:root {
  --brand: #73162d;
  --brand-deep: #4e0d20;
  --brand-soft: #f4e8ec;
  --brand-pale: #fbf5f7;
  --ink: #231a1d;
  --muted: #70676a;
  --line: #e5dedf;
  --surface: #ffffff;
  --canvas: #f6f3f1;
  --amber: #b66b05;
  --amber-soft: #fff2dc;
  --green: #167553;
  --green-soft: #e7f5ef;
  --blue: #2462a7;
  --blue-soft: #eaf2fb;
  --red: #ba3434;
  --red-soft: #fdeaea;
  --shadow: 0 8px 28px rgba(63, 28, 39, 0.07);
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar-w: 244px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; writing-mode: horizontal-tb; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
strong, b, span, small, p, label, th, td { writing-mode: horizontal-tb; text-orientation: mixed; }

.app-shell { min-height: 100vh; }
.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(250,220,228,.4), transparent 28rem),
    linear-gradient(135deg, #4e0d20 0 42%, #71152c 42% 60%, #f6f3f1 60% 100%);
}
.login-card { width: min(100%, 460px); padding: 34px; border: 1px solid rgba(255,255,255,.65); border-radius: 26px; background: rgba(255,255,255,.98); box-shadow: 0 28px 80px rgba(49,8,20,.25); }
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 34px; }
.login-brand img { width: 54px; height: 54px; border-radius: 12px; box-shadow: 0 8px 20px rgba(78,13,32,.2); }
.login-brand div { display: flex; flex-direction: column; }
.login-brand strong { color: var(--brand); font-size: 1.25rem; letter-spacing: -.04em; }
.login-brand span { margin-top: 2px; color: var(--muted); font-size: .8rem; }
.login-copy > span { color: var(--brand); font-size: .74rem; font-weight: 850; letter-spacing: .05em; }
.login-copy h1 { margin: 8px 0 8px; font-size: 2rem; letter-spacing: -.055em; }
.login-copy p { margin-bottom: 24px; color: var(--muted); font-size: .9rem; }
.login-form { display: grid; gap: 16px; }
.login-form > label { display: grid; gap: 7px; color: #51474a; font-size: .8rem; font-weight: 800; }
.login-form input { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: #fff; font-size: 1rem; }
.login-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(115,22,45,.1); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 58px; }
.password-field button { position: absolute; top: 7px; right: 7px; min-width: 46px; height: 36px; border: 0; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-size: .75rem; font-weight: 800; }
.login-submit { width: 100%; min-height: 52px; margin-top: 2px; font-size: .95rem; }
.login-error { margin: -3px 0 0; padding: 10px 12px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: .78rem; font-weight: 750; }
.login-help { margin: 18px 0 0; color: var(--muted); font-size: .75rem; text-align: center; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  padding: 22px 16px 16px;
  color: #fdf7f9;
  background: linear-gradient(180deg, #651126 0%, #4a0c1d 100%);
}

.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 9px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.brand span { display: flex; min-width: 0; flex-direction: column; line-height: 1.25; }
.brand strong { font-size: 1.05rem; letter-spacing: -.03em; white-space: nowrap; }
.brand small { margin-top: 3px; font-size: .73rem; opacity: .7; white-space: nowrap; }
.brand--desktop { padding: 2px 8px 24px; }
.brand--mobile { display: none; }

.side-nav { min-height: 0; flex: 1; overflow: auto; scrollbar-width: none; }
.side-nav::-webkit-scrollbar { display: none; }
.nav-section { margin-bottom: 22px; }
.nav-section > p { margin: 0 10px 7px; color: rgba(255,255,255,.46); font-size: .72rem; font-weight: 700; letter-spacing: .08em; }
.nav-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 12px;
  color: rgba(255,255,255,.74);
  font-size: .92rem;
  font-weight: 650;
  white-space: nowrap;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.is-active { color: #fff; background: rgba(255,255,255,.14); box-shadow: inset 3px 0 #efc3cf; }
.nav-icon { display: grid; width: 23px; place-items: center; font-size: 1.18rem; font-weight: 500; }
.nav-count { margin-left: auto; min-width: 21px; padding: 2px 6px; border-radius: 20px; color: #5e1024; background: #fff; font-size: .68rem; text-align: center; }
.nav-count--warn { color: #693d05; background: #ffdca3; }
.side-footer { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 13px 8px 3px; border-top: 1px solid rgba(255,255,255,.12); }
.side-footer > div:nth-child(2) { min-width: 0; }
.side-footer strong, .side-footer small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-footer strong { font-size: .82rem; }
.side-footer small { margin-top: 2px; color: rgba(255,255,255,.58); font-size: .69rem; }
.user-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: var(--brand-deep); background: #f9dce4; font-size: .83rem; font-weight: 800; }
.account-actions { display: flex; }
.logout-icon { color: rgba(255,255,255,.76); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-w); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 68px;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(20px, 3.5vw, 50px);
  border-bottom: 1px solid rgba(101, 77, 85, .1);
  background: rgba(246,243,241,.92);
  backdrop-filter: blur(14px);
}
.topbar-spacer { flex: 1; }
.session-badge { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.session-badge span { color: var(--muted); font-size: .72rem; }
.session-badge strong { color: var(--brand); font-size: .78rem; white-space: nowrap; }
.top-logout { min-height: 38px; padding: 7px 11px; }
.icon-button { display: inline-grid; min-width: 38px; height: 38px; place-items: center; padding: 0; border: 0; border-radius: 11px; color: inherit; background: transparent; }
.notification-button { position: relative; border: 1px solid var(--line); background: var(--surface); color: var(--brand); }
.notification-button i { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: #e14a4a; }
.content { width: min(1420px, 100%); margin: 0 auto; padding: 30px clamp(20px, 3.5vw, 50px) 54px; outline: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(1.55rem, 2.3vw, 2rem); letter-spacing: -.045em; line-height: 1.2; }
.page-head p { margin: 0; color: var(--muted); font-size: .91rem; }
.head-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.eyebrow { display: inline-flex; margin-bottom: 9px; color: var(--brand); font-size: .72rem; font-weight: 850; letter-spacing: .06em; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-size: .78rem; font-weight: 700; white-space: nowrap; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; font-size: .86rem; font-weight: 800; white-space: nowrap; transition: transform .15s, box-shadow .15s, background .15s; }
.button:active { transform: translateY(1px); }
.button--primary { color: #fff; background: var(--brand); box-shadow: 0 7px 18px rgba(115,22,45,.18); }
.button--primary:hover { background: var(--brand-deep); }
.button--secondary { border-color: var(--line); background: #fff; }
.button--ghost { color: var(--brand); background: var(--brand-soft); }
.button--danger { color: var(--red); background: var(--red-soft); }
.button--small { min-height: 34px; padding: 6px 10px; border-radius: 9px; font-size: .75rem; }
.button:disabled { cursor: not-allowed; opacity: .48; box-shadow: none; }

.notice-strip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; margin-bottom: 18px; padding: 13px 16px; border: 1px solid #ead4da; border-radius: var(--radius-md); background: linear-gradient(90deg, #fff 0%, var(--brand-pale) 100%); }
.notice-strip > b:first-child { color: var(--brand); font-size: .75rem; }
.notice-strip p { margin: 0; overflow: hidden; font-size: .84rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.notice-strip button { border: 0; color: var(--muted); background: transparent; font-size: .74rem; font-weight: 700; white-space: nowrap; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; min-width: 0; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 2px 12px rgba(57, 32, 41, .03); }
.metric-card::after { position: absolute; right: -22px; bottom: -30px; width: 82px; height: 82px; border-radius: 50%; background: var(--metric-tint, var(--brand-soft)); content: ""; }
.metric-card .metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .79rem; font-weight: 700; }
.metric-card .metric-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--metric-color, var(--brand)); }
.metric-value { position: relative; z-index: 1; margin: 13px 0 6px; font-size: 1.72rem; font-weight: 900; letter-spacing: -.04em; line-height: 1; white-space: nowrap; }
.metric-value small { margin-left: 3px; font-size: .77rem; font-weight: 700; }
.metric-delta { position: relative; z-index: 1; color: var(--muted); font-size: .72rem; }
.metric-delta b { color: var(--green); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 2px 12px rgba(57,32,41,.025); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px 13px; }
.panel-head h2 { margin: 0; font-size: 1rem; letter-spacing: -.025em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: .72rem; }
.panel-head button, .link-button { padding: 5px; border: 0; color: var(--brand); background: transparent; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.panel-body { padding: 0 20px 20px; }

.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 11px; padding: 13px 0; border-top: 1px solid #eee8e9; }
.timeline-time { color: var(--muted); font-size: .72rem; font-weight: 700; }
.timeline-main { min-width: 0; }
.timeline-main strong, .timeline-main span { display: block; }
.timeline-main strong { overflow: hidden; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.timeline-main span { margin-top: 3px; color: var(--muted); font-size: .72rem; }

.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; font-size: .69rem; font-weight: 850; white-space: nowrap; }
.status::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status--green { color: var(--green); background: var(--green-soft); }
.status--amber { color: var(--amber); background: var(--amber-soft); }
.status--blue { color: var(--blue); background: var(--blue-soft); }
.status--red { color: var(--red); background: var(--red-soft); }
.status--gray { color: #746e70; background: #efedee; }

.task-list { display: grid; gap: 9px; }
.task-card { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; padding: 12px; border-radius: 13px; background: #faf8f8; }
.task-num { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--brand); background: var(--brand-soft); font-size: .83rem; font-weight: 900; }
.task-card strong, .task-card small { display: block; }
.task-card strong { font-size: .79rem; }
.task-card small { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.task-card button { border: 0; color: var(--brand); background: transparent; font-size: 1rem; }

.deadline-card { padding: 19px; border: 0; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(140deg, #7b1730, #4c0e20); box-shadow: var(--shadow); }
.deadline-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.deadline-top p { margin: 0; color: rgba(255,255,255,.72); font-size: .76rem; }
.deadline-top b { padding: 5px 8px; border-radius: 20px; color: #6d1128; background: #f9d9e2; font-size: .65rem; }
.deadline-time { display: flex; align-items: baseline; gap: 7px; margin: 17px 0 4px; }
.deadline-time strong { font-size: 2.05rem; letter-spacing: -.05em; }
.deadline-time span { color: rgba(255,255,255,.72); font-size: .78rem; }
.deadline-bar { height: 6px; margin-top: 15px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.16); }
.deadline-bar i { display: block; width: 72%; height: 100%; border-radius: inherit; background: #fff; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.quick-card { min-height: 88px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; }
.quick-card span { display: block; margin-bottom: 12px; color: var(--brand); font-size: 1.15rem; }
.quick-card strong { display: block; font-size: .76rem; }
.quick-card small { display: block; margin-top: 3px; color: var(--muted); font-size: .67rem; }

.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.filter-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: -3px 0 13px; }
.filter-summary span { padding: 7px 10px; border: 1px solid #e5d7db; border-radius: 999px; color: var(--brand); background: var(--brand-pale); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.search { position: relative; min-width: 220px; flex: 1; }
.search::before { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: #958d90; content: "⌕"; }
.search input, .field input, .field select, .field textarea, .select-control { width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #fff; transition: border .15s, box-shadow .15s; }
.search input { padding: 9px 13px 9px 37px; }
.search input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(115,22,45,.08); }
.select-control { width: auto; min-width: 132px; padding: 8px 32px 8px 11px; font-size: .8rem; }
.period-filter-button { min-height: 43px; padding-inline: 14px; white-space: nowrap; }

.segmented { display: inline-flex; gap: 3px; padding: 4px; border-radius: 12px; background: #ebe6e7; }
.segmented button { min-height: 34px; padding: 7px 12px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.segmented button.is-active { color: var(--brand); background: #fff; box-shadow: 0 2px 8px rgba(55,30,39,.08); }

.catalog-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; color: var(--muted); font-size: .77rem; }
.catalog-meta b { color: var(--ink); }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #fff; transition: transform .18s, box-shadow .18s; }
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.product-visual { position: relative; display: grid; height: 118px; place-items: center; overflow: hidden; background: var(--visual-bg, #f5ecef); }
.product-visual::before, .product-visual::after { position: absolute; border-radius: 50%; content: ""; }
.product-visual::before { width: 94px; height: 94px; background: var(--fruit-color, #d84b56); box-shadow: inset -15px -12px 0 rgba(80,0,20,.12), 0 13px 24px rgba(83,36,42,.11); }
.product-visual::after { top: 22px; left: 50%; width: 18px; height: 8px; transform: translateX(-8px) rotate(-23deg); border-radius: 70% 10% 70% 10%; background: #3f8243; }
.product-visual[data-kind="box"]::before { width: 118px; height: 70px; border-radius: 10px; background: var(--fruit-color, #c98e4a); box-shadow: inset 0 -10px rgba(80,40,0,.1), 0 13px 24px rgba(83,36,42,.11); transform: rotate(-2deg); }
.product-visual[data-kind="box"]::after { width: 92px; height: 5px; top: 50%; left: 50%; border-radius: 0; background: rgba(255,255,255,.6); transform: translate(-50%,-50%); }
.product-badge { position: absolute; z-index: 2; top: 9px; left: 9px; padding: 4px 7px; border-radius: 7px; color: #fff; background: rgba(70,18,32,.82); font-size: .62rem; font-weight: 800; }
.product-info { padding: 14px; }
.product-info > small { color: var(--muted); font-size: .67rem; }
.product-info h3 { min-height: 39px; margin: 5px 0 9px; font-size: .88rem; line-height: 1.4; }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.price-row strong { font-size: 1rem; letter-spacing: -.03em; }
.price-row span { color: var(--muted); font-size: .68rem; }
.product-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; }
.stock-label { color: var(--green); font-size: .68rem; font-weight: 800; }
.stock-label.is-low { color: var(--red); }
.stepper { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.stepper button { display: grid; width: 31px; height: 31px; place-items: center; border: 0; background: #faf8f8; font-size: 1rem; }
.stepper b { min-width: 28px; text-align: center; font-size: .76rem; }

.cart-float { position: fixed; right: 26px; bottom: 26px; z-index: 25; display: flex; min-width: 210px; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px; border: 0; border-radius: 15px; color: #fff; background: var(--brand); box-shadow: 0 12px 34px rgba(91,16,36,.28); }
.cart-float span { text-align: left; }
.cart-float small, .cart-float strong { display: block; }
.cart-float small { color: rgba(255,255,255,.7); font-size: .66rem; }
.cart-float strong { margin-top: 2px; font-size: .88rem; }
.cart-float b { display: grid; min-width: 32px; height: 32px; place-items: center; border-radius: 50%; color: var(--brand); background: #fff; font-size: .76rem; }

.data-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 14px; color: var(--muted); background: #faf8f8; font-size: .7rem; font-weight: 800; text-align: left; white-space: nowrap; }
.data-table td { padding: 14px; border-top: 1px solid #eee9ea; font-size: .79rem; vertical-align: middle; }
.data-table td strong { font-size: .81rem; }
.data-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: .66rem; }
.data-table tr:hover td { background: #fdfbfc; }
.table-actions { display: flex; align-items: center; gap: 5px; }
.purchase-table-panel { overflow-x: auto; }
.purchase-table { min-width: 1160px; }
.purchase-product-cell { min-width: 190px; }
.data-table td .purchase-product-name { display: block; font-size: .96rem; line-height: 1.4; white-space: normal; }
.data-table td .purchase-order-id { margin-top: 5px; font-size: .66rem; font-weight: 650; letter-spacing: .02em; }
.delete-confirm { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: start; gap: 13px; padding: 16px; border: 1px solid #f0cbd2; border-radius: 14px; background: #fff5f7; }
.delete-confirm > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: #fff; background: var(--red); font-size: 1rem; font-weight: 900; }
.delete-confirm strong { display: block; margin-top: 1px; font-size: .9rem; }
.delete-confirm p { margin: 6px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.money { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.payment-amount { color: var(--green) !important; }
.balance-amount { color: var(--brand) !important; }
.muted { color: var(--muted); }
.filter-help { margin: 14px 0 0; font-size: .76rem; line-height: 1.55; }
.settlement-close-filter { margin-bottom: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #faf8f8; }
.settlement-close-filter .button { width: 100%; }
.payment-entry { margin-top: 16px; }
.section-title { margin: 0 0 10px; font-size: .86rem; }
.section-title--spaced { margin-top: 22px; }

.inventory-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.mini-stat { padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.mini-stat small { display: block; color: var(--muted); font-size: .7rem; }
.mini-stat strong { display: block; margin-top: 7px; font-size: 1.12rem; letter-spacing: -.03em; }
.stock-meter { width: 100%; min-width: 84px; height: 7px; overflow: hidden; border-radius: 10px; background: #eee9ea; }
.stock-meter i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.stock-meter.is-low i { background: var(--red); }

.group-list { display: grid; gap: 12px; }
.order-group { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.order-group-head { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 14px; padding: 15px 17px; background: #faf8f8; }
.order-group-head strong, .order-group-head small { display: block; }
.order-group-head strong { font-size: .88rem; }
.order-group-head small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.order-total { font-size: .86rem; font-weight: 850; white-space: nowrap; }
.order-items { display: grid; }
.order-item { display: grid; grid-template-columns: minmax(0, 1fr) 90px 105px; align-items: center; gap: 12px; padding: 12px 17px; border-top: 1px solid #eee9ea; font-size: .76rem; }
.order-item:first-child { border-top: 0; }
.order-item strong { font-size: .78rem; }
.order-item span { color: var(--muted); text-align: right; }
.order-group-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 12px 17px; border-top: 1px solid #eee9ea; }

.tabs { display: flex; gap: 18px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { position: relative; padding: 9px 1px 12px; border: 0; color: var(--muted); background: transparent; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.tabs button.is-active { color: var(--brand); }
.tabs button.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--brand); content: ""; }

.alert-list { display: grid; gap: 10px; }
.alert-card { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.alert-symbol { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--brand); background: var(--brand-soft); font-size: 1rem; font-weight: 900; }
.alert-card.is-unread { border-color: #dcbac4; background: var(--brand-pale); }
.alert-main { min-width: 0; }
.alert-main strong { display: block; font-size: .83rem; }
.alert-main p { margin: 4px 0 0; color: var(--muted); font-size: .74rem; }
.alert-card time { color: var(--muted); font-size: .67rem; white-space: nowrap; }

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-card { display: flex; min-height: 116px; flex-direction: column; justify-content: space-between; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; text-align: left; }
.menu-card:hover { border-color: #d5b0ba; box-shadow: var(--shadow); }
.menu-card > span { color: var(--brand); font-size: 1.25rem; }
.menu-card strong { display: block; margin-top: 17px; font-size: .83rem; }
.menu-card small { display: block; margin-top: 4px; color: var(--muted); font-size: .68rem; }

.sheet-layer, .modal-layer { position: fixed; inset: 0; z-index: 70; display: none; }
.sheet-layer.is-open, .modal-layer.is-open { display: block; }
.sheet-backdrop, .modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(32,17,23,.42); backdrop-filter: blur(2px); }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 92vw); overflow: auto; border-radius: 22px 0 0 22px; background: #fff; box-shadow: -18px 0 50px rgba(35,16,23,.16); animation: slide-in .22s ease-out; }
.modal { position: absolute; top: 50%; left: 50%; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 36px); overflow: auto; transform: translate(-50%,-50%); border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(34,16,23,.24); animation: pop-in .18s ease-out; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
@keyframes pop-in { from { transform: translate(-50%,-48%) scale(.98); opacity: 0; } }
.sheet-head, .modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.sheet-head h2, .modal-head h2 { margin: 0; font-size: 1.08rem; }
.close-button { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 10px; background: #f3f0f1; font-size: 1.1rem; }
.sheet-body, .modal-body { padding: 20px; }
.sheet-foot, .modal-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }

.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.field { display: grid; gap: 7px; }
.field--full { grid-column: 1 / -1; }
.field label { color: #51474a; font-size: .75rem; font-weight: 800; }
.field input, .field select, .field textarea { padding: 9px 11px; }
.field textarea { min-height: 86px; resize: vertical; }
.field small { color: var(--muted); font-size: .66rem; }
.permission-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.permission-grid label { display: flex; min-height: 42px; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .75rem; }
.permission-grid input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--brand); }
.notification-optin { margin-top: 16px; padding: 16px; border: 1px solid #ead4da; border-radius: 14px; background: var(--brand-pale); }
.notification-optin strong { font-size: .86rem; }
.notification-optin p { margin: 5px 0 12px; color: var(--muted); font-size: .74rem; }
.required::after { margin-left: 3px; color: var(--red); content: "*"; }

.cart-list { display: grid; gap: 10px; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; }
.cart-item strong, .cart-item small { display: block; }
.cart-item strong { font-size: .8rem; }
.cart-item small { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.cart-item .money { margin-top: 8px; font-size: .79rem; }
.cart-summary { margin-top: 17px; padding: 16px; border-radius: 14px; background: var(--brand-pale); }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .78rem; }
.summary-row:first-child { margin-top: 0; }
.summary-row.total { margin-top: 13px; padding-top: 13px; border-top: 1px solid #e3cbd2; font-size: .92rem; font-weight: 900; }

.document { color: #241b1e; background: #fff; }
.document-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 2px solid var(--brand); }
.document-brand img { width: 52px; height: 52px; border-radius: 7px; }
.document-brand strong { font-size: 1.2rem; }
.document-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.document h3 { margin: 22px 0 10px; font-size: .87rem; }
.doc-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 20px; padding: 14px 0; }
.doc-row { display: flex; justify-content: space-between; gap: 12px; font-size: .75rem; }
.doc-row span { color: var(--muted); }

.empty-state { display: grid; min-height: 250px; place-items: center; align-content: center; padding: 34px; color: var(--muted); text-align: center; }
.empty-symbol { display: grid; width: 52px; height: 52px; place-items: center; margin-bottom: 13px; border-radius: 17px; color: var(--brand); background: var(--brand-soft); font-size: 1.25rem; }
.empty-state strong { color: var(--ink); font-size: .9rem; }
.empty-state p { margin: 7px 0 0; font-size: .75rem; }

.toast-region { position: fixed; right: 22px; bottom: 24px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 260px; max-width: 380px; padding: 13px 15px; border-radius: 12px; color: #fff; background: #2e2226; box-shadow: 0 12px 30px rgba(30,13,19,.25); font-size: .79rem; font-weight: 750; animation: toast-in .2s ease-out; }
.toast.is-success { background: #155f48; }
.toast.is-error { background: #9d2f36; }
.toast--confirm { min-width: 340px; padding: 15px; pointer-events: auto; background: #35272c; }
.toast-confirm-copy strong, .toast-confirm-copy span { display: block; }
.toast-confirm-copy strong { font-size: .88rem; }
.toast-confirm-copy span { margin-top: 5px; color: rgba(255,255,255,.72); font-size: .7rem; font-weight: 650; }
.toast-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 13px; }
.toast-confirm-actions button { min-height: 36px; border: 0; border-radius: 9px; color: #35272c; background: #fff; font-size: .75rem; font-weight: 850; }
.toast-confirm-actions button:last-child { color: #fff; background: #c43d4a; }
.toast-confirm-actions button:focus-visible { outline: 3px solid rgba(255,255,255,.6); outline-offset: 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.bottom-nav { display: none; }
.mobile-only { display: none !important; }
.branch-mode .hq-only { display: none !important; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0,1.25fr) minmax(260px,.75fr); }
}

@media (max-width: 767px) {
  .login-screen { place-items: end center; padding: 16px 10px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, #5b0e23 0 31%, #f6f3f1 31% 100%); }
  .login-card { width: 100%; padding: 24px 20px; border-radius: 24px; }
  .login-brand { margin-bottom: 24px; }
  .login-copy h1 { font-size: 1.7rem; }
  .login-copy p { margin-bottom: 20px; }
  .session-badge { max-width: 122px; flex-direction: column; align-items: flex-end; gap: 0; border: 0; padding: 0; background: transparent; }
  .session-badge span, .session-badge strong { display: block; max-width: 122px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-logout { display: none; }
  :root { --radius-lg: 16px; }
  body { background: #faf8f7; }
  .sidebar { display: none; }
  .workspace { margin-left: 0; }
  .topbar { height: 60px; padding: 0 14px; background: rgba(255,255,255,.94); }
  .brand--mobile { display: inline-flex; }
  .brand--mobile img { width: 36px; height: 36px; border-radius: 7px; }
  .brand--mobile strong { font-size: .89rem; }
  .brand--mobile small { font-size: .61rem; }
  .role-switch { padding-left: 7px; }
  .role-switch > span { display: none; }
  .role-switch select { max-width: 76px; font-size: .74rem; }
  .notification-button { min-width: 36px; height: 36px; }
  .content { padding: 20px 14px calc(92px + env(safe-area-inset-bottom)); }
  .page-head { flex-direction: column; gap: 12px; margin-bottom: 17px; }
  .page-head h1 { margin-bottom: 5px; font-size: 1.38rem; }
  .page-head p { max-width: 250px; font-size: .78rem; line-height: 1.5; }
  .eyebrow { margin-bottom: 6px; font-size: .66rem; }
  .head-actions { width: 100%; }
  .head-actions:empty { display: none; }
  .head-actions .button { min-width: 0; min-height: 38px; flex: 1; padding: 7px 11px; font-size: .75rem; }
  .date-chip { display: none; }
  .notice-strip { grid-template-columns: auto minmax(0,1fr); gap: 9px; margin-bottom: 13px; padding: 11px 13px; }
  .notice-strip p { font-size: .75rem; }
  .notice-strip button { display: none; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 13px; }
  .metric-card { padding: 15px 13px; border-radius: 15px; }
  .metric-card .metric-label { font-size: .69rem; }
  .metric-value { margin: 12px 0 6px; font-size: 1.38rem; }
  .metric-value small { font-size: .67rem; }
  .metric-delta { font-size: .63rem; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 13px; }
  .dashboard-grid > div:last-child { display: grid; gap: 13px; }
  .panel + .panel { margin-top: 13px; }
  .panel-head { padding: 15px 14px 11px; }
  .panel-body { padding: 0 14px 15px; }
  .timeline-item { grid-template-columns: 39px minmax(0,1fr) auto; gap: 8px; padding: 11px 0; }
  .timeline-main strong { font-size: .76rem; }
  .timeline-main span, .timeline-time { font-size: .64rem; }
  .status { padding: 4px 6px; font-size: .61rem; }
  .task-card { grid-template-columns: 34px minmax(0,1fr) auto; padding: 10px; }
  .task-num { width: 32px; height: 32px; border-radius: 9px; font-size: .75rem; }
  .deadline-card { padding: 16px; }
  .deadline-time { margin-top: 12px; }
  .deadline-time strong { font-size: 1.75rem; }
  .toolbar { flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
  .search { width: 100%; min-width: 100%; order: -1; }
  .search input { min-height: 41px; font-size: .8rem; }
  .select-control { min-width: 0; flex: 1; min-height: 39px; font-size: .74rem; }
  .toolbar .period-filter-button { min-height: 39px; flex: 1; padding-inline: 10px; font-size: .74rem; }
  .segmented { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex: 1; padding-inline: 8px; }
  .catalog-meta { font-size: .7rem; }
  .product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .product-card { border-radius: 14px; }
  .product-visual { height: 93px; }
  .product-visual::before { width: 69px; height: 69px; }
  .product-visual::after { top: 16px; }
  .product-visual[data-kind="box"]::before { width: 88px; height: 53px; }
  .product-badge { top: 7px; left: 7px; font-size: .56rem; }
  .product-info { padding: 11px; }
  .product-info h3 { min-height: 36px; margin: 4px 0 7px; font-size: .77rem; }
  .price-row strong { font-size: .86rem; }
  .product-actions { margin-top: 10px; }
  .stock-label { display: none; }
  .stepper { margin-left: auto; }
  .stepper button { width: 29px; height: 29px; }
  .cart-float { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 14px; min-width: 0; }
  .inventory-summary { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .mini-stat { padding: 12px 10px; }
  .mini-stat small { font-size: .62rem; }
  .mini-stat strong { margin-top: 6px; font-size: .92rem; }
  .data-panel { border: 0; overflow: visible; background: transparent; }
  .data-table, .data-table tbody { display: block; }
  .purchase-table { min-width: 0; }
  .data-table thead { display: none; }
  .data-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 12px; margin-bottom: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
  .data-table td { display: block; min-width: 0; padding: 0; border: 0; font-size: .74rem; }
  .data-table td::before { display: block; margin-bottom: 3px; color: var(--muted); font-size: .61rem; font-weight: 700; content: attr(data-label); }
  .data-table td[data-wide="true"] { grid-column: 1 / -1; }
  .data-table td[data-actions="true"] { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid #eee9ea; }
  .data-table td .button { width: 100%; }
  .data-table .table-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
  .order-group-head { grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 13px; }
  .order-group-head .status { grid-column: 2; grid-row: 1; }
  .order-total { grid-column: 1 / -1; font-size: .78rem; }
  .order-item { grid-template-columns: minmax(0,1fr) auto; gap: 7px; padding: 11px 13px; }
  .order-item span:nth-child(3) { grid-column: 1 / -1; text-align: left; font-size: .67rem; }
  .order-group-actions { padding: 11px 13px; }
  .alert-card { grid-template-columns: 38px minmax(0,1fr); padding: 12px; }
  .alert-symbol { width: 38px; height: 38px; }
  .alert-card time { grid-column: 2; }
  .menu-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .menu-card { min-height: 105px; padding: 14px; }
  .tabs { gap: 15px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; font-size: .75rem; }
  .sheet { top: auto; left: 0; width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; animation: sheet-up .22s ease-out; }
  @keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } }
  .modal { width: calc(100vw - 20px); max-height: calc(100vh - 24px); border-radius: 18px; }
  .sheet-head, .modal-head { padding: 16px; }
  .sheet-body, .modal-body { padding: 16px; }
  .sheet-foot, .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .sheet-foot .button, .modal-foot .button { flex: 1; }
  .field-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: auto; }
  .permission-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .doc-grid { grid-template-columns: 1fr; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 45; display: grid; grid-template-columns: repeat(5,1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 -8px 28px rgba(55,31,39,.07); backdrop-filter: blur(14px); }
  .bottom-nav a, .bottom-nav button { display: flex; min-width: 0; min-height: 47px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 10px; color: #8c8386; background: transparent; }
  .bottom-nav span { min-height: 21px; font-size: 1rem; line-height: 1; }
  .bottom-nav b { font-size: .62rem; font-weight: 800; white-space: nowrap; }
  .bottom-nav .is-active { color: var(--brand); background: var(--brand-pale); }
  .toast-region { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; }
  .toast { min-width: 0; width: 100%; }
  .mobile-only { display: initial !important; }
}

@media (max-width: 380px) {
  .content { padding-inline: 11px; }
  .topbar { padding-inline: 11px; gap: 7px; }
  .brand--mobile span { display: none; }
  .page-head p { max-width: 210px; }
  .metric-card { padding: 14px 11px; }
  .metric-value { font-size: 1.28rem; }
  .product-grid { gap: 7px; }
  .product-info { padding: 10px 8px; }
  .stepper button { width: 27px; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .bottom-nav, .page-head, .toolbar, .modal-backdrop, .modal-head, .modal-foot { display: none !important; }
  .workspace { margin: 0; }
  .content { padding: 0; }
  .modal-layer { position: static; display: block !important; }
  .modal { position: static; width: 100%; max-height: none; overflow: visible; transform: none; box-shadow: none; }
  .modal-body { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
