*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #0e0e0f; color: #e8e6e0; font-size: 13px; min-height: 100vh; }
a { color: #3b82f6; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: #888580; }
.small { font-size: 11px; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; background: #161618; border-bottom: 1px solid rgba(255,255,255,0.08); position: sticky; top: 0; z-index: 5; }
.brand { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #e8541a; white-space: nowrap; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; color: #888580; font: inherit; font-weight: 500; padding: 0 12px; cursor: pointer; height: 100%; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: #e8e6e0; text-decoration: none; }
.tab.active { color: #e8e6e0; border-bottom-color: #e8541a; }
.pill { font-size: 10px; font-family: monospace; background: #26262a; color: #888580; padding: 1px 6px; border-radius: 8px; }
.pill.hot { background: rgba(232,84,26,0.2); color: #f97316; }
.pill.red { background: rgba(239,68,68,0.18); color: #ef4444; }
.topbar .spacer { flex: 1; }
.topbar .user { color: #888580; font-size: 12px; white-space: nowrap; }
.topbar .links { display: flex; gap: 14px; font-size: 12px; white-space: nowrap; }

/* layout */
.page { padding: 18px 20px 40px; }
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bar h2 { font-size: 16px; font-weight: 500; }
.bar .grow { flex: 1; }
.panel { background: #161618; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.empty { padding: 40px; text-align: center; color: #888580; }

/* controls */
button, .btn { font: inherit; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 6px 12px; cursor: pointer; border: 1px solid rgba(255,255,255,0.12); background: #1e1e21; color: #e8e6e0; }
button:hover:not(:disabled), .btn:hover { background: #26262a; text-decoration: none; }
button.primary { background: #e8541a; border-color: #e8541a; color: #fff; }
button.primary:hover:not(:disabled) { background: #d14a15; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.link { background: none; border: none; color: #3b82f6; padding: 0; font-weight: 400; }
input, select, textarea { font: inherit; font-size: 12px; background: #1e1e21; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 6px 8px; color: #e8e6e0; outline: none; color-scheme: dark; }
input:focus, select:focus, textarea:focus { border-color: #e8541a; }
label { display: block; font-size: 11px; color: #888580; margin: 10px 0 4px; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; background: #161618; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #888580; padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.done td { opacity: 0.6; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
tr.today td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.co { font-weight: 600; }
.phone a { font-family: monospace; font-size: 13px; display: block; white-space: nowrap; }
.research { max-width: 260px; color: #b5b2ab; font-size: 12px; }
.edit { display: flex; flex-direction: column; gap: 6px; }
.edit .row { display: flex; gap: 6px; flex-wrap: wrap; }
.edit select { flex: 1; min-width: 130px; }
.edit input[type=datetime-local] { width: 185px; flex: none; }
.edit textarea { width: 100%; resize: vertical; min-height: 46px; line-height: 1.4; }

/* calling tables: fixed columns so the notes box gets the spare width, striped rows for long lists */
.calltable { table-layout: fixed; }
.calltable .c-due { width: 150px; }
.calltable .c-co { width: 21%; }
.calltable .c-ph { width: 135px; }
.calltable .c-re { width: 27%; }
.calltable .c-st { width: 125px; }
.calltable .research { max-width: none; }
.calltable td { border-bottom: 1px solid rgba(255,255,255,0.1); padding-top: 11px; padding-bottom: 11px; overflow-wrap: anywhere; }
.calltable tbody tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
.calltable tbody tr:hover td { background: rgba(232,84,26,0.07); }
.due-over { color: #ef4444; font-weight: 600; }
.due-today { color: #f59e0b; font-weight: 600; }
.err { color: #ef4444; font-size: 11px; }
.ok { color: #22c55e; font-size: 11px; }

/* status badges */
.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; white-space: nowrap; background: rgba(136,133,128,0.15); color: #888580; }
.s-New { background: rgba(59,130,246,0.15); color: #3b82f6; }
.s-NoAnswer { background: rgba(245,158,11,0.15); color: #f59e0b; }
.s-Callback, .s-EmailRequested, .s-Replied { background: rgba(168,85,247,0.15); color: #c084fc; }
.s-MeetingBooked, .s-Interested { background: rgba(34,197,94,0.15); color: #22c55e; }
.s-NotInterested, .s-Dead { background: rgba(239,68,68,0.15); color: #ef4444; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.modal-inner { background: #161618; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; width: 640px; max-width: 100%; max-height: 85vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); font-weight: 600; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.hist { border-left: 2px solid rgba(255,255,255,0.1); padding: 2px 0 12px 12px; }
.hist .when { font-size: 11px; color: #888580; }

/* auth pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth .panel { width: 340px; max-width: 100%; }
.auth h1 { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #e8541a; }
.auth h2 { font-size: 18px; font-weight: 500; margin: 6px 0 4px; }
.auth input { width: 100%; padding: 8px 10px; font-size: 13px; }
.auth button { width: 100%; margin-top: 16px; padding: 9px; }
.auth .err, .auth .ok { margin-top: 10px; font-size: 12px; }

/* admin */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { width: 220px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric { background: #161618; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 12px 14px; }
.metric .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.secret { font-family: monospace; font-size: 14px; background: #0e0e0f; border: 1px dashed #e8541a; border-radius: 6px; padding: 10px 12px; margin-top: 8px; user-select: all; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; }

/* phones and narrow windows: the top bar wraps and each contact becomes a card */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 6px 14px; position: static; }
  .tabs { order: 3; width: 100%; height: 40px; }
  .tab { white-space: nowrap; padding: 0 8px; font-size: 12px; }
  .tabs { overflow-x: auto; }
  .topbar .links { gap: 10px; flex-wrap: wrap; }
  .page { padding: 12px 10px 30px; }
  .bar { gap: 8px; }
  .calltable, .calltable tbody, .calltable tr, .calltable td { display: block; width: 100%; }
  .calltable thead { display: none; }
  .calltable tr { padding: 12px; border-bottom: 6px solid #0e0e0f; }
  .calltable td { border: none; padding: 3px 0; background: none !important; }
  .calltable tbody tr:nth-child(even) { background: rgba(255,255,255,0.03); }
  .calltable td[data-l]::before { content: attr(data-l) ": "; color: #888580; font-size: 11px; }
  .calltable tr.overdue { box-shadow: inset 3px 0 0 #ef4444; }
  .calltable tr.today { box-shadow: inset 3px 0 0 #f59e0b; }
  tr.overdue td:first-child, tr.today td:first-child { box-shadow: none; }
  .phone a { font-size: 17px; padding: 6px 0; }
  .statuscell > * { display: inline-block; margin: 0 8px 0 0 !important; vertical-align: middle; }
  .edit select, .edit textarea, .edit input[type=datetime-local] { font-size: 16px; padding: 9px 10px; }
  .edit input[type=datetime-local] { width: 100%; }
  .filters input[type=search] { width: 100%; }
}

/* outreach */
pre.mail { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.5; background: #0e0e0f; border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; padding: 12px; margin-top: 8px; color: #d6d3cc; }
.pill.ok { background: rgba(34,197,94,0.18); color: #22c55e; }
