:root {
  --ink: #10201d;
  --muted: #5b6b66;
  --line: #d8e0dc;
  --panel: #ffffff;
  --wash: #f4f8f6;
  --soft: #e7f3ef;
  --accent: #0f766e;
  --accent-strong: #0a5f58;
  --good: #15803d;
  --warn: #b45309;
  --bad: #b42318;
  --good-bg: #e7f8ed;
  --warn-bg: #fff4db;
  --bad-bg: #ffe9e6;
  --shadow: 0 14px 30px rgba(16, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--wash);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  color: #eef8f5;
  background: #103f39;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-plate {
  display: grid;
  min-width: 96px;
  min-height: 48px;
  place-items: center;
  border: 2px solid #151515;
  border-left: 14px solid #1d4ed8;
  border-radius: 8px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #fff8bf, #f7df53);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  color: #121212;
  font-family: "Arial Narrow", Impact, ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  word-break: break-word;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #b9d6ce;
}

.garage-switcher {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.garage-switcher label {
  color: #b9d6ce;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.garage-switcher select {
  border-color: rgba(255, 255, 255, 0.3);
  background: #ffffff;
  color: var(--ink);
}

.garage-switcher small {
  color: #d8f1eb;
  line-height: 1.35;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  border-radius: 8px;
  padding: 11px 12px;
  color: #dcefeb;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cde7df;
  font-size: 0.85rem;
}

.sidebar-note code {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  white-space: normal;
  word-break: break-word;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 248, 246, 0.94);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 2.3vw, 2.2rem);
}

h2 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button,
button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button:hover,
button:hover {
  background: var(--accent-strong);
}

.button.ghost,
button.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button.danger,
button.danger {
  background: var(--bad-bg);
  color: var(--bad);
}

.content {
  display: grid;
  gap: 22px;
  padding: 28px 30px 46px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 14px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 116px;
  padding: 16px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
}

.stat-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  gap: 22px;
}

.file-input {
  display: block;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.garage-list {
  display: grid;
  gap: 10px;
}

.garage-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mini-plate {
  min-width: 92px;
  border: 2px solid #151515;
  border-left: 12px solid #1d4ed8;
  border-radius: 6px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #fff8bf, #f7df53);
  color: #111111;
  font-family: "Arial Narrow", Impact, ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #103f39;
  color: #ffffff;
  font-size: 0.78rem;
}

tbody tr:nth-child(even) {
  background: #f8fbfa;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.good {
  background: var(--good-bg);
  color: var(--good);
}

.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.pill.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.muted {
  color: var(--muted);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  text-align: center;
}

.reminder-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.reminder,
.activity {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.activity {
  grid-template-columns: auto 1fr auto;
}

.activity-type {
  min-width: 94px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 86px;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}

.bar-track {
  overflow: hidden;
  height: 14px;
  border-radius: 999px;
  background: #edf4f1;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #4fb89f);
}

.json-box {
  overflow: auto;
  max-height: 620px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #0f1f1c;
  color: #dff8ef;
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: 360px;
  transform: translateY(20px);
  border-radius: 8px;
  padding: 12px 14px;
  background: #103f39;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

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

  .split-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: 0;
  }

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

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .content {
    padding: 20px;
  }

  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
