:root {
  --red: #a42c15;
  --red-dark: #77200f;
  --red-deep: #4e1409;
  --red-soft: #fdeceb;
  --gold: #f0b429;
  --gold-deep: #9a6408;
  --gold-soft: #fff4d4;
  --ink: #1c1c1c;
  --body: #3e3d3d;
  --muted: #5e5854;
  --bg: #f7f4ef;
  --card: #ffffff;
  --line: #eadfce;
  --danger: #4a0d09;
  --shadow: 0 10px 28px rgba(80, 24, 10, 0.08);
  --radius: 18px;
  --nav-h: 76px;
  --sans: Mulish, "Segoe UI", sans-serif;
  --display: "Abril Fatface", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.gold { color: var(--gold-deep); }

.login {
  min-height: 100vh;
  display: grid;
  background: var(--bg);
}
.login-hero {
  padding: 36px 24px 72px;
  color: white;
  text-align: center;
  background-color: #a42c15;
  background-image:
    radial-gradient(circle at 18% 0%, rgba(240, 180, 41, 0.42), transparent 34%),
    linear-gradient(180deg, #a42c15 0%, #8d2612 55%, #6d1b0c 100%);
}
.logo-plate {
  display: inline-flex;
  background: white;
  border-radius: 50%;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.logo-plate img { width: 112px; height: 112px; object-fit: contain; }
.logo-plate.sm img { width: 48px; height: 48px; }
.logo-plate.xs { padding: 4px; }
.logo-plate.xs img { width: 36px; height: 36px; }
.slogan {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.15;
  margin: 18px 0 8px;
  font-weight: 400;
}
.login-card {
  margin: -40px 16px 32px;
  background: white;
  border-radius: 24px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow);
}
.eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-deep);
}
.login-card h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 700; }
.field span { font-size: 14px; }
.field input, .field select, .search input, .grow input {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  border: 1.5px solid #e4d3c4;
  background: #fffdfb;
  padding: 0 14px;
}
.field input:focus, .field select:focus, .search input:focus { border-color: var(--red); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 0;
  background: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--red); color: white; }
.btn.primary:hover { background: var(--red-dark); }
.btn.gold { background: var(--gold); color: var(--red-deep); }
.btn.danger { background: var(--danger); color: white; }
.btn.ghost { background: white; color: var(--red); border: 1.5px solid var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.fine { color: var(--muted); font-size: 13px; text-align: center; margin-top: 12px; }

.app-shell { min-height: 100vh; }
.sidebar { display: none; }
.mobile-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: white;
  border-bottom: 4px solid var(--gold);
}
.mobile-top strong { display: block; font-size: 15px; }
.mobile-top span { color: var(--muted); font-size: 12px; font-weight: 700; }
.content { padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 56px); }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.page-head h1 { font-size: 28px; letter-spacing: -0.03em; }
.user-chip { font-size: 13px; font-weight: 800; background: var(--gold-soft); color: var(--gold-deep); border-radius: 999px; padding: 6px 10px; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: white;
  border-top: 1px solid var(--line);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  min-height: 48px;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--red); }
.nav-scan {
  width: 62px;
  height: 62px;
  margin: -26px auto 0;
  border-radius: 50%;
  background: var(--red);
  color: white;
  border: 4px solid var(--gold);
  box-shadow: 0 8px 16px rgba(164, 44, 21, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
}
.nav-scan.active, .nav-scan:hover { background: var(--red-dark); color: white; }

.stat-grid, .qa-grid, .report-grid, .choice-grid { display: grid; gap: 12px; }
.stat-grid { grid-template-columns: 1fr 1fr; }
.stat, .panel, .item-row, .mv, .alert, .choice {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat {
  padding: 14px;
  text-decoration: none;
  color: inherit;
  display: block;
  min-height: 118px;
}
.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ico {
  width: 28px; height: 28px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red-soft); color: var(--red);
}
.ico.gold { background: var(--gold-soft); color: var(--gold-deep); }
.ico.danger { background: #f8e4e1; color: var(--danger); }
.ico svg, .mv-ico svg, .qa svg { width: 18px; height: 18px; }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -0.04em; margin-top: 10px; }
.stat-sub { color: var(--muted); font-size: 13px; font-weight: 700; }

.section-label { margin: 18px 0 10px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.qa-grid { grid-template-columns: 1fr 1fr; }
.qa {
  min-height: 86px;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-weight: 800;
}
.qa.primary { background: var(--red); color: white; }
.qa.scan { background: var(--gold); color: var(--red-deep); }
.qa.danger { box-shadow: inset 0 0 0 1.5px #e7b2aa; }
.qa span { font-weight: 700; color: inherit; opacity: 0.8; font-size: 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 4px 0 12px; }
.chip {
  flex: 0 0 auto;
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: white;
  color: var(--body);
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 14px;
}
.chip.active { background: var(--red); color: white; border-color: var(--red); }
.search { margin-bottom: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item-row, .choice, .mv, .alert {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  width: 100%;
  text-align: left;
  border: 0;
}
.choice { grid-template-columns: 64px 1fr auto; cursor: pointer; }
.thumb, .ph {
  width: 72px; height: 72px; border-radius: 16px; object-fit: cover; background: var(--gold-soft);
}
.ph {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--red); letter-spacing: 0.04em;
}
.choice .thumb, .choice .ph { width: 64px; height: 64px; }
.item-row small, .mv small, .choice small { display: block; color: var(--muted); font-weight: 700; }
.qty-col { text-align: right; font-weight: 800; }
.qty-col b { display: block; font-size: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 800; margin-top: 4px;
}
.pill.ok { background: var(--red-soft); color: var(--red-dark); }
.pill.warn { background: var(--gold-soft); color: var(--gold-deep); }
.pill.danger { background: var(--danger); color: white; }

.mv { grid-template-columns: 42px 1fr auto; }
.mv-ico {
  width: 42px; height: 42px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-soft); color: var(--red);
}
.mv-ico.gold { background: var(--gold-soft); color: var(--gold-deep); }
.mv-ico.danger { background: #f8e4e1; color: var(--danger); }
.mv-qty { font-weight: 800; text-align: right; }
.mv-qty.plus { color: var(--red); }
.mv-qty.minus { color: var(--danger); }

.alert { grid-template-columns: 10px 1fr auto; align-items: center; }
.alert small { display: block; color: var(--muted); font-weight: 700; }
.alert strong, .alert small { overflow-wrap: anywhere; }
.alert i { width: 10px; height: 42px; border-radius: 999px; display: block; background: var(--gold); }
.alert.danger i { background: var(--danger); }
.panel { padding: 16px; }
.panel + .panel, .stack > * + * { margin-top: 12px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.step {
  flex: 1; height: 8px; border-radius: 999px; background: #efe4d6; position: relative;
}
.step.on { background: var(--gold); }
.step.done { background: var(--red); }
.step-names { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--muted); margin: -6px 0 12px; }
.hero-num { font-size: 42px; font-weight: 800; letter-spacing: -0.04em; }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv { background: var(--bg); border-radius: 14px; padding: 10px; }
.kv span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.kv b { font-size: 18px; }
.banner {
  background: var(--gold-soft);
  color: var(--gold-deep);
  border-radius: 14px;
  padding: 12px;
  font-weight: 700;
}
.banner.danger { background: #f8e4e1; color: var(--danger); }
.row-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: white; font-weight: 800;
}
.sticky-action { position: sticky; bottom: calc(var(--nav-h) + 8px); margin-top: 16px; }
.video-wrap { border-radius: 18px; overflow: hidden; background: #1c1c1c; margin-bottom: 12px; }
video { width: 100%; max-height: 280px; object-fit: cover; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; }
.bar { height: 12px; background: #f3e7d8; border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--red); border-radius: inherit; }
.bar.gold span { background: var(--gold); }
.table-wrap { display: none; }
table { width: 100%; border-collapse: collapse; background: white; border-radius: 18px; overflow: hidden; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.empty, .spinner-card {
  background: white; border-radius: 18px; padding: 28px 16px; text-align: center; box-shadow: var(--shadow);
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 4px solid var(--gold-soft); border-top-color: var(--red);
  margin: 0 auto 10px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 12px);
  background: var(--ink); color: white; border-radius: 14px; padding: 12px 14px;
  z-index: 40; font-weight: 700; box-shadow: var(--shadow);
}
.modal-back {
  position: fixed; inset: 0; background: rgba(28, 28, 28, 0.46);
  z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.modal {
  background: white; border-radius: 22px; padding: 18px; width: min(480px, 100%);
  box-shadow: var(--shadow);
}
.modal h2 { font-size: 24px; margin-bottom: 8px; }
.modal p { color: var(--body); margin-bottom: 16px; }
.modal .row-actions { display: grid; grid-template-columns: 1fr 1fr; }
.error-line { background: #f8e4e1; color: var(--danger); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin-bottom: 12px; }
.batch-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.report-grid { grid-template-columns: 1fr 1fr; }
.report-card {
  background: white; border-radius: 18px; padding: 14px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; font-weight: 800;
}
.report-card span { color: var(--muted); font-size: 13px; font-weight: 700; }

@media (min-width: 960px) {
  .login { grid-template-columns: 1.1fr 0.9fr; }
  .login-hero { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px; }
  .slogan { font-size: 64px; }
  .login-card { margin: auto; width: min(440px, calc(100% - 64px)); }
  .logo-plate img { width: 150px; height: 150px; }
  .app-shell { display: grid; grid-template-columns: 260px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--red);
    color: white;
    padding: 22px 16px;
    position: sticky; top: 0; height: 100vh;
  }
  .side-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 16px; }
  .side-brand strong { font-family: var(--display); font-size: 22px; font-weight: 400; display: block; }
  .side-brand span { color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-nav a {
    color: white; text-decoration: none; font-weight: 800; border-radius: 12px;
    padding: 12px; display: flex; gap: 10px; align-items: center;
  }
  .side-nav a.active { background: var(--gold); color: var(--red-deep); }
  .side-nav svg { width: 18px; height: 18px; }
  .mobile-top, .bottom-nav { display: none; }
  .content { padding: 28px 32px 48px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .qa-grid { grid-template-columns: repeat(6, 1fr); }
  .report-grid { grid-template-columns: repeat(4, 1fr); }
  .only-mobile { display: none !important; }
  .table-wrap { display: block; }
  .toast { left: auto; right: 32px; width: 320px; bottom: 24px; }
  .modal-back { align-items: center; }
  .sticky-action { bottom: 16px; }
}

@media (max-width: 959px) {
  .only-desktop { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}
