/* Layout and components for the schedule app. No CSS framework: small, readable, no CDN needed. */

:root {
  --sidebar: #263043;
  --sidebar-text: #c9d1e0;
  --sidebar-active: #ffffff;
  --bg: #f3f4f7;
  --card: #ffffff;
  --border: #e3e6ec;
  --text: #2d3340;
  --muted: #7a8394;
  --accent: #6c5ce7;
  --accent-dark: #5a4bd1;
  --link: #3867d6;
  --ok-bg: #e3f4e8;    --ok-text: #1d6b37;
  --warn-bg: #fdf1dc;  --warn-text: #7a5300;
  --err-bg: #fbe3e3;   --err-text: #8a1f1f;
  --radius: 4px;
  font-size: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; margin: 0; }

/* --- Shell: sidebar + main ------------------------------------------------------------------ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex: 0 0 200px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 1rem 1.1rem; font-size: 1.15rem; color: #fff; }
.sidebar .brand small { display: block; font-size: .75rem; color: var(--sidebar-text); opacity: .8; }
.sidebar nav { flex: 1; padding-top: .5rem; }
.sidebar nav a {
  display: block; padding: .55rem 1.1rem; color: var(--sidebar-text); border-left: 3px solid transparent;
}
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.04); text-decoration: none; }
.sidebar nav a.active { color: var(--sidebar-active); border-left-color: var(--accent); background: rgba(255,255,255,.06); }
.sidebar .logout { padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .logout button {
  background: none; border: 0; color: var(--sidebar-text); padding: 0; cursor: pointer; font: inherit;
}
.sidebar .logout button:hover { color: #fff; }

main { flex: 1; min-width: 0; }
.page-header {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: 1rem 1.5rem; background: var(--bg); border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 1.35rem; color: #4a5263; }
.page-header .actions { margin-left: auto; display: flex; gap: .5rem; }
.content { padding: 1.25rem 1.5rem 3rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card > h2 { font-size: 1.1rem; margin-bottom: .75rem; color: #4a5263; }

/* --- Buttons & forms ------------------------------------------------------------------------ */
.btn {
  display: inline-block; padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; cursor: pointer; line-height: 1.3; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--text); border-color: #c7ccd6; }
.btn.secondary:hover { background: #f5f6f9; color: var(--text); }
.btn.small { padding: .2rem .6rem; font-size: .85rem; }

label { display: block; color: #4a5263; margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid #d4d8e0; border-radius: var(--radius);
  font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid rgba(108,92,231,.35); outline-offset: 1px; }
/* Radio buttons and checkboxes: native look in the accent colour; a focus ring only for keyboard users. */
input[type="radio"], input[type="checkbox"] { width: auto; padding: 0; margin: 0; accent-color: var(--accent); }
input[type="radio"]:focus-visible, input[type="checkbox"]:focus-visible { outline-offset: 2px; border-radius: 50%; }
input[type="checkbox"]:focus-visible { border-radius: 3px; }
input::placeholder { color: #b0b6c2; }
.field { margin-bottom: .9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1.25rem; }
.span-2 { grid-column: span 2; }
.checks label { display: flex; align-items: center; gap: .5rem; margin: .2rem 0; color: var(--text); }
.checks input { width: auto; }
.checks code { color: var(--muted); font-size: .8rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
legend, .section-title { font-size: 1.1rem; color: #4a5263; padding: 0; }
.section-sub { color: var(--muted); font-size: .85rem; margin: 0 0 .9rem; }
.form-actions { display: flex; gap: .5rem; }

/* --- Tables --------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th {
  text-align: left; font-weight: 500; font-size: .85rem; color: var(--muted);
  padding: .7rem .8rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
th a { color: var(--muted); }
td { padding: .7rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: #f8f9fb; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #eef0fb; }
td .sub { display: block; color: var(--muted); font-size: .9em; }
td.num { white-space: nowrap; }

.count { color: var(--muted); margin: 0 0 .5rem; }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }

/* --- Notices -------------------------------------------------------------------------------- */
.notice { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.error { background: var(--err-bg); color: var(--err-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.notice strong { display: block; }

/* --- Settings ------------------------------------------------------------------------------- */
form.inline { display: inline; margin: 0; }
tr.inactive td { color: var(--muted); }
.add-row { display: flex; gap: .5rem; margin-top: .75rem; }
.add-row input { max-width: 16rem; }

/* --- Login (no sidebar) ----------------------------------------------------------------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.login-card { width: 100%; max-width: 24rem; background: #fff; border-radius: 6px; padding: 2rem; }
.login-card h1 { font-size: 1.3rem; margin-bottom: .25rem; }
.login-card p.sub { color: var(--muted); margin: 0 0 1.25rem; }
.login-card .btn { width: 100%; padding: .6rem; }

/* --- Settings row actions ----------------------------------------------------------------------- */
td.row-actions { white-space: nowrap; text-align: right; }

/* --- Timetable colours (Instellingen › Dienstregelingen) ---------------------------------------- */
/* Yellow needs dark text; the others white. "closed" = Gesloten: white with a border. */
.tt-yellow { --tt: #f2c500; --tt-text: #3d3200; }
.tt-blue   { --tt: #1c7ed6; --tt-text: #fff; }
.tt-green  { --tt: #2f9e44; --tt-text: #fff; }
.tt-red    { --tt: #d64545; --tt-text: #fff; }
.tt-orange { --tt: #e8890c; --tt-text: #fff; }
.tt-purple { --tt: #8e44ad; --tt-text: #fff; }
.tt-grey   { --tt: #8a93a3; --tt-text: #fff; }
.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 1rem; font-size: .85em; font-weight: 600;
  background: var(--tt, #fff); color: var(--tt-text, var(--text)); white-space: nowrap;
}
.badge.closed { background: #fff; color: var(--muted); border: 1px solid var(--border); }
.swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; background: var(--tt, #fff);
          vertical-align: -2px; margin-right: .35rem; }
.swatch.closed { border: 1px solid #c7ccd6; }

/* --- Year calendar ----------------------------------------------------------------------------- */
.cal-nav { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.summary p { margin: 0 0 .5rem; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.year { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.cal-month { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; }
.cal-month h2 { font-size: 1rem; margin-bottom: .5rem; color: #4a5263; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { font-size: .72rem; color: var(--muted); text-align: center; text-transform: uppercase; }
.cal-day {
  display: block; text-align: center; padding: .3rem 0; border-radius: 4px; font-size: .85rem;
  font-variant-numeric: tabular-nums; background: var(--tt); color: var(--tt-text); font-weight: 600;
}
.cal-day.closed { background: #fff; color: var(--text); font-weight: 400; box-shadow: inset 0 0 0 1px var(--border); }
.cal-day:hover { text-decoration: none; filter: brightness(.92); }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.description { white-space: pre-line; }
td.description { font-size: .9em; color: #4a5263; }
.day-status { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 0; }
.day-status .badge { font-size: 1rem; }
.hours { gap: 0 .75rem; }
.inline-check { display: flex; align-items: center; gap: .4rem; }
.inline-check input { width: auto; }
code { background: var(--bg); padding: 0 .25rem; border-radius: 3px; }

/* --- Small screens (phones) -------------------------------------------------------------------- */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .brand { padding: .6rem 1rem; }
  .sidebar .logout { border: 0; margin-left: auto; padding: .6rem 1rem; }
  .sidebar nav { order: 3; width: 100%; display: flex; padding: 0; }
  .sidebar nav a { flex: 1; text-align: center; border-left: 0; border-bottom: 3px solid transparent; }
  .sidebar nav a.active { border-bottom-color: var(--accent); }
  .page-header { padding: .75rem 1rem; }
  .content { padding: 1rem 1rem 2rem; }
  .card { padding: 1rem; }
  .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .hours { grid-template-columns: 1fr 1fr; }
  .col-active { display: none; }
}

/* --- Trains (timetable page, day page) --------------------------------------------------------- */
table.trains th .sub { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
table.trains td.num { font-variant-numeric: tabular-nums; }
table.trains.edit td { padding: .3rem .35rem; }
table.trains.edit input[type="time"] { min-width: 6.5rem; padding: .3rem .4rem; }
table.trains.edit select { padding: .3rem .4rem; min-width: 5.5rem; }
td.description .sub { display: block; margin-top: .25rem; color: var(--muted); font-size: .9em; }
.section-title { margin: 1rem 0 .5rem; }

/* --- Published timetable tables: stations as rows, a column per train ----------------------------- */
table.timetable-grid { width: auto; min-width: 18rem; margin: 0 1.5rem 1rem 0; }
.timetable-grid caption { text-align: left; font-weight: 500; color: #4a5263; padding: .25rem 0 .4rem; }
.timetable-grid th, .timetable-grid td { padding: .35rem .8rem; text-align: center; font-variant-numeric: tabular-nums; }
.timetable-grid tbody th { text-align: left; font-weight: 400; color: var(--text); white-space: nowrap; }
.timetable-grid tbody th .sub { color: var(--muted); font-size: .85em; }
.timetable-grid .traction-steam { font-weight: 600; color: #8a1f1f; }
.timetable-grid tbody tr:nth-child(even) { background: none; }
#trains, .timetable { display: block; }
#trains .table-wrap, .timetable .table-wrap { display: inline-block; vertical-align: top; max-width: 100%; }
.timetable-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.timetable-head .row-actions { margin-left: auto; }
.card.timetable.inactive { opacity: .7; }
table.trains.edit tr.group th { text-align: center; color: #4a5263; border-bottom: 0; padding-bottom: 0; }

/* --- Logged-in person in the sidebar (login pages: scm-auth's auth.css) ------------------------- */
