:root {
  --bg: #0c0c10;
  --bg-elev: #17161d;
  --bg-elev-2: #201f29;
  --text: #e8e6f0;
  --text-dim: #8b8896;
  --primary: #7c5ce7;
  --must: #a855f7;
  --danger: #e8425f;
  --ok: #3ddc97;
  --border: #2c2a36;
  --radius: 10px;
  --gap: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

/* ---------- Header / tabs ---------- */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
}

.app-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.app-title-row h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.5px;
}

.app-title-row .icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  padding: 4px 8px;
}

.day-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-tabs button {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 4px;
  font-size: 13px;
  white-space: nowrap;
}

.day-tabs button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

.view-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 0;
}

.view-tabs button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  padding: 4px 10px;
  border-bottom: 2px solid transparent;
}

.view-tabs button.active {
  color: var(--text);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ---------- Main / schedule ---------- */
main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 24px;
}

.stage-headers {
  display: grid;
  grid-template-columns: 44px repeat(4, 1fr);
  gap: var(--gap);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  padding: 4px 0;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 44px repeat(4, 1fr);
  gap: var(--gap);
  position: relative;
}

.time-col {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  color: var(--text-dim);
}

.time-slot {
  height: 26px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 4px;
}

.stage-col {
  position: relative;
}

.act-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 8px;
  padding: 6px;
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  text-align: left;
}

.act-block .act-name {
  display: block;
  font-weight: 500;
  color: var(--text);
  white-space: normal;
}

.act-block .act-time {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  margin-top: 2px;
}

.act-block.status-none {
  border-style: dashed;
  opacity: 0.7;
}

.act-block.status-nice {
  background: linear-gradient(135deg, rgba(124,92,231,0.25), rgba(168,85,247,0.18));
  border-color: rgba(124,92,231,0.5);
  color: var(--text);
}

.act-block.status-must {
  background: linear-gradient(135deg, rgba(168,85,247,0.55), rgba(124,92,231,0.4));
  border-color: var(--must);
  color: white;
}

.act-block.status-must .act-name {
  font-weight: 700;
}

.act-block.conflict {
  border: 2px solid var(--danger);
  box-shadow: 0 0 0 1px var(--danger) inset;
}

.act-block .conflict-flag {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 12px;
}

.other-status-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  background: rgba(0,0,0,0.4);
  border-radius: 6px;
  padding: 1px 4px;
  line-height: 1.4;
}

/* ---------- Detail panel ---------- */
.detail-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 50;
  max-height: 75vh;
  overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
}

.detail-panel.open {
  transform: translateY(0);
}

.detail-panel .drag-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 12px;
}

.detail-panel h2 {
  margin: 0 0 2px;
  font-size: 18px;
}

.detail-panel .meta {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
}

.status-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.status-buttons button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.status-buttons button.active.status-none { border-color: var(--text-dim); }
.status-buttons button.active.status-nice { background: var(--primary); border-color: var(--primary); }
.status-buttons button.active.status-must { background: var(--must); border-color: var(--must); color: #fff; }

.other-status-line {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.conflict-warning {
  background: rgba(232,66,95,0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 12px;
}

.setlist-section h3 {
  font-size: 14px;
  margin: 14px 0 6px;
}

.setlist-section ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
}

.setlist-section li {
  margin-bottom: 3px;
}

.setlist-source {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

.setlist-empty {
  font-size: 12px;
  color: var(--text-dim);
}

.close-panel-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
}

/* ---------- Favorites timeline ---------- */
.day-section-title {
  font-size: 12px;
  color: var(--text-dim);
  margin: 18px 0 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fav-timeline {
  display: flex;
  flex-direction: column;
}

/* Act-kaart */
.fav-card {
  display: flex;
  gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}

.fav-card.status-nice {
  background: linear-gradient(135deg, rgba(124,92,231,0.2), rgba(168,85,247,0.12));
  border-color: rgba(124,92,231,0.45);
}

.fav-card.status-must {
  background: linear-gradient(135deg, rgba(168,85,247,0.45), rgba(124,92,231,0.3));
  border-color: var(--must);
}

.fav-card.conflict {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger) inset;
}

.fav-card-time {
  min-width: 38px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding-top: 2px;
  color: var(--text);
}

.fav-card-end {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 11px;
}

.fav-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fav-card-name {
  font-size: 14px;
  font-weight: 600;
}

.fav-card-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.fav-card-statuses {
  display: flex;
  gap: 5px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* Gapindicator tussen acts */
.fav-gap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  margin: 2px 0;
}

.fav-gap-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.fav-gap-label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.fav-gap-tight .fav-gap-label  { color: #f0a030; }
.fav-gap-overlap .fav-gap-label { color: var(--danger); font-weight: 600; }
.fav-gap-tight  .fav-gap-line  { background: #f0a030; }
.fav-gap-overlap .fav-gap-line  { background: var(--danger); }

.status-pill {
  display: inline-block;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 10px;
}
.status-pill.status-none { background: var(--bg-elev-2); color: var(--text-dim); }
.status-pill.status-nice { background: var(--primary); color: #fff; }
.status-pill.status-must { background: var(--must); color: #fff; }



/* ---------- Modals (identity / settings / install) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box h2 {
  margin-top: 0;
  font-size: 17px;
}

.modal-box label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 4px;
}

.modal-box input, .modal-box select {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
}

.modal-box .btn-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal-box .btn-row button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 13px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border) !important; }

.identity-choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.identity-choice-buttons button {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.install-instructions {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}

.install-instructions b { color: var(--text); }

.settings-section h3 {
  font-size: 13px;
  margin: 16px 0 4px;
  color: var(--primary);
}

.walk-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin: 6px 0;
}

.walk-time-row input {
  width: 64px;
  text-align: center;
}

.hidden { display: none !important; }
