/* Garage Ops - blue / white theme */
:root {
  --blue-900: #0b2a5b;
  --blue-800: #0f3a7d;
  --blue-700: #1450a8;
  --blue-600: #1a62cc;
  --blue-100: #e6effb;
  --blue-50: #f3f7fd;
  --ink: #142033;
  --ink-2: #4a5a70;
  --ink-3: #7b8aa0;
  --line: #dbe3ee;
  --bg: #f5f8fc;
  --white: #ffffff;
  --good: #16794b;   --good-bg: #e3f5ec;
  --warn: #9a6200;   --warn-bg: #fff3d9;
  --bad: #b42318;    --bad-bg: #fde8e7;
  --neutral-bg: #edf1f6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 80, .06), 0 2px 8px rgba(16, 40, 80, .05);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 650; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--blue-900); color: #dbe6f7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 14px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.wordmark { font-weight: 800; letter-spacing: .08em; font-size: 18px; color: #fff; display: flex; align-items: center; gap: 8px; }
.wordmark .gear { width: 22px; height: 22px; border-radius: 6px; background: var(--blue-600); color: #fff; display: grid; place-items: center; font-size: 13px; }
.wordmark span.ops { color: #8db7f5; }
.rate-pill { margin-top: 8px; font-size: 12px; color: #a9c1e6; }
.nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cfdcf2; padding: 8px 12px; border-radius: 8px; margin: 1px 0; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--blue-600); color: #fff; }
.nav .nav-ico { width: 18px; text-align: center; opacity: .9; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f9cc7; padding: 14px 12px 4px; }
.user-box { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.user-box .name { color: #fff; font-weight: 600; }
.user-box .role { color: #94afd8; font-size: 12px; }
.user-box button { margin-top: 8px; background: none; border: 1px solid rgba(255,255,255,.2); color: #dbe6f7; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.main { min-width: 0; }
.topbar-mobile { display: none; }

.page { padding: 24px 28px 48px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.subtitle { color: var(--ink-2); margin-top: 2px; }
.back { font-size: 13px; display: inline-block; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card > :not(.card-head):not(.table-wrap) { margin-left: 18px; margin-right: 18px; }
.card > :last-child:not(.table-wrap) { margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.card .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; display: block; }
a.stat:hover { border-color: var(--blue-600); text-decoration: none; }
.stat-title { color: var(--ink-2); font-size: 12.5px; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 2px; color: var(--blue-800); }
.stat-sub { color: var(--ink-3); font-size: 12px; }
.text-bad { color: var(--bad) !important; } .text-warn { color: var(--warn) !important; } .text-good { color: var(--good) !important; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--blue-50); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--blue-50); }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 650; background: var(--blue-50); border-top: 1px solid var(--line); }
.empty { padding: 28px 18px; color: var(--ink-3); text-align: center; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.strong { font-weight: 650; }

/* ---------- Money ---------- */
.money { display: inline-flex; flex-direction: column; line-height: 1.25; }
.money .lbp { color: var(--ink-3); font-size: 11.5px; }
.table .num .money { align-items: flex-end; }
.money-big { font-size: 22px; font-weight: 700; color: var(--blue-800); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-neutral { background: var(--neutral-bg); color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; font-family: inherit; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-secondary { background: #fff; color: var(--blue-700); border-color: #bcd0ee; }
.btn-secondary:hover:not(:disabled) { background: var(--blue-50); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f2c4c0; }
.btn-good { background: var(--good); color: #fff; }
.btn-whatsapp { background: #1f9d55; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.link { background: none; border: none; color: var(--blue-600); cursor: pointer; padding: 0 4px; font: inherit; }
.icon-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-2); line-height: 1; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: 12px; color: var(--ink-3); }
.input { border: 1px solid #c8d4e5; border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--ink); width: 100%; }
.input:focus { outline: 2px solid #b8d1f6; border-color: var(--blue-600); }
.search { max-width: 320px; }
textarea.input { resize: vertical; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 120px; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-good { background: var(--good-bg); color: var(--good); }
.alert-info { background: var(--blue-100); color: var(--blue-800); }
.loading { padding: 30px; color: var(--ink-3); text-align: center; }

/* ---------- Details ---------- */
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; margin: 16px 18px; }
.details dt { font-size: 12px; color: var(--ink-3); }
.details dd { margin: 2px 0 0; font-weight: 550; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { background: none; border: none; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--blue-700); border-bottom-color: var(--blue-600); }
.tab-count { background: var(--neutral-bg); border-radius: 999px; padding: 0 7px; margin-left: 6px; font-size: 11.5px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 30, 60, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-wide { width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--blue-900); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.bad { background: var(--bad); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--blue-900), var(--blue-700)); padding: 16px; }
.login { background: #fff; border-radius: 14px; padding: 30px 30px 26px; width: 380px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login .wordmark { color: var(--blue-900); font-size: 22px; margin-bottom: 4px; }
.login .wordmark span.ops { color: var(--blue-600); }
.login .field { margin-bottom: 12px; }
.login .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 10px; }
.demo-logins { margin-top: 16px; font-size: 12px; color: var(--ink-3); }
.demo-logins button { font-size: 12px; }

/* ---------- Document (print) ---------- */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px; border-bottom: 3px solid var(--blue-600); }
.doc-company .wordmark { color: var(--blue-900); }
.doc-company .wordmark span.ops { color: var(--blue-600); }
.doc-title { text-align: right; }
.doc-title .t { font-size: 20px; font-weight: 750; color: var(--blue-800); }
.totals { margin-left: auto; width: 340px; max-width: 100%; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { border-top: 2px solid var(--blue-600); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: 15px; }

/* Printing: only the document itself. margin 0 on the page also stops the
   browser adding its own date / title / web address at the top and bottom. */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  .sidebar, .topbar-mobile, .no-print, .page-head, .toasts, .alert { display: none !important; }
  .print-only { display: block; }
  .shell { display: block; }
  .main { padding: 0; }
  .page { padding: 12mm 14mm; max-width: none; }
  .card { box-shadow: none; border: none; margin: 0; }
  .card-head { padding-left: 0; padding-right: 0; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  input, select { border: none !important; background: none !important; padding: 0 !important; appearance: none; -webkit-appearance: none; font: inherit; color: inherit; }
  tr { break-inside: avoid; }
}
.sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 34px 18px 10px; break-inside: avoid; }
.sign-box .line { border-bottom: 1px solid #10161f; height: 46px; }
.sign-box .cap { font-size: 12px; color: var(--ink-2); margin-top: 6px; display: flex; justify-content: space-between; }
.doc-terms { padding: 0 18px; font-size: 12px; color: var(--ink-2); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .sidebar.open { transform: none; }
  .topbar-mobile { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--blue-900); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar-mobile button { background: none; border: none; color: #fff; font-size: 22px; }
  .page { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Pickers ---------- */
.picker { position: relative; }
.picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(16,40,80,.15); max-height: 300px; overflow-y: auto; }
.picker-list button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--line); }
.picker-list button:last-child { border-bottom: none; }
.picker-list button:hover { background: var(--blue-50); }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid #c8d4e5; background: var(--blue-50); border-radius: 8px; padding: 7px 10px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.timer-on { color: var(--good); font-weight: 650; }
.section-gap { height: 4px; }

/* Modals fit small screens: wide tables scroll inside the dialog */
.modal-backdrop { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal { min-width: 0; }
.modal-body { overflow: auto; }

/* logo: Automotive shield turning in 3D */
.auto-logo { display: flex; justify-content: center; user-select: none; }
.emblem { --size: 54px; width: var(--size); aspect-ratio: 345 / 303; flex: none; position: relative; }
.emblem-hires { position: absolute; inset: 0; }
.emblem-coin { position: relative; width: 100%; height: 100%; transform-origin: 50% 50%; }
.emblem-layer { position: absolute; inset: 0; }
.emblem-layer svg { display: block; width: 100%; height: 100%; }
.emblem-layer.face { }
.emblem-layer.back { display: none; }
.emblem-shine { position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 48%, transparent 60%);
  transform: translateX(-120%); }
.auto-logo.dark .emblem-coin { filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }

/* turn right-to-left continuously; the light glints as the face comes round */
.emblem.spin .emblem-coin { animation: emblem-turn 4.5s infinite; }
@keyframes emblem-turn {
  /* one full turn = two half-turns; the face narrows to its edge and widens again (cos curve) */
  0%   { transform: scaleX(1);    filter: brightness(1);    animation-timing-function: cubic-bezier(.12,0,.39,0); }
  25%  { transform: scaleX(.03);  filter: brightness(.75);  animation-timing-function: cubic-bezier(.61,1,.88,1); }
  50%  { transform: scaleX(1);    filter: brightness(1);    animation-timing-function: cubic-bezier(.12,0,.39,0); }
  75%  { transform: scaleX(.03);  filter: brightness(.75);  animation-timing-function: cubic-bezier(.61,1,.88,1); }
  100% { transform: scaleX(1);    filter: brightness(1); }
}
@keyframes emblem-shine {
  0%, 80% { transform: translateX(-120%); }
  100%    { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .emblem.spin .emblem-coin, .emblem.spin .emblem-shine { animation: none; }
}

.brand-logo { display: flex; justify-content: center; margin: 14px 0 14px; }
.brand-logo .emblem { --size: 165px; }
.brand .rate-pill { display: block; text-align: center; }
.login-logo { margin: 0 auto 10px; }
.login-logo .emblem { --size: 210px; }
.login-sub { text-align: center; margin-top: 0; }
.doc-logo .emblem { --size: 110px; }
.doc-logo { justify-content: flex-start; }
.mobile-logo { gap: 8px; }
.mobile-logo .emblem { --size: 40px; }

/* car health gauges */
.gauge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 14px 18px; }
.gauge-tile { border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge-pct { font-size: 22px; font-weight: 800; line-height: 1.1; }
.gauge-name { font-weight: 700; }
.gauge-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; }
.gauge-chip { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 120px; }

/* notification rules */
.rule-list { display: flex; flex-direction: column; gap: 12px; }
.rule { padding: 14px 18px; }
.rule-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.switch input { width: 20px; height: 20px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.rule-field { display: flex; flex-direction: column; gap: 6px; }
.rule-field label { display: inline-flex; align-items: center; gap: 6px; }
.bad-text { color: var(--bad, #c4121b); font-weight: 600; }
.page.side-switch { padding-bottom: 0; }
.page.side-switch .tabs { margin-bottom: 0; }
.page.side-switch + .page { padding-top: 12px; }
