:root {
  color-scheme: light;
  --primary: #99E1D9;
  --primary-strong: #5ECAC0;
  --primary-soft: #d9f4ef;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fff4cf;
  --danger: #be123c;
  --danger-soft: #ffe4e6;
  --violet: #99E1D9;
  --violet-soft: #ecebff;
  --text: #171717;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e4e7ec;
  --surface: #ffffff;
  --surface-soft: #f6f7f9;
  --canvas: #f7f8fb;
  --shadow: 0 10px 24px rgba(16, 24, 40, .06);
  --sidebar-width: 248px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --primary: #99E1D9;
  --primary-strong: #BDF3ED;
  --primary-soft: #123b38;
  --success: #4ade80;
  --success-soft: #12351f;
  --warning: #fbbf24;
  --warning-soft: #3a2b0b;
  --danger: #fb7185;
  --danger-soft: #401821;
  --violet: #BDF3ED;
  --violet-soft: #262244;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --subtle: #737373;
  --line: #2f2f32;
  --surface: #18181b;
  --surface-soft: #222225;
  --canvas: #101012;
  --shadow: 0 10px 26px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
}
body.auth-mode .sidebar, body.auth-mode .app-shell { display: none; }
body:not(.auth-mode) .auth-root { display: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.material-symbols-rounded { font-size: 20px; line-height: 1; }
.muted { color: var(--muted); }
.mobile-only { display: none !important; }

.auth-root {
  align-items: center;
  background: linear-gradient(135deg, #111827 0%, #99E1D9 52%, #111827 100%);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 22px;
}
.auth-layout {
  display: grid;
  gap: 38px;
  grid-template-columns: 1.05fr .95fr;
  max-width: 1000px;
  width: 100%;
}
.auth-copy { align-self: center; color: #fff; }
.auth-brand { align-items: center; display: flex; gap: 12px; margin-bottom: 38px; }
.auth-brand .brand-mark { height: 44px; width: 44px; }
.auth-brand strong { display: block; font-size: 27px; letter-spacing: 0; }
.auth-brand span { color: #9db7de; display: block; font-size: 11px; letter-spacing: .9px; text-transform: uppercase; }
.auth-copy h1 { font-size: 42px; letter-spacing: 0; line-height: 1.08; margin-bottom: 16px; max-width: 520px; }
.auth-copy p { color: #b9c8df; font-size: 15px; line-height: 1.65; max-width: 530px; }
.auth-benefits { display: grid; gap: 11px; margin-top: 27px; }
.auth-benefits span { align-items: center; color: #d9e5f7; display: flex; gap: 9px; font-size: 13px; }
.auth-benefits .material-symbols-rounded { color: #99E1D9; }
.auth-panel { background: var(--surface); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; box-shadow: 0 24px 65px rgba(0,0,0,.28); padding: 28px; }
.auth-panel h2 { font-size: 23px; margin-bottom: 7px; }
.auth-panel .form-grid { grid-template-columns: 1fr; }
.auth-panel .button { width: 100%; }
.auth-divider { align-items: center; color: var(--muted); display: flex; font-size: 11px; gap: 10px; margin: 19px 0; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { background: var(--line); content: ""; height: 1px; width: 100%; }
.auth-back { margin-bottom: 16px; }

.sidebar {
  background: #141414;
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;
  left: 0;
  padding: 18px 14px;
  position: fixed;
  top: 0;
  width: var(--sidebar-width);
  z-index: 30;
}
.brand { align-items: center; display: flex; gap: 11px; padding: 2px 7px 21px; }
.brand-mark {
  align-items: center; background: linear-gradient(135deg, #99E1D9, #99E1D9);
  border-radius: 8px; display: flex; font-size: 21px; font-weight: 800;
  height: 38px; justify-content: center; width: 38px;
}
.brand strong { display: block; font-size: 22px; letter-spacing: 0; line-height: 1; }
.brand span { color: #9eb0cc; display: block; font-size: 10px; margin-top: 3px; text-transform: uppercase; }
.main-nav { overflow-y: auto; }
.nav-group { color: #71839e; display: block; font-size: 10px; font-weight: 700; letter-spacing: 1px; margin: 18px 10px 7px; text-transform: uppercase; }
.nav-item {
  align-items: center; background: transparent; border: 0; border-radius: 8px; color: #d4d4d8;
  display: flex; gap: 11px; margin: 2px 0; padding: 10px 10px; text-align: left; transition: .2s; width: 100%;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #99E1D9; box-shadow: 0 6px 14px rgba(15,118,110,.24); color: #fff; }
.nav-item .material-symbols-rounded { font-size: 19px; }
.sidebar-bottom { margin-top: auto; padding-top: 12px; }
.profile-button { align-items: center; background: rgba(255,255,255,.05); border: 0; border-radius: 8px; color: #fff; display: flex; gap: 9px; padding: 9px; text-align: left; width: 100%; }
.profile-button .material-symbols-rounded { color: #8fa0ba; font-size: 17px; margin-left: auto; }
.profile-button small { color: #9eb0cc; display: block; font-size: 10px; margin-top: 2px; }
.avatar { align-items: center; background: #354869; border-radius: 50%; display: flex; font-size: 11px; font-weight: 700; height: 32px; justify-content: center; min-width: 32px; }

.app-shell { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar {
  align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); display: flex;
  height: 66px; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.global-search { align-items: center; color: var(--subtle); display: flex; gap: 8px; max-width: 470px; width: 100%; }
.global-search input { background: transparent; border: 0; color: var(--text); outline: 0; width: 100%; }
.topbar-actions { align-items: center; display: flex; gap: 7px; }
.icon-button { align-items: center; background: transparent; border: 0; border-radius: 50%; color: var(--muted); display: flex; height: 38px; justify-content: center; width: 38px; }
.icon-button:hover { background: var(--surface-soft); color: var(--text); }
.notification-button { position: relative; }
.notification-button i { background: #ef4444; border: 2px solid var(--surface); border-radius: 50%; height: 9px; position: absolute; right: 8px; top: 7px; width: 9px; }
.branch-selector { align-items: center; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; color: var(--text); display: flex; gap: 5px; margin-left: 5px; padding: 8px 10px; }
.branch-selector .material-symbols-rounded { color: var(--primary); font-size: 17px; }
.content { margin: 0 auto; max-width: 1640px; padding: 27px 30px 42px; }

.page-header, .section-head { align-items: center; display: flex; justify-content: space-between; }
.page-header { gap: 16px; margin-bottom: 22px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 25px; letter-spacing: 0; margin-bottom: 6px; }
h2 { font-size: 19px; letter-spacing: 0; }
h3 { font-size: 14px; }
.page-header p { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button { align-items: center; border: 0; border-radius: 8px; display: inline-flex; font-weight: 600; gap: 7px; justify-content: center; padding: 10px 13px; }
.button .material-symbols-rounded { font-size: 18px; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-strong); }
.button.secondary { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.button.ghost { background: transparent; color: var(--primary); padding: 6px; }

.stats-grid { display: grid; gap: 15px; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.stat-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.stat-card { padding: 17px; }
.stat-row { align-items: center; display: flex; justify-content: space-between; }
.stat-icon { align-items: center; border-radius: 8px; display: flex; height: 39px; justify-content: center; width: 39px; }
.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-card strong { display: block; font-size: 24px; letter-spacing: 0; margin-top: 13px; }
.stat-card small { color: var(--muted); }
.trend { color: var(--success); font-size: 11px; font-weight: 700; }

.dashboard-grid { display: grid; gap: 16px; grid-template-columns: 1.55fr 1fr; }
.card { padding: 17px; }
.card + .card { margin-top: 16px; }
.section-head { gap: 12px; margin-bottom: 14px; }
.section-head h2, .section-head h3 { margin-bottom: 0; }
.orders-list { display: grid; gap: 8px; }
.order-line { align-items: center; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 10px; grid-template-columns: auto 1fr auto auto; padding: 11px; }
.vehicle-thumb { align-items: center; background: var(--surface-soft); border-radius: 8px; color: var(--primary); display: flex; height: 42px; justify-content: center; width: 42px; }
.order-line strong, .appointment strong { display: block; font-size: 13px; }
.order-line small, .appointment small { color: var(--muted); }
.badge { border-radius: 20px; display: inline-flex; font-size: 10px; font-weight: 700; padding: 5px 8px; white-space: nowrap; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.appointment { align-items: center; border-left: 3px solid var(--primary); display: grid; gap: 9px; grid-template-columns: 50px 1fr; margin: 9px 0; padding: 5px 0 5px 10px; }
.appointment.amber { border-color: var(--warning); }
.appointment.green { border-color: var(--success); }
.appointment time { color: var(--muted); font-size: 12px; font-weight: 700; }
.progress-row { margin: 15px 0; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 7px; }
.progress-label strong { font-size: 12px; }
.progress-label span { color: var(--muted); font-size: 12px; }
.progress { background: var(--surface-soft); border-radius: 10px; height: 7px; overflow: hidden; }
.progress i { background: var(--primary); border-radius: 10px; display: block; height: 100%; }
.progress i.green { background: var(--success); }
.progress i.amber { background: var(--warning); }

.toolbar { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.toolbar-search { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 7px; padding: 8px 10px; width: min(100%, 290px); }
.toolbar-search input { background: transparent; border: 0; color: var(--text); outline: 0; width: 100%; }
.toolbar-search .material-symbols-rounded { color: var(--subtle); font-size: 18px; }
.select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 9px 10px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow-x: auto; }
table { border-collapse: collapse; min-width: 760px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 13px 15px; text-align: left; }
th { color: var(--muted); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.table-person { align-items: center; display: flex; gap: 9px; }
.table-person .avatar { background: var(--primary-soft); color: var(--primary); }
.table-person small { color: var(--muted); display: block; margin-top: 2px; }
td > small { display: block; margin-top: 3px; }
.row-actions { display: flex; gap: 1px; }
.row-actions .icon-button { height: 30px; width: 30px; }

.kanban { display: grid; gap: 13px; grid-template-columns: repeat(4, minmax(245px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
.kanban.wide-kanban { grid-template-columns: repeat(13, minmax(230px, 1fr)); }
.kanban-column { background: var(--surface-soft); border: 1px dashed transparent; border-radius: 8px; min-height: 430px; padding: 11px; transition: border-color .18s, background .18s; }
.kanban-column.drop-target, .calendar-cell.slot.drop-target { background: var(--primary-soft); border-color: var(--primary); outline-color: var(--primary); }
.kanban-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 10px; padding: 2px 2px 5px; }
.kanban-head h3 { align-items: center; display: flex; gap: 7px; margin: 0; }
.count { align-items: center; background: var(--line); border-radius: 50%; color: var(--muted); display: inline-flex; font-size: 10px; height: 21px; justify-content: center; width: 21px; }
.order-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: 8px; box-shadow: var(--shadow); cursor: grab; margin-bottom: 9px; padding: 11px; transition: opacity .18s, transform .18s; }
.order-card.dragging, .calendar-event.dragging { opacity: .55; transform: scale(.985); }
.order-card.urgent { border-left-color: var(--danger); }
.order-card.high { border-left-color: var(--warning); }
.order-card-head { align-items: center; display: flex; justify-content: space-between; }
.order-card h3 { margin: 9px 0 3px; }
.order-card p { color: var(--muted); font-size: 12px; line-height: 1.45; margin-bottom: 9px; }
.order-card-foot { align-items: center; display: flex; justify-content: space-between; }
.order-card-foot .avatar { height: 27px; min-width: 27px; }
.order-card-foot small { color: var(--muted); }

.calendar { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.calendar + .card { margin-top: 16px; }
.calendar-top { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 15px; }
.calendar-top small { color: var(--muted); display: block; margin-top: 3px; }
.calendar-grid { display: grid; grid-template-columns: 74px repeat(var(--calendar-days, 5), minmax(150px, 1fr)); min-width: 980px; }
.calendar-wrap { overflow-x: auto; }
.calendar-cell { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 76px; padding: 7px; }
.calendar-cell.header { color: var(--muted); font-size: 11px; font-weight: 700; min-height: auto; text-align: center; }
.calendar-cell.header small { display: block; font-weight: 600; margin-top: 2px; }
.calendar-cell.hour { color: var(--muted); font-size: 11px; text-align: center; }
.calendar-cell.slot { outline: 1px dashed transparent; outline-offset: -2px; }
.calendar-event { background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: 6px; color: var(--text); cursor: grab; display: grid; gap: 4px; font-size: 11px; margin-bottom: 6px; padding: 7px; transition: opacity .18s, transform .18s; }
.calendar-event small { color: var(--muted); line-height: 1.35; }
.calendar-event.green { background: var(--success-soft); border-color: var(--success); }
.calendar-event.amber { background: var(--warning-soft); border-color: var(--warning); }

.quick-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.quick-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; }
.quick-card .stat-icon { margin-bottom: 12px; }
.quick-card p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.brand-preview img { display: block; height: 54px; margin-bottom: 12px; max-width: 180px; object-fit: contain; }
.brand-preview.large { align-items: center; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; display: flex; justify-content: center; min-height: 150px; padding: 18px; }
.brand-preview.large img { margin: 0; max-height: 110px; max-width: 100%; }
.brand-panel { display: grid; gap: 16px; }
.swatches { display: flex; gap: 8px; margin-top: 10px; }
.swatches span { border: 1px solid var(--line); border-radius: 50%; display: inline-flex; height: 24px; width: 24px; }
.mini-specs { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 12px 0; }
.mini-specs div { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.mini-specs dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.mini-specs dd { margin: 3px 0 0; }
.notice-line { align-items: flex-start; background: var(--warning-soft); border-radius: 8px; color: var(--warning); display: flex; gap: 8px; margin: 8px 0; padding: 8px; }
.notice-line small { color: var(--muted); display: block; margin-top: 2px; }
.notice-line.urgent, .notice-line.high { background: var(--danger-soft); color: var(--danger); }
.order-timeline { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.order-timeline span { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 6px 9px; }
.order-timeline span.done { background: var(--primary-soft); color: var(--primary); }
.order-timeline span.current { outline: 2px solid var(--primary); }
.attachment-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.attachment-tile { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; color: var(--text); display: grid; gap: 6px; min-height: 110px; overflow: hidden; padding: 8px; text-decoration: none; }
.attachment-tile img { border-radius: 6px; height: 88px; object-fit: cover; width: 100%; }
.attachment-tile span { color: var(--muted); font-size: 11px; }
.quote-box { border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 8px; margin-bottom: 10px; padding: 10px; }
.empty-state { color: var(--muted); padding: 52px 20px; text-align: center; }
.empty-state .material-symbols-rounded { color: var(--subtle); font-size: 42px; }

.modal-backdrop { align-items: center; background: rgba(10,18,30,.52); display: flex; inset: 0; justify-content: center; padding: 18px; position: fixed; z-index: 60; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 8px; box-shadow: 0 22px 54px rgba(0,0,0,.24); max-height: 92vh; max-width: 620px; overflow-y: auto; padding: 24px; position: relative; width: 100%; }
.modal h2 { margin-bottom: 5px; }
.modal-close { position: absolute; right: 14px; top: 14px; }
.form-grid { display: grid; gap: 13px; grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field span { color: var(--muted); font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 7px; color: var(--text); outline: 0; padding: 10px; }
.field textarea { min-height: 70px; resize: vertical; }
.checkbox-field { align-content: start; align-items: center; display: flex; gap: 9px; }
.checkbox-field input { height: 16px; width: 16px; }
.details-list { display: grid; gap: 10px; margin: 0; }
.details-list div { border-bottom: 1px solid var(--line); display: grid; gap: 4px; grid-template-columns: 120px 1fr; padding: 9px 0; }
.details-list dt { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.details-list dd { margin: 0; }
.detail-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.loading-card {
  align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); display: flex; gap: 10px; justify-content: center; min-height: 180px;
}
.loading-card .material-symbols-rounded { animation: spin 1.1s linear infinite; color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.toast { background: #172033; border-radius: 8px; bottom: 20px; color: #fff; opacity: 0; padding: 11px 15px; position: fixed; right: 20px; transform: translateY(10px); transition: .25s; z-index: 80; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-copy h1 { font-size: 31px; }
  .auth-copy p, .auth-benefits { display: none; }
  .auth-brand { margin-bottom: 13px; }
  .mobile-only { display: flex !important; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { box-shadow: 12px 0 28px rgba(0,0,0,.2); transform: translateX(0); }
  .app-shell { margin-left: 0; }
  .topbar { gap: 7px; padding: 0 13px; }
  .global-search { flex: 1; }
  .branch-selector { display: none; }
  .content { padding: 20px 15px 34px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 22px; }
  .quick-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .details-list div { grid-template-columns: 1fr; }
  .modal { max-height: 94vh; padding: 20px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .topbar-actions .notification-button { display: none; }
  .table-wrap { border-radius: 8px; margin-left: -2px; margin-right: -2px; }
}
@media (max-width: 430px) {
  .stats-grid { gap: 10px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 13px; }
  .stat-card strong { font-size: 21px; }
  .order-line { grid-template-columns: auto 1fr; }
  .order-line .badge, .order-line > small { margin-left: 52px; }
  .actions { width: 100%; }
  .actions .button { flex: 1 1 100%; }
  .auth-panel { padding: 20px; }
}
@media print {
  body * { visibility: hidden; }
  .modal, .modal * { visibility: visible; }
  .modal { box-shadow: none; left: 0; max-width: none; position: absolute; top: 0; width: 100%; }
  .modal-close, .form-actions { display: none; }
}
/* Apex 2.0 - Portal público, historial e IA preventiva local */
.timeline-mini { display: grid; gap: 14px; }
.timeline-row { display: grid; grid-template-columns: 16px 1fr; gap: 10px; }
.timeline-row > span { background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 5px var(--primary-soft); height: 10px; margin-top: 5px; width: 10px; }
.timeline-row strong { display: block; }
.timeline-row small { color: var(--muted); display: block; line-height: 1.45; margin-top: 4px; }
.recommendation-card { border-left: 4px solid var(--violet); }
.recommendation-card p { line-height: 1.55; }

/* Apex 4.3 - visual refresh and stronger interaction states */
:root {
  --primary: #99E1D9;
  --primary-strong: #5ECAC0;
  --primary-soft: #d8f3ee;
  --success: #16803c;
  --success-soft: #ddf7e6;
  --warning: #b7791f;
  --warning-soft: #fff2cf;
  --danger: #c2415d;
  --danger-soft: #ffe4e9;
  --violet: #6658d3;
  --violet-soft: #eeecff;
  --info: #99E1D9;
  --info-soft: #e7efff;
  --text: #111827;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #d9e0ea;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --canvas: #f6f8fb;
  --shadow: 0 8px 22px rgba(15, 23, 42, .06);
  --shadow-hover: 0 14px 32px rgba(15, 23, 42, .1);
  --sidebar-bg: #ffffff;
  --sidebar-text: #111827;
  --sidebar-muted: #64748b;
  --sidebar-hover: #edf2f7;
  --focus: 0 0 0 3px rgba(15, 118, 110, .18);
}

[data-theme="dark"] {
  --primary: #99E1D9;
  --primary-strong: #7de8d8;
  --primary-soft: #123a36;
  --success: #4ade80;
  --success-soft: #123720;
  --warning: #f8c24d;
  --warning-soft: #3a2d11;
  --danger: #fb7185;
  --danger-soft: #421923;
  --violet: #BDF3ED;
  --violet-soft: #2d2a45;
  --info: #BDF3ED;
  --info-soft: #172642;
  --text: #f5f7fb;
  --muted: #a7b0bf;
  --subtle: #768295;
  --line: #2a313d;
  --surface: #171b22;
  --surface-soft: #202630;
  --canvas: #0f131a;
  --shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-hover: 0 16px 38px rgba(0, 0, 0, .36);
  --sidebar-bg: #141922;
  --sidebar-text: #f5f7fb;
  --sidebar-muted: #92a0b5;
  --sidebar-hover: #202838;
  --focus: 0 0 0 3px rgba(56, 211, 189, .2);
}

html { background: var(--canvas); }
body {
  background:
    linear-gradient(180deg, rgba(15, 118, 110, .045), rgba(255, 255, 255, 0) 290px),
    var(--canvas);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  line-height: 1.45;
}
[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(56, 211, 189, .055), rgba(15, 19, 26, 0) 310px),
    var(--canvas);
}
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { transition: border-color .18s, background .18s, color .18s, box-shadow .18s, transform .18s; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  box-shadow: var(--focus);
  outline: 0;
}

.auth-root {
  background:
    linear-gradient(135deg, #0e1726 0%, #99E1D9 54%, #332b1a 100%);
}
.auth-panel {
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.auth-panel h2, .auth-copy h1 { font-weight: 800; }

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(15, 23, 42, .02);
  color: var(--sidebar-text);
  padding: 18px 13px;
}
.brand {
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  padding: 2px 8px 18px;
}
.brand-mark {
  background: linear-gradient(135deg, var(--primary), var(--info));
  box-shadow: 0 10px 20px rgba(15, 118, 110, .22);
}
.brand strong, .profile-button strong { color: var(--sidebar-text); }
.brand span, .profile-button small, .profile-button .material-symbols-rounded { color: var(--sidebar-muted); }
.nav-group {
  color: var(--sidebar-muted);
  letter-spacing: .8px;
  margin: 18px 9px 8px;
}
.nav-item {
  color: var(--sidebar-muted);
  min-height: 40px;
  padding: 10px 11px;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}
.nav-item.active {
  background: var(--primary);
  box-shadow: 0 9px 18px rgba(15, 118, 110, .23);
  color: #fff;
}
[data-theme="dark"] .nav-item.active {
  color: #071311;
}
.profile-button {
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.avatar {
  background: var(--primary-soft);
  color: var(--primary);
}

.app-shell { background: transparent; }
.topbar {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  height: 65px;
}
.global-search {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 520px;
  padding: 10px 12px;
}
.global-search:focus-within {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--focus);
}
.branch-selector {
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}
.icon-button:hover, .branch-selector:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.content {
  max-width: 1720px;
  padding: 30px 34px 48px;
}
.page-header {
  border-bottom: 1px solid rgba(148, 163, 184, .22);
  margin-bottom: 20px;
  padding-bottom: 18px;
}
h1 {
  font-size: 27px;
  font-weight: 800;
}
h2 { font-weight: 800; }
h3 { font-weight: 800; }
.page-header p, .section-head p { color: var(--muted); }
.actions { align-items: center; }
.button {
  box-shadow: none;
  min-height: 38px;
}
.button:hover { transform: translateY(-1px); }
.button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 10px 18px rgba(15, 118, 110, .18);
}
.button.secondary:hover, .button.ghost:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.button.ghost {
  min-height: 32px;
  padding: 6px 8px;
}
.select, .toolbar-search, .field input, .field select, .field textarea {
  background: var(--surface);
}
.toolbar {
  background: transparent;
  margin-bottom: 16px;
}
.toolbar-search {
  min-height: 38px;
}
.toolbar-search:focus-within, .field input:focus, .field select:focus, .field textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.stat-card, .card, .quick-card, .table-wrap, .calendar, .modal {
  box-shadow: var(--shadow);
}
.stat-card:hover, .quick-card:hover, .card:hover {
  box-shadow: var(--shadow-hover);
}
.card, .quick-card, .stat-card {
  border-color: rgba(148, 163, 184, .3);
}
.stat-icon {
  border: 1px solid rgba(148, 163, 184, .22);
}
.badge {
  align-items: center;
  border: 1px solid transparent;
  line-height: 1;
}
.badge.blue {
  background: var(--info-soft);
  color: var(--info);
}
.badge.green {
  border-color: color-mix(in srgb, var(--success) 18%, transparent);
}
.badge.amber {
  border-color: color-mix(in srgb, var(--warning) 18%, transparent);
}
.badge.red {
  border-color: color-mix(in srgb, var(--danger) 18%, transparent);
}
.badge.violet {
  border-color: color-mix(in srgb, var(--violet) 18%, transparent);
}
.table-wrap {
  overflow: auto;
}
th {
  background: var(--surface-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-soft) 70%, transparent);
}
td small {
  color: var(--muted);
}

.kanban {
  align-items: start;
  gap: 14px;
  padding: 2px 2px 14px;
  scrollbar-color: var(--primary) transparent;
}
.kanban.wide-kanban {
  grid-template-columns: repeat(13, minmax(246px, 1fr));
}
.kanban-column {
  background: color-mix(in srgb, var(--surface-soft) 82%, var(--surface));
  border: 1px solid rgba(148, 163, 184, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
  min-height: 470px;
}
[data-theme="dark"] .kanban-column {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.kanban-column.drop-target, .calendar-cell.slot.drop-target {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary), var(--shadow);
}
.kanban-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 11px;
  padding: 3px 2px 10px;
}
.kanban-head h3 {
  color: var(--text);
  font-size: 13px;
}
.count {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}
.order-card {
  border-left-width: 4px;
  cursor: grab;
  overflow: hidden;
  padding: 12px;
  user-select: none;
}
.order-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.order-card:active { cursor: grabbing; }
.order-card.dragging, .calendar-event.dragging {
  opacity: .48;
  transform: rotate(.4deg) scale(.985);
}
.order-card-head small {
  color: var(--muted);
  font-weight: 800;
}
.order-card-tools {
  align-items: center;
  display: flex;
  gap: 7px;
}
.drag-chip {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--subtle);
  display: inline-flex;
  height: 26px;
  justify-content: center;
  width: 26px;
}
.drag-chip .material-symbols-rounded { font-size: 18px; }
.order-card h3 {
  font-size: 14px;
  line-height: 1.25;
}
.order-card-foot {
  gap: 8px;
  margin-top: 10px;
}
.order-card-foot small {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}
.stage-picker {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  margin: 11px 0 8px;
  padding: 7px 8px;
}
.stage-picker .material-symbols-rounded {
  color: var(--primary);
  font-size: 18px;
}
.stage-picker select {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  outline: 0;
  width: 100%;
}
.stage-picker:focus-within {
  border-color: var(--primary);
  box-shadow: var(--focus);
}
.order-card .actions {
  border-top: 1px solid var(--line);
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
}
.order-card .actions .button {
  flex: 1 1 auto;
  font-size: 12px;
  min-height: 30px;
}

.calendar {
  border-color: rgba(148, 163, 184, .32);
}
.calendar-top {
  background: var(--surface-soft);
}
.calendar-cell.slot:hover {
  background: color-mix(in srgb, var(--primary-soft) 38%, transparent);
}
.calendar-event {
  border: 1px solid color-mix(in srgb, var(--primary) 24%, transparent);
  border-left-width: 4px;
}
.calendar-event:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.modal-backdrop {
  backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, .55);
}
.modal {
  border: 1px solid var(--line);
}
.field span {
  color: var(--text);
}
.field input::placeholder, .field textarea::placeholder, .global-search input::placeholder, .toolbar-search input::placeholder {
  color: var(--subtle);
}
.toast {
  background: #111827;
  box-shadow: 0 18px 38px rgba(0, 0, 0, .28);
}

@media (max-width: 1050px) {
  .content { padding: 24px 22px 42px; }
  .kanban.wide-kanban { grid-template-columns: repeat(13, minmax(238px, 1fr)); }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 62px;
  }
  .global-search {
    min-width: 0;
    padding: 9px 10px;
  }
  .content { padding: 20px 14px 34px; }
  .page-header {
    gap: 12px;
    padding-bottom: 15px;
  }
  .page-header .actions, .page-header .button {
    width: 100%;
  }
  .kanban, .kanban.wide-kanban {
    display: flex;
    gap: 12px;
    margin-left: -2px;
    margin-right: -2px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  .kanban-column {
    flex: 0 0 min(86vw, 340px);
    min-height: 430px;
    scroll-snap-align: start;
  }
  .order-card .actions .button {
    flex-basis: calc(50% - 4px);
  }
  .stage-picker select {
    font-size: 13px;
  }
  th { position: static; }
}

@media (max-width: 430px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .button { min-height: 40px; }
  .kanban-column { flex-basis: 88vw; }
  .order-card .actions .button { flex-basis: 100%; }
}

/* Apex 4.3 - authenticated client portal */
.client-hero {
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  margin-bottom: 18px;
  padding: 20px;
}
.client-kicker {
  align-items: center;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 999px;
  color: var(--primary);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  margin-bottom: 12px;
  padding: 7px 10px;
}
.client-hero h2 {
  font-size: 28px;
  margin-bottom: 8px;
}
.client-hero p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
  max-width: 760px;
}
.client-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.client-hero-panel {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}
.client-hero-panel small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.client-hero-panel strong {
  display: block;
  margin-top: 4px;
}
.client-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.client-card-stack {
  display: grid;
  gap: 12px;
}
.client-vehicle-card {
  box-shadow: none;
}
.client-vehicle-card:hover {
  box-shadow: var(--shadow-hover);
}
.client-order-line {
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}
.client-order-layout {
  display: grid;
  gap: 16px;
}
.client-vehicle-grid {
  align-items: start;
}

@media (max-width: 900px) {
  .client-hero {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .client-order-line {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .client-order-line .badge,
  .client-order-line .button {
    margin-left: 52px;
  }
}

/* Apex 4.4 - production interface */
:root {
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-width: 264px;
}

::selection { background: var(--primary-soft); color: var(--text); }
html { scroll-behavior: smooth; }
body { min-width: 320px; }
body.menu-open { overflow: hidden; }

.skip-link {
  background: var(--primary);
  border-radius: 0 0 var(--radius-sm) 0;
  color: #fff;
  font-weight: 800;
  left: 0;
  padding: 11px 16px;
  position: fixed;
  top: 0;
  transform: translateY(-120%);
  transition: transform .18s;
  z-index: 100;
}
.skip-link:focus { transform: translateY(0); }
body.auth-mode .skip-link { display: none; }

.auth-root {
  background:
    radial-gradient(circle at 16% 18%, rgba(45, 212, 191, .2), transparent 34%),
    radial-gradient(circle at 86% 78%, rgba(96, 165, 250, .16), transparent 32%),
    linear-gradient(145deg, #0b1220 0%, #0d4f4b 55%, #111827 100%);
  padding: clamp(18px, 4vw, 48px);
}
.auth-layout { max-width: 1120px; }
.auth-copy h1 { font-size: clamp(36px, 4.4vw, 58px); letter-spacing: -.045em; }
.auth-panel { border-radius: var(--radius-lg); padding: clamp(24px, 3vw, 38px); }

.sidebar { width: var(--sidebar-width); }
.brand-mark, .nav-item, .profile-button { border-radius: var(--radius-sm); }
.main-nav { padding-right: 3px; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
.profile-button:hover { background: var(--sidebar-hover); border-color: color-mix(in srgb, var(--primary) 28%, var(--line)); }

.topbar { padding-inline: clamp(16px, 2.2vw, 34px); }
.global-search {
  border: 1px solid transparent;
  border-radius: 999px;
  max-width: 520px;
  padding: 9px 14px;
}
.global-search:focus-within {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  box-shadow: var(--focus);
}
.connection-status {
  align-items: center;
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 20%, transparent);
  border-radius: 999px;
  color: var(--success);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  white-space: nowrap;
}
.connection-status i { background: currentColor; border-radius: 50%; height: 7px; width: 7px; }
.connection-status[data-status="syncing"] { background: var(--info-soft); color: var(--info); }
.connection-status[data-status="syncing"] i { animation: pulse 1s ease-in-out infinite; }
.connection-status[data-status="offline"], .connection-status[data-status="error"] { background: var(--danger-soft); color: var(--danger); }
@keyframes pulse { 50% { opacity: .3; transform: scale(.75); } }
.branch-selector { cursor: default; }

.content { padding: 30px clamp(18px, 2.5vw, 38px) 52px; }
.page-header { margin-bottom: 26px; }
h1 { font-size: clamp(24px, 2vw, 30px); letter-spacing: -.025em; }
.page-header p { max-width: 760px; }

.stat-card, .card, .quick-card, .table-wrap, .calendar, .client-hero {
  border-radius: var(--radius-md);
}
.stat-card { overflow: hidden; position: relative; }
.stat-card::before {
  background: linear-gradient(90deg, var(--primary), var(--info));
  content: "";
  height: 3px;
  inset: 0 0 auto;
  opacity: .8;
  position: absolute;
}
.stat-card, .quick-card, .card { transition: border-color .18s, box-shadow .18s, transform .18s; }
.stat-card:hover, .quick-card:hover { border-color: color-mix(in srgb, var(--primary) 22%, var(--line)); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.button { border-radius: var(--radius-sm); min-height: 40px; }
.button:disabled { cursor: wait; opacity: .58; transform: none !important; }
.button.primary { box-shadow: 0 8px 18px rgba(15, 118, 110, .16); }
.icon-button { min-height: 40px; min-width: 40px; }
.badge { line-height: 1.2; }
.empty-state { background: color-mix(in srgb, var(--surface-soft) 62%, transparent); border-radius: var(--radius-sm); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }

.table-wrap { scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
th { background: var(--surface); position: sticky; top: 0; z-index: 1; }
tbody tr { transition: background .16s; }
tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 32%, transparent); }

.modal { border-radius: var(--radius-lg); max-width: 680px; padding: clamp(22px, 3vw, 32px); }
.field input, .field select, .field textarea { border-radius: var(--radius-sm); min-height: 43px; }
.toast { border-radius: var(--radius-sm); max-width: min(420px, calc(100vw - 32px)); }
.sidebar-backdrop { display: none; }

@media (max-width: 760px) {
  .sidebar { max-width: 320px; width: 88vw; }
  .sidebar-backdrop {
    background: rgba(15, 23, 42, .48);
    border: 0;
    display: block;
    inset: 0;
    padding: 0;
    position: fixed;
    z-index: 25;
  }
  .sidebar-backdrop[hidden] { display: none; }
  .topbar-actions { gap: 4px; }
  .connection-status { min-height: 36px; padding-inline: 9px; }
  .connection-status span { display: none; }
  .content { padding-top: 22px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-width: 0; }
  .stat-card strong { overflow-wrap: anywhere; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 94dvh; max-width: none; padding: 24px 18px calc(20px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(14px + env(safe-area-inset-bottom)); left: 16px; right: auto; }
  table { min-width: 680px; }
}

@media (max-width: 480px) {
  .topbar { padding-inline: 10px; }
  .global-search { padding-inline: 10px; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-header .actions { display: grid; grid-template-columns: 1fr; }
  .client-hero-actions { display: grid; }
  .client-hero-actions .button { width: 100%; }
}

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

/* Apex 4.5 - clear production theme and complete record sheets */
:root,
[data-theme="dark"],
[data-theme="light"] {
  color-scheme: light;
  --primary: #99E1D9;
  --primary-strong: #5ECAC0;
  --primary-soft: #dff6f2;
  --success: #15803d;
  --success-soft: #e3f8ea;
  --warning: #b45309;
  --warning-soft: #fff4d6;
  --danger: #be123c;
  --danger-soft: #ffe7eb;
  --violet: #6658d3;
  --violet-soft: #eeecff;
  --info: #99E1D9;
  --info-soft: #e8f0ff;
  --text: #111827;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #d9e0ea;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --canvas: #f6f8fb;
  --shadow: 0 8px 22px rgba(15, 23, 42, .06);
  --shadow-hover: 0 14px 32px rgba(15, 23, 42, .1);
  --sidebar-bg: #ffffff;
  --sidebar-text: #111827;
  --sidebar-muted: #64748b;
  --sidebar-hover: #edf2f7;
  --focus: 0 0 0 3px rgba(15, 118, 110, .18);
}

body,
[data-theme="dark"] body {
  background: linear-gradient(180deg, rgba(15, 118, 110, .045), rgba(255, 255, 255, 0) 290px), var(--canvas);
  color: var(--text);
}

.auth-root,
[data-theme="dark"] .auth-root {
  background: linear-gradient(145deg, #f8fafc 0%, #eef7f5 48%, #f6f8fb 100%);
}

.auth-copy,
[data-theme="dark"] .auth-copy {
  color: var(--text);
}

.auth-copy p,
.auth-brand span,
.auth-benefits span {
  color: var(--muted);
}

.auth-benefits .material-symbols-rounded {
  color: var(--primary);
}

.auth-panel,
[data-theme="dark"] .auth-panel,
.sidebar,
[data-theme="dark"] .sidebar,
.topbar,
[data-theme="dark"] .topbar {
  background: var(--surface);
  color: var(--text);
}

[data-theme="dark"] .nav-item.active {
  color: #fff;
}

.modal {
  max-width: min(1060px, calc(100vw - 36px));
}

.modal h2 {
  padding-right: 42px;
}

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

.detail-metric {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 11px;
  min-width: 0;
  padding: 12px;
}

.detail-metric small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-metric strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.detail-actions {
  align-items: center;
  background: linear-gradient(135deg, rgba(15, 118, 110, .08), rgba(37, 99, 235, .08));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin: -4px 0 18px;
  padding: 12px;
}

/* Apex 4.6 - Turquoise default brand */
:root,
[data-theme="dark"] {
  --primary: #99E1D9;
  --primary-strong: #5ECAC0;
  --primary-soft: #E9FAF8;
  --primary-ink: #0F2F2D;
  --focus: 0 0 0 3px rgba(153, 225, 217, .34);
  --info: #99E1D9;
  --info-soft: #E9FAF8;
}

body {
  background:
    linear-gradient(180deg, rgba(153, 225, 217, .14), rgba(255, 255, 255, 0) 290px),
    var(--canvas);
}

.auth-root {
  background: linear-gradient(135deg, #0B1F20 0%, #99E1D9 52%, #0B1F20 100%);
}

.brand-mark,
.nav-item.active,
.button.primary,
.progress i,
.timeline-row > span {
  background: #99E1D9;
  color: var(--primary-ink);
}

.button.primary:hover {
  background: #5ECAC0;
  color: var(--primary-ink);
}

.nav-item.active {
  box-shadow: 0 9px 18px rgba(153, 225, 217, .34);
}

.button.primary {
  box-shadow: 0 8px 18px rgba(153, 225, 217, .32);
}

.badge.blue,
.badge.violet,
.stat-icon.blue,
.stat-icon.violet,
.table-person .avatar,
.vehicle-thumb {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.detail-actions {
  background: linear-gradient(135deg, rgba(153, 225, 217, .20), rgba(153, 225, 217, .09));
}

.detail-grid.detail-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-section {
  box-shadow: none;
}

.section-head.compact {
  align-items: center;
  margin-bottom: 12px;
}

.section-head.compact h3 {
  align-items: center;
  display: flex;
  font-size: 15px;
  gap: 7px;
  margin: 0;
}

.detail-line {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 0;
}

.detail-line:last-child {
  border-bottom: 0;
}

.detail-line strong,
.detail-line small {
  display: block;
  overflow-wrap: anywhere;
}

.detail-line small {
  color: var(--muted);
  margin-top: 3px;
}

.detail-line .button {
  white-space: nowrap;
}

.detail-files {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.detail-files h4 {
  font-size: 13px;
  margin: 0 0 10px;
}

@media (max-width: 900px) {
  .detail-hero,
  .detail-grid.detail-grid-wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .detail-line {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
  .detail-line .button {
    width: 100%;
  }
}
