:root {
  --ink: #16231d;
  --muted: #65736c;
  --paper: #f5f4ed;
  --card: #fffef9;
  --green: #12372a;
  --green-2: #1e6148;
  --lime: #d7ed70;
  --line: #dfe3dc;
  --danger: #a23535;
  --shadow: 0 12px 30px rgba(20, 45, 35, .08);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 18px max(18px, env(safe-area-inset-left)); color: white; background: var(--green); }
.topbar h1 { margin: 2px 0 0; font-size: 1.35rem; }
.eyebrow { font-size: .68rem; letter-spacing: .16em; color: var(--lime); }
.eyebrow.dark { color: var(--green-2); }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, var(--green), #0a241a); }
.login-panel { width: min(100%, 420px); }
.login-panel h1 { margin: 5px 0; }
.login-panel p { margin-top: 0; color: var(--muted); }
.login-icon { width: 64px; height: 64px; border-radius: 15px; }
.diagnostic-link { color: var(--green-2); text-align: center; font-size: .8rem; font-weight: 800; }
.version-label { color: var(--muted); text-align: center; font-size: .68rem; }
.developer-credit { color: var(--muted); text-align: center; font-size: .72rem; font-weight: 700; }
.app-credit { margin: 28px 0 6px; }
.user-chip { display: grid; justify-items: end; gap: 3px; font-size: .72rem; }
.user-chip button { padding: 0; color: var(--lime); border: 0; background: transparent; font-weight: 800; }
main { max-width: 900px; margin: 0 auto; padding: 0 16px 100px; }
.view { display: none; }
.view.active { display: block; }
.hero { margin: 16px 0 24px; padding: 28px 22px; color: white; border-radius: 24px; background: linear-gradient(145deg, var(--green), var(--green-2)); box-shadow: var(--shadow); }
.hero h2 { max-width: 520px; margin: 18px 0 8px; font-size: clamp(1.7rem, 7vw, 2.7rem); line-height: 1.04; }
.hero p { color: #d4e2da; }
.badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; color: var(--green); background: var(--lime); font-size: .75rem; font-weight: 800; }
.danger-badge { color: white; background: var(--danger); }
.section { margin: 24px 0; }
.section-title, .page-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-title h3, .page-heading h2 { margin: 0; }
.counter { min-width: 25px; padding: 3px 7px; text-align: center; border-radius: 99px; color: white; background: var(--green); font-size: .8rem; }
.panel, .trip-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.card-list { display: grid; gap: 12px; }
.trip-card { display: grid; gap: 11px; }
.trip-card.open { border-left: 5px solid var(--lime); }
.occurrence-card.emergency { border-left: 5px solid var(--danger); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.card-top h4 { margin: 0 0 3px; font-size: 1.06rem; }
.card-top p, .trip-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.km { font-weight: 900; white-space: nowrap; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .82rem; }
.primary, .secondary, .icon-button, .back-button { border: 0; border-radius: 12px; font-weight: 800; }
.primary { padding: 12px 16px; color: white; background: var(--green); }
.primary:hover { background: var(--green-2); }
.primary.accent { color: var(--green); background: var(--lime); }
.secondary { padding: 11px 14px; color: var(--green); border: 1px solid var(--green); background: transparent; }
.large { width: 100%; padding: 16px; }
.compact { padding: 9px 11px; font-size: .78rem; }
.icon-button, .back-button { padding: 9px 11px; color: inherit; background: rgba(255,255,255,.12); }
.back-button { color: var(--green); background: #e3e8e3; }
.page-heading { padding-top: 20px; }
form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(30,97,72,.12); }
.input-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.info-box { padding: 11px; border-radius: 10px; color: var(--green); background: #e9f1e8; font-size: .85rem; }
.settings-grid { display: grid; gap: 14px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.metric-card { min-height: 105px; display: grid; align-content: space-between; padding: 16px; border-radius: 16px; color: white; background: var(--green); box-shadow: var(--shadow); }
.metric-card span { color: #d4e2da; font-size: .78rem; font-weight: 750; }
.metric-card strong { color: var(--lime); font-size: 1.55rem; }
.dashboard-lists { margin-bottom: 14px; }
.bar-list { display: grid; gap: 10px; }
.bar-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: .8rem; }
.bar-item i { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #e3e8e3; overflow: hidden; }
.bar-item i::after { content: ""; display: block; width: var(--bar); height: 100%; border-radius: inherit; background: var(--green-2); }
.smtp-grid { display: grid; gap: 12px; }
.panel h4 { margin: 8px 0 0; }
.panel h3 { margin: 0 0 12px; }
.simple-list { display: grid; gap: 5px; }
.simple-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.simple-item:last-child { border: 0; }
.simple-item small { display: block; color: var(--muted); margin-top: 2px; }
.danger-link { color: var(--danger); border: 0; background: transparent; font-weight: 800; }
.text-link { color: var(--green-2); border: 0; background: transparent; font-weight: 800; }
.row-actions, .button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.occurrence-filters { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.occurrence-filters button { align-self: end; }
.bottom-nav { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; padding: 7px 8px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,254,249,.96); backdrop-filter: blur(12px); }
.nav-item { flex: 1; display: grid; gap: 2px; justify-items: center; padding: 7px; color: var(--muted); border: 0; background: transparent; font-size: .7rem; font-weight: 800; }
.nav-item span { font-size: 1.25rem; }
.nav-item.active { color: var(--green); }
.empty { padding: 20px; color: var(--muted); text-align: center; border: 1px dashed #c6cec7; border-radius: 16px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 90px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; color: white; border-radius: 12px; background: var(--ink); box-shadow: var(--shadow); }
.hidden { display: none !important; }
dialog { width: min(94%, 580px); padding: 18px; border: 0; border-radius: 20px; color: var(--ink); background: var(--card); }
dialog::backdrop { background: rgba(9,23,17,.72); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; }
.dialog-header h3 { margin: 0; }
video { width: 100%; max-height: 50vh; margin: 10px 0; border-radius: 14px; background: #111; }
dialog.photo-mode video, dialog.photo-mode #captureButton { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.route-dialog { width: min(96%, 900px); }
#routeMap { width: 100%; height: min(65vh, 600px); margin-top: 12px; border-radius: 14px; background: #e3e8e3; }
.route-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.route-status { color: var(--green-2); font-size: .78rem; font-weight: 800; }
.photo-confirmation { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: #e9f1e8; color: var(--green); font-size: .78rem; }
.photo-confirmation img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; }
.audit-photo { display: block; max-width: 100%; max-height: 72vh; margin: 14px auto 0; border-radius: 12px; }
.maintenance-overdue { border-left: 4px solid var(--danger); }
.maintenance-soon { border-left: 4px solid #d49325; }
.offline { color: white; background: #a35d21; }
@media (min-width: 700px) {
  .dashboard-grid { grid-template-columns: repeat(5, 1fr); }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .smtp-grid { grid-template-columns: 1fr 1fr; }
  .full { grid-column: 1 / -1; }
  .bottom-nav { left: 50%; width: 700px; max-width: calc(100% - 20px); transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}
