:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef4f3;
  --ink: #0a1718;
  --muted: #647172;
  --line: #d9e4e2;
  --line-strong: #b9c9c6;
  --dark: #071314;
  --teal: #0c8f87;
  --teal-dark: #06635f;
  --teal-soft: #dff5f2;
  --amber: #a96d0d;
  --amber-soft: #fff3d3;
  --coral: #b74848;
  --coral-soft: #fde9e7;
  --blue: #356aa0;
  --blue-soft: #e8f1fb;
  --shadow: 0 16px 40px rgba(7, 19, 20, .08);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: var(--font); letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(12, 143, 135, .24); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr); align-items: center; gap: 18px; min-height: 72px; padding: 10px clamp(16px, 4vw, 46px); border-bottom: 1px solid rgba(217, 228, 226, .9); background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: var(--radius); color: #fff; background: var(--dark); font-size: 13px; font-weight: 850; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; line-height: 1.1; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.main-nav { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.nav-tab { min-height: 36px; padding: 0 15px; border: 0; border-radius: 6px; color: #485657; background: transparent; font-size: 13px; font-weight: 750; }
.nav-tab.is-active { color: var(--ink); background: #fff; box-shadow: 0 5px 14px rgba(7, 19, 20, .08); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.sync-state { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; color: #4b5a5a; font-size: 12px; font-weight: 750; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.sync-state.is-syncing .sync-dot { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); animation: pulse 1s infinite; }
.sync-state.is-error .sync-dot { background: var(--coral); box-shadow: 0 0 0 4px var(--coral-soft); }
main { padding: 28px clamp(16px, 4vw, 46px) 54px; }

.icon-button { display: inline-grid; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: #344344; background: #fff; }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.icon-button svg, button svg { width: 17px; height: 17px; stroke-width: 2; }
.primary-button, .secondary-button, .ghost-button, .danger-ghost { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 7px; font-size: 13px; font-weight: 800; text-decoration: none; }
.primary-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.primary-button:hover { background: var(--teal-dark); }
.secondary-button { border: 1px solid var(--line-strong); color: var(--ink); background: #fff; }
.secondary-button:hover, .ghost-button:hover { background: var(--surface-soft); }
.ghost-button { border: 1px solid transparent; color: #334344; background: transparent; }
.danger-ghost { border: 1px solid #efc6c2; color: var(--coral); background: #fff; }
.full-button { width: 100%; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--teal-dark); font-size: 11px; font-weight: 850; text-transform: uppercase; }

.setup-view { max-width: 1480px; margin: 0 auto; }
.setup-heading { max-width: 780px; margin-bottom: 26px; }
.setup-heading h1 { max-width: 720px; margin: 0; font-size: 38px; line-height: 1.08; }
.setup-heading p { max-width: 690px; margin: 13px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.template-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); gap: 22px; align-items: start; }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.template-card { position: relative; overflow: hidden; min-height: 214px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); text-align: left; background: #fff; box-shadow: 0 8px 24px rgba(7, 19, 20, .04); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.template-card:hover { border-color: #91b8b4; box-shadow: 0 14px 30px rgba(7, 19, 20, .09); transform: translateY(-2px); }
.template-card.is-selected { border: 2px solid var(--teal); box-shadow: 0 0 0 3px var(--teal-soft), var(--shadow); }
.template-photo { display: block; width: 100%; height: 132px; object-fit: cover; background: var(--surface-soft); }
.template-card-copy { display: block; padding: 13px 14px 14px; }
.template-card-copy strong { display: block; font-size: 16px; }
.template-card-copy small { display: block; min-height: 34px; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.template-check { position: absolute; top: 10px; right: 10px; display: none; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: var(--teal); }
.template-check svg { width: 15px; }
.template-card.is-selected .template-check { display: grid; }
.template-preview { position: sticky; top: 100px; overflow: hidden; min-height: 376px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.preview-empty { display: grid; min-height: 376px; padding: 34px; place-items: center; align-content: center; gap: 12px; color: var(--muted); text-align: center; }
.preview-empty svg { width: 34px; height: 34px; color: var(--teal); }
.preview-empty strong { color: var(--ink); }
.preview-head { padding: 21px 22px 18px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.preview-head h2 { margin: 0; font-size: 20px; }
.preview-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.preview-stats { display: flex; gap: 8px; margin-top: 13px; }
.preview-stats span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; color: #435253; background: #fff; font-size: 11px; font-weight: 800; }
.preview-sections { max-height: 420px; overflow: auto; padding: 10px 22px 18px; }
.preview-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.preview-section:last-child { border: 0; }
.preview-section strong { font-size: 13px; }
.preview-section ol { margin: 7px 0 0; padding-left: 21px; color: var(--muted); font-size: 12px; line-height: 1.7; }

.creation-panel { margin-top: 22px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.creation-title { display: flex; align-items: start; justify-content: space-between; margin-bottom: 20px; }
.creation-title h2 { margin: 0; font-size: 22px; }
.free-badge { padding: 6px 9px; border-radius: 5px; color: var(--teal-dark); background: var(--teal-soft); font-size: 12px; font-weight: 850; }
.account-gate { display: flex; align-items: center; gap: 12px; margin: -3px 0 18px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.account-gate-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 7px; color: var(--teal-dark); background: #fff; }
.account-gate-icon svg { width: 19px; height: 19px; }
.account-gate-copy { min-width: 0; flex: 1; }
.account-gate-copy strong, .account-gate-copy small { display: block; }
.account-gate-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-gate-copy small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; color: #3f4e4f; font-size: 12px; font-weight: 800; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: #fff; font-size: 14px; font-weight: 500; }
.field textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.form-footer { display: flex; min-height: 52px; align-items: end; justify-content: space-between; gap: 20px; margin-top: 15px; border-top: 1px solid var(--line); padding-top: 15px; }
.form-footer p { margin: 0; color: var(--coral); font-size: 13px; }
.form-submit-actions { display: flex; gap: 8px; }
.workspace { max-width: 1540px; margin: 0 auto; }
.event-band { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 19px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 9px 30px rgba(7, 19, 20, .05); }
.event-heading { display: flex; min-width: 0; align-items: center; gap: 20px; }
.event-type-button { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.event-type-button > span:nth-child(2) { min-width: 0; }
.event-type-button small, .event-type-button strong { display: block; }
.event-type-button small { color: var(--teal-dark); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.event-type-button strong { overflow: hidden; max-width: 480px; margin-top: 3px; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.event-type-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 7px; color: #fff; background: var(--dark); }
.event-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; color: #526061; background: var(--surface-soft); font-size: 11px; font-weight: 750; }
.meta-pill svg { width: 14px; height: 14px; }
.event-actions { display: flex; gap: 8px; }
.event-delete { color: var(--muted); }
.event-delete:hover { border-color: #e3a5a0; color: var(--coral); background: #fff7f6; }
.workspace-grid { display: grid; min-width: 0; grid-template-columns: 220px minmax(0, 1fr); gap: 26px; align-items: start; margin-top: 22px; }
.section-rail { position: sticky; top: 94px; min-width: 0; width: 100%; max-width: 100%; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.rail-heading span { color: var(--muted); font-weight: 750; }
.rail-heading strong { font-size: 11px; }
.section-rail nav { display: grid; min-width: 0; gap: 3px; padding: 10px 0; }
.section-link { display: grid; width: 100%; min-width: 0; max-width: 100%; min-height: 38px; overflow: hidden; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 8px; padding: 0 7px 0 9px; border: 0; border-radius: 6px; color: #425151; background: transparent; font-size: 12px; font-weight: 750; text-align: left; }
.section-link:hover, .section-link.is-active { color: var(--teal-dark); background: var(--teal-soft); }
.section-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-link small { display: inline-grid; width: 24px; height: 24px; justify-self: end; place-items: center; border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: 10px; font-weight: 850; }
.section-link:hover small, .section-link.is-active small { color: var(--teal-dark); background: #fff; }
.timeline-area { min-width: 0; }
.timeline-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 14px 52px; }
.timeline-heading h2 { margin: 0; font-size: 25px; }
.timeline-tools { display: flex; gap: 8px; }
.search-box { display: flex; width: 270px; height: 38px; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.search-box svg { width: 15px; color: var(--muted); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; font-size: 13px; }
.timeline-list { display: grid; gap: 22px; }
.section-block { scroll-margin-top: 96px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 46px; margin: 0 0 8px 52px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.section-heading h3 { margin: 0; font-size: 15px; }
.section-heading span { color: var(--muted); font-size: 11px; }
.section-actions { display: flex; gap: 5px; }
.section-actions .icon-button { width: 32px; height: 32px; }
.stage-stack { display: grid; }
.stage-card { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; min-height: 78px; margin-left: 52px; border: 1px solid var(--line); border-bottom: 0; background: #fff; }
.stage-card:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.stage-card:last-child { border-bottom: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.stage-card:only-child { border-bottom: 1px solid var(--line); border-radius: var(--radius); }
.stage-card.is-open { z-index: 2; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.stage-card.is-dragging { opacity: .45; }
.stage-card.is-drop-target { box-shadow: inset 0 3px 0 var(--teal); }
.stage-connector { position: absolute; left: -38px; top: 0; bottom: -1px; width: 22px; }
.stage-connector::before { content: ""; position: absolute; left: 10px; top: -1px; bottom: -1px; width: 2px; background: #a9c9c5; }
.stage-card:last-child .stage-connector::before { bottom: 38px; }
.stage-connector span { position: absolute; top: 31px; left: 4px; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 1px #85aaa6; }
.drag-handle { display: grid; width: 38px; height: 46px; grid-column: 1; padding: 0; place-items: center; border: 0; color: #8a9797; background: transparent; touch-action: none; }
.drag-handle svg { width: 16px; }
.stage-main { display: grid; width: 100%; grid-column: 2; grid-template-columns: 62px minmax(0, 1fr) auto 22px; align-items: center; gap: 13px; min-width: 0; min-height: 76px; padding: 10px 12px 10px 2px; border: 0; color: inherit; background: transparent; text-align: left; }
.stage-time { display: grid; min-height: 34px; place-items: center; border-radius: 5px; color: var(--teal-dark); background: var(--teal-soft); font-size: 12px; font-weight: 850; }
.stage-time.is-empty { color: var(--muted); background: var(--surface-soft); }
.stage-copy { min-width: 0; }
.stage-copy small, .stage-copy strong, .stage-copy > span { display: block; }
.stage-section { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.stage-title { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.stage-song { overflow: hidden; margin-top: 4px; color: #5c6a6b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stage-song.is-empty { color: #9aa5a5; font-style: italic; }
.priority-chip { padding: 5px 8px; border-radius: 5px; font-size: 10px; font-weight: 850; text-transform: uppercase; white-space: nowrap; }
.priority-chip.required { color: #8f2929; background: var(--coral-soft); }
.priority-chip.preferred { color: var(--teal-dark); background: var(--teal-soft); }
.priority-chip.suggestion { color: #6e521d; background: var(--amber-soft); }
.stage-chevron { color: var(--muted); transition: transform .2s; }
.stage-card.is-open .stage-chevron { transform: rotate(180deg); }
.stage-quick-actions { display: flex; grid-column: 3; gap: 4px; padding-right: 10px; }
.stage-quick-actions .icon-button { width: 32px; height: 32px; border-color: transparent; color: var(--muted); }
.stage-quick-actions .delete-stage:hover { color: var(--coral); background: var(--coral-soft); }
.stage-card.is-readonly { grid-template-columns: minmax(0, 1fr); }
.stage-card.is-readonly .stage-main { grid-column: 1; padding-left: 12px; }
.stage-editor { display: none; grid-column: 1 / -1; padding: 20px; border-top: 1px solid var(--line); background: #fbfcfc; }
.stage-card.is-open .stage-editor { display: block; }
.editor-grid { display: grid; grid-template-columns: 176px minmax(180px, 1fr) minmax(180px, 1fr); gap: 13px; }
.editor-grid .wide { grid-column: span 2; }
.stage-time-field { align-content: start; }
.stage-time-control { display: grid; width: fit-content; grid-template-columns: 48px 10px 48px 34px; align-items: center; gap: 4px; }
.field .stage-time-control input { min-height: 42px; padding: 8px 5px; font-variant-numeric: tabular-nums; font-weight: 750; text-align: center; }
.stage-time-control b { color: var(--muted); font-size: 17px; text-align: center; }
.stage-time-clear { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: #fff; }
.stage-time-clear:hover { color: var(--coral); border-color: #e3a5a0; background: var(--coral-soft); }
.stage-time-clear svg { width: 15px; height: 15px; }
.stage-time-control.is-invalid input { border-color: #d96961; background: #fff8f7; }
.field-error { color: #a33d36; font-size: 10px; font-weight: 700; line-height: 1.35; }
.song-editor { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(130px, 1fr) minmax(170px, 1.2fr) 90px; gap: 10px; margin-top: 17px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.song-editor h4 { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin: 0 0 2px; font-size: 13px; }
.song-editor .remove-song { min-height: 30px; padding: 0 8px; }
.song-heading-actions { display: flex; align-items: center; gap: 7px; }
.song-editor .resolve-song { min-height: 30px; padding: 0 9px; font-size: 11px; }
.music-resolution { grid-column: 1 / -1; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 9px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--ink); }
.music-resolution > svg { width: 18px; color: var(--teal); }
.music-resolution strong, .music-resolution small { display: block; }
.music-resolution strong { font-size: 12px; }
.music-resolution small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.provider-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.provider-chip { padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: #f7faf9; font-size: 9px; font-weight: 800; }
.editor-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; }
.editor-section-title h4 { margin: 0; font-size: 13px; }
.comments { display: grid; gap: 8px; margin-top: 10px; }
.comment { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 10px 12px; border-left: 3px solid #8ebcb7; background: #fff; }
.comment strong { font-size: 11px; }
.comment time { color: var(--muted); font-size: 10px; }
.comment p { grid-column: 1 / -1; margin: 0; color: #485657; font-size: 12px; line-height: 1.5; }
.comment-form { display: flex; gap: 8px; margin-top: 9px; }
.comment-form input { min-width: 0; height: 38px; flex: 1; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; }
.readonly-note { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.readonly-note svg { width: 15px; }
.empty-timeline { display: grid; min-height: 260px; place-items: center; align-content: center; gap: 11px; margin-left: 52px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); background: #fff; text-align: center; }

.modal { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: var(--radius); color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(7, 19, 20, .28); }
.modal::backdrop { background: rgba(3, 12, 13, .58); backdrop-filter: blur(3px); }
.modal-wide { width: min(850px, calc(100vw - 28px)); }
.modal-frame { margin: 0; padding: 24px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 23px; }
.modal-intro { margin: 17px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-actions .danger-ghost { margin-right: auto; }
.conflict-modal { width: min(620px, calc(100vw - 28px)); }
.conflict-revisions { display: grid; grid-template-columns: minmax(0,1fr) 34px minmax(0,1fr); align-items: center; gap: 12px; margin: 18px 0; }
.conflict-revisions > div { display: grid; min-height: 108px; align-content: center; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #f5f8f7; }
.conflict-revisions > svg { width: 22px; color: var(--teal-dark); }
.conflict-revisions small { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.conflict-revisions strong { font-size: 17px; }
.conflict-revisions span, .conflict-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.conflict-note { margin: 0; }
.share-link-box { display: flex; align-items: end; gap: 8px; }
.share-link-box .field { min-width: 0; flex: 1; }
.share-status { min-height: 24px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.active-share-links { display: grid; max-height: 190px; gap: 0; margin-top: 10px; overflow: auto; border-block: 1px solid var(--line); }
.active-share-head, .active-share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.active-share-head { min-height: 34px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.active-share-head span { min-width: 24px; padding: 3px 7px; border-radius: 4px; color: var(--ink); background: var(--surface-soft); text-align: center; }
.active-share-row { min-height: 50px; padding: 7px 4px 7px 8px; border-top: 1px solid var(--line); }
.active-share-row.is-current { box-shadow: inset 3px 0 0 var(--teal); }
.active-share-row > span { min-width: 0; }
.active-share-row strong, .active-share-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-share-row strong { font-size: 11px; }
.active-share-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.active-share-row .icon-button { flex: 0 0 auto; width: 34px; height: 34px; color: var(--muted); }
.active-share-row .icon-button:hover { color: var(--coral); border-color: #e3a5a0; background: var(--coral-soft); }
.share-access-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.share-access-option { display: grid; min-width: 0; min-height: 70px; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; text-align: left; }
.share-access-option:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.share-access-option.is-active { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.share-access-option > svg { width: 19px; }
.share-access-option strong, .share-access-option small { display: block; }
.share-access-option strong { font-size: 12px; }
.share-access-option small { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.share-access-copy { min-height: 38px; margin: 11px 0 13px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.compact-template-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.compact-template { min-height: 74px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; color: inherit; background: #fff; text-align: left; }
.compact-template strong, .compact-template small { display: block; }
.compact-template small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.compact-template.is-selected { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); }
.change-choice { margin-top: 20px; }
.change-choice h3 { margin: 0 0 10px; font-size: 14px; }
.choice-option { display: flex; align-items: start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; }
.choice-option + .choice-option { margin-top: 8px; }
.choice-option input { margin-top: 3px; accent-color: var(--teal); }
.choice-option strong, .choice-option small { display: block; }
.choice-option strong { font-size: 13px; }
.choice-option small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.danger-choice:has(input:checked) { border-color: #e3a5a0; background: #fff7f6; }
#summary-modal { width: min(1040px, calc(100vw - 28px)); overflow: hidden; }
.summary-frame { width: 100%; max-height: calc(100vh - 30px); overflow: auto; }
.summary-sync-proof { display: flex; min-height: 52px; align-items: center; gap: 11px; margin: 2px 0 8px; padding: 10px 12px; border: 1px solid #b8d8d2; border-radius: 6px; color: #235e56; background: #f1faf8; }
.summary-sync-proof > svg { width: 21px; height: 21px; flex: 0 0 auto; }
.summary-sync-proof strong, .summary-sync-proof small { display: block; }
.summary-sync-proof strong { font-size: 12px; }
.summary-sync-proof small { margin-top: 3px; color: #58736f; font-size: 10px; }
.summary-document { color: #172220; background: #fff; }
.summary-print-header { padding: 22px 0 18px; border-bottom: 2px solid #183c38; }
.summary-brand { display: flex; align-items: center; gap: 10px; }
.summary-brand > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 5px; color: #fff; background: #102b28; font-size: 11px; font-weight: 900; }
.summary-brand strong, .summary-brand small { display: block; }
.summary-brand strong { font-size: 14px; }
.summary-brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.summary-event-type { margin-top: 24px; color: var(--teal-dark); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.summary-print-header h1 { margin: 5px 0 14px; font-size: 25px; line-height: 1.12; }
.summary-event-meta { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(220px, 1.4fr) minmax(80px, .4fr); gap: 10px; }
.summary-event-meta span { padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; }
.summary-event-meta b { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.summary-section { padding: 16px 0 8px; border-bottom: 1px solid var(--line); }
.summary-section-head { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 9px; margin-bottom: 6px; }
.summary-section-head > span { color: var(--teal-dark); font-size: 10px; font-weight: 900; }
.summary-section h3 { margin: 0; font-size: 14px; }
.summary-section-head small { color: var(--muted); font-size: 10px; }
.summary-row { display: grid; grid-template-columns: 62px minmax(180px, .9fr) minmax(230px, 1.1fr); gap: 14px; align-items: start; padding: 9px 0; border-top: 1px solid #e8eeec; font-size: 11px; line-height: 1.35; }
.summary-row time { color: var(--teal-dark); font-weight: 900; font-variant-numeric: tabular-nums; }
.summary-stage-copy > strong, .summary-stage-copy > small, .summary-song > strong, .summary-song > small { display: block; }
.summary-stage-copy > small, .summary-song > small { margin-top: 3px; color: var(--muted); }
.summary-song .is-pending { color: #8a6b18; }
.summary-alternative { display: grid; grid-template-columns: auto 1fr; gap: 6px; margin-top: 6px; color: #53615f; font-size: 10px; }
.summary-alternative b { color: var(--teal-dark); text-transform: uppercase; }
.summary-print-footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 14px; color: #60706d; font-size: 9px; }
.toast-region { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 7px; color: #fff; background: var(--dark); box-shadow: var(--shadow); font-size: 12px; line-height: 1.45; animation: toast-in .2s ease; }
.toast.is-error { border-left-color: #e3655d; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .template-layout { grid-template-columns: 1fr; }
  .template-preview { position: static; min-height: 0; }
  .preview-empty { min-height: 200px; }
  .preview-sections { max-height: none; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .section-rail { position: static; padding: 10px; }
  .section-rail nav { display: flex; max-width: 100%; overflow-x: auto; padding-bottom: 5px; }
  .section-link { flex: 0 0 min(260px, calc(100vw - 46px)); }
  .section-rail .full-button { display: none; }
  .event-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .compact-template-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; min-height: 64px; padding: 8px 14px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand small, .main-nav, .sync-state span:last-child { display: none; }
  .sync-state { padding: 0 4px; }
  main { padding: 20px 12px 42px; }
  .setup-heading h1 { font-size: 30px; }
  .setup-heading p { font-size: 14px; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-card { min-height: 184px; }
  .template-photo { height: 106px; }
  .template-card-copy { padding: 11px; }
  .template-card-copy small { min-height: 0; }
  .creation-panel { padding: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
  .form-submit-actions { display: grid; grid-template-columns: 1fr; }
  .account-gate { align-items: flex-start; flex-wrap: wrap; }
  .account-gate .secondary-button { width: 100%; }
  .event-band { align-items: stretch; flex-direction: column; padding: 14px; }
  .event-type-button strong { max-width: calc(100vw - 125px); font-size: 18px; }
  .event-actions { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) 40px; }
  .timeline-heading { align-items: stretch; flex-direction: column; margin-left: 34px; }
  .timeline-tools { width: 100%; }
  .search-box { min-width: 0; width: auto; flex: 1; }
  .section-heading, .stage-card, .empty-timeline { margin-left: 34px; }
  .stage-connector { left: -29px; }
  .stage-card { grid-template-columns: 32px minmax(0, 1fr); }
  .drag-handle { width: 32px; }
  .stage-main { grid-template-columns: 50px minmax(0, 1fr) 18px; gap: 9px; padding-right: 9px; }
  .priority-chip { display: none; }
  .stage-quick-actions { grid-column: 1 / -1; justify-content: flex-end; padding: 0 8px 8px; }
  .editor-grid, .song-editor { grid-template-columns: 1fr; }
  .editor-grid .wide, .song-editor h4 { grid-column: auto; }
  .stage-time-control { grid-template-columns: 54px 12px 54px 40px; }
  .field .stage-time-control input { min-height: 44px; }
  .stage-time-clear { width: 40px; height: 44px; }
  .active-share-row .icon-button { width: 44px; height: 44px; }
  .song-editor h4 { align-items: flex-start; gap: 8px; }
  .song-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
  .music-resolution { grid-column: auto; }
  .comment-form { align-items: stretch; flex-direction: column; }
  .share-access-options { grid-template-columns: 1fr; }
  .share-access-option { min-height: 54px; }
  .compact-template-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-frame { padding: 18px; }
  .conflict-revisions { grid-template-columns: 1fr; }
  .conflict-revisions > svg { justify-self: center; transform: rotate(90deg); }
  .conflict-modal .modal-actions { align-items: stretch; flex-direction: column; }
  .conflict-modal .modal-actions button { min-height: 44px; }
  .summary-event-meta { grid-template-columns: 1fr; }
  .summary-row { grid-template-columns: 55px minmax(0, 1fr); }
  .summary-song { grid-column: 2; }
  .summary-print-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (max-width: 430px) {
  .template-grid { grid-template-columns: 1fr; }
  .template-card { min-height: 0; }
  .template-card { display: grid; grid-template-columns: 108px minmax(0, 1fr); }
  .template-photo { height: 100%; min-height: 108px; }
  .template-check { top: 8px; right: 8px; }
  .event-actions .secondary-button span, .event-actions .primary-button span { display: none; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm 13mm 14mm; }
  html, body { width: auto !important; min-width: 0 !important; height: auto !important; overflow: visible !important; background: #fff !important; }
  body > * { display: none !important; }
  #summary-modal { position: static !important; inset: auto !important; display: block !important; width: auto !important; max-width: none !important; height: auto !important; max-height: none !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; border: 0 !important; background: #fff !important; }
  #summary-modal::backdrop { display: none !important; }
  #summary-modal .summary-frame { display: block !important; width: auto !important; max-width: none !important; height: auto !important; max-height: none !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
  #summary-modal .modal-head, #summary-modal .summary-sync-proof, #summary-modal .modal-actions { display: none !important; }
  .summary-document { display: block !important; width: 100% !important; min-width: 0 !important; overflow: visible !important; }
  .summary-print-header { padding-top: 0; }
  .summary-section-head { break-after: avoid; }
  .summary-row { grid-template-columns: 16mm minmax(0, .9fr) minmax(0, 1.1fr); break-inside: avoid; }
  .summary-print-footer { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
