/* BuildTx — mobile-first, no build step. Must load instantly on a cheap phone
   on bad jobsite signal (spec sec.7). High contrast, big tap targets. */

:root {
  --ink:        #15202b;
  --ink-soft:   #475866;
  --muted:      #7c8a96;
  --line:       #d9e0e6;
  --bg:         #f4f6f8;
  --card:       #ffffff;
  --brand:      #1d4ed8;   /* confident blue */
  --brand-dark: #1736a3;
  --safety:     #f59e0b;   /* hi-vis amber accent */
  --ok:         #15803d;
  --ok-bg:      #dcfce7;
  --no:         #b91c1c;
  --no-bg:      #fee2e2;
  --view:       #b45309;
  --view-bg:    #fef3c7;
  --pend:       #64748b;
  --pend-bg:    #e2e8f0;
  --radius:     10px;
  --shadow:     0 1px 2px rgba(16,32,48,.06), 0 4px 16px rgba(16,32,48,.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }

/* Header / footer */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 800;
}
.brand-text { letter-spacing: -.02em; font-size: 19px; }
.nav { display: flex; align-items: center; gap: 14px; }
.nav a { color: var(--ink-soft); font-weight: 600; }
.nav a.btn-primary { color: #fff; }   /* beat .nav a specificity on the Sign in button */
.nav a.btn-primary:hover { color: #fff; }
.nav-user { color: var(--muted); font-size: 13px; display: none; }
@media (min-width: 640px) { .nav-user { display: inline; } }

.site-footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }
.footer-feedback { color: var(--brand); font-weight: 600; }

.main { padding-top: 24px; }
.flashes { padding-top: 12px; }
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 10px; font-weight: 600; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error   { background: var(--no-bg); color: var(--no); }
.flash-warning { background: var(--view-bg); color: var(--view); }
.flash-info    { background: #e0ecff; color: var(--brand-dark); }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-title { margin: 0 0 4px; font-size: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 700; font-size: 15px; cursor: pointer;
  min-height: 44px; line-height: 1;
}
.btn:hover { text-decoration: none; border-color: #b9c4cd; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--no); border-color: var(--no); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-sm { padding: 7px 12px; min-height: 36px; font-size: 14px; }
.btn-lg { padding: 15px 22px; min-height: 52px; font-size: 17px; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Forms */
.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; color: var(--ink); background: #fff; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.row2 { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .row2 { grid-template-columns: 1fr 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:hover { background: #fafcfd; }
td.num { font-variant-numeric: tabular-nums; }

/* Status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.pill-confirmed { background: var(--ok-bg); color: var(--ok); }
.pill-declined  { background: var(--no-bg); color: var(--no); }
.pill-viewed    { background: var(--view-bg); color: var(--view); }
.pill-pending   { background: var(--pend-bg); color: var(--pend); }

/* Type / category chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 6px; background: #eef2f6; color: var(--ink-soft); font-size: 12px; font-weight: 700; }

/* Stat tiles (dashboard) */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .n { font-size: 28px; font-weight: 800; line-height: 1; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
.stat-ok .n { color: var(--ok); }
.stat-no .n { color: var(--no); }
.stat-view .n { color: var(--view); }
.stat-pend .n { color: var(--pend); }

/* Checkbox list (recipient picker) */
.checklist { display: grid; gap: 8px; }
.check {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer;
}
.check input { width: 20px; height: 20px; }
.check .trade { color: var(--muted); font-size: 13px; }

/* Landing / marketing */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(28px, 6vw, 46px); letter-spacing: -.03em; margin: 0 0 14px; }
.hero .lede { font-size: 19px; color: var(--ink-soft); max-width: 620px; margin: 0 0 22px; }
.kicker { display: inline-block; background: #e0ecff; color: var(--brand-dark); font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; margin-bottom: 16px; }
.features { display: grid; gap: 16px; margin: 28px 0; }
@media (min-width: 720px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; color: var(--ink-soft); }
.steps { counter-reset: step; display: grid; gap: 14px; }
.steps li { list-style: none; padding-left: 46px; position: relative; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; }

/* Recipient page — big, simple, one event only */
.recv { max-width: 560px; }
.recv .event-card { padding: 24px; }
.recv h1 { font-size: 26px; margin: 0 0 4px; }
.recv .meta { color: var(--ink-soft); margin: 2px 0; }
.recv .actions { display: grid; gap: 12px; margin-top: 22px; }
.center { text-align: center; }
.big-status { font-size: 22px; font-weight: 800; margin: 10px 0; }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.list-meta { color: var(--muted); font-size: 13px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
small.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }

/* Month calendar (events list) */
.cal { padding: 16px; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-month { font-size: 18px; font-weight: 800; letter-spacing: -.01em; min-width: 160px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-label { font-size: 16px; font-weight: 800; letter-spacing: -.01em; min-width: 150px; text-align: center; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.view-toggle .vt { padding: 7px 14px; font-weight: 700; font-size: 14px; color: var(--ink-soft); border-right: 1px solid var(--line); background: #fff; }
.view-toggle .vt:last-child { border-right: 0; }
.view-toggle .vt:hover { text-decoration: none; background: #f1f5f9; }
.view-toggle .vt.on { background: var(--brand); color: #fff; }

/* Day agenda */
.agenda { display: grid; gap: 8px; }
.agenda-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); background: #fff; color: var(--ink); }
.agenda-item:hover { text-decoration: none; background: #fafcfd; border-left-color: var(--brand-dark); }
.agenda-time { font-weight: 800; color: var(--brand-dark); min-width: 78px; font-variant-numeric: tabular-nums; }
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-weight: 700; }
.agenda-count { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* Week grid */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.week-col { background: var(--card); min-height: 150px; display: flex; flex-direction: column; }
.week-col.today { background: #eef4ff; }
.week-head { display: flex; align-items: baseline; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--ink); }
.week-head:hover { text-decoration: none; background: #f1f5f9; }
.week-dow { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.week-num { font-size: 16px; font-weight: 800; }
.week-col.today .week-num { color: var(--brand); }
.week-body { padding: 6px; display: grid; gap: 4px; align-content: start; }
.week-add { text-align: center; color: var(--muted); font-weight: 800; border: 1px dashed var(--line); border-radius: 6px; padding: 2px; font-size: 13px; }
.week-add:hover { text-decoration: none; background: #f1f5f9; color: var(--brand); }

a.cal-daynum { color: var(--ink-soft); }
a.cal-daynum:hover { text-decoration: none; background: var(--brand); color: #fff; }
a.cal-more:hover { text-decoration: underline; }

.cal-ev.cancelled, .agenda-item.cancelled { opacity: .55; }
.cal-ev.cancelled .cal-ev-title, .agenda-item.cancelled .agenda-title { text-decoration: line-through; }

/* Proposed (awaiting GC approval) — dashed amber */
.cal-ev.proposed { background: var(--view-bg); border-left-style: dashed; border-left-color: var(--view); }
.agenda-item.proposed { border-left-style: dashed; border-left-color: var(--view); background: var(--view-bg); }
.cal-ev.proposed .cal-ev-time, .agenda-item.proposed .agenda-time { color: var(--view); }

/* Gantt timeline (day) — events as bars by time, packed into lanes */
.tl-scroll { overflow-x: auto; }
.tl { position: relative; padding-left: 54px; min-width: 360px; border-top: 1px solid var(--line); }
.tl-hour { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.tl-hour-label { position: absolute; left: 0; top: -8px; width: 46px; text-align: right; padding-right: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-lanes { position: relative; height: 100%; }
.tl-bar { position: absolute; border-radius: 6px; padding: 3px 7px; overflow: hidden; color: var(--ink); box-shadow: 0 1px 2px rgba(16,32,48,.08); }
.tl-bar:hover { text-decoration: none; filter: brightness(0.97); }
.tl-bar-time { display: block; font-size: 11px; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tl-bar-title { display: block; font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-bar.proposed { border-left-style: dashed !important; }
.tl-bar.cancelled { opacity: .5; }
.tl-bar.cancelled .tl-bar-title { text-decoration: line-through; }

/* Cancelled banner (recipient + dashboard) */
.cancel-banner { background: var(--no-bg); color: var(--no); border: 1px solid #f3b4b4; border-radius: var(--radius); padding: 11px 14px; font-weight: 700; margin-bottom: 14px; text-align: center; }
.safety-doc { background: var(--view-bg); border: 1px solid #f0d9b5; border-radius: var(--radius); padding: 11px 14px; margin: 12px 0; text-align: left; }
.safety-doc .ack-note { color: var(--ok); font-weight: 600; margin-top: 8px; }
.cal-scroll { overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: #f7f9fb; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 7px 8px; text-align: left; }
.cal-cell { background: var(--card); min-height: 96px; padding: 6px 7px 8px; display: flex; flex-direction: column; gap: 3px; }
.cal-cell.out { background: #fbfcfd; }
.cal-cell.out .cal-daynum { color: #c2ccd4; }
.cal-cell.today { background: #eef4ff; }
.cal-cell.today .cal-daynum { background: var(--brand); color: #fff; }
.cal-daynum { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--ink-soft); min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; }
.cal-ev { display: flex; gap: 5px; align-items: baseline; background: #e7eefb; border-left: 3px solid var(--brand); border-radius: 5px; padding: 3px 6px; font-size: 12px; line-height: 1.25; color: var(--ink); overflow: hidden; }
.cal-ev:hover { text-decoration: none; background: #dbe7fa; }
.cal-ev-time { font-weight: 800; color: var(--brand-dark); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal-ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 11px; font-weight: 700; color: var(--muted); padding-left: 2px; }

.plain-list { list-style: none; margin: 8px 0 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }

/* Site switcher (header) */
.site-switcher { position: relative; }
.site-switcher > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 700; font-size: 14px; color: var(--ink); background: #fff; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-switcher > summary::-webkit-details-marker { display: none; }
.site-switcher > summary::after { content: "▾"; color: var(--muted); }
.site-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 210px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px;
}
.site-menu form { margin: 0; }
.site-opt {
  display: block; width: 100%; text-align: left; padding: 9px 11px; border: 0;
  background: transparent; border-radius: 7px; font: inherit; font-weight: 600;
  color: var(--ink); cursor: pointer;
}
.site-opt:hover { background: #f1f5f9; text-decoration: none; }
.site-opt.current { background: #e7eefb; color: var(--brand-dark); }
.site-opt.manage { color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; border-radius: 0; }

/* Trial banner */
.trial-banner { background: var(--view-bg); color: var(--view); border-bottom: 1px solid #f3dca0; font-size: 14px; font-weight: 600; }
.trial-banner .wrap { padding: 8px 16px; }
.trial-banner a { color: var(--brand-dark); }
.trial-banner.expired { background: var(--no-bg); color: var(--no); border-bottom-color: #f3b4b4; }

/* Comment thread */
.thread { display: grid; gap: 10px; margin: 6px 0 14px; }
.cmt { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fff; }
.cmt.private { background: #fdf6ec; border-color: #f0d9b5; }
.cmt-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 3px; }
.cmt-author { font-weight: 700; font-size: 14px; }
.cmt-when { color: var(--muted); font-size: 12px; }
.cmt-body { white-space: pre-wrap; }
.cmt-vis { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 1px 7px; border-radius: 999px; }
.cmt-vis.private { background: var(--view-bg); color: var(--view); }
.cmt-vis.public { background: var(--ok-bg); color: var(--ok); }
.visibility-row { display: flex; gap: 16px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.visibility-row label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* Recipient: "your other events" */
.other-list { display: grid; gap: 10px; }
.other-evt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.other-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.other-title { font-weight: 700; }
.other-actions { display: flex; gap: 6px; margin: 0; }
