
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #98a1b2;
  --border: #e7e9f1;
  --primary: #6551eb;
  --primary-2: #7b63fa;
  --primary-soft: #f1edff;
  --shadow: 0 22px 60px rgba(35, 28, 76, .10);
  --green: #28b867;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --red: #e65362;
  --sidebar: #161326;
  --sidebar-2: #201a3a;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

button { cursor: pointer; }

.hidden { display: none !important; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(126,99,250,.25), transparent 32%),
    radial-gradient(circle at 85% 85%, rgba(47,95,220,.18), transparent 28%),
    linear-gradient(145deg, #21194c 0%, #382783 45%, #624af1 100%);
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.65), transparent);
}

.auth-card {
  position: relative;
  width: min(470px, 100%);
  background: rgba(255,255,255,.985);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 30px;
  padding: 30px;
  box-shadow: 0 40px 100px rgba(0,0,0,.26);
}

.brand-lockup, .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(145deg, #5c46e7, #7b63fa);
  box-shadow: 0 12px 28px rgba(101,81,235,.28);
}

.brand-mark.small { width: 42px; height: 42px; border-radius: 14px; font-size: 18px; }

.brand-name { font-weight: 900; letter-spacing: .14em; font-size: 12px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.auth-copy { margin-top: 34px; }

.eyebrow {
  color: var(--primary);
  font-weight: 900;
  font-size: 10px;
  letter-spacing: .17em;
}

.auth-copy h1, .topbar h1 {
  margin: 8px 0 8px;
  letter-spacing: -.035em;
}

.auth-copy h1 { font-size: clamp(30px, 6vw, 42px); }
.auth-copy p, .topbar p { color: var(--muted); margin: 0; line-height: 1.55; }

.auth-form {
  display: grid;
  gap: 15px;
  margin-top: 28px;
}

.auth-form label { display: grid; gap: 7px; }
.auth-form label > span { font-size: 12px; font-weight: 800; color: #4b5563; }

input, .select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: .18s ease;
}

.auth-form input {
  height: 52px;
  border-radius: 15px;
  padding: 0 15px;
}

input:focus, .select:focus {
  border-color: rgba(101,81,235,.6);
  box-shadow: 0 0 0 4px rgba(101,81,235,.09);
}

.auth-foot {
  margin-top: 20px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.shield-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(40,184,103,.12);
}

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 42px;
  padding: 0 15px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .16s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 24px rgba(101,81,235,.18);
}

.btn-secondary {
  color: #463c8c;
  background: var(--primary-soft);
  border: 1px solid rgba(101,81,235,.12);
}

.btn-ghost {
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
}

.btn-large { min-height: 52px; }
.full { width: 100%; }

.btn-spinner, .big-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.big-spinner { width: 28px; height: 28px; color: var(--primary); }

@keyframes spin { to { transform: rotate(360deg); } }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background:
    radial-gradient(circle at 80% 5%, rgba(123,99,250,.20), transparent 25%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar .brand-name { color: #fff; }
.sidebar .brand-sub { color: rgba(255,255,255,.54); }

.nav { display: grid; gap: 7px; margin-top: 30px; }

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.64);
  border-radius: 13px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(112,87,242,.30), rgba(255,255,255,.08));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.nav-count {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.08);
  font-size: 10px;
}

.nav-icon { font-size: 15px; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.status-dot.new { background: var(--orange); }
.status-dot.confirmed { background: #8b5cf6; }
.status-dot.printing { background: var(--blue); }
.status-dot.shipped { background: #06b6d4; }
.status-dot.delivered { background: var(--green); }
.status-dot.cancelled { background: var(--red); }

.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }

.admin-mini {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, #6d56ef, #8a73ff);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.admin-mini-copy { min-width: 0; display: grid; }
.admin-mini-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.admin-mini-copy span { color: rgba(255,255,255,.48); font-size: 9px; margin-top: 2px; }

.main { padding: 26px clamp(18px, 3vw, 38px) 40px; min-width: 0; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.topbar h1 { font-size: clamp(28px, 4vw, 40px); }
.topbar p { font-size: 13px; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.mobile-only { display: none; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  min-height: 96px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 19px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  box-shadow: 0 8px 24px rgba(25,22,48,.035);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.stat-icon.purple { color: var(--primary); background: var(--primary-soft); }
.stat-icon.orange { color: #d97706; background: #fff4df; }
.stat-icon.blue { color: #2563eb; background: #eaf2ff; }
.stat-icon.green { color: #168b4a; background: #e7f8ef; }

.stat-card div:last-child { display: grid; gap: 3px; }
.stat-card span { color: var(--muted); font-size: 10px; font-weight: 700; }
.stat-card strong { font-size: 26px; letter-spacing: -.04em; }

.orders-panel {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 32px rgba(26,23,52,.04);
  overflow: hidden;
}

.orders-toolbar {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-wrap {
  flex: 1 1 420px;
  max-width: 520px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface-soft);
}

.search-wrap span { color: var(--muted-2); }
.search-wrap input {
  border: 0;
  background: transparent;
  height: 100%;
  box-shadow: none;
  padding: 0;
  font-size: 12px;
}

.toolbar-right { display: flex; align-items: center; gap: 10px; }

.select {
  height: 42px;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
}

.select.large { height: 46px; }

.results-count { color: var(--muted); font-size: 10px; white-space: nowrap; }

.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 960px; }

th {
  text-align: left;
  color: #8b93a4;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 12px 14px;
  background: #fafbfe;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px;
  border-bottom: 1px solid #f0f1f5;
  vertical-align: middle;
  font-size: 11px;
}

tbody tr { transition: .14s ease; }
tbody tr:hover { background: #fbfbfe; }
tbody tr:last-child td { border-bottom: 0; }

.order-number { display: grid; gap: 3px; }
.order-number strong { font-size: 12px; }
.order-number span, .cell-sub { color: var(--muted); font-size: 9px; }

.customer-cell { display: grid; gap: 3px; }
.customer-cell strong { font-size: 11px; }

.vehicle-cell { display: grid; gap: 3px; }

.status-badge, .payment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.status-badge.new { color: #b45309; background: #fff4df; }
.status-badge.confirmed { color: #6d28d9; background: #f1eafe; }
.status-badge.printing { color: #1d4ed8; background: #e9f1ff; }
.status-badge.shipped { color: #0e7490; background: #e8f8fb; }
.status-badge.delivered { color: #167b43; background: #e7f8ef; }
.status-badge.cancelled { color: #b42335; background: #fdecef; }

.payment-badge { color: #7c3aed; background: #f1eafe; }

.row-action {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #4b5563;
  border-radius: 10px;
  min-height: 34px;
  padding: 0 11px;
  font-size: 10px;
  font-weight: 800;
}

.empty-state, .loading-state {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 7px;
  padding: 30px;
}

.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
}

.empty-state h3 { margin: 4px 0 0; }
.empty-state p, .loading-state p { margin: 0; color: var(--muted); font-size: 11px; }

.alert {
  margin: 12px 14px 0;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 650;
}

.alert.error { color: #a61b30; background: #fff0f2; border: 1px solid #ffd9df; }
.alert.success { color: #137443; background: #eaf8f0; border: 1px solid #ccefdc; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(18, 16, 30, .42);
  backdrop-filter: blur(9px);
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 35px 90px rgba(16,14,33,.28);
  border: 1px solid rgba(255,255,255,.65);
}

.modal-header {
  padding: 20px 22px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(16px);
  z-index: 2;
}

.modal-header h2 { margin: 9px 0 3px; font-size: 24px; letter-spacing: -.035em; }
.modal-header p { margin: 0; color: var(--muted); font-size: 10px; }

.modal-content { padding: 18px 22px 24px; display: grid; gap: 16px; }

.detail-section {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px;
  background: #fdfdff;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: #7c8495;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}

.detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-item.wide { grid-column: 1 / -1; }
.detail-item span, .payment-box span, .print-box span { color: var(--muted); font-size: 9px; }
.detail-item strong { font-size: 12px; overflow-wrap: anywhere; }

.payment-box, .print-box {
  min-height: 62px;
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.payment-box > div, .print-box > div { display: grid; gap: 4px; }
.print-box strong { font-size: 12px; }

.status-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.mobile-cards { display: none; }

.order-card-mobile {
  margin: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.order-card-mobile-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.order-card-mobile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.order-card-mobile-grid strong { display: block; color: var(--text); font-size: 11px; margin-top: 2px; }

.mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
}

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

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

  .sidebar {
    position: fixed;
    left: -270px;
    top: 0;
    width: 250px;
    transition: left .22s ease;
  }

  .sidebar.open { left: 0; }
  .mobile-only { display: grid; }

  .main { padding: 20px 14px 30px; }
  .topbar { align-items: flex-start; }
  .topbar p { max-width: 320px; }

  .orders-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-wrap { max-width: none; flex-basis: auto; }
  .toolbar-right { justify-content: space-between; }

  .desktop-table { display: none; }
  .mobile-cards { display: block; }

  .modal-backdrop { padding: 10px; place-items: end center; }
  .modal-card {
    width: 100%;
    max-height: 91vh;
    border-radius: 24px 24px 0 0;
  }
}

@media (max-width: 560px) {
  .auth-card { padding: 23px; border-radius: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 88px; padding: 12px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 12px; }
  .stat-card strong { font-size: 22px; }

  .topbar h1 { font-size: 30px; }
  .topbar p { display: none; }

  .toolbar-right { display: grid; grid-template-columns: 1fr auto; }
  .results-count { align-self: center; }

  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: auto; }

  .status-controls { grid-template-columns: 1fr; }
  .print-box { align-items: stretch; flex-direction: column; }
  .print-box .btn { width: 100%; }

  .order-card-mobile-grid { grid-template-columns: 1fr; }
}
