/* ============================================================
   Overture — warm editorial "outreach studio"
   Paper + ink + clay. Fraunces display / Hanken Grotesk body.
   ============================================================ */

:root {
  --paper:      #FBF7F0;
  --paper-2:    #F4ECDF;
  --card:       #FFFDF8;
  --ink:        #241C15;
  --ink-soft:   #756657;
  --ink-faint:  #A89A88;
  --line:       #EADFCF;
  --accent:     #BC5A33;
  --accent-deep:#9C4524;
  --accent-wash:#F7E7DB;
  --green:      #2F6E4F;
  --green-wash: #E4EFE7;
  --amber:      #9A6A14;
  --amber-wash: #F6ECD3;
  --red:        #AE3A2C;
  --red-wash:   #F6E1DB;
  --blue:       #2C5A77;
  --blue-wash:  #E2ECF1;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:  "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(50,36,22,.05), 0 1px 3px rgba(50,36,22,.04);
  --shadow-md: 0 2px 6px rgba(50,36,22,.05), 0 14px 34px rgba(50,36,22,.08);
  --shadow-lg: 0 8px 18px rgba(50,36,22,.07), 0 30px 60px rgba(50,36,22,.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: .005em;
}
/* atmosphere: soft warm light pooling top-left + a faint second glow */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(188,90,51,.10), transparent 60%),
    radial-gradient(820px 620px at 102% 8%, rgba(47,110,79,.07), transparent 55%),
    var(--paper);
}
/* fine grain overlay */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 540; letter-spacing: -.01em; margin: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-wash); }

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

.nav {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,253,248,.6), rgba(244,236,223,.5));
  backdrop-filter: blur(4px);
}
.brand {
  font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -.02em;
  display: flex; align-items: baseline; gap: 1px; padding: 4px 10px 22px;
}
.brand .mark { color: var(--accent); }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-md);
  color: var(--ink-soft); font-weight: 500; cursor: pointer; transition: all .16s ease;
}
.nav-link svg { width: 18px; height: 18px; opacity: .8; }
.nav-link:hover { background: rgba(188,90,51,.07); color: var(--ink); }
.nav-link.active { background: var(--ink); color: var(--paper); }
.nav-link.active svg { opacity: 1; }
.nav-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.who .av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.who .meta { font-size: 12.5px; line-height: 1.3; }
.who .meta b { font-weight: 600; }
.who .meta span { color: var(--ink-faint); }
.signout {
  display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 6px;
  padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-faint);
  font-size: 13px; cursor: pointer; background: none; border: 0; font-family: inherit;
}
.signout:hover { background: var(--red-wash); color: var(--red); }
.signout svg { width: 16px; height: 16px; }

/* ---------- stage ---------- */
.stage { padding: 44px 52px; max-width: 1080px; width: 100%; animation: rise .5s ease both; }
.lockbar { background: var(--amber-wash); color: #6e4d10; border: 1px solid #e7d9b3; border-radius: var(--r-md); padding: 11px 16px; margin-bottom: 22px; font-size: 13.5px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 30px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.page-head h1 { font-size: 34px; line-height: 1.08; }
.page-head .lede { color: var(--ink-soft); margin-top: 8px; max-width: 60ch; font-size: 15px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); cursor: pointer; font-size: 13px; margin-bottom: 18px; }
.back:hover { color: var(--accent); }
.back svg { width: 15px; height: 15px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  padding: 11px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-deep); box-shadow: var(--shadow-md); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #3a2e22; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-faint); background: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.07); }
.btn-danger { background: var(--card); color: var(--red); border-color: var(--red-wash); }
.btn-danger:hover { background: var(--red-wash); }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card-h { font-size: 18px; margin-bottom: 4px; }
.card-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.hint { font-size: 12px; color: var(--ink-faint); }
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 13px; width: 100%; transition: border .15s, box-shadow .15s; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); background: #fff; }
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-row { margin-top: 16px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.sourced { background: var(--paper-2); color: var(--ink-soft); }
.pill.enriched { background: var(--blue-wash); color: var(--blue); }
.pill.drafted  { background: var(--amber-wash); color: var(--amber); }
.pill.approved, .pill.draft.ok { background: var(--green-wash); color: var(--green); }
.pill.sent     { background: var(--green); color: #fff; }
.pill.replied  { background: var(--amber); color: #fff; }
.pill.draft    { background: var(--paper-2); color: var(--ink-soft); }
.pill.unsubscribed, .pill.suppressed, .pill.rejected, .pill.bounce, .pill.complaint, .pill.unsubscribe { background: var(--red-wash); color: var(--red); }
.pill.manual { background: var(--paper-2); color: var(--ink-soft); }
.pill.active { background: var(--green-wash); color: var(--green); }

/* ---------- project cards ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.proj-card { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s; position: relative; overflow: hidden; }
.proj-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0; transition: opacity .16s; }
.proj-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #E0D3BF; }
.proj-card:hover::after { opacity: 1; }
.proj-card h3 { font-size: 19px; margin-bottom: 8px; }
.proj-card .offer { color: var(--ink-soft); font-size: 13.5px; min-height: 40px; margin-bottom: 14px; }
.proj-card .foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-faint); }

/* ---------- pipeline stepper ---------- */
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 8px 0 28px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 15px; position: relative; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.step .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--paper-2); color: var(--ink-soft); }
.step.done .ico { background: var(--green-wash); color: var(--green); }
.step.ready .ico { background: var(--accent-wash); color: var(--accent); }
.step .ico svg { width: 18px; height: 18px; }
.step .n { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.step .t { font-family: var(--serif); font-size: 16px; }
.step .count { font-size: 12.5px; color: var(--ink-soft); margin-top: -2px; min-height: 18px; }
.step .count b { color: var(--ink); font-weight: 600; }
.step .btn { margin-top: 4px; }
.step .arrow { position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--line); z-index: 2; }
.step:last-child .arrow { display: none; }

/* ---------- stats ---------- */
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 20px; min-width: 96px; box-shadow: var(--shadow-sm); }
.stat .n { font-family: var(--serif); font-size: 28px; line-height: 1; }
.stat .l { font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin: 26px 0 22px; }
.tab { padding: 0 2px 14px; cursor: pointer; color: var(--ink-faint); font-weight: 600; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tab:hover { color: var(--ink-soft); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); padding: 13px 18px; background: var(--paper-2); }
td { padding: 14px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: rgba(188,90,51,.03); }
.who-cell { display: flex; align-items: center; gap: 11px; }
.who-cell .av { width: 32px; height: 32px; border-radius: 50%; background: var(--paper-2); color: var(--ink-soft); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.who-cell .nm { font-weight: 600; }
.who-cell .tt { font-size: 12px; color: var(--ink-faint); }
.conf { display: inline-flex; align-items: center; gap: 8px; }
.conf .bar { width: 46px; height: 5px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.conf .bar i.low { background: var(--amber); }

/* ---------- email preview (approval queue) ---------- */
.mailcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); margin-bottom: 16px; overflow: hidden; }
.mail-top { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.mail-to { display: flex; align-items: center; gap: 11px; }
.mail-to .av { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.mail-to .nm { font-weight: 600; }
.mail-to .em { font-size: 12.5px; color: var(--ink-faint); }
.mail-body { padding: 6px 20px 4px; }
.mail-subject { font-family: var(--serif); font-size: 17px; padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.mail-subject input { font-family: var(--serif); font-size: 17px; border: 0; background: none; padding: 0; }
.mail-subject input:focus { box-shadow: none; }
.mail-text { white-space: pre-wrap; line-height: 1.65; color: #3a3026; padding: 14px 0; font-size: 14px; }
.mail-body textarea.m-body { border: 0; background: none; font-family: var(--sans); font-size: 14px; line-height: 1.65; color: #3a3026; padding: 12px 0 16px; min-height: 120px; width: 100%; resize: vertical; }
.mail-body textarea.m-body:focus { box-shadow: none; outline: none; }
.mail-subject input.m-subj { padding: 4px 0; }
.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--card); }
.mail-actions .spacer { flex: 1; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 64px 24px; border: 1px dashed var(--line); border-radius: var(--r-lg); background: rgba(255,253,248,.5); }
.empty .e-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; margin: 0 auto 18px; }
.empty .e-ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: 21px; margin-bottom: 8px; }
.empty p { color: var(--ink-soft); max-width: 42ch; margin: 0 auto 20px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 380px; max-width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 40px 36px; box-shadow: var(--shadow-lg); position: relative; }
.login .brand { justify-content: center; padding: 0 0 6px; font-size: 32px; }
.login .tag { text-align: center; color: var(--ink-soft); margin-bottom: 28px; font-size: 14px; }
.login .field + .field { margin-top: 14px; }
.login .btn { margin-top: 22px; }
.login .foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--ink-faint); }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 16px);
  background: var(--ink); color: var(--paper); padding: 13px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0;
  transition: all .25s cubic-bezier(.2,.8,.2,1); pointer-events: none; z-index: 100;
  display: flex; align-items: center; gap: 10px; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); color: #fff; }
#toast.ok::before { content: "✓"; font-weight: 700; }

.spin { animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.muted { color: var(--ink-soft); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .stage { padding: 28px 22px; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .step .arrow { display: none; }
}
