/* Portal base styles. Colours come from brand-palette.css. */

/* Manrope, self-hosted (fonts/README.md): one variable file per subset, picked by unicode-range. */
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations"),
         url("/assets/fonts/manrope-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2-variations"),
         url("/assets/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/manrope-greek-wght-normal.woff2") format("woff2-variations"),
         url("/assets/fonts/manrope-greek-wght-normal.woff2") format("woff2");
    unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;
}

:root {
    /* Brand (brand-palette.css) */
    --green: var(--daphne-green);                 /* #1e3a2f */
    --green-darker: var(--daphne-green-darker);   /* #0f200f */
    --green-700: #2c4a3d;
    --gold: var(--daphne-gold);                   /* #c9a04a */
    --gold-light: var(--daphne-gold-light);       /* #e8c87a */
    --gold-muted: var(--daphne-gold-muted);       /* #7a6020 */

    /* Surfaces */
    --page-bg: #f7f6f2;
    --surface: #ffffff;
    --surface-sunken: #faf8f3;
    --surface-attention: var(--daphne-surface-warm); /* #fdf6e8 */
    --surface-selected: #f3f7f4;
    --surface-success: #e8f0ea;

    /* Lines */
    --line: #e6e0d2;
    --line-soft: #efebe2;
    --line-strong: #e0d9c8;
    --line-attention: var(--daphne-border-alert);   /* #f0d49a */

    /* Text */
    --ink-strong: var(--daphne-green);              /* 12.3:1 on white */
    --ink: var(--daphne-text-body);                 /* #3a4a40, 9.4:1 */
    --ink-muted: #5f6e66;                           /* 5.4:1 white, 5.0:1 page-bg */
    --ink-attention: var(--daphne-text-warning);    /* #5a3d00 */
    --ink-on-dark: #dce6df;
    --ink-on-dark-muted: var(--daphne-text-tagline);/* #a8c9b5 */

    /* Stage ramp: ordinal, one hue (validated). The meeting slot is reserved for phase 3. */
    --stage-not-invited: #a9b9b1;
    --stage-awaiting: #7a9d8e;
    --stage-no-meeting: #4e7d6a;
    --stage-meeting: #2e5d4b;
    --stage-filed: #1e3a2f;
    --track: #ece8df;

    /* Shape and type */
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-card: 0 1px 2px rgba(30, 58, 47, 0.05);
    --font-ui: "Manrope", "Segoe UI", system-ui, sans-serif;
}

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

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--ink-strong);
    line-height: 1.25;
}
h1 { font-size: 1.625rem; letter-spacing: -0.01em; }  /* page title, 26/600 */
h2 { font-size: 0.9375rem; }                          /* card title, 15/600 */
h3 { font-size: 0.875rem; }

a { color: var(--green); }
a:hover { color: var(--gold-muted); }

:focus-visible {
    outline: 2px solid var(--gold-muted);
    outline-offset: 2px;
}

/* Icons (templates/_icons.twig) */
.i {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
    vertical-align: -0.2em;
}

/* Application shell (signed in): sidebar, top bar, content. The sidebar wraps above the content
   below 64rem (see the breakpoints at the end). */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }

.side {
    /* A fixed width, so the content takes everything else; .side-collapsed (set on <html> by the script in
       layout.twig and app.js) narrows it to an icon rail. */
    flex: 0 0 15rem;
    position: relative;
    z-index: 2; /* the rail's tooltips reach over the content */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--green);
    color: var(--ink-on-dark);
}
.side-logo { display: block; width: fit-content; margin: 0 auto; padding: 0.25rem 0.75rem; border-radius: var(--radius); }
.side-logo img { display: block; width: 124px; height: auto; }
.side-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.side-nav a,
.side-lang button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 42px;
    padding: 0 0.75rem;
    border-radius: var(--radius);
    color: var(--ink-on-dark);
    font-weight: 500;
    text-decoration: none;
}
.side-lang { margin: 0; }
/* The language switch is a form button dressed as a nav link. */
.side-lang button { width: 100%; border: 0; background: none; font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.side-nav a:hover,
.side-lang button:hover { background: var(--green-700); color: #ffffff; }
.side-nav a[aria-current="page"] { background: var(--green-700); color: var(--gold-light); font-weight: 600; }
.side :focus-visible { outline-color: var(--gold-light); }

/* Collapse toggle: only with JavaScript, only where the sidebar is a column (not in the strip below 64rem). */
.side-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin-top: auto;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--ink-on-dark);
    cursor: pointer;
}
.side-toggle:hover { background: var(--green-700); color: #ffffff; }

@media (min-width: 64.01rem) {
    /* As tall as the window and fixed while the page scrolls, so the toggle at its foot is always in reach. */
    .side { position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; }
    .js .side-toggle { display: flex; }
    .side-nav a,
    .side-lang button { white-space: nowrap; }

    /* Collapsed: a 4rem rail with the icons centred. The labels stay in the page (visually hidden), so each
       link keeps its accessible name; data-label draws the tooltip on hover and keyboard focus. */
    .side-collapsed .side { flex-basis: 4rem; align-items: center; padding-left: 0; padding-right: 0; }
    .side-collapsed .side-logo { width: 40px; height: 40px; overflow: hidden; padding: 0; }
    .side-collapsed .side-logo img { width: 90px; max-width: none; margin: 2px 0 0 -24px; }
    .side-collapsed .side-nav { align-items: center; }
    .side-collapsed .side-nav a,
    .side-collapsed .side-lang button { position: relative; justify-content: center; width: 42px; padding: 0; }
    .side-collapsed .side-nav a > span:not(.nav-badge),
    .side-collapsed .side-lang button > span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .side-collapsed .side-toggle { align-self: center; }
    .side-collapsed .side-toggle .i { transform: rotate(180deg); }
    /* The review count stays: a small chip on the icon's corner. */
    .side-collapsed .nav-badge {
        position: absolute;
        top: 2px;
        right: 0;
        min-width: 1.1rem;
        margin: 0;
        padding: 0 0.25rem;
        font-size: 0.6875rem;
        line-height: 1.1rem;
        box-shadow: 0 0 0 2px var(--green);
    }
    .side-collapsed .side-nav a[data-label]:is(:hover, :focus-visible)::after,
    .side-collapsed .side-lang button[data-label]:is(:hover, :focus-visible)::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 0.5rem);
        top: 50%;
        transform: translateY(-50%);
        padding: 0.3rem 0.6rem;
        border-radius: var(--radius-sm);
        background: var(--ink-strong);
        color: #ffffff;
        font-size: 0.8125rem;
        font-weight: 600;
        pointer-events: none;
    }
}
@media (min-width: 64.01rem) and (prefers-reduced-motion: no-preference) {
    .side { transition: flex-basis 0.18s ease; }
    .side-toggle .i { transition: transform 0.18s ease; }
}

.app-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    min-height: 60px;
    padding: 0.625rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.office-name { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--ink-strong); }
.office-name .i { color: var(--ink-muted); }
.me { display: flex; align-items: center; gap: 0.75rem; }
.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--green);
    color: var(--gold-light);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.me-text { display: flex; flex-direction: column; line-height: 1.3; }
.me-text b { font-weight: 600; color: var(--ink-strong); }
.me-text small { font-size: 0.75rem; color: var(--ink-muted); }
/* The avatar and name: a link to the account page that looks like the label it was. */
.me-link { display: flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none; border-radius: 8px; padding: 0.125rem 0.375rem 0.125rem 0.125rem; }
.me-link:hover, .me-link:focus-visible { background: var(--surface-sunken); }
.me-link:hover .me-text b { text-decoration: underline; }
.logout { margin: 0; }

/* Content */
main { padding: 1.75rem 2rem 3rem; }
.app main { width: 100%; max-width: 90rem; }
main > h1:first-child { margin-top: 0; }

/* Pages without a session: the logo above a centred card. */
.anon main { max-width: 40rem; margin: 0 auto; padding: 3rem 1rem; }
.anon-logo { display: block; width: fit-content; margin: 0 auto 1.5rem; border-radius: var(--radius); }
.anon-logo img { display: block; width: 148px; height: auto; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--green);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
}
.link-button:hover { color: var(--gold-muted); }

[hidden] { display: none !important; }

/* Visually hidden, still read by screen readers. */
.vh {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.hint { color: var(--ink-muted); font-size: 0.8125rem; }
.none, .empty { color: var(--ink-muted); }

/* Buttons: primary (at most one a view), secondary, link. 40px page actions, 36px in a toolbar, 32px (.button-sm) in rows and cards. */
.button, button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0 1.1rem;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    background: var(--green);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.button:hover { color: #ffffff; background: var(--green-darker); border-color: var(--green-darker); }
.button:disabled { opacity: 0.6; cursor: default; }

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

.button-sm, button.button-sm { min-height: 32px; padding: 0 0.75rem; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.button .i { margin: 0 -0.1rem; }

/* Fields: the label above, 12.5px muted. */
label { display: block; margin-bottom: 0.3rem; font-size: 0.78125rem; font-weight: 500; color: var(--ink-muted); }
.field { margin: 0 0 1rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="tel"], input[type="number"], select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 0.45rem 0.75rem;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
}
input::placeholder { color: var(--ink-muted); opacity: 1; }
/* Selects draw their own chevron, so it sits 0.75rem inside the border, not against it, and the text never runs under it. */
select:not([multiple]) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6e66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px;
    cursor: pointer;
}
select:disabled { cursor: not-allowed; opacity: 0.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--gold-muted); }

.field-error { display: block; margin-top: 0.25rem; color: var(--ink-attention); font-size: 0.8125rem; font-weight: 500; }

.notice, .notice-ok {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}
.notice { color: var(--ink-attention); background: var(--surface-attention); border: 1px solid var(--line-attention); }
.notice-ok { color: var(--green); background: var(--surface-success); border: 1px solid var(--daphne-border-success); }

/* Cards */
.card {
    margin: 0 0 1.25rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.card-title { margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--ink-strong); }
.card-desc { margin: 0.2rem 0 0; font-size: 0.78125rem; color: var(--ink-muted); }
.card > :last-child { margin-bottom: 0; }
/* A card whose body is a table: the table runs to the card's edges. */
.table-card { padding: 0; overflow: hidden; }
.table-card > .card-head { margin: 0; padding: 1.25rem 1.5rem 1rem; }
.table-card > .hint { margin: 0; padding: 0.875rem 1.5rem; border-top: 1px solid var(--line-soft); }
.table-scroll { overflow-x: auto; }

/* Flag badges (keep .badge-{flag}), chips */
.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    margin-left: 0.35rem;
    padding: 0 0.4rem;
    font-size: 0.71875rem;
    font-weight: 500;
    line-height: 1;
    color: var(--ink-attention);
    background: var(--surface-attention);
    border: 1px solid var(--line-attention);
    border-radius: 6px;
    white-space: nowrap;
    vertical-align: 0.1em;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 26px;
    padding: 0.1rem 0.625rem;
    font-size: 0.78125rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
}
.chip-attention { color: var(--ink-attention); background: var(--surface-attention); border-color: var(--line-attention); }
.chip a { color: inherit; text-decoration: none; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); font-variant-numeric: tabular-nums; }
th, td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
thead th {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
tbody tr:last-child > td { border-bottom: 0; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem 1.25rem; margin: 1rem 0; font-variant-numeric: tabular-nums; }
.pagination a, .pagination .off { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 32px; font-weight: 600; text-decoration: none; }
.pagination .off { font-weight: 500; color: var(--ink-muted); }

/* Pages without a session, and the message pages */
.auth-card, .message-page {
    margin: 0 auto;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.auth-card { max-width: 26rem; }
.message-page { max-width: 36rem; }
.auth-card h1, .message-page h1 { margin: 0 0 1rem; font-size: 1.375rem; }
.auth-card form p { margin: 0 0 1rem; }
.auth-card .button { width: 100%; }
.auth-card > p:last-child, .message-page > p:last-child { margin-bottom: 0; }
.app .message-page { margin-top: 2rem; }

.error-details {
    overflow-x: auto;
    padding: 1rem;
    background: var(--surface-attention);
    border: 1px solid var(--line-attention);
    border-radius: var(--radius);
    font-size: 0.75rem;
}

.dialog-error { color: var(--ink-attention); }

/* Main page: header */
.page-date { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--ink-muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.year-form { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.year-form label { margin: 0; white-space: nowrap; }
.year-form select { width: auto; min-width: 6.5rem; }
.js .js-hide { display: none; }

/* Summary tiles */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem; margin: 0 0 1.25rem; }
.tile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    color: var(--ink);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.tile:hover { color: var(--ink); border-color: var(--line-strong); }
.tile.hot { background: var(--surface-attention); border-color: var(--line-attention); }
.tile.is-active { background: var(--surface-success); border-color: var(--green); }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.tile-label { font-size: 0.84375rem; font-weight: 600; color: var(--ink-strong); }
.tile-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--surface-sunken);
    color: var(--green);
}
.tile.hot .tile-icon { background: var(--surface); color: var(--gold-muted); }
.tile-value { font-size: 2.125rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink-strong); }
.tile-sub { font-size: 0.78125rem; color: var(--ink-muted); }
.tile.hot .tile-sub { color: var(--ink-attention); }
.tile .bar { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: var(--track); }
.tile .bar > span { display: block; height: 100%; border-radius: inherit; background: var(--green); }

/* The list card: title, toolbar, stage tabs, table, pagination */
.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 1.25rem 1.5rem 0.75rem; }
.list-head .card-title { font-size: 1rem; }
/* 32px hit target inside a 26px chip: the negative margins keep the chip's size. */
.chip-attention a { display: inline-grid; place-items: center; width: 32px; height: 32px; margin: -4px -0.65rem -4px -0.2rem; border-radius: 999px; }
.chip-attention a:hover { background: var(--line-attention); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0; padding: 0 1.5rem 1rem; }
.toolbar input, .toolbar select { min-height: 36px; }
.toolbar select { width: auto; max-width: 16rem; }
.toolbar .button { min-height: 36px; }
.toolbar-search { position: relative; flex: 1 1 16rem; max-width: 26rem; }
.toolbar-search .i { position: absolute; top: 50%; left: 0.7rem; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none; }
.toolbar-search input { padding-left: 2.1rem; }
.toolbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.link-clear { font-size: 0.8125rem; font-weight: 600; color: var(--ink-muted); }
.link-clear:hover { color: var(--gold-muted); }

/* The links overlap the bottom border by 1px (margin-bottom: -1px), which the 1px of padding-bottom keeps
   inside the box: without it the overflow gives the row a vertical scroll bar. The scroll bars are never
   shown; the row still scrolls (touch, wheel, keyboard focus), and a shadow on a clipped edge says so. */
.tabs {
    display: flex;
    gap: 0 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 1.5rem 1px;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
    background:
        linear-gradient(to right, var(--surface) 30%, transparent) left / 2rem 100% no-repeat local,
        linear-gradient(to left, var(--surface) 30%, transparent) right / 2rem 100% no-repeat local,
        linear-gradient(to right, rgba(0, 0, 0, 0.12), transparent) left / 0.75rem 100% no-repeat scroll,
        linear-gradient(to left, rgba(0, 0, 0, 0.12), transparent) right / 0.75rem 100% no-repeat scroll;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    margin-bottom: -1px;
    padding: 0 0.125rem;
    color: var(--ink-muted);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink-strong); }
.tabs a[aria-current="true"] { color: var(--ink-strong); font-weight: 600; border-bottom-color: var(--gold); }
.tabs .count {
    min-width: 1.6rem;
    padding: 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: 999px;
}
.tabs a[aria-current="true"] .count { color: #ffffff; background: var(--green); border-color: var(--green); }

/* Under the table (issue #9): who is shown and the page size on the left, the page numbers on the right. */
.list-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1.5rem; padding: 0.875rem 1.5rem; border-top: 1px solid var(--line-soft); }
.list-count { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0; font-size: 0.875rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.per-page { display: inline-flex; align-items: center; gap: 0.4rem; }
.per-page select { width: auto; min-height: 32px; }
.list-foot .pagination { justify-content: flex-end; gap: 0.25rem; margin: 0; }
.list-foot .pagination a, .list-foot .pagination .off, .list-foot .pagination [aria-current="page"] {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 32px;
    min-height: 32px;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
}
.list-foot .pagination a:hover { background: var(--surface-sunken); }
.list-foot .pagination [aria-current="page"] { font-weight: 600; color: #ffffff; background: var(--green); }
.list-foot .pagination .gap { padding: 0 0.25rem; color: var(--ink-muted); }
/* While htmx fetches the list: dimmed after a short delay, so a quick answer does not flicker. */
#taxpayer-list.htmx-request { opacity: 0.6; transition: opacity 0.15s 0.2s; }

/* Stage colours (ordinal ramp): dots, pills, progress bars. A stage colour is never used for text. */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--stage-not-invited); }
.stage-not_invited, .pill-not_invited .dot { background: var(--stage-not-invited); }
.stage-awaiting_questionnaire, .pill-awaiting_questionnaire .dot { background: var(--stage-awaiting); }
.stage-no_meeting, .pill-no_meeting .dot { background: var(--stage-no-meeting); }
.stage-meeting, .pill-meeting .dot { background: var(--stage-meeting); }
.stage-filed, .pill-filed .dot { background: var(--stage-filed); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.78125rem;
    font-weight: 500;
    color: var(--ink-strong);
    white-space: nowrap;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.stage-cell progress {
    display: block;
    width: 104px;
    height: 4px;
    margin-top: 0.4rem;
    overflow: hidden;
    color: var(--stage-not-invited);
    background: var(--track);
    border: 0;
    border-radius: 999px;
    -webkit-appearance: none;
    appearance: none;
}
/* One rule per engine: a selector list mixing -webkit- and -moz- pseudo-elements is dropped whole. */
.stage-cell progress::-webkit-progress-bar { background: var(--track); border-radius: 999px; }
.stage-cell progress::-webkit-progress-value { background: var(--stage-not-invited); border-radius: 999px; }
.stage-cell progress::-moz-progress-bar { background: var(--stage-not-invited); border-radius: 999px; }
.pill-awaiting_questionnaire + progress::-webkit-progress-value { background: var(--stage-awaiting); }
.pill-awaiting_questionnaire + progress::-moz-progress-bar { background: var(--stage-awaiting); }
.pill-no_meeting + progress::-webkit-progress-value { background: var(--stage-no-meeting); }
.pill-no_meeting + progress::-moz-progress-bar { background: var(--stage-no-meeting); }
.pill-meeting + progress::-webkit-progress-value { background: var(--stage-meeting); }
.pill-meeting + progress::-moz-progress-bar { background: var(--stage-meeting); }
.pill-filed + progress::-webkit-progress-value { background: var(--stage-filed); }
.pill-filed + progress::-moz-progress-bar { background: var(--stage-filed); }

/* The taxpayer table */
table.taxpayers { font-size: 0.84375rem; }
table.taxpayers td { vertical-align: middle; }
table.taxpayers th:first-child, table.taxpayers td:first-child { padding-left: 1.5rem; }
table.taxpayers th:last-child, table.taxpayers td:last-child { padding-right: 1.5rem; }
table.taxpayers tbody tr[data-client] { cursor: pointer; }
table.taxpayers tbody tr:hover > td { background: var(--surface-sunken); }
.who .row-link { font-weight: 600; color: var(--ink-strong); text-decoration: none; }
.who .row-link:hover { text-decoration: underline; }
.who .sub { margin-top: 0.15rem; font-size: 0.78125rem; color: var(--ink-muted); }
table.taxpayers td.afm, table.taxpayers td.mobile { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.taxpayers td.email a, table.taxpayers td.mobile a { color: inherit; text-decoration: none; }
table.taxpayers td.email a:hover, table.taxpayers td.mobile a:hover { text-decoration: underline; }

/* Spouse 2 sits under spouse 1 with an L-shaped connector (CSS only, so screen readers skip it), and
   no divider runs between the members of a pair. */
tr.is-spouse2 > td:first-child { position: relative; padding-left: calc(1.5rem + 24px); }
tr.is-spouse2 > td:first-child::before {
    content: "";
    position: absolute;
    top: 0;
    left: calc(1.5rem + 5px);
    width: 12px;
    height: 22px;
    border-left: 1.5px solid #b9b09a;
    border-bottom: 1.5px solid #b9b09a;
    border-bottom-left-radius: 6px;
}
tr.pair-next > td { border-bottom-color: transparent; }
tr.is-dimmed > td { opacity: 0.6; }
tr.is-pending .pending-text { font-style: italic; color: var(--ink-muted); }

.act .next { font-weight: 500; color: var(--ink); }
.person { display: inline-flex; align-items: center; }
.avatar-sm { width: 26px; height: 26px; font-size: 0.65625rem; }
.avatar-unassigned { color: var(--ink-attention); background: var(--surface-attention); border: 1px solid var(--line-attention); }
/* The assignee, the accountant report and the actions are icons in 32px targets: the columns stay narrow. */
table.taxpayers td.assignee, table.taxpayers td.reports, table.taxpayers td.actions { width: 1%; white-space: nowrap; }
/* The assignee and PDF columns centre their header, and the icon under it. */
table.taxpayers th.col-center, table.taxpayers td.assignee, table.taxpayers td.reports { text-align: center; }
.pdf { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); }
a.pdf { color: var(--green); }
a.pdf:hover { background: var(--surface-selected); }
.pdf.none { color: var(--ink-muted); opacity: 0.5; }
.row-actions-button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
}
.row-actions-button:hover, .row-actions-button:has(+ .row-menu:popover-open) { background: var(--surface-selected); color: var(--ink-strong); }
/* A popover lives in the top layer, so the table's horizontal scroll does not clip it. app.js sets top and left. */
.row-menu {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 0.25rem;
    min-width: 13rem;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(30, 58, 47, 0.14);
    font-size: 0.8125rem;
}
.row-menu a, .row-menu button, .row-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 32px;
    padding: 0 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--ink-strong);
    text-decoration: none;
    white-space: nowrap;
}
.row-menu a, .row-menu button { font-weight: 600; }
.row-menu a:hover, .row-menu button:hover { background: var(--surface-selected); }
.row-menu button { width: 100%; border: 0; background: transparent; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.row-menu button:disabled { color: var(--ink-muted); cursor: default; }
.row-menu .menu-item.none { color: var(--ink-muted); }
.list-empty { margin: 0; padding: 2rem 1.5rem; }

/* Dashboard card rows (Part B): wide (560px basis) and narrow (320px) cards share a row and wrap. */
.card-row { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0 0 1.25rem; }
.card-row > .card { flex: 1 1 320px; min-width: 0; margin: 0; }
.card-row > .card-wide { flex: 999 1 560px; }
.card-row:not(:has(> .card)) { display: none; }
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin: 1rem 0 0; padding-top: 0.875rem; font-size: 0.8125rem; color: var(--ink-muted); border-top: 1px solid var(--line-soft); }
.card-foot a { font-weight: 600; }

/* Πορεία πελατών: the 100% stage bar and its legend */
.stage-bar { display: flex; gap: 2px; height: 22px; overflow: hidden; border-radius: 6px; background: var(--track); }
.stage-bar .seg { display: block; min-width: 6px; }
.stage-bar .seg:focus-visible { outline-offset: -2px; outline-color: var(--gold-light); }
.stage-bar.has-active .seg:not(.is-active) { opacity: 0.3; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.5rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.legend-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 0.15rem 0.5rem;
    padding: 0.625rem 0.75rem;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
}
.legend-item:hover { color: var(--ink); background: var(--surface-sunken); }
.legend-item[aria-current="true"] { background: var(--surface-selected); border-color: var(--line); }
.legend-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.45rem; font-size: 0.78125rem; color: var(--ink-muted); }
.legend-count { font-size: 1.375rem; font-weight: 600; line-height: 1.1; color: var(--ink-strong); }
.legend-pct { font-size: 0.78125rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Χρειάζονται έλεγχο: each row is one link; its "button" is the visual cue only. */
.checks { margin: 0; padding: 0; list-style: none; }
.checks li + li { border-top: 1px solid var(--line-soft); }
.check-row { display: flex; align-items: center; gap: 0.75rem; margin: 0 -0.5rem; padding: 0.625rem 0.5rem; color: var(--ink); text-decoration: none; border-radius: var(--radius); }
.check-row:hover { color: var(--ink); background: var(--surface-sunken); }
.check-row:hover .button-secondary { background: var(--surface); }
.check-icon { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; color: var(--ink-attention); background: var(--surface-attention); border-radius: var(--radius); }
.check-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.check-label { font-weight: 600; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.check-desc { font-size: 0.78125rem; color: var(--ink-muted); }
.checks-card .empty { margin: 0; }

/* Προθεσμίες σεζόν: the timeline (discount zones, the past part filled, a "today" marker) and the rows */
.season-line { position: relative; margin: 0 0 1rem; padding-top: 1.625rem; }
.season-zones { display: flex; gap: 2px; height: 10px; }
.zone { display: block; min-width: 2px; overflow: hidden; border-radius: 3px; background: var(--track); }
.zone-past { display: block; height: 100%; background: var(--stage-no-meeting); }
.season-labels { display: flex; gap: 2px; margin-top: 0.35rem; font-size: 0.75rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.season-labels span { min-width: 0; }
.today-mark { position: absolute; top: 0.25rem; width: 2px; height: calc(1.375rem + 14px); margin-left: -1px; border-radius: 1px; background: var(--green); }
.today-mark > span { position: absolute; top: -0.25rem; left: 6px; font-size: 0.75rem; font-weight: 600; line-height: 1.2; color: var(--ink-strong); white-space: nowrap; transform: translateX(-50%); }
.today-mark:not(.at-start):not(.at-end) > span { left: 1px; }
.today-mark.at-start > span { transform: none; }
.today-mark.at-end > span { left: auto; right: 6px; transform: none; }
.deadlines { margin: 0; padding: 0; list-style: none; }
.deadlines li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.625rem 0; }
.deadlines li + li { border-top: 1px solid var(--line-soft); }
.deadlines li:last-child { padding-bottom: 0; }
.dl-text { display: flex; flex-direction: column; min-width: 0; }
.dl-title { font-weight: 600; color: var(--ink-strong); }
.dl-sub { font-size: 0.78125rem; color: var(--ink-muted); }
.season-closed { margin: 0; }

/* Δηλώσεις ανά εβδομάδα: server-drawn bars on a 0 / half / top scale, a tooltip on hover and focus */
.pace-stats { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
.stat { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.stat-value { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 1.375rem; font-weight: 600; line-height: 1.1; color: var(--ink-strong); }
.stat.is-warn .stat-value { color: var(--ink-attention); }
.stat.is-warn .i { color: var(--gold-muted); }
.stat-label { font-size: 0.75rem; color: var(--ink-muted); }
.pace-chart { display: flex; gap: 0.5rem; height: 170px; padding-top: 1rem; }
.pace-axis { position: relative; flex: none; width: 2rem; font-size: 0.6875rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pace-axis span { position: absolute; right: 0; transform: translateY(50%); }
.pace-plot { position: relative; flex: 1; min-width: 0; }
.pace-grid { position: absolute; right: 0; left: 0; height: 0; border-top: 1px solid var(--line-soft); }
.pace-bars { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 100%; margin: 0; padding: 0; list-style: none; }
.pace-bars li { display: flex; flex: 1; align-items: flex-end; justify-content: center; min-width: 0; height: 100%; }
.pace-bar { position: relative; display: block; width: 100%; max-width: 22px; min-height: 2px; background: var(--green); border-radius: 4px 4px 0 0; }
.pace-bar.is-partial { background: var(--stage-awaiting); }
.pace-bar.is-zero { background: var(--line-strong); }
.pace-value { position: absolute; bottom: 100%; left: 50%; margin-bottom: 2px; font-size: 0.6875rem; font-weight: 600; color: var(--ink-strong); transform: translateX(-50%); }
.pace-tip {
    position: absolute;
    bottom: calc(100% + 1.25rem);
    left: 50%;
    z-index: 3;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    color: #ffffff;
    white-space: nowrap;
    background: var(--green);
    border-radius: var(--radius-sm);
    transform: translateX(-50%);
    pointer-events: none;
    visibility: hidden;
}
.pace-bar:hover .pace-tip, .pace-bar:focus-visible .pace-tip { visibility: visible; }
.pace-dates { display: flex; justify-content: space-between; margin: 0.35rem 0 0 2.5rem; font-size: 0.6875rem; color: var(--ink-muted); }

/* Ανά υπεύθυνο: one link per assignee, filed / total and a bar */
.workload-card .card-head { align-items: baseline; }
.loads { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.25rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.load-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem 0.625rem;
    margin: 0 -0.5rem;
    padding: 0.5rem;
    color: var(--ink);
    text-decoration: none;
    border-radius: var(--radius);
}
.load-row:hover { color: var(--ink); background: var(--surface-sunken); }
.load-row[aria-current="true"] { background: var(--surface-selected); }
.load-name { overflow: hidden; font-weight: 600; color: var(--ink-strong); text-overflow: ellipsis; white-space: nowrap; }
/* Someone who holds clients but can no longer be given any (#39): "(ανενεργός)", "(γραμματέας)". */
.load-note { display: block; overflow: hidden; font-size: 0.75rem; font-weight: 400; color: var(--ink-muted); text-overflow: ellipsis; }
.load-count { font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.load-bar { grid-column: 2 / -1; display: block; height: 6px; overflow: hidden; border-radius: 999px; background: var(--track); }
.load-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.load-row.is-unassigned .avatar { color: var(--ink-attention); background: var(--surface-attention); border: 1px solid var(--line-attention); }

/* Taxpayer modal: dialog#taxpayer-dialog, and the same block as a page at /taxpayers/{uuid} */
dialog#taxpayer-dialog, dialog.member-dialog {
    width: min(60rem, 94vw);
    max-height: 90vh;
    padding: 0;
    overflow-y: auto;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 32, 15, 0.35);
}
dialog#taxpayer-dialog::backdrop, dialog.member-dialog::backdrop { background: rgba(8, 15, 9, 0.55); }
dialog#taxpayer-dialog > .dialog-error { margin: 0; padding: 1.5rem; }
.taxpayer-page .taxpayer-modal {
    max-width: 60rem;
    margin: 0 auto;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
}

/* Header and footer stay in view while the body scrolls inside the dialog. */
dialog .modal-head { position: sticky; top: 0; z-index: 2; }
dialog .modal-foot { position: sticky; bottom: 0; z-index: 2; }
dialog .modal-foot:has(details[open]) { position: static; }

.modal-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 1rem;
    padding: 1.25rem 1.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
}
.modal-head > :not(.modal-close) { grid-column: 1; }
.modal-close { grid-column: 2; grid-row: 1 / span 3; align-self: start; margin: -0.35rem -0.6rem 0 0; }
.modal-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.modal-title h2 { margin: 0; font-size: 1.375rem; font-weight: 600; }
.modal-title .badge { margin-left: 0; }
.modal-sub { margin: 0; font-size: 0.8125rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.modal-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.35rem; }
.modal-chips .chip .i { color: var(--ink-muted); }

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--ink-muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
}
.icon-button:hover { color: var(--ink-strong); background: var(--surface-sunken); }

/* Flags to clear from the modal (a restore to acknowledge, a possible duplicate): a strip under the head. */
.modal-notices { display: grid; gap: 0.5rem; margin: 0 0 1rem; }
.modal-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 0; padding: 0.625rem 0.875rem; color: var(--ink-attention); background: var(--surface-attention); border: 1px solid var(--line-attention); border-radius: 8px; }
.modal-notice p { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.875rem; }
.modal-notice-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Steps strip: done (green, check), current (gold ring), to come (grey ring). */
.steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 1rem 1.5rem;
    list-style: none;
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--line-soft);
}
.step { position: relative; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 12px;
    left: 34px;
    right: -0.5rem;
    height: 2px;
    border-radius: 2px;
    background: var(--line);
}
.step-done:not(:last-child)::after { background: var(--green); }
.step-mark {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: #ffffff;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: 999px;
}
.step-done .step-mark { background: var(--green); border-color: var(--green); }
.step-current .step-mark { background: var(--surface-attention); border-color: var(--gold); }
.step-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.step-label { font-size: 0.8125rem; font-weight: 600; color: var(--ink-strong); }
.step-todo .step-label { font-weight: 500; color: var(--ink-muted); }
.step time, .step-note { font-size: 0.75rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.step-current .step-note { font-weight: 500; color: var(--ink-attention); }

/* Body: the forms on the left, filing, PDFs and history on the right. */
.modal-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 1.5rem; padding: 1.25rem 1.5rem 1.5rem; }
.modal-body-single { grid-template-columns: minmax(0, 1fr); } /* a form alone, no side column */
.modal-form { margin: 0 0 1.25rem; padding: 0 0 1.25rem; border-bottom: 1px solid var(--line-soft); }
.modal-main > :last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.modal-form h3, .panel h3 { margin: 0 0 0.75rem; font-size: 0.875rem; font-weight: 600; color: var(--ink-strong); }
.modal-form p { margin: 0 0 0.75rem; }
.fields { display: grid; gap: 0 0.75rem; }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-actions { display: flex; justify-content: flex-end; }
.read-only { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0 0 1.25rem; }
.read-only dt { color: var(--ink-muted); }
.read-only dd { margin: 0; }

.modal-side { display: flex; flex-direction: column; gap: 1rem; }
.panel { margin: 0; padding: 1rem 1.125rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel .hint { margin: 0 0 0.75rem; }
.panel .field-error { margin: 0 0 0.75rem; }
.panel-status { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.5rem; font-weight: 600; color: var(--ink-strong); }
.panel-status .i { color: var(--green); }
.modal-reports ul { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.modal-reports .none { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; }

.history ol { margin: 0; padding: 0; list-style: none; }
.history li { position: relative; display: flex; flex-direction: column; padding: 0 0 0.75rem 1.25rem; }
.history li:last-child { padding-bottom: 0; }
.history li::before { content: ""; position: absolute; top: 0.4rem; left: 0; width: 8px; height: 8px; border-radius: 999px; background: var(--stage-no-meeting); }
.history li:not(:last-child)::after { content: ""; position: absolute; top: 1.1rem; bottom: 0.1rem; left: 3.5px; width: 1px; background: var(--line); }
.history-label { font-size: 0.84375rem; color: var(--ink-strong); }
.history time { font-size: 0.75rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.history .none { margin: 0; }

/* Footer: the rarely used, irreversible actions behind a <details>. */
.modal-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface-sunken);
    border-top: 1px solid var(--line-soft);
}
.more { flex: 1 1 20rem; }
.more summary { padding: 0.55rem 0; font-size: 0.8125rem; font-weight: 600; color: var(--ink-muted); cursor: pointer; }
.more summary:hover { color: var(--ink-strong); }
.more .modal-form { margin: 0.5rem 0 0; padding: 0.75rem 0 0; border-top: 1px solid var(--line); border-bottom: 0; }
.modal-foot-close { margin: 0 0 0 auto; }

/* The merge modal's picker: a search box with its results under it, then the chosen card. */
.picker-results { margin: 0.5rem 0 0.75rem; padding: 0; list-style: none; }
.picker-results button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: transparent;
    font: inherit;
    text-align: left;
    color: var(--ink-strong);
    cursor: pointer;
}
.picker-results button:hover, .picker-results button:focus-visible { background: var(--surface-selected); }
.picker-results .picker-note { padding: 0.5rem 0.75rem; color: var(--ink-muted); }
.picker-details { font-size: 0.8125rem; font-weight: 400; color: var(--ink-muted); }
.picker-chosen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    margin: 0 0 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.picker-chosen .picker-details { flex: 1 1 10rem; }
.picker-kept { background: transparent; }

/* Name review page and the nav badge */
.nav-badge {
    display: inline-block;
    min-width: 1.4rem;
    margin-left: auto;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--gold);
    color: var(--green);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin: 0 0 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .hint { flex-basis: 100%; margin: 0; }

ul.name-review { list-style: none; margin: 0; padding: 0; }
ul.name-review > li { padding: 0.875rem 1.5rem; border-bottom: 1px solid var(--line-soft); }
ul.name-review > li:last-child { border-bottom: 0; }
ul.name-review .legacy { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--ink-strong); }
ul.name-review form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
ul.name-review input[type="text"] { width: 12rem; max-width: 100%; min-height: 36px; }
ul.name-review .field-error { flex-basis: 100%; margin: 0; }
ul.name-review .field-error:empty { display: none; }

/* Import page */
.import-step > h2 { margin: 0 0 0.5rem; }
.import-step .hint { margin-top: 0; }
.import-file-label { color: var(--ink); font-size: 0.875rem; }
.import-file-label input { display: block; margin-top: 0.4rem; font: inherit; }
.import-table { margin: 0.75rem 0; border: 1px solid var(--line); }
.import-table select { width: auto; min-height: 36px; }
.import-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0 0; }
.import-summary { font-size: 0.9375rem; font-weight: 500; color: var(--ink-strong); }
.import-filter, .import-choice { display: block; margin: 0.5rem 0; font-size: 0.875rem; font-weight: 400; color: var(--ink); }
.import-choice { margin: 0; }
.import-choices { margin: 0.25rem 0; }
.import-note { color: var(--ink-muted); font-size: 0.8125rem; }
.import-skipped { color: var(--ink-muted); }
.import-table tr[hidden] { display: none; }

/* Account page: the name and the password side by side, stacked on a narrow screen. */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.25rem; align-items: start; max-width: 60rem; }
.account-card form p { margin: 0 0 1rem; }
.account-card form p:last-child { margin-bottom: 0; }

/* Team page */
.team-invite-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; align-items: end; }
.team-invite-form p { margin: 0 0 1rem; }
table.team td { vertical-align: middle; }
table.team td.actions, table.team th.col-center { width: 1%; text-align: center; white-space: nowrap; }
/* A member's actions: the same dialog look as the client modal, narrower. */
dialog.member-dialog { width: min(30rem, 94vw); }
.member-control { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.member-control form { margin: 0; }
/* Disabling or demoting a member who holds clients: where the clients go, in the same form (#39). */
.member-disable { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.member-move { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; flex-basis: 100%; font-size: 0.8125rem; color: var(--ink-muted); }
.member-move select { width: auto; max-width: 100%; }
.member-control select { width: auto; flex: 1 1 10rem; max-width: 100%; }
.member-control input[type="text"] { width: auto; flex: 1 1 8rem; min-width: 0; }
.modal-form > h3 + .hint { margin-top: -0.25rem; }

/* Breakpoints */
@media (max-width: 64rem) {
    .side { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; padding: 0.625rem 1rem; }
    .side-logo { padding: 0.25rem; }
    .side-logo img { width: 96px; }
    .side-nav { flex-direction: row; flex-wrap: wrap; }
    .side-nav a,
    .side-lang button { min-height: 38px; }
    .nav-badge { margin-left: 0; }
}
@media (max-width: 48rem) {
    .card-row > .card { flex-basis: 100%; }
    .modal-body { grid-template-columns: 1fr; }
    .modal-side { order: -1; }
    .fields-3, .fields-2 { grid-template-columns: 1fr; }
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1rem; }
    .step::after { display: none; }
}
@media (max-width: 40rem) {
    .topbar { padding: 0.625rem 1rem; }
    main { padding: 1.25rem 1rem 2.5rem; }
    .auth-card, .message-page { padding: 1.5rem 1.25rem; }
    .card { padding: 1rem 1rem; }
    .table-card { padding: 0; }
    .table-card > .card-head, .list-head { padding-left: 1rem; padding-right: 1rem; }
    .page-actions, .year-form { width: 100%; }
    .page-actions > .button { width: 100%; }
    .year-form select { flex: 1; }
    .toolbar { padding: 0 1rem 1rem; }
    .toolbar > div, .toolbar-search { flex: 1 1 100%; max-width: none; }
    .toolbar select { width: 100%; max-width: none; }
    .tabs { padding: 0 1rem 1px; }
    table.taxpayers th:first-child, table.taxpayers td:first-child { padding-left: 1rem; }
    tr.is-spouse2 > td:first-child { padding-left: calc(1rem + 24px); }
    tr.is-spouse2 > td:first-child::before { left: calc(1rem + 5px); }
    ul.name-review > li { padding: 0.875rem 1rem; }
    .modal-head, .steps, .modal-body, .modal-foot { padding-left: 1rem; padding-right: 1rem; }
}
