:root {
  /* Named --color-* (not --pico-*): the app ships a small hand-written
     stylesheet, not Pico.css, despite the CLAUDE.md reference — same
     variable role, different prefix. See UI_BACKLOG.md. */
  --color-bg: #FAFAF8;
  --color-text: #1A1A1A;
  --color-muted: #6b7280;
  --color-border: #d8dde3;
  --color-primary: #2E7D46;
  --color-primary-hover: #276b3c;
  --color-accent: #F2994A;
  --color-accent-hover: #de8c44;
  --color-accent-text: #1A1A1A;
  --color-danger: #b91c1c;
  --color-success: #15803d;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

h1, h2, h3 {
  color: var(--color-primary);
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
}

.site-header nav > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
  text-decoration: none;
}

main.container {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

a {
  color: var(--color-primary);
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

tr.row-cancelled {
  opacity: 0.6;
}

tr.row-cancelled a {
  text-decoration: line-through;
}

/* Below this width a data table doesn't fit — collapse each row into
   a stacked card instead (same breakpoint as the calendar agenda
   view, for consistency). Column order in the markup is always
   Dato, Tid, Hold, Instruktør, Status[, Actions], so the nth-child
   selectors below apply the same way to index.html's 5-column table
   and mine.html's 6-column one. */
@media (max-width: 700px) {
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr {
    display: block;
    width: 100%;
  }

  .table-wrap td {
    display: block;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .table-wrap td {
    border: none;
    padding: 0;
  }

  /* Hold: card heading, full width, shown first */
  .table-wrap td:nth-child(3) {
    order: -2;
    flex: 1 0 100%;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
  }

  /* Dato / Tid / Instruktør: compact meta line under the heading */
  .table-wrap td:nth-child(1),
  .table-wrap td:nth-child(2),
  .table-wrap td:nth-child(4) {
    order: -1;
    flex: 0 0 auto;
    font-size: 0.85rem;
    color: var(--color-muted);
  }

  .table-wrap td:nth-child(1)::after,
  .table-wrap td:nth-child(2)::after {
    content: "\00b7";
    margin: 0 0.35rem;
  }

  /* Status badges: own line */
  .table-wrap td:nth-child(5) {
    order: 0;
    flex: 1 0 100%;
    margin-top: 0.5rem;
  }

  /* Actions (mine.html only — index.html has no 6th column): own
     line, visually separated from the status line above it */
  .table-wrap td:nth-child(6) {
    order: 1;
    flex: 1 0 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
  }
}

form.inline {
  display: inline;
}

label {
  display: block;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
}

button, .btn, input[type="submit"], input[type="button"] {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .btn:hover, input[type="submit"]:hover, input[type="button"]:hover {
  background: var(--color-primary-hover);
}

button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-danger {
  background: var(--color-danger);
}

/* Matches input[...] on specificity explicitly: a plain .btn-accent class
   selector alone loses to the input[type="submit"] rule above on the same
   <input>, since attribute selectors outrank class selectors when tied
   elsewhere — WTForms SubmitField renders as <input type="submit">. */
.btn-accent,
input[type="submit"].btn-accent,
input[type="button"].btn-accent {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

.btn-accent:hover,
input[type="submit"].btn-accent:hover,
input[type="button"].btn-accent:hover {
  background: var(--color-accent-hover);
}

.btn-link {
  background: none;
  color: var(--color-primary);
  padding: 0;
  font-size: 1rem;
  text-decoration: none;
}

.btn-link:hover {
  background: none;
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.copy-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.copy-row input {
  flex: 1;
  min-width: 0;
}

.share-message textarea {
  font-family: inherit;
  margin-bottom: 0.5rem;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.view-toggle a {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.view-toggle a.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.cal-grid {
  display: grid;
  grid-template-rows: auto;
  grid-auto-rows: var(--cal-minute-px, 1.5px);
  gap: 1px;
  margin: 1rem 0;
  /* No overflow-x here on purpose: per the CSS overflow spec, setting
     overflow-x to anything but "visible" forces overflow-y's *computed*
     value to "auto" too (explicitly writing "overflow-y: visible" does
     NOT override this) — turning the grid into its own vertical
     scrollport. Not needed anyway: .cal-block has overflow:hidden, which
     gives the 1fr day columns an automatic minimum width of 0, so they
     can shrink to fit without forcing horizontal overflow. */
}

.cal-hour-mark {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-align: right;
  padding-right: 0.5rem;
}

.cal-day-header {
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  padding: 0.5rem 0.25rem;
  border-bottom: 2px solid var(--color-border);
}

.cal-gap {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--color-muted);
  border-top: 1px dashed var(--color-border);
  border-bottom: 1px dashed var(--color-border);
}

.cal-block {
  border-radius: var(--radius);
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1.15;
  overflow: hidden;
  border-left: 4px solid transparent;
  margin: 0 2px;
}

.cal-block a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.cal-block-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.cal-block--open {
  background: #dcfce7;
  border-left-color: var(--color-success);
}

.cal-block--full {
  background: #fef3c7;
  border-left-color: #92400e;
}

.cal-block--cancelled {
  background: #e5e7eb;
  opacity: 0.75;
}

.cal-block--cancelled a {
  text-decoration: line-through;
}

.cal-block--mine {
  border-left-width: 6px;
  border-left-color: var(--color-accent);
}

/* Already happened this week — kept visible for context (the calendar
   shows the whole Mon-Sun week, not just "upcoming" like the list view),
   but dimmed so it doesn't compete with what's still actionable. Placed
   after .cal-block--cancelled so a past+cancelled block gets this
   lower opacity rather than cancelled's alone (same specificity, source
   order decides). No strikethrough here — that stays cancelled-only,
   so "past" and "cancelled" read as visually distinct reasons. */
.cal-block--past {
  opacity: 0.55;
}

.cal-block-mine-marker {
  font-weight: 700;
}

.cal-day-empty {
  display: none;
}

@media (max-width: 700px) {
  .cal-grid {
    display: block;
  }

  .cal-corner,
  .cal-hour-mark,
  .cal-gap {
    display: none;
  }

  .cal-day-header {
    text-align: left;
    margin-top: 1rem;
  }

  .cal-block {
    margin: 0.5rem 0;
  }

  .cal-day-empty {
    display: block;
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 0.25rem 0;
  }
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #e5e7eb;
}

.badge-success {
  background: #dcfce7;
  color: var(--color-success);
}

.badge-full {
  background: #fef3c7;
  color: #92400e;
}

.badge-waitlist {
  background: #fef3c7;
  color: #92400e;
}

.flashes {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: #e5e7eb;
}

.flash-success {
  background: #dcfce7;
  color: var(--color-success);
}

.flash-error, .flash-danger {
  background: #fee2e2;
  color: var(--color-danger);
}

.flash-info {
  background: #dbeafe;
  color: #1e40af;
}

.muted {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.field-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin: 0.15rem 0 0;
}
