:root {
  --ink: #18201d;
  --text: #303936;
  --muted: #68716e;
  --subtle: #8c9491;
  --line: #dfe3e1;
  --line-strong: #cbd1ce;
  --surface: #ffffff;
  --canvas: #f6f7f6;
  --accent: #176b52;
  --accent-hover: #105640;
  --danger: #a33535;
  color: var(--text);
  background: var(--canvas);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }

.topbar {
  height: 66px;
  padding: 0 max(24px, calc((100% - 1160px) / 2));
  display: flex;
  align-items: center;
  gap: 46px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 5px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 750; letter-spacing: .4px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { color: var(--ink); font-size: 14px; font-weight: 650; }
.brand-copy small { margin-top: 3px; color: var(--subtle); font-size: 10px; letter-spacing: .25px; }
.nav-links { display: flex; align-self: stretch; gap: 30px; }
.nav-links a { display: flex; align-items: center; border-bottom: 2px solid transparent; color: #59625f; font-size: 13px; font-weight: 550; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { border-color: var(--accent); color: var(--ink); }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 15px; }
.user-menu > div { display: flex; flex-direction: column; text-align: right; line-height: 1.25; }
.user-menu strong { color: var(--ink); font-size: 12px; font-weight: 600; }
.user-menu small { margin-top: 2px; color: var(--subtle); font-size: 10px; }
.user-menu form { padding-left: 15px; border-left: 1px solid var(--line); }
.text-button, .link-button { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.text-button:hover, .link-button:hover { color: var(--accent-hover); text-decoration: underline; }
.menu-button { display: none; width: 36px; height: 36px; padding: 9px 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: pointer; }
.menu-button span { display: block; height: 1px; margin: 4px 0; background: var(--ink); }

.page-shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.page-heading h1 { margin: 0 0 7px; font-size: 28px; font-weight: 650; letter-spacing: -.5px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.vehicle-stat { min-width: 185px; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-left: 2px solid var(--accent); }
.vehicle-stat > span { color: var(--ink); font-size: 24px; font-weight: 650; line-height: 1; }
.vehicle-stat div { display: flex; flex-direction: column; }
.vehicle-stat strong { color: var(--text); font-size: 11px; font-weight: 600; }
.vehicle-stat small { margin-top: 2px; color: var(--subtle); font-size: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.form-card { padding: 25px 27px 27px; }
.card-header { display: flex; align-items: flex-start; padding-bottom: 18px; margin-bottom: 21px; border-bottom: 1px solid var(--line); }
.card-header h2 { margin: 0 0 4px; font-size: 17px; font-weight: 650; }
.card-header p { margin: 0; color: var(--muted); font-size: 12px; }
.section-label { display: block; margin-bottom: 6px; color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: 1.1px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-stack { display: grid; gap: 16px; margin-top: 25px; }
label { display: flex; flex-direction: column; gap: 6px; color: #3b4441; font-size: 12px; font-weight: 600; }
label small { color: var(--subtle); font-weight: 400; line-height: 1.4; }
input, select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 5px; outline: none; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #aeb7b3; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(23, 107, 82, .11); }
input::placeholder { color: #a4aba8; }
select { cursor: pointer; }
.span-2 { grid-column: span 2; }
.timezone-note { min-height: 42px; display: flex; align-items: center; padding: 7px 11px; margin-top: 18px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfa; }
.timezone-note div { display: flex; flex-direction: column; }
.timezone-note strong { color: var(--text); font-size: 11px; font-weight: 600; }
.timezone-note small { margin-top: 1px; color: var(--subtle); font-size: 10px; }
.checkbox { min-height: 52px; flex-direction: row; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfa; cursor: pointer; }
.checkbox input { position: absolute; width: 0; opacity: 0; }
.checkbox > span { width: 17px; height: 17px; flex: none; border: 1px solid #aeb8b3; border-radius: 3px; background: #fff; }
.checkbox input:checked + span { border-color: var(--accent); background: var(--accent); }
.checkbox input:checked + span::after { content: "✓"; display: block; color: #fff; font-size: 11px; text-align: center; line-height: 15px; }
.checkbox div { display: flex; flex-direction: column; }
.checkbox strong { color: var(--text); font-size: 11px; font-weight: 600; }
.checkbox small { font-size: 10px; }
.disabled { opacity: .55; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.submit-row p { max-width: 290px; margin: 0; color: var(--subtle); font-size: 10px; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 5px; font-size: 12px; font-weight: 600; line-height: 1.3; cursor: pointer; transition: background-color .15s, border-color .15s; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button.secondary { border-color: var(--line-strong); background: #fff; color: var(--text); }
.button.secondary:hover { border-color: #9ea8a3; background: #fafbfa; }
.button.ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.button.small { min-height: 30px; padding: 5px 9px; font-size: 11px; }
.button.full { width: 100%; }

.side-column { display: flex; flex-direction: column; gap: 16px; }
.compact-card { padding: 18px; }
.side-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.side-title h3 { margin: 0; font-size: 13px; font-weight: 650; }
.side-title h3 span { margin-left: 5px; color: var(--subtle); font-size: 11px; font-weight: 500; }
.side-title a { color: var(--accent); font-size: 11px; font-weight: 600; }
.vehicle-list { display: grid; }
.vehicle-list > div { padding: 9px 0; border-top: 1px solid #edf0ee; color: var(--text); font-size: 12px; }
.vehicle-list > div:first-child { border-top: 0; }
.vehicle-list strong { font-weight: 550; }
.vehicle-list > small { padding-top: 9px; border-top: 1px solid #edf0ee; color: var(--subtle); font-size: 10px; }
.mini-history { display: grid; }
.mini-history > div { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid #edf0ee; }
.mini-history > div:first-child { border-top: 0; }
.mini-history div div { display: flex; flex-direction: column; min-width: 0; }
.mini-history strong, .mini-history small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-history strong { color: var(--text); font-size: 11px; font-weight: 600; }
.mini-history small, .mini-history time { color: var(--subtle); font-size: 9px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-dot.sent { background: #4d9671; }
.status-dot.failed { background: #c95c5c; }
.empty-small { margin: 0; color: var(--subtle); font-size: 11px; }
.setup-card { display: flex; align-items: center; gap: 24px; padding: 23px 25px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: #fff; }
.setup-card > div { flex: 1; }
.setup-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.setup-card p { margin: 0; color: var(--muted); font-size: 12px; }

.alert { display: grid; grid-template-columns: 20px 1fr 20px; align-items: center; gap: 9px; padding: 11px 13px; margin: 0 0 20px; border: 1px solid; border-radius: 5px; }
.alert p { margin: 0; font-size: 12px; }
.alert > span { font-size: 11px; font-weight: 700; text-align: center; }
.alert button { padding: 0; border: 0; background: transparent; color: inherit; font-size: 17px; cursor: pointer; }
.alert.success { border-color: #cce1d4; background: #f0f8f3; color: #2d704f; }
.alert.error { border-color: #edcdca; background: #fff3f2; color: var(--danger); }
.alert.info { border-color: #ccdde5; background: #f1f6f8; color: #3e6477; }

.settings-layout { display: grid; gap: 16px; }
.settings-card { padding: 24px 27px 26px; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 4px 0; }
.settings-actions p { margin: 0; color: var(--subtle); font-size: 10px; }
.settings-actions > div { display: flex; gap: 8px; }
.password-settings { margin-top: 34px; }
.password-actions { display: flex; justify-content: flex-end; padding-top: 20px; margin-top: 21px; border-top: 1px solid var(--line); }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 15px; border-bottom: 1px solid var(--line); background: #fafbfa; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .7px; text-align: left; text-transform: uppercase; }
td { padding: 14px 15px; border-bottom: 1px solid #edf0ee; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfdfc; }
td strong { color: var(--ink); font-weight: 600; }
.status-pill { display: inline-block; padding: 3px 7px; border-radius: 4px; font-size: 9px; font-weight: 650; }
.status-pill.sent { background: #eaf5ee; color: #2d704f; }
.status-pill.failed { background: #fbeceb; color: #9a3939; }
.error-text { display: block; max-width: 300px; margin-top: 4px; color: var(--danger); }
.muted { color: var(--muted); }
.empty-state { padding: 64px 24px; text-align: center; }
.empty-state h3 { margin-bottom: 6px; font-size: 16px; }
.empty-state p { margin-bottom: 20px; color: var(--muted); font-size: 12px; }

.auth-body { background: #f4f5f4; }
.auth-header { height: 68px; display: flex; align-items: center; padding: 0 34px; border-bottom: 1px solid var(--line); background: #fff; }
.auth-shell { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 48px 24px; }
.auth-panel { width: min(400px, 100%); }
.auth-card { padding: 30px 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.auth-card h2 { margin: 0 0 7px; font-size: 22px; font-weight: 650; letter-spacing: -.2px; }
.auth-description { margin-bottom: 0; font-size: 12px; }
.auth-switch { margin: 21px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-note { margin: 16px 0 0; color: var(--subtle); font-size: 10px; text-align: center; }
.auth-card .alert { margin-bottom: 22px; }

@media (max-width: 900px) {
  .topbar { gap: 28px; }
  .nav-links { gap: 18px; }
  .user-menu > div { display: none; }
  .user-menu form { padding-left: 0; border-left: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-column { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 650px) {
  .topbar { min-height: 62px; height: auto; padding: 13px 16px; flex-wrap: wrap; gap: 12px; }
  .menu-button { display: block; margin-left: auto; }
  .user-menu { margin-left: 0; }
  .user-menu .text-button { font-size: 11px; }
  .nav-links { display: none; order: 5; width: 100%; padding-top: 6px; border-top: 1px solid var(--line); flex-direction: column; gap: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 4px; border-bottom: 0; }
  .nav-links a.active { color: var(--accent); }
  .page-shell { width: calc(100% - 30px); padding: 29px 0 48px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 21px; }
  .page-heading h1 { font-size: 24px; }
  .vehicle-stat { padding-left: 10px; }
  .dashboard-grid { gap: 15px; }
  .form-card, .settings-card { padding: 20px 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 15px; }
  .span-2 { grid-column: span 1; }
  .timezone-note { margin-top: 0; }
  .side-column { grid-template-columns: 1fr; gap: 15px; }
  .submit-row, .settings-actions { align-items: stretch; flex-direction: column; }
  .submit-row .button { width: 100%; }
  .settings-actions > div { display: grid; width: 100%; }
  .setup-card { align-items: flex-start; flex-direction: column; gap: 16px; }
  .setup-card .button, .setup-card form, .setup-card form .button { width: 100%; }
  .auth-header { height: 62px; padding: 0 18px; }
  .auth-shell { min-height: calc(100vh - 62px); padding: 28px 15px; }
  .auth-card { padding: 25px 21px; }
}
