/*
 * TuFichaPro interface.
 *
 * The look: an operations console. A dark rail, a cool light workspace, hard
 * 1px lines, monospaced figures and four state colours used like status LEDs:
 *
 *   yellow  it is waiting for you        blue   it is on its way
 *   green   it is answered               red    something went wrong
 *
 * White label: the only colours an agency changes are the --brand-* variables,
 * which the layout overrides per request (App\Domain\Branding\Brand). The text
 * colours that go on top of them are computed there, so any pair stays legible.
 * The four state colours never depend on the brand.
 *
 * No inline styles anywhere: the Content-Security-Policy forbids them.
 */

/* ---- Tokens --------------------------------------------------------------- */

:root {
    --brand-primary: #1967d2;
    --brand-secondary: #0b1220;
    --brand-on-primary: #ffffff;
    --brand-on-secondary: #ffffff;
    --brand-primary-text: #1967d2;
    --brand-primary-on-secondary: #3e7fd9;

    --page: #f6f8fb;
    --surface: #ffffff;
    --sunken: #f1f3f4;
    --ink: #202124;
    --ink-soft: #5f6368;
    --line: #e3e6ec;
    --line-strong: #c9ced6;

    --blue: #1a73e8;
    --blue-text: #1967d2;
    --blue-soft: #e8f0fe;
    --yellow: #fbbc04;
    --yellow-text: #8a5200;
    --yellow-soft: #fef7e0;
    --green: #34a853;
    --green-light: #81c995;
    --green-text: #137333;
    --green-soft: #e6f4ea;
    --orange: #fa7b17;
    --red: #ea4335;
    --red-text: #c5221f;
    --red-soft: #fce8e6;

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 10px;
    --radius-small: 7px;
    --sidebar: 252px;
    --tabbar: 62px;
    --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-primary-text);
}

/* ---- Base ----------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
blockquote,
figure {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

h1,
h2 {
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-size: clamp(1.55rem, 1.3rem + 0.9vw, 1.95rem);
}

h2 {
    font-size: 1.06rem;
    letter-spacing: -0.01em;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: 5px;
}

.icon {
    flex: none;
    vertical-align: -0.2em;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: -4rem;
    left: 1rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-small);
}

.skip-link:focus {
    top: 1rem;
}

/* Small labels are monospaced capitals: the console's own voice. */
.eyebrow,
.crumb {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.crumb span {
    margin-inline: 0.3em;
    opacity: 0.55;
}

.link {
    color: var(--brand-primary-text);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 0.2em;
    transition: text-decoration-color 0.15s;
    white-space: nowrap;
}

.link:hover {
    text-decoration-color: currentColor;
}

/* The brand as text, with a small card (a "ficha") before it. An agency logo replaces it in phase 6. */
.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    color: var(--ink);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    text-decoration: none;
}

.wordmark::before {
    content: "";
    flex: none;
    width: 0.78em;
    height: 0.92em;
    background: var(--brand-primary);
    border-radius: 2px;
    clip-path: polygon(0 0, 62% 0, 100% 34%, 100% 100%, 0 100%);
}

.wordmark--large {
    font-size: 1.7rem;
}

.wordmark--on-dark {
    color: var(--brand-on-secondary);
}

.wordmark--on-dark::before {
    background: var(--brand-primary-on-secondary);
}

/* ---- Stars ---------------------------------------------------------------- */

.stars {
    display: inline-flex;
    gap: 1px;
    vertical-align: middle;
}

.stars__star {
    fill: var(--star-off, #dadce0);
}

.stars__star.is-on {
    fill: var(--yellow);
}

/* ---- Buttons and forms ---------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.93rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.button--primary {
    background: var(--brand-primary);
    color: var(--brand-on-primary);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
}

.button--primary:hover {
    background: color-mix(in srgb, var(--brand-primary) 88%, #000);
}

.button--secondary {
    background: var(--surface);
    border-color: var(--line-strong);
}

.button--secondary:hover {
    background: var(--page);
    border-color: var(--ink-soft);
}

.button--quiet {
    padding-inline: 0.7rem;
    background: transparent;
    color: var(--ink-soft);
}

.button--quiet:hover {
    background: var(--sunken);
    color: var(--ink);
}

.button--danger {
    color: var(--red-text);
}

.button--danger:hover {
    background: var(--red-soft);
    color: var(--red-text);
}

.button--small {
    min-height: 40px;
    font-size: 0.88rem;
}

.button--block {
    width: 100%;
}

.form {
    display: grid;
    gap: 1.05rem;
}

.field {
    display: grid;
    gap: 0.4rem;
}

.field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.field__label {
    font-size: 0.88rem;
    font-weight: 600;
}

.field__aside {
    color: var(--brand-primary-text);
    font-size: 0.84rem;
    text-underline-offset: 0.2em;
}

.field__group {
    position: relative;
}

.field__hint {
    color: var(--ink-soft);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* One-time codes: big, spaced and monospaced, so they are easy to copy from a phone. */
.field__input--code {
    max-width: 14rem;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    letter-spacing: 0.18em;
}

.form--narrow {
    max-width: 26rem;
}

.checks {
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.checks legend {
    margin-bottom: 0.4rem;
    padding: 0;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.92rem;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.check:hover {
    border-color: var(--line-strong);
}

.check:has(input:checked) {
    background: color-mix(in srgb, var(--brand-primary) 7%, var(--surface));
    border-color: var(--brand-primary);
}

.check input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0.15rem 0 0;
    accent-color: var(--brand-primary);
}

.check small {
    display: block;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.link--button {
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
}

.field__input {
    width: 100%;
    min-height: 48px;
    padding: 0.55rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field__input::placeholder {
    color: #80868b;
}

.field__input:hover {
    border-color: var(--ink-soft);
}

.field__input:focus-visible {
    border-color: var(--brand-primary-text);
    border-radius: 8px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 24%, transparent);
}

.field__input.is-invalid {
    border-color: var(--red);
}

.field__group .field__input {
    padding-right: 3.2rem;
}

.field__toggle {
    position: absolute;
    top: 2px;
    right: 2px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 0;
    border-radius: 7px;
    color: var(--ink-soft);
    cursor: pointer;
}

.field__toggle[aria-pressed="true"] {
    background: var(--sunken);
    color: var(--brand-primary-text);
}

/* ---- Chips and notices ---------------------------------------------------- */

/* A state is a small light plus its name. */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.14rem 0.55rem;
    background: var(--sunken);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.chip--needs,
.chip--progress,
.chip--ok,
.chip--danger:not(.chip--outline) {
    padding-left: 0.5rem;
}

.chip--needs::before,
.chip--progress::before,
.chip--ok::before,
.chip--danger:not(.chip--outline)::before {
    content: "";
    width: 0.46rem;
    height: 0.46rem;
    background: currentColor;
    border-radius: 50%;
}

.chip--needs {
    background: var(--yellow-soft);
    color: var(--yellow-text);
}

.chip--needs::before {
    background: var(--yellow);
    box-shadow: 0 0 0 1px #e09c00;
}

.chip--progress {
    background: var(--blue-soft);
    color: var(--blue-text);
}

.chip--progress::before {
    background: var(--blue);
}

.chip--ok {
    background: var(--green-soft);
    color: var(--green-text);
}

.chip--ok::before {
    background: var(--green);
}

.chip--danger {
    background: var(--red-soft);
    color: var(--red-text);
}

.chip--danger:not(.chip--outline)::before {
    background: var(--red);
}

.chip--outline {
    background: transparent;
    border-color: var(--line-strong);
}

.chip--danger.chip--outline {
    border-color: color-mix(in srgb, var(--red) 55%, transparent);
}

.notice {
    display: flex;
    gap: 0.7rem;
    padding: 0.8rem 0.95rem;
    background: var(--sunken);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius-small);
    font-size: 0.9rem;
}

.notice .icon {
    margin-top: 0.15em;
}

.notice--needs {
    background: var(--yellow-soft);
    border-left-color: var(--yellow);
    color: #5c3a00;
}

.notice--needs .icon {
    color: var(--yellow-text);
}

.notice--danger {
    background: var(--red-soft);
    border-left-color: var(--red);
    color: #8c1d18;
}

.notice--danger .icon {
    color: var(--red-text);
}

.notice--ok {
    background: var(--green-soft);
    border-left-color: var(--green);
    color: #0d5226;
}

.notice--ok .icon {
    color: var(--green-text);
}

.notice--page {
    margin-bottom: 1rem;
}

.empty {
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.empty--block {
    padding: 2.5rem 1.5rem;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    text-align: center;
}

.empty__title {
    color: var(--ink);
    font-size: 1.1rem;
    font-weight: 650;
}

/* ---- What the customer wrote and what the business answers ---------------- */

.quote {
    color: var(--ink);
    font-size: 0.97rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.quote--small {
    font-size: 0.92rem;
}

.quote--large {
    padding: 0.1rem 0 0.1rem 1rem;
    border-left: 3px solid var(--line-strong);
    font-size: clamp(1.1rem, 1rem + 0.45vw, 1.3rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.quote--empty {
    color: var(--ink-soft);
    font-style: italic;
}

.quote--clamp,
.reply--clamp {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.reply {
    color: var(--ink);
    font-size: 0.93rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.reply--clamp {
    color: var(--ink-soft);
}

/* ---- Plain pages: placeholder home, errors, design index ----------------- */

.plain__main {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
}

.plain__card {
    display: grid;
    gap: 0.7rem;
    width: 100%;
    max-width: 34rem;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--brand-primary);
    border-radius: var(--radius);
}

.plain__card--wide {
    max-width: 44rem;
}

.plain__card p {
    color: var(--ink-soft);
}

.linklist {
    display: grid;
    margin-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.linklist__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    transition: background-color 0.15s;
}

.linklist__item:hover {
    background: var(--page);
}

.linklist__item .icon {
    color: var(--brand-primary-text);
}

.linklist__item strong,
.linklist__item small {
    display: block;
}

.linklist__item small {
    color: var(--ink-soft);
    font-size: 0.86rem;
}

/* ---- Dark surfaces: side rail, sign-in panel, rating ---------------------- */

/* A faint grid and a glow in the brand colour. Lines take the text colour, so
   the effect also works when an agency chooses a light secondary colour. */
.sidebar,
.auth__brand,
.rating {
    background-color: var(--brand-secondary);
    color: var(--brand-on-secondary);
}

.auth__brand,
.rating {
    background-image:
        radial-gradient(60% 55% at 100% 0%, color-mix(in srgb, var(--brand-primary) 38%, transparent), transparent 72%),
        linear-gradient(color-mix(in srgb, var(--brand-on-secondary) 5%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--brand-on-secondary) 5%, transparent) 1px, transparent 1px);
    background-size: auto, 28px 28px, 28px 28px;
}

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

.auth__layout {
    display: grid;
    min-height: 100vh;
}

.auth__brand {
    display: none;
}

.auth__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 2.5rem 1.4rem 1.75rem;
    background: var(--surface);
}

.auth__panel {
    display: grid;
    gap: 0.9rem;
    width: 100%;
    max-width: 24rem;
    animation: fade 0.3s both;
}

.auth__wordmark-small {
    margin-bottom: 1.5rem;
}

.auth__intro,
.auth__help {
    color: var(--ink-soft);
}

.auth__panel .form {
    margin-top: 0.75rem;
}

.auth__help {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 0.86rem;
}

.auth__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.5rem;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.auth__footer a {
    padding: 0.4rem 0;
    text-underline-offset: 0.2em;
}

@media (min-width: 900px) {
    .auth__layout {
        grid-template-columns: minmax(380px, 44%) 1fr;
    }

    .auth__brand {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 2rem;
        padding: 2.25rem 2.75rem 2.75rem;
    }

    .auth__wordmark-small {
        display: none;
    }

    .auth__claim {
        display: grid;
        gap: 0.8rem;
        max-width: 27rem;
    }

    .auth__claim-title {
        font-size: clamp(1.6rem, 0.9rem + 1.4vw, 2.2rem);
        font-weight: 650;
        letter-spacing: -0.03em;
        line-height: 1.15;
    }

    .auth__claim-title span {
        display: block;
    }

    .auth__claim-title span + span {
        color: var(--brand-primary-on-secondary);
    }

    .auth__claim-text {
        color: color-mix(in srgb, var(--brand-on-secondary) 70%, transparent);
        font-size: 0.98rem;
    }
}

/* The small console on the sign-in page. Decoration only. */
.feed {
    display: grid;
    width: min(100%, 25rem);
    margin: 0 auto;
    overflow: hidden;
    background: color-mix(in srgb, var(--brand-on-secondary) 5%, var(--brand-secondary));
    border: 1px solid color-mix(in srgb, var(--brand-on-secondary) 14%, transparent);
    border-radius: 12px;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7), 0 0 0 6px color-mix(in srgb, var(--brand-on-secondary) 3%, transparent);
    --star-off: color-mix(in srgb, var(--brand-on-secondary) 20%, transparent);
}

.feed__bar {
    display: flex;
    gap: 0.4rem;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid color-mix(in srgb, var(--brand-on-secondary) 10%, transparent);
}

.feed__bar span {
    width: 0.55rem;
    height: 0.55rem;
    background: color-mix(in srgb, var(--brand-on-secondary) 22%, transparent);
    border-radius: 50%;
}

.feed__row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0.9rem;
    animation: fade 0.5s both;
}

.feed__row + .feed__row {
    border-top: 1px solid color-mix(in srgb, var(--brand-on-secondary) 8%, transparent);
}

.feed__row:nth-child(3) {
    animation-delay: 0.12s;
}

.feed__row:nth-child(4) {
    animation-delay: 0.24s;
}

.feed__row:nth-child(5) {
    animation-delay: 0.36s;
}

.feed__lines {
    display: grid;
    gap: 0.35rem;
}

.feed__line {
    height: 0.4rem;
    background: color-mix(in srgb, var(--brand-on-secondary) 16%, transparent);
    border-radius: 99px;
}

.feed__line--short {
    width: 55%;
}

/* ---- Panel frame ---------------------------------------------------------- */

.ribbon {
    padding: 0.4rem 1rem;
    background: var(--ink);
    color: #e8eaed;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-align: center;
}

.ribbon a {
    margin-left: 0.4rem;
    font-weight: 600;
}

.shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.1rem;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.topbar__menu,
.sidebar__close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -0.5rem;
    border-radius: 8px;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: min(86vw, 310px);
    padding: 1rem 0.8rem 0.9rem;
    overflow-y: auto;
    border-right: 1px solid color-mix(in srgb, var(--brand-on-secondary) 10%, transparent);
    transform: translateX(-102%);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    visibility: hidden;
}

/* Opened with a plain link to #menu: it works without JavaScript. */
.sidebar:target {
    transform: none;
    visibility: visible;
}

.scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    background: rgba(11, 18, 32, 0.55);
}

.sidebar:target + .scrim {
    display: block;
}

.sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 0.55rem;
}

.sidebar .wordmark {
    color: var(--brand-on-secondary);
}

.sidebar .wordmark::before {
    background: var(--brand-primary-on-secondary);
}

.org {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    background: color-mix(in srgb, var(--brand-on-secondary) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-on-secondary) 14%, transparent);
    border-radius: 8px;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s;
}

.org:hover {
    border-color: color-mix(in srgb, var(--brand-on-secondary) 32%, transparent);
}

.org__text {
    display: grid;
    min-width: 0;
}

div.org {
    cursor: default;
}

/* Switching organization: a native <details>, so it opens without JavaScript. */
.orgmenu {
    position: relative;
}

.orgmenu summary {
    list-style: none;
}

.orgmenu summary::-webkit-details-marker {
    display: none;
}

.orgmenu[open] summary .icon {
    transform: rotate(180deg);
}

.orgmenu__list {
    display: grid;
    gap: 1px;
    max-height: 16rem;
    margin-top: 0.35rem;
    padding: 0.3rem;
    overflow-y: auto;
    background: color-mix(in srgb, var(--brand-on-secondary) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-on-secondary) 14%, transparent);
    border-radius: 8px;
}

.orgmenu__item {
    min-height: 38px;
    padding: 0.3rem 0.6rem;
    overflow: hidden;
    background: none;
    border: 0;
    border-radius: 6px;
    color: color-mix(in srgb, var(--brand-on-secondary) 78%, transparent);
    font-size: 0.88rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.orgmenu__item:hover {
    background: color-mix(in srgb, var(--brand-on-secondary) 9%, transparent);
    color: var(--brand-on-secondary);
}

.orgmenu__item.is-current {
    color: var(--brand-on-secondary);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--brand-primary-on-secondary);
}

.org__label,
.menu__label {
    color: color-mix(in srgb, var(--brand-on-secondary) 58%, transparent);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.org__name {
    overflow: hidden;
    font-size: 0.92rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu {
    display: grid;
    gap: 0.1rem;
}

.menu__label {
    padding: 0.95rem 0.7rem 0.3rem;
}

.menu__list {
    display: grid;
    gap: 1px;
}

.menu__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 40px;
    padding: 0.35rem 0.7rem;
    border-radius: 7px;
    color: color-mix(in srgb, var(--brand-on-secondary) 74%, transparent);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.menu__link:hover {
    background: color-mix(in srgb, var(--brand-on-secondary) 7%, transparent);
    color: var(--brand-on-secondary);
}

.menu__link.is-current {
    background: color-mix(in srgb, var(--brand-on-secondary) 10%, transparent);
    color: var(--brand-on-secondary);
    font-weight: 600;
}

.menu__link.is-current .icon {
    color: var(--brand-primary-on-secondary);
}

.menu__link.is-current::before {
    content: "";
    position: absolute;
    left: -0.8rem;
    top: 9px;
    bottom: 9px;
    width: 3px;
    background: var(--brand-primary-on-secondary);
    border-radius: 0 3px 3px 0;
}

.menu__text {
    flex: 1;
}

.menu__badge,
.tabbar__badge {
    display: grid;
    place-items: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    background: var(--yellow);
    border-radius: 5px;
    color: #202124;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.account {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: auto;
    padding: 0.7rem 0.55rem 0.2rem;
    border-top: 1px solid color-mix(in srgb, var(--brand-on-secondary) 10%, transparent);
    text-decoration: none;
}

.avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    background: color-mix(in srgb, var(--brand-primary-on-secondary) 24%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand-primary-on-secondary) 55%, transparent);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
}

.account__who {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding: 0.25rem;
    margin: -0.25rem;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

a.account__who:hover {
    background: color-mix(in srgb, var(--brand-on-secondary) 8%, transparent);
}

.account__text {
    display: grid;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.account__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account__form {
    display: contents;
}

.account__out {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 0;
    border-radius: 7px;
    color: color-mix(in srgb, var(--brand-on-secondary) 66%, transparent);
    cursor: pointer;
}

.account__out:hover {
    background: color-mix(in srgb, var(--brand-on-secondary) 9%, transparent);
    color: var(--brand-on-secondary);
}

.account__name {
    font-size: 0.88rem;
    font-weight: 600;
}

.account__role {
    color: color-mix(in srgb, var(--brand-on-secondary) 60%, transparent);
    font-size: 0.78rem;
}

.content {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.3rem 1.1rem calc(var(--tabbar) + 2rem);
}

.tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 20;
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    height: var(--tabbar);
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.tabbar__link {
    position: relative;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    color: var(--ink-soft);
    font-size: 0.66rem;
    font-weight: 600;
    text-decoration: none;
}

.tabbar__link.is-current {
    color: var(--brand-primary-text);
}

.tabbar__link.is-current::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 26%;
    right: 26%;
    height: 2px;
    background: var(--brand-primary);
}

.tabbar__icon {
    position: relative;
    display: grid;
}

.tabbar__badge {
    position: absolute;
    top: -6px;
    left: 13px;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    font-size: 0.64rem;
}

@media (min-width: 1000px) {
    .shell {
        display: grid;
        grid-template-columns: var(--sidebar) minmax(0, 1fr);
    }

    .topbar,
    .tabbar,
    .scrim,
    .sidebar__close {
        display: none !important;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: auto;
        height: 100vh;
        padding: 1.1rem 0.8rem 0.9rem;
        transform: none;
        visibility: visible;
    }

    .content {
        padding: 1.75rem 2.1rem 3rem;
    }
}

/* ---- Page head, cards, rows ----------------------------------------------- */

.page-head {
    display: grid;
    gap: 0.3rem;
    margin-bottom: 1.3rem;
}

.page-head__sub {
    color: var(--ink-soft);
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.05rem 1.15rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card--needs {
    border-top: 3px solid var(--yellow);
}

.card__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
}

.card__head > div {
    display: grid;
    gap: 0.25rem;
}

.eyebrow--needs {
    color: var(--yellow-text);
}

.card__more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    color: var(--brand-primary-text);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.rows > li + li {
    border-top: 1px solid var(--line);
}

.row {
    display: grid;
    gap: 0.35rem;
    margin-inline: -0.55rem;
    padding: 0.75rem 0.55rem;
    border-radius: 7px;
    text-decoration: none;
    transition: background-color 0.12s;
}

.rows--tight .row {
    padding-block: 0.62rem;
}

.row:hover {
    background: var(--page);
}

/* A row that is a form button (choosing an organization). */
.row--button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: calc(100% + 1.1rem);
    min-height: 48px;
    background: none;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}

.row--button:first-of-type {
    border-top: 0;
}

.card--narrow {
    max-width: 40rem;
}

/* A listing with its state. */
.place {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1rem;
    padding: 0.7rem 0;
}

.place__name {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.93rem;
    font-weight: 600;
}

.place__name .icon {
    color: var(--ink-soft);
}

.place__chips {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.place__text {
    display: grid;
    min-width: 0;
}

.place__text .place__name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place__meta {
    color: var(--ink-soft);
    font-size: 0.82rem;
}

/* Pages made of sections one under another: account, two-factor. */
.stack {
    display: grid;
    gap: 1rem;
    max-width: 46rem;
}

.steps {
    display: grid;
    gap: 1.25rem;
    margin: 0.3rem 0 0;
    padding-left: 1.4rem;
    list-style: decimal;
}

.steps > li {
    padding-left: 0.3rem;
}

.steps > li::marker {
    color: var(--brand-primary-text);
    font-family: var(--font-mono);
    font-weight: 600;
}

.steps .form,
.steps .notice {
    margin-top: 0.8rem;
}

.qr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.2rem;
    margin-top: 0.8rem;
}

.qr img {
    padding: 0.4rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.qr p {
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.secret,
.codes code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
}

.secret {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.35rem 0.6rem;
    background: var(--sunken);
    border-radius: 6px;
    color: var(--ink);
    user-select: all;
}

.codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    max-width: 22rem;
}

.codes li {
    padding: 0.55rem 0.7rem;
    background: var(--sunken);
    border-radius: 6px;
    text-align: center;
    user-select: all;
}

.row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.65rem;
    font-size: 0.84rem;
}

.row__who {
    font-weight: 600;
}

.row__when,
.item__when,
.alerts__when,
.timeline time {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    white-space: nowrap;
}

.row__when {
    margin-left: auto;
}

.row__foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.row__go {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--brand-primary-text);
    font-weight: 600;
    white-space: nowrap;
}

.row__go .icon {
    transition: transform 0.15s;
}

.row:hover .row__go .icon {
    transform: translateX(3px);
}

.row__state,
.row__author,
.answer__state,
.answer__author {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.row__state--progress,
.answer--progress .answer__state {
    color: var(--blue-text);
}

/* ---- Summary -------------------------------------------------------------- */

.kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.kpi {
    position: relative;
    display: grid;
    align-content: start;
    gap: 0.15rem;
    padding: 0.85rem 1rem 0.9rem 1.1rem;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.kpi:hover {
    border-color: var(--line-strong);
    box-shadow: 0 6px 18px -12px rgba(16, 24, 40, 0.35);
}

/* The light of each indicator. */
.kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--line-strong);
}

.kpi--needs::before {
    background: var(--yellow);
}

.kpi--progress::before {
    background: var(--blue);
}

.kpi--ok::before {
    background: var(--green);
}

.kpi--danger::before {
    background: var(--red);
}

.kpi__label {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.kpi__value {
    font-family: var(--font-mono);
    font-size: clamp(1.65rem, 1.3rem + 1.4vw, 2.2rem);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.15;
}

.kpi__value small {
    margin-left: 0.1em;
    color: var(--ink-soft);
    font-size: 0.5em;
    font-weight: 500;
    letter-spacing: 0;
}

.kpi__note {
    color: var(--ink-soft);
    font-size: 0.8rem;
    line-height: 1.35;
}

.board {
    display: grid;
    gap: 1rem;
}

/* On a phone the columns dissolve and the order puts first what needs a decision. */
.board__col {
    display: contents;
}

.board__col > * {
    animation: fade 0.35s both;
}

.board__awaiting {
    order: 1;
}

.board__rating {
    order: 2;
}

.board__progress {
    order: 3;
}

.board__recent {
    order: 4;
}

.board__alerts {
    order: 5;
}

.kpis--three {
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 760px) {
    .kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 1rem;
    }

    .kpis--three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1180px) {
    .board {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        align-items: start;
    }

    .board__col {
        display: grid;
        gap: 1rem;
    }

    .board__col > * {
        order: 0;
    }
}

/* The rating, on the dark surface: the one figure every owner knows by heart. */
.rating {
    display: grid;
    align-content: start;
    gap: 0.25rem;
    padding: 1.15rem 1.25rem 1.05rem;
    border-radius: var(--radius);
    --star-off: color-mix(in srgb, var(--brand-on-secondary) 24%, transparent);
}

.rating .eyebrow {
    color: color-mix(in srgb, var(--brand-on-secondary) 64%, transparent);
}

.rating__value {
    font-family: var(--font-mono);
    font-size: clamp(3.6rem, 2.6rem + 4.2vw, 5rem);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -0.06em;
    line-height: 1;
}

.rating__count {
    margin-top: 0.25rem;
    color: color-mix(in srgb, var(--brand-on-secondary) 74%, transparent);
    font-size: 0.88rem;
}

.rating__note,
.spark__label {
    color: color-mix(in srgb, var(--brand-on-secondary) 58%, transparent);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.03em;
}

.rating__note {
    margin-top: 0.9rem;
}

.bars {
    display: grid;
    gap: 0.4rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--brand-on-secondary) 12%, transparent);
}

.bars__row {
    display: grid;
    grid-template-columns: 0.7rem 1fr 1.3rem;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

.bars__count {
    text-align: right;
}

.bars__track {
    height: 0.4rem;
    overflow: hidden;
    background: color-mix(in srgb, var(--brand-on-secondary) 12%, transparent);
    border-radius: 2px;
}

.bars__fill {
    display: block;
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transform-origin: left;
    animation: grow 0.6s 0.15s both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bars__fill--star4 {
    background: var(--green-light);
}

.bars__fill--star3 {
    background: var(--yellow);
}

.bars__fill--star2 {
    background: var(--orange);
}

.bars__fill--star1 {
    background: var(--red);
}

.bars__fill--0 { width: 0; }
.bars__fill--1 { width: 10%; }
.bars__fill--2 { width: 20%; }
.bars__fill--3 { width: 30%; }
.bars__fill--4 { width: 40%; }
.bars__fill--5 { width: 50%; }
.bars__fill--6 { width: 60%; }
.bars__fill--7 { width: 70%; }
.bars__fill--8 { width: 80%; }
.bars__fill--9 { width: 90%; }
.bars__fill--10 { width: 100%; }

.spark {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--brand-on-secondary) 12%, transparent);
}

.spark__bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 2.6rem;
}

.spark__bar {
    flex: 1;
    min-height: 2px;
    background: var(--brand-primary-on-secondary);
    border-radius: 2px 2px 0 0;
    transform-origin: bottom;
    animation: rise-bar 0.5s 0.2s both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.spark__bar--0 {
    height: 2px;
    background: color-mix(in srgb, var(--brand-on-secondary) 22%, transparent);
}

.spark__bar--1 { height: 12.5%; }
.spark__bar--2 { height: 25%; }
.spark__bar--3 { height: 37.5%; }
.spark__bar--4 { height: 50%; }
.spark__bar--5 { height: 62.5%; }
.spark__bar--6 { height: 75%; }
.spark__bar--7 { height: 87.5%; }
.spark__bar--8 { height: 100%; }

.alerts {
    display: grid;
}

.alerts__item {
    display: grid;
    grid-template-columns: 0.55rem 1fr;
    gap: 0.7rem;
    padding: 0.7rem 0;
}

.alerts__item + .alerts__item {
    border-top: 1px solid var(--line);
}

.alerts__mark {
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.45rem;
    background: var(--line-strong);
    border-radius: 50%;
}

.alerts__item--danger .alerts__mark {
    background: var(--red);
    box-shadow: 0 0 0 3px var(--red-soft);
}

.alerts__item--needs .alerts__mark {
    background: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow-soft);
}

.alerts__body {
    display: grid;
    gap: 0.1rem;
}

.alerts__title {
    font-size: 0.93rem;
    font-weight: 600;
    text-underline-offset: 0.2em;
}

.alerts__text {
    color: var(--ink-soft);
    font-size: 0.86rem;
}

/* ---- Inbox ---------------------------------------------------------------- */

.inbox {
    display: grid;
    gap: 0.9rem;
}

.inbox .page-head {
    margin-bottom: 0;
}

.tabs {
    display: flex;
    gap: 1.4rem;
    margin-inline: -1.1rem;
    padding-inline: 1.1rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tabs__tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 0 0.65rem;
    border-bottom: 2px solid transparent;
    color: var(--ink-soft);
    font-size: 0.93rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.tabs__tab:hover {
    color: var(--ink);
}

.tabs__tab.is-current {
    border-bottom-color: var(--brand-primary);
    color: var(--brand-primary-text);
    font-weight: 600;
}

.tabs__count {
    min-width: 1.4rem;
    padding: 0.08rem 0.4rem;
    background: var(--sunken);
    border-radius: 5px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

.tabs__tab--needs .tabs__count {
    background: var(--yellow);
    color: #202124;
}

.filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 0.65rem;
}

.filters__field {
    display: grid;
    gap: 0.25rem;
}

.filters__field > span {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filters select {
    width: 100%;
    min-height: 40px;
    padding: 0.3rem 2rem 0.3rem 0.7rem;
    appearance: none;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.6rem center;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    font-size: 0.9rem;
    cursor: pointer;
}

.filters select:hover {
    border-color: var(--ink-soft);
}

.filters__actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 40px;
}

/* With JavaScript the filters apply on change and the button is not needed. */
.js .filters__actions .button {
    display: none;
}

.inbox__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 0.85rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font-size: 0.93rem;
    font-weight: 600;
    cursor: pointer;
}

.inbox__toggle .icon:last-child {
    margin-left: auto;
    color: var(--ink-soft);
    transition: transform 0.2s;
}

.inbox__switch:checked + .inbox__toggle .icon:last-child {
    transform: rotate(180deg);
}

.inbox__switch:focus-visible + .inbox__toggle {
    box-shadow: var(--focus);
}

.inbox__count {
    margin-bottom: 0.45rem;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.items {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.items > li + li {
    border-top: 1px solid var(--line);
}

.item {
    position: relative;
    display: grid;
    gap: 0.25rem;
    padding: 0.8rem 1rem 0.85rem;
    text-decoration: none;
    transition: background-color 0.12s;
}

.item:hover {
    background: var(--page);
}

.item.is-selected {
    background: var(--blue-soft);
    background: color-mix(in srgb, var(--brand-primary) 9%, var(--surface));
}

.item.is-selected::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--brand-primary);
}

.item__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.item__who {
    font-size: 0.9rem;
    font-weight: 600;
}

.item__where {
    color: var(--ink-soft);
    font-weight: 400;
}

.item__chips,
.detail__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.3rem;
}

.back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    margin-bottom: 0.2rem;
    color: var(--brand-primary-text);
    font-size: 0.93rem;
    font-weight: 600;
    text-decoration: none;
}

.detail {
    display: grid;
    gap: 1.1rem;
    padding: 1.15rem 1.1rem 0.4rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    animation: fade 0.25s both;
}

.detail__head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 0.5rem 1rem;
}

.detail__rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
}

.detail__head .link {
    grid-row: 1;
    grid-column: 2;
}

.detail__who {
    display: grid;
    grid-column: 1 / -1;
    gap: 0.05rem;
    line-height: 1.4;
}

.detail__who span {
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.detail__translation {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem 0.95rem;
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    font-size: 0.92rem;
}

.detail__chips {
    margin-top: -0.4rem;
}

.composer {
    display: grid;
    gap: 0.55rem;
}

.composer__label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.93rem;
    font-weight: 600;
}

.composer__label .icon {
    color: var(--brand-primary-text);
}

.composer__text {
    width: 100%;
    min-height: 9rem;
    padding: 0.8rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
}

.composer__text:focus-visible {
    border-color: var(--brand-primary-text);
    border-radius: 8px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 24%, transparent);
}

.composer__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.2rem 1rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.composer__bytes {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.composer__bytes.is-over {
    color: var(--red-text);
    font-weight: 700;
}

.composer__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.35rem;
}

/* The answer hangs from the review like a reply in a thread. */
.answer {
    display: grid;
    gap: 0.65rem;
    padding: 0.95rem 1rem 1rem;
    background: var(--page);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-small);
}

.answer__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem 1rem;
}

.answer--ok .answer__state {
    color: var(--green-text);
}

.fold {
    margin-inline: -1.1rem;
    padding-inline: 1.1rem;
    border-top: 1px solid var(--line);
}

.fold summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    font-size: 0.93rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}

.fold summary::-webkit-details-marker {
    display: none;
}

.fold summary .icon {
    color: var(--ink-soft);
    transition: transform 0.2s;
}

.fold[open] summary .icon {
    transform: rotate(180deg);
}

.fold + .fold {
    margin-top: -1.1rem;
}

.facts {
    display: grid;
    gap: 0.65rem;
    padding-bottom: 1.1rem;
    font-size: 0.9rem;
}

.facts > div {
    display: grid;
    gap: 0.1rem;
}

.facts dt {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.timeline {
    display: grid;
    gap: 0.8rem;
    margin-left: 0.25rem;
    padding: 0 0 1.2rem 1.1rem;
    border-left: 1px solid var(--line-strong);
    font-size: 0.9rem;
}

.timeline li {
    position: relative;
    display: grid;
}

.timeline li::before {
    content: "";
    position: absolute;
    top: 0.5em;
    left: calc(-1.1rem - 4px);
    width: 7px;
    height: 7px;
    background: var(--surface);
    border: 1.5px solid var(--ink-soft);
    border-radius: 2px;
}

.timeline li:first-child::before {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* A phone shows either the list or the opened review, and folds the filters. */
@media (max-width: 999px) {
    .inbox:not(.inbox--opened) .inbox__detail,
    .inbox--opened .inbox__list,
    .inbox--opened .inbox__filters,
    .inbox--opened .inbox__toggle,
    .inbox--opened .inbox__tabs,
    .inbox--opened .inbox__head,
    .inbox__switch:not(:checked) ~ .inbox__filters {
        display: none;
    }

    /* The review preselected for wide screens is not marked while only the list shows. */
    .inbox:not(.inbox--opened) .item.is-selected {
        background: none;
    }

    .inbox:not(.inbox--opened) .item.is-selected::before {
        content: none;
    }
}

@media (min-width: 620px) {
    .filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .facts > div {
        grid-template-columns: 9.5rem 1fr;
        align-items: baseline;
        gap: 1rem;
    }

    .detail {
        padding: 1.4rem 1.5rem 0.4rem;
    }

    .fold {
        margin-inline: -1.5rem;
        padding-inline: 1.5rem;
    }
}

@media (min-width: 1000px) {
    .inbox {
        grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
        column-gap: 1.25rem;
    }

    .inbox__head,
    .inbox__tabs,
    .inbox__filters {
        grid-column: 1 / -1;
    }

    .inbox__toggle {
        display: none;
    }

    .tabs {
        margin-inline: 0;
        padding-inline: 0;
    }

    .filters {
        grid-template-columns: repeat(5, minmax(0, 10.5rem)) auto;
    }

    .inbox__detail {
        position: sticky;
        top: 1.25rem;
        align-self: start;
        max-height: calc(100vh - 2.5rem);
        overflow-y: auto;
        border-radius: var(--radius);
    }

    .back {
        display: none;
    }
}

/* ---- Motion: short and functional ----------------------------------------- */

@keyframes fade {
    from {
        opacity: 0;
    }
}

@keyframes grow {
    from {
        transform: scaleX(0);
    }
}

@keyframes rise-bar {
    from {
        transform: scaleY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.001ms !important;
    }
}
