/* ===== Media Cargo — soft glass design system ===== */
:root {
  --red: #E11E26;
  --red-600: #C2161D;
  --red-700: #9E1318;
  --red-soft: rgba(225,30,38,.10);
  --red-soft-2: rgba(225,30,38,.16);
  --gold: #CBA135;
  --gold-dark: #A9851B;
  --gold-soft: rgba(203,161,53,.16);

  --ink: #20242b;
  --muted: #66707c;
  --faint: #9aa3af;
  --line: rgba(20,28,40,.10);
  --line-2: rgba(20,28,40,.06);

  /* glass surfaces */
  --glass: rgba(255,255,255,.66);
  --glass-strong: rgba(255,255,255,.82);
  --glass-border: rgba(255,255,255,.7);
  --blur: saturate(160%) blur(14px);

  --slate-bg:#eef1f5; --slate-ink:#516074;
  --blue-bg:#e9f1ff;  --blue-ink:#2563eb;
  --amber-bg:#fdf1df; --amber-ink:#b4730b;
  --indigo-bg:#eeecfe;--indigo-ink:#5b4be0;
  --green-bg:#e6f7ee; --green-ink:#1c8a4e;
  --rose-bg:#fdecec;  --rose-ink:#cf2230;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20,28,40,.04), 0 12px 30px -16px rgba(20,28,40,.22);
  --shadow-lg: 0 24px 60px -24px rgba(20,28,40,.32);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background: #eef1f7;
}
/* soft brand-tinted ambient background */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 600px at 110% -10%, rgba(225,30,38,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(203,161,53,.12), transparent 55%),
    linear-gradient(180deg, #f7f9fc, #eef1f7);
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-600); }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; font-weight: 750; }
h2 { font-size: 15px; margin: 26px 0 12px; letter-spacing: -.005em; font-weight: 700; }

/* ===== App shell ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar .logo-chip { margin: 18px 18px 8px; padding: 12px 14px;
  background: rgba(255,255,255,.7); border: 1px solid var(--glass-border);
  border-radius: 14px; box-shadow: var(--shadow); }
.sidebar .logo-chip img { width: 100%; display: block; }

.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav .group { margin: 16px 8px 6px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase; color: var(--faint); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0; border-radius: 11px;
  color: var(--ink); font-weight: 560; font-size: 14px;
  transition: background .15s, color .15s, transform .12s;
}
.nav a .ico { width: 20px; text-align: center; font-size: 15px; opacity: .85; }
.nav a:hover { background: rgba(20,28,40,.05); transform: translateX(2px); }
.nav a.active {
  background: linear-gradient(100deg, var(--red-soft-2), var(--red-soft));
  color: var(--red-600); font-weight: 680;
  box-shadow: inset 3px 0 0 var(--red);
}
.nav a.active .ico { opacity: 1; }

.userbox { margin: 12px; padding: 12px; border-radius: 13px;
  background: rgba(255,255,255,.55); border: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--red), var(--gold)); color: #fff;
  font-weight: 700; font-size: 13px; display: grid; place-items: center;
  box-shadow: 0 6px 14px -6px var(--red); }
.userbox .meta { flex: 1; min-width: 0; }
.userbox .meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .meta span { font-size: 11.5px; color: var(--muted); }
.userbox form { margin: 0; }
.userbox button { background: rgba(255,255,255,.7); border: 1px solid var(--line);
  color: var(--muted); padding: 6px 10px; font-size: 12px; border-radius: 9px; box-shadow: none; }
.userbox button:hover { background: #fff; color: var(--ink); transform: none; }

/* mobile top bar (hidden on desktop) */
.mobile-bar { display: none; }
.scrim { display: none; }

/* ===== Content ===== */
.content { flex: 1; min-width: 0; }
.container { max-width: 1100px; margin: 0 auto; padding: 26px 30px 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .muted { margin-top: 4px; }

/* speed-streak motif */
.streaks { position: relative; overflow: hidden; }
.streaks::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(100deg, transparent 0 9px, rgba(255,255,255,.10) 9px 10px);
  mask-image: linear-gradient(90deg, transparent, #000 45%); animation: drift 9s linear infinite; }
@keyframes drift { from { background-position: 0 0; } to { background-position: 120px 0; } }

/* Dashboard hero */
.hero { color: #fff; border-radius: var(--radius); padding: 26px 28px; margin-bottom: 24px;
  background: linear-gradient(110deg, var(--red-700), var(--red) 55%, #e1591f);
  box-shadow: 0 20px 50px -24px rgba(225,30,38,.6); }
.hero h1 { color: #fff; }
.hero p { margin: 6px 0 0; color: rgba(255,255,255,.88); font-size: 14px; }
.hero .accent { height: 3px; width: 60px; background: var(--gold); border-radius: 3px; margin-bottom: 14px; }

/* ===== Cards & stats ===== */
.card { background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { position: relative; overflow: hidden; padding: 18px 20px; border-radius: var(--radius);
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s; }
.stat::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px;
  background: linear-gradient(180deg, var(--red), var(--gold)); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat .num { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.stat .ico { position: absolute; right: 14px; top: 14px; font-size: 20px; opacity: .22; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
th { background: rgba(255,255,255,.5); color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(225,30,38,.035); }
tr:last-child td { border-bottom: 0; }
tfoot th { background: transparent; color: var(--ink); }
.text-right { text-align: right; }

/* ===== Forms ===== */
form .field { margin-bottom: 15px; }
label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; background: rgba(255,255,255,.8); transition: border-color .15s, box-shadow .15s; font-family: inherit; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); background: #fff; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* ===== Buttons ===== */
.btn, button {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: 14px; font-weight: 650; cursor: pointer; font-family: inherit;
  background: linear-gradient(100deg, var(--red), var(--red-600)); color: #fff;
  box-shadow: 0 8px 18px -10px var(--red); transition: transform .15s, box-shadow .15s, filter .15s; }
.btn:hover, button:hover { transform: translateY(-1px); filter: brightness(1.05); color: #fff; box-shadow: 0 12px 24px -10px var(--red); }
.btn:active, button:active { transform: translateY(0); }
.btn-ghost { background: rgba(255,255,255,.8); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-ghost:hover { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.btn-gold { background: linear-gradient(100deg, var(--gold), var(--gold-dark)); box-shadow: 0 8px 18px -10px var(--gold); }
.btn-danger { background: linear-gradient(100deg, #ec4a51, var(--red-700)); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===== Flash ===== */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; font-weight: 500; border: 1px solid transparent; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.flash-notice { background: var(--green-bg); color: var(--green-ink); border-color: #bfe6cc; }
.flash-alert { background: var(--rose-bg); color: var(--rose-ink); border-color: #f3c2c4; }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--slate-bg); color: var(--slate-ink); }
.badge-slate { background: var(--slate-bg); color: var(--slate-ink); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue-ink); }
.badge-amber { background: var(--amber-bg); color: var(--amber-ink); }
.badge-indigo{ background: var(--indigo-bg);color: var(--indigo-ink); }
.badge-green { background: var(--green-bg); color: var(--green-ink); }
.badge-rose  { background: var(--rose-bg);  color: var(--rose-ink); }
.badge-gold  { background: var(--gold-soft);color: var(--gold-dark); }

/* ===== Toolbar / misc ===== */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; }
td form { display: inline; }
.row-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
small.muted { font-weight: 400; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.spread { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: space-between; }

/* ===== Barcode ===== */
.barcode-box { display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.barcode-box svg { display: block; }
.barcode-box .code { font-size: 12px; letter-spacing: .14em; color: var(--ink); font-weight: 600; }
.barcode-mini svg { height: 34px; }

/* ===== Nested item rows (addable) ===== */
.items-table td { padding: 8px; vertical-align: middle; }
.items-table input { padding: 8px 10px; }
.item-remove { background: var(--rose-bg); color: var(--rose-ink); border: none; padding: 7px 10px; border-radius: 9px; box-shadow: none; font-size: 13px; }
.item-remove:hover { background: #f7d2d4; color: var(--rose-ink); box-shadow: none; transform: none; }

/* ===== Modal (scanner) ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: rgba(15,18,24,.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); padding: 18px; }
.modal.open { display: flex; }
.modal-card { width: 100%; max-width: 460px; background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-lg); }
.modal-card h3 { margin: 0 0 4px; }
#scanner-view { width: 100%; border-radius: 12px; overflow: hidden; background: #000; margin: 14px 0; }
#scanner-view video { width: 100% !important; display: block; }

/* ===== Login ===== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand { background: linear-gradient(150deg, var(--red-700), var(--red) 60%, #e1591f); color: #fff;
  padding: 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-brand .logo-chip { background: #fff; border-radius: 18px; padding: 22px; max-width: 340px; box-shadow: var(--shadow-lg); }
.auth-brand .logo-chip img { width: 100%; display: block; }
.auth-brand h2 { font-size: 26px; margin: 30px 0 8px; color: #fff; }
.auth-brand p { color: rgba(255,255,255,.85); max-width: 380px; }
.auth-brand .gold-line { width: 56px; height: 4px; background: var(--gold); border-radius: 4px; margin-top: 18px; }
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 360px; }
.auth-card h1 { margin-bottom: 4px; }
.errors { background: var(--rose-bg); color: var(--rose-ink); padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .mobile-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 45;
    padding: 10px 14px; background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--glass-border); }
  .mobile-bar img { height: 30px; }
  .hamburger { background: rgba(255,255,255,.7); border: 1px solid var(--line); color: var(--ink); box-shadow: none;
    width: 40px; height: 40px; padding: 0; border-radius: 11px; font-size: 18px; }
  .hamburger:hover { background: #fff; transform: none; }

  .app { flex-direction: column; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 270px;
    transform: translateX(-100%); transition: transform .25s ease; }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15,18,24,.4); }
  .container { padding: 18px 16px 60px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { padding: 40px 28px; }
}
@media (min-width: 861px) { .mobile-bar { display: none; } }

/* ===== Print (labels & manifest report) ===== */
@media print {
  body::before, .sidebar, .mobile-bar, .scrim, .nav, .userbox, .toolbar, .actions, .btn, button, .no-print { display: none !important; }
  body { background: #fff; }
  .content, .container { margin: 0; padding: 0; max-width: none; }
  .card, table, .stat { box-shadow: none; border-color: #ccc; background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
