
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #101827;
  --muted: #687386;
  --line: #e5e7eb;
  --sidebar: #0b1220;
  --sidebar-2: #111827;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b91c1c;
  --warning: #b45309;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 278px; flex: 0 0 278px; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); color: white; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; box-shadow: 10px 0 30px rgba(15, 23, 42, .16); z-index: 30; transition: margin-left .22s ease, transform .22s ease; }
.brand { padding: 12px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.11); margin-bottom: 14px; }
.brand-menu { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.brand-title { color:#fff; font-weight:900; font-size:20px; letter-spacing:.2px; }
.sidebar-hide { margin:0; width:36px; height:36px; padding:0; border-radius:10px; background:rgba(255,255,255,.1); color:#fff; }
.side-nav { display: block; padding: 0; background: transparent; border: 0; position: static; overflow: visible; }
.nav-group-title { margin: 16px 10px 6px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 800; }
.tab.nav-link { width: 100%; text-align: left; display: block; border: 0; margin: 3px 0; padding: 11px 12px; border-radius: 12px; background: transparent; color: rgba(255,255,255,.78); font-weight: 800; white-space: normal; }
.tab.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.tab.nav-link.active { background: #ffffff; color: #111827; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.app-shell.sidebar-collapsed .sidebar { margin-left: -278px; }
.content-shell { flex: 1; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 8px 18px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; min-height: 58px; }
.topbar-logo-wrap { display:flex; align-items:center; min-height:0; }
.topbar-logo { display:block; height:42px; width:auto; max-width:min(360px, 62vw); object-fit:contain; }
.menu-button { display: inline-flex; align-items: center; justify-content: center; margin: 0; background: var(--sidebar); color: white; width: 44px; height: 44px; padding: 0; border-radius: 12px; }
main { padding: 20px; max-width: 1240px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }
h2 { margin: 8px 0 16px; font-size: 28px; }
h3 { margin: 0 0 10px; }
.card { background: var(--panel); padding: 18px; border-radius: 18px; box-shadow: 0 10px 30px rgba(15,23,42,.06); margin-bottom: 16px; border: 1px solid rgba(226,232,240,.8); }
.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 8px 22px rgba(15,23,42,.05); }
.metric-card span { display: block; color: var(--muted); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.metric-card strong { display: block; margin-top: 8px; font-size: 32px; color: var(--ink); }
label { display: block; font-weight: 800; margin-top: 12px; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 16px; background: white; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15,118,110,.14); border-color: var(--accent); }
textarea { min-height: 78px; resize: vertical; }
small { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 180px; }
.row-between { justify-content: space-between; }
button { cursor: pointer; border: 0; background: var(--accent); color: white; padding: 12px 14px; border-radius: 12px; font-size: 16px; font-weight: 800; margin-top: 12px; }
button:hover { filter: brightness(.96); }
button.secondary { background: #334155; }
button.danger { background: var(--danger); }
button.warning { background: var(--warning); }
button.small { padding: 7px 10px; border-radius: 9px; font-size: 13px; margin-top: 0; }
.info { margin: 10px 0; padding: 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; color: #1e3a8a; }
.table-wrap { overflow-x: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: white; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { background: #f8fafc; font-weight: 900; color: #0f172a; }
tr:last-child td { border-bottom: 0; }
.scanner { position: fixed; inset: 0; background: rgba(0,0,0,.76); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 100; }
.scanner.hidden { display: none; }
.scanner-box { width: min(500px, 100%); background: white; padding: 16px; border-radius: 18px; text-align: center; }
video { width: 100%; border-radius: 14px; background: black; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #111827; color: white; padding: 12px 16px; border-radius: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200; max-width: 90%; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
#toast.show { opacity: 1; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
a { color: var(--accent); font-weight: 800; }
.inline-label, .inline-check { display:flex; align-items:center; gap:8px; margin:0; font-weight:700; }
.inline-label select { min-width:220px; }
.inline-check input { width:auto; }
ul { margin: 8px 0 0 20px; }
.sidebar-backdrop { display:none; position:fixed; inset:0; background:rgba(15,23,42,.46); z-index:25; }
.sidebar-backdrop.show { display:block; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 980px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-102%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .app-shell.sidebar-collapsed .sidebar { margin-left: 0; }
  .content-shell { width: 100%; }
  main { padding: 14px; }
  .topbar { padding: 14px; }
  .topbar h1 { font-size: 21px; }
  .topbar p { font-size: 14px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: 16px; }
  h2 { font-size: 24px; }
  .row { align-items: stretch; }
  .row > button { width: 100%; }
}

@media (max-width: 560px) { .topbar-logo { height: 36px; max-width: 68vw; } .topbar-logo-wrap { min-height: 0; } .topbar { min-height: 52px; padding: 7px 12px; } }
