:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #f0f4f2;
  --ink: #1b2321;
  --muted: #63716b;
  --line: #dce3de;
  --accent: #146c62;
  --accent-strong: #0f514a;
  --warning: #a85f13;
  --danger: #a33a38;
  --shadow: 0 18px 42px rgba(30, 49, 44, 0.12);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px;
  overflow: auto;
  background: #21302c;
  color: #f8fbfa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: #f2c14e;
  color: #21302c;
  font-weight: 800;
}

.brand h1,
.brand p,
.panel h3,
.panel p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 2px;
  color: #bdd0ca;
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #dce9e5;
  text-align: left;
}

.nav-tab.is-active {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.side-panel {
  display: grid;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.side-panel h2 {
  margin: 0 0 2px;
  font-size: 15px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.sidebar label {
  color: #d3e0dc;
}

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

input:focus,
select:focus,
button:focus-visible,
.file-button:focus-within {
  outline: 3px solid rgba(20, 108, 98, 0.22);
  outline-offset: 2px;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 3px;
  font-size: 30px;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.primary-button,
.ghost-button,
.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 750;
}

.icon-button {
  display: grid;
  width: 42px;
  padding: 0;
  place-items: center;
  font-size: 20px;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.ghost-button {
  background: transparent;
}

.sidebar .ghost-button {
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel.is-visible {
  display: block;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 20px;
}

.panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.ride-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.compact-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 13px;
  align-items: end;
  margin-bottom: 16px;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-self: end;
}

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

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

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

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e5f3f0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.type-badge.private {
  background: #fbeddc;
  color: var(--warning);
}

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

.small-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.small-button.danger {
  border-color: rgba(163, 58, 56, 0.36);
  color: var(--danger);
}

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

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.list-item strong {
  display: block;
}

.list-item span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: none;
  margin: 16px 0 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state.is-visible,
.is-hidden {
  display: none;
}

.empty-state.is-visible {
  display: block;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: translateY(16px);
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 13px 15px;
  background: #21302c;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

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

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

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

@media (max-width: 680px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-header,
  .list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .ride-form,
  .compact-form,
  .side-panel,
  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .actions,
  .form-actions,
  .row-actions {
    flex-wrap: wrap;
  }
}
