/* ============================================================================
   ANUBYTE — Shared Stylesheet
   Design System: Dark Obsidian · Neon Gradient · Chakra Petch / Sora / Space Mono
============================================================================ */

/* ---- Design tokens -------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg:              #07060B;
  --bg-elevated:     #0E0C15;
  --surface:         #181520;
  --surface-sunken:  #13111C;
  --surface-raised:  #1E1B2A;
  --surface-chip:    #262232;

  /* Borders */
  --border:          #322D44;
  --border-strong:   #463F5E;
  --hairline:        rgba(255,255,255,0.06);
  --hairline-strong: rgba(255,255,255,0.10);

  /* Text */
  --text:            #E7E3F3;
  --text-strong:     #F5F3FB;
  --text-secondary:  #B6AECE;
  --text-muted:      #8B82A6;
  --text-disabled:   #635A80;

  /* Neon palette */
  --neon-magenta:    #C81FF0;
  --neon-purple:     #8B2BF2;
  --neon-violet:     #6B3DF5;
  --neon-cyan:       #25D6F2;
  --neon-blue:       #2E6BFF;

  /* Gold */
  --gold-400:        #E2C067;
  --gold-500:        #C9A24B;
  --gold-a14:        rgba(201,162,75,0.14);
  --gold-a28:        rgba(201,162,75,0.28);

  /* Gradients */
  --grad-neon:       linear-gradient(105deg, #C81FF0 0%, #7B36F0 38%, #2E6BFF 72%, #25D6F2 100%);
  --grad-gold-soft:  linear-gradient(135deg, #C9A24B 0%, #E2C067 100%);
  --inset-sheen:     inset 0 1px 0 rgba(255,255,255,0.06);

  /* Status */
  --success:         #2FD27A;
  --success-bg:      rgba(47,210,122,0.12);
  --warning:         #E2C067;
  --warning-bg:      rgba(226,192,103,0.12);
  --danger:          #FF4D6D;
  --danger-bg:       rgba(255,77,109,0.12);
  --info:            #25D6F2;
  --info-bg:         rgba(37,214,242,0.12);

  /* Glows */
  --glow-magenta:    0 0 0 1px rgba(200,31,240,0.35), 0 0 22px rgba(200,31,240,0.40);
  --glow-cyan:       0 0 0 1px rgba(37,214,242,0.35), 0 0 22px rgba(37,214,242,0.40);
  --shadow-2:        0 4px 14px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.6);
  --shadow-3:        0 12px 36px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.5);

  /* Typography */
  --font-display:    'Chakra Petch', 'Rajdhani', system-ui, sans-serif;
  --font-sans:       'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:       'Space Mono', 'JetBrains Mono', ui-monospace, monospace;

  /* Radii */
  --r-xs:     4px;
  --r-sm:     8px;
  --r-md:     12px;
  --r-lg:     18px;
  --r-xl:     26px;
  --r-card:   16px;
  --r-pill:   999px;
  --r-control:12px;

  /* Motion */
  --dur:      200ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Legacy aliases used by page inline styles (v2 pages) */
  --bg-raised:     var(--surface-raised);
  --text-dim:      var(--text-disabled);
  --purple-bright: #BD8CFF;
  --blue-bright:   #6BA5FF;
  --bad:           var(--danger);
}

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--neon-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top nav -------------------------------------------------------------- */
.nav {
  background: rgba(7,6,11,0.80);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 var(--hairline), 0 4px 24px rgba(0,0,0,0.4);
}
.nav .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--grad-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav .brand img {
  width: 28px; height: 28px;
  border-radius: 8px;
  object-fit: cover;
}
.nav .brand .brand-logo {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-text-fill-color: initial;
}
.nav .brand .brand-logo svg {
  width: 100%; height: 100%; display: block;
  filter: drop-shadow(0 0 8px rgba(139,43,242,0.4));
}
.nav .brand .brand-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-disabled);
  font-weight: 400;
  letter-spacing: 0.16em;
  margin-left: 6px;
  text-transform: uppercase;
  align-self: flex-end;
  padding-bottom: 4px;
}
.nav-tabs { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; min-width: 0; }
.nav-tabs a {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 11px;
  border-radius: var(--r-md);
  white-space: nowrap;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.nav-tabs a:hover {
  color: var(--text);
  background: var(--surface-raised);
  text-decoration: none;
}
.nav-tabs a.active {
  background: linear-gradient(135deg, rgba(200,31,240,0.2), rgba(107,61,245,0.2));
  color: var(--text-strong);
  border: 1px solid rgba(200,31,240,0.3);
}
.nav-right { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  border: 1px solid var(--border-strong);
  background: var(--surface-chip);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--dur) var(--ease-out);
}
.lang-toggle:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}
.hamburger {
  display: none;
  background: transparent; border: 0;
  font-size: 20px;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--text-muted);
  border-radius: var(--r-sm);
}
.hamburger:hover { color: var(--text); background: var(--surface-raised); }
.user-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--neon-cyan);
  background: var(--info-bg);
  border: 1px solid rgba(37,214,242,0.3);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Page wrapper --------------------------------------------------------- */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}
.page h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: var(--text-strong);
}
.page h1 .ar {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 10px;
}
.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

/* ---- Cards ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-2), var(--inset-sheen);
  transition: border-color var(--dur) var(--ease-out);
}
.card:hover { border-color: var(--hairline-strong); }
.card h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 18px;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2 .ar {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ---- KPI grid ------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-2), var(--inset-sheen);
  transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-neon);
  opacity: 0.5;
}
.kpi:hover { border-color: var(--hairline-strong); transform: translateY(-1px); }
.kpi .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.4;
}
.kpi .label .ar {
  display: block;
  font-family: var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
  font-size: 11px;
  color: var(--text-disabled);
  font-style: italic;
  margin-top: 2px;
}
.kpi .value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--neon-cyan);
  margin-top: 10px;
  line-height: 1;
}
.kpi.alert .value { color: var(--danger); }
.kpi.alert::before { background: var(--danger); }
.kpi.warn  .value { color: var(--warning); }
.kpi.warn::before { background: var(--warning); }

/* ---- Forms ---------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px 20px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field label .req { color: var(--danger); }
.field .ar-label {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  display: block;
  margin-top: -2px;
  margin-bottom: 2px;
}
.field input,
.field select,
.field textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface-sunken);
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
  appearance: none;
  -webkit-appearance: none;
}
.field select {
  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 1l5 5 5-5' stroke='%238B82A6' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(37,214,242,0.15);
}
.field textarea { resize: vertical; min-height: 68px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-disabled); }

/* Auto-calculated / read-only field */
.field.auto input,
.field.auto .auto-value {
  background: rgba(107,61,245,0.10);
  border: 1px dashed rgba(107,61,245,0.5);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
}
.auto-value {
  padding: 10px 12px;
  border-radius: var(--r-control);
  min-height: 40px;
  display: flex;
  align-items: center;
}
.field.auto { position: relative; }
.field.auto::after {
  content: "Auto";
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: linear-gradient(135deg, #6B3DF5, #C81FF0);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  pointer-events: none;
}

/* Checkbox */
.field input[type="checkbox"] {
  width: 18px; height: 18px;
  padding: 0;
  border-radius: var(--r-xs);
  background: var(--surface-chip);
  border-color: var(--border-strong);
  accent-color: var(--neon-magenta);
  cursor: pointer;
}

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 20px;
  height: 42px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--surface-chip);
  color: var(--text-secondary);
  transition: all var(--dur) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-raised); color: var(--text); border-color: var(--border); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--grad-neon);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--glow-magenta);
}
.btn.primary:hover {
  box-shadow: 0 0 40px rgba(200,31,240,0.55), 0 0 90px rgba(200,31,240,0.25);
  transform: translateY(-1px);
}
.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.btn.ghost:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); background: transparent; }
.btn.danger {
  background: var(--danger-bg);
  border-color: rgba(255,77,109,0.4);
  color: var(--danger);
}
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn-small { height: 34px; padding: 0 14px; font-size: 12px; }

/* ---- Multi-spool repeater (print jobs) ------------------------------------ */
.spool-row {
  display: grid;
  grid-template-columns: 1fr 130px auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  background: var(--surface-sunken);
}
.spool-row .field { gap: 2px; }
.spool-row .remove-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 14px;
  line-height: 1;
  transition: all var(--dur) var(--ease-out);
}
.spool-row .remove-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ---- Tables --------------------------------------------------------------- */
.table-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  max-width: 340px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface-sunken);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.search-box input::placeholder { color: var(--text-disabled); }
.search-box input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(37,214,242,0.15);
}
.search-box::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5' stroke='currentColor' stroke-width='1.5' fill='none'/%3E%3Cline x1='13' y1='13' x2='17' y2='17' stroke='currentColor' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5' stroke='currentColor' stroke-width='1.5' fill='none'/%3E%3Cline x1='13' y1='13' x2='17' y2='17' stroke='currentColor' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.search-box:focus-within::before { background: var(--neon-cyan); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  overflow: auto;
  box-shadow: var(--shadow-2);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data thead th {
  text-align: left;
  padding: 11px 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--dur);
}
table.data thead th:hover { color: var(--neon-cyan); }
table.data thead th .sort-arrow { opacity: .4; margin-left: 4px; font-size: 10px; }
table.data thead th.sorted .sort-arrow { opacity: 1; color: var(--neon-cyan); }
table.data tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-secondary);
  white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr {
  transition: background var(--dur);
  cursor: pointer;
}
table.data tbody tr:hover td {
  background: var(--surface-raised);
  color: var(--text);
}
table.data .id-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon-cyan);
  font-weight: 400;
  cursor: pointer;
}
table.data .id-link:hover { text-decoration: underline; }
table.data td.auto-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--neon-cyan);
}
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* ---- Status badges -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge.ok      { background: var(--success-bg); color: var(--success); border: 1px solid rgba(47,210,122,0.3); }
.badge.warn    { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(226,192,103,0.3); }
.badge.bad     { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,77,109,0.3); }
.badge.neutral { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--hairline); }
.badge.info    { background: var(--info-bg); color: var(--info); border: 1px solid rgba(37,214,242,0.3); }

/* ---- Progress bar --------------------------------------------------------- */
.bar {
  position: relative;
  background: var(--surface-chip);
  border-radius: var(--r-pill);
  height: 6px;
  overflow: hidden;
  min-width: 100px;
}
.bar .fill {
  height: 100%;
  background: var(--grad-neon);
  border-radius: var(--r-pill);
  transition: width .4s var(--ease-out);
}
.bar.warn .fill { background: var(--warning); }
.bar.bad  .fill { background: var(--danger); box-shadow: 0 0 8px rgba(255,77,109,0.5); }

/* ---- Social icons --------------------------------------------------------- */
.social { display: inline-flex; gap: 4px; }
.social a {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-chip);
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--hairline);
  transition: all var(--dur);
}
.social a.ig { background: rgba(194,24,91,0.15); color: #f48fb1; border-color: rgba(194,24,91,0.3); }
.social a.fb { background: rgba(24,119,242,0.15); color: #90caf9; border-color: rgba(24,119,242,0.3); }
.social a.tt { background: var(--surface-chip); color: var(--text-secondary); }
.social a:hover { transform: scale(1.12); text-decoration: none; }

/* ---- Modal ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7,6,11,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-xl);
  max-width: 740px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: 28px;
  box-shadow: var(--shadow-3), var(--inset-sheen), 0 0 60px rgba(107,61,245,0.12);
  animation: modal-in 0.22s var(--ease-out);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 20px;
  color: var(--text-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal .close-x {
  border: none; background: transparent; cursor: pointer;
  font-size: 20px; color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur);
}
.modal .close-x:hover { background: var(--surface-raised); color: var(--text); }

/* ---- Loading spinner ------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  vertical-align: middle;
}
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row {
  padding: 36px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
}

/* ---- Toast ---------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 13.5px;
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.22s var(--ease-out);
  pointer-events: none;
  max-width: 340px;
  box-shadow: var(--shadow-3);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error   { background: var(--danger-bg);  border-color: rgba(255,77,109,0.4);   color: var(--danger); }
.toast.success { background: var(--success-bg); border-color: rgba(47,210,122,0.35);  color: var(--success); }

/* ---- Table footer (expenses total) --------------------------------------- */
table.data tfoot td {
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-strong);
  border-top: 1px solid var(--border);
  padding: 11px 14px;
}

/* ---- Arabic / RTL -------------------------------------------------------- */
html.ar body {
  direction: rtl;
  font-family: "Segoe UI", "Tahoma", "Arial", var(--font-sans), sans-serif;
}
html.ar .nav-tabs a,
html.ar .kpi .label,
html.ar .field label { text-align: right; }
html.ar .field .ar-label { display: none; }
html.ar .field label .en-label { display: none; }
html.ar table.data thead th,
html.ar table.data tbody td { text-align: right; }
html.ar .field select {
  background-position: left 12px center;
  padding-right: 12px;
  padding-left: 32px;
}
html:not(.ar) .ar-only { display: none; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1400px) {
  .nav .brand .brand-tag { display: none; }
}
@media (max-width: 768px) {
  .nav-tabs {
    display: none;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: rgba(7,6,11,0.96);
    backdrop-filter: blur(18px);
    flex-direction: column;
    padding: 10px;
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow-3);
  }
  .nav-tabs.open { display: flex; }
  .nav-tabs a { padding: 12px 14px; }
  .hamburger { display: inline-flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .nav .brand .brand-tag { display: none; }
  .spool-row { grid-template-columns: 1fr; }
  .page { padding: 16px 14px 60px; }
  .modal { padding: 20px; border-radius: var(--r-lg); }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .nav .brand { font-size: 15px; }
  .kpi .value { font-size: 26px; }
}

/* ---- Scrollbar styling --------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-chip); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ---- Focus visible -------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
