/* Manual — Outley outbound console.
   One operator, long sessions, lots of reading. Dark by default, generous
   line-height in the email review pane, and a layout that keeps the review
   keyboard shortcuts reachable without scrolling. */

:root {
  --bg:        #0d1117;
  --bg-2:      #131a23;
  --panel:     #161d27;
  --panel-2:   #1c2531;
  --line:      #242e3b;
  --line-2:    #303c4b;
  --text:      #e6edf3;
  --text-2:    #9fb0c3;
  --muted:     #6b7d92;
  --accent:    #4c8dff;
  --accent-2:  #2f6fe0;
  --good:      #3fb950;
  --warn:      #d29922;
  --bad:       #f85149;
  --radius:    10px;
  --radius-sm: 7px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* Any explicit `display` on an element beats the UA's `[hidden]{display:none}`.
   The modal backdrop (display:grid) therefore stayed as a full-screen invisible
   layer that swallowed every click in the app. Make `hidden` authoritative. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--sans);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; cursor: pointer; }
h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; color: var(--text-2); }
p  { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ───────────────────────── login ───────────────────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #16202e 0%, var(--bg) 60%);
}
.login-card {
  width: 340px; padding: 32px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-card .brand { margin-bottom: 2px; }
.login-card p { margin-bottom: 10px; }

/* ───────────────────────── shell ───────────────────────── */
#app { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 15px; letter-spacing: -0.01em;
}
.brand-mark {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #7b5cff);
  color: #fff; font-size: 13px; font-weight: 700;
}
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); }
.sidebar-foot { margin-top: auto; }

main { padding: 26px 30px 60px; max-width: 1500px; overflow-x: hidden; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}

/* ───────────────────────── controls ───────────────────────── */
.btn {
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 550; font-family: inherit;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #24303f; border-color: #3d4b5d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.btn.good { background: var(--good); border-color: var(--good); color: #06210c; }
.btn.bad  { background: transparent; border-color: #5a2b2b; color: #ff8b83; }
.btn.bad:hover:not(:disabled) { background: #2a1616; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input, textarea, select {
  background: var(--bg); border: 1px solid var(--line-2); color: var(--text);
  padding: 9px 11px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; width: 100%;
  /* Flex items default to min-width:auto, so an <input> refuses to shrink
     below its intrinsic ~20-character width and bursts out of its container
     (the login card, the filter rows). */
  min-width: 0;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,141,255,.15);
}
textarea { resize: vertical; line-height: 1.65; }
label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.field { margin-bottom: 14px; }
.checkbox { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.checkbox input { width: auto; }

/* ───────────────────────── panels ───────────────────────── */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
@media (max-width: 1000px) { .grid.two { grid-template-columns: 1fr; } }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 25px; font-weight: 650; margin-top: 3px; letter-spacing: -0.02em; }
.stat .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ───────────────────────── table ───────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-2); color: var(--text-2); font-weight: 550; font-size: 12px;
     position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: var(--panel); }
tbody tr:last-child td { border-bottom: none; }
td.wrap { max-width: 380px; }

/* Briefs are a paragraph long. Clamping them just truncated mid-sentence, so
   they now live in a collapsible block under the company name — full text when
   you want it, zero row height when you don't. */
tr.brief-row td { background: var(--bg-2); padding: 0 12px 12px; }
.brief-body {
  padding: 11px 13px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12.5px; line-height: 1.65;
  white-space: normal;
}
.brief-toggle { font-size: 12px; }

/* CRM row controls */
tr.is-called { background: rgba(63, 185, 80, .05); }
tr.is-called td:first-child { box-shadow: inset 2px 0 0 var(--good); }
td .note {
  min-height: 42px; font-size: 12.5px; padding: 6px 8px; line-height: 1.45;
  resize: vertical;
}
td .outcome { font-size: 12.5px; padding: 6px 8px; }
.call-box { width: 16px; height: 16px; cursor: pointer; accent-color: var(--good); }
#save-hint { color: var(--good); }
.cell-sub { color: var(--muted); font-size: 12px; }

.pill {
  display: inline-block; padding: 2px 7px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--line-2); color: var(--text-2);
  white-space: nowrap;
}
.pill.safe    { color: #7ee787; border-color: #2c5233; background: #12281a; }
.pill.unknown { color: #d8b44a; border-color: #4a3b16; background: #241d0d; }
.pill.risky   { color: #ffa657; border-color: #5a3a1c; background: #271a0e; }
.pill.invalid { color: #ff8b83; border-color: #5a2b2b; background: #271414; }
.pill.blue    { color: #79c0ff; border-color: #1f4b7a; background: #0f2338; }
.pill.green   { color: #7ee787; border-color: #2c5233; background: #12281a; }
.pill.grey    { color: var(--muted); }

/* ───────────────────────── review ───────────────────────── */
.review-shell { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .review-shell { grid-template-columns: 1fr; } }

.review-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.counter { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }
.email-meta {
  display: flex; gap: 14px; flex-wrap: wrap; padding-bottom: 12px;
  margin-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.email-meta .who { font-weight: 600; }
.email-body {
  width: 100%; min-height: 340px; font-family: var(--sans); font-size: 14px; line-height: 1.7;
}
.subject-input { font-weight: 600; }
.kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted);
  background: var(--bg);
}

.progress { height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }

/* ───────────────────────── preview cards ───────────────────────── */
.preview-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; background: var(--bg-2);
}
.preview-card .to { font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.preview-card .subj { font-weight: 600; margin-bottom: 8px; }
.preview-card .body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.65; color: var(--text-2); }

/* ───────────────────────── misc ───────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  padding: 10px 18px; border-radius: 9px; font-size: 13.5px; z-index: 100;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.toast.bad { border-color: #5a2b2b; color: #ff8b83; }
.toast.good { border-color: #2c5233; color: #7ee787; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,12,.72);
  display: grid; place-items: center; z-index: 200; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 22px; width: 100%; max-width: 560px; max-height: 86vh; overflow: auto;
}

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 8px 15px; cursor: pointer; color: var(--muted); font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 520;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.hint {
  background: #0f1a2a; border: 1px solid #1f3b5c; color: #9dc3f0;
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 14px;
}
.hint.warn { background: #241d0d; border-color: #4a3b16; color: #d8b44a; }
