/* ══════════════════════════════════════════════════════════════════
   MASTER AUTO  ·  Professional Design System  ·  v3.0
   ══════════════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Tajawal:wght@400;500;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap");

/* ── Design Tokens ───────────────────────────────────────────────── */
:root {
  /* Typography */
  --f-body:    "IBM Plex Sans Arabic", "Dubai", "Segoe UI", Tahoma, Arial, sans-serif;
  --f-display: "Tajawal", "IBM Plex Sans Arabic", "Cairo", Tahoma, Arial, sans-serif;
  --f-num:     "JetBrains Mono", "Segoe UI", monospace;

  /* Brand Red */
  --red-700: #b91c1c;
  --red-600: #c81e1e;
  --red-500: #d71920;
  --red-400: #ef4444;
  --red-100: #fee2e2;
  --red-50:  #fff5f5;

  /* Ink Scale */
  --ink-900: #0a0d12;
  --ink-800: #0f1117;
  --ink-700: #1e2330;
  --ink-600: #2d3748;
  --ink-500: #374151;
  --ink-400: #4b5563;
  --ink-300: #6b7280;
  --ink-200: #9ca3af;
  --ink-100: #d1d5db;

  /* Surface */
  --surface-0: #ffffff;
  --surface-1: #f8f9fc;
  --surface-2: #f1f4f9;
  --surface-3: #e8ecf4;
  --border:    #e2e7f0;
  --border-2:  #d1d9e6;

  /* Semantic */
  --accent:       var(--red-500);
  --accent-dark:  var(--red-700);
  --accent-hover: var(--red-600);
  --accent-soft:  var(--red-50);
  --accent-mid:   var(--red-100);

  --ok:    #059669;
  --ok-bg: #ecfdf5;
  --warn:  #d97706;
  --warn-bg: #fffbeb;
  --info:  #2563eb;
  --info-bg: #eff6ff;

  /* Sidebar */
  --s-bg:   #0c0f18;
  --s-card: #131926;
  --s-row:  #1a2235;
  --s-text: #c8d4e4;
  --s-dim:  #6e7f96;
  --s-line: rgba(255,255,255,0.06);

  /* Elevation */
  --z0: 0 0 0 1px rgba(15,23,42,0.06);
  --z1: 0 1px 4px rgba(15,23,42,0.07), 0 1px 2px rgba(15,23,42,0.05);
  --z2: 0 4px 16px rgba(15,23,42,0.09), 0 2px 6px rgba(15,23,42,0.06);
  --z3: 0 12px 36px rgba(15,23,42,0.12), 0 4px 14px rgba(15,23,42,0.08);
  --z4: 0 24px 64px rgba(10,15,30,0.18), 0 8px 24px rgba(10,15,30,0.10);
  --z-red: 0 4px 18px rgba(215,25,32,0.30);

  /* Geometry */
  --r1: 6px;
  --r2: 10px;
  --r3: 14px;
  --r4: 20px;
  --pill: 9999px;

  /* Motion */
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  --snappy: cubic-bezier(0.4, 0, 0.2, 1);
  --ms-fast: 130ms;
  --ms-std:  240ms;
  --ms-slow: 400ms;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { min-height: 100%; }

body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background: var(--surface-2);
  color: var(--ink-800);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }


/* ══════════════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--s-bg);
  overflow: hidden;
}

/* Radial accent glow */
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(215,25,32,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 80% 100%, rgba(215,25,32,0.07) 0%, transparent 60%);
  pointer-events: none;
}

/* Subtle grid */
.login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
}

.login-screen.hidden { display: none; }

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: grid;
  gap: 0;
  background: var(--s-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r4);
  box-shadow: 0 48px 96px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
  animation: loginIn 0.55s var(--spring) both;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Red top stripe */
.login-card::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--red-500), var(--red-700), var(--s-bg));
}

.login-card > img {
  width: 150px;
  max-width: 60%;
  justify-self: center;
  margin: 36px auto 0;
  filter: drop-shadow(0 6px 20px rgba(215,25,32,0.45));
}

.login-card h2 {
  text-align: center;
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin: 16px 0 0;
  padding: 0 32px;
}

.login-card form {
  display: grid;
  gap: 16px;
  padding: 28px 32px 36px;
}

.login-card label {
  display: grid;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--s-dim);
}

.login-card input {
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.08);
  color: #fff;
  border-radius: var(--r2);
  min-height: 46px;
}

.login-card input:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(215,25,32,0.55);
  box-shadow: 0 0 0 4px rgba(215,25,32,0.12);
}

.login-card input::placeholder { color: rgba(255,255,255,0.2); }

.login-error {
  min-height: 18px;
  color: #fc8181;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.login-card .primary-button {
  margin-top: 4px;
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  letter-spacing: 0.3px;
  border-radius: var(--r2);
}


/* ══════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 20px;
  background: var(--s-bg);
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  border-left: 1px solid var(--s-line);
}
.sidebar::-webkit-scrollbar { display: none; }

/* ── Brand ── */
.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--s-line);
  overflow: hidden;
}

.brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(215,25,32,0.1), transparent 60%);
  pointer-events: none;
}

.brand-logo {
  flex: 0 0 50px;
  width: 50px;
  height: 38px;
  object-fit: contain;
  background: #fff;
  border-radius: var(--r1);
  padding: 3px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.brand h1 {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.brand p { font-size: 11px; color: var(--s-dim); margin-top: 1px; }

/* ── Nav ── */
.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 10px;
  flex: 1;
}

.nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r2);
  color: var(--s-text);
  background: transparent;
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  transition:
    background var(--ms-fast) var(--snappy),
    color     var(--ms-fast) var(--snappy);
}

/* Icon mapping via pseudo-element */
.nav-item[data-view]::before {
  font-size: 16px;
  flex: 0 0 auto;
  opacity: 0.7;
}
.nav-item[data-view="dashboard"]::before  { content: "◈"; }
.nav-item[data-view="orders"]::before     { content: "⚙"; }
.nav-item[data-view="inventory"]::before  { content: "▤"; }
.nav-item[data-view="invoices"]::before   { content: "▦"; }
.nav-item[data-view="customers"]::before  { content: "◉"; }
.nav-item[data-view="services"]::before   { content: "◎"; }
.nav-item[data-view="expenses"]::before   { content: "▷"; }
.nav-item[data-view="purchases"]::before  { content: "◐"; }
.nav-item[data-view="reports"]::before    { content: "◑"; }
.nav-item[data-view="users"]::before      { content: "◈"; }
.nav-item[data-view="settings"]::before   { content: "◆"; }

.nav-item:hover {
  background: var(--s-row);
  color: #fff;
}
.nav-item:hover::before { opacity: 1; }

.nav-item.active {
  background: linear-gradient(90deg, rgba(215,25,32,0.22) 0%, rgba(215,25,32,0.08) 100%);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(215,25,32,0.22);
}

.nav-item.active::before { opacity: 1; color: var(--red-400); }

/* Active indicator bar */
.nav-item.active::after {
  content: "";
  position: absolute;
  top: 7px; bottom: 7px; right: 0;
  width: 3px;
  border-radius: var(--pill);
  background: var(--red-500);
  box-shadow: 0 0 10px rgba(215,25,32,0.7);
}

/* ── Sidebar Alert ── */
.sidebar-note {
  margin: 10px 10px 0;
  padding: 12px 14px;
  border: 1px solid var(--s-line);
  border-radius: var(--r2);
  background: var(--s-card);
  display: grid;
  gap: 6px;
}

.sidebar-note strong {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-note strong::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red-500);
  box-shadow: 0 0 8px rgba(215,25,32,0.8);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%,100% { opacity:1; } 50% { opacity:0.2; }
}

.sidebar-note span { font-size: 12px; color: var(--s-dim); line-height: 1.65; }


/* ══════════════════════════════════════════════════════════════════
   MAIN SHELL
══════════════════════════════════════════════════════════════════ */
.app-shell {
  padding: 20px 24px 32px;
  min-width: 0;
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding: 10px 18px;
  background: rgba(248,249,252,0.92);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--z2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
}

.topbar h2 {
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--ink-800);
  letter-spacing: -0.5px;
  line-height: 1.25;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions select { width: 185px; }


/* ══════════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════════ */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--r2);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: var(--z-red);
  transition:
    background  var(--ms-fast) var(--snappy),
    box-shadow  var(--ms-fast) var(--snappy),
    transform   var(--ms-fast) var(--spring);
  cursor: pointer;
  white-space: nowrap;
}

.primary-button:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(215,25,32,0.38);
  transform: translateY(-1px);
}

.primary-button:active { transform: translateY(0); box-shadow: var(--z-red); }

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  background: var(--surface-0);
  color: var(--ink-500);
  border: 1.5px solid var(--border);
  border-radius: var(--r2);
  font-size: 14px;
  font-weight: 600;
  transition:
    background var(--ms-fast) var(--snappy),
    border-color var(--ms-fast) var(--snappy),
    color var(--ms-fast) var(--snappy),
    transform var(--ms-fast) var(--spring);
  cursor: pointer;
  white-space: nowrap;
}

.ghost-button:hover {
  background: var(--surface-1);
  border-color: var(--border-2);
  color: var(--ink-700);
  transform: translateY(-1px);
}

.text-button {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--accent-dark);
  border: 0;
  padding: 0 4px;
  min-height: 28px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: var(--r1);
  transition: color var(--ms-fast), opacity var(--ms-fast);
  cursor: pointer;
}

.text-button:hover { color: var(--red-700); text-decoration: underline; }

button:disabled { cursor: not-allowed; opacity: 0.4; pointer-events: none; }

.danger-button {
  color: var(--red-700);
  border-color: var(--red-100);
}
.danger-button:hover {
  background: var(--red-50);
  border-color: var(--red-100);
  color: var(--red-700);
}

.print-button  { color: var(--accent-dark); }
.table-button  { min-height: 32px; padding: 0 12px; font-size: 13px; }


/* ══════════════════════════════════════════════════════════════════
   VIEWS
══════════════════════════════════════════════════════════════════ */
.view { display: none; }
.view.active {
  display: block;
  animation: viewIn 0.28s var(--spring) both;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════════════════════════════
   STATS GRID
══════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 16px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--z1);
  display: grid;
  gap: 8px;
  transition: box-shadow var(--ms-std) var(--spring), transform var(--ms-std) var(--spring);
}

.stat:hover {
  box-shadow: var(--z3);
  transform: translateY(-3px);
}

/* Top accent stripe */
.stat::after {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red-500) 0%, rgba(215,25,32,0.12) 100%);
}

.stat span {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-300);
}

.stat strong {
  font-family: var(--f-num);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-800);
  letter-spacing: -0.5px;
}


/* ══════════════════════════════════════════════════════════════════
   CONTENT GRID
══════════════════════════════════════════════════════════════════ */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.45fr);
  gap: 16px;
}

.workflow-panel { grid-column: 1 / -1; }

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-steps div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: var(--surface-1);
  transition: border-color var(--ms-std) var(--snappy), background var(--ms-std) var(--snappy);
}

.workflow-steps div:hover {
  border-color: rgba(215,25,32,0.28);
  background: var(--red-50);
}

.workflow-steps strong {
  flex: 0 0 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--z-red);
}

.workflow-steps span { font-size: 13px; color: var(--ink-500); font-weight: 500; }


/* ══════════════════════════════════════════════════════════════════
   PANELS
══════════════════════════════════════════════════════════════════ */
.panel {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--z1);
  padding: 20px;
}

.panel.plain { padding: 0; overflow: hidden; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h3 {
  font-family: var(--f-display);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink-700);
  letter-spacing: -0.15px;
}


/* ══════════════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: right;
  padding: 11px 15px;
  border-bottom: 1px solid var(--surface-2);
  white-space: nowrap;
}

th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-300);
  background: var(--surface-1);
  border-bottom-color: var(--border);
}

td { font-size: 14px; color: var(--ink-600); }

tr:last-child td { border-bottom: 0; }

tr:hover td {
  background: var(--surface-1);
  color: var(--ink-800);
}

tbody tr { transition: background var(--ms-fast); }


/* ══════════════════════════════════════════════════════════════════
   SECTION TOOLBAR
══════════════════════════════════════════════════════════════════ */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 10px 16px;
  background: rgba(248,249,252,0.9);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--z1);
  backdrop-filter: blur(10px);
}


/* ══════════════════════════════════════════════════════════════════
   FORM CONTROLS
══════════════════════════════════════════════════════════════════ */
input, textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  background: var(--surface-0);
  border: 1.5px solid var(--border);
  border-radius: var(--r2);
  color: var(--ink-700);
  font-size: 14.5px;
  font-weight: 500;
  outline: none;
  transition:
    border-color var(--ms-fast) var(--snappy),
    box-shadow   var(--ms-fast) var(--snappy);
  appearance: auto;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(215,25,32,0.45);
  box-shadow: 0 0 0 4px rgba(215,25,32,0.09);
}

input::placeholder, textarea::placeholder { color: var(--ink-200); }
textarea { min-height: 96px; resize: vertical; }
.section-toolbar input, .section-toolbar input[type="search"] { max-width: 380px; }

/* Search input icon placeholder */
input[type="search"] { padding-right: 14px; }


/* ══════════════════════════════════════════════════════════════════
   SEGMENTED CONTROL
══════════════════════════════════════════════════════════════════ */
.segmented-control {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  border-radius: var(--r2);
}

.segmented-control button {
  border: 0;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--r1);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-400);
  background: transparent;
  transition: background var(--ms-fast), color var(--ms-fast), box-shadow var(--ms-fast);
  cursor: pointer;
}

.segmented-control button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--z-red);
}

.segmented-control button:hover:not(.active) {
  background: var(--surface-3);
  color: var(--ink-700);
}


/* ══════════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════════ */
.cards-list, .stack-list { display: grid; gap: 12px; }

.order-card, .invoice-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--z1);
  padding: 16px 20px;
  transition:
    box-shadow var(--ms-std) var(--spring),
    transform  var(--ms-std) var(--spring),
    border-color var(--ms-std);
}

.order-card:hover, .invoice-card:hover {
  box-shadow: var(--z3);
  border-color: var(--border-2);
  transform: translateY(-2px);
}

.order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.card-actions, .inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-actions { justify-content: flex-end; }

.invoice-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.card-title strong {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-800);
}

.meta {
  font-size: 13px;
  color: var(--ink-300);
  line-height: 1.8;
}

.amount {
  font-family: var(--f-num);
  font-size: 19px;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: -0.5px;
}

.stack-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  transition: background var(--ms-fast);
}
.stack-item:hover { background: var(--surface-1); }


/* ══════════════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 10px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-dark);
  white-space: nowrap;
}

.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.done { background: var(--ok-bg);   color: var(--ok);   }
.badge.info { background: var(--info-bg); color: var(--info); }

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}


/* ══════════════════════════════════════════════════════════════════
   REPORTS
══════════════════════════════════════════════════════════════════ */
.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px 26px;
  background: linear-gradient(135deg, var(--ink-700), var(--s-bg) 90%);
  border-radius: var(--r3);
  color: #fff;
  box-shadow: var(--z2);
}

.report-head img {
  width: 96px;
  height: 60px;
  object-fit: contain;
  background: rgba(255,255,255,0.07);
  border-radius: var(--r2);
  padding: 6px;
}

.report-head h3 {
  font-family: var(--f-display);
  font-size: 21px;
  font-weight: 800;
  color: #fff;
}

.report-head .eyebrow { color: rgba(215,25,32,0.85); }
.report-head .meta    { color: rgba(255,255,255,0.42); font-size: 13px; }
.report-stats { margin-bottom: 18px; }


/* ══════════════════════════════════════════════════════════════════
   SETTINGS
══════════════════════════════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-grid .panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.settings-grid label {
  display: grid;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-500);
}

.maintenance-panel {
  border-color: rgba(215,25,32,0.22);
  background: linear-gradient(160deg, var(--surface-0), var(--red-50));
}

.maintenance-panel .panel-header h3 { color: var(--red-700); }

.field-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-300);
  line-height: 1.65;
}

.app-footer {
  margin-top: 18px;
  padding: 14px 0 0;
  color: var(--ink-300);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border-top: 1px solid var(--line);
}


/* ══════════════════════════════════════════════════════════════════
   MODALS / DIALOGS
══════════════════════════════════════════════════════════════════ */
dialog {
  border: 0;
  padding: 0;
  width: min(580px, calc(100vw - 24px));
  border-radius: var(--r4);
  box-shadow: var(--z4);
  background: var(--surface-0);
}

dialog[open] { animation: dialogIn 0.32s var(--spring) both; }

@keyframes dialogIn {
  from { opacity: 0; transform: scale(0.96) translateY(-12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

dialog::backdrop {
  background: rgba(8,12,24,0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.wide-dialog { width: min(980px, calc(100vw - 24px)); }

.modal-form {
  display: grid;
  gap: 16px;
  padding: 26px 28px;
}

.modal-form h3 {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-800);
  letter-spacing: -0.3px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.form-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.form-row > * { flex: 1 1 0; min-width: 0; }

.vehicle-entry {
  padding: 14px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r2);
  background: var(--surface-1);
  display: grid;
  gap: 10px;
}

.photo-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.photo-strip img {
  width: 72px;
  height: 54px;
  border: 1.5px solid var(--border);
  border-radius: var(--r2);
  object-fit: cover;
  background: var(--surface-1);
}


/* ══════════════════════════════════════════════════════════════════
   STATEMENT MODAL
══════════════════════════════════════════════════════════════════ */
.statement-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.statement-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.statement-summary div {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px 14px;
  display: grid;
  gap: 5px;
}

.statement-summary span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-300);
}

.statement-summary strong {
  font-family: var(--f-num);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-700);
}

.statement-table {
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: auto;
}


/* ══════════════════════════════════════════════════════════════════
   MISC
══════════════════════════════════════════════════════════════════ */
.info-row td { color: var(--ink-300); background: var(--surface-1); }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-200);
  font-size: 14px;
  font-weight: 500;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-100); }


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE – 1100px
══════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  body { grid-template-columns: 240px minmax(0, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE – 940px  (tablet)
══════════════════════════════════════════════════════════════════ */
@media (max-width: 940px) {
  body { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    padding: 10px 12px 12px;
    border-left: 0;
    border-bottom: 1px solid var(--s-line);
  }

  .brand { padding: 10px 12px; }

  .nav {
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 6px 0 4px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }

  .nav-item {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
  }

  .nav-item.active::after { display: none; }
  .nav-item[data-view]::before { display: none; }

  .sidebar-note { display: none; }

  .content-grid { grid-template-columns: 1fr; }
  .workflow-steps { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .topbar { position: static; }
}


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE – 640px  (mobile)
══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  body { font-size: 14px; }

  .login-screen { align-items: flex-start; overflow-y: auto; padding: 16px; }
  .login-card { margin-top: 16px; border-radius: var(--r3); }
  .login-card > img { width: 120px; margin-top: 28px; }
  .login-card form { padding: 22px 22px 28px; }

  .app-shell { padding: 12px 14px 28px; }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
  }

  .top-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .top-actions select { width: 100%; }

  .topbar h2 { font-size: 21px; }

  .section-toolbar { flex-direction: column; align-items: stretch; }
  .section-toolbar input { max-width: none; }

  .stats-grid,
  .content-grid,
  .workflow-steps,
  .settings-grid,
  .statement-summary { grid-template-columns: 1fr; }

  .form-row { flex-direction: column; gap: 10px; }

  dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    overflow-y: auto;
    border-radius: var(--r3);
  }

  .modal-form { padding: 18px 18px 22px; }
  .modal-form h3 { font-size: 18px; }

  .order-card { grid-template-columns: 1fr; }
  .card-actions { justify-content: flex-start; }

  .stat strong { font-size: 20px; }
  .amount { font-size: 17px; }
  .panel { padding: 14px; }
  .panel h3 { font-size: 14.5px; }
}


/* ══════════════════════════════════════════════════════════════════
   PRINT
══════════════════════════════════════════════════════════════════ */
@media print {
  .sidebar,
  .topbar,
  .section-toolbar { display: none !important; }
  body { display: block; }
  .app-shell { padding: 0; }
  .view { display: block !important; }
}
