/* Operational Diagnostic Platform — admin styles.
   Hand-written, no build step (toaster discipline). Restrained, editorial register
   matching the brand: depth, calm, typographic. */

:root {
    --ink: #14213d;
    --ink-2: #1f2a4a;
    --paper: #f7f7f5;
    --card: #ffffff;
    --line: #e3e3df;
    --muted: #5a6472;         /* ~5.7:1 on paper — comfortably past WCAG AA (#6b7280 was borderline) */
    --accent: #c8a04e;        /* restrained gold */
    --accent-deep: #9c7a32;
    --ok: #2f7d4f;
    --warn: #b4541f;
    --danger: #9b2c2c;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20,33,61,.06), 0 6px 20px rgba(20,33,61,.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

.app-header {
    background: var(--ink);
    color: #fff;
    border-bottom: 3px solid var(--accent);
}
.app-header .bar {
    max-width: 1080px;
    margin: 0 auto;
    padding: .9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.app-header .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    text-decoration: none;
    font-size: 1.05rem;
}
/* Black-on-light mark sits in a small light tile so it reads intentionally on the
   dark header (a lockup, not a sticker). */
.app-header .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #fff;
    padding: 3px;
    box-sizing: border-box;
    display: block;
    flex: none;
}
/* Manage-recipients list (inside the dialog). */
.recipient-list { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow-y: auto; }
.recipient-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .25rem;
    border-bottom: 1px solid #eceae5;
}
.recipient-list li:last-child { border-bottom: 0; }
.recipient-email { font-size: .92rem; color: var(--ink); word-break: break-all; }
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e3e3df;
    border-radius: 8px;
    background: #fff;
    color: var(--muted, #5a6472);
    cursor: pointer;
    flex: none;
}
.icon-btn.danger:hover { color: var(--danger, #b3402f); border-color: #e7c9c9; background: #fbf4f3; }
.icon-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.app-header .brand-name { display: block; line-height: 1.05; }
.app-header .brand small { display: block; font-weight: 400; color: #b9c2d6; font-size: .72rem; letter-spacing:.08em; text-transform: uppercase; }
.app-header nav { display: flex; gap: 1.1rem; margin-left: auto; align-items: center; }
/* Direct children only, so this never bleeds into the dropdown panel's links. */
.app-header nav > a { color: #cfd6e6; text-decoration: none; font-size: .92rem; }
.app-header nav > a:hover, .app-header nav > a.active { color: #fff; }
.app-header .who { color:#b9c2d6; font-size:.82rem; }

.wrap { max-width: 1080px; margin: 2rem auto; padding: 0 1.25rem; }

h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.lede { color: var(--muted); margin-top: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow);
}
.card .n { font-size: 2rem; font-weight: 700; line-height: 1; }
.card .k { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); font-size: .94rem; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

.btn {
    display: inline-block;
    background: var(--ink);
    color: #fff;
    /* Transparent 1px border so solid and .ghost buttons share the same box size. */
    border: 1px solid transparent;
    border-radius: 8px;
    padding: .6rem 1.1rem;
    font-size: .95rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--ink-2); }
.btn.accent { background: var(--accent-deep); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.sm { padding: .35rem .7rem; font-size: .85rem; }

.badge { display:inline-block; padding:.15rem .55rem; border-radius:999px; font-size:.75rem; font-weight:600; }
.badge.draft { background:#eee; color:#555; }
.badge.open { background:#e6f0ea; color: var(--ok); }
.badge.closed { background:#f1e2dd; color: var(--warn); }

label { display:block; font-size:.85rem; color: var(--muted); margin:.75rem 0 .25rem; font-weight:600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}
textarea { min-height: 8rem; }

.error { color: var(--danger); font-size: .85rem; margin-top: .35rem; }
.flash { background:#e6f0ea; border:1px solid #b9d8c4; color: var(--ok); padding:.7rem 1rem; border-radius:8px; margin-bottom:1rem; }
.flash.warn { background:#f6efe6; border-color:#e2cda6; color: var(--warn); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.row-actions { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }

/* Centered auth card */
.auth-shell { min-height: 100vh; display:flex; align-items:center; justify-content:center; background: var(--ink); }
.auth-card { background:#fff; border-radius:14px; padding:2rem 2.2rem; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { display:block; width:56px; height:56px; margin:0 auto .9rem; border-radius:10px; }
.auth-card h1 { font-size:1.25rem; text-align:center; margin:.25rem 0 0; }
.auth-card .sub { color: var(--muted); font-size:.85rem; margin-bottom:1rem; text-align:center; }

/* Name dropdown (admin menu) — no-JS <details> in the header. */
.usermenu { position: relative; }
.usermenu > summary { list-style: none; cursor: pointer; color: #cfd6e6; font-size: .92rem; display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .55rem; border-radius: 8px; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { color: #fff; background: #1f2a4a; }
.usermenu[open] > summary { color: #fff; background: #1f2a4a; }
.usermenu .caret { font-size: .65rem; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + .45rem); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,33,61,.18); min-width: 210px; padding: .4rem; z-index: 60; }
.usermenu-head { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; padding: .4rem .6rem .5rem; }
.usermenu-panel a, .usermenu-panel button { display: block; width: 100%; text-align: left; padding: .5rem .6rem; color: var(--ink); text-decoration: none; font-size: .92rem; border: 0; background: transparent; cursor: pointer; border-radius: 6px; font-family: inherit; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--paper); }
.usermenu-divider { height: 1px; background: var(--line); margin: .35rem .3rem; }

/* Visible keyboard focus on every interactive element (WCAG 2.4.7). */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Light ring only on the dark-header elements; panel links keep the gold ring on white. */
.app-header nav > a:focus-visible, .usermenu > summary:focus-visible { outline-color: #ffffff; }

/* Send modal — native <dialog> (focus-trap + Esc-close come free). */
.send-modal { border: 0; border-radius: 14px; padding: 1.5rem 1.75rem; width: min(480px, 92vw); box-shadow: 0 24px 70px rgba(20,33,61,.35); color: var(--ink); }
.send-modal::backdrop { background: rgba(20,33,61,.5); }
.send-modal h2 { font-size: 1.2rem; }
.send-x { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .1rem .35rem; }
.send-x:hover { color: var(--ink); }
.send-modal textarea { min-height: 6rem; }

/* ============ Principal brief — the conversation cockpit ============ */
.brief-headline { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin: .25rem 0 1rem; line-height: 1.4; }
.brief-sub { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.5rem 0 .6rem; }

/* Coaching aside (how to open) — visually distinct from the talking script. */
.brief-coach { background: #faf6ec; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: .6rem .85rem; margin: 0 0 1rem; font-size: .95rem; color: #5a5238; }
.brief-coach-tag { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9c7a32; margin-bottom: .15rem; }

/* Accordions — collapsed is glanceable (the claim); expand for the script + evidence. */
.brief-acc { border: 1px solid var(--line); border-radius: 9px; margin-bottom: .4rem; background: #fff; }
.brief-acc > summary { cursor: pointer; padding: .65rem .9rem; font-weight: 600; color: var(--ink); list-style: none; display: flex; align-items: center; gap: .5rem; }
.brief-acc > summary::-webkit-details-marker { display: none; }
.brief-acc > summary::before { content: "▸"; color: var(--accent); font-size: .8rem; flex: none; transition: transform .12s ease; }
.brief-acc[open] > summary::before { transform: rotate(90deg); }
.brief-acc[open] > summary { border-bottom: 1px solid var(--line); }
.brief-acc-body { padding: .7rem .9rem .85rem 1.9rem; }
.brief-say { font-size: 1.02rem; color: var(--ink); margin: 0; line-height: 1.5; }
.brief-because { font-size: .85rem; color: var(--muted); margin: .5rem 0 0; }
.brief-because .muted { font-weight: 600; text-transform: uppercase; font-size: .68rem; letter-spacing: .05em; }

/* Rebuttal book — the objection (summary) reads like a quote you scan for. */
.brief-rebuttal > summary { font-style: italic; font-weight: 500; color: #5a5238; background: #fbf9f3; border-radius: 9px; }
.brief-rebuttal[open] > summary { border-radius: 9px 9px 0 0; }

.brief-care { margin: 0; padding-left: 1.1rem; }
.brief-care li { color: var(--muted); font-size: .92rem; margin: .2rem 0; }

/* Enablement recommendation card. */
.brief-rec { border: 1px solid var(--line); border-radius: 11px; padding: .9rem 1.1rem; margin-bottom: .7rem; background: #fff; }
.brief-rec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brief-rec-head strong { font-size: 1.02rem; }
.brief-tags { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.brief-rec-what { margin: .45rem 0 .5rem; }
.brief-rec-cap { font-size: .92rem; margin: 0 0 .4rem; }
.brief-rec-cap .muted { font-weight: 600; }
.brief-rec-ship { font-size: .9rem; margin: 0 0 .5rem; color: #33415c; }
.brief-ship-tag { display: inline-block; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #2f7d4f; background: #eef3ee; border-radius: 5px; padding: .1rem .4rem; margin-right: .4rem; }
.brief-rec-meta { margin: .35rem 0 0; }

/* Effort × impact chips. */
.chip { font-size: .68rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.chip-win { background: #eef3ee; color: #2f7d4f; border-color: #cfe0d4; }
.chip-lift { background: #f4f1ea; color: #7a6a3f; border-color: #e6dcc4; }
.chip-impact-high { background: #14213d; color: #fff; }
.chip-impact-medium { background: #eef0f4; color: var(--ink); }
.chip-impact-low { background: #f4f5f7; color: var(--muted); }

/* Async "Generating…" state (the kick returns instantly; the page polls). */
.brief-generating { display: flex; align-items: center; gap: .6rem; background: #faf6ec; border: 1px solid #ecdfba; border-radius: 9px; padding: .75rem 1rem; color: #5a5238; font-size: .95rem; }
.brief-spinner { width: 15px; height: 15px; border: 2px solid #e6dcc4; border-top-color: var(--accent); border-radius: 50%; animation: briefSpin .8s linear infinite; flex: none; }
@keyframes briefSpin { to { transform: rotate(360deg); } }

/* Guided per-recommendation explainer — "Discuss this" → pinned Agent Guidance */
.btn.xs { padding: .26rem .6rem; font-size: .78rem; border-radius: 7px; }
.brief-guide { margin-top: .7rem; border-top: 1px dashed var(--line); padding-top: .55rem; }
.brief-guide > summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--accent); list-style: none; display: inline-flex; align-items: center; gap: .4rem; }
.brief-guide > summary::-webkit-details-marker { display: none; }
.brief-guide > summary::before { content: "✦"; font-size: .7rem; opacity: .7; }
.brief-guide-count { background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; padding: .02rem .4rem; }
.brief-guide-body { margin-top: .6rem; }
.brief-guide-entry { border-left: 3px solid #e3e9f2; padding: .15rem 0 .35rem .7rem; margin-bottom: .65rem; }
.brief-guide-lens { display: inline-block; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: #6b7686; margin-bottom: .25rem; }
.brief-guide-content { font-size: .9rem; line-height: 1.5; color: #2b3344; }
.brief-guide-content strong { color: #1f2733; }
.brief-guide-lenses { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.brief-guide-lenses form { margin: 0; }
.brief-guide-clear { color: #9aa3b0; }

/* Resources surface — the hunter's enablement kit (learn → pitch → prove) */
.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.res-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.35rem; text-decoration: none; color: var(--ink); transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.res-card:hover { border-color: var(--accent); box-shadow: 0 6px 22px rgba(20,33,61,.08); transform: translateY(-2px); }
.res-step { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--accent-deep); }
.res-card h2 { margin: .35rem 0 .5rem; font-size: 1.25rem; }
.res-card p { margin: 0 0 1rem; color: #4a5568; font-size: .92rem; line-height: 1.55; flex: 1; }
.res-cta { font-weight: 600; color: var(--accent-deep); font-size: .92rem; }

/* Rendered markdown docs (Training / Prospecting) — fill the content width like the rest of the app */
.res-doc h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
.res-doc h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.res-doc h3 { font-size: 1rem; margin: 1rem 0 .35rem; }
.res-doc p { margin: .5rem 0; line-height: 1.6; }
.res-doc ul { margin: .5rem 0; padding-left: 1.3rem; }
.res-doc li { margin: .3rem 0; line-height: 1.55; }
.res-doc blockquote { margin: .75rem 0; padding: .6rem 1rem; background: #faf6ec; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; color: #5a5238; }
.res-doc blockquote p { margin: 0; }
.res-doc strong { color: #1f2733; }
.res-doc hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.res-doc em { color: #6b7280; }

/* Evidence share/download controls on the sample readback */
.res-share { display: inline-flex; align-items: center; gap: .5rem; }
