/* UPRE Outreach Engine — Fraunces/Inter, sage-green-on-cream */
:root {
  --cream:        #FAF7EE;
  --cream-2:      #F3EFE3;
  --cream-3:      #E8E3D1;
  --white:        #FFFFFF;
  --sidebar-bg:   #0E2A1E;
  --sidebar-hover:#1A3D2B;
  --sidebar-active:#2C5C45;
  --sage:         #2C5C45;
  --sage-light:   #3D7A5C;
  --ink:          #1C2B22;
  --ink-dim:      #4A6355;
  --ink-faint:    #7A9485;
  --line:         #DDD8C6;
  --owed:         #C0392B;
  --owed-edge:    #E74C3C;
  --hot:          #D35400;
  --going:        #B7950B;
  --cold:         #C75820;
  --awaiting:     #6B7280;
  --good:         #1E7A46;
  --sidebar-w:    220px;
  --radius:       10px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  display: flex;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sage); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; }

/* ── sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 50;
}
.sidebar-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: #FAF7EE;
  line-height: 1.25;
}
.sidebar-brand .sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: rgba(250,247,238,0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-top: 3px;
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 14px;
  color: rgba(250,247,238,0.65);
  text-decoration: none;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #FAF7EE; text-decoration: none; }
.sidebar-nav a.active { background: var(--sidebar-active); color: #FAF7EE; }
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-footer a { color: rgba(250,247,238,0.35); font-size: 12px; }
.sidebar-footer a:hover { color: rgba(250,247,238,0.7); text-decoration: none; }
.paused-badge {
  display: block;
  background: var(--owed);
  color: white;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 5px 8px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* ── main content ──────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px;
  background: var(--cream);
}
h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 20px;
  line-height: 1.2;
}
h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 20px 0 8px;
}
.muted  { color: var(--ink-dim); }
.faint  { color: var(--ink-faint); font-size: 13px; }

/* ── login ─────────────────────────────────────────────── */
.login-outer {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
}
.login-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 36px;
  max-width: 360px;
  width: 100%;
}
.login-wrap .brand {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 22px;
  text-align: center;
}

/* ── panels ────────────────────────────────────────────── */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

/* ── buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--sage); background: var(--cream-2); text-decoration: none; }
.btn-primary { background: var(--sage); border-color: var(--sage); color: white; }
.btn-primary:hover { background: var(--sage-light); border-color: var(--sage-light); color: white; }
.btn-good { background: var(--good); border-color: var(--good); color: white; }
.btn-good:hover { background: #256B3E; border-color: #256B3E; color: white; }
.btn-danger { background: var(--owed); border-color: var(--owed); color: white; }
.btn-danger:hover { background: #A93226; border-color: #A93226; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── forms ─────────────────────────────────────────────── */
input[type=text],input[type=password],input[type=number],textarea,select {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sage); }
textarea { resize: vertical; min-height: 64px; }
label {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  font-weight: 500;
  margin: 10px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field { margin-bottom: 10px; }

/* ── badges ────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.owed      { background: #FEF0EF; color: var(--owed);    border: 1px solid #F5C6C4; }
.badge.going-cold{ background: #FFF8E6; color: var(--going);   border: 1px solid #F0D880; }
.badge.cold      { background: #FFF3DC; color: var(--cold); }
.badge.awaiting  { background: #F3F4F6; color: var(--awaiting); }
.badge.new       { background: var(--cream-2); color: var(--ink-faint); }
.badge.excluded  { background: #F3F4F6; color: var(--ink-faint); }
.badge.hot       { background: #FEF3EC; color: var(--hot);     border: 1px solid #FAC89F; }
.badge.stage     { background: #EBF4EF; color: var(--sage); }
.badge.tag       { background: #EDF2FF; color: #4361EE; }
.badge.review    { background: #F5EDFF; color: #7B2FBE;        border: 1px solid #D4A8FF; }
.badge.good      { background: #EBF8EF; color: var(--good); }

/* ── toolbar / chips ───────────────────────────────────── */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.chip {
  font-size: 12px;
  color: var(--ink-dim);
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  background: var(--white);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--sage); text-decoration: none; }
.chip.active { background: var(--sage); color: white; border-color: var(--sage); }

/* ── bulk reply bar ────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #EBF4EF;
  border: 1px solid #BDD9CA;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-dim);
  flex-wrap: wrap;
}
.bulk-bar .grow { flex: 1; min-width: 8px; }

/* ── inbox rows (three-zone) ───────────────────────────── */
.inbox-row {
  display: grid;
  grid-template-columns: 5px 1fr auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.inbox-row:hover { box-shadow: 0 2px 8px rgba(28,43,34,0.08); border-color: #C8C2AC; }
.inbox-row.row-sent { opacity: 0.4; pointer-events: none; transition: opacity 0.5s; }

.row-edge { background: var(--cream-3); }
.inbox-row.owed       .row-edge { background: var(--owed-edge); }
.inbox-row.going-cold .row-edge { background: var(--going); }
.inbox-row.cold       .row-edge { background: var(--cold); }
.inbox-row.awaiting   .row-edge { background: var(--awaiting); }
.inbox-row.new        .row-edge { background: #D1D5DB; }
.inbox-row.excluded   .row-edge { background: #E5E7EB; }

.row-body { padding: 12px 14px; min-width: 0; }
.row-link { display: block; color: inherit; text-decoration: none; }
.row-link:hover { text-decoration: none; }
.row-top  { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 4px; }
.row-name { font-weight: 600; font-size: 15px; }
.row-meta { color: var(--ink-faint); font-size: 12px; margin-bottom: 2px; }
.row-last { font-size: 13px; color: var(--ink-dim); margin: 3px 0; }
.row-draft {
  font-size: 13px;
  background: #F5F2E8;
  border-left: 3px solid var(--sage-light);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  margin-top: 6px;
  color: var(--ink-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.row-draft .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sage);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 14px;
  gap: 7px;
  min-width: 130px;
  border-left: 1px solid var(--cream-3);
  background: var(--cream);
}
.row-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--sage); }
.row-actions { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.row-result { font-size: 12px; display: inline-block; }
.row-result.ok  { color: var(--good); font-weight: 600; }
.row-result.err { color: var(--owed); }

/* ── chat bubbles ──────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble .t { display: block; font-size: 10px; margin-top: 5px; }
.bubble.in {
  align-self: flex-start;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
  color: var(--ink);
}
.bubble.in .t { color: var(--ink-faint); }
.bubble.out {
  align-self: flex-end;
  background: var(--sage);
  color: white;
  border-bottom-right-radius: 3px;
}
.bubble.out .t { color: rgba(255,255,255,0.55); }
.bubble.failed { background: #FEF0EF; border: 1px solid #F5C6C4; color: var(--owed); }

/* ── two-col layout (conversation) ────────────────────── */
.cols { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media(min-width:860px) { .cols { grid-template-columns: 1fr 320px; } }
.crm dt { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 10px; font-weight: 600; }
.crm dd { margin: 3px 0 0; font-size: 14px; }

/* ── tables ────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-faint); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; background: var(--cream-2); }
tr:hover td { background: var(--cream); }

/* ── stat grid ─────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
@media(min-width:680px) { .stat-grid { grid-template-columns: repeat(4,1fr); } }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-family: 'Fraunces', Georgia, serif; font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat .l { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.stat.alert .n { color: var(--owed); }
.stat.hot .n   { color: var(--hot); }
.stat.good .n  { color: var(--good); }

/* ── modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14,42,30,0.72);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(720px, 96vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
}

/* ── notices ───────────────────────────────────────────── */
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.notice.ok  { background: #EBF8EF; border: 1px solid #A7D9B8; color: var(--good); }
.notice.err { background: #FEF0EF; border: 1px solid #F5C6C4; color: var(--owed); }
.flash { animation: flash 1s ease; }
@keyframes flash { 0% { background: #EBF8EF; } 100% { background: transparent; } }

/* ── misc ──────────────────────────────────────────────── */
.playbook-btns { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }

/* ── mobile ────────────────────────────────────────────── */
@media(max-width:680px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .inbox-row { grid-template-columns: 5px 1fr; }
  .row-side {
    grid-column: 2;
    border-left: none;
    border-top: 1px solid var(--cream-3);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    min-width: 0;
  }
  .row-meta, .badge.tag { display: none; }
}
