:root {
  color-scheme: light;
  --navy: #173b67;
  --blue: #245f9e;
  --ink: #172235;
  --muted: #52647a;
  --line: #d8e1ec;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --low: #a45a00;
  --danger: #b42318;
  font-family: "Pretendard", "맑은 고딕", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  min-height: 72px; padding: 12px max(18px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  color: white; background: var(--navy); box-shadow: 0 2px 8px #0b29484d;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { border-radius: 12px; background: white; padding: 4px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { margin-top: 2px; color: #dce8f7; font-size: 12px; }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; }

main { width: min(1180px, calc(100% - 28px)); margin: 24px auto 56px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px #1c3c5a12; }
.login-wrap { min-height: calc(100vh - 150px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 30px; }
.eyebrow { color: var(--blue); font-weight: 800; font-size: 13px; }
.login-card h1 { margin: 8px 0; font-size: 25px; }
.login-card p { color: var(--muted); line-height: 1.6; }
.login-card label { display: grid; gap: 7px; margin-top: 16px; font-size: 14px; font-weight: 700; }
input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #aebdcd; border-radius: 9px; color: var(--ink); background: white; }
input:focus { outline: 3px solid #2b72bd2b; border-color: #2b72bd; }
.error { min-height: 22px; color: var(--danger) !important; font-weight: 700; }

.primary, .secondary, .ghost { min-height: 42px; border-radius: 9px; padding: 0 16px; font-weight: 800; }
.primary { width: 100%; border: 1px solid var(--blue); color: white; background: var(--blue); }
.secondary { border: 1px solid #9fb0c3; color: var(--ink); background: #f9fbfd; }
.ghost { min-height: 36px; border: 1px solid #a9c0db; color: white; background: transparent; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { padding: 17px 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; margin-top: 6px; font-size: 26px; }
.metric.warning strong { color: var(--low); }
.metric.danger strong { color: var(--danger); }

.tabs { display: flex; gap: 7px; margin: 18px 0 10px; }
.tab { min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 800; }
.tab.active { border-color: #b7cadf; color: var(--navy); background: white; }
.badge { display: inline-grid; place-items: center; min-width: 21px; min-height: 21px; padding: 0 5px; border-radius: 999px; color: white; background: var(--danger); font-size: 11px; }
.content-card { padding: 17px; }
.toolbar, .section-heading { display: flex; align-items: end; gap: 12px; margin-bottom: 14px; }
.toolbar .search { flex: 1; display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.toolbar .check { display: flex; align-items: center; gap: 7px; min-height: 44px; white-space: nowrap; }
.toolbar .check input { width: 18px; min-height: 18px; }
.section-heading { align-items: center; justify-content: space-between; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.inventory-list, .alerts-list { display: grid; gap: 8px; }
.stock-row, .alert-row { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(4, 110px); align-items: center; gap: 10px; min-height: 68px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px; }
.stock-row.low { border-color: #e6bd77; background: #fff9ed; }
.stock-row.out_of_stock, .alert-row.out_of_stock { border-color: #efb4ae; background: #fff3f2; }
.product-name strong, .product-name span { display: block; }
.product-name span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.number { text-align: right; }
.number span, .number strong { display: block; }
.number span { color: var(--muted); font-size: 11px; }
.number strong { margin-top: 2px; font-size: 17px; }
.alert-row { grid-template-columns: minmax(260px, 1fr) 120px 120px; }
.alert-state { color: var(--danger); font-weight: 900; text-align: right; }
.empty { padding: 38px 18px; color: var(--muted); text-align: center; border: 1px dashed #b9c7d6; border-radius: 11px; }
.footnote { color: var(--muted); text-align: center; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 17px; border-radius: 10px; color: white; background: #172235; box-shadow: 0 8px 30px #0004; }

@media (max-width: 760px) {
  main { width: min(100% - 20px, 680px); margin-top: 14px; }
  .brand span { display: none; }
  .account span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .metric { padding: 13px; }
  .metric strong { font-size: 21px; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .toolbar .search { flex-basis: 100%; }
  .stock-row { grid-template-columns: 1fr 1fr 1fr; }
  .product-name { grid-column: 1 / -1; }
  .number { text-align: left; }
  .number:nth-of-type(4) { display: none; }
  .alert-row { grid-template-columns: 1fr 90px; }
  .alert-row .product-name { grid-column: 1; }
  .alert-row .number { display: none; }
}
