/* THM Fleet Tools — shared Apple-style theme (light + dark, follows system setting) */
:root {
  color-scheme: light dark;
  --c-bg: 245 245 247;
  --c-surface: 255 255 255;
  --c-fill: 232 232 237;
  --c-label: 29 29 31;
  --c-label2: 110 110 115;
  --c-sep: 0 0 0;
  --sep-a: .1;
  --c-accent: 0 113 227;
  --c-link: 0 102 204;
  --c-ok: 36 138 61;
  --c-warn: 182 86 0;
  --c-bad: 215 0 21;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: 0 0 0;
    --c-surface: 28 28 30;
    --c-fill: 44 44 46;
    --c-label: 245 245 247;
    --c-label2: 152 152 157;
    --c-sep: 255 255 255;
    --sep-a: .13;
    --c-accent: 10 132 255;
    --c-link: 41 151 255;
    --c-ok: 48 209 88;
    --c-warn: 255 159 10;
    --c-bad: 255 69 58;
    --shadow: none;
  }
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: rgb(var(--c-bg));
  color: rgb(var(--c-label));
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}
.mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:focus-visible { outline: 3px solid rgb(var(--c-accent) / .55); outline-offset: 2px; }

/* Translucent navigation bar */
.nav {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top);
  background: rgb(var(--c-bg) / .72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgb(var(--c-sep) / var(--sep-a));
}
.nav-link {
  display: inline-flex; align-items: center; min-height: 32px;
  padding: 0 12px; border-radius: 999px;
  color: rgb(var(--c-label2)); font-size: 14px; font-weight: 500;
  transition: color .2s, background-color .2s;
}
.nav-link:hover { color: rgb(var(--c-label)); }
.nav-link[aria-current="page"] { color: rgb(var(--c-label)); background: rgb(var(--c-fill)); }

/* Surfaces */
.card {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-sep) / var(--sep-a));
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card-link { display: block; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .card-link:hover { transform: translateY(-3px); border-color: rgb(var(--c-accent) / .5); } }
.card-link:active { transform: scale(.985); }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: rgb(var(--c-label2)); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px;
  font: inherit; font-size: 16px; font-weight: 500; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, filter .2s ease, background-color .2s ease, opacity .2s ease;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: rgb(var(--c-accent)); color: #fff; }
.btn-gray { background: rgb(var(--c-fill)); color: rgb(var(--c-label)); }
.btn-tinted { background: rgb(var(--c-accent) / .12); color: rgb(var(--c-link)); }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.08); } }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 13px; }
@media (pointer: coarse) { .btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; } }

/* Form fields (16px text prevents iOS focus zoom) */
.field {
  width: 100%; min-height: 48px; padding: 0 16px;
  border: 1px solid rgb(var(--c-sep) / calc(var(--sep-a) * 1.8)); border-radius: 12px;
  background: rgb(var(--c-surface)); color: rgb(var(--c-label));
  font: inherit; font-size: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field::placeholder { color: rgb(var(--c-label2) / .6); }
.field:focus { border-color: rgb(var(--c-accent)); box-shadow: 0 0 0 4px rgb(var(--c-accent) / .2); }
select.field { min-height: 40px; width: auto; padding: 0 12px; font-size: 16px; }

/* Badges & callouts */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: rgb(var(--c-ok) / .14); color: rgb(var(--c-ok)); }
.badge-warn { background: rgb(var(--c-warn) / .14); color: rgb(var(--c-warn)); }
.badge-bad { background: rgb(var(--c-bad) / .14); color: rgb(var(--c-bad)); }
.badge-gray { background: rgb(var(--c-fill)); color: rgb(var(--c-label2)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.callout-warn { background: rgb(var(--c-warn) / .1); }
.callout-warn svg, .callout-warn strong { color: rgb(var(--c-warn)); }
.callout-bad { background: rgb(var(--c-bad) / .1); }
.callout-bad svg, .callout-bad strong { color: rgb(var(--c-bad)); }

/* Toast (HUD style) */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%);
  width: max-content; max-width: min(92vw, 480px);
  padding: 12px 18px; border-radius: 14px;
  background: rgb(var(--c-label)); color: rgb(var(--c-bg));
  font-size: 14px; font-weight: 500; line-height: 1.4; text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  pointer-events: none;
}
.toast-error { background: rgb(var(--c-bad)); color: #fff; }

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