:root {
  --brand: #1d7a5f;
  --brand-dark: #155c47;
  --brand-light: #e8f5f0;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #7a8088;
  --line: #e5e7eb;
  --red: #d94848;
  --blue: #2b6cb0;
  --amber: #b7791f;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 76px; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }
button { font-family: inherit; cursor: pointer; border: 0; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* ---- 로고 ---- */
.brandbar { display: flex; align-items: center; gap: 7px; }
.logo-mark { height: 30px; width: auto; display: block; }
.logo-word { font-weight: 900; font-size: 23px; color: #2fb84f; letter-spacing: -1px; line-height: 1; }
.logo-word i { font-style: normal; color: #383d42; }
.logo-sub { font-weight: 800; font-size: 12.5px; color: #3c4146; letter-spacing: -0.3px; align-self: flex-end; padding-bottom: 2px; }

/* ---- 로그인 ---- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 28px; }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .lmark { display: flex; justify-content: center; margin-bottom: 8px; }
.login-logo .lmark .logo-mark { height: 84px; }
.login-logo .logo-word { font-size: 34px; }
.login-logo .logo-sub { font-size: 15px; padding-bottom: 4px; }
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 8px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form input { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.login-form input:focus { outline: 2px solid var(--brand); border-color: transparent; }

/* ---- 헤더 / 탭 ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; color: var(--text); padding: calc(11px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.topbar .sub { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: 3px; }
.topbar .right { display: flex; gap: 6px; align-items: center; }
.icon-btn { background: #f0f2f4; color: #444; border-radius: 10px; padding: 7px 10px; font-size: 15px; position: relative; }
.badge-dot { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #e0483f; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; background: none; padding: 9px 0 7px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabbar button .ico { font-size: 20px; line-height: 1.1; }
.tabbar button.on { color: var(--brand); font-weight: 700; }

/* ---- 공용 ---- */
.page { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h3 { font-size: 15px; margin-bottom: 10px; letter-spacing: -0.3px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12.5px; }
.b { font-weight: 700; }
.amt { font-variant-numeric: tabular-nums; font-weight: 700; }
.btn { background: var(--brand); color: #fff; border-radius: 12px; padding: 13px 16px; font-size: 15px; font-weight: 700; width: 100%; }
.btn:disabled { background: #c3cbc8; }
.btn.sm { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: var(--brand-light); color: var(--brand-dark); }
.btn.gray { background: #eef0f2; color: #444; }
.btn.danger { background: #fdecec; color: var(--red); }
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.st-placed { background: #fff4e0; color: var(--amber); }
.st-billed { background: #e7efff; color: var(--blue); }
.st-paid { background: var(--brand-light); color: var(--brand-dark); }
.st-shipped { background: #e9e9f7; color: #5a5ab0; }
.st-canceled { background: #f2f2f2; color: #999; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); gap: 8px; }
.list-item:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; font-size: 14px; }
.seg { display: flex; background: #eceff1; border-radius: 11px; padding: 3px; gap: 3px; overflow-x: auto; }
.seg button { flex: 1; background: none; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar input[type=month], .toolbar select, .toolbar input[type=search] { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 7px 6px; border-bottom: 1px solid var(--line); font-size: 12px; }
.table td { padding: 8px 6px; border-bottom: 1px solid #f0f1f3; }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.twrap { overflow-x: auto; }

/* ---- 발주 (상품 리스트) ---- */
.brand-head { background: var(--brand-light); color: var(--brand-dark); font-weight: 800; padding: 9px 14px; border-radius: 10px; font-size: 14px; margin-top: 4px; }
.prod { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.pimg { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: #f2f3f5; cursor: pointer; }
.prod:last-child { border-bottom: 0; }
.prod .info { flex: 1; min-width: 0; }
.prod .nm { font-weight: 600; font-size: 14.5px; }
.prod .pr { color: var(--brand-dark); font-weight: 700; font-size: 13.5px; }
.qty { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 36px; height: 36px; background: #f7f8f9; font-size: 18px; color: #555; }
.qty input { width: 44px; height: 36px; border: 0; text-align: center; font-weight: 700; font-size: 15px; }
.qty input:focus { outline: none; background: var(--brand-light); }
.cartbar { position: fixed; bottom: 62px; left: 50%; transform: translateX(-50%); width: calc(100% - 24px); max-width: 616px; z-index: 25; }
.cartbar button { width: 100%; display: flex; justify-content: space-between; padding: 15px 18px; border-radius: 14px; background: var(--brand); color: #fff; font-size: 15px; font-weight: 700; box-shadow: 0 6px 18px rgba(21,92,71,.35); }

/* ---- 모달 ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }

/* ---- 좌측 메뉴 (삼선 드로어) ---- */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; left: 0; bottom: 0; width: 78%; max-width: 300px; background: #fff; box-shadow: 4px 0 24px rgba(0,0,0,.18); transform: translateX(-102%); transition: transform .22s ease; display: flex; flex-direction: column; padding: calc(18px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
.drawer-bg.open .drawer { transform: translateX(0); }
.drawer-head { padding: 4px 10px 16px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.drawer-item { display: flex; align-items: center; gap: 12px; width: 100%; background: none; padding: 13px 12px; border-radius: 12px; font-size: 15px; color: var(--text); text-align: left; }
.drawer-item .ico { font-size: 18px; width: 24px; text-align: center; }
.drawer-item.on { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.drawer-item:active { background: #f0f2f4; }
.drawer-item.danger { color: var(--red); }
.drawer-sep { height: 1px; background: var(--line); margin: 10px 6px; }

/* ---- 토스트 ---- */
#toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: #2b2f33; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13.5px; z-index: 99; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; }

/* ---- 알림 ---- */
.noti { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.noti .t { font-weight: 700; font-size: 14px; }
.noti.unread .t::before { content: "●"; color: var(--brand); font-size: 9px; margin-right: 6px; vertical-align: 2px; }
.noti .d { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ---- 정산 요약 ---- */
.sum-hero { background: linear-gradient(135deg, var(--brand), #2b9d7c); color: #fff; border-radius: var(--radius); padding: 18px; }
.sum-hero .lb { font-size: 12.5px; opacity: .9; }
.sum-hero .v { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-top: 2px; }
.sum-hero .meta { margin-top: 10px; font-size: 12.5px; opacity: .92; display: flex; gap: 14px; flex-wrap: wrap; }
