/* Phiusion brand tokens (shared with events.phiusion.com) */
:root {
  --bg: #fafaf9; --surface: #ffffff;
  --text: #292524; --text-2: #57534e; --text-3: #78726a; --muted: #a8a39a;
  --ink: #1c1917; --border: #e7e5e4; --border-subtle: #ede8df;
  --card-border: rgba(252, 233, 176, 0.6);
  --accent: #ce971a; --accent-hover: #9a7114; --accent-subtle: #fffcf2; --amber-800: #92400e;
  --ok: #2f7a4f; --ok-bg: #eef6f0; --warn: #9a5b0b; --warn-bg: #fff4e0; --bad: #a3332b; --bad-bg: #fbeceb;
  --radius: 14px; --radius-sm: 8px;
  --shadow: 0 1px 3px -1px rgba(28,25,23,.04), 0 2px 8px -2px rgba(28,25,23,.03);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Plus Jakarta Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.4,0,0.2,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 600; }
h2 { font-size: 19px; font-weight: 600; }
p { margin: 0 0 12px; }
.boot { padding: 64px 16px; text-align: center; color: var(--text-3); }
.muted { color: var(--text-3); } .small { font-size: 13px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-hover); }
.hidden { display: none !important; }
code { font-size: 12px; background: var(--border-subtle); padding: 1px 5px; border-radius: 4px; }

/* Layout */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid rgba(252, 211, 77, .3); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wordmark { display: inline-flex; align-items: baseline; font: 500 20px/1 var(--display); letter-spacing: -0.04em; color: var(--ink); text-decoration: none; }
.wordmark-dot { display: inline-block; width: .16em; height: .16em; border-radius: 50%; background: var(--amber-800); margin-left: .06em; }
.app-tag { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 2px; align-items: center; margin-left: 12px; flex-wrap: wrap; }
.nav a { padding: 7px 11px; border-radius: 8px; font-size: 14px; color: var(--text-2); text-decoration: none; }
.nav a:hover { background: var(--accent-subtle); color: var(--ink); }
.nav a[aria-current=page] { background: var(--accent-subtle); color: var(--ink); font-weight: 600; }
.me { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }
@media (max-width: 720px) { .nav { margin-left: 0; order: 3; width: 100%; } .me .who { display: none; } }
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
@media (min-width: 768px) { main { padding: 32px 24px 72px; } }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .spacer { flex: 1; }
.card { background: rgba(255,255,255,.9); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; } @media (min-width: 720px) { .pad { padding: 24px; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 14px/1 var(--font);
  padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease); }
.btn:hover { border-color: var(--text-3); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; } .btn-primary:hover { background: #33302d; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); } .btn-ghost:hover { background: var(--border-subtle); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 14px 20px; font-size: 15px; width: 100%; justify-content: center; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Forms */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; font: 400 15px/1.4 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 40px; }
.inline-select { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 760px) { .form-grid { grid-template-columns: 1.2fr 1.4fr .8fr auto; } }

/* Chips */
.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); white-space: nowrap; }
.chip-ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.chip-bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.chip-gold { background: var(--accent-subtle); border-color: #f1dfb0; color: var(--accent-hover); }
.chip-ink { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2);
  padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.inactive td { color: var(--muted); }
.actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 720px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.list td { border: 0; padding: 3px 0; }
  table.list td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 92px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
  .actions { justify-content: flex-start; margin-top: 6px; }
}

/* Notices, dialog, toast */
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.notice-warn { background: var(--warn-bg); color: var(--warn); } .notice-bad { background: var(--bad-bg); color: var(--bad); } .notice-ok { background: var(--ok-bg); color: var(--ok); }
dialog.dlg { border: 0; border-radius: 14px; padding: 22px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--text); }
dialog.dlg::backdrop { background: rgba(28,25,23,.45); }
dialog.dlg h2 { margin-bottom: 10px; }
dialog.dlg .row { justify-content: flex-end; margin-top: 18px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s var(--ease); max-width: calc(100% - 32px); z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); } #toast.bad { background: var(--bad); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: min(420px, 100%); text-align: center; }
.login .wordmark { font-size: 28px; }
.gbtn svg { width: 18px; height: 18px; }

/* Audit */
.diff { margin: 8px 0 0; font-size: 12px; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
details summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tile { padding: 18px; text-decoration: none; display: block; }
.tile:hover { border-color: var(--accent); }
.tile b { display: block; font: 600 16px/1.3 var(--display); color: var(--ink); margin-bottom: 4px; }

/* ===== Phase 2: leads ===== */
.backlink { display: inline-flex; gap: 6px; margin-bottom: 12px; font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.backlink:hover { color: var(--ink); }
.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px; }
.filters-bar input[type=search] { flex: 1 1 260px; width: auto; }
.filters-bar .inline-select { min-height: 40px; }
.rowlink { font-weight: 600; color: var(--ink); text-decoration: none; }
.rowlink:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.chip.tiny { font-size: 11px; padding: 1px 7px; margin-left: 4px; }
.narrow-card { max-width: 760px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
textarea { width: 100%; font: 400 15px/1.45 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; resize: vertical; }
input[type=tel] { width: 100%; font: 400 15px/1.4 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 40px; }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); }
.detail-head { align-items: center; }
.detail-head h1 { font-size: clamp(22px, 3.5vw, 30px); }
.detail-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: 360px 1fr; } }
.kv { display: grid; gap: 10px; margin: 0; }
.kv div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 14px; align-items: center; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; word-break: break-word; }
.kv a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.note-form { margin-bottom: 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.tl-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: var(--border-subtle); color: var(--text-2); }
.tl-note .tl-icon { background: var(--accent-subtle); color: var(--accent-hover); }
.tl-call .tl-icon, .tl-email_sent .tl-icon { background: var(--ok-bg); color: var(--ok); }
.tl-status_change .tl-icon, .tl-owner_change .tl-icon { background: var(--warn-bg); color: var(--warn); }
.tl-body { min-width: 0; flex: 1; }
.tl-meta { font-size: 12px; color: var(--text-3); }
.tl-meta b { color: var(--text-2); font-weight: 600; }
.tl-text { font-size: 14px; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
dialog.dlg .stack > * + * { margin-top: 12px; }
