/* Main viewer — light theme matching admin panel design */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');
@import url('tokens.css');
@import url('a11y.css');

/* ── Theme preference (profile) ──────────────────────── */
.theme-preference {
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-preference legend {
    padding: 0;
    margin-bottom: 4px;
}

.theme-preference__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: border-color 0.12s, background 0.12s;
}

.theme-preference__option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-10);
}

.theme-preference__option input {
    margin: 0;
    accent-color: var(--primary);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
html, body { margin: 0; }

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

:root {
    --calendar-event-slot-height: 2.625rem;
    --calendar-event-slot-gap: 4px;
    --calendar-events-default-height: calc(
        4 * var(--calendar-event-slot-height) + 3 * var(--calendar-event-slot-gap)
    );
}

/* ── Topbar ───────────────────────────────────────────── */
.app-topbar {
    height: var(--app-topbar-height);
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: var(--border-hairline) solid var(--border);
    box-shadow: var(--e1);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0 var(--space-6);
    flex-shrink: 0;
}

.app-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.app-topbar__logo {
    width: 26px;
    height: 37px;
    flex-shrink: 0;
    display: block;
}

.app-topbar__name {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent-ink);
    letter-spacing: -0.02em;
}

.app-topbar__search {
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.app-topbar__search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 18px;
}

.app-topbar__search-input {
    flex: 1;
    height: var(--control-height);
    padding: 0 36px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-control, var(--border));
    background: var(--surface-muted);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 0;
}

.app-topbar__search-input::placeholder { color: var(--muted); }
.app-topbar__search-input:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
    background: var(--surface-raised);
}

.app-topbar__search-btn {
    height: var(--control-height);
    padding: 0 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.app-topbar__search-btn:hover { background: var(--bg); }

.app-topbar__search-btn--secondary {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
.app-topbar__search-btn--secondary:hover,
.app-topbar__search-btn--secondary:focus-visible {
    background: var(--surface-hover);
    color: var(--accent-ink);
}
.app-topbar__search-btn--secondary:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.app-topbar__export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: var(--control-height);
    padding: 0 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.app-topbar__export-btn:hover { background: var(--bg); }
.app-topbar__export-btn .material-symbols-outlined { font-size: 18px; }

.app-topbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.app-topbar__user {
    display: inline-flex;
    align-items: center;
    gap: var(--s-sm);
    min-height: var(--hit);
    max-width: min(360px, 42vw);
    padding-block: 4px;
    padding-inline: 8px 6px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    background: transparent;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s, border-color 0.12s;
}

.app-topbar__user:hover {
    background: var(--lavender-2);
    border-color: var(--border-2);
}

.app-topbar__user:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.app-topbar__user-email {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.app-topbar__avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--r-full);
    background: var(--purple-500);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-accent);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.app-topbar__avatar--image {
    object-fit: cover;
    display: block;
    padding: 0;
}

.app-topbar__divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.app-topbar__org-context {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    max-width: min(280px, 36vw);
}

.app-topbar__org-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-topbar__org-select {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    padding: 6px 28px 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-control, var(--border));
    background: var(--surface);
    cursor: pointer;
    max-width: 100%;
    text-align: right;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 8px center;
    appearance: none;
}

.app-topbar__org-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* ── Shell ────────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: var(--rail-w) 1fr;
    grid-template-areas: "rail content";
    min-height: calc(100vh - var(--app-topbar-height));
    background: var(--bg);
}

/* ── Sidebar ──────────────────────────────────────────── */
.app-sidebar {
    grid-area: rail;
    width: var(--rail-w);
    background: var(--surface);
    border-inline-end: var(--border-hairline) solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-4) var(--space-3);
    position: sticky;
    top: var(--app-topbar-height);
    max-height: calc(100vh - var(--app-topbar-height));
    overflow-y: auto;
    align-self: start;
}

.sidebar-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 12px 6px;
    margin-top: 8px;
}

.sidebar-label:first-child { margin-top: 0; }

.sidebar-hint {
    font-size: 11px;
    color: var(--muted);
    margin: 0 12px 10px;
    line-height: 1.4;
}

.sidebar-org-block {
    padding: 4px 12px 10px;
    margin-top: 4px;
}

.sidebar-org-block .sidebar-label {
    margin-top: 0;
}

.sidebar-org-block__summary {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    word-break: break-word;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    min-height: var(--hit);
    padding-block: 9px;
    padding-inline: var(--space-3) var(--space-2);
    border-radius: var(--r-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--lavender-2); color: var(--text); }
.nav-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-item.is-active { background: var(--purple-50); color: var(--accent-ink); font-weight: 600; }
/* State = three signals: bg tint + colour + start-edge accent bar (a11y: not colour alone) */
.nav-item.is-active::before {
    content: "";
    position: absolute;
    inset-block: 6px;
    inset-inline-start: 0;
    inline-size: var(--accent-bar);
    border-radius: var(--r-full);
    background: var(--purple-500);
}
.nav-item .material-symbols-outlined { font-size: 19px; flex-shrink: 0; }
.nav-item.is-active .material-symbols-outlined { color: var(--accent); }

/* Filter form in sidebar */
.sidebar-filters {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 2px;
}

.filter-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.filter-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 4px;
}

.filter-panel__header h2 {
    margin: 0;
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
}

.filter-panel__close,
.filter-panel__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--hit);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.filter-panel__close { width: var(--hit); padding: 0; }
.filter-panel__trigger { gap: 6px; padding-inline: 12px; }
.filter-panel__trigger .material-symbols-outlined,
.filter-panel__close .material-symbols-outlined { font-size: 18px; }
.filter-panel__close:hover,
.filter-panel__trigger:hover { background: var(--lavender-2); color: var(--accent-ink); }
.filter-panel__close:focus-visible,
.filter-panel__trigger:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.filter-panel.is-collapsed > :not(.filter-panel__header) { display: none; }

.filter-panel__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    bottom: 0;
    padding: 12px 2px 4px;
    background: var(--surface);
}

.filter-panel__apply {
    flex: 1;
    min-height: var(--hit);
    border: 0;
    border-radius: var(--r-md);
    background: var(--primary);
    color: var(--text-inverse);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.filter-panel__save-view {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--hit);
    margin: 0 2px 12px;
    padding: 8px 12px;
    border: 1px dashed var(--border-control, var(--border));
    border-radius: var(--r-md);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s;
}
.filter-panel__save-view:hover { background: var(--surface-hover); border-color: var(--primary); }
.filter-panel__save-view:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.filter-panel__save-view .material-symbols-outlined { font-size: 17px; }

.filter-combobox { position: relative; }
.filter-combobox__input { padding-inline-end: 30px; }
.filter-combobox__options {
    position: absolute;
    z-index: 30;
    inset-inline: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-raised);
    box-shadow: var(--e4);
    list-style: none;
}

.filter-combobox__options [role="option"] {
    min-height: var(--hit);
    display: flex;
    align-items: center;
    padding-inline: 10px;
    border-radius: var(--r-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.filter-combobox__options [role="option"]:hover,
.filter-combobox__options [aria-selected="true"] {
    background: var(--primary-10);
    color: var(--accent-ink);
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-field__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-status-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.review-status-inline__label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.filter-field__control {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--r-xs);
    border: 1px solid var(--border-control, var(--border));
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-field__control:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
    background: var(--surface-raised);
}

select.filter-field__control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    padding-right: 26px;
}

.filter-reset-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 0;
    transition: color 0.12s;
}
.filter-reset-link:hover { color: var(--danger); }
.filter-reset-link .material-symbols-outlined { font-size: 15px; }

.org-filter-ignore-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin: 0 0 10px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.org-filter-ignore-btn:hover {
    color: var(--text);
    border-color: var(--primary);
}
.org-filter-ignore-btn.is-active {
    color: var(--primary);
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-raised));
}
.org-filter-ignore-btn .material-symbols-outlined { font-size: 15px; }

/* ── Main content ─────────────────────────────────────── */
.app-main {
    grid-area: content;
    min-width: 0;
    max-width: var(--content-max);
    padding: 38px 36px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding-block: 24px 8px;
}

.app-main h2 { font-size: 19px; font-weight: 700; }

.page-title {
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
    letter-spacing: 0;
    line-height: 1.08;
}

.page-subtitle {
    font-size: 16px;
    color: var(--muted);
    margin: 0;
}

.tender-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.tender-view-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--primary-20);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.tender-view-tab {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

.tender-view-tab.is-active {
    background: var(--primary);
    color: var(--text-inverse);
}

.tender-view-tab--muted {
    color: var(--muted);
}

.tender-view-tab .material-symbols-outlined {
    font-size: 18px;
}

.tender-view-tab__count {
    min-width: 26px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 12px;
}

.tender-view-tab:not(.is-active) .tender-view-tab__count {
    background: var(--primary-10);
    color: var(--primary);
}

.tender-toolbar__summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.tender-filter-chip {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: min(280px, 100%);
    padding: 0 12px;
    border-radius: 999px;
    background: var(--primary-10);
    border: 1px solid var(--primary-20);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tender-filter-chip .material-symbols-outlined {
    font-size: 16px;
}

.chip-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-inline-start: 4px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s;
}
.chip-clear:hover {
    opacity: 1;
    background: var(--primary-20);
}
.chip-clear .material-symbols-outlined {
    font-size:  14px;
}

.tender-filter-reset {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.tender-filter-reset:hover {
    background: var(--surface-hover);
    border-color: var(--primary-20);
}

/* ── Calendar view ───────────────────────────────────── */
.calendar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--e2);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calendar-toolbar__nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.calendar-toolbar__title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.calendar-nav-btn {
    min-width: 44px;
    padding-inline: 10px;
}

.calendar-today-btn {
    margin-inline-start: 4px;
}

.calendar-toolbar__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.calendar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.calendar-toggle input {
    accent-color: var(--primary);
}

.calendar-toggle__swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.calendar-toggle__swatch--publish { background: var(--primary); }
.calendar-toggle__swatch--deadline { background: var(--warning); }

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--muted);
}

.calendar-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.calendar-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.calendar-legend__dot--publish { background: var(--primary); }
.calendar-legend__dot--deadline { background: var(--warning); }

.calendar-grid-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    padding: 4px 0;
}

.calendar-day {
    min-height: calc(
        1.25rem + var(--calendar-event-slot-gap) + var(--calendar-events-default-height) + 12px
    );
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: var(--calendar-event-slot-gap);
    min-width: 0;
    overflow: hidden;
}

.calendar-day--outside {
    opacity: 0.55;
    background: #f8fafc;
}

.calendar-day--today {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary-20);
}

.calendar-day--expanded {
    overflow: visible;
    z-index: 2;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.calendar-day--expanded.calendar-day--today {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), inset 0 0 0 1px var(--primary-20);
}

.calendar-day--expanded .calendar-day__events {
    overflow: visible;
}

.calendar-day__number {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.calendar-day--today .calendar-day__number {
    color: var(--primary);
}

.calendar-day__events {
    display: flex;
    flex-direction: column;
    gap: var(--calendar-event-slot-gap);
    flex: 1;
    min-height: var(--calendar-events-default-height);
    min-width: 0;
    overflow: hidden;
}

.calendar-event {
    width: 100%;
    max-width: 100%;
    min-height: var(--calendar-event-slot-height);
    box-sizing: border-box;
    text-align: start;
    border: none;
    border-radius: var(--r-md);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    box-shadow: none;
    flex-shrink: 0;
}

.calendar-event__type {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event__title {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.calendar-event--publish {
    background: var(--primary-10);
    color: #1d4ed8;
}

.calendar-event--deadline-ok {
    background: var(--success-10);
    color: var(--success-700);
}

.calendar-event--deadline-soon {
    background: rgba(217, 119, 6, 0.12);
    color: var(--warn);
}

.calendar-event--deadline-urgent {
    background: var(--danger-10);
    color: var(--danger);
}

.calendar-event--deadline-expired,
.calendar-event--deadline-neutral {
    background: #f1f5f9;
    color: var(--muted);
}

.calendar-day__more {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    background: none;
    border: none;
    padding: 0;
    margin: 2px 0 0;
    cursor: pointer;
    text-align: start;
    font-family: inherit;
}

.calendar-day__more:hover,
.calendar-day__more:focus-visible {
    color: var(--primary);
    text-decoration: underline;
}

.calendar-day__more--collapse {
    margin-top: 2px;
}

.calendar-status {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

/* ── Table card ───────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border: var(--border-hairline) solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--e2);
    /* Allow פעולות dropdowns on the last row to extend over the pagination bar. */
    overflow: visible;
    position: relative;
}

.table-card.is-loading::after {
    content: "";
    position: absolute;
    inset-inline: 22px;
    inset-block-start: 0;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: table-card-loading 1.2s ease-in-out infinite;
}

@keyframes table-card-loading {
    0% { transform: translateX(-45%); opacity: 0.2; }
    50% { opacity: 0.9; }
    100% { transform: translateX(45%); opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
    .table-card.is-loading::after { animation: none; opacity: 0.6; }
}

/* ── Table skeleton rows (loading state) ─────────────────
   Shown in tbody the moment a live-search/sort/page fetch starts, so the
   table never renders empty mid-request; replaced wholesale once the real
   fragment arrives (see applyResultsFragment in script.js). */
.skeleton-row td, .skeleton-row th {
    padding: 16px 12px;
}

.skeleton-bar {
    height: 14px;
    max-width: 100%;
    border-radius: 999px;
    background: var(--surface-hover);
    position: relative;
    overflow: hidden;
}

.skeleton-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-bar::after { animation: none; content: none; }
}

/* ── Tenders cards view (alternate results layout, issue #270) ──────────
   Same #tender-results region as the table (templates/partials/tender_results.html
   picks one or the other server-side); reuses .deadline-badge, .dept-status-badge,
   .review-badge, .view-btn/.link-btn and .table-actions as-is for visual and
   behavioural parity with the table row. */
.tender-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-lg);
}

.tender-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: var(--s-lg);
    background: var(--surface);
    border: var(--border-hairline) solid var(--border-2);
    border-radius: var(--r-lg);
    box-shadow: var(--e2);
    border-inline-start: var(--accent-bar) solid var(--purple-500);
    transition: transform 0.12s, box-shadow 0.12s;
}

.tender-card:hover { transform: translateY(-2px); box-shadow: var(--e3); }

.tender-card--urgent   { border-inline-start-color: var(--error); }
.tender-card--soon     { border-inline-start-color: var(--warn); }
.tender-card--ok       { border-inline-start-color: var(--success-700); }
.tender-card--expired  { border-inline-start-color: var(--text-3); opacity: 0.82; }

.tender-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-md);
}

.tender-card__ref {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-3);
    direction: ltr;
}

.tender-card__title {
    font-weight: 700;
    font-size: 19px;
    line-height: 1.3;
    color: var(--accent-ink);
    margin: 0;
}

.profile-tenant-card__title {
    margin: 0 0 16px;
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}

.tender-card__office {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-2);
    font-size: 1rem;
}

.tender-card__office svg.ico {
    width: 16px;
    height: 16px;
    color: var(--text-3);
    flex-shrink: 0;
}

.tender-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-sm);
}

.tender-card__footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-sm);
    border-block-start: var(--border-hairline) solid var(--border);
    padding-block-start: var(--s-md);
    margin-block-start: 6px;
}

.tender-card__footer .spacer { flex: 1 1 auto; }

/* Card-shaped loading placeholder — server-rendered alongside #tender-cards
   (hidden by default) and toggled by showCardSkeleton() in script.js, so the
   loading state never needs card markup written in JS. */
.tender-card-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-lg);
}

.tender-card--skeleton {
    gap: 12px;
}

.tender-card--skeleton .skeleton-bar {
    height: 14px;
}

.table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

table.results-table {
    width: 100%;
    border-collapse: collapse;
    /* Extra room for admin review-status / department columns; title keeps a floor via min-width. */
    min-width: 1120px;
}

.results-table thead th {
    padding: 14px 18px;
    background: var(--purple-50);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-ink);
    text-transform: none;
    letter-spacing: 0;
    text-align: left;
    border-bottom: var(--border-hairline) solid var(--border-2);
    white-space: nowrap;
}

.results-table tbody tr {
    border-bottom: var(--border-hairline) solid var(--border);
    transition: background 0.1s, box-shadow 0.1s;
}
.results-table tbody tr:last-child { border-bottom: none; }
.results-table tbody tr:nth-child(even) { background: var(--surface-muted); }
.results-table tbody tr:hover {
    background: var(--lavender-2);
    box-shadow: inset 4px 0 0 var(--accent);
}

[dir="rtl"] .results-table tbody tr:hover {
    box-shadow: inset -4px 0 0 var(--accent);
}

/* The title cell is the row's header (scope="row"), so it needs the same box
   as a data cell — the thead rules above are scoped and don't reach it. */
.results-table td,
.results-table tbody th {
    padding: 16px 18px;
    font-size: 1rem;
    color: var(--text);
    vertical-align: middle;
    text-align: start;
}

.results-table th[data-sort-col="title"],
.results-table .title-cell {
    /* Without a floor, word-wrapping lets this column collapse when nowrap
       admin columns (review status, actions) claim intrinsic width. */
    min-width: 260px;
}

.results-table .title-cell {
    font-weight: 700;
    max-width: 420px;
    width: 30%;
}

.results-table td.mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-3);
}

.tender-title-text {
    display: block;
    color: var(--accent-ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: break-word;
}

.tender-title-meta {
    display: none;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

/* Sort header links */
.sortable-th { white-space: nowrap; }

.th-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: var(--r-sm);
    transition: background 0.12s, color 0.12s;
}
.th-sort:hover { color: var(--accent); background: var(--purple-100); }
.th-sort:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* The caret is always rendered so the column reads as sortable before any
   interaction; it only gains accent colour once the sort is applied. */
.sort-caret {
    font-size: 11px;
    color: var(--text-3);
    line-height: 1;
}
.th-sort.is-sorted { color: var(--accent); }
.th-sort.is-sorted .sort-caret { color: var(--accent); }

/* ── Action buttons in table ──────────────────────────── */
.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--primary-10);
    border: 1px solid var(--primary-20);
    transition: background 0.12s;
}
.link-btn:hover { background: var(--primary-20); }

.view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--hit);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--primary-20);
    font-family: inherit;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.view-btn:hover { background: var(--surface-hover); color: var(--primary-hover); border-color: var(--primary-20); }
.view-btn--danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.35);
    background: var(--danger-10);
}
.view-btn--danger:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--danger);
}
.view-btn--primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--e2);
}
.view-btn--primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: var(--e3);
}

/* ── Table actions dropdown (פעולות) ─────────────────── */
.table-actions {
    position: relative;
    display: inline-block;
}

.table-actions.is-open {
    z-index: 40;
}

.table-actions__toggle.view-btn {
    white-space: nowrap;
}

.table-actions__menu {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-end: 0;
    min-width: 188px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-popover);
    z-index: 30;
}

/* Escapes .table-wrap horizontal scroll clipping (overflow-x forces overflow-y: auto). */
.table-actions__menu.table-actions__menu--fixed {
    position: fixed;
    inset-inline-end: auto;
    z-index: 1000;
}

.table-actions__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    min-height: var(--hit);
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: start;
    cursor: pointer;
    transition: background 0.1s;
}

a.table-actions__item {
    text-decoration: none;
}

.table-actions__item:hover {
    background: var(--bg);
}

.table-actions__item .material-symbols-outlined {
    font-size: 18px;
    color: var(--muted);
}

.table-actions__item--danger {
    color: var(--danger);
}

.table-actions__item--danger:hover {
    background: var(--danger-10);
}

.table-actions__item--disabled,
.table-actions__item--disabled:hover {
    color: var(--muted);
    cursor: not-allowed;
    background: transparent;
}

.table-actions__item--disabled .material-symbols-outlined {
    color: var(--muted);
    opacity: 0.6;
}

.table-action-links {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.table-action-link {
    padding: 6px 14px;
    border: var(--border-hairline) solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-ink);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.1s, border-color 0.1s;
}

.table-action-link:hover {
    background: var(--purple-50);
    border-color: var(--accent);
}

.table-actions__form {
    margin: 0;
}

.modal-content--follow {
    width: min(440px, 94vw);
    max-height: none;
}

.follow-modal__body {
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.follow-modal__lead {
    margin: 0;
    font-size: 1rem;
    line-height: 1.45;
    color: var(--text);
}

.logout-confirm__body {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.logout-confirm__help {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.logout-confirm__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.follow-modal__title-preview {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.4;
    word-break: break-word;
}

.follow-modal__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
    color: var(--text);
}

.follow-modal__check input {
    margin-top: 3px;
    flex-shrink: 0;
}

.follow-modal__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.follow-modal__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.follow-modal__date-input {
    max-width: 100%;
}

.follow-modal__status {
    min-height: 1.2em;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

#assign-modal-customers.assign-customer-checkboxes {
    width: 100%;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
}

.assign-customer-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.assign-customer-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.assign-customer-checkbox input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

.assign-customer-checkboxes--compact {
    max-height: 8rem;
    margin-bottom: 0.5rem;
}

.follow-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

.tender-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 48px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.tender-empty-state[hidden] {
    display: none;
}

.tender-empty-state__icon {
    width: 82px;
    height: 82px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-10);
    color: var(--primary);
    margin-bottom: 20px;
}

.tender-empty-state__icon .material-symbols-outlined {
    font-size: 38px;
}

.tender-empty-state__icon svg.ico {
    width: 38px;
    height: 38px;
}

.tender-empty-state__title {
    margin: 0;
    color: var(--text);
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.25;
}

.tender-empty-state__text {
    margin: 12px 0 20px;
    color: var(--muted);
    font-size: 15px;
}

.tender-empty-state__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tender-empty-state__actions svg.ico {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Table error state (failed live-search/sort/page fetch) ──
   Shares the empty state's layout; only the icon/title colors read as
   an error rather than a neutral "nothing here" message. */
.tender-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 48px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.tender-error-state[hidden] {
    display: none;
}

.tender-error-state__icon {
    width: 82px;
    height: 82px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--error-50);
    color: var(--error);
    margin-bottom: 20px;
}

.tender-error-state__icon svg.ico {
    width: 38px;
    height: 38px;
}

.tender-error-state__title {
    margin: 0;
    color: var(--text);
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.25;
}

.tender-error-state__text {
    margin: 12px 0 20px;
    color: var(--muted);
    font-size: 15px;
}

.tender-error-state__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tender-error-state__actions svg.ico {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Pagination ───────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-top: var(--border-hairline) solid var(--border);
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-3);
    margin-right: auto;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: var(--hit);
    padding: 7px 14px;
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.page-btn:hover { background: var(--lavender-2); color: var(--accent-ink); border-color: var(--border-2); }
.page-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.page-btn .material-symbols-outlined { font-size: 16px; }

/* ── Modal ────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: var(--scrim);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

.modal.is-open { display: flex; }

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    width: min(860px, 94vw);
    max-height: 85vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-content--item-detail {
    border-radius: 0;
    width: min(640px, 94vw);
    max-height: 100vh;
    height: 100vh;
    margin-inline-start: auto;
    margin-inline-end: 0;
    background: var(--bg);
    box-shadow: var(--e5);
}

[dir="ltr"] .modal-content--item-detail {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-md);
    padding: var(--s-md) var(--s-lg);
    border-bottom: var(--border-hairline) solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    box-shadow: var(--e1);
    z-index: 1;
}

.modal-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

/* Item-detail drawer: the real page identity is the tender title rendered as
   .item-detail__title below, so this header label is downgraded to a small
   eyebrow tag rather than duplicating an <h1>-sized heading. */
.modal-content--item-detail .modal-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-header__left {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    min-width: 0;
}

.modal-version-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-full);
    background: var(--surface-muted);
    color: var(--text-2);
    font-size: 12px;
    white-space: nowrap;
}

.modal-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    padding: 4px 8px;
    border-radius: var(--r-full);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}
.modal-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.modal-nav-btn:hover:not(:disabled) {
    background: var(--lavender-2);
    color: var(--accent-ink);
    border-color: var(--border-2);
}
.modal-nav-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.modal-nav-btn .material-symbols-outlined { font-size: 18px; color: inherit; }

.modal-version-label {
    color: var(--text-2);
    font-weight: 700;
}

.modal-close {
    width: var(--hit);
    height: var(--hit);
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    font-size: 20px;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
}
.modal-close:hover { background: var(--error-50); color: var(--error); }
.modal-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }

#modal-table { padding: 0; }

.item-detail {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    padding: var(--s-lg);
}

.item-detail__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-md);
    flex-wrap: wrap;
}
.item-detail__title {
    position: relative;
    margin: 0;
    padding-inline-start: var(--s-md);
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.35;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}
.item-detail__title::before {
    content: "";
    position: absolute;
    inset-block: 3px;
    inset-inline-start: 0;
    inline-size: var(--accent-bar);
    border-radius: var(--r-full);
    background: var(--purple-500);
}
.item-detail__title--empty { color: var(--muted); font-weight: 500; }
.item-detail__title--empty::before { background: var(--border-2); }
.item-detail__status { flex: 0 0 auto; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}
.status-badge--active   { background: var(--success-50); color: var(--success-700); border-color: rgba(23,122,84,0.25); }
.status-badge--inactive { background: var(--surface-muted); color: var(--text-3); border-color: var(--border-2); }
.status-badge--neutral  { background: var(--info-50); color: var(--info); border-color: rgba(45,108,181,0.25); }

/* Shown in the item-detail modal when kol_kore.status = Archived (global
   archive) — the item is hidden from every organization's default list. */
.item-detail__archived-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--surface-muted);
    color: var(--text-3);
    border: 1px solid var(--border-2);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.review-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.review-badge--pending_review { background: var(--warn-50); color: var(--warn); }
.review-badge--draft_ready { background: var(--purple-50); color: var(--accent-ink); }
.review-badge--approved { background: var(--success-50); color: var(--success-700); }
.review-badge--rejected { background: var(--error-50); color: var(--error); }
.review-badge--needs_re_review { background: var(--warn-50); color: var(--warn); }

.item-detail__dates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-sm);
}
.item-detail__date-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--s-sm) var(--s-md);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--e1);
    min-width: 0;
    transition: background 0.15s, border-color 0.15s;
}
.item-detail__date-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.item-detail__date-value {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text);
    font-weight: 700;
    unicode-bidi: isolate;
}
.item-detail__date-meta {
    font-size: 12px;
    font-weight: 600;
    color: inherit;
    opacity: 0.85;
}
/* Close-date urgency tinting — uses same semantic tokens as the deadline pill. */
.item-detail__date-block--ok      { background: var(--success-50); border-color: rgba(23,122,84,0.25); color: var(--success-700); }
.item-detail__date-block--soon    { background: var(--warn-50); border-color: rgba(146,64,14,0.25); color: var(--warn); }
.item-detail__date-block--urgent  { background: var(--error-50); border-color: rgba(192,57,43,0.30); color: var(--error); }
.item-detail__date-block--expired { background: var(--surface-muted); border-color: var(--border-2); color: var(--text-3); }

.item-detail__date-block--ok      .item-detail__date-value,
.item-detail__date-block--soon    .item-detail__date-value,
.item-detail__date-block--urgent  .item-detail__date-value { color: inherit; }

/* Reduced-opacity meta text dilutes contrast toward the tinted background —
   keep full opacity wherever the bucket color carries the AA guarantee. */
.item-detail__date-block--ok      .item-detail__date-meta,
.item-detail__date-block--soon    .item-detail__date-meta,
.item-detail__date-block--urgent  .item-detail__date-meta { opacity: 1; }

.item-detail__deadline-warning {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--warn);
    cursor: help;
}
.item-detail__deadline-override {
    display: flex;
    align-items: center;
    gap: var(--s-xs);
    margin-top: var(--s-xs);
}
.item-detail__deadline-override-input {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 2px 6px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
}
.item-detail__deadline-override-msg {
    font-size: 12px;
    color: var(--text-3);
}

.item-detail__source {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-sm);
    flex-wrap: wrap;
}
.item-detail__source-btn { white-space: nowrap; }
.item-detail__source-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* "This is the source as captured, read-only" cue — copy/style only, carried
   over from the redesign mock's document-viewer badge without the viewer
   infrastructure it implies (see issue #278). Informational tone (--info),
   not a semantic status color. */
.item-detail__source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--info-50);
    border: 1px solid var(--border-2);
    color: var(--info);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.item-detail__source-badge .material-symbols-outlined { font-size: 14px; }

/* Variant D reskin (issue #279): the mock's appendices screen lists each file
   as a full-width row (icon, name/meta, action) inside one bordered card,
   not a grid of standalone tiles — the per-file treatment here mirrors that
   row language, minus the stage/version/completion-status chips, which need
   an annex data model (versioning, submission stages) that doesn't exist yet.
   See storage/file_archive.py — untouched; this is styling-only. */
.attachment-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface);
}
.attachment-btn {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    padding: var(--s-sm) var(--s-md);
    min-height: var(--hit);
    border-block-end: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    min-width: 0;
}
.attachment-list .attachment-btn:last-child { border-block-end: 0; }
.attachment-btn:hover {
    background: var(--lavender-2);
}
.attachment-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    position: relative;
    z-index: 1;
}
.attachment-btn:active { transform: translateY(1px); }
.attachment-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    font-size: 20px;
    color: var(--purple-500);
    background: var(--purple-50);
    flex: 0 0 auto;
}
.attachment-btn__body {
    flex: 1 1 auto;
    min-width: 0;
}
.attachment-btn__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    line-height: 1.3;
}
.attachment-btn__meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    font-family: var(--font-mono);
}
.attachment-btn__open {
    font-size: 18px;
    color: var(--muted);
    flex: 0 0 auto;
}
.attachment-btn:hover .attachment-btn__open { color: var(--purple-500); }
.attachment-btn--corrupted { background: var(--error-50); }
.attachment-btn--corrupted .attachment-btn__icon { color: var(--error); background: var(--surface); }
.attachment-btn--corrupted:hover { background: var(--error-50); }
.attachment-btn__warning {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--error);
    font-weight: 600;
}
.attachment-btn__warning .material-symbols-outlined {
    font-size: 15px;
    flex: 0 0 auto;
    margin-top: 1px;
}

.item-detail__section {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    padding: var(--s-md);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--e1);
}
.item-detail__section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.review-editor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.review-editor__status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--purple-100);
    border: 1px solid var(--purple-200);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 600;
}
.review-editor__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.review-editor__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px 12px;
}
.review-editor__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.review-editor__field span {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.review-editor__field--wide {
    grid-column: 1 / -1;
}
.review-editor__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.review-editor__message {
    min-height: 1.3em;
    font-size: 13px;
    color: var(--muted);
}
.item-detail__description-input {
    min-height: 140px;
    resize: vertical;
}

.dept-status__field { margin-bottom: 10px; }
.dept-status__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
}
.dept-status__select { min-width: 180px; max-width: 100%; }
.dept-status__current {
    padding: 10px 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    margin-bottom: 10px;
}
.dept-status__current-label { font-size: 13px; color: var(--muted); }
.dept-status__current-value { font-size: 15px; }
.dept-status__current-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}
.dept-status__editor { margin-bottom: 10px; }
.dept-status__editor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.dept-status__hint {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 8px;
}
.dept-status__hint--error {
    color: var(--error);
    font-weight: 600;
}
.dept-status__field--error .filter-field__control {
    border-color: var(--error);
}
.dept-status__message {
    font-size: 13px;
    min-height: 1.2em;
    margin-bottom: 8px;
}
.dept-status__history { margin-top: 4px; }
.dept-status__history-summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
}
.dept-status__history-list {
    margin: 8px 0 0;
    padding-inline-end: 18px;
    font-size: 12px;
    color: var(--text);
}
.dept-status__history-list li { margin-bottom: 6px; }
.dept-status__history-change { font-weight: 600; }

.dept-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary-10);
    border: 1px solid var(--primary-20);
    color: var(--primary);
    white-space: nowrap;
}

.dept-status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.dept-status-badge--btn {
    cursor: pointer;
    font: inherit;
    letter-spacing: inherit;
    line-height: inherit;
}
.dept-status-badge--btn:hover {
    opacity: 0.8;
}
.dept-status-badge--btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.dept-status-badge--add {
    background: transparent;
    border-style: dashed;
    opacity: 0.7;
}
.dept-status-badge--add::before {
    display: none;
}

.item-detail__handling-owner {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

/* Workspace / Versions (issue #280): newest-first timeline of kol_kore_version
 * rows inside the item-detail drawer. border-inline-start is a logical
 * property, so the rail sits on the reading-start edge automatically under
 * RTL — no separate [dir="rtl"] override needed. */
.version-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    list-style: none;
    margin: 0;
    padding: 0;
}
.version-timeline__item {
    position: relative;
    padding-inline-start: var(--s-md);
    padding-bottom: var(--s-xs);
    border-inline-start: 2px solid var(--border-2);
}
.version-timeline__item:last-child {
    border-inline-start-color: transparent;
    padding-bottom: 0;
}
.version-timeline__item::before {
    content: "";
    position: absolute;
    inset-inline-start: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-2);
}
.version-timeline__item--current {
    border-inline-start-color: var(--purple-500);
}
.version-timeline__item--current::before {
    background: var(--purple-500);
    box-shadow: 0 0 0 3px var(--purple-100);
}
.version-timeline__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-xs) var(--s-sm);
}
.version-timeline__number {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.version-timeline__current-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--purple-100);
    border: 1px solid var(--purple-200);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 700;
}
.version-timeline__date {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 2px;
}
.version-timeline__summary {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    margin-top: 4px;
}
.version-timeline__view-btn {
    margin-top: var(--s-xs);
    min-height: 32px;
    font-size: 12px;
}
.version-timeline__view-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.version-change-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--r-full);
    white-space: nowrap;
}
.version-change-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.version-change-badge--created { background: var(--success-50); color: var(--success-700); }
.version-change-badge--updated { background: var(--info-50); color: var(--info); }
.version-change-badge--other   { background: var(--surface-muted); color: var(--text-3); }

/* Workspace / Activity (issue #282): admin-only per-tender audit trail inside the
 * item-detail drawer (db/audit_log.fetch_kol_kore_audit_events). Same timeline
 * shape as .version-timeline above but flat (no current-item rail marker — every
 * row is a past event, none is "the current state"). border-inline-start is a
 * logical property so the rail sits on the reading-start edge under RTL with no
 * extra [dir="rtl"] override. */
.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    list-style: none;
    margin: 0;
    padding: 0;
}
.activity-timeline__item {
    position: relative;
    padding-inline-start: var(--s-md);
    padding-bottom: var(--s-xs);
    border-inline-start: 2px solid var(--border-2);
}
.activity-timeline__item:last-child {
    border-inline-start-color: transparent;
    padding-bottom: 0;
}
.activity-timeline__item::before {
    content: "";
    position: absolute;
    inset-inline-start: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-2);
}
.activity-timeline__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-xs) var(--s-sm);
}
.activity-timeline__actor {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.activity-timeline__date {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 2px;
}
.activity-timeline__details-wrap {
    margin-top: var(--s-xs);
}
.activity-timeline__details-summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-2);
    cursor: pointer;
}
.activity-timeline__details-summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.activity-timeline__details-pre {
    margin-top: var(--s-xs);
    padding: var(--s-sm);
    background: var(--surface-muted);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}
.activity-timeline__empty {
    font-size: 13px;
    color: var(--text-3);
}

.activity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--r-full);
    white-space: nowrap;
}
.activity-badge__icon { font-size: 14px; }
.activity-badge--tone-success { background: var(--success-50); color: var(--success-700); }
.activity-badge--tone-warn    { background: var(--warn-50); color: var(--warn); }
.activity-badge--tone-error   { background: var(--error-50); color: var(--error); }
.activity-badge--tone-info    { background: var(--info-50); color: var(--info); }
.activity-badge--tone-muted   { background: var(--surface-muted); color: var(--text-3); }

/* Workspace / Tasks & Assignment (issue #281): assignment_record + per-department
 * department_kol_kore_status/comment reframed as the workspace's task list — no new
 * backend state. .item-detail__section--tasks wraps the read-only summary rendered
 * here plus the pre-existing #modal-dept-status-root status/comment editor. */
.tasks-assignment__summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--s-md);
}
.tasks-assignment__org {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.tasks-assignment__org .material-symbols-outlined { font-size: 16px; color: var(--text-3); }
.tasks-assignment__date { font-size: 12px; color: var(--text-3); }
.tasks-assignment__empty {
    font-size: 13px;
    color: var(--text-3);
    margin: 0 0 var(--s-md);
}
.tasks-assignment__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-xs);
    margin-bottom: var(--s-md);
}
.tasks-assignment__chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: var(--surface-muted);
    border: 1px solid var(--border-2);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    list-style: none;
    margin: 0 0 var(--s-md);
    padding: 0;
}
.task-row {
    padding: var(--s-sm) var(--s-md);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--surface-muted);
}
.task-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-sm);
    flex-wrap: wrap;
}
.task-row__dept { font-size: 13px; font-weight: 700; color: var(--text); }
.task-row__meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.task-row__comment {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    margin-top: 6px;
}

.task-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--r-full);
    white-space: nowrap;
}
.task-status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.task-status-badge--neutral { background: var(--surface-muted); color: var(--text-2); border: 1px solid var(--border-2); }
.task-status-badge--muted   { background: var(--surface-muted); color: var(--text-3); }
.task-status-badge--info    { background: var(--info-50); color: var(--info); }
.task-status-badge--warn    { background: var(--warn-50); color: var(--warn); }
.task-status-badge--success { background: var(--success-50); color: var(--success-700); }
.task-status-badge--error   { background: var(--error-50); color: var(--error); }

.dept-comment__textarea {
    width: 100%;
    min-height: 88px;
    resize: vertical;
    margin-bottom: 8px;
}
.dept-comment__readonly {
    padding: 10px 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    margin-bottom: 8px;
}
.dept-comment__text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 1rem;
    line-height: 1.5;
}
.dept-comment__text--empty {
    color: var(--muted);
    font-style: italic;
}

#modal-dept-status-root,
#dept-status-modal-root {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
}

.item-detail__desc {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    font-size: 1rem;
    color: var(--text);
    padding: 12px 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    max-height: 360px;
    overflow-y: auto;
}
.item-detail__desc--empty { color: var(--muted); font-style: italic; }
.item-detail__desc a { color: #2563eb; text-decoration: underline; word-break: break-all; }
.item-detail__desc a:hover { color: #1d4ed8; }

.item-detail__grid {
    display: flex;
    flex-direction: column;
}
.item-detail__field {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: baseline;
    gap: var(--s-md);
    padding-block: var(--s-sm);
    border-block-end: 1px solid var(--border);
    min-width: 0;
}
.item-detail__field:last-child { border-block-end: 0; }
.item-detail__label {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 500;
}
.item-detail__value {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    word-break: break-word;
    line-height: 1.4;
}

.item-detail__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-2);
}
.item-detail__version-line {
    font-size: 12px;
    color: var(--text-3);
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.copy-btn:hover { background: var(--lavender-2); border-color: var(--border-hover); }
.copy-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.copy-btn:active { transform: translateY(1px); }
.copy-btn .material-symbols-outlined { color: var(--muted); }
.copy-btn__label { color: var(--muted); }
.copy-btn__id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text);
}
.copy-btn__feedback {
    color: var(--success-700);
    font-weight: 700;
    margin-inline-start: 4px;
    min-width: 0;
}
.copy-btn.is-copied { border-color: rgba(34,197,94,0.45); background: rgba(34,197,94,0.08); }

.item-detail__raw {
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--e1);
    overflow: hidden;
}
.item-detail__raw + .item-detail__raw {
    margin-top: 10px;
}
.item-detail__raw--ai {
    border-color: var(--purple-200);
    background: var(--purple-50);
}
.item-detail__raw--ai[open] .item-detail__raw-summary {
    border-bottom-color: var(--purple-200);
}
.item-detail__raw-summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: var(--hit);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: 100%;
    box-sizing: border-box;
}
.item-detail__raw-summary::-webkit-details-marker { display: none; }
.item-detail__raw-summary::after {
    /* Expand/collapse chevron is a block-axis (down/up) indicator, not a
       wayfinding arrow — it must NOT mirror under RTL, so this uses a fixed
       physical corner (border-right) rather than border-inline-end. */
    content: "";
    inline-size: 8px;
    block-size: 8px;
    margin-inline-start: auto;
    border-right: 2px solid currentColor;
    border-block-end: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s;
}
.item-detail__raw[open] .item-detail__raw-summary::after { transform: rotate(225deg); }
.item-detail__raw-summary:hover { color: var(--accent-ink); background: var(--lavender-2); }
.item-detail__raw:focus-within .item-detail__raw-summary { box-shadow: var(--focus-ring); }
.item-detail__raw[open] .item-detail__raw-summary {
    border-bottom: 1px solid var(--border-2);
    color: var(--text);
}
.item-detail__raw-empty {
    margin: 0;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}
.item-detail__raw-pre {
    margin: 0;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow: auto;
    background: var(--surface);
}

/* ── Role pill (topbar) ───────────────────────────────── */
.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}
.role-pill--system_administrator { background: var(--purple-100); color: var(--purple-900); border-color: var(--purple-200); }
.role-pill--internal_operator { background: var(--primary-10); color: var(--primary); border-color: var(--primary-20); }
.role-pill--internal_read_only { background: var(--surface-muted); color: var(--muted); border-color: var(--border); }
.role-pill--customer { background: var(--info-50); color: var(--info); border-color: rgba(45,108,181,.25); }
.role-pill--customer_admin { background: var(--warn-50); color: var(--warn); border-color: rgba(146,64,14,.25); }
.role-pill--customer_department_admin { background: var(--primary-10); color: var(--purple-700); border-color: var(--primary-20); }
.role-pill--customer_contributor { background: var(--primary-10); color: var(--primary); border-color: var(--primary-20); }
.role-pill--customer_viewer { background: var(--surface-muted); color: var(--muted); border-color: var(--border); }

.app-topbar__user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 0;
}

.app-topbar__tenant-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    max-width: min(420px, 55vw);
}

.tenant-chip {
    font-size: 11px;
    line-height: 1.2;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--purple-50);
    color: var(--muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ── Profile settings ────────────────────────────────── */
.profile-settings-page .app-main {
    gap: 20px;
}

.profile-header {
    align-items: center;
}

.profile-breadcrumb {
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.profile-workspace {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 780px);
    grid-template-areas: "summary sections";
    align-items: start;
    gap: 24px;
    max-width: 1120px;
}

.profile-summary-card {
    grid-area: summary;
    position: sticky;
    top: calc(var(--app-topbar-height) + 18px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--primary-20);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.profile-summary-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.profile-summary-copy h2 {
    margin: 0;
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.profile-summary-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.profile-summary-copy .role-pill {
    align-self: flex-start;
}

.profile-summary-orgs {
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.profile-summary-orgs h3 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 1rem;
}

.profile-tenant-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.profile-tenant-list li {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    color: var(--text);
    font-size: 13px;
}

.profile-tenant-list strong,
.profile-tenant-list .tenant-role-label {
    overflow-wrap: anywhere;
}

.profile-tenant-list .tenant-role-label {
    color: var(--muted);
    font-weight: 600;
}

.profile-sections {
    grid-area: sections;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 18px;
}

.profile-settings-page .manual-form-card {
    border-color: var(--primary-20);
    border-radius: var(--r-sm);
}

.profile-section {
    padding: 24px;
}

.profile-section__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    margin-bottom: 18px;
}

.profile-section__header h2 {
    margin: 0;
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}

.profile-section__header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.45;
}

.profile-section__kicker {
    display: inline-flex;
    min-width: 54px;
    justify-content: center;
    padding: 5px 9px;
    border-radius: var(--radius-pill);
    background: var(--primary-10);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.profile-theme-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.profile-settings-page .theme-preference__option {
    min-height: 64px;
    justify-content: flex-start;
    padding: 14px 16px;
    border-color: var(--primary-20);
    background: var(--surface);
    color: var(--text);
}

.profile-settings-page .theme-preference__option .material-symbols-outlined {
    color: var(--primary);
}

.profile-avatar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 24px;
}

.profile-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary);
    border: 1px solid var(--primary-20);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-preview--large {
    width: 112px;
    height: 112px;
    align-self: center;
}

.profile-avatar-preview__initial {
    color: var(--text-inverse);
    font-size: 36px;
    font-weight: 700;
}

.profile-avatar-preview--large .profile-avatar-preview__initial {
    font-size: 44px;
}

.profile-avatar-preview__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-actions {
    flex: 1;
    min-width: min(280px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-avatar-upload {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 16px;
    border: 1px dashed var(--primary-20);
    border-radius: var(--r-sm);
    background: var(--surface-subtle);
}

.profile-avatar-upload > .material-symbols-outlined {
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-10);
    color: var(--primary);
}

.profile-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.profile-settings-page .manual-submit-btn {
    min-height: var(--hit);
    border-color: var(--primary);
    background: var(--primary);
    color: var(--text-inverse);
    padding-inline: 18px;
}

.profile-settings-page .manual-submit-btn:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}

.profile-settings-page .manual-submit-btn--danger {
    border-color: var(--danger-10);
    background: var(--danger-10);
    color: var(--danger);
}

.profile-settings-page .manual-submit-btn--danger:hover {
    border-color: var(--danger);
    background: var(--danger);
    color: var(--text-inverse);
}

.manual-submit-btn--danger {
    color: var(--danger);
    border-color: var(--danger-10);
    background: var(--danger-10);
}

.manual-submit-btn--danger:hover {
    color: var(--text-inverse);
    background: var(--danger);
    border-color: var(--danger);
}

/* ── Small link/button in topbar ─────────────────────── */
.topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: var(--hit);
    padding: 6px 12px;
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.topbar-link:hover { background: var(--lavender-2); color: var(--accent-ink); border-color: var(--border-2); }
.topbar-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.topbar-link .material-symbols-outlined { font-size: 16px; }

/* ── Manual entry form ────────────────────────────────── */
.manual-entry-page .app-main {
    gap: 20px;
}

.manual-flash-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.manual-flash {
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
}

.manual-flash--success {
    background: var(--success-50);
    color: var(--success-700);
    border: 1px solid rgba(30, 142, 99, 0.25);
}

.manual-flash--error {
    background: var(--error-50);
    color: var(--error);
    border: 1px solid rgba(192, 57, 43, 0.25);
}

.view-as-org-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    border: 1px solid rgba(37, 99, 235, 0.22);
    background: rgba(37, 99, 235, 0.08);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.view-as-org-banner__exit {
    color: var(--primary, #2563eb);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.global-context-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.08);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.global-context-banner .material-symbols-outlined {
    font-size: 16px;
    color: rgb(16, 185, 129);
}

.manual-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.manual-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.manual-entry-breadcrumb {
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.manual-entry-header {
    align-items: center;
    padding-bottom: 4px;
}

.manual-entry-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--success-10);
    border-radius: var(--r-sm);
    background: var(--success-10);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.manual-entry-state .material-symbols-outlined {
    font-size: 18px;
}

.manual-entry-workspace {
    width: 100%;
}

.manual-entry-form {
    display: block;
}

.manual-entry-layout {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 760px);
    grid-template-areas: "progress sections";
    align-items: start;
    gap: 24px;
    max-width: 1120px;
}

.manual-entry-progress-card {
    grid-area: progress;
    position: sticky;
    top: calc(var(--app-topbar-height) + 18px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--primary-20);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.manual-progress-summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
}

.manual-progress-summary strong {
    color: var(--primary);
    font-size: 24px;
    line-height: 1;
}

.manual-progress-meter {
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--primary-20);
}

.manual-progress-meter span {
    display: block;
    width: 57%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.manual-progress-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.manual-progress-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.manual-progress-dot {
    width: 13px;
    height: 13px;
    border: 2px solid var(--primary-20);
    border-radius: 50%;
    background: var(--surface);
    flex: 0 0 auto;
}

.manual-progress-item--active {
    color: var(--primary);
}

.manual-progress-item--active .manual-progress-dot {
    border-color: var(--primary);
    background: var(--primary);
}

.manual-progress-note,
.manual-date-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.manual-progress-note {
    padding: 12px;
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: var(--r-sm);
    background: rgba(59, 130, 246, 0.08);
    color: var(--text);
}

.manual-progress-note .material-symbols-outlined,
.manual-date-note .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 18px;
}

.manual-entry-sections {
    grid-area: sections;
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 18px;
}

.manual-entry-page .manual-form-card {
    border-color: var(--primary-20);
    border-radius: var(--r-sm);
}

.manual-entry-section {
    padding: 24px;
}

.manual-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.manual-section-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}

.manual-section-kicker {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.manual-upload-section {
    padding: 22px 24px;
}

.manual-upload-dropzone {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px 14px;
    align-items: center;
    padding: 20px;
    border: 1px dashed var(--primary-20);
    border-radius: var(--r-sm);
    background: var(--surface-subtle);
}

.manual-upload-icon {
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-10);
    color: var(--primary);
}

.manual-upload-copy {
    min-width: 0;
}

.manual-upload-copy p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.manual-upload-label {
    color: var(--text);
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
}

.manual-file-control {
    grid-column: 1 / -1;
    min-height: 44px;
    background: var(--surface);
}

.manual-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manual-grid-span-2 {
    grid-column: span 2;
}

.manual-textarea {
    min-height: 110px;
    resize: vertical;
}

.manual-actions {
    display: flex;
    justify-content: flex-start;
}

.manual-entry-actions-card .manual-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.manual-entry-actions-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.manual-required-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.manual-cancel-btn {
    border-color: transparent;
    background: transparent;
    color: var(--primary);
}

.manual-submit-btn {
    border: 1px solid var(--primary-20);
    background: var(--primary-10);
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
}

.manual-submit-btn:hover {
    background: var(--primary-20);
}

.manual-entry-page .manual-submit-btn {
    min-height: 40px;
    border-color: var(--primary);
    background: var(--primary);
    color: var(--text-inverse);
    padding-inline: 18px;
    box-shadow: var(--e2);
}

.manual-entry-page .manual-submit-btn:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    box-shadow: var(--e3);
}

.org-filter-pop-range {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.org-filter-pop-range .filter-field__control {
    flex: 0 1 160px;
    min-width: 112px;
}

.org-filter-pop-range__sep {
    color: var(--muted);
    font-size: 0.95rem;
}

/* ── Material symbols helper ─────────────────────────── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
}

/* ── Deadline badge ──────────────────────────────────── */
.deadline-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.deadline-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.deadline-badge--urgent  { background: var(--error-50); color: var(--error); }
.deadline-badge--soon    { background: var(--warn-50);  color: var(--warn); }
.deadline-badge--ok      { background: var(--success-50); color: var(--success-700); }
.deadline-badge--expired { background: var(--purple-50); color: var(--text-3); }

/* Shown when the source's deadline field looked like a placeholder and the
   displayed date may be wrong (see routes/main_routes/list_filters.py). */
.deadline-uncertain-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px dashed var(--warn);
    border-radius: 999px;
    background: var(--warn-50);
    color: var(--warn);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: help;
}

/* "חדש" badge — full accent fill per Variant D brand book (canonical p.8) */
.badge--new {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* ── Inbox dashboard ─────────────────────────────────── */
.inbox-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.inbox-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--e1);
    min-width: 100px;
    text-align: center;
}

.inbox-stat-card__count {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.inbox-stat-card__label {
    font-size: 13px;
    color: var(--muted);
}

/* ── Dashboard (Variant D) ───────────────────────────── */
.dashboard { gap: var(--space-6); }
.dashboard__header { align-items: center; }
.dashboard__eyebrow,
.dashboard-panel__eyebrow {
    margin: 0 0 4px;
    color: var(--accent-ink);
    font-size: 13px;
    font-weight: 800;
}
.dashboard__scope {
    margin: calc(var(--space-4) * -1) 0 0;
    color: var(--muted);
    font-size: 14px;
}
.dashboard__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
}
.dashboard-metric {
    display: grid;
    gap: 7px;
    min-height: 164px;
    padding: 20px;
    color: inherit;
    text-decoration: none;
    background: var(--surface);
    border: var(--border-hairline) solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--e1);
}
.dashboard-metric:hover { border-color: var(--primary); box-shadow: var(--e3); }
.dashboard-metric:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.dashboard-metric--urgent { border-inline-start: 4px solid var(--warn); }
.dashboard-metric__label { color: var(--muted); font-size: 14px; font-weight: 800; }
.dashboard-metric__value { color: var(--text); font-size: 38px; line-height: 1; }
.dashboard-metric__hint { align-self: end; color: var(--muted); font-size: 13px; }
.dashboard__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: var(--space-5);
}
.dashboard-panel {
    padding: 22px;
    background: var(--surface);
    border: var(--border-hairline) solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--e1);
}
.dashboard-panel__heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: 20px;
}
.dashboard-panel__heading h2 { margin: 0; font-size: 19px; font-weight: 700; }
.dashboard-panel__heading a { font-size: 14px; font-weight: 800; }
.dashboard-pipeline,
.dashboard-deadlines { display: grid; gap: 13px; margin: 0; padding: 0; list-style: none; }
.dashboard-pipeline a {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
    min-height: var(--hit);
    color: inherit;
    text-decoration: none;
}
.dashboard-pipeline a:focus-visible,
.dashboard-deadlines a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.dashboard-pipeline__label { font-size: 14px; font-weight: 700; }
.dashboard-pipeline__bar { height: 10px; overflow: hidden; background: var(--surface-muted); border-radius: var(--r-full); }
.dashboard-pipeline__bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.dashboard-pipeline__count { color: var(--muted); font-size: 14px; text-align: end; }
.dashboard-deadlines li { border-bottom: var(--border-hairline) solid var(--border); }
.dashboard-deadlines li:last-child { border-bottom: 0; }
.dashboard-deadlines a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    color: inherit;
    text-decoration: none;
}
.dashboard-deadlines__title { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-deadlines__date { flex: 0 0 auto; color: var(--warn); font-size: 13px; font-weight: 800; }
.dashboard-empty { margin: 0; color: var(--muted); }

/* ── Opportunities inbox (Variant D) ─────────────────── */
.inbox-view-tabs {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--primary-20);
    border-radius: var(--r-full);
    background: var(--surface);
    box-shadow: var(--e1);
}

.inbox-view-tab {
    min-height: var(--hit);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding-inline: 14px;
    border-radius: var(--r-full);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.inbox-view-tab:hover { background: var(--surface-hover); }
.inbox-view-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.inbox-view-tab.is-active { background: var(--primary); color: var(--text-inverse); }
.inbox-view-tab .material-symbols-outlined { font-size: 18px; }
.inbox-view-tab__count {
    min-width: 22px;
    padding-inline: 6px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.2);
    text-align: center;
}

.inbox-summary {
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.inbox-feed {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 980px;
}

.opportunity-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opportunity-group__header {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: calc(var(--app-topbar-height) + 8px);
    z-index: 2;
    padding-block: 6px;
    background: var(--bg);
}

.opportunity-group__header h2 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
}

.opportunity-group__header span {
    min-width: 26px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--primary-10);
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.opportunity-card {
    display: grid;
    gap: 12px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-inline-start: 4px solid var(--primary);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--e1);
}

.opportunity-card__heading,
.opportunity-card__actions,
.opportunity-card__matches {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.opportunity-card__heading { justify-content: space-between; }
.opportunity-card__title { margin: 0; font-size: 18px; line-height: 1.4; }
.opportunity-card__meta { margin: -5px 0 0; color: var(--muted); font-size: 14px; }
.opportunity-card__matches span {
    padding: 3px 9px;
    border-radius: var(--r-full);
    background: var(--surface-muted);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
}
.opportunity-card__actions { margin-top: 2px; }
.opportunity-card__actions .view-btn { min-height: var(--hit); }

@media (max-width: 768px) {
    .dashboard__header { align-items: stretch; }
    .dashboard__header .view-btn { justify-content: center; }
    .dashboard__metrics,
    .dashboard__grid { grid-template-columns: 1fr; }
    .dashboard-metric { min-height: 130px; }
    .inbox-view-tabs { align-self: stretch; border-radius: var(--r-md); }
    .inbox-view-tab { flex: 1; justify-content: center; padding-inline: 8px; }
    .inbox-view-tab .material-symbols-outlined { display: none; }
    .inbox-feed { gap: 18px; }
    .opportunity-group__header { top: var(--topbar-h-mobile); }
    .opportunity-card { padding: 16px; }
    .opportunity-card__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .opportunity-card__actions .view-btn { justify-content: center; }
}

/* ── Global search results (#276) ─────────────────────── */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    margin: var(--s-md) 0 0;
    padding: 0;
    list-style: none;
}

.search-result-card {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    background: var(--surface);
    border: var(--border-hairline) solid var(--border-2);
    border-inline-start: var(--accent-bar, 4px) solid var(--purple-500);
    border-radius: var(--r-lg);
    box-shadow: var(--e1);
    transition: box-shadow 0.12s, transform 0.12s;
}
.search-result-card:hover { box-shadow: var(--e2); transform: translateY(-1px); }

.search-result-card__top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.search-result-card__meta { color: var(--muted); font-size: 13px; }

.search-result-card__title { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.4; }
.search-result-card__title a {
    color: var(--text);
    text-decoration: none;
    border-radius: var(--r-xs);
}
.search-result-card__title a:hover { color: var(--primary); text-decoration: underline; }
.search-result-card__title a:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.search-result-card__title strong,
.search-result-card__office strong,
.search-result-card__excerpt strong { font-weight: 800; }

.search-result-card__office { margin: 0; color: var(--muted); font-size: 14px; }
.search-result-card__excerpt { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }

@media (max-width: 768px) {
    .search-result-card { padding: 16px; }
}

/* ── Call peek-drawer (#284) ──────────────────────────── */
/* Trigger button in the table cell / card footer, next to .pdf-btn. */
.peek-trigger-btn {
    padding: 6px 8px;
}

/* Reuses the existing .modal shell (scrim, fixed overlay) — only the inner
   panel's size/shape is new, mirroring .modal-content--item-detail's
   RTL edge-pinning (always the visual left, i.e. the "end" edge in RTL). */
.modal-content--peek {
    width: min(440px, 92vw);
    max-height: 100vh;
    height: 100vh;
    margin-inline-start: auto;
    margin-inline-end: 0;
    border-radius: 0;
    border-start-start-radius: var(--r-lg);
    border-end-start-radius: var(--r-lg);
    background: var(--bg);
    box-shadow: var(--e5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
[dir="ltr"] .modal-content--peek {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

.peek-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-sm);
    padding: var(--s-sm) var(--s-md);
    border-bottom: var(--border-hairline) solid var(--border);
    background: var(--surface);
    flex: 0 0 auto;
}
.peek-drawer__eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.peek-drawer__nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}
.peek-drawer__navbtn { min-height: 36px; }

.peek-drawer__body {
    padding: var(--s-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    flex: 1 1 auto;
}
.peek-drawer__statusline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-sm);
    flex-wrap: wrap;
}
.peek-drawer__pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}
.peek-drawer__title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text);
}
.peek-drawer__sub {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
    font-size: 14px;
    flex-wrap: wrap;
}
.peek-drawer__sub .material-symbols-outlined { font-size: 16px; color: var(--text-3); }
.peek-drawer__desc {
    margin: 0;
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.peek-drawer__divider {
    height: 1px;
    border: 0;
    margin: 0;
    background: var(--border);
}
.peek-drawer__kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px var(--s-md);
    margin: 0;
    background: var(--purple-50);
    border-radius: var(--r-md);
    padding: var(--s-md);
}
.peek-drawer__kv dt { color: var(--text-3); font-size: 13px; }
.peek-drawer__kv dd { margin: 0; color: var(--text); font-size: 14px; font-weight: 500; }
.peek-drawer__tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.peek-drawer__tag {
    background: var(--lavender);
    color: var(--text-2);
    border-radius: var(--r-full);
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
}

.peek-drawer__foot {
    flex: 0 0 auto;
    border-top: var(--border-hairline) solid var(--border);
    padding: var(--s-md);
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    background: var(--surface);
}
.peek-drawer__cta {
    width: 100%;
    min-height: var(--hit);
}
.peek-drawer__triage {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.peek-drawer__triage-label {
    font-size: 12px;
    color: var(--text-3);
    margin-inline-end: auto;
}
.peek-drawer__triage-btn {
    width: var(--hit);
    height: var(--hit);
    padding: 0;
    justify-content: center;
}

/* Mobile: bottom-sheet instead of a side drawer (matches mock #23's
   frame--mobile variant). Reuses the same #peek-drawer/.modal shell — only
   the panel's positioning/shape changes. */
@media (max-width: 768px) {
    .modal-content--peek {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 88vh;
        margin: auto 0 0;
        border-start-start-radius: var(--r-lg);
        border-start-end-radius: var(--r-lg);
        border-end-start-radius: 0;
        border-end-end-radius: 0;
        align-self: flex-end;
    }
    #peek-drawer.modal { align-items: flex-end; }
    .peek-drawer__eyebrow { display: none; }
}

/* ── Pipeline / Lifecycle board (Variant D, issue #287) ──
 * Screen-scoped NEW components (kanban board, column, card) — logical
 * properties throughout, so no separate RTL-override block is needed below.
 */
.pipeline-board__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-md); flex-wrap: wrap; }
.pipeline-board__dept-picker { display: flex; align-items: center; min-width: 200px; }
.pipeline-board__header-controls { display: flex; align-items: center; gap: var(--s-lg); flex-wrap: wrap; }
.pipeline-board__hide-expired-form { display: flex; align-items: center; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--s-sm);
    padding: 10px var(--s-md);
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.5;
}
.alert .material-symbols-outlined { font-size: 18px; flex: none; margin-block-start: 1px; }
.alert--info { background: var(--info-50); color: var(--info); }

.pipeline-board__kbd-hint { margin-block-end: var(--s-md); }
.pipeline-board__readonly-note { margin-block-end: var(--s-md); }
.pipeline-kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    direction: ltr;
    unicode-bidi: isolate;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    padding: 1px 6px;
    color: var(--accent-ink);
}

.pipeline-board__mobile-controls { display: none; }
.pipeline-board__stage-picker { display: flex; align-items: center; gap: var(--s-sm); width: 100%; }
.pipeline-board__stage-picker .k { color: var(--text-3); font-weight: 600; font-size: 13px; flex: none; }
.pipeline-board__stage-picker select { flex: 1 1 auto; min-height: var(--hit); }

.pipeline-board {
    display: flex;
    align-items: flex-start;
    gap: var(--s-md);
    overflow-x: auto;
    padding-block-end: var(--s-md);
}

.pipeline-col {
    flex: 0 0 300px;
    inline-size: 300px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    display: flex;
    flex-direction: column;
    max-block-size: 100%;
    transition: box-shadow .15s, border-color .15s;
}
.pipeline-col--move-target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--purple-200); }

.pipeline-col__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-sm);
    padding: var(--s-md);
    background: var(--surface-muted);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-block-end: 1px solid var(--border-2);
}
.pipeline-col__name { font-weight: 700; font-size: 14px; color: var(--accent-ink); }
.pipeline-col__count {
    min-width: 24px;
    padding-inline: 7px;
    border-radius: var(--r-full);
    background: var(--purple-100);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.pipeline-col__body {
    padding: var(--s-sm);
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    overflow-y: auto;
    flex: 1 1 auto;
    min-block-size: 64px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.pipeline-col__body--drag-over { background: var(--lavender-2); }
.pipeline-col__empty { margin: var(--s-sm); color: var(--text-3); font-size: 12px; text-align: center; }

.pipeline-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    padding: var(--s-sm) 12px;
    box-shadow: var(--e1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.pipeline-card:hover { box-shadow: var(--e2); }
.pipeline-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pipeline-card--lifted { opacity: .55; }
.pipeline-card--move-mode { box-shadow: var(--focus-ring); }
.pipeline-card--pending { opacity: .6; pointer-events: none; }
.pipeline-card--readonly { cursor: default; }

.pipeline-card__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-sm); position: relative; }
.pipeline-card__ref { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); direction: ltr; unicode-bidi: isolate; }
.pipeline-card__menu {
    inline-size: 28px;
    block-size: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-3);
    border-radius: var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pipeline-card__menu:hover { background: var(--surface-hover); color: var(--accent-ink); }
.pipeline-card__menu:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pipeline-card__menu .material-symbols-outlined { font-size: 18px; }

.pipeline-card__transfer-menu {
    position: absolute;
    inset-inline-end: 0;
    top: 30px;
    z-index: var(--z-popover);
    min-width: 160px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-popover);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pipeline-card__transfer-menu[hidden] { display: none; }
.pipeline-card__transfer-menu button {
    text-align: start;
    background: transparent;
    border: 0;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    min-height: 36px;
}
.pipeline-card__transfer-menu button:hover,
.pipeline-card__transfer-menu button:focus-visible { background: var(--surface-hover); outline: none; }

.pipeline-card__title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.35;
    color: var(--accent-ink);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pipeline-card__title a { color: inherit; text-decoration: none; }
.pipeline-card__title a:hover { text-decoration: underline; }
.pipeline-card__org {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
}
.pipeline-card__org .material-symbols-outlined { font-size: 14px; color: var(--text-3); }
.pipeline-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-sm); margin-block-start: 2px; }
.pipeline-card__owner { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.pipeline-card__owner .material-symbols-outlined { font-size: 14px; color: var(--text-3); }
.pipeline-card__owner--empty { color: var(--text-3); }

/* Terminal-status pills reuse the review-badge component's pill shape. */
.review-badge--applied { background: var(--info-50); color: var(--info); }
.review-badge--won { background: var(--success-50); color: var(--success-700); }
.review-badge--not_submitting { background: var(--surface-muted); color: var(--text-3); }
.review-badge--rejected { background: var(--error-50); color: var(--error); }

@media (max-width: 768px) {
    .pipeline-board__mobile-controls { display: block; margin-block-end: var(--s-md); }
    .pipeline-board__dept-picker { width: 100%; }
    .pipeline-board {
        display: block;
        overflow-x: visible;
    }
    .pipeline-col { display: none; inline-size: 100%; margin-block-end: var(--s-md); }
    .pipeline-col--mobile-active { display: flex; }
    .pipeline-card { cursor: default; }
}

/* ── RTL overrides ───────────────────────────────────── */
[dir="rtl"] .app-topbar__search-icon {
    left: auto;
    right: 10px;
}
[dir="rtl"] .app-topbar__search-input {
    padding: 0 36px 0 12px;
}
[dir="rtl"] select.filter-field__control {
    background-position: left 9px center;
    padding-right: 10px;
    padding-left: 26px;
}
[dir="rtl"] .results-table th {
    text-align: right;
}
[dir="rtl"] .results-table td {
    text-align: right;
}
[dir="rtl"] .pagination-info {
    margin-right: 0;
    margin-left: auto;
}
[dir="rtl"] .manual-actions {
    justify-content: flex-end;
}

/* ── Mobile drawer toggle button ─────────────────────── */
/* Hidden on desktop; revealed in the mobile breakpoint below. */
.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}
.mobile-menu-btn:hover { background: var(--lavender-2); }
.mobile-menu-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
.mobile-menu-btn .material-symbols-outlined { font-size: 22px; }

/* Mobile-only chrome: the drawer header and the search toggle exist in the
   markup on every viewport but only make sense once the sidebar becomes a
   modal drawer, so they stay hidden until the breakpoint below. */
.drawer-head,
.mobile-search-btn { display: none; }

/* ── Mobile breakpoint (≤768px) ──────────────────────── */
@media (max-width: 768px) {
    /* Condensed single-row top bar: hamburger + brand + actions. Search is one
       tap away behind .mobile-search-btn and unfolds onto a second row; the
       tenant picker and secondary nav links live in the drawer at this width. */
    .app-topbar {
        min-height: var(--topbar-h-mobile);
        height: auto;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 8px;
        align-items: center;
    }
    .mobile-menu-btn { display: inline-flex; }
    .mobile-search-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--hit);
        height: var(--hit);
        padding: 0;
        background: transparent;
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        color: var(--text-2);
        cursor: pointer;
        flex-shrink: 0;
    }
    .mobile-search-btn:hover { background: var(--lavender-2); color: var(--accent-ink); }
    .mobile-search-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
    .mobile-search-btn[aria-expanded="true"] {
        background: var(--purple-50);
        border-color: var(--border-2);
        color: var(--accent-ink);
    }
    .app-topbar__brand { gap: 8px; }
    .app-topbar__name { font-size: 15px; }
    .app-topbar__search {
        display: none;
        order: 99;
        flex: 1 1 100%;
        max-width: 100%;
    }
    body.is-mobile-search-open .app-topbar__search { display: flex; flex-wrap: wrap; }
    .app-topbar__search-btn--secondary { flex: 1 1 100%; text-align: center; }
    .app-topbar__right {
        margin-inline-start: auto;
        gap: 6px;
        flex-wrap: nowrap;
    }
    .app-topbar__user {
        max-width: none;
        padding: 2px;
        gap: 0;
        border-color: transparent;
        background: transparent;
    }
    .app-topbar__user:hover {
        background: transparent;
        border-color: transparent;
    }
    .app-topbar__user-meta,
    .app-topbar__user-email,
    .role-pill,
    .app-topbar__divider,
    .app-topbar__org-context,
    .app-topbar .topbar-link {
        display: none;
    }
    /* Keep the avatar visible — it's the clickable profile entry point. */

    /* Sidebar becomes an off-canvas drawer sliding in from the start edge
       (right in RTL). Motion is transform-only; a11y.css neutralises the
       transition under prefers-reduced-motion. */
    .app-shell { grid-template-columns: 1fr; grid-template-areas: "content"; }
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        inset-inline-start: 0;
        z-index: 200;
        width: var(--filter-panel-drawer-width, min(300px, 86vw));
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--e5);
    }
    body.is-filter-panel-open { --filter-panel-drawer-width: 100vw; }
    .filter-panel__header { padding-inline: 0; }
    .filter-panel__actions {
        position: sticky;
        bottom: -12px;
        margin-inline: -12px;
        padding: 12px;
        border-top: var(--border-hairline) solid var(--border);
    }
    /* In RTL, inset-inline-start already maps to right:0, so the drawer
       sits flush against the right edge by default. We only need to flip
       the transform direction so the off-canvas state is past the right
       edge, not partially over the left. */
    [dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }
    body.is-mobile-drawer-open .app-sidebar {
        transform: translateX(0);
    }
    /* Scrim — always present so it can fade 0 → plum 55%, inert while closed. */
    body::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 150;
        background: var(--scrim);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.24s ease, visibility 0.24s;
    }
    body.is-mobile-drawer-open::before {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    /* Prevent body scroll while drawer is open */
    body.is-mobile-drawer-open { overflow: hidden; }

    /* Drawer header: brand at the start, close at the end (top-left in RTL). */
    .drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--s-sm);
        padding-bottom: var(--s-sm);
        margin-bottom: var(--s-sm);
        border-bottom: var(--border-hairline) solid var(--border);
    }
    .drawer-head__brand {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }
    .drawer-head__logo {
        width: 22px;
        height: 31px;
        flex-shrink: 0;
        display: block;
    }
    .drawer-head__name {
        font-size: 17px;
        font-weight: 800;
        color: var(--accent-ink);
        letter-spacing: -0.02em;
    }
    .drawer-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--hit);
        height: var(--hit);
        padding: 0;
        background: transparent;
        border: 1px solid transparent;
        border-radius: var(--r-md);
        color: var(--text-2);
        cursor: pointer;
        flex-shrink: 0;
    }
    .drawer-close:hover { background: var(--lavender-2); color: var(--accent-ink); }
    .drawer-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }

    /* Main content: trim padding, single-column form grids */
    .app-main { padding: 18px 16px; gap: 16px; }
    .page-header { flex-wrap: wrap; }
    .page-title { font-size: 34px; }
    .page-subtitle { font-size: 1rem; }
    .tender-toolbar { align-items: stretch; }
    .tender-view-tabs {
        width: 100%;
        justify-content: space-between;
        border-radius: var(--r-md);
    }
    .tender-view-tab {
        flex: 1;
        justify-content: center;
        padding-inline: 10px;
    }
    .tender-toolbar__summary {
        justify-content: flex-start;
    }
    :root {
        --calendar-event-slot-height: 2.35rem;
    }
    .manual-grid { grid-template-columns: 1fr; }
    .manual-grid-span-2 { grid-column: 1; }
    .manual-entry-header {
        align-items: flex-start;
        padding-block: 18px 4px;
    }
    .manual-entry-state {
        width: 100%;
        justify-content: center;
    }
    .manual-entry-layout {
        display: flex;
        max-width: none;
        flex-direction: column;
        gap: 16px;
    }
    .manual-entry-progress-card {
        position: static;
        width: 100%;
        padding: 18px;
    }
    .manual-entry-sections {
        gap: 16px;
    }
    .manual-entry-section,
    .manual-upload-section {
        padding: 20px;
    }
    .manual-section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 16px;
    }
    .manual-section-header h2 {
        font-size: 19px;
    }
    .manual-upload-dropzone {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 16px;
    }
    .manual-upload-icon {
        width: 40px;
        height: 40px;
    }
    .manual-entry-actions-card {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    .manual-entry-actions-card .manual-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .manual-entry-actions-card .topbar-link {
        display: inline-flex;
        justify-content: center;
        min-height: 44px;
    }
    .profile-header {
        align-items: flex-start;
        padding-block: 18px 4px;
    }
    .profile-workspace {
        display: flex;
        max-width: none;
        flex-direction: column;
        gap: 16px;
    }
    .profile-summary-card {
        position: static;
        width: 100%;
        padding: 20px;
    }
    .profile-sections {
        width: 100%;
        gap: 16px;
    }
    .profile-section {
        padding: 20px;
    }
    .profile-section__header {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 16px;
    }
    .profile-section__kicker {
        justify-self: start;
    }
    .profile-section__header h2 {
        font-size: 22px;
    }
    .profile-theme-options {
        grid-template-columns: 1fr;
    }
    .profile-avatar-row {
        gap: 16px;
    }
    .profile-avatar-upload {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 14px;
    }
    .profile-avatar-upload > .material-symbols-outlined {
        width: 40px;
        height: 40px;
    }
    .profile-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
    .profile-actions .topbar-link {
        display: inline-flex;
        justify-content: center;
        min-height: 44px;
    }

    /* Cards view: the auto-fill grid already collapses on its own, but drop the
       gap a bit to match the table's mobile-card spacing above. */
    .tender-cards,
    .tender-card-skeleton {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Tender table reflows into cards while preserving table semantics in markup. */
    .table-card {
        background: transparent;
        border: 0;
        box-shadow: none;
    }
    .table-wrap {
        overflow: visible;
        border-radius: 0;
    }
    table.results-table,
    .results-table tbody,
    .results-table tr,
    .results-table td,
    .results-table tbody th {
        display: block;
        width: 100%;
        min-width: 0;
    }
    .results-table thead {
        display: none;
    }
    .results-table tbody {
        display: grid;
        gap: 14px;
    }
    .results-table tbody tr {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px 18px;
        padding: 58px 18px 18px;
        background: var(--surface);
        border: var(--border-hairline) solid var(--border);
        border-inline-end: 5px solid var(--accent);
        border-radius: var(--r-lg);
        box-shadow: var(--e2);
    }
    .results-table tbody tr:nth-child(even) {
        background: var(--surface);
    }
    .results-table tbody tr:hover {
        background: var(--surface);
        box-shadow: var(--e3);
    }
    [dir="rtl"] .results-table tbody tr:hover {
        box-shadow: var(--e3);
    }
    .results-table tbody tr.tender-row--urgent { border-inline-end-color: var(--error); }
    .results-table tbody tr.tender-row--soon { border-inline-end-color: var(--warn); }
    .results-table tbody tr.tender-row--ok { border-inline-end-color: var(--success-700); }
    .results-table tbody tr.tender-row--expired { border-inline-end-color: var(--text-3); }
    .results-table td,
    .results-table tbody th {
        padding: 0;
        font-size: 1rem;
        border: 0;
        text-align: start;
    }
    .results-table td::before,
    .results-table tbody th::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--text-3);
        font-size: 12px;
        font-weight: 700;
    }
    .results-table .title-cell {
        grid-column: 1 / -1;
        width: 100%;
        max-width: none;
        min-width: 0;
        padding-bottom: 10px;
        border-bottom: var(--border-hairline) solid var(--border);
    }
    .results-table .title-cell::before,
    .results-table td.tender-cell--deadline::before,
    .results-table td.tender-cell--details::before,
    .results-table td.tender-cell--actions::before,
    .results-table td.tender-cell--link::before {
        display: none;
    }
    .tender-title-text {
        font-size: 24px;
        line-height: 1.25;
    }
    .tender-title-meta {
        display: block;
    }
    .tender-cell--id,
    .tender-cell--office {
        display: none !important;
    }
    .tender-cell--deadline {
        position: absolute;
        inset-block-start: 18px;
        inset-inline-start: 18px;
        width: auto !important;
    }
    .tender-cell--published,
    .tender-cell--department,
    .tender-cell--review {
        color: var(--text);
    }
    .tender-cell--link,
    .tender-cell--details,
    .tender-cell--actions {
        display: inline-flex !important;
        align-items: center;
        min-width: 0;
    }
    .tender-cell--details .view-btn,
    .tender-cell--link .link-btn,
    .tender-cell--actions .table-actions__toggle {
        min-width: 96px;
    }

    /* Touch targets: WCAG 2.5.5 floor of 44x44 for primary actions. */
    .view-btn,
    .page-btn,
    .link-btn,
    .filter-reset-link {
        min-height: 44px;
        padding-block: 10px;
    }

    /* Pagination: wrap so buttons don't overflow */
    .pagination {
        margin-top: 14px;
        flex-wrap: wrap;
        gap: 8px;
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        box-shadow: var(--shadow-sm);
    }
    .pagination-info { flex: 1 1 100%; }

    /* Modal: full-bleed margin on small screens */
    .modal-content {
        width: 96vw;
        max-height: 92vh;
        margin: 4vh auto;
    }
    .modal-content--item-detail {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
    }
    .modal-header { padding: var(--s-sm) var(--s-md); }
    .item-detail { padding: var(--s-md); }
    .item-detail__title { font-size: 20px; }
    .item-detail__dates { grid-template-columns: 1fr; }
    .item-detail__field { grid-template-columns: 100px 1fr; gap: var(--s-sm); }
}

/* ── Accessibility statement page topbar ── */
.a11y-page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--app-topbar-height);
    padding: 0 var(--space-6);
    background: var(--surface);
    border-bottom: var(--border-hairline) solid var(--border);
    box-shadow: var(--e1);
    position: sticky;
    top: 0;
    z-index: 40;
}
.a11y-page-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-ink);
    letter-spacing: -0.02em;
}
.a11y-page-topbar__back {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.a11y-page-topbar__back:hover { text-decoration: underline; }
.a11y-page-topbar__back .material-symbols-outlined { font-size: 18px; }

/* ── Accessibility statement / legal prose ── */
.legal-page {
    min-height: calc(100vh - var(--app-topbar-height));
    display: flex;
    justify-content: center;
    padding: 48px 24px;
    background: var(--color-background, #f5f5f5);
}
.legal-prose {
    max-width: 720px;
    width: 100%;
    background: var(--color-surface, #fff);
    border-radius: var(--r-sm);
    padding: 40px 48px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    line-height: 1.7;
    color: var(--color-text, #222);
}
.legal-prose h1 { font-size: 40px; margin-bottom: 24px; }
.legal-prose h2 { font-size: 19px; font-weight: 700; margin-top: 32px; margin-bottom: 8px; }
.legal-prose p, .legal-prose ul, .legal-prose dl { margin-bottom: 12px; }
.legal-prose ul { padding-inline-start: 24px; }
.legal-definition-list dt { font-weight: 600; display: inline; }
.legal-definition-list dd { display: inline; margin-inline-start: 4px; }
.legal-definition-list dd::after { content: "\A"; white-space: pre; }
.legal-back-link { margin-top: 40px; }
@media (max-width: 600px) {
    .legal-prose { padding: 24px 20px; }
}

/* ── Saved / Smart Views (#272) ──────────────────────── */
.saved-view-create-card,
.saved-view-list-card {
    margin-top: var(--space-4);
}

.saved-view-create-card--hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.saved-view-create-card--hint .page-subtitle { margin: 0; max-width: 60ch; }

.saved-view-list {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.saved-view-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 4px 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-inline-start: 4px solid var(--border-2);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--e1);
}
.saved-view-card--favorite { border-inline-start-color: var(--primary); }

.saved-view-card__favorite-form { grid-row: 1 / 3; }
.saved-view-card__favorite-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--hit);
    min-height: var(--hit);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-3);
    cursor: pointer;
}
.saved-view-card--favorite .saved-view-card__favorite-btn,
.saved-view-card__favorite-btn[aria-pressed="true"] {
    color: var(--warn);
    border-color: var(--warn-50);
    background: var(--warn-50);
}
.saved-view-card__favorite-btn:hover { background: var(--surface-hover); }
.saved-view-card__favorite-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.saved-view-card__main {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--hit);
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}
.saved-view-card__main:hover .saved-view-card__name { text-decoration: underline; }
.saved-view-card__main:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
.saved-view-card__name { font-size: 15px; }
.saved-view-card__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--surface-muted);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 800;
}

.saved-view-card__chips {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 0;
}
.saved-view-card__chips--empty {
    color: var(--text-3);
    font-size: 12px;
}
.saved-view-card__chip {
    padding: 3px 9px;
    border-radius: var(--r-full);
    background: var(--surface-muted);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
}

.saved-view-card__more {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: start;
}
.saved-view-card__more summary {
    display: inline-flex;
    align-items: center;
    min-height: var(--hit);
    padding: 6px 12px;
    border: 1px solid var(--primary-20);
    border-radius: var(--r-md);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.saved-view-card__more summary::-webkit-details-marker { display: none; }
.saved-view-card__more summary:hover { background: var(--surface-hover); }
.saved-view-card__more summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.saved-view-card__more[open] summary { background: var(--surface-hover); }
.saved-view-card__more > div,
.saved-view-card__more form {
    margin-top: 8px;
}
.saved-view-card__rename-form {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.saved-view-card__rename-form .filter-field__control { min-width: 200px; }

@media (max-width: 640px) {
    .saved-view-card {
        grid-template-columns: auto 1fr;
    }
    .saved-view-card__more {
        grid-column: 1 / -1;
        grid-row: auto;
        margin-top: 8px;
    }
    .saved-view-card__rename-form { flex-direction: column; align-items: stretch; }
}

/* ── Quick-action bar (item detail modal) ── */
.item-detail__quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    margin-top: 4px;
}
.item-detail__quick-actions-label {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    margin-inline-end: 4px;
}
.item-detail__quick-actions-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 6px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #374151);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.quick-action-btn:hover,
.quick-action-btn:focus-visible {
    background: var(--color-surface-hover, #f3f4f6);
    border-color: var(--color-border-strong, #9ca3af);
    outline: none;
}
.quick-action-btn .material-symbols-outlined { font-size: 18px; }
