:root {
  color-scheme: light;
  --ink: #f8fbff;
  --muted: #9aa8b8;
  --line: rgba(255, 255, 255, 0.12);
  --paper: #061525;
  --panel: rgba(255, 255, 255, 0.045);
  --field: rgba(255, 255, 255, 0.075);
  --accent: #ff4164;
  --accent-2: #ff6f89;
  --navy: #061525;
  --navy-2: #0b2035;
  --purple: #311425;
  --red: #ff6b6b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 65, 100, 0.18), transparent 36%),
    linear-gradient(135deg, var(--navy) 0%, #08182a 58%, var(--purple) 100%);
}

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

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.25);
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  background: rgba(1, 11, 20, 0.72);
  border-right: 1px solid var(--line);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.brand-mark {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.brand strong {
  display: block;
  font-size: 18px;
}

.admin-badge {
  border: 1px solid rgba(255, 65, 100, 0.55);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.brand small,
.topbar p,
.muted {
  color: var(--muted);
}

.sidebar .brand small {
  color: #b7c1c9;
}

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

.tab {
  text-align: left;
  border: 0;
  background: transparent;
  color: #d9e1e7;
  font-weight: 700;
}

.tab.active,
.tab:hover {
  background: rgba(255, 65, 100, 0.12);
  box-shadow: inset 3px 0 0 var(--accent);
  color: white;
}

.shell {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.vehicle-switch,
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
}

select option {
  color: #061525;
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.hidden {
  display: none !important;
}

.toolbar,
.import-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.stats,
.lock-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.month-filter {
  min-width: 220px;
}

.stats span {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.trip-check {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: -4px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.trip-check strong {
  color: var(--text);
}

.trip-check.ok {
  border-color: rgba(85, 214, 156, 0.55);
  background: rgba(85, 214, 156, 0.12);
}

.trip-check.warning {
  border-color: rgba(255, 61, 112, 0.55);
  background: rgba(255, 61, 112, 0.1);
}

.trip-filter-panel {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.trip-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.trip-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(120px, 1fr));
  align-items: end;
  gap: 10px;
}

.trip-filter-grid label {
  min-width: 0;
}

.trip-filter-grid input,
.trip-filter-grid select {
  width: 100%;
}

.trip-filter-grid button {
  min-height: 42px;
  white-space: nowrap;
}

.table-wrap,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.table-wrap {
  overflow: auto;
}

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

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

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

.split {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel.wide {
  max-width: 980px;
}

.import-vehicle {
  max-width: 360px;
  margin: 16px 0 14px;
}

.import-odometer {
  display: grid;
  gap: 7px;
  max-width: 360px;
  margin-top: 14px;
}

.export-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
  gap: 12px;
  margin: 16px 0;
}

.fueling-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fueling-summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.import-row {
  justify-content: flex-start;
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-only {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.file-stack {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
}

.file-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.template-link {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--accent-2);
  padding: 0;
  font-weight: 800;
}

.template-link:hover {
  color: white;
  text-decoration: underline;
}

.estimate-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 65, 100, 0.28);
  border-radius: 8px;
  background: rgba(255, 65, 100, 0.08);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
}

form {
  display: grid;
  gap: 12px;
}

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

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

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 65, 100, 0.16);
  color: var(--accent-2);
  font-size: 12px;
}

.badge.private {
  background: rgba(255, 255, 255, 0.1);
  color: #dbe6f2;
}

.badge.locked {
  background: rgba(255, 107, 107, 0.16);
  color: var(--red);
}

button.danger {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.45);
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check input {
  width: auto;
}

pre {
  max-height: 300px;
  overflow: auto;
  background: rgba(1, 11, 20, 0.82);
  color: #eef5f1;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
}

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

.log-entry {
  border-bottom: 1px solid var(--line);
  padding: 0 0 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.log-entry:last-child {
  border-bottom: 0;
}

.log-entry time {
  color: var(--muted);
  font-size: 12px;
}

.log-main {
  min-width: 0;
}

.log-delete {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 107, 107, 0.32);
  background: transparent;
  color: rgba(255, 107, 107, 0.82);
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}

.log-delete:hover {
  border-color: var(--red);
  color: var(--red);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(760px, calc(100vw - 28px));
  box-shadow: var(--shadow);
  background: #071827;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(23, 32, 38, 0.42);
}

#tripForm {
  padding: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

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

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .topbar,
  .toolbar,
  .split,
  .import-row,
  .file-action-row,
  .export-grid,
  .trip-filter-grid,
  .fueling-summary,
  .admin-section-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 20px;
  }

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

  .sidebar {
    gap: 18px;
  }

  .brand-mark {
    width: 88px;
    height: 88px;
  }

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