:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0e7;
  --primary: #116a7b;
  --primary-dark: #0d5361;
  --green: #13795b;
  --amber: #9a5b00;
  --red: #b42318;
  --blue: #175cd3;
  --purple: #6941c6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; margin-bottom: 16px; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.mobile-topbar, .mobile-nav-backdrop, .sidebar-close { display: none; }
.sidebar { background: #111827; color: #fff; padding: 22px; display: flex; flex-direction: column; gap: 20px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-size: 18px; font-weight: 800; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar a { color: #d7dde6; padding: 10px 12px; border-radius: 8px; }
.sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.logout { margin-top: auto; }
.main { padding: 28px; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.muted { color: var(--muted); }
.grid.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.stat { display: grid; gap: 8px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { font-size: 26px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 10px 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; }
.btn:hover { border-color: #a8b3c0; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { min-height: 34px; padding: 7px 10px; }
.danger-btn { color: var(--red); border-color: #f0c4be; }
.icon-btn { border: 0; background: transparent; font-size: 28px; cursor: pointer; }

.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; text-transform: capitalize; width: max-content; }
.pill.green { color: var(--green); background: #dcfae6; }
.pill.amber { color: var(--amber); background: #fff4d6; }
.pill.red { color: var(--red); background: #fee4e2; }
.pill.blue { color: var(--blue); background: #dbeafe; }
.pill.purple { color: var(--purple); background: #ebe9fe; }

.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); background: #fff; }
.alert.success { background: #ecfdf3; border-color: #abefc6; color: var(--green); }
.alert.warning { background: #fffaeb; border-color: #fedf89; color: var(--amber); }
.alert.danger { background: #fef3f2; border-color: #fecdca; color: var(--red); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.empty { text-align: center; color: var(--muted); padding: 34px; }

.stack { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
label { display: grid; gap: 6px; font-weight: 700; color: #344054; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
legend { font-weight: 800; padding: 0 6px; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; cursor: pointer; }
.segmented input { width: auto; }
.check-grid { display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; }

.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.totals { display: grid; gap: 10px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.totals div:last-child { border-bottom: 0; }
.actions { display: grid; gap: 10px; }
.actions form, .actions .btn { width: 100%; }
.actions button { width: 100%; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }
.left-actions { justify-content: flex-start; flex-wrap: wrap; }
.conditional-box[hidden] { display: none; }
.conditional-box { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 12px; border-radius: 8px; background: #fff; color: var(--muted); border: 1px solid var(--line); font-weight: 800; }
.tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.modal { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: none; place-items: center; padding: 18px; z-index: 20; }
.modal.open { display: grid; }
.modal-panel { background: #fff; border-radius: 8px; width: min(680px, 100%); padding: 22px; position: relative; max-height: 92vh; overflow: auto; }
.modal-panel .icon-btn { position: absolute; top: 8px; right: 12px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: linear-gradient(140deg, #eef6f8, #f7f8fa); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 26px; box-shadow: 0 20px 70px rgba(16,24,40,.12); }
.auth-card h1 { margin-bottom: 10px; }

.portal { background: #f5f5f7; }
.portal-premium {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.98), rgba(255,255,255,0) 34%),
    linear-gradient(145deg, #f7f7f8 0%, #eceff2 48%, #f9fafb 100%);
}
.portal-wrap { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 48px; }
.portal-hero {
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(247,249,251,.82));
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 8px;
  padding: 34px;
  margin-bottom: 16px;
  box-shadow: 0 24px 80px rgba(31,41,55,.12);
}
.portal-eyebrow { display: block; color: #68717d; font-size: 13px; font-weight: 800; letter-spacing: 0; margin-bottom: 10px; text-transform: uppercase; }
.portal-hero h1 { font-size: 46px; line-height: 1.02; margin-bottom: 12px; color: #101820; }
.portal-hero p { margin: 0; color: #5f6874; font-size: 18px; }
.portal-hero-meta { min-width: 220px; display: grid; gap: 8px; justify-items: end; }
.portal-hero-meta strong { font-size: 28px; }
.portal-hero-meta > span:last-child { color: var(--muted); font-size: 13px; font-weight: 700; }
.portal-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.portal-summary-grid div {
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(31,41,55,.07);
}
.portal-summary-grid span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.portal-summary-grid strong { font-size: 20px; }
.portal-layout { grid-template-columns: minmax(0, 1fr) 380px; }
.portal-card {
  background: rgba(255,255,255,.86);
  border-color: rgba(255,255,255,.9);
  box-shadow: 0 18px 54px rgba(31,41,55,.08);
}
.portal-card h2 { font-size: 20px; }
.playlist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.playlist-grid h3 { font-size: 15px; margin: 0 0 8px; }
.playlist-grid iframe { border: 0; width: 100%; height: 352px; border-radius: 8px; }
.playlist-panel { min-width: 0; }
.map { border: 0; width: 100%; height: 280px; border-radius: 8px; }
.portal-map { height: 360px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.7); }
.map-placeholder { min-height: 260px; display: grid; place-items: center; text-align: center; color: var(--muted); background: #eef1f4; border: 1px dashed #b8c0ca; border-radius: 8px; padding: 18px; }
.venue-card { position: sticky; top: 22px; }
.contract-text { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); padding: 14px; border-radius: 8px; overflow: auto; font-family: "Open Sans", Arial, sans-serif; }
.signature-pad { display: block; width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 8px; background: #fff; touch-action: none; margin: 6px 0 10px; }
.signature-preview { display: block; max-width: 360px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px; margin-top: 12px; }

.planning-page {
  background: #ffffff;
  color: #111111;
  font-size: 16px;
}
.wdm-portal {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 18px 42px;
}
.planning-header {
  text-align: center;
  padding: 8px 0 2px;
}
.planning-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
}
.planning-header h3 {
  margin: 8px 0 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 500;
  color: #333333;
}
.planning-time { margin: 8px 0 0; font-weight: 700; color: #333333; }
.wdm-portal hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid #dedede;
}
.planning-section h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
}
.planning-section p {
  margin: 0 0 12px;
  color: #242424;
}
.soundtrack-list {
  display: grid;
  gap: 16px;
}
.soundtrack-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.soundtrack-item iframe,
.planning-map,
.first-dance-embed {
  border: 0;
  border-radius: 12px;
  display: block;
  background: #f4f4f4;
}
.planning-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: #111111;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.planning-button:hover {
  background: #2b2b2b;
  color: #ffffff;
}
.map-link {
  margin-top: 8px;
}
.contract-details {
  margin: 0 0 14px;
}
.contract-details summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
}
.contract-sign-form {
  margin-top: 14px;
}
.planning-brand {
  margin-top: 28px;
  text-align: center;
}
.planning-brand img {
  max-width: 100%;
  height: auto;
}

.contract-page {
  background: #eef1f4;
  color: #111827;
  padding: 28px;
}
.contract-document {
  width: min(980px, 100%);
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  box-shadow: 0 24px 90px rgba(15, 23, 42, .14);
  overflow: hidden;
}
.contract-cover {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 34px;
  background: linear-gradient(135deg, #101820, #25313f);
  color: #ffffff;
}
.contract-kicker {
  display: block;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  color: #cbd5e1;
  margin-bottom: 10px;
}
.contract-cover h1 {
  font-size: 38px;
  line-height: 1.05;
  margin-bottom: 10px;
}
.contract-cover p {
  margin: 0;
  color: #d8dee8;
}
.contract-status {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  white-space: nowrap;
}
.contract-status.signed {
  color: #053321;
  background: #a7f3d0;
}
.contract-status.unsigned {
  color: #5f370e;
  background: #fde68a;
}
.contract-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid #e5e7eb;
}
.contract-meta-grid div {
  padding: 18px;
  border-right: 1px solid #e5e7eb;
}
.contract-meta-grid div:last-child {
  border-right: 0;
}
.contract-meta-grid span {
  display: block;
  color: #6b7280;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.contract-meta-grid strong {
  font-size: 17px;
}
.contract-body {
  padding: 34px;
}
.contract-body pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: #1f2937;
}
.signature-certificate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  margin: 0 34px 34px;
  padding: 20px;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  background: #f8fafc;
}
.signature-certificate h2 {
  margin-bottom: 12px;
}
.signature-certificate dl {
  display: grid;
  gap: 10px;
  margin: 0;
}
.signature-certificate dl div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}
.signature-certificate dt {
  color: #6b7280;
  font-weight: 900;
}
.signature-certificate dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.signature-box {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px solid #d8dee6;
  border-radius: 8px;
  background: #ffffff;
  color: #6b7280;
  font-weight: 800;
}
.signature-box img {
  max-width: 100%;
  max-height: 150px;
}
.client-certificate {
  margin: 14px 0 0;
}
.contract-actions {
  display: flex;
  gap: 10px;
  padding: 0 34px 34px;
}

.calendar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.calendar-filter { margin-bottom: 18px; }
.calendar-layout { grid-template-columns: minmax(0, 1fr) 320px; }
.calendar-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.calendar-weekdays div { padding: 0 8px 10px; }
.calendar-day { min-height: 132px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; background: #fff; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.muted-day { background: #f8fafc; color: #98a2b3; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-date { font-weight: 900; margin-bottom: 8px; }
.calendar-events { display: grid; gap: 6px; }
.calendar-event { display: grid; gap: 2px; padding: 7px; border-radius: 8px; background: #eef7f8; color: #12343b; border: 1px solid #d4eaee; }
.calendar-event strong { font-size: 12px; line-height: 1.2; }
.calendar-event span { color: #53606b; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-list { display: grid; gap: 10px; }
.upcoming-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.upcoming-item span { grid-row: span 2; color: var(--primary); font-weight: 900; }
.upcoming-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.print-doc { background: #fff; padding: 32px; color: #111827; }
.print-doc pre { white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.55; }
.print-doc table { max-width: 760px; }

@media (min-width: 861px) {
  body.menu-open { overflow: auto; }
  .mobile-topbar, .mobile-nav-backdrop, .sidebar-close { display: none !important; }
  .app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); padding-top: 0; }
  .sidebar {
    position: static;
    z-index: auto;
    width: auto;
    transform: none !important;
    transition: none;
    box-shadow: none;
  }
  .sidebar nav { display: grid; grid-template-columns: 1fr; }
  .main { padding: 28px; min-width: 0; }
}

@media (max-width: 860px) {
  body.menu-open { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; padding-top: 62px; }
  .mobile-topbar {
    position: fixed;
    z-index: 35;
    inset: 0 0 auto 0;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }
  .mobile-brand { font-weight: 900; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hamburger {
    width: 42px;
    height: 42px;
    display: grid;
    place-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
  }
  .hamburger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 36;
    background: rgba(15,23,42,.45);
    border: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .menu-open .mobile-nav-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 37;
    width: min(82vw, 320px);
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 20px 0 60px rgba(15,23,42,.28);
  }
  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; font-size: 24px; cursor: pointer; }
  .sidebar nav { grid-template-columns: 1fr; }
  .sidebar a { min-height: 44px; align-items: center; display: flex; }
  .main { padding: 16px; min-width: 0; }
  h1 { font-size: 24px; }
  .page-head { display: grid; grid-template-columns: 1fr; align-items: start; }
  .page-head .btn, .page-head button, .calendar-actions .btn { width: 100%; }
  .booking-layout { grid-template-columns: 1fr; display: grid; }
  .grid.cards, .dashboard-grid, .two-col, .playlist-grid, .copy-row, .portal-summary-grid, .calendar-layout { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .table-card { padding: 12px; }
  th, td { padding: 10px 8px; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .row-actions .btn, .row-actions button { min-height: 36px; }
  .tabs { padding-bottom: 4px; }
  .tabs a { white-space: nowrap; }
  input, select, textarea { font-size: 16px; }
  .modal { padding: 10px; align-items: start; }
  .modal-panel { margin-top: 70px; padding: 18px; }
  .auth-card { padding: 20px; }
  .wdm-portal { padding: 16px 14px 34px; }
  .planning-header h1 { font-size: 30px; overflow-wrap: anywhere; }
  .planning-section h2 { font-size: 21px; }
  .soundtrack-item iframe { height: 300px; }
  .planning-map { height: 280px; }
  .planning-brand img { max-height: 180px; object-fit: contain; }
  .portal-hero { min-height: 220px; display: grid; padding: 24px; }
  .portal-hero h1 { font-size: 34px; }
  .portal-hero-meta { justify-items: start; }
  .venue-card { position: static; }
  .calendar-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; width: 100%; }
  .calendar-actions .btn { padding: 9px 8px; }
  .calendar-grid { grid-template-columns: 1fr; }
  .calendar-weekdays { display: none; }
  .calendar-day { min-height: auto; border-right: 0; padding: 12px; }
  .calendar-event { padding: 10px; }
  .contract-page { padding: 0; }
  .contract-cover, .contract-actions { display: grid; }
  .contract-cover h1 { font-size: 30px; overflow-wrap: anywhere; }
  .contract-meta-grid, .signature-certificate { grid-template-columns: 1fr; }
  .contract-meta-grid div { border-right: 0; border-bottom: 1px solid #e5e7eb; }
  .signature-certificate { margin: 0 18px 18px; }
  .contract-body, .contract-cover { padding: 24px; }
  .contract-body pre { font-size: 15px; }
}

@media (max-width: 480px) {
  .main { padding: 12px; }
  .card { border-radius: 8px; }
  .btn { width: 100%; }
  .calendar-actions { grid-template-columns: 1fr; }
  .signature-certificate dl div { grid-template-columns: 1fr; gap: 2px; }
}

@media print {
  .sidebar, .btn, .no-print { display: none !important; }
  body, .print-doc, .contract-page { background: #fff; padding: 0; }
  .card, .contract-document { border: 0; box-shadow: none; }
  .contract-cover { color: #111827; background: #fff; border-bottom: 2px solid #111827; }
  .contract-cover p, .contract-kicker { color: #374151; }
}
