/* ==========================================================================
   Authentication pages + dashboard application
   ========================================================================== */

/* ------------------------------------------------------------ Auth */
.auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
}

.auth-main {
    display: flex;
    flex-direction: column;
    padding: var(--s-5) var(--gutter);
}

.auth-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
}

.auth-top .back {
    font-size: var(--t-sm);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
}

.auth-top .back:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-top .back svg {
    width: 16px;
    height: 16px;
}

.auth-form-wrap {
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding-block: var(--s-8);
}

.auth-form-wrap h1 {
    font-size: clamp(2.2rem, 4vw, 3rem);
    letter-spacing: -0.04em;
}

.auth-form-wrap > p {
    margin-top: var(--s-3);
    color: var(--muted);
}

.auth-form {
    margin-top: var(--s-6);
}

.auth-form .notice {
    margin-bottom: var(--s-5);
}

.auth-form .btn-block {
    margin-top: var(--s-6);
}

.pw-wrap {
    position: relative;
}

.pw-wrap .input {
    padding-right: 3.25rem;
}

.pw-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    color: var(--muted);
}

.pw-toggle:hover {
    background: var(--paper-2);
    color: var(--ink);
}

.pw-toggle svg {
    width: 18px;
    height: 18px;
}

.auth-alt {
    margin-top: var(--s-6);
    padding-top: var(--s-5);
    border-top: var(--b) solid var(--line);
    font-size: var(--t-sm);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--s-2);
}

.auth-foot {
    font-size: var(--t-xs);
    color: var(--muted);
    font-family: var(--font-mono);
}

.auth-side {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--s-7);
    padding: clamp(2rem, 5vw, 4.5rem);
    background: var(--blue);
    color: #fff;
    border-left: var(--b-lg) solid var(--line);
    overflow: hidden;
    align-items: center;
    /* The blue panel always uses light-theme colours, even in dark mode. */
    --line: #111318;
    --shadow: #111318;
    --paper: #f5f2ea;
    --paper-2: #ebe6d9;
    --card: #ffffff;
    --ink: #111318;
    --ink-2: #353a45;
    --muted: #5d6472;
    --line-soft: #d8d1c1;
    --blue-wash: #dde5ff;
    --sun-wash: #fff2c9;
    --mint-wash: #d4f2e3;
    --on-ink: #f5f2ea;
}

/* Everything in the panel shares one centred column. */
.auth-side > * {
    width: min(100%, 460px);
}

.auth-side-quote {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.04em;
    max-width: 16ch;
    isolation: isolate;
}

/* Behind the quote's text (see .mark in system.css), so it never hides the line above. */
.auth-side-quote span {
    position: relative;
    z-index: -1;
    background: var(--sun);
    color: #111318;
    padding-inline: 0.12em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.auth-card {
    max-width: 440px;
    background: var(--card);
    color: var(--ink);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: 8px 8px 0 #111318;
    padding: var(--s-5);
    display: grid;
    gap: var(--s-4);
}

.auth-card .rf-panel {
    background: var(--paper);
}

/* Three steps in one card, divided by rules. */
.auth-steps {
    list-style: none;
    padding: 0;
    background: #fff;
    color: #111318;
    border: var(--b) solid #111318;
    border-radius: var(--r-lg);
    box-shadow: 8px 8px 0 #111318;
    overflow: hidden;
}

.auth-steps li {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: var(--s-4);
    align-items: center;
    padding: var(--s-5);
    font-family: var(--font-display);
    font-weight: 700;
}

.auth-steps li + li {
    border-top: var(--b) solid #111318;
}

.auth-steps li:last-child {
    background: #dde5ff;
}

.auth-steps small [data-agency-email] {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.auth-steps b {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    background: var(--sun);
    border: var(--b) solid #111318;
    border-radius: var(--r-sm);
    font-family: var(--font-display);
}

.auth-steps small {
    display: block;
    margin-top: 2px;
    font-family: var(--font-body);
    font-weight: 400;
    color: #5d6472;
}

@media (max-width: 900px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-side {
        display: none;
    }

    .auth-form-wrap {
        padding-block: var(--s-7);
    }
}

/* ------------------------------------------------------------ App shell */
.app {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-right: var(--b) solid var(--line);
    padding: var(--s-5) var(--s-4);
    overflow-y: auto;
    z-index: 60;
}

.side-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--s-2) var(--s-5);
    border-bottom: var(--b) solid var(--line);
}

.side-close {
    display: none;
}

.side-nav {
    padding-top: var(--s-4);
    display: grid;
    gap: var(--s-5);
}

.side-group {
    display: grid;
    gap: 2px;
}

.side-group-label {
    padding: 0 var(--s-3) var(--s-2);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.side-link {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 0.55rem var(--s-3);
    border: var(--b) solid transparent;
    border-radius: var(--r);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background-color 0.12s, transform 0.12s var(--ease);
}

.side-link svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.side-link:hover {
    background: var(--paper-2);
}

.side-link[aria-current="page"] {
    background: var(--blue);
    color: #fff;
    border-color: var(--line);
    box-shadow: 3px 3px 0 var(--shadow);
}

.side-foot {
    margin-top: auto;
    padding-top: var(--s-5);
    display: grid;
    gap: var(--s-4);
}

.side-site-link {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding-inline: var(--s-3);
    font-size: var(--t-sm);
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.side-site-link:hover {
    color: var(--ink);
}

.side-site-link svg {
    width: 16px;
    height: 16px;
}

.side-user {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--paper);
    min-width: 0;
}

.side-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border: var(--b) solid var(--line);
    border-radius: var(--r-sm);
    background: var(--sun);
    color: var(--on-sun);
    font-family: var(--font-display);
    font-weight: 700;
}

.side-email {
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-actions {
    display: flex;
    gap: var(--s-2);
}

.side-signout {
    flex: 1;
}

[data-theme="light"] .when-dark,
[data-theme="dark"] .when-light {
    display: none;
}

.app-topbar {
    display: none;
}

.sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(17, 19, 24, 0.45);
    z-index: 55;
}

.app-main {
    min-width: 0;
    padding: var(--s-6) clamp(1rem, 3.5vw, 3rem) var(--s-8);
}

.app-content {
    max-width: 1120px;
}

@media (max-width: 960px) {
    .app {
        grid-template-columns: 1fr;
    }

    .app-topbar {
        position: sticky;
        top: 0;
        z-index: 50;
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 60px;
        padding-inline: var(--gutter);
        background: var(--card);
        border-bottom: var(--b) solid var(--line);
    }

    .app-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        transform: translateX(-105%);
        transition: transform 0.22s var(--ease);
        box-shadow: none;
    }

    .app-sidebar.is-open {
        transform: none;
        box-shadow: 6px 0 0 var(--shadow);
    }

    .side-close {
        display: inline-grid;
    }

    body.nav-open {
        overflow: hidden;
    }

    .app-main {
        padding-top: var(--s-5);
    }
}

/* ------------------------------------------------------------ App page header */
.app-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--s-4);
    padding-bottom: var(--s-5);
    margin-bottom: var(--s-6);
    border-bottom: var(--b) solid var(--line);
}

.app-head h1 {
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    letter-spacing: -0.035em;
}

.app-head p {
    margin-top: var(--s-2);
    color: var(--muted);
    max-width: 60ch;
}

.app-head .eyebrow {
    margin-bottom: var(--s-2);
}

/* ------------------------------------------------------------ Cards */
.card {
    background: var(--card);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
}

.card-shadow {
    box-shadow: var(--sh);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-4) var(--s-5);
    border-bottom: var(--b) solid var(--line);
}

.card-head h2 {
    font-size: 1.0625rem;
    letter-spacing: -0.015em;
}

.card-head a {
    font-size: var(--t-sm);
}

.card-body {
    padding: var(--s-5);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--s-5);
    align-items: start;
}

.stack {
    display: grid;
    gap: var(--s-5);
    align-content: start;
}

@media (max-width: 1080px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------ Overview */
.welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-4);
    padding: var(--s-5);
    margin-bottom: var(--s-6);
    background: var(--sun);
    color: var(--on-sun);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh);
    --line: #111318;
    --shadow: #111318;
}

.welcome h2 {
    font-size: var(--t-lg);
}

.welcome p {
    font-size: var(--t-sm);
}

.welcome .btn:not(.btn-ink) {
    --btn-bg: #fff;
    --btn-fg: #111318;
}

.welcome .btn-ink {
    --btn-bg: #111318;
    --btn-fg: #f5f2ea;
}

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
    background: var(--card);
    margin-bottom: var(--s-6);
    overflow: hidden;
}

.stat-tile {
    padding: var(--s-5);
    border-right: var(--b) solid var(--line);
    min-width: 0;
}

.stat-tile:last-child {
    border-right: 0;
}

.stat-tile:first-child {
    background: var(--blue-wash);
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.stat-value {
    display: block;
    margin-top: var(--s-2);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 3.4vw, 2.75rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.stat-sub {
    display: block;
    margin-top: var(--s-2);
    font-size: 0.8125rem;
    color: var(--muted);
}

@media (max-width: 860px) {
    .stat-tiles {
        grid-template-columns: 1fr 1fr;
    }

    .stat-tile:nth-child(2) {
        border-right: 0;
    }

    .stat-tile:nth-child(-n + 2) {
        border-bottom: var(--b) solid var(--line);
    }
}

.reply-list {
    list-style: none;
    padding: 0;
}

.reply-list li + li {
    border-top: 1.5px solid var(--line-soft);
}

.reply-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--s-4);
    align-items: start;
    padding: var(--s-4) var(--s-5);
}

.reply-row .stars {
    font-size: 0.8125rem;
    padding-top: 2px;
}

.reply-row .r-text {
    font-size: 0.9375rem;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reply-row .r-reply {
    font-size: var(--t-sm);
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reply-row time {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--muted);
    white-space: nowrap;
}

@media (max-width: 560px) {
    .reply-row {
        grid-template-columns: 1fr;
        gap: var(--s-1);
    }
}

.checklist {
    list-style: none;
    padding: 0;
}

.checklist li {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: var(--s-3);
    padding: var(--s-4) var(--s-5);
    align-items: start;
}

.checklist li + li {
    border-top: 1.5px solid var(--line-soft);
}

.check-box {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: var(--b) solid var(--line);
    border-radius: var(--r-sm);
    background: var(--card);
    /* line-height 1 so a text glyph like "?" sits in the true centre, not on the body text's baseline */
    line-height: 1;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 700;
}

.check-box svg {
    width: 14px;
    height: 14px;
    stroke-width: 3.5;
}

.is-done .check-box {
    background: var(--mint);
    color: #fff;
}

.checklist strong {
    display: block;
    font-family: var(--font-display);
    font-size: 0.9375rem;
}

.is-done strong {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    color: var(--muted);
}

.checklist p {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 2px;
}

.checklist a {
    font-size: 0.8125rem;
}

.voice-summary dl {
    display: grid;
    gap: var(--s-3);
}

.voice-summary dt {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.voice-summary dd {
    margin: 2px 0 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ Empty + loading */
.empty {
    padding: var(--s-7) var(--s-5);
    text-align: center;
    border: var(--b) dashed var(--line-soft);
    border-radius: var(--r);
    margin: var(--s-5);
}

.empty h3 {
    font-size: 1.125rem;
    margin-bottom: var(--s-2);
}

.empty p {
    color: var(--muted);
    font-size: var(--t-sm);
    max-width: 42ch;
    margin: 0 auto var(--s-4);
}

.skeleton {
    display: block;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--paper-2), var(--line-soft), var(--paper-2));
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
}

.skeleton + .skeleton {
    margin-top: var(--s-2);
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

/* ------------------------------------------------------------ Reply studio */
.studio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--s-5);
    align-items: start;
}

@media (max-width: 1000px) {
    .studio {
        grid-template-columns: 1fr;
    }
}

.star-picker {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}

.star-picker input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.star-picker label {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    color: var(--line-soft);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s, transform 0.12s var(--ease);
}

.star-picker label:hover,
.star-picker label:hover ~ label,
.star-picker input:checked ~ label {
    color: #111318;
    background: var(--sun);
}

.star-picker input:focus-visible + label {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.rating-caption {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--muted);
}

.studio-output {
    position: sticky;
    top: var(--s-5);
}

.output-empty {
    padding: var(--s-7) var(--s-5);
    text-align: center;
    color: var(--muted);
}

.output-empty .big-q {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--s-4);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--blue-wash);
    color: var(--ink);
}

.output-empty .big-q svg {
    width: 28px;
    height: 28px;
}

.output-text {
    min-height: 180px;
    font-size: 1rem;
    line-height: 1.6;
}

.output-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-3);
    margin-top: var(--s-3);
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--muted);
}

.output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    margin-top: var(--s-5);
}

.source-review {
    margin-bottom: var(--s-4);
    padding: var(--s-3) var(--s-4);
    border-left: 4px solid var(--line);
    background: var(--paper);
    font-size: var(--t-sm);
    color: var(--ink-2);
}

/* ------------------------------------------------------------ Reply history */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    align-items: center;
    justify-content: space-between;
    padding: var(--s-4) var(--s-5);
    border-bottom: var(--b) solid var(--line);
}

.search {
    position: relative;
    flex: 1 1 260px;
    max-width: 380px;
}

.search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

.search .input {
    padding-left: 2.4rem;
    min-height: 42px;
}

.segmented.small span {
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    text-align: left;
    padding: var(--s-3) var(--s-5);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    border-bottom: var(--b) solid var(--line);
    white-space: nowrap;
}

.history-table td {
    padding: var(--s-4) var(--s-5);
    border-bottom: 1.5px solid var(--line-soft);
    vertical-align: top;
    font-size: var(--t-sm);
}

.history-table tr:last-child td {
    border-bottom: 0;
}

.history-table .col-when {
    width: 120px;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--muted);
}

.history-table .col-rating {
    width: 100px;
}

.history-table .col-act {
    width: 1%;
    white-space: nowrap;
}

.clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.is-expanded .clamp {
    -webkit-line-clamp: unset;
    display: block;
}

.history-table .reply-cell {
    color: var(--ink-2);
}

.row-toggle {
    margin-top: var(--s-2);
    font-size: var(--t-xs);
    font-weight: 600;
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.history-foot {
    padding: var(--s-3) var(--s-5);
    border-top: var(--b) solid var(--line);
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--muted);
}

@media (max-width: 760px) {
    .history-table thead {
        display: none;
    }

    .history-table,
    .history-table tbody,
    .history-table tr,
    .history-table td {
        display: block;
        width: 100%;
    }

    .history-table tr {
        padding: var(--s-4) var(--s-5);
        border-bottom: 1.5px solid var(--line-soft);
        display: grid;
        grid-template-columns: 1fr auto;
        gap: var(--s-2);
    }

    .history-table td {
        padding: 0;
        border: 0;
    }

    .history-table .col-when,
    .history-table .col-rating {
        width: auto;
    }

    .history-table td.review-cell,
    .history-table td.reply-cell {
        grid-column: 1 / -1;
    }

    .history-table td.reply-cell {
        padding-left: var(--s-3);
        border-left: 3px solid var(--blue);
    }

    .history-table .col-act {
        grid-column: 1 / -1;
        width: auto;
    }
}

/* ------------------------------------------------------------ Setup */
.setup-steps {
    list-style: none;
    padding: 0;
    display: grid;
    gap: var(--s-4);
}

.setup-step {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: var(--s-5);
    padding: var(--s-5);
    background: var(--card);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
}

.setup-step:last-child {
    box-shadow: var(--sh);
}

.setup-num {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--sun);
    color: var(--on-sun);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
}

.setup-step h2 {
    font-size: var(--t-lg);
    margin-bottom: var(--s-2);
}

.setup-step p {
    color: var(--ink-2);
    font-size: 0.9375rem;
    max-width: 62ch;
}

.setup-step .btn-row {
    margin-top: var(--s-4);
}

.setup-step details {
    margin-top: var(--s-4);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    background: var(--paper);
}

.setup-step summary {
    padding: var(--s-3) var(--s-4);
    font-weight: 600;
    font-size: var(--t-sm);
    cursor: pointer;
}

.setup-step details ol {
    padding: 0 var(--s-5) var(--s-4) 2.4rem;
    font-size: var(--t-sm);
    color: var(--ink-2);
    display: grid;
    gap: var(--s-2);
}

kbd,
code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.05rem 0.35rem;
    border: 1.5px solid var(--line);
    border-radius: 3px;
    background: var(--card);
    overflow-wrap: anywhere;
}

@media (max-width: 560px) {
    .setup-step {
        grid-template-columns: 1fr;
        gap: var(--s-3);
    }

    .setup-num {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* ------------------------------------------------------------ Settings */
.settings-form .card-body + .card-body {
    border-top: var(--b) solid var(--line);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-4) var(--s-5);
    border-top: var(--b) solid var(--line);
    background: var(--paper);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.save-state {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
}

.save-state::before {
    content: "";
    width: 8px;
    height: 8px;
    border: 1.5px solid var(--line);
    background: var(--mint);
}

.save-state.is-dirty::before {
    background: var(--sun);
}

.counter {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--muted);
    text-align: right;
}

.brief {
    background: var(--ink);
    color: var(--on-ink);
    border: var(--b) solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: 4px 4px 0 var(--blue);
}

.brief .card-head {
    border-color: color-mix(in srgb, var(--on-ink) 30%, transparent);
}

.brief pre {
    margin: 0;
    padding: var(--s-5);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.brief .k {
    color: var(--sun);
}

[data-theme="dark"] .brief .k {
    color: var(--blue-deep);
}

.brief .v {
    opacity: 0.75;
}

.brief .card-body {
    font-size: 0.8125rem;
    opacity: 0.85;
    padding-top: 0;
}

/* ------------------------------------------------------------ Account */
.kv {
    display: grid;
    grid-template-columns: 180px 1fr;
}

.kv dt,
.kv dd {
    padding: var(--s-4) var(--s-5);
    border-bottom: 1.5px solid var(--line-soft);
}

.kv dt {
    font-family: var(--font-mono);
    font-size: var(--t-xs);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    padding-top: 1.15rem;
}

.kv dd {
    margin: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.kv dt:nth-last-of-type(1),
.kv dd:nth-last-of-type(1) {
    border-bottom: 0;
}

@media (max-width: 560px) {
    .kv {
        grid-template-columns: 1fr;
    }

    .kv dt {
        border-bottom: 0;
        padding-bottom: 0;
    }
}

.plan-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-5);
}

.plan-strip h3 {
    font-size: var(--t-lg);
}

.plan-strip .price {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

.plan-strip .price small {
    font-family: var(--font-body);
    font-size: var(--t-sm);
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0;
}

/* ------------------------------------------------------------ Toast */
.toast {
    position: fixed;
    right: var(--s-5);
    bottom: var(--s-5);
    z-index: 90;
    display: flex;
    align-items: center;
    gap: var(--s-2);
    max-width: calc(100vw - 2rem);
    padding: 0.7rem 1rem;
    background: var(--ink);
    color: var(--on-ink);
    border: var(--b) solid var(--line);
    border-radius: var(--r);
    box-shadow: 4px 4px 0 var(--blue);
    font-weight: 600;
    font-size: var(--t-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(calc(100% + 2rem));
    transition: transform 0.25s var(--ease), opacity 0.2s, visibility 0s linear 0.25s;
}

.toast.is-shown {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: transform 0.25s var(--ease), opacity 0.2s, visibility 0s;
}

.toast svg {
    width: 18px;
    height: 18px;
}

/* ------------------------------------------------------------ Manager setup, approvals, admin */
.copy-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-3);
    margin-top: var(--s-3);
}

.copy-field code {
    font-size: 0.95rem;
    padding: 0.4rem 0.6rem;
}

.copy-field .input {
    flex: 1 1 180px;
    width: auto;
}

.plain-steps {
    padding-left: 1.3rem;
    display: grid;
    gap: var(--s-2);
    color: var(--ink-2);
    font-size: 0.9375rem;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    justify-content: flex-end;
}

.history-table tr.is-pending td {
    background: var(--sun-wash);
}

@media (max-width: 760px) {
    .history-table tr.is-pending {
        background: var(--sun-wash);
    }

    .history-table tr.is-pending td {
        background: transparent;
    }
}

.history-table td.reply-cell .textarea {
    min-width: 220px;
}

.admin-help {
    padding: var(--s-4) var(--s-5);
}

.admin-help summary {
    font-weight: 600;
    cursor: pointer;
}

.admin-help .plain-steps {
    margin-top: var(--s-4);
}

.admin-client .card-head {
    flex-wrap: wrap;
    gap: var(--s-3);
}

.admin-client .card-head h2 {
    margin: 0;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4) var(--s-5);
}

.admin-form .field {
    margin: 0;
    align-content: start;
}

/* Every control in the client form shares one height, so the two columns line up. */
.admin-form .input,
.admin-form .btn {
    height: 46px;
    min-height: 46px;
}

/* Paid until: date + quick buttons on one line. */
.date-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--s-2);
}

.date-row .btn {
    padding-inline: 0.8rem;
    font-size: 0.8125rem;
}

/* Phones: full-width date, the two quick buttons share the row below. */
@media (max-width: 520px) {
    .date-row {
        grid-template-columns: 1fr 1fr;
    }

    .date-row .input {
        grid-column: 1 / -1;
    }
}

/* Footer spans the card edge to edge, like the Reply settings page. */
.admin-form-wrap .form-actions {
    border-radius: 0 0 calc(var(--r-lg) - 2px) calc(var(--r-lg) - 2px);
}

@media (max-width: 760px) {
    .admin-form {
        grid-template-columns: 1fr;
    }

    .row-actions {
        justify-content: flex-start;
    }
}

/* ------------------------------------------------------------ Local demo account marker */
.demo-badge {
    display: inline-block;
    margin-bottom: var(--s-4);
    padding: 0.3rem 0.6rem;
    background: var(--sun);
    color: #111318;
    border: var(--b) solid #111318;
    border-radius: var(--r-sm);
    box-shadow: 2px 2px 0 #111318;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}
