/* Abell Planner — base styling. Intentionally lean; expands with the app. */
:root {
  --ink: #1c2230;
  --muted: #6b7280;
  --line: #e3e6ec;
  --bg: #f5f6f8;
  --accent: #2b6cb0;
  --accent-ink: #fff;
  --ok-bg: #e7f6ec; --ok-ink: #1d6b37;
  --err-bg: #fdeaea; --err-ink: #a32020;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.topbar-nav { display: flex; align-items: center; gap: 18px; }
.who { color: var(--muted); font-size: 13px; }
.who em { font-style: normal; text-transform: uppercase; font-size: 11px;
  background: var(--bg); padding: 2px 7px; border-radius: 10px; margin-left: 4px; }
.signout { text-decoration: none; }

.wrap { max-width: 880px; margin: 0 auto; padding: 28px 22px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 26px;
}
.card h1 { margin: 0 0 6px; font-size: 22px; }
.muted { color: var(--muted); }
.roadmap { color: var(--muted); }

.login-card { max-width: 360px; margin: 8vh auto 0; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px;
  color: var(--muted); }
input {
  font: inherit; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 14px; border: 0; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink);
}
button:hover { filter: brightness(1.07); }

.flash { padding: 10px 14px; border-radius: 7px; margin-bottom: 16px; font-size: 14px; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }

/* ----- Phase 2: Events & CRM ----------------------------------------- */

/* Main nav in the top bar */
.brand { text-decoration: none; color: var(--ink); }
.mainnav { display: flex; gap: 4px; margin-right: auto; margin-left: 28px; }
.mainnav a {
  text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: 7px;
}
.mainnav a:hover { background: var(--bg); color: var(--ink); }
.mainnav a.on { background: var(--bg); color: var(--ink); font-weight: 600; }

/* The list/detail pages are wider than the login-era 880px wrap */
.wrap { max-width: 1080px; }

/* Page header: title left, primary action right */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 24px; }
.page-head .muted { margin: 4px 0 0; }
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }

.crumb { margin: 0 0 12px; font-size: 13px; }
.crumb a { text-decoration: none; color: var(--muted); }
.crumb a:hover { color: var(--accent); }

/* Buttons rendered as links */
.btn {
  display: inline-block; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 9px 15px; border: 1px solid var(--accent);
  border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  text-decoration: none;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.ghost:hover { background: var(--bg); filter: none; }

/* Dashboard tiles */
.tile-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.tile {
  display: flex; flex-direction: column; gap: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 20px 22px; text-decoration: none; color: var(--ink);
}
.tile:hover { border-color: var(--accent); }
.tile-label { font-size: 17px; font-weight: 700; }
.tile-sub { font-size: 13px; color: var(--muted); }

/* Search / filter bars */
.searchbar, .filterbar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.searchbar input[type=search] { flex: 1; min-width: 240px; }
.filterbar label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted);
}
.filterbar select { min-width: 150px; }
.clear-link, .link-action { font-size: 13px; text-decoration: none; }
.clear-link { align-self: center; }

select {
  font: inherit; padding: 9px 11px; background: #fff;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink);
}
select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* A card that holds a flush-edge table */
.card.flush { padding: 0; overflow: hidden; }
.card.flush .pad, .card .pad { padding: 18px 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; }

/* Data tables — airy, modern, not DJEP-dense */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
  text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid var(--line); background: #fcfcfd;
}
table.data tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #f9fafb; }
table.data td a { text-decoration: none; font-weight: 600; }
table.data td a:hover { text-decoration: underline; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .nowrap { white-space: nowrap; }

.count-line { margin: 12px 2px 0; font-size: 13px; }

/* Status pill */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  color: #fff; background: var(--pill, var(--muted));
}

/* Empty states */
.card.empty { text-align: center; padding: 44px 26px; }
.card.empty p { margin: 0 0 16px; color: var(--muted); }

/* Detail panels */
.panel-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.panel-grid.three { grid-template-columns: repeat(3, 1fr); }
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.card h2.spaced { margin-top: 20px; }
.card h3 { margin: 16px 0 4px; font-size: 13px; color: var(--muted); }
.card h3:first-of-type { margin-top: 0; }

/* Key/value lists */
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; font-size: 14px; text-align: right; }
dl.kv dt.total { font-weight: 700; color: var(--ink); padding-top: 7px;
  border-top: 1px solid var(--line); }
dl.kv dd.total { font-weight: 700; padding-top: 7px;
  border-top: 1px solid var(--line); }

.lead-line { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.lead-line a { text-decoration: none; }
.addr { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.notes { white-space: pre-wrap; font-size: 14px; }

/* Forms */
.form-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 26px 26px;
}
.form-card fieldset {
  border: 0; border-top: 1px solid var(--line); padding: 18px 0 4px; margin: 0;
}
.form-card fieldset:first-of-type { border-top: 0; }
.form-card legend {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 0;
}
.field-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.form-card label {
  display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 180px;
  font-size: 13px; color: var(--muted);
}
.form-card label.narrow { flex: 0 0 110px; min-width: 90px; }
.form-card label.check {
  flex-direction: row; align-items: center; gap: 8px; min-width: 160px;
}
.form-card label.check input { width: auto; }
.form-card input, .form-card select, .form-card textarea {
  font: inherit; padding: 9px 11px; width: 100%;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink);
  background: #fff;
}
.form-card textarea { resize: vertical; }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
}
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }

@media (max-width: 720px) {
  .panel-grid, .panel-grid.three { grid-template-columns: 1fr; }
  .mainnav { margin-left: 12px; }
}

/* ----- Phase 3: Staffing -------------------------------------------------- */

/* Small button variant — used in the event Staff panel's inline forms */
.btn.small {
  font-size: 12px; padding: 5px 10px; border-radius: 6px;
}

/* Inline forms inside table cells — staff position edit, check-in, add */
.inline-edit {
  display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin: 0;
}
.inline-edit input[type=text], .inline-edit input[type=time],
.inline-edit select {
  font: inherit; font-size: 13px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 6px; color: var(--ink);
  background: #fff;
}
.inline-edit input.mini { width: 116px; }
.inline-edit input[type=time].mini { width: 110px; }
.inline-edit input:focus, .inline-edit select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}

/* The "add staff" row below the staff table */
.staff-add {
  padding: 14px 22px; border-top: 1px solid var(--line); background: #fcfcfd;
}
.staff-panel table.data tbody tr { cursor: default; }
.staff-panel table.data tbody tr:hover { background: transparent; }

/* A muted helper line, smaller than .muted's default */
.small { font-size: 12px; }
td .muted.small { display: block; margin-top: 2px; }

/* ----- Phase 4: Client portal & planning --------------------------------- */

/* Required-field marker on portal form labels */
.req { color: var(--err-ink); font-weight: 700; }

/* Planning Q&A pairs on the admin event detail Planning panel */
dl.qa { margin: 0; }
dl.qa dt {
  font-size: 13px; color: var(--muted); margin-top: 12px;
}
dl.qa dt:first-child { margin-top: 0; }
dl.qa dd {
  margin: 2px 0 0; font-size: 14px; white-space: pre-wrap;
}
dl.qa dd.unanswered { color: var(--muted); font-style: italic; }

/* Section heading within a planning panel */
.qa-section {
  font-size: 13px; font-weight: 700; margin: 18px 0 4px; color: var(--ink);
}
.qa-section:first-of-type { margin-top: 0; }

/* ----- Phase 7: Calendar ------------------------------------------------- */

/* Toolbar above the grid: month stepper on the left, view toggle on right */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-title {
  font-size: 18px; font-weight: 700; min-width: 168px; text-align: center;
}
.cal-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; color: var(--ink);
  text-decoration: none; font-size: 18px; line-height: 1;
}
.cal-step:hover { border-color: var(--accent); color: var(--accent); }
.cal-today {
  font-size: 13px; text-decoration: none; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--muted);
}
.cal-today:hover { border-color: var(--accent); color: var(--accent); }

/* View toggle (Month / List) */
.cal-views {
  display: inline-flex; border: 1px solid var(--line); border-radius: 7px;
  overflow: hidden;
}
.cal-view-btn {
  font-size: 13px; font-weight: 600; padding: 7px 14px;
  text-decoration: none; color: var(--muted); background: #fff;
}
.cal-view-btn + .cal-view-btn { border-left: 1px solid var(--line); }
.cal-view-btn:hover { background: var(--bg); color: var(--ink); }
.cal-view-btn.on { background: var(--accent); color: var(--accent-ink); }

/* The month grid itself */
table.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.cal-grid thead th {
  text-align: center; padding: 9px 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: #fcfcfd; border-bottom: 1px solid var(--line);
}
table.cal-grid td.cal-cell {
  vertical-align: top; height: 112px; padding: 5px 6px 7px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #fff;
}
table.cal-grid tr td:last-child { border-right: 0; }
table.cal-grid tr:last-child td { border-bottom: 0; }
.cal-cell.out { background: #fafbfc; }
.cal-cell.out .cal-daynum { color: #c4c9d2; }
.cal-cell.today { background: #f0f6fc; }
.cal-cell.today .cal-daynum {
  background: var(--accent); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: inline-flex;
  align-items: center; justify-content: center;
}
.cal-daynum {
  font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 3px;
}

/* A single event chip inside a day cell */
.cal-event {
  display: block; margin-top: 3px; padding: 2px 7px; border-radius: 5px;
  font-size: 11.5px; line-height: 1.4; text-decoration: none; color: #fff;
  background: var(--pill, var(--muted));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid rgba(0, 0, 0, .22);
}
.cal-event:hover { filter: brightness(1.08); }
.cal-event-time { font-weight: 700; opacity: .92; }
.cal-event-name { font-weight: 500; }

/* Feed settings page */
.cal-feed-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px;
}
.cal-feed-url {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; padding: 9px 11px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink); background: var(--bg);
}

@media (max-width: 720px) {
  table.cal-grid td.cal-cell { height: 78px; }
  .cal-event-name { display: none; }
}

/* --- Phase 8: contracts & invoicing -------------------------------------- */

/* Frozen contract body — preserve the template's line breaks. */
.contract-body {
  white-space: pre-wrap; font-size: 14px; line-height: 1.6; color: var(--ink);
}

/* Printable contract / invoice sheet (no PDF library — browser Print). */
.print-doc { background: var(--bg); }
.doc-sheet {
  max-width: 720px; margin: 28px auto; padding: 44px 52px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.doc-title { margin: 0 0 4px; font-size: 24px; }
.doc-meta { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.doc-signatures { margin-top: 38px; }
.doc-sig { margin-top: 22px; }
.doc-sig-line {
  margin: 0; padding-bottom: 4px; min-height: 26px;
  font-size: 20px; font-style: italic; border-bottom: 1px solid var(--ink);
}
.doc-sig-name { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
.doc-sig-meta { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.doc-print-hint { margin-top: 32px; font-size: 12px; color: var(--muted); }

@media print {
  .doc-sheet { margin: 0; border: 0; border-radius: 0; max-width: none; }
  .doc-print-hint { display: none; }
}

/* ===== Improvement round: redesigned event detail ======================== */

/* Event header — title + status + quick actions */
.evt-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.evt-header-main h1 { margin: 0 0 6px; font-size: 25px; }
.evt-subline { margin: 0; display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap; }
.evt-meta { color: var(--muted); font-size: 13px; }
.evt-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* At-a-glance stat strip */
.evt-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; margin-bottom: 20px;
}
.evt-stat {
  background: #fff; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 3px;
}
.evt-stat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}
.evt-stat-value { font-size: 19px; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.evt-stat-due { color: var(--err-ink); }

/* Tab bar */
.evt-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 2px solid var(--line); margin-bottom: 20px;
}
.evt-tab {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 0; border-bottom: 2px solid transparent;
  padding: 10px 16px; margin-bottom: -2px; border-radius: 0;
}
.evt-tab:hover { color: var(--ink); background: transparent; filter: none; }
.evt-tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Panels — only the active one is shown */
.evt-panel { display: none; }
.evt-panel.on { display: block; }
.evt-panel > .card,
.evt-panel > .panel-grid { margin-bottom: 16px; }
.evt-panel > .card:last-child,
.evt-panel > .panel-grid:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .evt-header { flex-direction: column; }
  .evt-tabs { overflow-x: auto; flex-wrap: nowrap; }
}

/* ===== Improvement round: printable planning worksheet =================== */

.ws-sheet {
  max-width: 760px; margin: 0 auto; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 40px 48px;
}
.ws-head { border-bottom: 2px solid var(--ink); padding-bottom: 14px;
  margin-bottom: 22px; }
.ws-title { margin: 0 0 12px; font-size: 22px; }
.ws-meta { width: 100%; border-collapse: collapse; font-size: 13px; }
.ws-meta td { padding: 3px 12px 3px 0; vertical-align: top; }
.ws-label {
  display: inline-block; min-width: 56px; color: var(--muted);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em;
}
.ws-section { margin-bottom: 26px; page-break-inside: auto; }
.ws-form-title {
  margin: 0 0 4px; font-size: 16px;
  border-bottom: 1px solid var(--line); padding-bottom: 5px;
}
.ws-sub { margin: 16px 0 6px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ws-desc { margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.ws-qa { margin: 0; }
.ws-qa dt {
  font-size: 12px; color: var(--muted); margin-top: 10px;
}
.ws-qa dt:first-child { margin-top: 0; }
.ws-qa dd {
  margin: 1px 0 0; font-size: 14px; min-height: 20px;
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
  white-space: pre-wrap;
}
.ws-blank { display: inline-block; min-height: 16px; }
.ws-empty { font-size: 12px; color: var(--muted); font-style: italic; }
.ws-table { width: 100%; border-collapse: collapse; font-size: 13px;
  margin-top: 6px; }
.ws-table th {
  text-align: left; padding: 6px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  border-bottom: 1.5px solid var(--ink);
}
.ws-table td {
  padding: 7px 8px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.ws-footer { margin-top: 30px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); text-align: center; }

@media print {
  body { background: #fff; }
  .topbar, .ws-screen-only, .flash { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .ws-sheet { border: 0; border-radius: 0; padding: 0; max-width: none; }
  .ws-section { page-break-inside: avoid; }
}
