[hidden] { display: none !important; }
:root {
  --teal: #458684;
  --teal-2: #5aa3a0;
  --teal-soft: #e6f1f0;
  --navy: #0f1e33;
  --navy-2: #172a45;
  --ink: #142235;
  --muted: #64748b;
  --line: #e3e8ef;
  --bg: #f4f6f9;
  --card: #ffffff;
  --red: #c2413a;
  --red-soft: #fbeceb;
  --amber: #b7791f;
  --amber-soft: #fdf4e3;
  --green: #2f855a;
  --green-soft: #e8f5ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 30, 51, .05), 0 4px 16px rgba(15, 30, 51, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Outfit", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
button, input, textarea { font: inherit; color: inherit; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12.5px; margin: .7em 0 0; }

/* Buttons */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .55em 1.1em; cursor: pointer; font-weight: 500; transition: .15s; }
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: #3a7472; color: #fff; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { padding: .35em .9em; font-size: 13px; }
.btn.wide { width: 100%; margin-top: .6em; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .5em; margin-top: .6em; }
.btn-row .btn { flex: 1; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: .8em 1.4em; background: var(--navy); color: #fff; }
.brand-mark { display: flex; align-items: center; gap: .5em; font-weight: 700; font-size: 16px; }
.brand-mark .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--teal-2); box-shadow: 0 0 0 4px rgba(90, 163, 160, .25); }
.brand-mark .sub { font-weight: 400; opacity: .7; margin-left: .3em; }
.top-right { display: flex; align-items: center; gap: 1em; }
.top-right .btn { color: #fff; border-color: rgba(255,255,255,.25); }
.spend { min-width: 210px; }
.spend-label { font-size: 12px; opacity: .85; display: flex; justify-content: space-between; gap: 1em; }
.bar { height: 6px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; width: 0; background: var(--teal-2); transition: width .4s; }
.live { font-size: 12px; padding: .25em .7em; border-radius: 99px; background: rgba(255,255,255,.1); }
.live.on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; margin-right: 6px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.banner { margin: 1em 1.4em 0; padding: .8em 1em; border-radius: var(--radius); background: var(--amber-soft); color: #7a4f12; border: 1px solid #f1dcb0; }

/* Layout */
.layout { display: grid; grid-template-columns: 300px minmax(320px, 1fr) minmax(380px, 1.1fr); gap: 1em; padding: 1em 1.4em 2em; align-items: start; }
.col { display: flex; flex-direction: column; gap: 1em; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1em; box-shadow: var(--shadow); }
.field { display: block; margin-bottom: .8em; }
.label { display: block; font-size: 12px; color: var(--muted); margin-bottom: .35em; text-transform: uppercase; letter-spacing: .04em; }
input[type=number], input[type=email], input[type=text], input[type=password], .search, textarea { width: 100%; padding: .55em .75em; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, textarea:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; }
.check { display: flex; gap: .5em; align-items: center; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: .35em; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: .25em .75em; cursor: pointer; font-size: 13px; background: #fff; user-select: none; }
.chip.on { background: var(--teal-soft); border-color: var(--teal); color: #2c605e; font-weight: 500; }
.chip.warn { border-style: dashed; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5em; }
.tile { background: var(--bg); border-radius: 10px; padding: .6em; text-align: center; }
.tile b { display: block; font-size: 20px; }
.tile span { font-size: 11.5px; color: var(--muted); }

.job-now { padding: .7em .8em; border-radius: 10px; background: var(--teal-soft); color: #2c605e; font-weight: 500; }
.job-now.idle { background: var(--bg); color: var(--muted); font-weight: 400; }
.job-now small { display: block; font-weight: 400; opacity: .8; margin-top: .2em; }
.job-history { list-style: none; padding: 0; margin: .8em 0 0; font-size: 12.5px; color: var(--muted); max-height: 160px; overflow: auto; }
.job-history li { padding: .3em 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: .5em; }

/* Feed */
.feed-card { height: calc(100vh - 110px); display: flex; flex-direction: column; position: sticky; top: 76px; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; }
.progress { font-size: 12.5px; color: var(--teal); font-weight: 500; text-align: right; }
.feed { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; display: flex; flex-direction: column-reverse; }
.feed li { display: grid; grid-template-columns: 22px 1fr auto; gap: .5em; padding: .45em .2em; border-bottom: 1px solid var(--line); animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(-4px); } }
.feed .ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; background: var(--bg); }
.feed .t { font-size: 13px; word-break: break-word; }
.feed .t b { font-weight: 600; }
.feed .time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.feed li.search .ic { background: #e8eefc; } .feed li.fetch .ic, .feed li.read .ic { background: #eef7e8; }
.feed li.thinking .t { color: var(--muted); font-style: italic; }
.feed li.lead .ic, .feed li.send .ic { background: var(--teal-soft); }
.feed li.error .ic { background: var(--red-soft); } .feed li.error .t { color: var(--red); }
.feed li.job .t { font-weight: 600; }
.feed li.replay { opacity: .7; }

/* Leads */
.leads-card { min-height: 60vh; }
.leads-head { display: flex; justify-content: space-between; gap: .6em; align-items: center; flex-wrap: wrap; margin-bottom: .6em; }
.tabs { display: flex; flex-wrap: wrap; gap: .2em; }
.tabs button { border: 0; background: transparent; padding: .4em .7em; border-radius: 99px; cursor: pointer; color: var(--muted); font-size: 13px; }
.tabs button.on { background: var(--navy); color: #fff; }
.tabs button .n { opacity: .7; margin-left: .3em; font-size: 12px; }
.search { margin-bottom: .6em; }
.leads { list-style: none; margin: 0; padding: 0; }
.leads li { padding: .75em .6em; border: 1px solid var(--line); border-radius: 12px; margin-bottom: .5em; cursor: pointer; transition: .15s; }
.leads li:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.lrow { display: flex; justify-content: space-between; gap: .6em; align-items: baseline; }
.lname { font-weight: 600; }
.lmeta { font-size: 12.5px; color: var(--muted); margin-top: .15em; }
.lsubject { font-size: 13px; margin-top: .35em; }
.tag { font-size: 11.5px; padding: .15em .55em; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tag.good { background: var(--green-soft); color: var(--green); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.teal { background: var(--teal-soft); color: #2c605e; }
.empty { color: var(--muted); text-align: center; padding: 2em 1em; }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(15, 30, 51, .35); z-index: 10; display: flex; justify-content: flex-end; }
.drawer-inner { width: min(720px, 100%); height: 100%; background: #fff; overflow: auto; padding: 1.4em 1.6em 3em; position: relative; }
.close { position: absolute; top: 1em; right: 1em; }
.d-head h3 { font-size: 22px; margin-bottom: .2em; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6em 1.2em; margin: 1em 0; }
.d-grid div span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.d-grid a { color: var(--teal); word-break: break-all; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.4em 0 .6em; }
.wp { border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 10px; padding: .7em .9em; margin-bottom: .6em; }
.wp .area { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--amber); font-weight: 600; }
.wp .issue { font-weight: 600; margin: .15em 0; }
.wp .ev { font-size: 13px; color: var(--muted); }
.wp .fix { font-size: 13px; margin-top: .3em; } .wp .fix b { color: var(--teal); }
.wp.used { border-left-color: var(--teal); }
.email-box { border: 1px solid var(--line); border-radius: 12px; padding: 1em; background: #fbfcfd; }
.email-box textarea { min-height: 260px; resize: vertical; line-height: 1.55; }
.email-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin: .4em 0 .8em; flex-wrap: wrap; gap: .5em; }
.actions { display: flex; flex-wrap: wrap; gap: .5em; margin-top: 1em; }
.blocker { margin-top: .8em; padding: .6em .8em; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { padding: .3em 0 .3em 1.2em; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 0; top: .75em; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.timeline li.done::before { background: var(--teal); }
.timeline li.now::before { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #1d3a5c, var(--navy) 60%); padding: 16px; }
.login-card { width: min(400px, 100%); background: #fff; border-radius: 18px; padding: 2em; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card .brand-mark { color: var(--navy); margin-bottom: 1.2em; }
.login-card h1 { font-size: 28px; }
.login-card form { margin-top: 1.4em; }
.login-card label { font-size: 13px; color: var(--muted); }
.error { color: var(--red); font-size: 13px; margin: .6em 0 0; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .7em 1.2em; border-radius: 99px; z-index: 20; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.bad { background: var(--red); }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 290px 1fr; }
  .col.right { grid-column: 1 / -1; }
  .feed-card { height: 520px; position: static; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: 1em 16px; }
  .topbar { flex-wrap: wrap; padding: .8em 16px; }
  .spend { min-width: 0; flex: 1; }
  .d-grid { grid-template-columns: 1fr; }
}
.label.mt { margin-top: .7em; }
