/* Theme variables. Overridden at runtime from the venue's brand config
   (primary_color, accent_color, font, logo_url). Fallbacks are a natural,
   Moss-leaning palette until Jordan provides exact brand assets. */
:root {
  --primary: #3f5540;      /* mossy green */
  --accent: #a8763e;       /* warm clay */
  --ink: #1f241f;
  --muted: #6b726a;
  --line: #e3e6e1;
  --bg: #f6f7f4;
  --card: #ffffff;
  --good: #2e7d5b;
  --warn: #b23b3b;
  --font: "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
.err { color: var(--warn); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

/* Login */
/* The sign-in screen wears the PLATFORM's identity, not a venue's (Jordan
   2026-08-17). Every value here is literal on purpose: applyTheme() rewrites
   --primary/--accent/--font per venue, so anything token-based would make the
   door change clothes depending on who logged in last. Palette and type match
   the VIP mark exactly: ivory ground, olive serif, gold hairline. */
.login {
  --vip-olive: #3f5540;
  --vip-cream: #F5F1E8;
  --vip-gold:  #B99A55;
  --vip-serif: Georgia, "Times New Roman", serif;
  min-height: 100vh; display: grid; place-items: center;
  background: var(--vip-cream);
  padding: 24px;
}
.login-card {
  background: #fff; padding: 38px 34px 32px; border-radius: 18px; width: 340px; max-width: 100%;
  border: 1px solid rgba(185,154,85,.38);
  box-shadow: 0 18px 50px rgba(63,85,64,.13);
  display: flex; flex-direction: column; align-items: stretch; text-align: center;
}
.login-mark { display: block; margin: 0 auto 14px; }
.login-brand {
  font-family: var(--vip-serif); font-size: 25px; font-weight: 400; line-height: 1.25;
  letter-spacing: .01em; color: var(--vip-olive);
}
.login-rule { width: 72px; height: 2px; background: var(--vip-gold); margin: 14px auto 0; }
.login-sub {
  color: var(--vip-gold); margin: 12px 0 20px; font-size: 12px;
  letter-spacing: .16em; text-transform: uppercase;
}
.login-card input {
  padding: 12px 13px; margin-bottom: 10px; border: 1px solid #ddd8cb;
  border-radius: 9px; font-size: 15px; background: #fcfbf7; color: #1f241f; text-align: left;
}
.login-card input:focus { outline: none; border-color: var(--vip-gold); box-shadow: 0 0 0 3px rgba(185,154,85,.16); }
.login-card button {
  padding: 12px; margin-top: 4px; border: 0; border-radius: 9px; background: var(--vip-olive);
  color: var(--vip-cream); font-size: 15px; font-weight: 600; letter-spacing: .03em;
}
.login-card button:hover { background: #34462f; }

/* App shell */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--primary); color: #eef1ec; display: flex; flex-direction: column; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; padding: 4px 8px 16px; }
.brand-logo { height: 26px; width: auto; }
/* When a venue logo is loaded, it IS the name: the text beside it was pure
   duplication and crowded the rail, worst at VUE where the wordmark is wide
   (Jordan, 2026-08-07). Venues without a logo keep their text name. */
.brand-logo:not(.hidden) + #brand-name { display: none; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav button { text-align: left; background: transparent; border: 0; color: #dfe6dc;
  padding: 9px 12px; border-radius: 8px; font-size: 14px; display: flex; justify-content: space-between; }
#nav button:hover { background: rgba(255,255,255,.08); }
#nav button.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
#nav .count { opacity: .7; font-variant-numeric: tabular-nums; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.15); padding-top: 12px; font-size: 13px; }
.who { opacity: .85; margin-bottom: 6px; }
.link { background: none; border: 0; color: #cdd8c9; text-decoration: underline; padding: 0; font-size: 13px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { padding: 20px 28px 8px; }
.topbar h1 { margin: 0; font-size: 24px; }
.view-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.view { padding: 16px 28px 40px; overflow: auto; }

/* Cards + tables */
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line);
  border-radius: 12px; padding: 28px; text-align: center; }
/* Saved sort on the event dashboards (item 13, 2026-08-05). Sits above the grid,
   quiet enough that it does not compete with the cards it orders. */
.sortbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sortbar label { color: var(--muted); font-size: 13px; }
.sortbar select { padding: 6px 9px; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; font-family: inherit; font-size: 13px; color: var(--ink); }
.sortbar select:hover { border-color: var(--primary); }
.sortbar-note { color: var(--muted); font-size: 12px; opacity: .8; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.row span:first-child { color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.green { background: #e6f2ec; color: var(--good); }
.pill.red { background: #f6e7e7; color: var(--warn); }
.pill.amber { background: #f6efe1; color: var(--accent); }
.pill.grey { background: #eef0ec; color: var(--muted); }
.clickable { cursor: pointer; }
.clickable:hover { border-color: var(--primary); }

/* Pipeline board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { min-width: 220px; flex: 0 0 220px; background: #eef0eb; border-radius: 12px; padding: 8px; }
.col h4 { margin: 4px 6px 8px; font-size: 13px; display: flex; justify-content: space-between; }
.col .count { color: var(--muted); }
.col .card { margin-bottom: 8px; padding: 10px; }
.col .card h3 { font-size: 14px; }

/* Detail (per-client) */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail .panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.detail .panel h3 { margin: 0 0 10px; font-size: 15px; color: var(--primary); }
.back { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 0 0 12px; font-size: 14px; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 5px 0; font-size: 14px; vertical-align: top; border-bottom: 1px solid var(--line); }
table.kv td:first-child { color: var(--muted); width: 42%; }

/* In-place field editing (item 1, 2026-08-05).
   The input sits exactly where the read-only value used to, so the panel keeps
   its shape and nothing jumps when a field becomes editable. Borderless until
   hovered or focused: a panel of fifteen boxed inputs reads as a form to fill in
   rather than a record to correct, and most visits here are reads. */
table.kv td.ed-cell { padding: 2px 0 2px 6px; }
.ed { width: 100%; padding: 5px 7px; font-family: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 5px; }
.ed:hover { border-color: var(--line); background: var(--bg); }
.ed:focus { border-color: var(--primary); background: var(--card); outline: none; }
.ed-msg { font-size: 12px; color: var(--muted); padding-left: 7px; }
.ed-msg.ok { color: var(--good); }
.ed-msg.err { color: var(--warn); display: block; padding-top: 2px; }
/* Why a field is read-only. A field that cannot be edited and gives no reason
   reads as the bug item 1 was raised to fix. */
.ed-hint { display: block; font-size: 11px; line-height: 1.35; color: var(--muted); opacity: .8; padding-top: 1px; }

.nav-div { height: 1px; background: rgba(255,255,255,.15); margin: 8px 6px; }

/* Detail controls */
.control { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.control label { color: var(--muted); font-size: 13px; width: 60px; }
.control select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.control button { padding: 6px 10px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 13px; }
.control button:hover { border-color: var(--primary); }

/* Inline add form (tasks) */
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.inline-form input[type=text], .inline-form input:not([type]), .inline-form input[type=date] {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.inline-form .chk { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.inline-form button { padding: 9px 16px; border: 0; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600; }

/* Tasks */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.t-title { font-weight: 600; }
.t-actions { display: flex; gap: 6px; flex-shrink: 0; }
.t-actions button { padding: 6px 10px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 13px; }
.t-actions button:hover { border-color: var(--primary); }

/* Modal (draft preview) */
.modal-ov { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); border-radius: 12px; padding: 18px; width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* New-lead form */
.lead-form { max-width: 720px; }
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 12px 0; }
.lead-form button[type=submit] { padding: 10px 18px; border: 0; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600; }
.lead-form select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
@media (max-width: 560px) { .lead-grid { grid-template-columns: 1fr; } }

/* Back-end editor (templates + timing) */
.mini { padding: 5px 12px; border: 1px solid var(--line); background: var(--card); border-radius: 7px; font-size: 13px; }
.mini:hover { border-color: var(--primary); }
.tpl { margin-bottom: 12px; }
.tpl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fld { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.fld input, .fld textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--ink); }
.fld textarea { resize: vertical; line-height: 1.5; }
.tpl-foot { display: flex; align-items: center; gap: 12px; }
.tpl-foot .chk { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.save-msg { font-size: 13px; }
.save-msg.ok { color: var(--good); }
.save-msg.err { color: var(--warn); }
.report-table input[type=number] { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; }

/* Editable checklist rows (event detail) */
.chkrow { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.chkrow input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* Banner */
.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.banner.warn { background: #f6e7e7; color: var(--warn); border: 1px solid #eccaca; }

/* Calendar */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-width: 460px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head .link { color: var(--primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow span { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0; }
.cal-day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; font-size: 13px; cursor: pointer; border: 1px solid var(--line); }
.cal-day.empty-day { border: 0; cursor: default; }
.cal-day.open { background: #eef0ec; }
.cal-day.soft_hold { background: #f6efe1; color: var(--accent); font-weight: 600; }
.cal-day.booked { background: #e6f2ec; color: var(--good); font-weight: 700; }
.cal-day:hover:not(.empty-day) { outline: 2px solid var(--primary); }
.cal-legend { margin-top: 10px; display: flex; gap: 8px; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat-val { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.report-table td { padding: 7px 8px; }
.report-table tr:first-child td { color: var(--muted); font-weight: 600; }

/* ---- Mobile layout (2026-08-07, Jordan: desktop stays exactly as is) ----
   Before this, the nav rendered as an 838px wall of wrapped buttons ABOVE the
   content: the whole first screen of the phone was menu. Now the sidebar is a
   compact sticky header with a hamburger; the menu is a drawer that closes on
   navigation; wide tables scroll sideways instead of crushing; inputs are 16px
   so iOS stops zooming the page on focus. Nothing here applies above 720px. */
.nav-toggle { display: none; }
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 50; flex-direction: row; align-items: center;
    flex-wrap: wrap; padding: 10px 12px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
  .brand { padding: 0; flex: 1; font-size: 16px; min-width: 0; }
  .nav-toggle { display: block; background: rgba(255,255,255,.14); border: 0; color: #fff;
    font-size: 20px; line-height: 1; padding: 10px 14px; border-radius: 8px; }
  body.nav-open .nav-toggle { background: rgba(255,255,255,.3); }
  #nav { display: none; flex-direction: column; flex: none; width: 100%;
    max-height: 72vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-top: 10px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.15); }
  body.nav-open #nav { display: flex; }
  #nav button { padding: 12px 12px; font-size: 15px; }   /* real touch targets */
  .sidebar-foot { display: none; width: 100%; }
  body.nav-open .sidebar-foot { display: block; }
  .topbar { padding: 14px 14px 4px; }
  .topbar h1 { font-size: 20px; }
  .view-meta { font-size: 13px; }
  .view { padding: 12px 12px 32px; }
  .detail { grid-template-columns: 1fr; }
  /* Wide tables scroll inside themselves; the page never scrolls sideways. */
  .report-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  /* 16px inputs are the iOS threshold below which the browser zooms the page. */
  input, select, textarea { font-size: 16px; }
  .inline-form { flex-wrap: wrap; }
  .inline-form input, .inline-form select { flex: 1 1 140px; }
  .tpl-foot { flex-wrap: wrap; gap: 6px; }
  .mini { padding: 8px 12px; }
  .modal { max-width: calc(100vw - 20px); max-height: 92vh; }
  .col { min-width: 240px; flex: 0 0 240px; }   /* pipeline swipes card by card */

  /* Round 2 (Jordan's phone screenshots, 2026-08-07). */
  /* Cards stack: text on top at full width, buttons wrapping BELOW, so no
     button row can drag the page sideways and no card squeezes its text into
     a sliver beside dead space. */
  .task-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .t-actions { flex-wrap: wrap; justify-content: flex-start; }
  .t-actions button { padding: 8px 12px; }
  /* Dropdowns in card actions (vendor review) size to their label, not the
     row: they open a floating picker anyway. */
  .t-actions select, .v-reason { width: auto; max-width: 230px; flex: 0 1 auto; }
  /* Belt and suspenders: the page itself never pans sideways; anything wide
     scrolls inside its own table or board instead. */
  .view { overflow-x: hidden; }
  /* Table headers breathe: wrap onto two lines instead of jamming together. */
  .report-table tr:first-child td { white-space: normal; min-width: 76px;
    vertical-align: bottom; line-height: 1.25; }
  .report-table td { padding: 8px 10px; }
}

/* Sequence firing-mode note (2026-08-03). Auto-fire is the one setting in the
   back end that can email a client with nobody reading it first, so it reads
   as a warning rather than as neutral help text. */
.sub.warn { color: var(--warn); font-weight: 600; }

/* Archive control on the deal page (2026-08-03). The hint sits under the row
   because archiving changes what the reports say, so the consequence should be
   readable before the click, not discovered after it. */
.archive-ctl .archive-hint { flex-basis: 100%; color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.45; }
.archive-ctl .a-go { border-color: var(--warn); color: var(--warn); }

/* Triage grading (2026-08-04). The confirm action reads as the primary one,
   because most calls are right and the list should be quick to clear. */
.t-actions .t-right { border-color: var(--good); color: var(--good); font-weight: 600; }
