/* ============================================================
   MRPH Grand Opening HQ — dark, prestige event styling
   ============================================================ */

:root {
  --navy-deepest: #070e1a;
  --navy-deep:    #0a1424;
  --navy:         #102036;
  --navy-raised:  #16294a3d;
  --panel:        rgba(20, 36, 60, 0.72);
  --panel-solid:  #13243d;
  --line:         rgba(244, 123, 32, 0.14);
  --line-soft:    rgba(255, 255, 255, 0.07);
  --text:         #e9eef6;
  --text-dim:     #93a3ba;
  --text-faint:   #5d6d85;

  --orange:       #f47b20;
  --orange-soft:  #f8a25e;
  --gold:         #e3b878;

  --c-paid:       #f47b20;
  --c-committed:  #3e8ede;
  --c-planned:    #36b98a;
  --c-remaining:  #e36ba8;
  --c-over:       #e0455a;

  --t-done:       #5f6b7d;
  --t-progress:   #3e8ede;
  --t-notstarted: #e3a23d;
  --t-overdue:    #e0455a;

  --radius: 12px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(244,123,32,0.07), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(62,142,222,0.06), transparent 60%),
    linear-gradient(180deg, var(--navy-deep) 0%, var(--navy-deepest) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ============================ Festoon background ============================ */

.festoon-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.festoon {
  position: absolute;
  left: -5%;
  width: 110%;
  height: 230px;
  transform-origin: 50% 0;
}

.festoon .wire {
  stroke: rgba(227, 184, 120, 0.18);
  stroke-width: 1.4;
}

.festoon .bulb {
  fill: var(--gold);
  opacity: 0.5;
  animation: twinkle 6s ease-in-out infinite;
}
.festoon .bulb.warm  { fill: var(--orange-soft); }
.festoon .bulb.cool  { fill: #f3d9a8; }
.festoon .bulb-glow {
  fill: var(--gold);
  opacity: 0.12;
  animation: twinkle 6s ease-in-out infinite;
}

.string-1 { top: -18px;  opacity: 0.34; animation: sway 14s ease-in-out infinite alternate; }
.string-2 { top: 90px;   opacity: 0.22; animation: sway 19s ease-in-out -4s infinite alternate-reverse; }
.string-3 { top: 215px;  opacity: 0.13; animation: sway 24s ease-in-out -9s infinite alternate; }

@keyframes sway {
  from { transform: rotate(-0.7deg) translateY(-5px); }
  to   { transform: rotate(0.7deg)  translateY(5px); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.18; }
}

@media (prefers-reduced-motion: reduce) {
  .festoon, .festoon .bulb, .festoon .bulb-glow { animation: none; }
}

/* ============================ Login ============================ */

.login-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%; max-width: 420px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 44px 40px 36px;
  text-align: center;
}

.login-logo { width: 96px; height: 96px; object-fit: contain; margin-bottom: 14px; filter: drop-shadow(0 4px 18px rgba(244,123,32,0.35)); }

.login-title {
  font-family: var(--font-display);
  font-size: 2.1rem; font-weight: 600; letter-spacing: 0.04em;
}
.login-title span { color: var(--orange); }

.login-sub { color: var(--text-dim); font-size: 0.82rem; margin: 8px 0 28px; letter-spacing: 0.06em; }

.login-card form { text-align: left; display: flex; flex-direction: column; gap: 16px; }

/* ============================ Forms ============================ */

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--text-dim); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 500; }

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  background: rgba(7, 14, 26, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.15);
}
select option { background: var(--panel-solid); color: var(--text); }
textarea { resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }

.form-error {
  color: #ff8d9d; background: rgba(224, 69, 90, 0.12);
  border: 1px solid rgba(224, 69, 90, 0.3);
  border-radius: 8px; padding: 8px 12px; font-size: 0.85rem;
}

/* ============================ Buttons ============================ */

.btn {
  font-family: var(--font-body);
  font-size: 0.88rem; font-weight: 500;
  border: none; border-radius: 9px;
  padding: 10px 18px; cursor: pointer;
  letter-spacing: 0.03em;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--orange) 0%, #d9620b 100%);
  box-shadow: 0 6px 18px rgba(244, 123, 32, 0.3);
}
.btn-primary:hover { box-shadow: 0 8px 24px rgba(244, 123, 32, 0.45); }

.btn-secondary {
  color: var(--orange-soft);
  background: rgba(244, 123, 32, 0.1);
  border: 1px solid rgba(244, 123, 32, 0.35);
}
.btn-secondary:hover { background: rgba(244, 123, 32, 0.2); }

.btn-ghost { color: var(--text-dim); background: transparent; border: 1px solid transparent; }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.btn-danger { color: #ff8d9d; background: rgba(224,69,90,0.12); border: 1px solid rgba(224,69,90,0.35); }
.btn-danger:hover { background: rgba(224,69,90,0.22); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; padding: 13px; font-size: 0.95rem; }
.chev { font-size: 0.7em; opacity: 0.7; display: inline-block; transition: transform 0.2s; }
.chev.open { transform: rotate(180deg); }

/* ============================ Layout ============================ */

.app { position: relative; z-index: 1; display: flex; flex-direction: column; min-height: 100vh; padding: 0 22px 22px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px 10px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 2px 10px rgba(244,123,32,0.3)); }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; letter-spacing: 0.05em; line-height: 1.1; }
.brand-sub { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; }

.powered-by-inline {
  font-family: var(--font-body);
  font-size: 0.64rem; font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.1em; text-transform: uppercase;
  vertical-align: 2px;
}
.powered-by {
  font-size: 0.66rem; font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-top: 2px;
}

.app-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  padding: 14px 0 2px;
}
.app-footer a { color: var(--text-dim); text-decoration: none; border-bottom: 1px solid rgba(244,123,32,0.35); }
.app-footer a:hover { color: var(--orange-soft); }
.login-footer { margin-top: 22px; padding: 0; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.user-menu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 190px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dropdown-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-family: var(--font-body); font-size: 0.88rem;
  padding: 11px 16px;
}
.dropdown-item:hover { background: rgba(244,123,32,0.12); }

/* ============================ Event info ============================ */

.info-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--orange-soft);
  background: rgba(244, 123, 32, 0.14);
  border: 1px solid rgba(244, 123, 32, 0.5);
  border-radius: 999px;
  padding: 7px 8px 7px 16px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(244, 123, 32, 0.18);
  transition: background 0.15s, box-shadow 0.15s;
}
.info-toggle:hover { background: rgba(244, 123, 32, 0.26); box-shadow: 0 0 20px rgba(244, 123, 32, 0.38); }
.chev-circle {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(244, 123, 32, 0.3);
  border: 1px solid rgba(244, 123, 32, 0.55);
}
.chev-circle .chev { font-size: 0.8rem; opacity: 1; }

.event-info-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.event-info-foot .meta-line { margin-top: 0; }

.event-info {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 14px;
  font-size: 0.86rem;
  line-height: 1.55;
}
.event-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.event-info h3 {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600;
  color: var(--gold); margin-bottom: 8px; letter-spacing: 0.05em;
}
.event-info p { margin-bottom: 7px; color: var(--text-dim); }
.event-info strong { color: var(--text); font-weight: 500; }
.event-info .warn { color: #f3c069; }

/* ============================ Zone A: Budget ============================ */

.budget-zone {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px 12px;
  margin-bottom: 14px;
}

.budget-bar-row { display: flex; align-items: center; gap: 12px; }
.budget-edge { font-size: 0.78rem; color: var(--text-dim); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

.budget-track {
  position: relative; flex: 1; height: 34px;
  background: rgba(7, 14, 26, 0.55);
  border: 1px solid var(--line-soft);
  border-radius: 17px;
  overflow: visible;
  cursor: pointer;
}
.budget-track:hover { border-color: rgba(244, 123, 32, 0.4); }

.budget-expand {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(244, 123, 32, 0.16);
  border: 1px solid rgba(244, 123, 32, 0.5);
  border-radius: 50%;
  color: var(--orange-soft);
  cursor: pointer;
  box-shadow: 0 0 14px rgba(244, 123, 32, 0.2);
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.budget-expand:hover { background: rgba(244, 123, 32, 0.3); box-shadow: 0 0 20px rgba(244, 123, 32, 0.4); }
.budget-expand:active { transform: translateY(1px); }
.budget-expand .chev { font-size: 1.05rem; opacity: 1; }
.budget-segments { display: flex; height: 100%; border-radius: 17px; overflow: hidden; }
.budget-track.overflowing .budget-segments { border-radius: 17px 0 0 17px; }

.budget-seg {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.74rem; font-weight: 600; color: rgba(255,255,255,0.92);
  white-space: nowrap; overflow: hidden;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.seg-paid      { background: linear-gradient(180deg, #ff9b46, var(--c-paid)); }
.seg-committed { background: linear-gradient(180deg, #62a7ea, var(--c-committed)); }
.seg-planned   { background: linear-gradient(180deg, #4fd2a3, var(--c-planned)); }
.seg-remaining { background: linear-gradient(180deg, #f08cc0, var(--c-remaining)); }
.seg-over      { background: repeating-linear-gradient(45deg, var(--c-over), var(--c-over) 8px, #c22f44 8px, #c22f44 16px); }

.budget-segments { position: relative; }
.over-zone {
  position: absolute; top: 0; bottom: 0; z-index: 2;
  background: repeating-linear-gradient(45deg, rgba(224,69,90,0.85), rgba(224,69,90,0.85) 8px, rgba(194,47,68,0.85) 8px, rgba(194,47,68,0.85) 16px);
  border-left: 2px solid #fff;
  border-radius: 0 17px 17px 0;
}

.budget-legend {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 8px; padding: 0 4px;
  font-size: 0.76rem; color: var(--text-dim);
}
.budget-legend span { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-paid { background: var(--c-paid); } .dot-committed { background: var(--c-committed); }
.dot-planned { background: var(--c-planned); } .dot-remaining { background: var(--c-remaining); }
.dot-over { background: var(--c-over); }
.dot-done { background: var(--t-done); } .dot-progress { background: var(--t-progress); }
.dot-notstarted { background: var(--t-notstarted); } .dot-overdue { background: var(--t-overdue); }

.over-budget {
  margin-top: 8px;
  color: #ff8d9d; background: rgba(224, 69, 90, 0.12);
  border: 1px solid rgba(224, 69, 90, 0.3);
  border-radius: 8px; padding: 8px 12px;
  font-size: 0.84rem; font-weight: 500;
}

.budget-panel { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 14px; }

.table-wrap { overflow-x: auto; }

.budget-table, .users-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.budget-table th, .users-table th {
  text-align: left; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 8px 10px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.budget-table td, .users-table td {
  padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top; color: var(--text-dim); font-weight: 400;
}
.budget-table td.item-cell { color: var(--text); font-weight: 500; min-width: 180px; }
.budget-table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.budget-table th.num { text-align: right; }
.budget-table tr:hover td { background: rgba(244, 123, 32, 0.04); }
.budget-table td.notes-cell { max-width: 260px; font-size: 0.8rem; }
.budget-table td.meta-cell { font-size: 0.74rem; white-space: nowrap; color: var(--text-faint); }

.status-select {
  padding: 5px 8px; font-size: 0.8rem; border-radius: 6px; cursor: pointer;
  font-weight: 500;
}
.status-select.st-planned   { color: #6fe0b6; border-color: rgba(54,185,138,0.4); }
.status-select.st-committed { color: #8dc1f3; border-color: rgba(62,142,222,0.4); }
.status-select.st-paid      { color: #ffb070; border-color: rgba(244,123,32,0.45); }

.row-actions { white-space: nowrap; }
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 0.95rem; padding: 4px 6px; border-radius: 6px;
}
.icon-btn:hover { color: var(--orange-soft); background: rgba(244,123,32,0.1); }
.icon-btn.danger:hover { color: #ff8d9d; background: rgba(224,69,90,0.12); }

/* Attachments */
.attach-cell { max-width: 220px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(62, 142, 222, 0.12);
  border: 1px solid rgba(62, 142, 222, 0.3);
  color: #9cc6f0;
  border-radius: 999px; padding: 2px 9px;
  font-size: 0.72rem; margin: 2px 3px 2px 0;
  max-width: 200px;
}
.attach-chip a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.attach-chip a:hover { text-decoration: underline; }
.attach-chip .attach-del { cursor: pointer; opacity: 0.6; font-style: normal; }
.attach-chip .attach-del:hover { opacity: 1; color: #ff8d9d; }

.attach-add {
  display: inline-flex; align-items: center;
  border: 1px dashed rgba(255,255,255,0.2); color: var(--text-faint);
  border-radius: 999px; padding: 2px 9px; font-size: 0.72rem;
  cursor: pointer; background: none;
}
.attach-add:hover { color: var(--orange-soft); border-color: rgba(244,123,32,0.45); }

.attach-block { margin-top: 4px; }
.attach-block .attach-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-bottom: 5px; font-weight: 500; }

.meta-line { font-size: 0.74rem; color: var(--text-faint); margin-top: 10px; }

/* ============================ Zone B: Timeline ============================ */

.timeline-zone {
  flex: 1;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 0 6px;
  display: flex; flex-direction: column;
  min-height: 420px;
}

.timeline-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  font-size: 0.75rem; color: var(--text-dim);
  padding: 0 18px 10px;
}
.timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-hint { margin-left: auto; color: var(--text-faint); font-style: italic; }

.timeline-scroll { flex: 1; overflow: auto; position: relative; }

.timeline { position: relative; min-width: 100%; }

.timeline-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; height: 46px;
  background: linear-gradient(180deg, rgba(13,23,40,0.97), rgba(13,23,40,0.88));
  border-bottom: 1px solid var(--line-soft);
}
.day-head {
  flex: none; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  font-size: 0.68rem; color: var(--text-faint);
  padding-bottom: 5px; border-left: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.day-head .month-label {
  font-family: var(--font-display);
  font-size: 0.85rem; font-weight: 700; color: var(--gold);
  letter-spacing: 0.1em; white-space: nowrap;
}
.day-head.weekend { color: var(--text-dim); }
.day-head.event-day { color: #ff8d9d; font-weight: 700; }

.timeline-canvas { position: relative; }

.grid-line {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: rgba(255, 255, 255, 0.045);
  pointer-events: none;
}
.grid-line.month-start { background: rgba(227, 184, 120, 0.3); width: 1px; }
.weekend-shade {
  position: absolute; top: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.022);
  pointer-events: none;
}

.marker-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  pointer-events: none; z-index: 3;
}
.marker-line.event { background: var(--c-over); box-shadow: 0 0 12px rgba(224,69,90,0.55); }
.marker-line.today { background: rgba(255,255,255,0.3); width: 1.5px; }
.marker-label {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em;
  padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; z-index: 4; pointer-events: none;
}
.marker-label.event {
  background: var(--c-over); color: #fff; box-shadow: 0 2px 10px rgba(224,69,90,0.5);
  pointer-events: auto; cursor: pointer;
}
.marker-label.event:hover { box-shadow: 0 2px 16px rgba(224,69,90,0.85); }
.day-head.event-day { cursor: pointer; }
.marker-label.today {
  background: #6b7686; color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.task-bar {
  position: absolute; height: 42px;
  border-radius: 7px;
  display: flex; align-items: center;
  padding: 0 9px;
  font-size: 0.72rem; font-weight: 500; color: #fff;
  line-height: 1.15;
  overflow: hidden;
  cursor: pointer; z-index: 2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  transition: filter 0.15s, transform 0.15s;
  border: 1px solid rgba(255,255,255,0.14);
}
.task-bar:hover { filter: brightness(1.18); transform: translateY(-1px); z-index: 6; }
.task-bar .bar-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}
.task-bar.overflow-label { overflow: visible; }
.task-bar.overflow-label .bar-label {
  display: block;
  position: absolute; left: calc(100% + 7px);
  top: 50%; transform: translateY(-50%);
  white-space: nowrap;
  color: var(--text-dim); text-shadow: none; font-weight: 400;
  pointer-events: none;
}

.task-done       { background: linear-gradient(180deg, #74819a, var(--t-done)); opacity: 0.8; }
.task-progress   { background: linear-gradient(180deg, #5ea3ec, #2f78c8); }
.task-notstarted { background: linear-gradient(180deg, #efb558, #cf8c26); }
.task-overdue    { background: linear-gradient(180deg, #ec5e72, #c83549); box-shadow: 0 3px 14px rgba(224,69,90,0.45); }

.task-bar.milestone {
  border-radius: 4px;
  justify-content: center;
}
.task-bar.milestone::before { content: '◆'; margin-right: 5px; font-size: 0.6rem; }

/* ============================ Modals ============================ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
}

.modal {
  width: 100%; max-width: 560px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 30px 24px;
  max-height: 92vh; overflow-y: auto;
}
.modal-sm { max-width: 420px; }

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 600; letter-spacing: 0.04em;
  margin-bottom: 18px; color: var(--text);
}
.modal h2::after {
  content: ''; display: block; width: 44px; height: 2px;
  background: var(--orange); margin-top: 8px; border-radius: 2px;
}
.modal form { display: flex; flex-direction: column; gap: 14px; }
.modal-note { font-size: 0.85rem; color: var(--gold); margin-bottom: 14px; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.spacer { flex: 1; }

.users-table td { color: var(--text-dim); }
.users-table td:first-child { color: var(--text); font-weight: 500; }
.users-subhead { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold); margin: 18px 0 10px; }
#newUserForm { display: grid; gap: 12px; }
.badge { font-size: 0.68rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; letter-spacing: 0.06em; }
.badge-admin { background: rgba(244,123,32,0.15); color: var(--orange-soft); border: 1px solid rgba(244,123,32,0.35); }
.badge-active { background: rgba(54,185,138,0.12); color: #6fe0b6; }
.badge-inactive { background: rgba(224,69,90,0.12); color: #ff8d9d; }

/* ============================ Toast ============================ */

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 100;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 22px;
  font-size: 0.88rem;
  animation: toast-in 0.25s ease;
}
.toast.error { border-left-color: var(--c-over); color: #ff8d9d; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================ Run sheet ============================ */

.modal-runsheet { max-width: 820px; }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.modal-head h2 { margin-bottom: 12px; }
.modal-head-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.runsheet-sub { font-size: 0.8rem; color: var(--text-dim); letter-spacing: 0.05em; margin: -8px 0 12px; }
.runsheet-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 0.74rem; color: var(--text-dim); margin-bottom: 12px;
}
.runsheet-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rs-dot-setup   { background: #6b7686; }
.rs-dot-openday { background: var(--c-committed); }
.rs-dot-vip     { background: var(--orange); }

.runsheet { position: relative; margin-left: 64px; }
.rs-hourline {
  position: absolute; left: 0; right: 0; height: 1px;
  background: rgba(255, 255, 255, 0.06);
}
.rs-hourlabel {
  position: absolute; left: -64px; width: 54px;
  text-align: right; transform: translateY(-50%);
  font-size: 0.7rem; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.rs-entry {
  position: absolute; left: 8px; right: 4px;
  border-radius: 8px; padding: 4px 12px;
  overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}
.rs-setup   { background: linear-gradient(180deg, rgba(107,118,134,0.32), rgba(107,118,134,0.2)); border-left: 3px solid #8b97a8; }
.rs-openday { background: linear-gradient(180deg, rgba(62,142,222,0.4), rgba(62,142,222,0.24)); border-left: 3px solid var(--c-committed); }
.rs-vip     { background: linear-gradient(180deg, rgba(244,123,32,0.42), rgba(244,123,32,0.24)); border-left: 3px solid var(--orange); }
.rs-time   { font-size: 0.66rem; color: var(--text-dim); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.rs-title  { font-size: 0.84rem; font-weight: 600; color: var(--text); line-height: 1.25; }
.rs-openday .rs-title, .rs-vip .rs-title { letter-spacing: 0.03em; }
.rs-detail { font-size: 0.72rem; color: var(--text-dim); line-height: 1.3; margin-top: 1px; }

/* ---- run sheet editing ---- */

.rs-edit-entry {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(7, 14, 26, 0.35);
}
.rs-edit-row {
  display: grid;
  grid-template-columns: 118px 118px 1fr 170px 34px;
  gap: 8px; align-items: center;
}
.rs-edit-row input, .rs-edit-row select { padding: 7px 9px; font-size: 0.85rem; }
.rs-edit-detail { width: 100%; margin-top: 8px; padding: 7px 9px; font-size: 0.82rem; }

@media (max-width: 768px) {
  .rs-edit-row { grid-template-columns: 1fr 1fr 32px; }
  .rs-edit-row input[data-rs-field="title"] { grid-column: 1 / 3; }
}

/* ============================ Screensaver ============================ */

.screensaver {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(900px 500px at 50% 40%, rgba(16, 32, 54, 0.9), rgba(4, 8, 16, 0.97));
  overflow: hidden;
  cursor: none;
}
.ss-logo {
  position: absolute; top: 0; left: 0;
  will-change: transform;
  user-select: none; pointer-events: none;
  filter: drop-shadow(0 0 16px rgba(244, 123, 32, 0.35));
}

/* ============================ Responsive ============================ */

@media (max-width: 768px) {
  .app { padding: 0 10px 10px; }
  .brand-title { font-size: 1.15rem; }
  .brand-sub { font-size: 0.6rem; }
  .brand-logo { width: 40px; height: 40px; }
  .event-info-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .budget-bar-row { flex-wrap: wrap; }
  .budget-edge { font-size: 0.68rem; }
  .budget-track { min-width: 0; }
  .legend-hint { display: none; }
  .modal { padding: 22px 18px; }

  /* 3 — header: stack title row and actions row */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .topbar-actions {
    justify-content: space-between;
    width: 100%;
  }

  /* 1 — budget line items: restack each row into a compact card */
  .table-wrap { overflow-x: visible; }
  .budget-table { box-sizing: border-box; }
  .budget-table thead { display: none; }
  .budget-table, .budget-table tbody, .budget-table tr, .budget-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .budget-table tr {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(7, 14, 26, 0.35);
    padding: 8px 14px 8px 10px;   /* right padding so text never hits the edge */
    margin-bottom: 8px;
  }
  .budget-table tr:hover td { background: none; }
  .budget-table td {
    border-bottom: none;
    padding: 2px 8px 2px 0;
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .budget-table td.item-cell { font-size: 0.92rem; min-width: 0; padding-bottom: 4px; }
  .budget-table td.num { text-align: left; }
  .budget-table td.meta-cell, .budget-table td.notes-cell { white-space: normal; max-width: none; }
  /* stacked field labels, one per line */
  .budget-table td:nth-child(2):not(:empty)::before { content: 'Supplier'; }
  .budget-table td.num::before { content: 'Amount'; }
  .budget-table td:nth-child(4)::before { content: 'Status'; }
  .budget-table td.attach-cell::before { content: 'Attachments'; }
  .budget-table td.notes-cell:not(:empty)::before { content: 'Notes'; }
  .budget-table td.meta-cell::before { content: 'Last edited by'; }
  .budget-table td::before {
    display: block;
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    margin-bottom: 1px;
  }
  .budget-table td.row-actions { padding-top: 4px; }

  /* 2 — timeline: never render labels outside their bar on mobile, so no
     floating label can appear cut off at the scroll area's left edge */
  .timeline-zone { padding-left: 0; padding-right: 0; }
  .timeline-scroll { overscroll-behavior-x: contain; }
  .timeline { margin: 0; }
  .task-bar.overflow-label { overflow: hidden; }
  .task-bar.overflow-label .bar-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    position: static;
    transform: none;
    white-space: normal;
    overflow: hidden;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.45);
    font-weight: 500;
    pointer-events: auto;
  }
}
