@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
*{box-sizing:border-box}
body{font-family:Poppins,system-ui,sans-serif;margin:0;color:#1a1a2e;background:#f4f6fb}
.wrap{max-width:1180px;margin:0 auto;padding:0 24px 48px}
h1,h2,h3{color:#28266B} h1{font-weight:600;font-size:1.5rem} h2{font-weight:600;font-size:1.15rem;margin-top:32px}
a{color:#28266B;text-decoration:none} a:hover{text-decoration:underline}
.muted{color:#7a7f97;font-size:.85em}
.topbar{background:#28266B;color:#fff;padding:12px 24px;display:flex;align-items:center;justify-content:space-between;
        box-shadow:0 2px 10px #28266b33;border-bottom:3px solid #65D7EF}
.topbar .brand{display:flex;align-items:center;gap:12px;font-weight:600;font-size:1.05rem;color:#fff}
.topbar .brand .dot{width:11px;height:11px;border-radius:50%;background:#65D7EF;display:inline-block}
.topbar nav a{color:#cfd2ec;margin-left:18px;font-size:.92rem}
.topbar nav a:hover{color:#fff;text-decoration:none}
.topbar nav a.active{color:#fff;border-bottom:2px solid #65D7EF;padding-bottom:2px}
.topbar .user{display:flex;align-items:center;gap:14px}
.topbar .user .who{color:#65D7EF;font-weight:500}
.topbar .user .role{background:#65D7EF;color:#0c2d38;font-size:.72em;padding:1px 8px;border-radius:10px;font-weight:600;text-transform:uppercase}
.topbar .user .logout{color:#cfd2ec;font-size:.88rem}
table{border-collapse:collapse;width:100%;background:#fff;box-shadow:0 1px 6px #0001;border-radius:8px;overflow:hidden}
th,td{padding:8px 12px;border-bottom:1px solid #eef0f6;text-align:left;font-size:.9em;vertical-align:top}
th{background:#28266B;color:#fff;font-weight:500} tr:hover td{background:#f3f6ff}
.badge{display:inline-block;padding:1px 9px;border-radius:10px;font-size:.78em;font-weight:500;line-height:1.6}
.badge-auto{background:#65D7EF;color:#0c2d38}
.badge-confirmed{background:#28266B;color:#fff}
.badge-pending{background:#f6b73c;color:#3a2a00}
.badge-stale{background:#e0e3ee;color:#444}
.badge-admin{background:#28266B;color:#fff}
.badge-user{background:#e0e3ee;color:#222}
.badge-active{background:#1c6b34;color:#fff}
.badge-inactive{background:#9b1c1c;color:#fff}
pre{background:#0c1330;color:#cfe3ff;padding:12px;border-radius:8px;overflow-x:auto;font-size:.82em;margin:6px 0}
input[type=text],input[type=password],input[type=email],textarea,select{padding:7px 10px;border:1px solid #c2c8de;border-radius:6px;font-family:inherit;font-size:.92rem}
input[type=text]{width:420px}
button{padding:6px 14px;background:#28266B;color:#fff;border:0;border-radius:6px;cursor:pointer;font-family:inherit;font-size:.9rem}
button:hover{background:#3a378f} button.ghost{background:#fff;color:#28266B;border:1px solid #c2c8de}
button.ghost:hover{background:#eef1fb} button.aqua{background:#65D7EF;color:#0c2d38}
button.aqua:hover{background:#8ce4f4}
button.danger{background:#9b1c1c;color:#fff} button.danger:hover{background:#b62a2a}
.chunk{background:#fff;border-left:4px solid #65D7EF;margin:10px 0;padding:10px 14px;box-shadow:0 1px 3px #0001;border-radius:0 6px 6px 0}
.card{background:#fff;border-radius:8px;box-shadow:0 1px 6px #0001;padding:16px 18px;margin:12px 0}
.fact-actions{white-space:nowrap}
.fact-edit{margin-top:8px;padding:10px;background:#f6f8ff;border:1px solid #dfe4f4;border-radius:6px}
.fact-edit input[type=text]{width:280px}
.fact-edit textarea{width:380px;height:38px;vertical-align:top}
details{margin:2px 0} details>summary{cursor:pointer;color:#28266B;font-size:.85em}
.kv{font-size:.9em} .kv b{color:#28266B}
.err{background:#fde8e8;color:#9b1c1c;padding:10px 14px;border-radius:6px;border:1px solid #f5c2c2;margin:10px 0}
.ok{background:#e7f6ec;color:#1c6b34;padding:10px 14px;border-radius:6px;border:1px solid #b6e0c2;margin:10px 0}
.aqua-callout{background:#e9f8fc;color:#0c2d38;padding:14px 18px;border-radius:8px;border-left:5px solid #65D7EF;margin:14px 0;font-size:.95em}
.aqua-callout code{background:#fff;padding:3px 8px;border-radius:4px;font-family:'Courier New',monospace;font-size:1.05em;color:#28266B;border:1px solid #c2c8de;user-select:all}
.must-change-banner{background:#fff3cd;color:#7a5b00;padding:12px 18px;border-radius:8px;border-left:5px solid #f6b73c;margin:10px 0 20px;font-weight:500}
.subnav{margin:0 0 18px;padding:6px 0;border-bottom:2px solid #eef1fb}
.subnav a{display:inline-block;padding:6px 14px;margin-right:6px;border-radius:6px 6px 0 0;font-size:.92rem}
.subnav a.active{background:#28266B;color:#fff}
.subnav a:hover:not(.active){background:#eef1fb;text-decoration:none}
.subnav .admin-only{margin-left:8px;font-size:.7em;background:#65D7EF;color:#0c2d38;padding:1px 7px;border-radius:8px;vertical-align:middle;font-weight:600}
.login-box{max-width:380px;margin:80px auto;background:#fff;border-radius:12px;box-shadow:0 6px 30px #28266b22;
           padding:34px 34px 30px;border-top:5px solid #65D7EF}
.login-box h1{margin:0 0 4px;font-size:1.35rem} .login-box .sub{color:#7a7f97;margin:0 0 22px;font-size:.9rem}
.login-box label{display:block;font-size:.85rem;color:#28266B;margin:12px 0 4px;font-weight:500}
.login-box input{width:100%}
.login-box button{width:100%;margin-top:20px;padding:9px}
.filters a{margin-right:10px;font-size:.85em}
.filters a.active{font-weight:600;text-decoration:underline}
.form-row{margin:10px 0}
.form-row label{display:inline-block;min-width:160px;font-size:.9em;color:#28266B;font-weight:500;vertical-align:top}
.form-row input[type=text],.form-row input[type=password],.form-row input[type=email],.form-row select{width:300px}
.user-row td{vertical-align:middle}
.user-row .countries-cell label{margin-right:10px;font-size:.85em;cursor:pointer}
.cc-chip{display:inline-block;background:#eef1fb;color:#28266B;padding:1px 7px;border-radius:8px;font-size:.78em;margin-right:3px}
/* Inbox tab (Task B) */
.badge-screen-i{background:#65D7EF;color:#0c2d38}
.badge-screen-u{background:#f6b73c;color:#3a2a00}
.badge-screen-n{background:#e0e3ee;color:#444}
.badge-analyzed{background:#28266B;color:#fff}
.badge-running{background:#65D7EF;color:#0c2d38;animation:pulse-aqua 1.4s ease-in-out infinite}
.badge-failed{background:#9b1c1c;color:#fff}
.badge-none{background:#e0e3ee;color:#666}
@keyframes pulse-aqua{0%,100%{box-shadow:0 0 0 0 #65d7ef88}50%{box-shadow:0 0 0 6px #65d7ef00}}
.inbox-card{background:#fff;border:1px solid #fde6c8;border-left:5px solid #f6b73c;border-radius:8px;
            box-shadow:0 1px 4px #0001;padding:14px 16px;margin:12px 0}
.inbox-card h3{margin:0 0 6px;font-size:1.02rem;color:#28266B}
.inbox-card .meta{color:#7a7f97;font-size:.82em;margin-bottom:8px}
.inbox-card .row{margin:6px 0}
.inbox-card label{display:block;font-size:.82em;color:#28266B;font-weight:500;margin-bottom:3px}
.inbox-card input[type=text]{width:100%;max-width:520px}
.didyou{margin:6px 0 10px;padding:8px 10px;background:#fffaf0;border:1px dashed #f6b73c;border-radius:6px}
.didyou .label{font-size:.82em;color:#7a5b00;margin-bottom:4px}
.didyou .chips{display:flex;flex-wrap:wrap;gap:6px}
.didyou .chip{background:#fff5e0;border:1px solid #f6c977;color:#7a5b00;padding:3px 9px;border-radius:14px;
              font-size:.8em;cursor:pointer;font-family:inherit}
.didyou .chip:hover{background:#ffe9b5}
.didyou .chip.selected{background:#f6b73c;color:#3a2a00;border-color:#d99a20;box-shadow:0 0 0 2px #f6b73c44}
.didyou .chip .pct{color:#9b7400;margin-left:3px;font-size:.92em}
.didyou .chip .e1{color:#28266B;margin-left:3px;font-weight:600}
.didyou .chip .addr{color:#1c6b34;margin-left:3px}
.didyou .clear{background:#fff;border:1px solid #d9dbe7;color:#444;padding:3px 9px;border-radius:14px;
               font-size:.8em;cursor:pointer;font-family:inherit}
.didyou .clear:hover{background:#eef1fb}
.toast{position:fixed;bottom:24px;right:24px;background:#28266B;color:#fff;padding:11px 18px;
       border-radius:8px;box-shadow:0 4px 18px #28266b55;font-size:.92em;z-index:9999;
       border-left:4px solid #65D7EF;max-width:380px}
.toast.err{background:#9b1c1c;border-left-color:#fff}
.empty-state{background:#fff;border:1px dashed #c2c8de;border-radius:8px;padding:30px;
             text-align:center;color:#7a7f97}
.inbox-banner{background:#e9f8fc;color:#0c2d38;padding:11px 18px;border-radius:8px;border-left:5px solid #65D7EF;
              margin:0 0 18px;font-size:.93em;display:flex;align-items:center;justify-content:space-between;gap:14px}
.inbox-banner a{color:#28266B;font-weight:600}

/* ── UI v2 additions (Jinja2 + HTMX views) ─────────────────────────────────── */
.filterbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:14px 0;
           background:#fff;padding:10px 14px;border-radius:8px;box-shadow:0 1px 6px #0001}
.filterbar select,.filterbar input[type=text]{padding:5px 9px;font-size:.88rem}
.filterbar input[type=text]{width:220px}
.filterbar label{font-size:.82em;color:#7a7f97;margin-right:2px}
.due-past{color:#9b1c1c;font-weight:600}
.num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.proj-sub{color:#9aa0b8;font-size:.78em;margin-top:2px}
.stage-chip{display:inline-block;background:#28266B;color:#fff;padding:1px 8px;
            border-radius:10px;font-size:.75em;font-weight:600}
.badge-rec-i{background:#1c6b34;color:#fff}
.badge-rec-u{background:#f6b73c;color:#3a2a00}
.badge-rec-n{background:#e0e3ee;color:#444}

/* ── Brand tooltip (ported from the legacy dashboard — see static/tooltip.js).
   Pinned bottom-right; .flipped = top-left when the trigger is in the
   bottom-right viewport quadrant. data-tip on any element; \n = newline. ── */
#brand-tooltip{
  position:fixed;right:20px;bottom:20px;max-width:380px;min-width:180px;
  background:#28266B;color:#fff;font-family:Poppins,'Inter',system-ui,sans-serif;
  font-size:12.5px;line-height:1.5;padding:11px 14px 11px 16px;border-radius:8px;
  border-left:3px solid #65D7EF;
  box-shadow:0 12px 28px -8px rgba(40,38,107,.45),0 4px 10px -2px rgba(0,0,0,.18);
  white-space:pre-wrap;word-wrap:break-word;pointer-events:none;z-index:99999;
  opacity:0;transform:translateY(4px);
  transition:opacity .12s ease-out,transform .12s ease-out}
#brand-tooltip.visible{opacity:1;transform:translateY(0)}
#brand-tooltip.flipped{right:auto;bottom:auto;left:20px;top:20px;
  border-left:0;border-right:3px solid #65D7EF}
[data-tip]::after{display:none!important;content:none!important}
.tip-hint{cursor:help;border-bottom:1px dotted #65D7EF}
/* vocab editor */
.vocab-value-row{display:flex;align-items:center;gap:8px;padding:3px 0}
.vocab-value-row .kw{color:#7a7f97;font-size:.82em}
.vocab-retired{opacity:.55}
.rates-ok{background:#1c6b34;color:#fff}
.rates-missing{background:#f6b73c;color:#3a2a00}
.badge-auto{background:#65D7EF;color:#0c2d38}
/* ── docked terminal panel (M9 / BC-44) ── */
#term-panel{position:fixed;left:0;right:0;bottom:0;background:#0c1330;color:#cfe3ff;
  z-index:9000;border-top:3px solid #65D7EF;font-size:.85em}
#term-panel.term-min #term-tabs,#term-panel.term-min #term-body{display:none}
#term-bar{display:flex;align-items:center;gap:10px;padding:4px 14px}
#term-bar .title{color:#65D7EF;font-weight:600;cursor:pointer}
#term-tabs{display:flex;gap:6px;flex-wrap:wrap;padding:0 14px 6px}
.term-tab{background:#1a2147;color:#cfd2ec;border:1px solid #2c356e;border-radius:6px 6px 0 0;
  padding:2px 10px;cursor:pointer;font-family:inherit;font-size:.95em}
.term-tab.active{background:#28266B;color:#fff;border-color:#65D7EF}
#term-body{display:none;border-top:1px solid #2c356e;outline:none}
#term-head{display:flex;align-items:center;gap:10px;padding:4px 14px;background:#141b3d}
#term-out{height:260px;overflow-y:auto;padding:8px 14px;font-family:'Courier New',monospace;
  font-size:12px;line-height:1.45;white-space:pre-wrap;word-break:break-all}
#term-body button{padding:2px 10px;font-size:.85em}
body{padding-bottom:34px}

/* ── summary-as-button (scan/analyze popovers, merge picker) ── */
.btn-like{display:inline-block;padding:6px 14px;background:#28266B;color:#fff;
  border-radius:6px;cursor:pointer;font-size:.9rem;list-style:none;user-select:none}
.btn-like::-webkit-details-marker{display:none}
.btn-like:hover{background:#3a378f}
details[open]>.btn-like{background:#3a378f}

/* "New since last visit" tag (email events, M16) */
.badge-new{background:#65D7EF;color:#0c2d38;font-weight:600}
