:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #1f6feb;
  --primary-dark: #174ea6;
  --danger: #dc2626;
  --danger-dark: #991b1b;
  --success: #15803d;
  --warning: #b45309;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-weight: 700; transition: .15s; }
button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15,23,42,.08); }
button.primary, .button-like.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: var(--danger-dark); }
button.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); width: 100%; }
button.link { border: none; background: transparent; color: var(--primary); padding-left: 0; box-shadow: none; }
.hidden { display: none !important; }
.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #fff; padding: 22px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg,#1f6feb,#22c55e); display: grid; place-items: center; font-weight: 900; }
.brand span { display: block; color: #cbd5e1; font-size: 13px; }
.nav { display: grid; gap: 8px; }
.nav button { text-align: left; background: transparent; color: #cbd5e1; border-color: transparent; }
.nav button.active, .nav button:hover { color: #fff; background: rgba(255,255,255,.09); transform: none; box-shadow: none; }
.main { padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.topbar h1 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 36px); }
.topbar p { margin: 0; color: var(--muted); }
.user-box { text-align: right; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; min-width: 220px; box-shadow: 0 8px 20px rgba(15,23,42,.05); }
.user-box strong { display: block; }
.user-box span { color: var(--muted); font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { margin: 0 0 12px; }
.card p { color: var(--muted); }
.auth-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: start; }
.hero-card { min-height: 360px; background: radial-gradient(circle at top left, rgba(31,111,235,.12), #fff 46%); }
.hero-card li { margin-bottom: 10px; color: #374151; }
.auth-card { max-width: 460px; width: 100%; justify-self: end; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: #f3f4f6; border-radius: 14px; padding: 6px; margin-bottom: 14px; }
.tabs button { border: none; background: transparent; box-shadow: none; }
.tabs button.active { background: #fff; color: var(--primary); }
.form { display: grid; gap: 12px; }
.form label, label { display: grid; gap: 7px; color: #374151; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; color: var(--text); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
.view { display: none; }
.view.active { display: block; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: 0 12px 25px rgba(15,23,42,.05); }
.kpi span { display: block; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.kpi strong { font-size: 32px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.scan-row, .search-row, .two-cols { display: grid; grid-template-columns: 1fr 160px; gap: 12px; align-items: end; }
.two-cols { grid-template-columns: 1fr 1fr; }
.barcode-input { font-size: 22px; letter-spacing: .04em; }
.switch { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; font-weight: 700; }
.switch input { width: auto; }
.result-box { margin-top: 16px; }
.product-preview { border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-top: 14px; display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; }
.product-preview.empty { display: block; color: var(--muted); }
.product-preview img, .thumb { width: 72px; height: 72px; object-fit: contain; border-radius: 14px; background: #f3f4f6; border: 1px solid var(--line); }
.split { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr); gap: 18px; align-items: start; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.list { display: grid; gap: 10px; margin-top: 14px; }
.item { border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; background: #fff; }
.item .meta { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 800; background: #eef2ff; color: #3730a3; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.orange { background: #ffedd5; color: #9a3412; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; background: #fff; min-width: 820px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f9fafb; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; }
tr.low td { background: #fff7ed; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compact-form { max-width: 620px; }
.checks, .field-config { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.checks label, .field-config label { display: flex; align-items: center; gap: 8px; padding: 10px; background: #f9fafb; border: 1px solid var(--line); border-radius: 12px; }
.checks input, .field-config input { width: auto; }
.toast { position: fixed; right: 22px; top: 22px; z-index: 50; max-width: min(760px, calc(100vw - 32px)); background: #111827; color: #fff; padding: 14px 16px; border-radius: 14px; box-shadow: var(--shadow); white-space: pre-wrap; word-break: break-word; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.verify-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.verify-card { max-width: 560px; text-align: center; }
.button-like { display: inline-block; text-decoration: none; border-radius: 12px; padding: 11px 14px; font-weight: 800; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .auth-grid, .split, .kpi-grid { grid-template-columns: 1fr; }
  .auth-card { justify-self: stretch; max-width: none; }
  .scan-row, .search-row, .two-cols { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .user-box { text-align: left; width: 100%; }
}

.button-row.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.muted {
  color: #64748b;
  font-size: .92rem;
  margin-top: -4px;
}

.access-card {
  max-width: 780px;
  margin: 40px auto;
  text-align: center;
}

.access-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: #ffedd5;
  color: #9a3412;
  font-size: 32px;
  font-weight: 900;
}

.notice-box {
  margin: 18px auto;
  padding: 16px;
  border: 1px solid #fed7aa;
  border-radius: 18px;
  background: #fff7ed;
  text-align: left;
  max-width: 620px;
}

.notice-box p {
  margin: 8px 0;
  color: #7c2d12;
}

.notice-box a {
  color: #1f6feb;
  font-weight: 900;
  text-decoration: none;
}
