/* ============================================================
   Entirely Activity Log

   The design handoff ("Activity Log (standalone)") authored every style
   inline because its prototype dialect streams markup. That did NOT come
   across: the CloudFront CSP is script-src 'self' with no 'unsafe-inline',
   so every rule lives here and every behaviour in app.js / logic.js.

   Palette and type are the handoff's, which are the brand tokens in
   tokens/*.css: sand ground, white cards, black header, neon accent, and
   the status hues it chose (petal/plum for overdue, sage/moss for open,
   aqua/teal for scheduled, sand/slate for logged).
   ============================================================ */

* { box-sizing: border-box; }

/* The `hidden` attribute is enforced by the UA stylesheet as
   [hidden] { display: none }, which ANY class rule that sets `display` beats on
   specificity. Global and !important on purpose - every `hidden` toggle in
   app.js depends on this, and the failure is silent (growth-radar hit it). */
[hidden] { display: none !important; }

html, body { min-height: 100%; }
body {
  margin: 0; background: var(--surface-page); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 6px 0; }

/* ------------------------------------------------------------------ gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: #000; color: #fff; }
.gate-card { max-width: 460px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.gate-eyebrow { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: var(--tracking-cta); color: rgba(255,255,255,.6); }
.gate-title { margin: 0; font-family: var(--font-display); font-weight: var(--weight-light); font-size: 38px; line-height: 1.15; color: var(--color-neon); }
.gate-message { margin: 0; font-size: 14.5px; color: rgba(255,255,255,.78); text-wrap: pretty; }
.gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.gate .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }

/* --------------------------------------------------------------- buttons */
.btn-primary, .btn-ghost, .btn-secondary {
  display: inline-flex; align-items: center; gap: 8px; border-radius: var(--radius-capsule);
  padding: 10px 18px; font-weight: var(--weight-semibold); font-size: 13px; text-decoration: none;
  border: 1px solid transparent; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.btn-primary { background: var(--color-neon); color: #000; border-color: var(--color-neon); }
.btn-primary:hover:not(:disabled) { background: var(--color-lime); border-color: var(--color-lime); }
.btn-secondary { background: #000; color: #fff; border-color: #000; }
.btn-secondary:hover:not(:disabled) { background: var(--color-slate); }
.btn-ghost { background: #fff; color: #000; border-color: var(--border-subtle); }
.btn-ghost:hover:not(:disabled) { border-color: #000; }
.btn-primary:disabled, .btn-ghost:disabled, .btn-secondary:disabled { opacity: .55; cursor: default; }
.sm { padding: 7px 13px; font-size: 12.5px; }
.link { background: none; border: 0; padding: 0; color: var(--color-moss); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: 13px; cursor: pointer; }
.btn-dashed { display: inline-flex; align-items: center; border: 1px dashed var(--color-cement); background: transparent; border-radius: var(--radius-capsule); padding: 6px 14px; font-size: 13px; color: var(--color-slate); cursor: pointer; }
.btn-dashed:hover { border-color: #000; color: #000; }

/* ----------------------------------------------------------------- shell */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px 40px; background: #000; color: #fff;
}
.topbar-left { display: flex; align-items: center; gap: 24px; min-width: 0; }
.lockup { font-family: var(--font-display); font-size: 22px; font-weight: var(--weight-regular); text-decoration: none; letter-spacing: -.01em; }
.app-name { font-family: var(--font-display); font-size: 19px; font-weight: var(--weight-regular); color: rgba(255,255,255,.85); padding-left: 24px; border-left: 1px solid var(--border-on-dark); }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.scope-line { font-size: 12px; text-transform: uppercase; letter-spacing: var(--tracking-cta); color: var(--color-cement); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: var(--weight-semibold); color: var(--color-neon); }
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--color-neon); animation: sparkpulse 1.8s ease-in-out infinite; }
@keyframes sparkpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.usermenu { position: relative; }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border: 1px solid var(--border-on-dark); border-radius: var(--radius-capsule); background: transparent; color: #fff; font-size: 13px; }
.user-pill:hover { border-color: rgba(255,255,255,.5); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--color-neon); color: #000; display: grid; place-items: center; font-size: 12px; font-weight: var(--weight-semibold); flex-shrink: 0; }
.menu { position: absolute; top: 46px; right: 0; z-index: 41; width: 270px; background: #fff; color: #000; border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px 0; }
.menu p { margin: 0; padding: 0 16px; }
.menu-name { font-size: 13.5px; font-weight: var(--weight-semibold); padding-top: 6px !important; }
.menu-email, .menu-sf { font-size: 12px; color: var(--color-cement); margin-top: 2px !important; word-break: break-all; }
.menu-sf { padding-bottom: 6px !important; }
.menu-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 10px 16px; font-size: 13px; color: var(--color-slate); text-decoration: none; }
.menu-item:hover { background: var(--color-sand); }
.menu-item.danger { color: #c0362c; font-weight: var(--weight-semibold); }

.main { padding: 32px 40px 56px; max-width: 1600px; margin: 0 auto; }
.grid-top { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(300px, .9fr); gap: 28px; align-items: start; }
@media (max-width: 1100px) { .grid-top { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .main { padding: 18px; } .topbar { padding: 14px 18px; } .two { grid-template-columns: 1fr !important; } .app-name, .scope-line { display: none; } }

/* ---------------------------------------------------------------- connect */
.connect { display: grid; place-items: center; padding: 72px 24px; }
.connect-card { max-width: 560px; background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 36px 40px; display: flex; flex-direction: column; gap: 12px; }
.connect-actions { margin-top: 8px; }

/* ------------------------------------------------------------ typography */
.h1 { margin: 0; font-family: var(--font-display); font-size: 34px; line-height: 1.1; font-weight: var(--weight-light); }
.h2 { margin: 0; font-family: var(--font-display); font-weight: var(--weight-light); font-size: 30px; line-height: 1.15; }
.h3 { margin: 0; font-size: 15px; font-weight: var(--weight-semibold); }
.h3.display { font-family: var(--font-display); font-size: 22px; font-weight: var(--weight-regular); }
.display { font-family: var(--font-display); font-weight: var(--weight-regular); }
.eyebrow { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: var(--tracking-cta); color: var(--color-cement); }
.muted { color: var(--color-cement); }
.slate { color: var(--color-slate); }
.small { font-size: 12.5px; }
.lead { margin: 0; font-size: 14.5px; color: var(--color-slate); }

/* ----------------------------------------------------------------- cards */
.card { background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 22px 22px 14px; }

/* ------------------------------------------------------------------ form */
.form-card { overflow: visible; }
.form-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 28px 32px 22px; border-bottom: 1px solid var(--border-subtle); }
.form-head .eyebrow { margin-bottom: 6px; }
.form-head-right { text-align: right; max-width: 260px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.form-head-right p { margin: 0; text-wrap: pretty; }
.form { padding: 26px 32px 32px; display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; position: relative; }
.label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: var(--weight-medium); color: var(--color-slate); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.input {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: #fff; font-size: 14px; color: var(--text-primary); outline: none;
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.input:focus { border-color: #000; }
.input:invalid.touched { border-color: var(--color-rowan); }
.textarea { min-height: 104px; height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232e2e2e' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.pill-input { border-radius: var(--radius-capsule); height: 40px; }

/* chips (activity type) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border-radius: var(--radius-capsule); font-size: 13px; }
.chip-kind { border: 1px solid var(--border-subtle); background: #fff; padding: 8px 14px; color: var(--color-slate); transition: all var(--dur-fast) var(--ease-standard); }
.chip-kind:hover { border-color: #000; color: #000; }
.chip-kind[aria-checked="true"] { background: #000; color: #fff; border-color: #000; }
.chip-kind .kind-obj { font-size: 10px; text-transform: uppercase; letter-spacing: var(--tracking-cta); opacity: .55; }

/* segmented controls */
.seg { display: flex; gap: 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-capsule); overflow: hidden; height: 44px; background: #fff; }
.seg-btn { flex: 1; border: 0; background: transparent; font-size: 13px; font-weight: var(--weight-medium); color: var(--color-slate); padding: 0 12px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border-subtle); }
.seg-btn[aria-pressed="true"] { background: #000; color: #fff; }
.seg-mini { height: 26px; font-size: 11px; }
.seg-mini .seg-btn { font-size: 11px; padding: 0 9px; text-transform: uppercase; letter-spacing: .04em; }

/* pickers */
.picker-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px; padding: 5px 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: #fff; transition: border-color var(--dur-fast) var(--ease-standard); }
.picker-box:focus-within { border-color: #000; }
.picker-input { flex: 1; min-width: 120px; border: 0; outline: none; background: transparent; height: 30px; font-size: 14px; padding: 0 6px; }
.chip-sel { background: var(--color-sand); padding: 4px 6px 4px 12px; max-width: 100%; }
.chip-sel .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-sel .chip-type { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--color-cement); margin-right: 2px; }
.chip-x { border: 0; background: #fff; width: 20px; height: 20px; border-radius: 50%; color: var(--color-slate); font-size: 14px; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.chip-x:hover { background: #000; color: #fff; }
.picker-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin-top: 4px; background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-md); max-height: 300px; overflow: auto; padding: 4px; }
.picker-item { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; }
.picker-item:hover, .picker-item[aria-selected="true"] { background: var(--color-sand); }
.picker-item .pi-name { font-size: 13.5px; font-weight: var(--weight-medium); }
.picker-item .pi-meta { font-size: 11.5px; color: var(--color-cement); }
.picker-item .pi-type { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--color-moss); }
.picker-note { padding: 10px 12px; font-size: 12.5px; color: var(--color-cement); }
.attendees .chip-sel { background: var(--color-sand); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 40px; height: 22px; border-radius: 999px; background: var(--color-cement); position: relative; transition: background var(--dur-fast) var(--ease-standard); flex-shrink: 0; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--dur-fast) var(--ease-standard); }
.switch input:checked + .switch-track { background: var(--color-moss); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.extras { padding: 18px 20px; background: var(--color-sand); border-radius: var(--radius-lg); }
.extras .field { gap: 12px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: #fff; border: 1px solid var(--border-subtle); border-radius: var(--radius-capsule); font-size: 13px; }
.file-chip .file-size { color: var(--color-cement); font-size: 11.5px; }
.files-note { margin: 0; }

.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#hint.error { color: #c0362c; }

/* ----------------------------------------------------------------- aside */
.aside { display: flex; flex-direction: column; gap: 20px; }
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.counter { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius-lg); background: #fff; border: 1px solid var(--border-subtle); text-align: left; cursor: pointer; }
.counter-value { font-family: var(--font-display); font-size: 36px; line-height: 1; font-weight: var(--weight-light); font-variant-numeric: tabular-nums; }
.counter-label { font-size: 11px; text-transform: uppercase; letter-spacing: var(--tracking-cta); }
.counter.dark { background: #000; color: #fff; border-color: #000; }
.counter.neon { background: var(--color-neon); color: #000; border-color: var(--color-neon); }
.counter.moss { background: var(--color-moss); color: #fff; border-color: var(--color-moss); }
.counter[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-moss); }
.counter.dark[aria-pressed="true"], .counter.moss[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-neon); }
.upnext { display: flex; flex-direction: column; padding: 0 22px 8px; }
.upnext-item { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--border-subtle); }
.upnext-when { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: var(--tracking-cta); color: var(--color-slate); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-teal); flex-shrink: 0; }
.dot.Overdue { background: var(--color-azalea); }
.dot.Open { background: var(--color-moss); }
.dot.Scheduled { background: var(--color-teal); }
.dot.Logged { background: var(--color-cement); }
.upnext-subject { font-size: 15px; font-weight: var(--weight-medium); line-height: 1.3; text-wrap: pretty; }
.upnext-meta { font-size: 13px; color: var(--color-slate); }
.btn-outline { align-self: flex-start; margin-top: 2px; border: 1px solid #000; background: transparent; border-radius: var(--radius-capsule); padding: 6px 14px; font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-cta); text-transform: uppercase; }
.btn-outline:hover { background: #000; color: #fff; }
.upnext-empty { padding: 14px 0 12px; font-size: 13px; color: var(--color-cement); }

/* ----------------------------------------------------------------- table */
.table-card { margin-top: 28px; overflow: hidden; }
.table-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 22px 26px; border-bottom: 1px solid var(--border-subtle); }
.table-head .h3 { flex: 1; min-width: 220px; }
.table-head .pill-input { width: auto; }
#t-search { width: 280px; }
.table-scroll { overflow-x: auto; }
.thead, .trow { display: grid; grid-template-columns: 2.3fr 1.4fr 1.1fr 1.2fr 1.2fr .9fr .9fr; gap: 0; padding: 0 26px; min-width: 900px; }
.thead { background: var(--color-sand); border-bottom: 1px solid var(--border-subtle); }
.th { display: flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 14px 8px 14px 0; font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-cta); text-transform: uppercase; color: var(--color-slate); text-align: left; }
.th.right { justify-content: flex-end; padding-right: 0; }
.th[aria-sort="ascending"], .th[aria-sort="descending"] { color: #000; }
.th .arrow { color: var(--color-moss); font-size: 12px; }
.trow { padding: 16px 26px; border-bottom: 1px solid var(--border-subtle); background: #fff; align-items: center; }
.trow.editing { background: var(--color-sage); }
.trow:hover { background: var(--color-sand); }
.trow.editing:hover { background: var(--color-sage); }
.td-subject { display: flex; flex-direction: column; gap: 4px; padding-right: 16px; min-width: 0; }
.td-subject .subj { font-size: 14px; font-weight: var(--weight-medium); line-height: 1.3; text-wrap: pretty; }
.td-subject .who { font-size: 12px; color: var(--color-cement); }
.td { font-size: 13px; color: var(--color-slate); min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.td-when { display: flex; flex-direction: column; gap: 2px; }
.td-when .d { font-size: 14px; color: #000; }
.td-when .t { font-size: 12px; color: var(--color-cement); }
.status { display: inline-flex; padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: var(--tracking-cta); text-transform: uppercase; white-space: nowrap; }
.status.Overdue { background: var(--color-petal); color: var(--color-plum); }
.status.Open { background: var(--color-sage); color: var(--color-moss); }
.status.Scheduled { background: var(--color-aqua); color: var(--color-teal); }
.status.Logged { background: var(--color-sand); color: var(--color-slate); }
.td-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.prio { font-size: 11px; font-weight: var(--weight-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--color-slate); }
.prio.High { color: var(--color-rowan); }
.prio.none { color: var(--color-cement); font-weight: var(--weight-regular); }
.row-btn { border: 1px solid var(--border-subtle); background: #fff; border-radius: 50%; width: 30px; height: 30px; font-size: 15px; color: var(--color-moss); line-height: 1; display: grid; place-items: center; text-decoration: none; }
.row-btn:hover { background: var(--color-sand); border-color: #000; }
.empty { padding: 56px 26px; text-align: center; color: var(--color-slate); }
.empty p { margin: 0 0 6px; }
.empty .display { font-size: 22px; }

/* ----------------------------------------------------------------- toast */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; background: #000; color: #fff; padding: 14px 22px; border-radius: var(--radius-capsule); z-index: 60; box-shadow: var(--shadow-lg); max-width: min(90vw, 640px); font-size: 14px; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-neon); flex-shrink: 0; }
.toast.error .toast-dot { background: var(--color-rowan); }
.toast a { color: var(--color-neon); }

/* ---------------------------------------------------------------- banner */
.session-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; padding: 11px 18px; font-weight: var(--weight-semibold); text-align: center; background: #8f2d1c; color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.session-banner a { color: #fff; }
