/* NVSN Supplier Portal — same look as the NVSN Client Portal (portal.nvsn.group) */

/* Light mode — NVSN Page Directory palette */
:root {
  color-scheme: light;
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --accent: #111111;
  --accent-text: #ffffff;
  --link: #1d4ed8;
  --focus: #18181b;

  --amber-bg: #fef3c7; --amber-text: #92400e;
  --blue-bg: #e0ecff;  --blue-text: #1e40af;
  --green-bg: #dcfce7; --green-text: #166534;
  --red-bg: #fef2f2;   --red-text: #b91c1c;
  --grey-bg: #f4f4f5;  --grey-text: #52525b;
  --purple-bg: #ede9fe; --purple-text: #5b21b6;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* Dark mode — original portal colours */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013;
  --surface: #171a1f;
  --surface-2: #1f232a;
  --text: #eceef2;
  --muted: #9aa0ab;
  --border: #2a2e36;
  --accent: #eceef2;
  --accent-text: #0e1013;
  --link: #8fb0ff;
  --focus: #7aa2ff;

  --amber-bg: #3a2c0c; --amber-text: #f5c66a;
  --blue-bg: #17223a;  --blue-text: #a9c2ff;
  --green-bg: #11301c; --green-text: #8fdca7;
  --red-bg: #3a1717;   --red-text: #ffb4b4;
  --grey-bg: #262a31;  --grey-text: #b3b8c2;
  --purple-bg: #2a1f42; --purple-text: #c9b3ff;
}

/* Light / dark toggle — same switch style as the NVSN Stock Booking Form */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; color: var(--muted); font-size: 13px; position: relative; }
.theme-toggle input { position: absolute; opacity: 0; width: 0 !important; height: 0; margin: 0 !important; padding: 0 !important; pointer-events: none; }
.theme-toggle .switch-track {
  display: inline-block; position: relative; flex-shrink: 0;
  width: 34px; height: 18px; border: 1.5px solid var(--text); border-radius: 9px;
  background: var(--surface); transition: background 0.15s ease;
}
.theme-toggle .switch-thumb {
  position: absolute; top: 1.5px; left: 1.5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--text); transition: left 0.15s ease, background 0.15s ease;
}
.theme-toggle input:checked + .switch-track { background: var(--text); }
.theme-toggle input:checked + .switch-track .switch-thumb { left: 18.5px; background: var(--surface); }
.theme-toggle input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* NVSN logo: black on the light theme, white on the dark theme */
.logo { display: inline-flex; line-height: 0; color: #000; }
:root[data-theme="dark"] .logo { color: #fff; }
.logo svg { height: 17px; width: auto; display: block; }

/* ---------- Header (two rows: brand | user, then status | tools) ---------- */
header.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand user" "status theme";
  align-items: center; column-gap: 16px; row-gap: 6px;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand .sub { color: var(--muted); white-space: nowrap; }
.refresh { grid-area: status; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.refresh.err { color: var(--red-text); }
.user { grid-area: user; display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.user .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 4px; }
.user .name small { color: var(--muted); font-weight: 400; }
.header-tools { grid-area: theme; justify-self: end; display: flex; align-items: center; gap: 16px; }
.header-link { color: var(--muted); font-size: 13px; text-decoration: none; white-space: nowrap; }
.header-link:hover { color: var(--text); text-decoration: underline; }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 500;
  white-space: nowrap; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--red-text); }
.btn.small, .btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: 0.55; cursor: default; }

.field, label.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.field small, label.field small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 10px; min-height: 38px; font-size: 14px; font-weight: 400;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--text); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- Layout ---------- */
main.page { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
main.page.narrow { max-width: 860px; }

/* Main tabs (segmented, like the Client Portal) */
.tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 18px; max-width: 100%; }
.tab {
  border: 0; background: transparent; padding: 8px 18px; border-radius: 7px; cursor: pointer;
  font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.tab-badge { background: var(--amber-bg); color: var(--amber-text); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-block; margin-bottom: 8px; }
.crumb:hover { color: var(--text); }

.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }

/* Filters bar (like the Client Portal) */
.filters, .toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 14px;
}
.toolbar .search, .filters .search { flex: 1 1 240px; }
.toolbar select { width: auto; min-width: 180px; }
.count-note { color: var(--muted); font-size: 13px; padding-bottom: 10px; }

/* Status chips (order list filter) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); padding: 5px 12px; border-radius: 999px;
  cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; color: var(--text);
}
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip.active .count { color: inherit; opacity: .7; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tr.static { cursor: default; }
table.list tr.static:hover { background: transparent; }
.mono { font-family: var(--mono); font-size: 13px; }
td .sub, .sub { color: var(--muted); font-size: 12px; }
.overdue { color: var(--red-text); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.num.zero { color: var(--muted); }

/* ---------- Pills & order status badges ---------- */
.pill, .badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--grey-bg); color: var(--grey-text); }
.badge.s-submitted { background: var(--blue-bg); color: var(--blue-text); }
.badge.s-accepted { background: var(--purple-bg); color: var(--purple-text); }
.badge.s-in-production, .badge.s-ready { background: var(--amber-bg); color: var(--amber-text); }
.badge.s-dispatched { background: var(--green-bg); color: var(--green-text); }
.badge.s-completed { background: var(--grey-bg); color: var(--grey-text); }
.badge.s-on-hold { background: var(--red-bg); color: var(--red-text); }
.badge.s-cancelled { background: var(--red-bg); color: var(--red-text); }
.pill.ad-on { background: var(--green-bg); color: var(--green-text); }
.pill.ad-wait { background: var(--amber-bg); color: var(--amber-text); }
.pill.ad-off { background: var(--grey-bg); color: var(--grey-text); }
.pill.ad-admin { background: var(--purple-bg); color: var(--purple-text); }
.pill.ad-staff { background: var(--blue-bg); color: var(--blue-text); }

/* ---------- Order page ---------- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.desc { white-space: pre-wrap; line-height: 1.6; }
.files-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.files-cols h3, .sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.file-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; gap: 4px; }
.empty, .loading { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty.box { padding: 14px; border: 1px dashed var(--border); border-radius: 10px; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; margin-top: 14px; }
.dropzone.drag, .dropzone:hover { border-color: var(--muted); background: var(--surface-2); color: var(--text); }
.dropzone b { color: var(--text); }
.uploads { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.uploads li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.uploads .st { color: var(--muted); white-space: nowrap; }
.uploads .st.done { color: var(--green-text); }
.uploads .st.err { color: var(--red-text); }
.notes { display: grid; gap: 10px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.note { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.note.mine { background: var(--surface-2); }
.note.staff { border-left: 3px solid var(--text); }
.note-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note-head b { color: var(--text); font-weight: 600; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.note-form { display: grid; gap: 10px; margin-top: 14px; }
.note-form textarea { min-height: 70px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; font-size: 13px; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin-top: 6px; }
.timeline .when { color: var(--muted); font-size: 12px; }

/* ---------- Status tab (staff only) — same as the Client Portal ---------- */
.status-view { display: flex; flex-direction: column; gap: 16px; }
.st-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.st-banner.ok { background: var(--green-bg); color: var(--green-text); border-color: transparent; }
.st-banner.warn { background: var(--amber-bg); color: var(--amber-text); border-color: transparent; }
.st-banner.down { background: var(--red-bg); color: var(--red-text); border-color: transparent; }
.st-banner .st-title { font-weight: 700; font-size: 15px; }
.st-banner .st-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.st-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 8px; }
.st-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 2px; font-weight: 600; }
.st-card h3 span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.st-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.st-row:first-of-type { border-top: none; }
.st-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--grey-text); }
.st-dot.ok { background: var(--green-text); } .st-dot.warn { background: var(--amber-text); } .st-dot.down { background: var(--red-text); }
.st-banner .st-dot { margin-top: 0; width: 12px; height: 12px; background: currentColor; }
.st-main { flex: 1; min-width: 0; }
.st-name { font-weight: 600; }
.st-sum { margin-top: 2px; }
.st-detail { font-size: 12px; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.pill.st-ok { background: var(--green-bg); color: var(--green-text); }
.pill.st-warn { background: var(--amber-bg); color: var(--amber-text); }
.pill.st-down { background: var(--red-bg); color: var(--red-text); }
.pill.st-none, .pill.st-pending { background: var(--grey-bg); color: var(--grey-text); }
.st-live { font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.st-live b { color: var(--text); font-weight: 600; }
.st-scroll { overflow-x: auto; }
.st-speeds { width: 100%; border-collapse: collapse; font-size: 13px; }
.st-speeds th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.st-speeds td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-speeds th:first-child, .st-speeds td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.st-speeds tr:last-child td { border-bottom: none; }
.st-speeds .st-dot { display: inline-block; margin: 0 8px 0 0; vertical-align: 1px; }
.st-note { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }

/* ---------- Suppliers / Logins tabs — same as the Client Portal's Clients tab ---------- */
.ad-view { display: flex; flex-direction: column; gap: 14px; }
.ad-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ad-bar .field.search { flex: 1 1 240px; }
.ad-bar .ad-count { color: var(--muted); font-size: 13px; padding-bottom: 10px; }
.ad-bar .push { margin-left: auto; display: flex; gap: 8px; }
.ad-note { background: var(--blue-bg); color: var(--blue-text); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.ad-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ad-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ad-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ad-table tr:last-child td { border-bottom: none; }
.ad-table tbody tr { cursor: pointer; }
.ad-table tbody tr:hover td { background: var(--surface-2); }
.ad-table tbody tr.static { cursor: default; }
.ad-table tbody tr.static:hover td { background: transparent; }
.ad-name { font-weight: 600; }
.ad-sub { color: var(--muted); font-size: 12px; }
.ad-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.ad-form .wide { grid-column: 1 / -1; }
.ad-form .field input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--text); border-radius: 3px; }
.ad-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--text); cursor: pointer; }
.ad-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.ad-checks { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.ad-checks label { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; cursor: pointer; color: var(--text); font-weight: 400; }
.ad-checks input { margin: 0; accent-color: var(--text); }
.ad-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.ad-actions .spacer { flex: 1; }
.ad-msg { font-size: 13px; }
.ad-msg.err { color: var(--red-text); }
.ad-msg.ok { color: var(--green-text); }
.ad-pw { display: flex; gap: 6px; }
.ad-pw input { flex: 1; }
.ad-section { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }
.ad-section h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ad-section h4 .btn { text-transform: none; letter-spacing: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li.wait { background: var(--amber-bg); }
.mini-list a { color: inherit; text-decoration: none; }
.mini-list a:hover { text-decoration: underline; }
.mini-list .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }

/* ---------- Modal (Client Portal style) ---------- */
.overlay, .modal-bg {
  position: fixed; inset: 0; background: rgba(10, 12, 16, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; border: 1px solid var(--border); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-head .muted { color: var(--muted); font-size: 13px; margin-top: 3px; }
.close { border: 0; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.modal-body { padding: 18px 22px 22px; display: grid; gap: 14px; }

/* ---------- Messages ---------- */
.alert, .notice { padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.4; }
.alert.err, .notice.error { background: var(--red-bg); color: var(--red-text); }
.alert.ok { background: var(--green-bg); color: var(--green-text); }
.alert.info { background: var(--blue-bg); color: var(--blue-text); }
.alert.warn { background: var(--amber-bg); color: var(--amber-text); }
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(92vw, 420px); }
.toast { background: var(--accent); color: var(--accent-text); padding: 11px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-weight: 500; animation: pop .18s ease-out; }
.toast.err { background: var(--red-bg); color: var(--red-text); border: 1px solid currentColor; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--text); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; }
.loading .spinner { width: 26px; height: 26px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sign-in, forgot password, request access, change password ---------- */
body.auth { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; border-radius: 14px; padding: 36px 32px 32px; }
.auth .card.wide { max-width: 440px; }
.auth .brand { margin-bottom: 28px; }
.auth .brand .logo svg { height: 20px; }
.auth .brand .sub { font-size: 14px; }
.auth .brand .theme-toggle { margin-left: auto; }
.auth h1 { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.auth p.lead { margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.auth label.lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.auth input[type=text], .auth input[type=email], .auth input[type=password] { font-size: 15px; padding: 11px 12px; margin-bottom: 16px; }
.auth input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.auth button.go { width: 100%; font-weight: 600; font-size: 15px; padding: 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); cursor: pointer; margin-top: 4px; }
.auth button.go:disabled { opacity: 0.6; cursor: default; }
.auth .msg { display: none; font-size: 14px; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; line-height: 1.4; }
.auth .msg.error { display: block; background: var(--red-bg); color: var(--red-text); }
.auth .msg.info { display: block; background: var(--blue-bg); color: var(--blue-text); }
.auth .msg.success { display: block; background: var(--green-bg); color: var(--green-text); }
.auth .forgot { margin: 14px 0 0; text-align: center; font-size: 14px; }
.auth .forgot a { color: var(--text); font-weight: 500; text-decoration: none; }
.auth .forgot a:hover { text-decoration: underline; }
.auth .forgot.register { margin-top: 8px; color: var(--muted); }
.auth .foot { margin-top: 22px; font-size: 13px; color: var(--muted); text-align: center; }
.auth .foot a { color: inherit; text-decoration: none; font-weight: 500; }
.auth .foot a:hover { text-decoration: underline; }
.auth .who { color: var(--text); font-weight: 600; }
.rules { list-style: none; margin: -6px 0 16px; padding: 0; font-size: 13px; color: var(--muted); }
.rules li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.rules li::before { content: '○'; width: 14px; text-align: center; }
.rules li.ok { color: var(--green-text); }
.rules li.ok::before { content: '✓'; font-weight: 700; }
.match { margin: -10px 0 16px; font-size: 13px; min-height: 18px; }
.match.ok { color: var(--green-text); }
.match.bad { color: var(--red-text); }
.show-pw { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); cursor: pointer; margin-bottom: 18px; font-size: 13px; }
.show-pw input { width: auto; margin: 0; padding: 0; accent-color: var(--accent); }
.btn-link { display: block; text-align: center; text-decoration: none; font-weight: 600; font-size: 15px; padding: 12px; border-radius: 8px; background: var(--accent); color: var(--accent-text); margin-top: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.site-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 28px; }
body.auth .site-foot { padding: 20px 0 0; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .top-inner { padding: 12px 16px; }
  .brand .sub { display: none; }
  .user .name { display: none; }
  main.page { padding: 16px 16px 48px; }
  .tabs { display: flex; width: 100%; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; font-size: 13px; padding: 8px 8px; justify-content: center; }
  .st-speeds td:first-child { min-width: 130px; }
  .st-speeds th, .st-speeds td { padding-left: 6px; padding-right: 6px; }
  .form-grid, .ad-form { grid-template-columns: minmax(0, 1fr); }
  .files-cols { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .ad-bar .push { margin-left: 0; }
  .toolbar select { width: 100%; }
  .modal-bg, .overlay { padding: 16px 10px; }
  .auth .card { padding: 28px 22px 24px; }
}
@media (max-width: 420px) {
  .header-tools { gap: 12px; }
  .user .btn { padding: 6px 10px; }
}

/* Tab bar sits just above <main> */
.tabs-wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 0; }
.tabs-wrap .tabs { margin-bottom: 0; }
.tabs-wrap + main.page { padding-top: 18px; }
main.page.narrow { max-width: 1280px; }
main.page.narrow > * { max-width: 860px; }
@media (max-width: 760px) { .tabs-wrap { padding: 16px 16px 0; } .tabs-wrap + main.page { padding-top: 14px; } }
