/* ==========================================================================
   LootNova stock portal — design system
   ========================================================================== */

:root {
  /* Surfaces */
  --page: #f6f8fb;
  --panel: #ffffff;
  --panel-alt: #fafbfd;
  --sidebar: #111a26;
  --sidebar-deep: #0b131d;
  --sidebar-text: #e8edf4;
  --sidebar-muted: #8fa3ba;
  --sidebar-hover: rgba(255, 255, 255, .07);

  /* Lines */
  --line: #e3e8ef;
  --line-soft: #eef1f6;
  --line-strong: #d3dae4;

  /* Text */
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --text-inverse: #ffffff;

  /* Brand / accent */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-border: #c7d9fb;

  /* Status */
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --ok-border: #abefc6;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-border: #fecdca;
  --danger-solid: #d92d20;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --warn-border: #fedf89;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --info-border: #b2ddff;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 13.5px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  /* Space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  /* Elevation */
  --sh-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --sh-md: 0 4px 12px rgba(16, 24, 40, .08);
  --sh-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --sh-xl: 0 24px 56px rgba(16, 24, 40, .18);

  --ring: 0 0 0 3px rgba(37, 99, 235, .18);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  margin: 0 0 var(--s3);
  font-weight: 600;
  letter-spacing: -0.011em;
  color: var(--text);
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); }

p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }

.muted { color: var(--muted); font-size: var(--fs-sm); }
.mono { font-family: var(--mono); font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }

::selection { background: #9dc4fb; color: #06214f; }
::-moz-selection { background: #9dc4fb; color: #06214f; }

body.modal-open { overflow: hidden; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* ---------- layout utilities ---------- */

.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--s3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.mt4 { margin-top: var(--s4); }

@media (max-width: 960px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ---------- buttons ---------- */

button {
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 550;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .04s ease;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:active { transform: translateY(.5px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

button.secondary {
  background: #fff;
  color: var(--text-2);
  border-color: var(--line-strong);
  box-shadow: var(--sh-xs);
}
button.secondary:hover { background: var(--panel-alt); color: var(--text); border-color: var(--line-strong); }

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
  box-shadow: none;
}
button.ghost:hover { background: rgba(16, 24, 40, .05); color: var(--text); }

button.danger {
  background: var(--danger-solid);
  border-color: var(--danger-solid);
  color: #fff;
}
button.danger:hover { background: #b42318; border-color: #b42318; }

button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-weight: 550;
}
button.link:hover { background: none; text-decoration: underline; }

button.sm { padding: 5px 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
button.block { width: 100%; }

/* ---------- form controls ---------- */

input, select, textarea {
  font: inherit;
  font-size: var(--fs-base);
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 8px 11px;
  box-shadow: var(--sh-xs);
  transition: border-color .12s ease, box-shadow .12s ease;
  width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: #b9c3d1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input::placeholder { color: #98a2b3; }

input[type="file"] {
  padding: 7px 10px;
  background: var(--panel-alt);
  cursor: pointer;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  box-shadow: none;
  cursor: pointer;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%23667085' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
  cursor: pointer;
}

label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 550; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-base);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.check input { width: 16px; }

/* Radio-style option cards (replaces typed prompts) */
.choice-list { display: flex; flex-direction: column; gap: var(--s2); }
.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #fff;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.choice:hover { border-color: #b9c3d1; background: var(--panel-alt); }
.choice input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); box-shadow: none; }
.choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-title { font-weight: 600; font-size: var(--fs-base); color: var(--text); }
.choice-sub { font-size: var(--fs-sm); color: var(--muted); }
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

/* clearable search input */
.input-clear { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.input-clear input { padding-right: 34px; }
.input-clear .clear-btn {
  position: absolute;
  right: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--r-full);
  background: #eef1f6;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
  box-shadow: none;
  display: none;
}
.input-clear .clear-btn:hover { background: #e2e7ef; }
.input-clear.has-value .clear-btn { display: grid; place-items: center; }

/* search 80% / filter 20% */
.filter-row { display: flex; gap: var(--s3); align-items: stretch; }
.filter-row .input-clear { flex: 4 1 0; min-width: 0; }
.filter-row > select { flex: 1 1 0; min-width: 0; }

@media (max-width: 700px) {
  .filter-row { flex-direction: column; }
  .filter-row .input-clear, .filter-row > select { flex: 1 1 auto; }
}

/* ---------- searchable sub-account picker ---------- */

.picker { position: relative; display: flex; flex-direction: column; gap: var(--s2); }
.picker.has-choice .picker-search { display: none; }

/* Results float over the page instead of pushing the layout down. */
.picker-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #fff;
  overflow: hidden auto;
  max-height: 232px;
  box-shadow: var(--sh-lg);
}

/* Let the floating results escape a modal's scroll box. */
.modal:has(.picker) { overflow: visible; }
.modal-body:has(.picker) { overflow: visible; min-height: 220px; }
.picker-label {
  padding: 6px 12px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.picker-item {
  width: 100%;
  justify-content: space-between;
  gap: var(--s3);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  font-weight: 550;
  text-align: left;
  box-shadow: none;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: var(--accent-soft); color: var(--text); }
.picker-tag { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.picker-empty { padding: 16px 12px; text-align: center; font-size: var(--fs-sm); color: var(--muted); }

.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  padding: 8px 10px 8px 12px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-weight: 600;
  color: var(--text);
}
.picker-chip button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: none;
}
.picker-chip button:hover { background: none; text-decoration: underline; }

/* ---------- app shell ---------- */

/* The rail never scrolls; only the main column does. */
.app-shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  align-items: stretch;
}
.app-shell.child-shell { grid-template-columns: 236px 1fr; }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
  color: var(--sidebar-text);
  padding: var(--s5) var(--s3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  overflow-y: auto;
  align-self: stretch;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px var(--s5);
  color: #fff;
}
.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: url("/logo.svg") center / contain no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.brand-text small,
.brand small {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--sidebar-muted);
  margin-top: 3px;
  letter-spacing: 0;
}

.sidebar button.nav-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--sidebar-muted);
  border-radius: var(--r-md);
  padding: 8px 11px;
  font-size: var(--fs-base);
  font-weight: 550;
  box-shadow: none;
}
.sidebar button.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar button.nav-item.active {
  background: rgba(255, 255, 255, .11);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--page);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 10px var(--s6);
  min-height: 52px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: var(--s2); }

.crumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.crumb strong { color: var(--text); font-weight: 600; }

.content { padding: var(--s6); max-width: 1400px; width: 100%; }

.page-head { margin-bottom: var(--s5); }
.page-head h1 { margin: 0 0 2px; }
.page-head .sub { color: var(--muted); font-size: var(--fs-sm); }

/* hamburger */
.menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  padding: 8px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text-2);
  box-shadow: none;
}
.menu-toggle:hover { background: var(--panel-alt); border-color: var(--line-strong); }
.menu-toggle span { display: block; height: 1.5px; width: 100%; background: currentColor; border-radius: 2px; }

.nav-backdrop { display: none; }

/* ---------- cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  margin-bottom: var(--s4);
  box-shadow: var(--sh-xs);
}
.card:last-child { margin-bottom: 0; }
.card > h2, .card > h3 { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.card-body { padding: var(--s5); }
.card-foot {
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

/* ---------- stats ---------- */

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--sh-xs);
}
.stat .label {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 550;
  margin-bottom: 6px;
}
.stat .value {
  font-size: var(--fs-2xl);
  font-weight: 660;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat .foot { margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- tables ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: auto;
  background: #fff;
}
.card.flush .table-wrap { border: none; border-radius: 0; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-base); }

th, td { text-align: left; padding: 10px var(--s3); }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
tbody td { border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--text-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f9fafc; }

.clean-table thead th { border-right: 1px solid var(--line); }
.clean-table tbody td { border-right: 1px solid var(--line-soft); }
.clean-table thead th:last-child,
.clean-table tbody td:last-child { border-right: none; }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text); }
td.strong, .pack-name { font-weight: 600; color: var(--text); }
td.check-col, th.check-col { width: 36px; padding-right: 0; }

.packs-table { table-layout: fixed; }
.packs-table col.w25 { width: 25%; }
.packs-table .col-total { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }

tr.pack-sep td {
  padding: 0 !important;
  border-right: none !important;
  background: #fff;
}
tr.pack-sep span {
  display: block;
  padding: 7px var(--s3);
  background: var(--panel-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
tr.pack-sep:hover td { background: #fff; }

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
  font-size: var(--fs-sm);
  color: var(--muted);
}

tfoot td {
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
  font-weight: 650;
  color: var(--text);
}
.clean-table tfoot td { border-right: 1px solid var(--line-soft); }
.clean-table tfoot td:last-child { border-right: none; }
tfoot tr:hover td { background: var(--panel-alt); }

@keyframes rowFlash {
  0% { background: #d7e8ff; }
  100% { background: transparent; }
}
tr.row-updated td { animation: rowFlash 2s ease-out; }

.danger-card { border-color: var(--danger-border); }
.danger-card .card-head { background: var(--danger-bg); border-bottom-color: var(--danger-border); }
.danger-card .card-head h3 { color: var(--danger); }
.err-text { color: var(--danger) !important; }

/* ---------- badges / pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .01em;
  background: rgba(102, 112, 133, .10);
  color: var(--text-2);
  border: 1px solid rgba(102, 112, 133, .18);
  white-space: nowrap;
  backdrop-filter: blur(6px);
}
.badge.ready {
  background: rgba(6, 118, 71, .12);
  color: #067647;
  border-color: rgba(6, 118, 71, .22);
}
.badge.in_use, .badge.claim {
  background: rgba(181, 71, 8, .12);
  color: #b54708;
  border-color: rgba(181, 71, 8, .22);
}
.badge.received {
  background: rgba(2, 122, 110, .12);
  color: #0f766e;
  border-color: rgba(2, 122, 110, .22);
}
.badge.not_received {
  background: rgba(180, 35, 24, .12);
  color: #b42318;
  border-color: rgba(180, 35, 24, .22);
}
.badge.import {
  background: rgba(8, 116, 67, .12);
  color: #087443;
  border-color: rgba(8, 116, 67, .22);
}
.badge.transfer {
  background: rgba(83, 56, 158, .12);
  color: #5340a9;
  border-color: rgba(83, 56, 158, .22);
}
.badge.harvest {
  background: rgba(8, 112, 184, .12);
  color: #026aa2;
  border-color: rgba(8, 112, 184, .22);
}
.badge.undo {
  background: rgba(71, 84, 103, .12);
  color: #344054;
  border-color: rgba(71, 84, 103, .22);
}
.badge.delete {
  background: rgba(180, 35, 24, .12);
  color: #b42318;
  border-color: rgba(180, 35, 24, .22);
}
.badge.inbox {
  background: rgba(37, 99, 235, .12);
  color: #175cd3;
  border-color: rgba(37, 99, 235, .22);
}
.badge.promoted {
  background: rgba(6, 118, 71, .12);
  color: #067647;
  border-color: rgba(6, 118, 71, .22);
}
.badge.rejected {
  background: rgba(180, 35, 24, .12);
  color: #b42318;
  border-color: rgba(180, 35, 24, .22);
}
.badge.off {
  background: rgba(152, 162, 179, .12);
  color: var(--muted);
  border-color: rgba(152, 162, 179, .22);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: #eef1f6;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- inline alerts ---------- */

.err, .ok, .warn, .info-note {
  font-size: var(--fs-sm);
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 500;
}
.err { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.info-note { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.card.err { padding: var(--s4) var(--s5); }

/* ---------- tabs (segmented) ---------- */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: var(--s5);
  background: #eef1f6;
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.tabs button {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: var(--fs-base);
  font-weight: 550;
  padding: 6px 13px;
  border-radius: 6px;
  box-shadow: none;
}
.tabs button:hover { background: rgba(255, 255, 255, .7); color: var(--text); }
.tabs button.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--sh-xs);
}
.tabs.sm { margin-bottom: 0; }
.tabs.sm button { font-size: var(--fs-sm); padding: 5px 10px; }
.tab-count {
  margin-left: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tabs button.active .tab-count { color: var(--text-2); }
.card-head.wrap { flex-wrap: wrap; row-gap: var(--s3); }
select.sm { padding: 6px 28px 6px 10px; font-size: var(--fs-sm); }
.input-clear.sm input { padding: 6px 26px 6px 10px; font-size: var(--fs-sm); min-width: 230px; }
.rows-clickable tbody tr { cursor: pointer; }
.rows-clickable tbody tr:hover { background: var(--panel-alt); }
.row-undone td { opacity: .55; }

/* ---------- pager ---------- */

.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
  font-size: var(--fs-sm);
}
.pager .right { flex: 1; }
.pager-num {
  min-width: 30px;
  padding: 5px 8px;
  font-size: var(--fs-sm);
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: var(--r-sm);
  box-shadow: none;
}
.pager-num:hover { border-color: var(--line-strong); color: var(--text); }
.pager-num.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.pager-gap { color: var(--muted); padding: 0 2px; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pager-jump input {
  width: 58px;
  padding: 5px 8px;
  font-size: var(--fs-sm);
  text-align: center;
}

/* ---------- transfer builder ---------- */

.xfer-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s4);
  align-items: stretch;
}
.xfer-pane {
  min-height: 0;
  margin: 0;
}
.xfer-pane h2 { margin: 0 0 4px; font-size: var(--fs-lg); }
.xfer-add-row {
  display: flex;
  align-items: stretch;
  gap: var(--s2);
  flex-wrap: wrap;
}
.pack-trigger {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-xs);
  font-weight: 550;
}
.pack-trigger:hover { background: var(--panel-alt); }
.pack-trigger-caret { color: var(--muted); font-size: 12px; }
#xferPackLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xfer-qty {
  flex: 0 0 72px;
  width: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}
.xfer-qty::-webkit-outer-spin-button,
.xfer-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.btn-cart {
  flex: 0 0 auto;
  background: linear-gradient(180deg, #16c75e 0%, #0f9d4a 100%);
  border: 1px solid #0c8a40;
  color: #fff;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(12, 138, 64, .28);
}
.btn-cart:hover { background: linear-gradient(180deg, #12b955 0%, #0d8b42 100%); }
.xfer-cart {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
}
.xfer-empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.cart-line {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel-alt);
}
.cart-line.is-short { background: var(--danger-bg); border-color: var(--danger-border); }
.cart-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-qty {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-2);
  min-width: 1.5em;
  text-align: right;
}
.xfer-foot {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-top: var(--s4);
}
.xfer-accts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.xfer-foot-actions {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}
.xfer-foot-actions #xferNote { flex: 1; min-width: 120px; }

.acct-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-weight: 650;
  color: var(--text);
  line-height: 1;
}
.acct-x {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: rgba(16, 24, 40, .08);
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  box-shadow: none;
}
.acct-x:hover { background: var(--danger-bg); color: var(--danger); }

.row-short td { background: var(--danger-bg); }
.right-cell { text-align: right; }
.danger-link { color: var(--danger); }
.picker-head {
  padding: 6px 12px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.picker.multi .picker-chosen { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }

/* Pack chooser overlay */
.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, .45);
}
.sheet {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h3 { margin: 0; font-size: var(--fs-md); }
.sheet-search { padding: 10px 16px 0; }
.sheet-list {
  padding: 8px 10px 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sheet-label {
  padding: 10px 12px 4px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  background: #fff;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  box-shadow: none;
  font-weight: 550;
}
.sheet-row:hover { background: var(--accent-soft); }
.sheet-row.is-on { background: var(--ok-bg); border-color: var(--ok-border); }
.sheet-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-row-qty { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }

.sess-list { display: flex; flex-direction: column; }
.sess-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line);
}
.sess-card:last-child { border-bottom: none; }
.sess-card.is-current { background: var(--accent-soft); }
.sess-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 650; }
.sess-meta { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; }

@media (max-width: 860px) {
  .xfer-split { grid-template-columns: 1fr; }
  .xfer-cart { max-height: 200px; }
  .sheet-root { padding: 0; place-items: end stretch; }
  .sheet {
    width: 100%;
    max-height: 86vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .sess-card { flex-direction: column; }
  .btn-cart { flex: 1 1 100%; }
}

/* ---------- export ---------- */

input.qty {
  width: 84px;
  padding: 6px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}
input.qty::-webkit-outer-spin-button,
input.qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.hist-inline {
  padding: var(--s2) 0;
  border-left: 2px solid var(--line);
  padding-left: var(--s3);
}
.hist-inline .card { border: 0; padding: 0; background: transparent; }
.basket-line { display: flex; align-items: center; gap: var(--s2); }
.pick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--s2) 0;
  max-height: 260px;
  overflow: auto;
}
.pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.pick-chip:hover { border-color: var(--accent); }
.pick-chip input { margin: 0; }

/* ---------- sub account grid (two per row) ---------- */

.sub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}
.sub-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  padding: var(--s4) var(--s5);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  color: inherit;
}
.sub-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sub-card-main { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.sub-card-name {
  font-weight: 600;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-card-stats {
  margin-left: auto;
  display: flex;
  gap: var(--s4);
  color: var(--muted);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.sub-card-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.sub-card .chev { color: var(--muted); font-size: 18px; }
@media (max-width: 760px) {
  .sub-grid { grid-template-columns: minmax(0, 1fr); }
  .sub-card-stats { gap: var(--s3); }
}

/* ---------- lists (sub accounts) ---------- */

.sub-list { display: flex; flex-direction: column; gap: var(--s2); }
.sub-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px var(--s4);
  font-weight: 550;
  box-shadow: var(--sh-xs);
}
.sub-list-item:hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }

.sub-panels { display: flex; flex-direction: column; gap: var(--s2); }
.sub-panel-btn {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px var(--s4);
  font-weight: 600;
  box-shadow: var(--sh-xs);
}
.sub-panel-btn:hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }
.sub-panel-btn .chev { color: var(--muted); font-weight: 400; }

/* ---------- empty state ---------- */

.empty {
  padding: var(--s10) var(--s5);
  text-align: center;
  color: var(--muted);
}
.empty .title { font-size: var(--fs-md); font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty .desc { font-size: var(--fs-sm); max-width: 420px; margin: 0 auto var(--s4); }

/* ---------- skeleton ---------- */

@keyframes sk {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.sk {
  display: block;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%);
  background-size: 200% 100%;
  animation: sk 1.2s ease-in-out infinite;
}
.sk-line { height: 11px; margin: 7px 0; }
.sk-title { height: 16px; width: 40%; margin-bottom: var(--s4); }
.sk-stat { height: 30px; width: 55%; margin-top: 10px; }
.sk-row { height: 13px; }

/* ---------- key/value detail ---------- */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s4);
}
.kv .k { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.kv .v { font-size: var(--fs-base); color: var(--text); font-weight: 550; }

pre.box, .box {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s3);
  white-space: pre-wrap;
  font-size: var(--fs-sm);
  margin: 0;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--s5);
  animation: fadein .12s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes popin {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  overflow: hidden;
  animation: popin .14s cubic-bezier(.2, .8, .3, 1);
}
.modal.wide { width: min(620px, 100%); }
.modal-head {
  padding: var(--s5) var(--s5) var(--s3);
}
.modal-head h3 { margin: 0; font-size: var(--fs-md); }
.modal-head .sub { margin-top: 3px; font-size: var(--fs-sm); color: var(--muted); }
.modal-body {
  padding: 0 var(--s5) var(--s4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--line);
  background: var(--panel-alt);
}
.modal-error {
  font-size: var(--fs-sm);
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-md);
  padding: 9px 12px;
}
.modal-summary {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s3);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.modal-summary strong { color: var(--text); }

/* ---------- toasts ---------- */

.toast-stack {
  position: fixed;
  right: var(--s5);
  bottom: var(--s5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}
@keyframes toastin {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--sh-lg);
  font-size: var(--fs-base);
  color: var(--text);
  animation: toastin .16s ease;
}
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all .16s ease; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--muted); }
.toast.ok .dot { background: var(--ok); }
.toast.err .dot { background: var(--danger-solid); }
.toast.info .dot { background: var(--accent); }
.toast .msg { flex: 1; min-width: 0; }
.toast .msg .t { font-weight: 600; }
.toast .msg .d { font-size: var(--fs-sm); color: var(--muted); margin-top: 1px; }
.toast .x {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0 2px;
  font-size: 15px;
  line-height: 1;
  box-shadow: none;
}
.toast .x:hover { background: none; color: var(--text); }

/* ---------- all stock: pack grid ---------- */

/* Back sits inside the panel it returns from, not in the top bar. */
.back-btn {
  padding: 5px 11px;
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--sh-xs);
}
.back-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.back-btn span { font-size: 14px; line-height: 1; }

/* Back, pack name and the row actions all share one compact line. */
.pack-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  padding: var(--s3) var(--s4);
}
.pack-head-title { display: flex; align-items: baseline; gap: var(--s2); min-width: 0; }
.panel-title { margin: 0; font-size: var(--fs-lg); }
.panel-count { font-size: var(--fs-sm); font-weight: 600; color: var(--accent); white-space: nowrap; }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}
.pack-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--s2);
  width: 100%;
  padding: var(--s4);
  text-align: left;
  white-space: normal;
  font-weight: 500;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.pack-card:hover {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.pack-card.is-empty { background: var(--panel-alt); }
.pack-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}
.pack-card-name { font-weight: 600; font-size: var(--fs-md); }
.pack-card-count { font-size: 20px; font-weight: 650; line-height: 1; }
.pack-card-count.has { color: var(--accent); }
.pack-card-count.none { color: var(--muted); }
.pack-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.pack-card-meta b { color: var(--text); font-weight: 600; }

.owner-sub { font-weight: 600; }

/* Selected import files */
.file-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--fs-sm);
}
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
}
.file-chip button:hover { background: none; color: var(--danger-solid); }

@media (max-width: 720px) {
  .pack-grid { grid-template-columns: 1fr; }
}

/* ---------- login ---------- */

.login-center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s5);
  background:
    radial-gradient(900px 400px at 50% -5%, #e8eefb 0%, transparent 60%),
    var(--page);
}
.login-box {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--s8);
  box-shadow: var(--sh-md);
  gap: var(--s3);
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--sh-sm); }
.login-box h1 { font-size: var(--fs-xl); margin: 0; }
.login-box .muted { margin-bottom: var(--s3); }

/* Authenticator enrolment */
.enroll { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s3); }
.enroll-step { margin: 0; font-size: var(--fs-sm); color: var(--text); line-height: 1.5; }
.enroll-step b { color: var(--accent); }
.enroll-qr {
  align-self: center;
  width: 200px;
  height: 200px;
  padding: var(--s3);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.enroll-manual { font-size: var(--fs-xs); color: var(--muted); }
.enroll-manual summary { cursor: pointer; }
.enroll-secret {
  display: block;
  margin-top: var(--s2);
  padding: var(--s2);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-sm);
  letter-spacing: 1px;
  word-break: break-all;
  user-select: all;
}

/* ==========================================================================
   Child (sub-account) portal
   ========================================================================== */

.child-nav { display: flex; flex-direction: column; gap: var(--s2); }
.child-head { display: flex; flex-direction: column; gap: var(--s3); }
.child-head-right { display: none; }
.child-user-mobile { display: none; }
.child-shell .brand { font-size: var(--fs-md); padding: 4px 10px var(--s4); }
.child-shell .child-nav .nav-item { padding: 8px 11px; }
.child-shell .child-logout-mobile { display: none; }

.child-shell .child-web-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--s6);
}
.child-shell .child-user { font-size: var(--fs-base); font-weight: 600; color: var(--text); }
.child-shell .child-logout-web {
  padding: 5px 11px;
  font-size: var(--fs-sm);
  background: #fff;
  color: var(--text-2);
  border-color: var(--line-strong);
  box-shadow: var(--sh-xs);
}
.child-shell .child-logout-web:hover { background: var(--panel-alt); color: var(--text); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
  .content { padding: var(--s5); }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-content: start;
    align-items: start;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .main-col { height: auto; overflow: visible; }

  .menu-toggle { display: inline-flex; }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    z-index: 30;
    border: none;
    padding: 0;
    margin: 0;
  }
  .app-shell.nav-open .nav-backdrop { display: block; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: max(min(30vw, 260px), 136px);
    height: 100vh;
    z-index: 40;
    transform: translateX(-102%);
    transition: transform .18s cubic-bezier(.3, .8, .3, 1);
    overflow-y: auto;
  }
  .app-shell.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--sh-xl);
  }

  .content { padding: var(--s4); }
  .topbar { padding: 8px var(--s4); }
  .toast-stack { right: var(--s3); left: var(--s3); bottom: var(--s3); max-width: none; }
  .modal-backdrop { padding: var(--s3); align-items: flex-end; }
  .modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; }

  /* Child: compact top strip, brand left, user + logout right */
  .app-shell.child-shell { grid-template-columns: 1fr; align-content: start; }
  .app-shell.child-shell .menu-toggle,
  .app-shell.child-shell .nav-backdrop { display: none !important; }
  .app-shell.child-shell .sidebar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    transform: none !important;
    transition: none !important;
    padding: 10px 12px 12px !important;
    gap: 8px !important;
    overflow: hidden;
    box-shadow: none !important;
    align-self: start;
  }
  .app-shell.child-shell .main-col { align-self: start; min-height: 0; }
  .app-shell.child-shell .child-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .app-shell.child-shell .brand {
    flex: 1 1 auto;
    font-size: var(--fs-base);
    font-weight: 700;
    padding: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .app-shell.child-shell .brand small {
    display: inline;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    margin: 0 0 0 4px;
  }
  .app-shell.child-shell .child-head-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }
  .app-shell.child-shell .child-user-mobile {
    display: inline-block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: rgba(255, 255, 255, .82);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-shell.child-shell .child-web-bar { display: none !important; }
  .app-shell.child-shell .child-logout-mobile {
    display: inline-flex !important;
    width: auto !important;
    padding: 5px 9px !important;
    font-size: var(--fs-sm);
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: none;
  }
  .app-shell.child-shell .child-nav { flex-direction: row; gap: 6px; width: 100%; }
  .app-shell.child-shell .child-nav .nav-item {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
    padding: 6px !important;
    font-size: var(--fs-sm);
  }
  .app-shell.child-shell .content { padding: var(--s4) var(--s3) var(--s6); }
}

@media (max-width: 560px) {
  .row { gap: var(--s2); }
  .card { padding: var(--s4); }
  .stat { padding: var(--s4); }
  .stat .value { font-size: var(--fs-xl); }
  .content { padding: var(--s3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Free Fire vault extras ---------- */

.badge.available { background: rgba(6, 118, 71, .12); color: #067647; border-color: rgba(6, 118, 71, .22); }
.badge.reserved { background: rgba(181, 71, 8, .12); color: #b54708; border-color: rgba(181, 71, 8, .22); }
.badge.used { background: rgba(2, 122, 110, .12); color: #0f766e; border-color: rgba(2, 122, 110, .22); }
.badge.invalid { background: rgba(180, 35, 24, .12); color: #b42318; border-color: rgba(180, 35, 24, .22); }
.badge.wrong { background: rgba(181, 71, 8, .12); color: #b54708; border-color: rgba(181, 71, 8, .22); }
.badge.reavailable { background: rgba(37, 99, 235, .12); color: #175cd3; border-color: rgba(37, 99, 235, .22); }
.badge.reveal, .badge.edit { background: rgba(71, 84, 103, .12); color: #344054; border-color: rgba(71, 84, 103, .22); }

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center;
  background: var(--panel-alt);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.dropzone strong { display: block; color: var(--text); margin-bottom: 4px; }

.pin-cell {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: .02em;
  color: var(--text);
}
.pin-cell button.link { font-family: inherit; }

.actions-cell { white-space: nowrap; }
.actions-cell button { margin-right: 4px; }

.topbar-right #logout {
  background: var(--danger-solid);
  border-color: var(--danger-solid);
  color: #fff;
  font-weight: 650;
  padding: 7px 16px;
}
.topbar-right #logout:hover { background: #b42318; border-color: #b42318; }

.mt4 { margin-top: var(--s4); }

.nav-group {
  margin: 10px 8px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
