:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #13283f;
  --muted: #59708b;
  --primary: #003f7f;
  --primary-2: #0f5da6;
  --accent: #ff6a00;
  --accent-2: #e45d00;
  --border: #d2ddea;
  --ok: #1f8a45;
  --warn: #b26700;
  --error: #b02323;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Söhne", "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: 14px;
}

.container { max-width: none; margin: 0 auto; padding: 0.5rem 0.65rem; }
.topbar {
  background: #043b74;
  border-bottom: 3px solid var(--accent);
}
.nav-wrap { display: flex; justify-content: space-between; align-items: center; }
.brand { color: #ffffff; font-weight: 800; text-decoration: none; letter-spacing: 0.2px; font-size: 15px; }
nav a { color: #e9f2ff; margin-left: 1rem; text-decoration: none; font-weight: 600; font-size: 13px; }
nav a:hover { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }

h1 { margin-top: 0; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.6rem;
  box-shadow: none;
}
.narrow { max-width: 440px; margin: 2rem auto; }

.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.meta { color: var(--muted); }
.tabs { display: flex; gap: 0.5rem; margin: 0.8rem 0; }
.stats-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.55rem; }
.pill {
  display: inline-block;
  border-radius: 0;
  padding: 0.2rem 0.5rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.pill-ok { background: #d9f4de; color: #1f6a2f; border: 1px solid #aeddb8; }
.pill-warn { background: #fde7ba; color: #805d12; border: 1px solid #eac77c; }
.tab {
  border: 1px solid var(--border);
  background: #f9fbfe;
  color: #294665;
  text-decoration: none;
  padding: 0.36rem 0.62rem;
  border-radius: 0;
  font-weight: 600;
}
.tab.active {
  background: #ebf3ff;
  border-color: #8fb4de;
  color: #003f7f;
  font-weight: 700;
}
.tabs button.tab {
  border: 1px solid var(--border);
  background: #f9fbfe;
  color: #294665;
  cursor: pointer;
}
.tabs button.tab:hover {
  background: #ebf3ff;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem;
  text-align: left;
  vertical-align: top;
}
th {
  color: #294665;
  font-weight: 700;
  background: #f8fbff;
}

.form-grid { display: grid; gap: 0.55rem; }
.form-inline { margin-bottom: 0.6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
label { display: grid; gap: 0.35rem; font-weight: 600; }
input, textarea, select, button {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #6e9fd5;
  box-shadow: 0 0 0 3px rgba(15, 93, 166, 0.15);
}
textarea { width: 100%; resize: vertical; }
button, .button-link {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 0.45rem 0.74rem;
  border-radius: 0;
  display: inline-block;
  font-weight: 700;
  transition: background-color 120ms ease;
}
button:hover, .button-link:hover {
  background: var(--accent-2);
}
.button-row { margin-top: 0.55rem; display: flex; gap: 0.5rem; }

.status { padding: 0.2rem 0.55rem; border-radius: 0; font-size: 0.84rem; font-weight: 700; }
.status-concept { background: #fff0d8; color: var(--warn); border: 1px solid #f1ca8f; }
.status-published { background: #ddf5e3; color: var(--ok); border: 1px solid #b8e2c4; }

.flash-list { margin-bottom: 1rem; }
.flash { padding: 0.7rem; border-radius: 8px; margin-bottom: 0.5rem; }
.flash-success { background: #ddf5e3; color: var(--ok); border: 1px solid #b8e2c4; }
.flash-error { background: #fce1e1; color: var(--error); border: 1px solid #edbcbc; }

.mobile-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem; }
.day-card { background: #ffffff; border: 1px solid #c9d9ed; border-radius: 0; padding: 0.75rem; }
.day-card h3 { margin: 0 0 0.5rem; }
.daytype-subtle {
  margin: -0.25rem 0 0.45rem;
  color: var(--muted);
  font-size: 12px;
}
.crew-lines {
  display: grid;
  gap: 0.25rem;
}
.crew-lines p {
  margin: 0;
}
.agenda-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
.agenda-link:hover {
  color: var(--primary-2);
}
.staffing-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 0;
}
.staffing-danger { background: #f7dddd; color: #8f1f1f; border: 1px solid #e5b7b7; }
.staffing-warning { background: #fde7ba; color: #8e6615; border: 1px solid #eac77c; }
.staffing-ok { background: #d9f4de; color: #2a7a3b; border: 1px solid #aeddb8; }

.roster-editor {
  padding: 0.2rem;
}
.roster-table {
  width: 100%;
  table-layout: fixed;
}
.roster-table th,
.roster-table td {
  padding: 0.22rem 0.28rem;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
}
.roster-table select,
.roster-table input,
.roster-table textarea {
  font-size: 12px;
  padding: 0.2rem 0.35rem;
  width: 100%;
  min-width: 0;
}
.roster-table textarea {
  min-height: 30px;
  max-height: 64px;
}
.roster-table th:nth-child(1), .roster-table td:nth-child(1) { width: 78px; }
.roster-table th:nth-child(2), .roster-table td:nth-child(2) { width: 96px; }
.roster-table th:nth-child(3), .roster-table td:nth-child(3) { width: 21.5%; }
.roster-table th:nth-child(4), .roster-table td:nth-child(4) { width: 21.5%; }
.roster-table th:nth-child(5), .roster-table td:nth-child(5) { width: 21.5%; }
.roster-table th:nth-child(6), .roster-table td:nth-child(6) { width: 21.5%; }
.roster-table tbody tr.day-group-a td { background: #ffffff; }
.roster-table tbody tr.day-group-b td { background: #f8fbff; }
.roster-table tbody tr.day-gap-before td { border-top: 2px solid #b8cce2; }

.secondary-btn { background: #edf4fe; color: #123a6b; border: 1px solid #b4c9e4; }
.secondary-btn:hover { background: #dfeefe; }
.parts-block {
  margin-top: 3px;
  display: grid;
  gap: 2px;
}
.role-cell { display: grid; gap: 2px; }
.primary-inline { display: grid; grid-template-columns: 1fr 24px; gap: 2px; align-items: center; }
.split-toggle {
  padding: 0;
  min-height: 22px;
  min-width: 22px;
  font-size: 12px;
  line-height: 1;
}
.split-controls {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}
.split-add,
.split-remove {
  min-width: 22px;
  padding: 0;
  min-height: 18px;
  font-size: 13px;
  line-height: 1;
}
.part-row {
  display: grid;
  grid-template-columns: 1fr 48px 48px;
  gap: 2px;
}
.role-indicator {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 3px;
  border: 1px solid transparent;
}
.role-indicator-ok {
  background: #ddf5e3;
  border-color: #b8e2c4;
  color: #1f8a45;
}
.role-indicator-partial {
  background: #fff0d8;
  border-color: #f1ca8f;
  color: #b26700;
}
.role-indicator-warn {
  background: #fce1e1;
  border-color: #edbcbc;
  color: #b02323;
}
.role-indicator-empty {
  background: #f3f6fa;
  border-color: #d2ddea;
  color: #59708b;
}
.hidden { display: none !important; }
.day-cell {
  min-width: 170px;
}
.dayinfo-inline {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.dayinfo-inline-text {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.dayinfo-icon {
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 36, 52, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal-backdrop.hidden {
  display: none;
}
.modal-card {
  width: min(560px, 92vw);
  background: #fff;
  border: 1px solid #aec5e1;
  border-radius: 0;
  padding: 0.7rem;
  display: grid;
  gap: 0.5rem;
  box-shadow: none;
}
.sync-block {
  border: 1px solid var(--border);
  padding: 0.35rem 0.45rem;
  margin-bottom: 0.45rem;
}
.sync-block summary {
  cursor: pointer;
  font-weight: 700;
  color: #1b3858;
  margin-bottom: 0.35rem;
}
.pagination-row {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (max-width: 780px) {
  .title-row { flex-direction: column; align-items: flex-start; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .grid-2 { grid-template-columns: 1fr; }
  nav a { margin-left: 0.6rem; }
}
