/* ---------------------------------------------------------------
   Trams — stylesheet
   Same quiet, logbook-style design as middagsboken: cool-neutral
   paper background, a single deep navy accent, hairline borders
   instead of shadows, and a geometric display face used sparingly
   for structure.
   ------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --color-bg: #F1F0EB;
  --color-surface: #FFFFFF;
  --color-ink: #2A2723;
  --color-muted: #8A8378;
  --color-accent: #2A4D6E;
  --color-accent-soft: #E6EDF4;
  --color-line: #E2DED4;
  --color-warn-bg: #F6ECD9;
  --color-warn-text: #8A5A12;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;

  --radius: 10px;
  --sidebar-width: 230px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 0.75rem; }

.muted { color: var(--color-muted); }
.mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-line);
  padding: 1.75rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 2rem;
  color: var(--color-ink);
}
.brand .dot { color: var(--color-accent); }

.nav-list { list-style: none; padding: 0; margin: 0; }
.nav-list li { margin-bottom: 0.15rem; }
.nav-list a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  color: var(--color-ink);
  font-size: 0.92rem;
}
.nav-list a:hover { background: var(--color-bg); text-decoration: none; }
.nav-list a.active { background: var(--color-accent-soft); color: var(--color-accent); font-weight: 500; }

.content {
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: 880px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
}

/* Mobile top bar (sidebar collapses) */
.topbar { display: none; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { display: none; }

  .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-line);
    padding: 0.9rem 1.25rem 0.6rem;
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .topbar .brand { margin-bottom: 0.6rem; }
  .topbar nav {
    display: flex;
    gap: 0.3rem;
    font-size: 0.82rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--color-line);
    padding-top: 0.5rem;
  }
  .topbar nav a {
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    color: var(--color-ink);
  }
  .topbar nav a:hover { background: var(--color-bg); text-decoration: none; }

  .content { padding: 1.25rem 1rem; max-width: 100%; }

  h1 { font-size: 1.3rem; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }

  .row-link { flex-wrap: wrap; gap: 0.5rem; }

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

  /* Tables scroll horizontally rather than overflowing */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.plain { min-width: 480px; }

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

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.55rem 1rem;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--color-accent);
  color: #fff;
}
.btn:hover { background: #1F3B54; text-decoration: none; }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-line);
}
.btn-secondary:hover { background: var(--color-bg); }

.btn-danger {
  background: var(--color-surface);
  color: #8a3a3a;
  border: 1px solid var(--color-line);
}
.btn-danger:hover { background: #fbeceb; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

form.inline { display: inline; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  margin-top: 1rem;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=tel],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-line);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-ink);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.field-hint { font-size: 0.78rem; color: var(--color-muted); margin-top: 0.2rem; }

.form-actions {
  margin-top: 1.75rem;
  display: flex;
  gap: 0.6rem;
}

fieldset {
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-top: 1rem;
}
fieldset legend {
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 0 0.3rem;
  color: var(--color-muted);
}

/* ---------- Cards & lists ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1rem;
}

.card-list .card { margin-bottom: 0.75rem; }

.row-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.row-link h2, .row-link h3 { margin-bottom: 0.15rem; }

.empty-state {
  border: 1px dashed var(--color-line);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  margin: 0 0.25rem 0.25rem 0;
}
.badge-warn { background: var(--color-warn-bg); color: var(--color-warn-text); }
.badge-muted { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-line); }

/* ---------- Stats (dashboard) ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat .stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-accent);
}
.stat .stat-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.2rem;
}

/* ---------- Progress bars (model coverage) ---------- */

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}
.progress-header h3 { margin-bottom: 0; }

.progress-bar {
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
}
.progress-bar-fill {
  background: var(--color-accent);
  height: 100%;
}

/* ---------- Line coverage pills ---------- */

.line-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.line-pill {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid var(--color-line);
}
.line-pill-pending { opacity: 0.3; }

.line-pill-sm {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 0.78rem;
  margin-top: 0.3rem;
}

/* ---------- Log entry ---------- */

.log-number {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-accent);
  letter-spacing: 0.03em;
}

.log-entry {
  display: flex;
  gap: 1.1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-line);
}
.log-entry:last-child { border-bottom: none; }
.log-entry .log-marker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-muted);
  width: 4.5rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}
.log-entry .log-body { flex: 1; }
.log-entry form { flex-shrink: 0; align-self: flex-start; }
.log-entry .log-body .date { font-size: 0.82rem; color: var(--color-muted); }

.list-row { padding: 0.6rem 0; border-bottom: 1px solid var(--color-line); }
.list-row:last-child { border-bottom: none; }

.note {
  font-size: 0.88rem;
  color: var(--color-ink);
  background: var(--color-bg);
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
  margin-top: 0.4rem;
}

table.plain { width: 100%; border-collapse: collapse; }
table.plain th, table.plain td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--color-line);
  font-size: 0.9rem;
}
table.plain th { color: var(--color-muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Model filter (trams index) ---------- */

.model-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}
.model-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 100px;
  cursor: pointer;
  background: var(--color-surface);
}
.model-filter-pill input[type=checkbox] { accent-color: var(--color-accent); margin: 0; }
.model-filter-pill:has(input:checked) {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent);
}
