/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 220px;
  --sidebar-bg: #0d1117;
  --sidebar-border: #21262d;
  --sidebar-text: #8b949e;
  --sidebar-active-bg: #1f2937;
  --sidebar-active: #58a6ff;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --border-light: #e8ecf0;
  --text: #1f2937;
  --text-2: #57606a;
  --text-3: #8c959f;
  --accent: #0969da;
  --accent-hover: #0757ba;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.09);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* status colors */
  --confirmed: #1a7f37;
  --confirmed-bg: #dafbe1;
  --contacted: #9a6700;
  --contacted-bg: #fff8c5;
  --declined: #cf222e;
  --declined-bg: #ffebe9;
  --ready: #0969da;
  --ready-bg: #ddf4ff;
  --open: #cf222e;
  --open-bg: #ffebe9;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.backup-btn {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #21262d;
  color: #c9d1d9;
  cursor: pointer;
  transition: background .15s;
}
.backup-btn:hover { background: #30363d; color: #fff; }
.restore-btn { color: #79c0ff; border-color: #1f6feb; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  color: #e6edf3;
}

.brand-icon {
  font-size: 22px;
  line-height: 1;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.3px;
}

.nav-list {
  list-style: none;
  padding: 8px 8px 4px;
}

.nav-templates {
  padding-top: 4px;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: #4b5563;
  padding: 10px 18px 2px;
  border-top: 1px solid var(--sidebar-border);
  margin-top: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #e6edf3;
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}

.nav-icon { font-size: 13px; opacity: .7; }

.sidebar {
  overflow-y: auto;
}

/* ============================================================
   ADDRESS AUTOCOMPLETE
   ============================================================ */
.ac-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
  list-style: none;
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
  margin-top: -1px;
}

.ac-dropdown.ac-open { display: block; }

.ac-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.ac-active {
  background: var(--ready-bg);
  color: var(--accent);
}

.template-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #ddf4ff;
  border: 1px solid #54aeff;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #0550ae;
  margin-bottom: 20px;
  line-height: 1.5;
}

.template-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.template-banner-note {
  opacity: .75;
  font-size: 11.5px;
  display: inline-block;
  margin-top: 2px;
}

.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

#app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 16px;
  cursor: pointer;
}

.back-link:hover { text-decoration: underline; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
  padding: 5px 10px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-email {
  background: #0d1117;
  color: #ffffff;
  border-color: #0d1117;
}
.btn-email:hover { background: #1f2937; border-color: #1f2937; }

.expiry-countdown {
  font-size: 11px;
  color: var(--contacted);
  margin-top: 4px;
  font-weight: 600;
}

.btn-danger {
  background: transparent;
  color: var(--declined);
  border-color: var(--border);
}
.btn-danger:hover { background: var(--declined-bg); border-color: var(--declined); }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
}

.btn-icon {
  padding: 5px 8px;
  font-size: 13px;
}

.btn-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   CARDS / EVENTS GRID
   ============================================================ */
.month-group { margin-bottom: 8px; }
.month-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.month-group-header::-webkit-details-marker { display: none; }
.month-group-arrow {
  font-size: 10px;
  color: var(--text-3);
  transition: transform 0.2s;
  display: inline-block;
}
details[open] .month-group-arrow { transform: rotate(90deg); }
.month-group-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.month-group-count {
  font-size: 12px;
  color: var(--text-3);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 10px;
}
.month-group .events-grid { padding-bottom: 16px; }

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}

.event-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #b0bbc5;
}

.event-card-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}

.event-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.event-card-venue {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 14px;
}

.event-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.event-card-type {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 20px;
}

.event-card-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* ============================================================
   PILLS / BADGES
   ============================================================ */
.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.pill-confirmed { background: var(--confirmed-bg); color: var(--confirmed); }
.pill-contacted { background: var(--contacted-bg); color: var(--contacted); }
.pill-declined  { background: var(--declined-bg);  color: var(--declined); }
.pill-ready     { background: var(--ready-bg);     color: var(--ready); }
.pill-open      { background: var(--open-bg);      color: var(--open); }

.status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  text-transform: uppercase;
}
.status-confirmed { background: var(--confirmed-bg); color: var(--confirmed); }
.status-contacted { background: var(--contacted-bg); color: var(--contacted); }
.status-declined  { background: var(--declined-bg);  color: var(--declined); }
.status-not_contacted { background: var(--open-bg); color: var(--open); border: 1px solid var(--border); }

/* ============================================================
   EVENT DETAIL
   ============================================================ */
.event-detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.event-detail-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 4px;
}

.event-detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-2);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.event-detail-meta span { display: flex; align-items: center; gap: 5px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.detail-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
  margin-bottom: 14px;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
}

.timeline-row:last-child { border-bottom: none; }

.timeline-label {
  font-size: 12.5px;
  color: var(--text-2);
  width: 140px;
  flex-shrink: 0;
}

.timeline-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Financial summary */
.financial-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}

.financial-row:last-child { border-bottom: none; }

.financial-row.total {
  font-weight: 700;
  font-size: 15px;
  padding-top: 10px;
  margin-top: 4px;
}

.financial-row.total .financial-amount { color: var(--confirmed); }
.financial-row.loss .financial-amount { color: var(--declined); }

.financial-label { color: var(--text-2); }
.financial-amount { font-weight: 600; }

.financial-row.commission {
  font-size: 12.5px;
  padding: 4px 0 4px 10px;
  border-bottom: none;
  color: var(--text-3);
}
.financial-row.commission .financial-amount { font-weight: 500; color: var(--text-2); }
.financial-row.commission-header { padding-bottom: 2px; margin-top: 4px; border-top: 1px solid var(--border-light); }

.financial-row.band-fund-row {
  background: #fffbeb;
  margin: -7px -12px 4px;
  padding: 9px 12px;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid #f59e0b;
}
.financial-row.band-fund-row .financial-label { color: var(--text); font-weight: 700; }
.band-fund-amount { color: #b45309 !important; font-size: 15px; }
.band-fund-select {
  margin-left: 6px;
  font-size: 12px;
  padding: 2px 4px;
  border: 1px solid #d97706;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  cursor: pointer;
  vertical-align: middle;
}

/* Budget tracker bar */
.budget-tracker {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 80;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.bt-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
}
.bt-label {
  font-size: 10px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.bt-val {
  font-size: 16px;
  font-weight: 700;
  color: #e6edf3;
}
.bt-op {
  font-size: 16px;
  color: #8b949e;
  flex-shrink: 0;
  margin-top: 16px;
}
.bt-deduct  { color: #f85149; }
.bt-avail   { color: #79c0ff; }
.bt-remaining { color: #56d364; }
.bt-over-budget { color: #f85149 !important; }
.bt-rem-seg .bt-val { font-size: 22px; }

/* Positions section */
.positions-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.positions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.positions-title {
  font-size: 14px;
  font-weight: 700;
}

.position-card {
  border-bottom: 1px solid var(--border-light);
}

.position-card:last-child { border-bottom: none; }

.position-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.position-role {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.position-card-actions {
  display: flex;
  gap: 6px;
}

.calls-table {
  width: 100%;
  border-collapse: collapse;
}

.calls-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  text-align: left;
  padding: 6px 20px;
  background: #f9fafb;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.calls-table td {
  padding: 9px 20px;
  vertical-align: middle;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-light);
}

.calls-table tr:last-child td { border-bottom: none; }

.calls-table tr.call-active td { background: #fdfeff; }
.calls-table tr.call-confirmed td { background: #f6fffb; }
.calls-table tr.call-declined td {
  opacity: .55;
}

/* ============================================================
   TWO-COLUMN EVENT LAYOUT
   ============================================================ */
.event-two-col {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  align-items: start;
}

.event-sidebar {
  position: sticky;
  top: 16px;
  order: 1;
}

.event-budget-col {
  min-width: 0;
  overflow-x: auto;
  order: 2;
}

@media (max-width: 900px) {
  .event-two-col { grid-template-columns: 1fr; }
  .event-sidebar { position: static; order: 1; }
  .event-budget-col { order: 2; }
}

/* ── Schedule strip ─────────────────────────────────── */
.schedule-strip {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
.schedule-strip::-webkit-scrollbar { display: none; }

.sched-from {
  font-size: 11px;
  color: var(--text-2);
  padding: 7px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  max-width: 180px;
  flex-shrink: 0;
  line-height: 1.3;
}

.sched-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 16px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 90px;
}
.sched-item:last-child { border-right: none; }

.sched-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  margin-bottom: 1px;
}

.sched-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}

/* ============================================================
   BUDGET TABLE
   ============================================================ */
.budget-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  table-layout: fixed;
}

.budget-table thead tr {
  background: #0d1117;
}

.budget-table th {
  color: #c9d1d9;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.budget-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 12.5px;
}

.budget-table tfoot td {
  padding: 10px 8px;
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: #fafbfc;
}

.position-group {
  border-bottom: 2px solid var(--border);
}

.position-group:last-of-type {
  border-bottom: none;
}

.budget-role-cell {
  vertical-align: top;
  padding-top: 8px !important;
  background: #fafbfc;
  font-size: 12px;
  width: 150px;
}

.budget-call-cell {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  width: 42px;
}

.budget-status-cell {
  width: 108px;
}

.budget-num-cell {
  width: 145px;
  white-space: nowrap;
}

.trav-cell {
  width: 155px;
}

.trav-details {
  margin-top: 4px;
  position: relative;
}

.trav-summary {
  font-size: 10px;
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.trav-summary::-webkit-details-marker { display: none; }
.trav-details[open] .trav-summary { color: var(--accent); }

/* Float the panel as an overlay so it doesn't compress the column */
.trav-fields {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
  margin-top: 4px;
}

.trav-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trav-row label {
  font-size: 10px;
  color: var(--text-3);
  width: 46px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.trav-row input {
  font-size: 12px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-1);
  width: 100%;
  min-width: 0;
}

.trav-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.budget-action-cell {
  white-space: nowrap;
  width: 155px;
}

.budget-table .pay-input-wrap {
  width: 100%;
}

.budget-table .call-musician-sel {
  font-size: 12px;
  padding: 3px 6px;
  height: auto;
}

.budget-table .pay-input-wrap input {
  font-size: 12px;
}

.budget-table .status-badge {
  font-size: 10px;
  padding: 2px 6px;
}

.call-order-badge {
  display: inline-block;
  width: 22px;
  height: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 20px;
  color: var(--text-2);
}

.call-pay {
  font-weight: 600;
  color: var(--text);
}

.call-actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}

.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.form-grid-times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 700px) {
  .form-grid, .form-grid-3, .form-grid-times { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="tel"],
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9,105,218,.12);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

/* Dark select arrow */
select {
  color-scheme: dark;
}

textarea { resize: vertical; min-height: 80px; }

.form-footer {
  display: flex;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  margin-top: 24px;
}

/* Google Places dropdown dark theme */
.pac-container {
  background: #1a1a1a !important;
  border: 1px solid #2a2a2a !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.6) !important;
}
.pac-item {
  background: #1a1a1a !important;
  color: #e8e8e8 !important;
  border-top: 1px solid #2a2a2a !important;
  font-size: 13px;
}
.pac-item:hover, .pac-item-selected { background: #222222 !important; }
.pac-item-query { color: #d4a843 !important; }
.pac-matched { color: #d4a843 !important; }

/* ============================================================
   ROSTER TABLE
   ============================================================ */
.roster-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  background: #fafbfc;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f6f8fa; }

.musician-name-cell {
  font-weight: 600;
}
.musician-name-link {
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.musician-name-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.instrument-badge {
  display: inline-block;
  background: var(--ready-bg);
  color: var(--ready);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* ============================================================
   MESSAGES VIEW
   ============================================================ */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.message-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}

.message-position {
  font-weight: 700;
  font-size: 14px;
}

.message-recipient {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.message-body {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 18px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: var(--font);
  background: #fdfdfe;
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--border-light);
  outline: none;
  resize: vertical;
  min-height: 180px;
}

.message-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
}

.copy-success { color: var(--confirmed); font-size: 12px; font-weight: 600; display: none; margin-left: 8px; align-items: center; }

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
}

.stat-confirmed .stat-number { color: var(--confirmed); }
.stat-contacted .stat-number { color: var(--contacted); }
.stat-open .stat-number { color: var(--text-3); }
.stat-total .stat-number { color: var(--text); }

/* ============================================================
   DISTANCE TABLE
   ============================================================ */
.distance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.distance-table {
  width: 100%;
  border-collapse: collapse;
}

.distance-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  background: #fafbfc;
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.distance-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  vertical-align: middle;
}

.distance-table tr:last-child td { border-bottom: none; }

.dist-value {
  font-weight: 600;
  color: var(--accent);
}

/* ============================================================
   ADD POSITION FORM (always visible at bottom of positions)
   ============================================================ */
.add-pos-form {
  border-top: 2px dashed var(--border);
  padding: 20px 20px 24px;
  background: #fafbfc;
}

.add-pos-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.add-pos-inner input[type="text"] {
  width: 100%;
}

/* Role name inline edit in position card header */
.pos-role-name-input {
  border: 1px solid transparent !important;
  outline: none;
  font-weight: 700 !important;
  font-size: 14px !important;
  color: var(--text) !important;
}

.pos-role-name-input:hover,
.pos-role-name-input:focus {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  box-shadow: 0 0 0 3px rgba(9,105,218,.1) !important;
}

/* ============================================================
   INLINE POSITION FORM (kept for pay-input-wrap reuse)
   ============================================================ */
.pos-form-panel {
  border-bottom: 1px solid var(--border);
  background: #f0f6ff;
  border-left: 3px solid var(--accent);
}

.pos-form-inner {
  padding: 20px 24px;
}

.pos-form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--accent);
  margin-bottom: 14px;
}

.call-form-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 16px;
}

.call-form-header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  background: #f6f8fa;
  border-bottom: 1px solid var(--border);
}

.call-form-col-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
}

.call-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}

.call-form-row:last-child { border-bottom: none; }

.call-form-label {
  width: 68px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.call-form-fields {
  display: flex;
  gap: 10px;
  flex: 1;
  align-items: center;
}

.call-form-fields select {
  flex: 1;
  min-width: 0;
}

.pay-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: 140px;
  flex-shrink: 0;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.pay-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9,105,218,.12);
}

.pay-prefix {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  background: #f6f8fa;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  align-self: stretch;
}

.pay-input-wrap input {
  border: none;
  box-shadow: none;
  padding: 7px 8px;
  flex: 1;
  min-width: 0;
}

.pay-input-wrap input:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

.pos-form-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-3);
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .15s;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  margin-top: 16px;
}

.modal-call-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
}

.modal-call-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
  padding-bottom: 6px;
  white-space: nowrap;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}

.empty-state p { font-size: 15px; margin-bottom: 16px; }

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: .4;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  transition: opacity .3s;
}

.toast.hidden { display: none; }
.toast-success { background: #1a7f37; color: #fff; }
.toast-error   { background: #cf222e; color: #fff; }
.toast-info    { background: var(--accent); color: #fff; }

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }
.text-muted { color: var(--text-3); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.divider { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }

.loading {
  text-align: center;
  padding: 20px;
  color: var(--text-3);
  font-size: 13px;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-overlay {
  position: fixed;
  inset: 0;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 40px 48px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-brand {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
}

.login-box h2 {
  color: #ffffff;
  font-size: 20px;
  margin-bottom: 8px;
}

.login-box p {
  color: #8b949e;
  font-size: 14px;
  margin-bottom: 24px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #ffffff;
  margin-bottom: 12px;
  outline: none;
}

.login-input:focus { border-color: #58a6ff; }

.login-btn {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  font-weight: 600;
  background: #238636;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.login-btn:hover:not(:disabled) { background: #2ea043; }
.login-btn:disabled { opacity: 0.6; cursor: default; }

.login-error {
  color: #f85149;
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* ============================================================
   MOBILE
   ============================================================ */
.mobile-header { display: none; }

@media (max-width: 768px) {
  /* Show mobile top bar, hide desktop sidebar */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    padding: 0 16px;
    z-index: 200;
  }

  .mobile-brand {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
  }

  .mobile-nav-links {
    display: flex;
    gap: 4px;
  }

  .mobile-nav-link {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #8b949e;
    text-decoration: none;
    border-radius: 6px;
    transition: background .15s, color .15s;
  }

  .mobile-nav-link.active,
  .mobile-nav-link:active {
    background: #1f2937;
    color: #58a6ff;
  }

  .sidebar { display: none; }

  .content {
    margin-left: 0;
    padding-top: 52px;
  }

  #app {
    padding: 16px 12px;
  }

  /* Event cards */
  .event-card { padding: 14px; }
  .event-card-footer { flex-wrap: wrap; gap: 6px; }

  /* Stats row — 2x2 on mobile */
  .stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .btn-actions { display: flex; flex-wrap: wrap; gap: 6px; }

  /* Budget tracker bar — scrollable */
  .budget-tracker {
    overflow-x: auto;
    font-size: 12px;
    gap: 6px;
    padding: 10px 12px;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* Schedule strip already scrolls — just make text slightly bigger */
  .sched-item { min-width: 90px; }
  .sched-time { font-size: 15px; }

  /* Budget table — scrollable */
  .event-budget-col { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Venue sidebar shows full width on mobile (already stacks via 900px breakpoint) */
  .event-sidebar .detail-card { margin-bottom: 10px; }

  /* Notes / attire text */
  .detail-card { padding: 14px; }

  /* Hide less useful columns on very small screens — keep Role, Musician, Status, Pay */
  .trav-cell, .budget-action-cell { min-width: 90px; }

  /* Form pages */
  .event-form-grid { grid-template-columns: 1fr !important; }
  .times-grid      { grid-template-columns: repeat(2, 1fr) !important; }
}
