* { box-sizing: border-box; }
body {
    font-family: -apple-system, Segoe UI, Roboto, sans-serif;
    margin: 0;
    color: #1a1a1a;
    background: #fafafa;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #1f2937;
    color: #fff;
}
.topbar a { color: #fff; text-decoration: none; margin-right: 16px; }
.topbar .brand { font-weight: bold; font-size: 1.2em; }
.topbar nav .muted { color: #cbd5e1; margin-right: 16px; }
.organization-nav {
    background: #0b1120;
    color: #fff;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.organization-nav-title a { color: #fff; font-weight: 600; text-decoration: none; }
.organization-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.organization-tabs a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9em;
}
.organization-tabs a:hover { background: #1f2937; color: #fff; }
.organization-tabs a.active { background: #2563eb; color: #fff; }

.event-nav {
    background: #111827;
    color: #fff;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.event-nav-title a { color: #fff; font-weight: 600; text-decoration: none; }
.event-nav-title .muted { color: #9ca3af; margin-left: 8px; font-weight: normal; }
.event-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.event-tabs a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9em;
}
.event-tabs a:hover { background: #1f2937; color: #fff; }
.event-tabs a.active { background: #2563eb; color: #fff; }

.performer-nav {
    background: #f3f4f6;
    color: #111827;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
}
.performer-nav-title a { color: #111827; font-weight: 600; text-decoration: none; }
.performer-nav-title .muted { color: #6b7280; margin-left: 8px; font-weight: normal; }
.performer-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.performer-tabs a {
    color: #374151;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9em;
}
.performer-tabs a:hover { background: #e5e7eb; }
.performer-tabs a.active { background: #2563eb; color: #fff; }

.container { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.container.container-wide { max-width: 1500px; }

h1, h2, h3 { margin-top: 0; }
section { margin-top: 32px; }

.page-header, .section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.muted { color: #666; }

.filter-bar {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 12px;
}
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-weight: 600; color: #555; margin-right: 4px; }
.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.9em;
    cursor: pointer;
}
.checkbox-pill input { width: auto; margin: 0; }

.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.day-tabs a {
    padding: 6px 14px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.9em;
}
.day-tabs a:hover { background: #e5e7eb; }
.day-tabs a.active { background: #2563eb; color: #fff; }

.grid-wrapper { overflow-x: auto; margin-top: 8px; margin-bottom: 24px; }
.schedule-grid { border-collapse: collapse; width: 100%; min-width: 480px; }
.schedule-grid th, .schedule-grid td {
    border: 1px solid #e2e2e2;
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}
.schedule-grid thead th { background: #f3f4f6; }
.schedule-grid .time-col, .schedule-grid .time-col-header {
    white-space: nowrap;
    background: #f9fafb;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.schedule-grid td.grid-busy { background: #dbeafe; }
.schedule-grid td.grid-idle { background: #fff; }
.schedule-grid .phase-label { display: block; color: #555; font-size: 0.85em; }

/* DayPilot Calendar (Resources view): stages render as columns, one
   event per phase per performance, colored via DayPilot's own
   backColor/barColor/fontColor EventData fields (festival/views.py,
   PHASE_STYLES) rather than CSS -- DayPilot renders an event as an outer
   box plus a separate accent-bar element, and only those fields reliably
   reach both. Shaded cells (onBeforeCellRender, timeline.js) span each
   performance's load-in-to-load-out range so it's clear why a slot is
   unavailable even when only e.g. the Show block is visible. */
#visualization { margin-top: 8px; margin-bottom: 32px; }
/* Load-in/load-out are only a 15-min synthetic block (~15px tall at this
   view's scale) -- too short to show their label at all. min-height only
   raises the *visual* box for short events; it doesn't touch the
   underlying time data DayPilot positions everything from. */
.calendar_default_event { min-height: 32px; }
.calendar_default_event_inner { white-space: normal; line-height: 1.25; }
.occupied-band {
    background: repeating-linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.04),
        rgba(0, 0, 0, 0.04) 6px,
        rgba(0, 0, 0, 0.08) 6px,
        rgba(0, 0, 0, 0.08) 12px
    ) !important;
}

.table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid #e2e2e2; }

.kv-table th { text-align: left; padding: 4px 12px 4px 0; color: #555; vertical-align: top; }
.kv-table td { padding: 4px 0; }

.card { border: 1px solid #e2e2e2; border-radius: 6px; padding: 12px 16px; margin-bottom: 12px; background: #fff; }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.stat-card {
    flex: 1;
    min-width: 160px;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 12px 16px;
    background: #fff;
    color: #1a1a1a;
    text-decoration: none;
}
.stat-card:hover { border-color: #2563eb; }
.stat-card strong { font-size: 1.4em; color: #2563eb; }

.tight-list { margin: 4px 0; padding-left: 20px; }

.button, button {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95em;
}
.button:hover, button:hover { background: #1d4ed8; }

.link-button {
    background: none;
    border: none;
    color: #2563eb;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
}

.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.stacked-form p, .stacked-form > div { margin-bottom: 12px; }
.stacked-form input, .stacked-form textarea, .stacked-form select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.stacked-form label { display: block; font-weight: 600; margin-bottom: 4px; }

.actions { display: flex; gap: 10px; margin-top: 16px; }

dialog#performance-edit-modal {
    border: none;
    border-radius: 6px;
    padding: 20px;
    width: min(480px, 90vw);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
dialog#performance-edit-modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
}
dialog#performance-edit-modal h2 { margin-top: 0; }

.messages { list-style: none; padding: 0; }
.message { padding: 8px 12px; border-radius: 4px; margin-bottom: 8px; }
.message.success { background: #dcfce7; color: #166534; }
.message.error { background: #fee2e2; color: #991b1b; }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 0.85em; }
.badge.draft { background: #fef3c7; color: #92400e; }
.badge.sent { background: #dcfce7; color: #166534; }

.email-log { background: #111827; color: #d1fae5; padding: 12px; border-radius: 6px; white-space: pre-wrap; }

.preformatted { background: #f3f4f6; padding: 12px; border-radius: 6px; white-space: pre-wrap; font-family: inherit; }
