/* Screen-level components for the Bates Estates console: grids, detail layouts, the
   approval queue, operator cards and settings.

   Split from console.css purely for readability - both are served together and the tokens
   live in console.css. Values are read off the approved Figma; see
   docs/design/admin-console-design-reference.md. */

/* ----------------------------------------------------------------- paging */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}

.pager__links { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------- detail layout */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }

/* The pipeline runs across the full page, with the two columns starting underneath it. */
.detail__full { grid-column: 1 / -1; }

.side-stack { display: flex; flex-direction: column; gap: 20px; }

.side-card__label {
    font-size: 11px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

/* Seven-step pipeline, as drawn on the job detail screen: completed steps struck through
   in green, the current one filled blue, the rest greyed. */
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper li { display: flex; align-items: center; gap: 12px; padding: 9px 0; }

.stepper__mark {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--slate-soft);
    color: var(--muted);
    flex: 0 0 26px;
}

.stepper li.is-done .stepper__mark { background: var(--success); color: #fff; }
.stepper li.is-done .stepper__label { color: var(--success); text-decoration: line-through; }
.stepper li.is-current .stepper__mark { background: var(--primary); color: #fff; }
.stepper li.is-current .stepper__label { font-weight: 700; }
.stepper__label { flex: 1; }
.stepper__current { color: var(--primary); font-size: 12px; font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 20px 20px; }

.timeline li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
}

/* A backward stage move is flagged amber, matching how it is logged (JP-03). */
.timeline li.is-back::before { background: var(--warning); }
.timeline__title { font-weight: 600; }
.timeline__meta { color: var(--muted); font-size: 13px; }

/* The two operators a reassignment moved the lead between, above the who-and-when line. */
.timeline__move { font-size: 13px; margin-top: 2px; }
.timeline__arrow { color: var(--muted); margin: 0 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }

.tabs a {
    padding: 13px 14px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* Hides a tab panel regardless of its own display value (grid/flex layouts would otherwise
   tie with a bare [hidden] on specificity and win by source order - see the Notifications
   Compose/Delivery Log tabs). */
.is-hidden { display: none !important; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-grid img { width: 100%; height: 90px; object-fit: cover; border-radius: 9px; border: 1px solid var(--border); }

/* The upload tile, sized to sit in the grid beside the photos it adds. The file input is
   inside the label rather than hidden with display:none, which would take it out of the
   tab order and leave the tile unreachable from the keyboard. */
.photo-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 90px;
    border: 1px dashed var(--border-strong);
    border-radius: 9px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    transition: border-color .12s ease, color .12s ease, background .12s ease;
}

.photo-drop:hover,
.photo-drop:focus-within,
.photo-drop.is-over {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.photo-drop input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ---------------------------------------------- property notes (Notes tab)

   Two states, never both: what is on record, and the box for changing it. The panel is
   the read state - prose on a tinted card with the stamp under it, so a note that was
   saved looks saved and carries the date it was written. .is-hidden is not used here
   because the editor is a plain block: [hidden] alone does the job and keeps the no-script
   override (see the <noscript> in _LeadTabs) to one rule. */

.notes-record {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--page);
    padding: 16px 18px;
}

.notes-record__text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.65;
}

.notes-record__meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 14px 0 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
}

.notes-record__meta svg { flex: 0 0 auto; stroke: currentColor; fill: none; }

.notes-editor__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------- dated note log (Notes tab)

   Notes are entries filed under the day they are about, grouped the way the item log
   below groups a sale day. The day heading is the same weight and rhythm as .item-day__head
   on purpose: the two tabs hold the same kind of record - what happened at this property on
   this date - and they should read as one screen, not two conventions.

   The box for writing one sits above the log rather than below it, because the log grows
   and a compose box at the bottom walks off the screen. */

.note-add {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--page);
    padding: 16px 18px;
}

/* Label on the left, the date it will be filed under on the right - the one field that
   decides where the note lands, so it is never below the fold of the textarea. */
.note-add__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.note-add__head .label { margin: 0; }

.note-add__date { display: flex; align-items: center; gap: 8px; }
.note-add__date .input { width: auto; }

.note-editor {
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--page);
    padding: 16px 18px;
    margin-top: 8px;
}

.note-log__head {
    color: var(--muted);
    font-size: 13px;
    padding: 18px 0 2px;
}

.note-day + .note-day { margin-top: 6px; }

.note-day__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 18px 0 10px;
}

.note-day__head svg { flex: 0 0 auto; stroke: currentColor; fill: none; color: var(--muted); }
.note-day__date { font-weight: 600; font-size: 14px; }

/* Pushed to the end rather than floated, so it stays right-aligned as the heading wraps. */
.note-day__count { margin-left: auto; color: var(--muted-light); font-size: 12px; }

.note-entry + .note-entry,
.note-editor + .note-entry { margin-top: 10px; }

/* The read panel's buttons are secondary work - the note itself is what the tab is for -
   so they sit at the text size the meta line uses rather than at full button weight. */
.note-entry .notes-editor__actions .btn { padding: 7px 12px; font-size: 13px; }

@media (max-width: 767px) {
    .note-add__head { align-items: stretch; }
    .note-add__date { width: 100%; }
    .note-add__date .input { flex: 1; }

    /* The count drops under the date rather than being squeezed against it. */
    .note-day__count { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------- estate item log (Items tab)

   The log is read-only in the console, so none of this is form furniture - it is a
   receipt. The overall total leads because it is the number the client opens the tab
   for; the per-day blocks below it are the working the operator did to get there.

   Deliberately styled nothing like the closing figures (.figures / .figure). Items now
   carry a commission of their own, which makes the resemblance more dangerous rather than
   less: a panel that looked like the closing figures would invite reading item commission
   as ledger commission, and it is not (section 4). Hence the commission figures here are
   the quiet ones - an aside under the takings, a sub-line under the day subtotal - never
   a tile. */

.item-log__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.item-log__total { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.item-log__total-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* The item commission total. Same size as the labels above it, not the total: it is a
   note about the items, not a second headline figure competing with the takings. */
.item-log__aside { color: var(--muted); font-size: 13px; margin-top: 10px; max-width: 52ch; }
.item-log__aside-note { color: var(--muted-light); display: block; font-size: 12px; margin-top: 2px; }

.item-day + .item-day { margin-top: 8px; }

.item-day__head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding: 18px 0 10px;
}

.item-day__date { font-weight: 600; font-size: 14px; }
.item-day__count { color: var(--muted-light); font-size: 12px; }

/* Pushed to the end rather than floated, so it stays right-aligned with the Price
   column when the day header wraps on a narrow screen. */
.item-day__subtotal { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* Under the day's takings rather than beside them, so the bold figure on that line stays
   the one thing it has always been - what the day sold for. */
.item-day__commission {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 400;
}

/* The day tables sit inside a tab panel that already has the card's padding, so they
   need less room per row than the full-page grids .table is sized for. */
.table--tight th { padding: 9px 12px; }
.table--tight td { padding: 10px 12px; }
.table--tight .cell-sub { font-size: 12px; }

@media (max-width: 767px) {
    .item-log__total { font-size: 22px; }

    /* The subtotal drops onto its own line with the date above it rather than being
       squeezed against the item count. */
    .item-day__subtotal { margin-left: 0; width: 100%; text-align: left; }
}

.meta-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.meta-row dt { color: var(--muted); margin: 0; }
.meta-row dd { margin: 0; font-weight: 600; text-align: right; }

/* -------------------------------------------------------- approval queue */

.approval-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.figure { border-radius: 10px; padding: 12px 14px; }
.figure__label { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; }
.figure__value { font-size: 21px; font-weight: 700; margin-top: 4px;word-break:break-all }
.figure--grey { background: #f6f7f9; color: var(--muted); }
.figure--grey .figure__value { color: var(--text); }
.figure--green { background: var(--success-soft); color: var(--success); }
.figure--blue { background: var(--primary-soft); color: var(--primary); }

.section-label {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    margin: 26px 0 12px;
}

.action-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }

/* A decided closing carries the reviewer's words with it. The reason sits behind an icon
   beside the badge rather than in a column of its own: it is up to 2000 characters, and a
   reference table that has to stay readable across seven columns cannot carry that inline. */
.status-note { display: inline-flex; align-items: center; gap: 6px; }
.status-note .icon-btn { width: 24px; height: 24px; border-radius: 6px; }

/* Rejection reasons are typed into a textarea, so line breaks the admin put in are kept. */
.review-note { white-space: pre-wrap; overflow-wrap: anywhere; }

/* --------------------------------------------------------- operator cards */

.operator-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.operator-card { text-align: center; padding: 20px 16px; }

/* The card is a link to that operator's profile. Nothing about it should look like body
   copy with a link in it, so the anchor keeps the card's own colour. */
a.operator-card { display: block; color: inherit; text-decoration: none; }
a.operator-card:hover { border-color: var(--border-strong); text-decoration: none; }
.operator-card__name { font-weight: 700; margin-top: 10px; }
.operator-card__area { color: var(--muted); font-size: 13px; }
.operator-card__split { display: flex; margin: 16px 0 12px; gap: 8px; }
.operator-card__split > div { flex: 1; }
.operator-card__split b { display: block; font-size: 21px; }
.operator-card__split span { font-size: 12px; color: var(--muted); }

.meter { height: 5px; border-radius: 999px; background: var(--slate-soft); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; }
.meter span.tone--green { background: var(--success); }
.meter span.tone--blue { background: var(--primary); }
.meter span.tone--amber { background: var(--warning); }
.meter span.tone--slate { background: var(--muted); }

.meter-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.meter-row b { font-size: 13px; }
.meter-row .tone--green { color: var(--success); }
.meter-row .tone--blue { color: var(--primary); }
.meter-row .tone--amber { color: #b45309; }
.meter-row .tone--slate { color: var(--muted); }

/* ---------------------------------------------------------------- settings */

.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings__rail { display: flex; flex-direction: column; gap: 3px; }

.settings__rail a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.settings__rail a:hover { background: #f3f4f6; text-decoration: none; }
.settings__rail a.is-active { background: var(--primary-soft); color: var(--primary); }

.rowlist { display: flex; flex-direction: column; gap: 10px; }

.rowlist__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fbfbfc;
}

.rowlist__num {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--slate-soft);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    flex: 0 0 24px;
}

/* --------------------------------------------------- notifications screen */

/* Composer on the left, history on the right, roughly matching the design's proportions. */
.compose-grid { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }

.composer-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
}

/* Channel picker: taller tiles with the icon stacked over the label, as drawn - a
   different weight than the compact pill .segmented used for grid filters elsewhere. */
.channel-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 5px;
    margin-top: 8px;
}

.channel-tiles button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.channel-tiles button.is-active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }

/* Recipient scope: two independent buttons, not a shared pill group - "All operators" is a
   solid dark toggle when active, "Select" stays an outline button either way, as drawn. */
.recipient-toggle { display: flex; gap: 10px; margin-top: 8px; }

.recipient-toggle button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.recipient-toggle button.is-active { background: var(--text); border-color: var(--text); color: #fff; }

/* The leads grid's per-row "more actions" menu (Mark as Responded / Mark as Urgent /
   Delete Lead). Toggled by a delegated click handler in Leads/Index.cshtml.

   Fixed rather than absolute: the row lives inside .table-scroll, which sets
   overflow-x: auto for wide tables - an absolutely positioned panel there gets clipped to
   that box instead of floating over the page. Fixed positioning escapes it; the click
   handler sets top/left from the toggle button's own position since fixed has no anchor
   of its own. */
.row-menu { position: relative; }

.row-menu__panel {
    display: none;
    position: fixed;
    z-index: 50;
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(12, 18, 32, .18);
    padding: 6px;
}

.row-menu.is-open .row-menu__panel { display: block; }

.row-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font: inherit;
    text-align: left;
    color: var(--text);
    cursor: pointer;
}

.row-menu__item:hover { background: #f3f4f6; }
.row-menu__item--danger { color: var(--danger); }
.row-menu__item--danger:hover { background: var(--danger-soft); }

/* Filter dropdown styled as a bordered pill rather than a bare native <select>. */
.select-wrap { position: relative; display: inline-block; }

.select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    font-weight: 600;
    padding: 8px 32px 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.select-wrap__chevron { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted-light); }

/* "Schedule for later" - a small sliding on/off control built from a checkbox, since the
   console ships no JS framework and a native checkbox already carries the right semantics
   and keyboard behaviour. */
.toggle-switch { position: relative; display: inline-flex; vertical-align: middle; }

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 40px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}

.toggle-switch__track {
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--border-strong);
    display: inline-block;
    transition: background .15s ease;
}

.toggle-switch__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(12, 18, 32, .2);
    transition: transform .15s ease;
}

.toggle-switch input:checked ~ .toggle-switch__track { background: var(--primary); }
.toggle-switch input:checked ~ .toggle-switch__track .toggle-switch__thumb { transform: translateX(18px); }
.toggle-switch input:focus-visible ~ .toggle-switch__track { outline: 2px solid var(--primary-soft); outline-offset: 2px; }

/* The "Select" recipient checklist, shown only once that scope is chosen. Each row is its
   own bordered card - not a bare checkbox list - so a crowded operator roster still reads
   as individual people rather than a form control. */
.recipient-picker {
    margin-top: 10px;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    padding: 2px;
}

/* Only applied while the picker is shown - otherwise this "display" would outrank the
   [hidden] attribute's own display:none and the picker would never actually hide. */
.recipient-picker:not([hidden]) { display: flex; }

.recipient-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
}

.recipient-row:hover { border-color: var(--border-strong); }

/* :has() reacts to the hidden checkbox so the whole row highlights on selection without
   any JS - the same "state lives in the checkbox" approach the toggle switch above uses. */
.recipient-row:has(input:checked) { background: var(--primary-soft); border-color: #dde9fd; }

.recipient-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.recipient-row__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.recipient-row__avatar--purple { background: var(--purple); }
.recipient-row__avatar--red { background: var(--danger); }
.recipient-row__avatar--amber { background: var(--warning); }
.recipient-row__avatar--green { background: var(--success); }
.recipient-row__avatar--sky { background: var(--sky); }

.recipient-row__body { flex: 1; min-width: 0; }
.recipient-row__name { display: block; font-weight: 700; font-size: 13px; color: var(--primary); }
.recipient-row__area { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

.recipient-row__check {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    display: grid;
    place-items: center;
}

.recipient-row input:checked ~ .recipient-row__check {
    border-color: var(--primary);
    background: var(--primary);
}

.recipient-row input:checked ~ .recipient-row__check::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

.recipient-row input:focus-visible ~ .recipient-row__check { outline: 2px solid var(--primary-soft); outline-offset: 2px; }

@media (max-width: 1100px) {
    .compose-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Tone chip beside a row in the Alert History tab. Same soft-background-plus-matching-ink
   pairing the badges use, so a red row reads as urgent in both columns at once. */
.alert-ico {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.alert-ico--blue { background: var(--primary-soft); color: var(--primary); }
.alert-ico--purple { background: var(--purple-soft); color: var(--purple); }
.alert-ico--amber { background: var(--warning-soft); color: #b45309; }
.alert-ico--green { background: var(--success-soft); color: var(--success); }
.alert-ico--red { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------- websites screen */

.banner {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f4f8ff, #eef4ff);
    border: 1px solid #dde9fd;
    margin-bottom: 20px;
}

.banner__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
}

.banner__chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.banner__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #dde9fd;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.keybox {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f6f7f9;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 14px 16px;
    margin: 14px 0;
}

.keybox code {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
    flex: 1 1 auto;
    min-width: 0;
}

.keybox .btn { flex: 0 0 auto; }

.steps { counter-reset: s; list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 8px 0; }
.steps li > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

.steps li::before {
    counter-increment: s;
    content: counter(s);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 22px;
}

/* Native dialog rather than a JS modal library: it traps focus, closes on Escape and needs
   no script beyond showModal(). A dialog that outgrows the viewport scrolls internally: the
   dialog itself is capped and clipped, and only .card__body (not the head or a foot, when
   present) scrolls, so the title and action buttons stay pinned in view. */
dialog {
    border: 0;
    border-radius: var(--radius);
    padding: 0;
    max-width: 480px;
    width: calc(100% - 32px);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(12, 18, 32, .28);
}

dialog[open] { display: flex; flex-direction: column; }
dialog[open] > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

dialog::backdrop { background: rgba(12, 18, 32, .45); }
dialog .card__head { border-bottom: 1px solid var(--border); flex: 0 0 auto; }
dialog .card__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
dialog .card__foot { flex: 0 0 auto; }
dialog .card__foot .action-pair { margin-top: 0; }
dialog .card__close { margin-left: auto; flex: 0 0 auto; }
dialog .dialog__text { margin: 0; }

/* Confirmation dialogs (e.g. "Remove website") carry little content, so the default
   480px form-dialog width leaves them a wide, short letterbox. Capping the width keeps
   the shape closer to square instead of a wide banner. */
dialog.dialog--confirm { max-width: 400px; }

/* The Integration Guide packs a full URL and header name into its steps; 480px forces
   those onto cramped, wrapping lines. Widen it so the setup steps read as prose. */
dialog.dialog--wide { max-width: 640px; }

/* The Add Lead form's grid uses roomier gutters than the compact .field-grid default (used
   elsewhere for denser forms), so the gap lives here scoped to this dialog rather than on
   the shared class. */
#add-lead .field-grid { gap: 20px 24px; }
#add-lead .form-row { margin-bottom: 0; }

/* Labels are inline by default, so margin-bottom needs display:block to actually push the
   input down. */
#add-lead .label { display: block; margin-bottom: 6px; color: var(--muted); }

/* -------------------------------------------- horizontal pipeline stepper

   The seven stages run left to right across the top of the detail page, as drawn. The
   connector is a ::before on each step rather than a separate element, so the markup stays
   one <li> per stage and the vertical fallback below needs no different HTML. */

.track { padding: 22px 20px 18px; }

.track__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Badge plus the Start Pipeline button on a job that has not been opened yet. Its own
   flex row so the two stay together when track__head wraps on a narrow console. */
.track__head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.track__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(84px, 1fr);
}

.track__steps li {
    position: relative;
    text-align: center;
}

/* The whole step is the hit target, not just the circle - the design lets you click a
   stage to set it. A plain <button> so it is reachable by keyboard and announced as a
   control, with the circle and label laid out inside it. */
.track__step {
    display: block;
    width: 100%;
    padding: 34px 0 0;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    border-radius: 10px;
}

.track__step:hover:not(:disabled) .track__mark {
    border-color: var(--primary);
    color: var(--primary);
}

.track__step:hover:not(:disabled) .track__label { color: var(--primary); }

.track__step:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* The current stage is not a destination, so it is not clickable - but it must not look
   greyed out either, since it is the one that is actually true. */
.track__step:disabled { cursor: default; }

/* The connector, drawn behind the marks. Not on the first step, so the line starts at the
   first circle rather than running off the left edge. */
.track__steps li::before {
    content: "";
    position: absolute;
    top: 12px;
    right: 50%;
    left: -50%;
    height: 2px;
    background: var(--border-strong);
}

.track__steps li:first-child::before { display: none; }
.track__steps li.is-done::before, .track__steps li.is-current::before { background: var(--success); }

.track__mark {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--surface);
    color: var(--muted-light);
    border: 2px solid var(--border-strong);
    z-index: 1;
}

.track__steps li.is-done .track__mark { background: var(--success); border-color: var(--success); color: #fff; }
.track__steps li.is-current .track__mark { background: var(--primary); border-color: var(--primary); color: #fff; }

.track__steps li.is-current .track__mark::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid var(--primary-soft);
}

.track__label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.track__steps li.is-done .track__label { color: var(--text); }
.track__steps li.is-current .track__label { color: var(--primary); }

/* -------------------------------------------------------- detail sidebar */

.side-card__label--row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }

.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.doc-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.doc-list__icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
}

.doc-list__body { flex: 1; min-width: 0; }
.doc-list__name { font-weight: 600; font-size: 13px; word-break: break-word; }
.doc-list__meta { color: var(--muted); font-size: 12px; }

/* The follow-up card turns amber once the date has passed - the same signal the jobs grid
   uses for a stalled job, so "late" reads the same everywhere. */
.followup { display: flex; align-items: center; gap: 9px; }
.followup__icon { color: var(--primary); flex: 0 0 16px; }
.followup__date { font-weight: 600; }
.followup--overdue .followup__icon, .followup--overdue .followup__date { color: var(--warning); }

/* The stage pill beside the page title, as drawn: a coloured dot and the stage name. */
.stage-dot { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--muted); }

.stage-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.stage-dot--slate { color: #64748b; }
.stage-dot--blue { color: var(--primary); }
.stage-dot--purple { color: var(--purple); }
.stage-dot--sky { color: var(--sky); }
.stage-dot--amber { color: var(--warning); }
.stage-dot--green { color: var(--success); }
.stage-dot--dark-green { color: #0f7a37; }

.empty-note { color: var(--muted); font-size: 13px; margin: 0; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-grid--full { grid-column: 1 / -1; }

@media (max-width: 1100px) {
    /* Seven columns will not fit beside a stacked sidebar; let them scroll horizontally
       rather than crushing the labels to two characters. */
    .track__steps { grid-auto-columns: minmax(96px, 1fr); }
    .track { overflow-x: auto; }
}

@media (max-width: 767px) {
    .field-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 1399px) {
    /* Never drop below 4 columns, even on small screens - a stretched 2- or 3-up
       grid at this width leaves the cards looking oversized for how little each
       one holds. */
    .operator-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .detail, .approval-grid, .settings { grid-template-columns: minmax(0, 1fr); }
    .settings__rail { flex-direction: row; overflow-x: auto; }
}

@media (max-width: 767px) {
    .figures, .action-pair { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    /* Below phone width the 4-up grid still holds, but the card's desktop
       padding/type scale is too large to fit four across - shrink it down. */
    .operator-grid { gap: 8px; }
    .operator-card { padding: 12px 6px; }
    .operator-card .avatar--lg { width: 36px; height: 36px; font-size: 12px; }
    .operator-card__name { font-size: 12px; margin-top: 6px; }
    .operator-card__area { font-size: 10px; }
    .operator-card__split { margin: 8px 0; gap: 4px; }
    .operator-card__split b { font-size: 14px; }
    .operator-card__split span { font-size: 9px; }

    /* "Performance" plus a percentage no longer fit side by side at this card
       width - stack them instead of letting the value collide with the meter
       bar underneath. */
    .operator-card .meter-row { flex-direction: column; gap: 2px; font-size: 9px; }
    .operator-card .meter-row b { font-size: 11px; }
}

/* ------------------------------------------------------ operator profile

   One operator's own screen, reached from the chart button on their row. The header is a
   single card - identity on the left, the three headline figures stacked down the right -
   with the tab strip sitting on the page background underneath it rather than inside a
   card, as drawn. */

.profile { display: grid; grid-template-columns: minmax(0, 1fr) 168px; gap: 26px; padding: 24px 26px; }

.profile__id { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 20px; align-items: start; }

.profile__avatar { width: 76px; height: 76px; font-size: 25px; border-radius: 18px; }

/* The status dot sits on the corner of a rounded square here rather than a circle, so it
   needs pushing out further than .avatar-wrap .online does for the round avatars. */
.profile__id .avatar-wrap .online { right: -2px; bottom: -2px; width: 15px; height: 15px; border-width: 3px; }

.profile__name { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; font-size: 27px; }

.profile__meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 10px 0 18px; color: var(--muted); font-size: 13px; }
.profile__meta > span, .profile__meta > a { display: inline-flex; align-items: center; gap: 7px; }
.profile__meta svg { color: var(--muted-light); flex: 0 0 auto; }

.profile__score { max-width: 460px; }
.profile__caption { color: var(--muted-light); font-size: 12px; margin: 7px 0 0; }

.profile__figures { display: flex; flex-direction: column; gap: 10px; }

.profile__figure { border-radius: 12px; padding: 12px 14px; text-align: center; background: var(--page); }
.profile__figure b { display: block; font-size: 25px; font-weight: 700; line-height: 1.15; }
.profile__figure span { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.profile__figure--blue { background: var(--primary-soft); }
.profile__figure--blue b { color: var(--primary); }
.profile__figure--green { background: var(--success-soft); }
.profile__figure--green b { color: var(--success); }

/* The tab strip on the page background. .tabs itself assumes it is the top edge of a card,
   so this only has to undo the card padding and give it room to breathe. */
.tabs--page { padding: 0; margin: 22px 0 20px; }

/* The Overview tiles: a soft-tinted block per figure, icon top-left, as drawn. Distinct
   from .stat (the dashboard's white tile with a trend chip) - these carry no trend and sit
   four-up inside a column, not five-up across the page. */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }

.tile { border-radius: 12px; padding: 15px 16px; }
.tile__icon { display: block; margin-bottom: 12px; }
.tile__value { font-size: 25px; font-weight: 700; line-height: 1.15; }
.tile__label { color: var(--muted); font-size: 12px; margin-top: 2px; }

.tile--blue { background: var(--primary-soft); } .tile--blue .tile__icon { color: var(--primary); }
.tile--purple { background: var(--purple-soft); } .tile--purple .tile__icon { color: var(--purple); }
.tile--green { background: var(--success-soft); } .tile--green .tile__icon { color: var(--success); }
.tile--amber { background: var(--warning-soft); } .tile--amber .tile__icon { color: var(--warning); }

/* Active Jobs and Recent Leads: a seller, their address, and whatever badges the panel
   carries on the right. Ruled rather than boxed, so a panel of eight does not read as
   eight separate cards. */
.entry-list { display: flex; flex-direction: column; }

.entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}

.entry:last-child { border-bottom: 0; }
.entry:hover { text-decoration: none; }
.entry:hover .entry__name { color: var(--primary); }
.entry__body { min-width: 0; }
.entry__name { font-weight: 600; }
.entry__address { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 3px; }
.entry__address svg { color: var(--muted-light); flex: 0 0 auto; }
.entry__marks { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.entry__date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Red once the job has sat still past the stale threshold - the same signal the jobs grid
   uses, so "going cold" reads identically on both screens (JP-04). */
.entry__date--stale { color: var(--danger); }

/* A scheduled follow-up, as drawn: stage chip, seller, when, and the last thing said. */
.fu { border-radius: 11px; border: 1px solid var(--border); background: #fbfbfc; padding: 13px 14px; }
.fu + .fu { margin-top: 10px; }
.fu--due { background: var(--primary-soft); border-color: #dde9fd; }
.fu--overdue { background: var(--warning-soft); border-color: #f6e3bd; }
.fu__head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 7px; }
.fu__name { font-weight: 700; }
.fu__when { color: var(--muted); font-size: 13px; }
.fu__note { color: var(--muted); font-size: 13px; margin: 5px 0 0; }

/* The operator a dialog is about, shown at the top of it - the row it was opened from is
   behind a backdrop by then, so the modal has to name who it is editing. */
.assignee {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: #fbfbfc;
}

.assignee__name { font-weight: 700; }
.assignee__area { color: var(--muted); font-size: 13px; }

.field-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.field-note svg { flex: 0 0 auto; }

@media (max-width: 1100px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile { grid-template-columns: minmax(0, 1fr); }
    .profile__figures { flex-direction: row; }
    .profile__figure { flex: 1; }
}

@media (max-width: 767px) {
    .profile { padding: 20px 18px; }
    .profile__id { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .profile__name { font-size: 22px; }
    .profile__figures { flex-direction: column; }
    .tiles { grid-template-columns: minmax(0, 1fr); }
    .entry { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ----------------------------------------------- add-operator credentials

   The Add Operator dialog creates two things at once: the operator record and the mobile
   login that goes with it. The second half is set off in its own block so it is obvious a
   password is being set here, rather than reading as four more contact fields. */

.credentials {
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
}

.credentials .section-label { margin: 0 0 6px; }
.credentials .form-row:last-child { margin-bottom: 0; }

.pw-row { display: flex; align-items: flex-start; gap: 10px; }
.pw-row .input-wrap { flex: 1; min-width: 0; }
.pw-row .input { padding-right: 42px; }
.pw-row .btn { flex: 0 0 auto; padding-top: 13px; padding-bottom: 13px; }

/* --------------------------------------------------- settings: account tab */

/* The Account tab is four stacked cards rather than the single card every other
   settings tab renders, so the spacing between them lives here. */
.settings__stack { display: flex; flex-direction: column; gap: 20px; }

/* The soft rounded glyph beside each Account card title, as drawn. */
.card__glyph {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: var(--slate-soft);
    color: var(--muted);
}

.card__glyph--blue { background: var(--primary-soft); color: var(--primary); }
.card__glyph--purple { background: var(--purple-soft); color: var(--purple); }
.card__glyph--green { background: var(--success-soft); color: var(--success); }
.card__glyph--amber { background: var(--warning-soft); color: #b45309; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Narrower than the profile fields above them, as drawn: a password is short, and a
   full-width box invites a sentence. */
.pw-form .form-row { max-width: 430px; }
.pw-form .input { padding-right: 42px; }

/* This browser's own session, tinted so it reads as "you" without a second badge doing
   all the work. */
.rowlist__item.is-current { background: var(--primary-soft); border-color: transparent; }

.session-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex: 0 0 auto;
}

/* Always visible, unlike .row-actions, which appears on row hover. These are the only
   way to act on a credentials row, and a touch screen has no hover to reveal them. */
.cell-actions { display: flex; gap: 8px; justify-content: flex-end; }
.cell-actions .btn { white-space: nowrap; }
.cell-actions .btn svg { margin-right: 5px; vertical-align: -2px; }


/* --- Dashboard: Follow-ups & Schedule (design only - the panel is not in the spec).
   Transcribed from the approved screen: tinted icon beside the title, three counted pills
   on the right, and a dense table underneath. */

.panel-title { display: flex; align-items: flex-start; gap: 12px; }

.panel-title__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
}

/* Tab and Done/Reopen posts land back on this panel via a URL fragment, so the sticky
   topbar (.topbar, console.css) must not cover it when the browser scrolls it into view. */
#follow-up-schedule { scroll-margin-top: 84px; }

.fu-tabs { display: flex; flex-wrap: wrap; gap: 8px; }

.fu-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    background: var(--slate-soft);
    color: var(--muted);
}

.fu-tab:hover { text-decoration: none; border-color: var(--border-strong); }

.fu-tab__count { font-variant-numeric: tabular-nums; opacity: .75; }

/* Each tab keeps its own colour once selected, as the design draws them: today is the
   thing to act on, upcoming is a warning tint, done is spent. An unselected tab is grey
   whichever one it is, so only one thing on the row reads as current. */
.fu-tab--today.is-active { background: var(--primary); color: #fff; }

/* Upcoming keeps its amber tint whether selected or not - only Today (the thing to act
   on) and Done (spent) go grey when they are not the current tab. */
.fu-tab--upcoming { background: var(--warning-soft); color: #b45309; }
.fu-tab--upcoming.is-active { border-color: #f6dfb4; }
.fu-tab--done.is-active { background: var(--border); color: var(--text); }
.fu-tab.is-active .fu-tab__count { opacity: 1; }

/* The seven columns are dense and none of them may wrap onto three lines - not even the
   note, which clips to a single line with an ellipsis instead (see .cell-note below). */
.table--schedule th, .table--schedule td { white-space: nowrap; }

.cell-place { display: flex; align-items: center; gap: 4px; }
.cell-place svg { flex: 0 0 auto; color: var(--muted-light); }

.cell-phone { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }

/* Clipped to one line rather than wrapped: a long note must not make one row taller than
   its neighbours and push the rest of the schedule off the screen. The full text is on the
   element's title. */
.cell-note {
    max-width: 280px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Seller is the row's own identity, not a cross-reference to something else, so it reads
   in the row's own text colour rather than link-blue - only Operator (a person elsewhere
   in the console) and Contact (an action) use the link colour here. */
.table--schedule .cell-primary a { color: var(--text); }
.table--schedule .cell-primary a:hover { color: var(--primary); text-decoration: underline; }

/* Type reads as plain coloured text in this table, not a tinted pill - the pill treatment
   is reserved for the Status column so the two don't compete for attention. */
.table--schedule td .badge--plain {
    background: transparent;
    padding: 0;
    font-size: 13px;
}

.card__foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

@media (max-width: 767px) {
    /* The head stacks so the three pills get a full row of their own rather than being
       crushed against the title (the console is desktop-first but has to reflow). */
    .card__head:has(.fu-tabs) { flex-wrap: wrap; }
    .fu-tabs { margin-left: 0; width: 100%; }
    .cell-note { max-width: 200px; }
}

/* ------------------------------------------------- Settings: webhook log

   The day list is a row list of links, and the viewer below it is a terminal-style block.
   Entries are wrapped rather than scrolled sideways: a raw JSON body is one long line, and
   a horizontal scrollbar under 500 lines of it is unreadable. */

.rowlist__item--link { color: inherit; }
.rowlist__item--link:hover { background: #f3f4f6; text-decoration: none; }
.rowlist__item--link svg { color: var(--muted); flex: 0 0 auto; }

.logview {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 11px;
    padding: 16px;
    margin: 0;
    max-height: 520px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.text-danger{
color:#ff0000;
}
