/* ==========================================================================
   RS Research — admin interface
   Desktop-first executive dashboard, fully usable on mobile.
   No framework, no external requests: one stylesheet, one script.
   ========================================================================== */

:root {
    --navy-900: #0b1020;
    --navy-800: #111a30;
    --navy-700: #1a2544;
    --navy-600: #26355c;
    --ink-900: #10151f;
    --ink-700: #33415c;
    --ink-500: #5b6a86;
    --ink-400: #8290ab;
    --line: #dfe4ee;
    --line-soft: #eef1f7;
    --paper: #f6f8fc;
    --white: #ffffff;

    --accent: #1f6feb;
    --accent-dark: #1758c0;
    --accent-soft: #e8f0fe;

    --green: #10794f;
    --green-soft: #e3f5ec;
    --amber: #9a6206;
    --amber-soft: #fdf3e0;
    --red: #b3261e;
    --red-soft: #fdeceb;
    --violet: #5b3fb5;
    --violet-soft: #efeafc;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 21, 31, .06), 0 6px 18px rgba(16, 21, 31, .06);
    --sidebar-w: 232px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-900);
    background: var(--paper);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--navy-900); color: #fff; padding: .6rem 1rem;
}
.skip-link:focus { left: 0; }

/* --- Shell ------------------------------------------------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--navy-900);
    color: #c7d0e4;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand { padding: 1.15rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar__brand a { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.sidebar__mark {
    width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
    background: linear-gradient(135deg, var(--accent) 0%, #4f9cff 100%);
    display: grid; place-items: center; font-weight: 700; color: #fff;
}
.sidebar__name { font-weight: 700; letter-spacing: .09em; font-size: .82rem; line-height: 1.15; }
.sidebar__name small { display: block; font-weight: 400; letter-spacing: .04em; color: #8fa0c2; font-size: .68rem; }

.sidebar__nav { padding: .85rem 0; flex: 1; }
.sidebar__group {
    margin: .9rem 1.1rem .35rem;
    font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
    color: #6f7f9f; font-weight: 600;
}
.sidebar__nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar__nav a {
    display: block; padding: .5rem 1.1rem; color: #c7d0e4;
    border-left: 3px solid transparent; font-size: .855rem;
}
.sidebar__nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar__nav a.is-active {
    background: rgba(31,111,235,.16); color: #fff; border-left-color: var(--accent); font-weight: 600;
}

.sidebar__foot { padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar__public {
    display: block; margin-bottom: .55rem; font-size: .78rem; font-weight: 500;
    color: #9db4d8; text-decoration: none;
}
.sidebar__public:hover { color: #fff; text-decoration: underline; }
.sidebar__tagline { margin: 0; font-size: .72rem; color: #7386a8; font-style: italic; }

/* Visible to a screen reader only. The admin stylesheet needed its own copy;
   landing.css has an identical rule and the two pages never share one. */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .85rem 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__title h1 { font-size: 1.12rem; }
.topbar__title p { margin: .1rem 0 0; color: var(--ink-500); font-size: .82rem; }
.topbar__right { display: flex; align-items: center; gap: .75rem; }
.topbar__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.topbar__toggle {
    display: none; flex-direction: column; gap: 4px; background: none;
    border: 0; cursor: pointer; padding: .4rem;
}
.topbar__toggle span { display: block; width: 20px; height: 2px; background: var(--ink-700); border-radius: 2px; }

.content { flex: 1; padding: 1.5rem; max-width: 1500px; width: 100%; }
.pagefoot {
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 1rem 1.5rem; color: var(--ink-400); font-size: .76rem;
    border-top: 1px solid var(--line);
}

/* --- User menu --------------------------------------------------------- */

.usermenu { position: relative; }
.usermenu summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem;
    padding: .3rem .5rem; border-radius: var(--radius-sm);
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--line-soft); }
.usermenu__avatar {
    width: 28px; height: 28px; border-radius: 50%; background: var(--navy-700); color: #fff;
    display: grid; place-items: center; font-size: .78rem; font-weight: 600;
}
.usermenu__name { font-size: .84rem; font-weight: 500; }
.usermenu__panel {
    position: absolute; right: 0; top: calc(100% + .4rem); min-width: 230px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: .5rem; z-index: 30;
}
.usermenu__meta { margin: 0 0 .4rem; padding: .5rem; border-bottom: 1px solid var(--line-soft); display: grid; gap: .15rem; }
.usermenu__meta span { color: var(--ink-500); font-size: .78rem; }
.usermenu__panel a, .usermenu__signout {
    display: block; width: 100%; text-align: left; padding: .45rem .5rem;
    border: 0; background: none; font: inherit; color: var(--ink-900);
    border-radius: var(--radius-sm); cursor: pointer;
}
.usermenu__panel a:hover, .usermenu__signout:hover { background: var(--line-soft); text-decoration: none; }
.usermenu__signout { color: var(--red); }

/* --- Flash messages ---------------------------------------------------- */

.flashes { display: grid; gap: .5rem; margin-bottom: 1.1rem; }
.flash {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    padding: .7rem .9rem; border-radius: var(--radius);
    border: 1px solid; font-size: .87rem;
}
.flash--success { background: var(--green-soft); border-color: #b6e0cb; color: var(--green); }
.flash--error   { background: var(--red-soft);   border-color: #f3c3bf; color: var(--red); }
.flash--warning { background: var(--amber-soft); border-color: #f0d9ae; color: var(--amber); }
.flash--info    { background: var(--accent-soft);border-color: #c3d8fb; color: var(--accent-dark); }
.flash__close { border: 0; background: none; font-size: 1.15rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash__close:hover { opacity: 1; }

/* --- Cards and panels --------------------------------------------------- */

.card {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.2rem;
}
.card__head {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .85rem 1.1rem; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.card__head h2 { font-size: .95rem; }
.card__head p { margin: .1rem 0 0; font-size: .8rem; color: var(--ink-500); }
.card__body { padding: 1.1rem; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 1.2rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* --- Stat tiles --------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.3rem; }
.stat {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: .95rem 1.05rem; box-shadow: var(--shadow);
}
.stat__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-400); font-weight: 600; }
.stat__value { font-size: 1.65rem; font-weight: 650; letter-spacing: -.02em; margin: .2rem 0 0; }
.stat__meta { font-size: .77rem; color: var(--ink-500); margin: .15rem 0 0; }
.stat a { color: inherit; }

/* A queue tile is the link to its own work, so the whole card is the target
   rather than a "view" link tucked in a corner. */
.stat--link { display: block; text-decoration: none; color: inherit; transition: border-color .12s, box-shadow .12s; }
.stat--link:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(31, 78, 121, .10); }
.stat--link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Something is waiting on a person. The only colour on the strip, so it means
   something when it appears. */
.stat__value--warn { color: var(--amber); }

/* --- Evidence drop zone -------------------------------------------------- */

.dropzone { position: relative; }

/* The input stays a real, focusable input covering the zone: the label is its
   label, so a click or a keyboard Enter opens the picker with no JS at all.
   Only once nexora.js has taken over does it become invisible. */
.dropzone__input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; z-index: 1;
}
.dropzone:not(.dropzone--live) .dropzone__input { position: static; opacity: 1; height: auto; cursor: auto; }
.dropzone:not(.dropzone--live) .dropzone__label { margin-top: .7rem; }
/* Pasting needs a script; without one, do not offer it. */
.dropzone:not(.dropzone--live) .dropzone__paste { display: none; }

.dropzone__label {
    display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
    padding: 2.1rem 1.2rem; cursor: pointer;
    border: 1.5px dashed var(--line); border-radius: var(--radius);
    background: var(--line-soft); color: var(--ink-700);
    transition: border-color .12s, background .12s;
}
.dropzone--live:hover .dropzone__label { border-color: var(--accent); }
.dropzone__input:focus-visible + .dropzone__label { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone.is-dragging .dropzone__label { border-color: var(--accent); background: var(--accent-soft); }

.dropzone__icon { font-size: 1.5rem; line-height: 1; color: var(--accent); }
.dropzone__lead { font-size: .95rem; font-weight: 600; color: var(--ink); }
.dropzone__link { color: var(--accent); text-decoration: underline; }
.dropzone__hint { font-size: .78rem; color: var(--ink-500); }

/* What is queued. Sits above the input so its remove buttons are clickable. */
.dropzone__list {
    position: relative; z-index: 2;
    list-style: none; margin: .7rem 0 0; padding: 0;
    display: flex; flex-direction: column; gap: .3rem;
}
.dropzone__item {
    display: flex; align-items: center; gap: .6rem;
    padding: .45rem .6rem; font-size: .84rem;
    background: var(--white); border: 1px solid var(--line); border-radius: 7px;
}
.dropzone__item--bad { border-color: #e0b4a8; background: #fdf4f1; }
.dropzone__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone__size { flex: none; font-size: .76rem; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.dropzone__item--bad .dropzone__size { color: var(--red); font-weight: 600; }
.dropzone__remove {
    flex: none; border: 0; background: none; cursor: pointer; padding: 0 .2rem;
    font-size: 1.1rem; line-height: 1; color: var(--ink-400);
}
.dropzone__remove:hover { color: var(--red); }
.dropzone__remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* --- Evidence library ---------------------------------------------------- */

/* A grid, because a person recognises a photograph faster than a filename. */
.evidence-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 1rem; margin-bottom: 1.3rem;
}
.evidence {
    display: flex; flex-direction: column; gap: .35rem;
    text-decoration: none; color: inherit; min-width: 0;
}
.evidence__frame {
    position: relative; display: flex; align-items: center; justify-content: center;
    aspect-ratio: 4 / 3; overflow: hidden;
    background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .12s, box-shadow .12s;
}
.evidence:hover .evidence__frame { border-color: var(--accent); box-shadow: 0 2px 10px rgba(31,78,121,.10); }
.evidence:focus-visible .evidence__frame { outline: 2px solid var(--accent); outline-offset: 2px; }
.evidence__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.evidence__ext {
    font-size: .82rem; font-weight: 700; letter-spacing: .08em; color: var(--ink-500);
}
/* Marks a file that is proof of nothing yet. */
.evidence__flag {
    position: absolute; top: .4rem; right: .4rem;
    font-size: .64rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
    background: var(--amber-soft); color: var(--amber);
    border-radius: 4px; padding: .12rem .4rem;
}
.evidence__title {
    font-size: .85rem; font-weight: 600; line-height: 1.35;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.evidence__meta { font-size: .75rem; color: var(--ink-500); }

/* Readable, but visibly a lesser warning than Unfiled: a file nobody can
   search inside is a smaller problem than one that backs nothing. */
.evidence__flag--read { background: var(--line-soft); color: var(--ink-500); }

.evidence__full {
    display: block; max-width: 100%; height: auto; border-radius: var(--radius);
    border: 1px solid var(--line);
}

/* --- The practice lens -------------------------------------------------- */

/* Buttons rather than a select, so each practice is one click and the whole
   thing works with scripting off. */
.practice { margin: .25rem 1.1rem .4rem; }
.practice__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.practice__list li { margin: 0; }
.practice__option {
    appearance: none; cursor: pointer; font: inherit;
    font-size: .74rem; line-height: 1.2;
    padding: .3rem .55rem; border-radius: 999px;
    border: 1px solid transparent; background: transparent;
    color: #b9c4da;
}
.practice__option:hover { background: rgba(255, 255, 255, .08); }
.practice__option.is-active {
    background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25);
    color: #fff; font-weight: 600;
}
.practice__option:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* The line that keeps a narrowed screen honest: it says a lens is on, how
   much it is holding back, and offers one click to see everything. Styled as
   information rather than as a warning — nothing is wrong, the reader just
   needs to know they are not looking at all of it. */
.practice-notice {
    margin: 0 0 1rem; padding: .55rem .8rem;
    background: var(--line-soft); border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: .82rem; color: var(--ink-700);
}
.practice-notice a { font-weight: 600; }

/* Which practice a row belongs to, where a list is showing several. */
.badge--practice {
    background: transparent; border: 1px solid var(--line);
    color: var(--ink-500); font-weight: 500;
}

/* --- Engagements -------------------------------------------------------- */

/* The client's question, set larger than body text. It is the sentence the
   whole job is measured against, and a screen that renders it at the same
   weight as a fee note invites the work to drift away from it. */
.lede {
    font-size: 1.05rem; line-height: 1.6; color: var(--ink-900);
    border-left: 3px solid var(--accent); padding-left: .9rem; margin: 0 0 1rem;
}

/* One state move per row: the button, and where it is blocked, the reason
   beside it rather than hidden behind a click that fails. */
.transition {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .45rem 0; border-bottom: 1px solid var(--line-soft);
}
.transition:last-child { border-bottom: 0; }
.transition input[type="text"] { flex: 1 1 18rem; min-width: 0; }
.transition .hint { margin: 0; flex: 1 1 14rem; }

/* --- Extracted text ----------------------------------------------------- */
/* Monospaced and scrolling in its own box. This is a machine's reading of a
   document, and it should look like one — a spreadsheet extract is tab
   separated and reads as columns only in a fixed-width font, and prose set to
   look like the platform's own writing would invite it to be trusted as if a
   person had written it. */
.extract {
    max-height: 26rem; overflow: auto; margin: .6rem 0 .5rem;
    padding: .75rem .85rem; background: var(--line-soft); border-radius: var(--radius);
    border: 1px solid var(--line);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .78rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.extract-inline {
    margin: .5rem 0; padding: .5rem .7rem;
    border-left: 3px solid var(--line); background: var(--line-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: .84rem; line-height: 1.6;
}
details > summary {
    cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--ink-700);
}

/* --- Tables ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .855rem; }
table.data th, table.data td { padding: .6rem .75rem; text-align: left; vertical-align: top; }
table.data thead th {
    background: var(--line-soft); color: var(--ink-700); font-size: .72rem;
    text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data thead th a { color: inherit; }
table.data tbody tr { border-bottom: 1px solid var(--line-soft); }
table.data tbody tr:hover { background: #fbfcfe; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .cell-primary { font-weight: 600; }
table.data .cell-sub { color: var(--ink-500); font-size: .78rem; display: block; }
table.data .row-actions { white-space: nowrap; text-align: right; }

/* A superseded price, a retired estimate, a factor with no data: still on the
   record and still readable, but visibly not the row a decision rests on. */
table.data tbody tr.row--muted { color: var(--ink-500); background: var(--line-soft); }
table.data tbody tr.row--muted:hover { background: var(--line-soft); }

/* --- Badges, scores ----------------------------------------------------- */

.badge {
    display: inline-block; padding: .12rem .45rem; border-radius: 999px;
    font-size: .7rem; font-weight: 600; line-height: 1.5;
    background: var(--line-soft); color: var(--ink-700); white-space: nowrap;
}
.badge--role    { background: var(--violet-soft); color: var(--violet); }
.badge--ok      { background: var(--green-soft);  color: var(--green); }
.badge--warn    { background: var(--amber-soft);  color: var(--amber); }
.badge--danger  { background: var(--red-soft);    color: var(--red); }
.badge--info    { background: var(--accent-soft); color: var(--accent-dark); }
.badge--muted   { background: var(--line-soft);   color: var(--ink-500); }
.badge--violet  { background: var(--violet-soft); color: var(--violet); }
.badge--tier-a  { background: #e7f0e9; color: #14602f; }
.badge--tier-b  { background: var(--accent-soft); color: var(--accent-dark); }
.badge--tier-c  { background: var(--amber-soft); color: var(--amber); }
.badge--tier-d  { background: var(--violet-soft); color: var(--violet); }
.badge--tier-e  { background: var(--red-soft); color: var(--red); }

.score { display: inline-flex; align-items: baseline; gap: .3rem; font-variant-numeric: tabular-nums; }
.score__value { font-weight: 650; }
.score.is-exceptional .score__value { color: #0d6b45; }
.score.is-strong      .score__value { color: var(--green); }
.score.is-attractive  .score__value { color: var(--accent-dark); }
.score.is-moderate    .score__value { color: var(--amber); }
.score.is-low         .score__value { color: var(--ink-500); }
.score.is-none        { color: var(--ink-400); font-style: italic; }

.meter { height: 5px; background: var(--line-soft); border-radius: 999px; overflow: hidden; min-width: 60px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* --- Buttons ------------------------------------------------------------ */

.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .45rem .85rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--white); color: var(--ink-900);
    font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--line-soft); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn--danger { background: var(--white); border-color: #f0c2bf; color: var(--red); }
.btn--danger:hover { background: var(--red-soft); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--line-soft); }
.btn--sm { padding: .27rem .55rem; font-size: .78rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* --- Forms -------------------------------------------------------------- */

.form-grid { display: grid; gap: 1rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid--wide { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: .28rem; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: .8rem; font-weight: 600; color: var(--ink-700); }
.field .hint { font-size: .74rem; color: var(--ink-400); }
.field .error { font-size: .76rem; color: var(--red); }
.field .req { color: var(--red); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=url], select, textarea {
    width: 100%; padding: .45rem .6rem; font: inherit; font-size: .87rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--white); color: var(--ink-900);
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--red); }
.checkbox { display: flex; align-items: flex-start; gap: .45rem; font-size: .85rem; }
.checkbox input { margin-top: .22rem; }

/* The filter box script writes above a long select. Set slightly back from
   the select it narrows, so the pair reads as one control rather than as two
   fields with the same label. */
.select-filter { margin-bottom: .3rem; font-size: .82rem; }
.select-filter::placeholder { color: var(--ink-400); }
.select-filter__count { margin: .3rem 0 0; }

fieldset.section { border: 0; padding: 0; margin: 0 0 1.6rem; }
fieldset.section > legend {
    font-size: .74rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--ink-400); font-weight: 700; padding: 0 0 .55rem;
    border-bottom: 1px solid var(--line-soft); width: 100%; margin-bottom: .9rem;
}

/* The per-row language picker sits inline with its generate button. */
.lang-pick { font: inherit; font-size: .78rem; padding: .25rem .35rem; border: 1px solid var(--line);
             border-radius: 5px; background: var(--white); color: var(--ink); margin-right: .3rem; }

.form-actions {
    display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
    padding-top: 1rem; border-top: 1px solid var(--line-soft);
}
.form-actions .spacer { flex: 1; }

/* --- Filter bar --------------------------------------------------------- */

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { flex: 1 1 165px; max-width: 240px; }
.filters .field--search { flex: 2 1 260px; max-width: 400px; }
.filters__actions { display: flex; gap: .4rem; }
.filter-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .7rem; }
.filter-chips a {
    display: inline-flex; gap: .35rem; align-items: center; font-size: .76rem;
    background: var(--accent-soft); color: var(--accent-dark);
    padding: .15rem .5rem; border-radius: 999px;
}

/* --- Detail views ------------------------------------------------------- */

.definition { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem 1.4rem; }
.definition div { min-width: 0; }
.definition dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-400); font-weight: 600; }
.definition dd { margin: .1rem 0 0; font-size: .88rem; word-break: break-word; }

.profile-head { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.profile-head__main { flex: 1 1 320px; min-width: 0; }
.profile-head__scores { display: flex; gap: .8rem; flex-wrap: wrap; }
.score-card {
    border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem;
    min-width: 128px; background: var(--white);
}
.score-card__label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-400); font-weight: 600; }
.score-card__value { font-size: 1.3rem; font-weight: 650; margin: .1rem 0; }
.score-card__band { font-size: .74rem; color: var(--ink-500); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .55rem 0 .55rem 1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
    content: ''; position: absolute; left: -5px; top: .85rem;
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.timeline time { font-size: .74rem; color: var(--ink-400); display: block; }

.notice {
    padding: .7rem .9rem; border-radius: var(--radius); font-size: .84rem;
    background: var(--accent-soft); border: 1px solid #c3d8fb; color: var(--accent-dark);
}
.notice--warn { background: var(--amber-soft); border-color: #f0d9ae; color: var(--amber); }
.notice--muted { background: var(--line-soft); border-color: var(--line); color: var(--ink-700); }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--ink-500); }
.empty-state h2 { font-size: 1.05rem; color: var(--ink-900); margin-bottom: .4rem; }

.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs a {
    padding: .5rem .85rem; color: var(--ink-500); font-size: .85rem; font-weight: 500;
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink-900); }

.mono { font-family: var(--mono); font-size: .8rem; }
.muted { color: var(--ink-500); }
.small { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: .6rem; }

/* --- Sign-in ------------------------------------------------------------ */

.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 100%);
}
.auth__panel {
    width: 100%; max-width: 380px; background: #fff;
    border-radius: 14px; padding: 2rem; box-shadow: 0 18px 50px rgba(6, 10, 22, .4);
}
.auth__brand { text-align: center; margin-bottom: 1.4rem; }
.auth__brand .sidebar__mark { margin: 0 auto .6rem; }
.auth__brand h1 { font-size: 1.05rem; letter-spacing: .12em; }
.auth__brand p { margin: .2rem 0 0; color: var(--ink-500); font-size: .82rem; font-style: italic; }
.auth__panel .field { margin-bottom: .9rem; }
.auth__panel .btn { width: 100%; justify-content: center; }
.auth__foot { margin-top: 1.2rem; text-align: center; font-size: .75rem; color: var(--ink-400); }

/* --- Responsive --------------------------------------------------------- */

/* Opportunity brief — reading text, not table data. A slightly longer line
   height and a measure cap because these pages are read end to end. */
.report { max-width: 68ch; }
.report p { margin: 0 0 .85rem; line-height: 1.65; }
.report p:last-child { margin-bottom: 0; }
.report__list { margin: 0 0 .85rem; padding-left: 1.15rem; }
.report__list li { margin-bottom: .3rem; line-height: 1.55; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; }
.inline-form .field { margin: 0; flex: 1 1 320px; }

@media (max-width: 960px) {
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
        transform: translateX(-100%); transition: transform .18s ease;
        box-shadow: 0 0 40px rgba(0,0,0,.35);
    }
    .sidebar.is-open { transform: translateX(0); }
    .topbar__toggle { display: flex; }
    .content { padding: 1rem; }
    .topbar { padding: .7rem 1rem; }
    .topbar__title h1 { font-size: 1rem; }
    .usermenu__name { display: none; }
    .nav-backdrop {
        position: fixed; inset: 0; background: rgba(11,16,32,.5); z-index: 35;
    }
}

@media (max-width: 620px) {
    .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; }
    .stat__value { font-size: 1.35rem; }
    .filters .field, .filters .field--search { max-width: none; flex-basis: 100%; }
    .card__head { align-items: flex-start; }
    .topbar__actions .btn { padding: .4rem .6rem; font-size: .8rem; }
}

@media print {
    .sidebar, .topbar__toggle, .topbar__actions, .usermenu, .pagefoot, .filters { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; break-inside: avoid; }
}

/* The one green variant the admin lacked: something is correct and finished,
   as opposed to merely informational. */
.notice--ok { background: var(--green-soft); border-color: #b6e0cb; color: var(--green); }

/* A select sitting inside a table row, beside the move buttons — it has to
   match their height or the row grows a few pixels wherever one appears. */
.select--sm {
    font-size: .8rem; padding: .25rem .4rem;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--white, #fff); color: var(--ink-900, inherit); max-width: 11rem;
}
