/* ========================================
   Design tokens
======================================== */
:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #172033;
    --text-muted: #667085;
    --border: #e4e7ec;
    --brand: #3b5ccc;
    --brand-soft: #eef2ff;
    --success: #169c65;
    --success-soft: #eaf8f1;
    --warning: #c87d00;
    --warning-soft: #fff6df;
    --danger: #d64545;
    --danger-soft: #fff0f0;
    --review: #7a56d8;
    --status-new: #3156b6;
    --status-assigned: #5043a3;
    --status-progress: #6a3eb4;
    --status-review: #236783;
    --status-accepted: #16694f;
    --status-closed: #4b5563;
    --status-returned: #a25a12;
    --status-danger: #b53939;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 18px 45px rgba(16, 24, 40, .12);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

:root[data-theme="dark"] {
    --bg: #111827;
    --surface: #182131;
    --surface-alt: #111927;
    --text: #eef2f6;
    --text-muted: #a8b2c1;
    --border: #2a3647;
    --brand: #8ea2ff;
    --brand-soft: #26335b;
    --success-soft: #183d30;
    --warning-soft: #4b3b1e;
    --danger-soft: #48292c;
    --shadow-sm: none;
    --shadow-lg: 0 18px 45px rgba(0, 0, 0, .35);
}

/* ========================================
   Base
======================================== */
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, Arial, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
h1, h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 6px; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.03em; }
h3 { margin-bottom: 4px; }
[hidden] { display: none !important; }

/* ========================================
   Utilities
======================================== */
.muted { color: var(--text-muted); }
.eyebrow { margin-bottom: 6px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* ========================================
   Application shell
======================================== */
.app-layout { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.app-sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; gap: 22px; background: var(--surface); border-right: 1px solid var(--border); }
.app-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; text-decoration: none; }
.app-brand__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand); color: #fff; font-size: 11px; letter-spacing: .05em; }
.app-sidebar__caption { margin: -12px 0 0 48px; color: var(--text-muted); font-size: 11px; }
.app-nav { display: grid; gap: 4px; }
.app-nav__link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.app-nav__link:hover, .app-nav__link.is-active { background: var(--brand-soft); color: var(--brand); }
.app-nav__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.app-sidebar__footer { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px; color: var(--text-muted); font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot--online { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.app-main { min-width: 0; }
.app-header { min-height: 92px; padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--border); }
.app-header__intro .eyebrow { margin-bottom: 2px; }
.app-header__title { margin: 0; font-size: 20px; }
.app-header__subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.app-header__actions, .page-toolbar__actions { display: flex; align-items: center; gap: 10px; }
.global-search input { width: min(300px, 30vw); padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); color: var(--text); }
.global-search-wrap { position: relative; }
.global-search-results { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; max-height: 60vh; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.global-search-results__group-label { padding: 8px 10px 4px; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.global-search-results__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.global-search-results__item:hover, .global-search-results__item.is-active { background: var(--brand-soft); }
.global-search-results__item strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.global-search-results__item small { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.global-search-results__empty, .global-search-results__loading { padding: 14px 10px; color: var(--text-muted); font-size: 12px; text-align: center; }
.icon-button, .profile-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.profile-button { background: var(--brand); color: #fff; border-color: var(--brand); font-size: 11px; font-weight: 800; }
.app-content { padding: 28px 32px 48px; }

/* ========================================
   Common components
======================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.card-header { padding-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; font-size: 15px; }
.page-section { display: grid; gap: 20px; }
.page-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-toolbar h2 { margin: 0; }
.page-toolbar .muted { margin: 0; }
button, [role="button"], .btn, .segmented-button, .icon-button, .profile-button,
.pagination-button, .pagination-page, .pagination__button, .person-profile-role,
.tasks-quick-tab, .task-detail-tab, .table-icon-button, .simple-list__button {
    text-decoration: none;
}
.app-layout a,
.app-layout a:hover,
.app-layout a:focus,
.app-layout a:active,
.app-layout a:visited {
    text-decoration: none;
}
.btn, .segmented-button { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; }
.btn:hover, .segmented-button:hover { border-color: var(--brand); color: var(--brand); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { color: #fff; filter: brightness(.96); }
.btn--ghost { background: transparent; }
.field { display: grid; gap: 7px; color: var(--text-muted); font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; outline: 0; background: var(--surface-alt); color: var(--text); text-transform: none; letter-spacing: normal; font-size: 13px; font-weight: 500; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { min-height: 80px; resize: vertical; }
.field select[multiple] { min-height: 98px; }
.count-pill, .filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); font-size: 11px; font-weight: 800; }
.status-badge, .priority-badge, .task-label { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; padding: 4px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 800; white-space: nowrap; }
.priority-badge[data-priority="CRITICAL"], .priority-badge[data-priority="HIGH"] { background: var(--danger-soft); color: var(--danger); }
.priority-badge[data-priority="MEDIUM"] { background: var(--warning-soft); color: var(--warning); }
.priority-badge[data-priority="NORMAL"] { background: var(--brand-soft); color: var(--brand); }
.priority-badge[data-priority="LOW"] { background: var(--success-soft); color: var(--success); }

/* ========================================
   Dashboard
======================================== */
.dashboard-kpis, .task-insights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .insight-card { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.metric-card span, .insight-card__label { display: block; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.metric-card strong, .insight-card__value { display: block; margin: 8px 0; font-size: 30px; letter-spacing: -.04em; }
.metric-card small { color: var(--text-muted); }
.dashboard-grid--wide, .reports-grid, .chain-layout, .security-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; }
.dashboard-panel { padding: 18px; }
.simple-list { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.simple-list__button { width: 100%; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 0; border-radius: 10px; background: var(--surface-alt); color: var(--text); text-align: left; }
.simple-list__button:hover { background: var(--brand-soft); }
.simple-list__main { display: grid; gap: 4px; min-width: 0; }
.simple-list__main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.simple-list__main small { color: var(--text-muted); }
.health-list { margin: 16px 0 0; display: grid; gap: 10px; }
.health-list div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.health-list dt { color: var(--text-muted); }
.health-list dd { margin: 0; font-weight: 800; }

/* ========================================
   Tasks page and filters
======================================== */
.tasks-page { display: grid; gap: 18px; }
.tasks-filters {
    flex: 0 0 auto;
    margin: 12px 28px 0;
    padding: 20px 22px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.tasks-filters__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.tasks-filters__header h2,
.tasks-filters__header h3 {
    margin: 0;
    font-size: 16px;
}

.tasks-filters__header .muted {
    margin: 5px 0 0;
    font-size: 12px;
}

.tasks-filters__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.tasks-filters__grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.35fr) repeat(4, minmax(150px, 1fr));
    gap: 16px;
    padding-top: 18px;
}

.tasks-filters .field {
    min-width: 0;
}

.tasks-filters .field > span,
.field--date-range > span {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tasks-filters .field input,
.tasks-filters .field select {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    background: var(--surface-alt);
}

.tasks-filters .field--select select {
    appearance: auto;
    cursor: pointer;
}

.field--date-range {
    grid-column: span 2;
}

.date-range-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.date-range-control__separator {
    color: var(--text-muted);
    font-weight: 700;
}

.date-range-control input[type="date"] {
    min-width: 0;
}

.tasks-filters[hidden] {
    display: none;
}
.tasks-view-toggle { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.segmented-button { border: 0; padding: 8px 12px; }
.segmented-button.is-active { background: var(--brand); color: #fff; }

/* ========================================
   Kanban
======================================== */
.tasks-view--kanban { display: grid; grid-template-columns: repeat(7, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kanban-column { min-width: 250px; min-height: 180px; background: color-mix(in srgb, var(--surface-alt) 70%, var(--surface)); border: 1px solid var(--border); border-radius: var(--radius-md); }
.kanban-column__header { padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.kanban-column__header > div { display: flex; align-items: center; gap: 8px; }
.kanban-column__header h3 { margin: 0; font-size: 13px; }
.kanban-column__indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.kanban-column__indicator--new { background: var(--text-muted); }
.kanban-column__indicator--assigned { background: var(--brand); }
.kanban-column__indicator--progress { background: var(--warning); }
.kanban-column__indicator--review { background: var(--review); }
.kanban-column__indicator--done { background: var(--success); }
.kanban-column__tasks { padding: 10px; display: grid; gap: 10px; }
.kanban-column__empty { margin: 0; padding: 10px 14px 16px; color: var(--text-muted); font-size: 12px; text-align: center; }
.task-card { display: grid; gap: 10px; padding: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.task-card:hover, .task-card:focus-visible { border-color: var(--brand); box-shadow: 0 8px 18px rgba(16, 24, 40, .08); outline: 0; transform: translateY(-1px); }
.task-card__meta, .task-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-card__number { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.task-card__title { margin: 0; font-size: 14px; line-height: 1.4; }
.task-card__description { margin: 0; display: -webkit-box; overflow: hidden; color: var(--text-muted); font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.task-card__labels { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }
.task-card__footer { padding-top: 8px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 11px; }
.task-card__person { max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }

/* ========================================
   Table
======================================== */
.tasks-table-wrap { overflow-x: auto; }
.tasks-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.tasks-table th { padding: 12px 14px; color: var(--text-muted); font-size: 11px; letter-spacing: .04em; text-align: left; text-transform: uppercase; background: var(--surface-alt); }
.tasks-table td { padding: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.task-row { cursor: pointer; }
.task-row:hover, .task-row:focus-visible { background: var(--brand-soft); outline: none; }
.table-task { display: grid; gap: 4px; }
.table-task span { color: var(--text-muted); font-size: 10px; }

/* ========================================
   Task detail panel
======================================== */
.task-detail-panel { position: fixed; inset: 0 0 0 auto; width: min(720px, 52vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 50; }
.task-detail-panel__header { padding: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); }
.task-detail-panel__header h2 { margin: 4px 0 0; font-size: 22px; }
.task-detail-panel__number { margin: 0; color: var(--text-muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.task-detail-panel__body { padding: 24px; overflow-y: auto; display: grid; gap: 24px; }
.task-detail-section h3 { margin-bottom: 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.task-detail-section p { line-height: 1.7; }
.task-detail-list { display: grid; margin: 0; border-top: 1px solid var(--border); }
.task-detail-list div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.task-detail-list dt { color: var(--text-muted); }
.task-detail-list dd { margin: 0; font-weight: 600; }

/* ========================================
   Chain
======================================== */
.chain-panel, .chain-sidebar { padding: 18px; }
.chain-list { display: grid; gap: 8px; margin-top: 16px; }
.chain-item { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-alt); cursor: pointer; }
.chain-item:hover, .chain-item:focus-visible { border-color: var(--brand); outline: none; }
.chain-item__connector { width: 3px; height: 100%; min-height: 42px; border-radius: 999px; background: var(--brand); }
.chain-item__relation, .chain-item p { color: var(--text-muted); font-size: 11px; }
.chain-item h3, .chain-item p { margin: 0; }
.chain-legend { display: grid; gap: 14px; padding-left: 20px; color: var(--text-muted); }
.chain-legend li { display: grid; gap: 3px; }
.chain-legend strong { color: var(--text); }

/* ========================================
   People
======================================== */
.people-toolbar { padding: 14px; }
.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.person-card { padding: 18px; display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.person-card__header { display: flex; align-items: center; gap: 12px; }
.person-card__header h3 { margin: 0; font-size: 15px; }
.person-card__header p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }
.avatar { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; }
.person-card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.person-card__stats div { padding: 10px; background: var(--surface-alt); border-radius: 9px; }
.person-card__stats dt { color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.person-card__stats dd { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.person-card__role { color: var(--brand); font-size: 11px; font-weight: 800; }

/* ========================================
   Reports
======================================== */
.reports-grid > .card { padding: 18px; }
.report-status-list { display: grid; gap: 12px; margin-top: 16px; }
.report-status { display: grid; grid-template-columns: 100px minmax(100px, 1fr) 36px; align-items: center; gap: 10px; }
.report-status__label { color: var(--text-muted); font-size: 12px; }
.report-status__meter { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-alt); }
.report-status__meter span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; }
.report-notes { display: grid; gap: 10px; margin: 16px 0 0; padding-left: 20px; color: var(--text-muted); line-height: 1.6; font-size: 13px; }

/* ========================================
   Security
======================================== */
.security-grid > .card { padding: 18px; }
.settings-form { display: grid; gap: 14px; margin-top: 16px; }
.security-tip { align-self: start; background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 20%, var(--border)); }
.security-tip p { color: var(--text-muted); line-height: 1.6; }
.sessions-list { display: grid; margin-top: 16px; }
.session { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.session__icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--success-soft); color: var(--success); }
.session__main h3 { margin: 0; font-size: 13px; }
.session__main p, .session__main small { display: block; margin: 3px 0 0; color: var(--text-muted); font-size: 12px; }
.session__status { color: var(--success); font-size: 11px; font-weight: 800; }

/* ========================================
   Empty states and toast region
======================================== */
.empty-state { padding: 32px; margin: 0; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius-md); background: var(--surface); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; }
.toast {
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .14);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    max-width: 320px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); color: var(--success); }
.toast--error { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); color: var(--danger); }

/* ========================================
   Responsive
======================================== */
@media (max-width: 1200px) {
    .tasks-filters__grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
    .field--date-range { grid-column: span 3; }
    .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .app-layout { grid-template-columns: 1fr; }
    .app-sidebar { position: static; height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
    .app-sidebar__caption, .app-sidebar__footer { display: none; }
    .app-nav { grid-template-columns: repeat(6, minmax(max-content, 1fr)); overflow-x: auto; }
    .app-nav__link { justify-content: center; white-space: nowrap; }
    .app-header { padding: 16px; }
    .app-content { padding: 20px 16px 36px; }
    .dashboard-kpis, .task-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid--wide, .reports-grid, .chain-layout, .security-grid { grid-template-columns: 1fr; }
    .task-detail-panel { width: min(720px, 100vw); }
}

@media (max-width: 640px) {
    .app-header, .page-toolbar, .page-toolbar__actions, .tasks-filters__header, .tasks-filters__actions { align-items: stretch; flex-direction: column; }
    .app-header__actions { width: 100%; }
    .global-search { flex: 1; }
    .global-search input { width: 100%; }
    .tasks-filters__grid, .dashboard-kpis, .task-insights, .people-grid { grid-template-columns: 1fr; }
    .field--date-range { grid-column: auto; }
    .date-range-control { grid-template-columns: 1fr; }
    .date-range-control__separator { display: none; }
    .app-nav__link { padding: 8px 10px; font-size: 12px; }
    .task-detail-panel__header, .task-detail-panel__body { padding: 18px; }
    .task-detail-list div { grid-template-columns: 1fr; gap: 4px; }
    .report-status { grid-template-columns: 80px minmax(80px, 1fr) 28px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ========================================
   Enhanced Dashboard
======================================== */
.dashboard-content { padding: 24px 28px 42px; }
.dashboard-page { display: grid; gap: 20px; }
.dashboard-header { align-items: center; }
.app-brand small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 11px; font-weight: 500; }
.app-sidebar__role { margin: 12px 0 20px; color: var(--text-muted); font-size: 12px; }
.app-sidebar__role strong { margin-left: 6px; color: var(--brand); font-size: 11px; letter-spacing: .06em; }
.workspace-switcher select,
.dashboard-profile__switch { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.dashboard-profile { display: grid; gap: 10px; margin-top: auto; }
.dashboard-profile__switch { display: flex; align-items: center; justify-content: space-between; text-align: left; cursor: pointer; }
.dashboard-profile__role { color: var(--text-muted); font-size: 11px; font-weight: 700; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); font-size: 11px; text-align: center; }
.dashboard-notification { position: relative; }
.notification-count { position: absolute; top: -6px; right: -5px; min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 999px; background: #c94141; color: #fff; font-size: 10px; font-weight: 800; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.dashboard-metric-card { min-height: 152px; padding: 18px 20px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
.dashboard-metric-card__label { margin: 0; color: var(--text-muted); font-size: 13px; font-weight: 700; }
.dashboard-metric-card__value { margin: 10px 0 auto; font-size: 31px; letter-spacing: -.04em; line-height: 1; }
.dashboard-metric-card__value small { font-size: 13px; color: var(--text-muted); letter-spacing: 0; }
.dashboard-metric-card__footer { min-height: 30px; display: flex; align-items: end; justify-content: space-between; gap: 12px; color: var(--text-muted); font-size: 12px; }
.mini-trend { width: 112px; height: 32px; color: var(--brand); }
.metric-alert { padding: 3px 10px; border-radius: 999px; background: rgba(180, 57, 57, .08); color: #b53939; font-weight: 800; }
.dashboard-analytics-grid { display: grid; grid-template-columns: minmax(0, 2.05fr) minmax(320px, 1fr); gap: 16px; }
.dashboard-chart-card,
.dashboard-status-card,
.attention-card,
.workload-card,
.source-card,
.dashboard-summary-card { padding: 18px; }
.dashboard-section-header { min-height: 36px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dashboard-section-header h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.dashboard-section-header p { margin: 0; color: var(--text-muted); font-size: 12px; }
.dashboard-section-header a { color: var(--brand); font-size: 12px; font-weight: 800; text-decoration: none; }
.dashboard-section-header--compact { align-items: center; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--text-muted); font-size: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-marker { width: 18px; height: 2px; display: inline-block; background: var(--brand); }
.legend-marker--accepted { background: #246754; border-top: 1px dashed #246754; }
.dashboard-chart { margin: 10px 0 0; min-height: 330px; display: grid; align-items: center; overflow: hidden; }
.dashboard-chart svg { width: 100%; min-width: 640px; height: auto; }
.chart-grid line { stroke: var(--border); stroke-width: 1; }
.chart-axis-labels text { fill: var(--text-muted); font-size: 12px; }
.chart-area { fill: rgba(42, 86, 173, .08); }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line--opened { stroke: var(--brand); }
.chart-line--accepted { stroke: #246754; stroke-dasharray: 6 7; }
.dashboard-status-card { display: grid; align-content: start; }
.status-donut { width: 186px; aspect-ratio: 1; margin: 22px auto 20px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#3156b6 0 5%, #5043a3 5% 10%, #6a3eb4 10% 13%, #a25a12 13% 16%, #236783 16% 21%, #16694f 21% 75%, #4b5563 75% 100%); position: relative; }
.status-donut::before { content: ""; position: absolute; width: 68%; height: 68%; border-radius: 50%; background: var(--surface); }
.status-donut__center { position: relative; z-index: 1; display: grid; text-align: center; }
.status-donut__center strong { font-size: 32px; }
.status-donut__center span { color: var(--text-muted); font-size: 12px; }
.status-breakdown { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.status-breakdown li { display: flex; justify-content: space-between; gap: 16px; color: var(--text-muted); font-size: 13px; }
.status-breakdown li span { display: inline-flex; align-items: center; gap: 9px; }
.status-breakdown strong { color: var(--text); }
.status-dot { width: 10px; height: 10px; flex: 0 0 10px; display: inline-block; border-radius: 3px; background: var(--brand); }
.status-dot--new { background: var(--status-new); }.status-dot--assigned { background: var(--status-assigned); }.status-dot--paused { background: var(--status-progress); }.status-dot--returned { background: var(--status-returned); }.status-dot--review { background: var(--status-review); }.status-dot--accepted { background: var(--status-accepted); }.status-dot--closed { background: var(--status-closed); }.status-dot--warning { background: #a66a06; }.status-dot--danger { background: var(--status-danger); }
.dashboard-attention-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.attention-card { min-height: 250px; display: flex; flex-direction: column; }
.attention-card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.attention-card__header h2 { margin: 0; font-size: 16px; }
.attention-count { min-width: 26px; padding: 4px 8px; border-radius: 999px; font-size: 12px; text-align: center; }
.attention-count--info { color: #216786; background: rgba(33, 103, 134, .08); }.attention-count--warning { color: #9a6505; background: rgba(154, 101, 5, .08); }.attention-count--danger { color: #b53939; background: rgba(181, 57, 57, .08); }
.attention-list { list-style: none; padding: 0; margin: 10px 0 auto; }
.attention-task { min-height: 61px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border); border-radius: 8px; }
.attention-task:last-child { border-bottom: 0; }
.attention-task[data-task-id] { cursor: pointer; }
.attention-task[data-task-id]:hover, .attention-task[data-task-id]:focus-visible { background: var(--brand-soft); outline: none; padding-inline: 8px; margin-inline: -8px; }
.task-avatar,
.person-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; }
.task-avatar--purple,.person-avatar--purple { background: #5637ae; }.task-avatar--amber,.person-avatar--orange { background: #b45d05; }.task-avatar--orange { background: #b85c05; }.task-avatar--gold,.person-avatar--gold { background: #9b6505; }.task-avatar--unknown { background: #e4e8ec; color: #75808e; }.person-avatar--blue { background: #3156b6; }.person-avatar--brown { background: #823718; }.person-avatar--indigo { background: #4542a8; }
.attention-task__content { min-width: 0; }
.attention-task__content a { display: block; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 800; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.attention-task__content p { margin: 3px 0 0; overflow: hidden; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.attention-task time { color: var(--text-muted); font-size: 11px; font-weight: 800; white-space: nowrap; }.attention-task time.is-danger { color: #b53939; }.attention-task time.is-warning { color: #9a6505; }
.attention-card__link { margin-top: 10px; color: var(--brand); font-size: 13px; font-weight: 800; text-decoration: none; }
.dashboard-bottom-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .95fr); gap: 16px; }
.workload-list,
.source-list,
.quick-status-list { list-style: none; padding: 0; margin: 10px 0 0; }
.workload-list { display: grid; gap: 10px; }
.workload-list li { display: grid; grid-template-columns: 36px 185px minmax(100px, 1fr) 50px; align-items: center; gap: 10px; }
.workload-list strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.workload-list b { color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-align: right; }
.progress-track,.source-meter { height: 8px; overflow: hidden; border-radius: 999px; background: #e4e8ec; }.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.source-list { display: grid; gap: 12px; }
.source-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding-bottom: 11px; border-bottom: 1px solid var(--border); }
.source-list__label { display: inline-flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 14px; }.source-list__label i { color: var(--brand); font-style: normal; }
.source-list strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.source-meter { grid-column: 1 / -1; }.source-meter__fill { display: block; height: 100%; border-radius: inherit; }.source-meter__fill--blue { background: #3156b6; }.source-meter__fill--purple { background: #6a3eb4; }.source-meter__fill--orange { background: #a95a0a; }.source-meter__fill--green { background: #16694f; }
.source-card__footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }.source-card__footer strong { color: #16694f; }
.dashboard-extra-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.activity-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; }.activity-summary div { padding: 12px; border-radius: 12px; background: var(--surface-alt); }.activity-summary dt { color: var(--text-muted); font-size: 11px; }.activity-summary dd { margin: 7px 0 0; font-size: 20px; font-weight: 800; }
.quick-status-list { display: grid; gap: 0; }.quick-status-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }.quick-status-list li:last-child { border-bottom: 0; }.quick-status-list span { display: inline-flex; align-items: center; gap: 9px; color: var(--text-muted); }.quick-status-list strong { font-size: 12px; }

@media (max-width: 1320px) {
    .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-attention-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1080px) {
    .dashboard-analytics-grid,
    .dashboard-bottom-grid { grid-template-columns: 1fr; }
    .dashboard-status-card { grid-template-columns: 220px minmax(0, 1fr); align-items: center; }
    .dashboard-status-card .dashboard-section-header { grid-column: 1 / -1; }
    .status-donut { margin: 18px auto; }
}
@media (max-width: 780px) {
    .dashboard-content { padding: 18px; }
    .dashboard-metrics,
    .dashboard-attention-grid,
    .dashboard-extra-grid { grid-template-columns: 1fr; }
    .dashboard-status-card { grid-template-columns: 1fr; }
    .workload-list li { grid-template-columns: 36px minmax(0, 1fr) 1fr 45px; }
    .activity-summary { grid-template-columns: 1fr 1fr; }
    .app-header__actions { width: 100%; flex-wrap: wrap; }
    .global-search { flex: 1 1 100%; }
}
@media (max-width: 520px) {
    .dashboard-metric-card { min-height: 132px; }
    .attention-task { grid-template-columns: 34px minmax(0, 1fr); }
    .attention-task time { grid-column: 2; }
    .workload-list li { grid-template-columns: 34px minmax(0, 1fr) 45px; }
    .workload-list .progress-track { grid-column: 2 / -1; }
    .dashboard-chart { overflow-x: auto; }
}

/* ========================================
   Tasks Page — Full Workspace Upgrade
======================================== */
body[data-page="tasks"] {
    height: 100dvh;
    overflow: hidden;
}

body[data-page="tasks"] .app-layout {
    height: 100dvh;
    min-height: 0;
}

body[data-page="tasks"] .app-main {
    min-height: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body[data-page="tasks"] .app-sidebar {
    min-height: 0;
    overflow-y: auto;
}

.tasks-app-header {
    min-height: 78px;
    padding: 14px 28px;
    flex: 0 0 auto;
}

.tasks-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    /* Keep the app shell fixed, but allow the Tasks workspace to grow and scroll
       vertically when optional UI (such as the filter panel) is opened. */
    overflow-x: hidden;
    overflow-y: auto;
}

.tasks-page--workspace {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tasks-workspace-header {
    min-height: 58px;
    padding: 8px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-bottom: 1px solid var(--border);
}

.tasks-quick-tabs {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tasks-quick-tab,
.tasks-filter-trigger {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 13px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.tasks-quick-tab:hover,
.tasks-filter-trigger:hover {
    color: var(--brand);
    background: var(--brand-soft);
}

.tasks-quick-tab.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.tasks-filter-trigger {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.tasks-alert {
    min-height: 56px;
    margin: 14px 28px 0;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    border: 1px solid #ecd4a6;
    border-radius: 13px;
    background: linear-gradient(90deg, #fff8e7, #fffcf3);
    color: #956017;
    font-size: 13px;
    font-weight: 700;
}

.tasks-alert__icon { font-size: 16px; }

.tasks-alert__task {
    margin-left: auto;
    padding: 6px 10px;
    border: 1px solid #e7dcc7;
    border-radius: 9px;
    background: rgba(255,255,255,.7);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

.tasks-board-shell {
    /* The Kanban must never collapse when the optional filter panel is opened.
       The workspace can scroll vertically while the board keeps a professional
       full-height working area. */
    flex: 0 0 auto;
    height: calc(100dvh - 170px);
    min-height: 620px;
    position: relative;
    padding: 12px 28px 24px;
    overflow: hidden;
}

.tasks-view--kanban {
    /*
     * Cross-browser horizontal Kanban scrolling.
     *
     * Chrome/Safari on macOS can use overlay scrollbars, and Safari is more
     * sensitive to grid tracks using flexible 1fr sizing inside an overflow
     * container. Give the board explicit intrinsic column widths so its scroll
     * width is always calculated correctly.
     */
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(7, 292px);
    gap: 14px;

    /* Always create a horizontal scrolling context. */
    overflow-x: scroll;
    overflow-y: hidden;

    /* Keep room for the horizontal scrollbar where the browser supports it. */
    scrollbar-gutter: stable both-edges;

    /* Smooth native scrolling on Safari/iOS and trackpad devices. */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;

    padding: 0 0 12px;
    align-items: stretch;
    scroll-snap-type: x proximity;
    scroll-snap-stop: normal;
    scroll-behavior: smooth;

    /* Prevent Safari from treating the grid as shrinkable content. */
    min-width: 0;

    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--text-muted) 55%, transparent)
                     color-mix(in srgb, var(--surface-alt) 70%, transparent);
}

/* Chromium / Safari / WebKit horizontal scrollbar styling. */
.tasks-view--kanban::-webkit-scrollbar {
    height: 12px;
}

.tasks-view--kanban::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--surface-alt) 70%, transparent);
    border-radius: 999px;
}

.tasks-view--kanban::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 55%, transparent);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

.tasks-view--kanban::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    border: 3px solid transparent;
    background-clip: padding-box;
}

.kanban-column {
    width: 292px;
    min-width: 292px;
    max-width: 292px;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: color-mix(in srgb, var(--surface-alt) 86%, var(--surface));
    border: 1px solid var(--border);
    border-radius: 15px;
    scroll-snap-align: start;
}

.kanban-column__header {
    flex: 0 0 auto;
    padding: 11px 12px;
    border-bottom: 0;
    background: color-mix(in srgb, var(--surface) 65%, transparent);
}

.kanban-column__header > div {
    min-width: 0;
    gap: 8px;
}

.kanban-column__header h2 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0;
    white-space: nowrap;
}

.kanban-column__header small {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.kanban-column__count {
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.kanban-column__menu,
.task-card__menu {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}

.kanban-column__tasks {
    min-height: 0;
    flex: 1 1 auto;
    padding: 10px;
    display: grid;
    align-content: start;
    gap: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.kanban-column__empty {
    margin: 0;
    padding: 18px 14px;
}

.kanban-column__add {
    margin: 0 10px 10px;
    padding: 8px;
    flex: 0 0 auto;
    border: 1px dashed var(--border);
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface) 75%, transparent);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.kanban-column__add:hover { color: var(--brand); border-color: var(--brand); }

.task-card {
    gap: 11px;
    padding: 13px 13px 11px;
    border-radius: 12px;
    background: var(--surface);
}

.task-card[data-priority="CRITICAL"] { border-left: 3px solid var(--danger); }
.task-card[data-priority="HIGH"] { border-left: 3px solid var(--warning); }

.task-card__meta { min-height: 16px; }
.task-card__number { font-size: 10px; }
.task-card__title { font-size: 14px; line-height: 1.42; }
.task-card__labels:empty { display: none; }
.task-card__footer { padding-top: 0; border-top: 0; }
.task-card__person { display: inline-flex; align-items: center; gap: 7px; max-width: 65%; }
.task-card__footer time { white-space: nowrap; }
.task-card__footer time[data-deadline-state="overdue"] { color: var(--danger); font-weight: 800; }
.task-card__footer time[data-deadline-state="urgent"] { color: var(--warning); font-weight: 800; }

.task-card__progress {
    position: relative;
    height: 7px;
    overflow: visible;
    border-radius: 999px;
    background: #e8edf6;
}

.task-card__progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

/* ========================================
   Kanban drag & drop
======================================== */
.task-card[draggable="true"] { cursor: grab; }
.task-card.is-dragging { cursor: grabbing; opacity: .45; box-shadow: none; transform: scale(.98); }
.task-card.is-drop-valid { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.task-card.is-drop-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.task-card.is-drop-rejected { animation: task-card-reject .3s ease; }
.task-card.is-dropped { animation: task-card-drop-in .22s ease; }

@keyframes task-card-reject {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes task-card-drop-in {
    from { opacity: .4; transform: scale(.96); }
    to { opacity: 1; transform: scale(1); }
}

.kanban-column { transition: background-color .15s ease, border-color .15s ease; }
.kanban-column.is-drop-target { border-color: var(--success); background: color-mix(in srgb, var(--success-soft) 55%, var(--surface)); }
.kanban-column.is-drop-invalid { border-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface)); }

.task-card__progress small {
    position: absolute;
    right: 0;
    bottom: 9px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.avatar--sm {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    font-size: 9px;
}

.tasks-view--table {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.tasks-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.tasks-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.tasks-table td { white-space: nowrap; }

.table-person,
.detail-person {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.table-pagination {
    flex: 0 0 auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.table-pagination__summary {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.table-pagination__controls,
.table-pagination__pages { display: flex; align-items: center; gap: 5px; }

.pagination-button,
.pagination-page {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.pagination-button:disabled { opacity: .45; cursor: not-allowed; }
.pagination-page.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }

/* ========================================
   Task Detail Drawer
======================================== */
.task-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 48;
    background: rgba(19, 27, 41, .48);
    backdrop-filter: blur(2px);
}

.task-detail-panel {
    width: min(52vw, 860px);
    min-width: 680px;
    z-index: 50;
    box-shadow: -18px 0 45px rgba(16, 24, 40, .18);
}

.task-detail-panel__header {
    flex: 0 0 auto;
    padding: 22px 26px 14px;
    border-bottom: 0;
}

.task-detail-heading { min-width: 0; }
.task-detail-panel__number { display: flex; gap: 8px; margin-bottom: 8px; font-size: 11px; }
.task-detail-panel__header h2 { margin: 8px 0 0; max-width: 760px; font-size: 23px; line-height: 1.25; }
.task-detail-close { flex: 0 0 auto; font-size: 24px; }

.task-detail-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.confidence-badge { padding: 4px 9px; border-radius: 999px; background: #f2efff; color: #5b47a9; font-size: 11px; font-weight: 800; }

.task-status-line {
    position: relative;
    flex: 0 0 auto;
    padding: 10px 24px 18px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.task-status-line__track {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 25px;
    height: 2px;
    background: var(--border);
}

.task-status-line__steps {
    position: relative;
    z-index: 1;
    min-width: 700px;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(90px, 1fr));
    list-style: none;
}

.task-status-line__steps li {
    display: grid;
    justify-items: center;
    gap: 5px;
    color: var(--text-muted);
    text-align: center;
}

.task-status-line__dot {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: transparent;
    font-size: 12px;
    font-weight: 900;
}

.task-status-line__steps li strong { font-size: 11px; white-space: nowrap; }
.task-status-line__steps li time { color: var(--text-muted); font-size: 10px; }
.task-status-line__steps li.is-complete .task-status-line__dot { border-color: var(--success); background: var(--success); color: #fff; }
.task-status-line__steps li.is-complete { color: var(--text); }
.task-status-line__steps li.is-current .task-status-line__dot { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.task-status-line__steps li.is-current { color: var(--brand); }

.task-detail-tabs {
    flex: 0 0 auto;
    display: flex;
    gap: 4px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.task-detail-tab {
    position: relative;
    padding: 12px 10px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.task-detail-tab span { margin-left: 4px; color: var(--text-muted); }
.task-detail-tab.is-active { color: var(--brand); }
.task-detail-tab.is-active::after { content: ""; position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: var(--brand); }

.task-detail-panel__body {
    min-height: 0;
    flex: 1 1 auto;
    padding: 16px 20px 24px;
    overflow-y: auto;
    display: block;
}

.task-detail-tab-panel { min-height: 100%; }
.task-detail-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(255px, .85fr); gap: 14px; }
.task-detail-main-column,
.task-detail-side-column { display: grid; align-content: start; gap: 14px; }

.task-detail-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.task-detail-card header { display: flex; align-items: center; gap: 9px; }
.task-detail-card h3 { margin: 0; font-size: 14px; }
.task-detail-card p { margin: 12px 0 0; line-height: 1.65; color: var(--text-muted); }

.task-source-card header .text-action { margin-left: auto; padding: 0; border: 0; background: transparent; color: var(--brand); font-size: 12px; font-weight: 700; }
.source-kind { padding: 4px 8px; border-radius: 999px; background: #f2efff; color: #5b47a9; font-size: 10px; font-weight: 800; }
.task-source-card blockquote { margin: 12px 0; padding: 4px 0 4px 12px; border-left: 2px solid var(--border); color: var(--text); font-size: 13px; line-height: 1.6; }
.source-meta { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.source-meta time { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.source-meta strong { color: var(--success); }

.task-detail-description-card p { color: var(--text); }
.checklist-card > header { justify-content: space-between; }
.checklist-list { display: grid; gap: 7px; margin-top: 12px; }
.checklist-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; font-size: 12px; }
.checklist-item input { accent-color: var(--brand); }
.checklist-empty { padding: 18px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
.checklist-add { display: flex; gap: 8px; margin-top: 10px; }
.checklist-add input { flex: 1; min-width: 0; min-height: 40px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-alt); color: var(--text); }

.deadline-card {
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    border-radius: 13px;
    background: var(--surface-alt);
    color: var(--text-muted);
}

.deadline-card__icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.deadline-card p { margin: 0; font-size: 12px; }
.deadline-card strong { display: block; margin-top: 4px; color: var(--text); font-size: 12px; }
.deadline-card__button { grid-column: 1 / -1; width: 100%; margin-top: 3px; padding: 8px 10px; }
.deadline-card[data-deadline-state="safe"] { background: var(--success-soft); }
.deadline-card[data-deadline-state="warning"] { background: var(--warning-soft); }
.deadline-card[data-deadline-state="urgent"] { background: color-mix(in srgb, var(--warning-soft) 55%, var(--danger-soft) 45%); }
.deadline-card[data-deadline-state="overdue"] { background: var(--danger-soft); }
.deadline-card[data-deadline-state="complete"] { background: var(--brand-soft); }

.task-detail-list--compact { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.task-detail-list--compact div { grid-template-columns: 94px 1fr; padding: 11px 12px; background: var(--surface); }
.task-detail-list--compact dd { min-width: 0; text-align: right; }
.task-detail-actions { display: grid; gap: 8px; }
.task-detail-actions .btn { width: 100%; }
.btn--danger { border-color: #efb7b7; background: transparent; color: var(--danger); }

.task-chain-card { min-height: 280px; }
.task-chain-node { margin-top: 18px; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; border: 1px solid var(--brand); border-radius: 11px; background: var(--brand-soft); }
.task-chain-node small { grid-column: 2; color: var(--text-muted); }

.comments-card,
.history-card { min-height: 300px; }
.comments-card > header,
.history-card > header { justify-content: space-between; }
.comments-empty { padding: 40px 0; text-align: center; }
.comment-composer { display: grid; gap: 9px; margin-top: 16px; }
.comment-composer textarea { min-height: 88px; resize: vertical; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); color: var(--text); }
.comment-composer .btn { justify-self: end; }
.history-list { margin: 18px 0 0; padding: 0; display: grid; gap: 16px; list-style: none; }
.history-item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; }
.history-item__dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.history-item strong { font-size: 12px; }
.history-item p { margin: 4px 0; font-size: 12px; }
.history-item time { color: var(--text-muted); font-size: 10px; }

body.has-task-detail .tasks-board-shell { pointer-events: none; }

/* ========================================
   Tasks Responsive Workspace
======================================== */
@media (max-width: 1200px) {
    .tasks-workspace-header { padding-inline: 18px; }
    .tasks-alert { margin-inline: 18px; }
    .tasks-board-shell { padding-inline: 18px; }
    .task-detail-panel { width: min(760px, 70vw); min-width: 600px; }
    .task-detail-layout { grid-template-columns: 1fr; }
    .task-detail-side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .deadline-card { grid-column: 1 / -1; }
    .task-detail-actions { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    body[data-page="tasks"],
    body[data-page="tasks"] .app-layout,
    body[data-page="tasks"] .app-main { height: auto; min-height: 100dvh; overflow: visible; }
    .tasks-content { overflow-x: hidden; overflow-y: visible; }
    .tasks-page--workspace { min-height: calc(100dvh - 150px); }
    .tasks-workspace-header { align-items: stretch; flex-direction: column; }
    .tasks-board-shell { height: auto; min-height: 68dvh; }
    .tasks-view--kanban { min-height: 68dvh; height: 68dvh; }
    .task-detail-panel { width: min(760px, 94vw); min-width: 0; }
    .task-detail-side-column { grid-template-columns: 1fr; }
    .deadline-card,
    .task-detail-actions { grid-column: auto; }
    .task-detail-actions { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .tasks-app-header { padding: 12px 14px; }
    .tasks-app-header .app-header__actions { gap: 7px; }
    .tasks-new-button { padding-inline: 10px; }
    .tasks-workspace-header { padding: 8px 12px; }
    .tasks-alert { margin: 8px 12px 0; min-height: 48px; padding: 0 10px; }
    .tasks-alert__task { display: none; }
    .tasks-board-shell { padding: 8px 12px 16px; }
    .tasks-view--kanban { grid-template-columns: repeat(5, minmax(272px, 82vw)); }
    .kanban-column { min-width: 272px; }
    .task-detail-panel { width: 100vw; min-width: 0; }
    .task-detail-panel__header { padding: 18px 16px 12px; }
    .task-status-line { padding-inline: 12px; }
    .task-detail-tabs { overflow-x: auto; padding-inline: 10px; }
    .task-detail-panel__body { padding: 12px; }
    .source-meta { grid-template-columns: auto 1fr; }
    .source-meta time,
    .source-meta span:last-child { grid-column: 2; }
    .table-pagination { flex-direction: column; align-items: flex-start; }
}

/* ========================================
   People registry
======================================== */
.sidebar-workspace { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); font-weight: 700; }
.sidebar-role { margin: -10px 0 4px; color: var(--text-muted); font-size: 12px; }
.sidebar-role strong { margin-left: 6px; color: var(--brand); font-size: 11px; letter-spacing: .06em; }
.nav-count { margin-left: auto; min-width: 22px; padding: 3px 7px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; text-align: center; }
.notification-button { position: relative; }
.notification-button b { position: absolute; top: -8px; right: -8px; min-width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px; }
.people-page { max-width: 100%; gap: 18px; }
.people-page__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.people-page__header h2 { margin: 0 0 6px; }
.people-page__header .muted { margin: 0; }
.people-page__actions { display: flex; align-items: end; gap: 10px; }
.field--inline { min-width: min(320px, 35vw); }
.people-select { min-height: 42px; min-width: 180px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.people-alert { min-height: 80px; padding: 16px 18px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-color: #f0b6b0; background: color-mix(in srgb, var(--danger-soft) 60%, var(--surface)); }
.people-alert__icon { color: var(--danger); font-size: 18px; }
.people-alert strong { font-size: 13px; color: #b53939; }
.people-alert p { margin: 5px 0 0; color: #b5544f; font-size: 12px; }
.people-table-card { overflow: hidden; }
.people-table-wrap { overflow-x: auto; }
.people-table { width: 100%; min-width: 1080px; border-collapse: collapse; }
.people-table th { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.people-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.people-table tbody tr:last-child td { border-bottom: 0; }
.people-table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.person-row__profile { display: flex; align-items: center; gap: 11px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; }
.person-row__identity { display: grid; gap: 4px; }
.person-row__identity strong { font-size: 13px; }
.person-row__identity small { max-width: 280px; overflow: hidden; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.person-table .person-avatar, .people-table .person-avatar { width: 36px; height: 36px; }
.people-table code { color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.person-aliases, .person-groups { display: flex; flex-wrap: wrap; gap: 5px; max-width: 260px; }
.alias-chip, .group-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.group-chip { color: var(--brand); background: var(--brand-soft); }
.person-status { display: inline-flex; align-items: center; gap: 6px; color: #246754; font-size: 12px; }
.person-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.person-status.is-pending { color: var(--warning); }.person-status.is-pending::before { background: var(--warning); }
.person-status[data-status="inactive"] { color: var(--warning); }
.person-status[data-status="inactive"]::before { background: var(--warning); }
.person-status[data-status="blocked"] { color: var(--danger); }
.person-status[data-status="blocked"]::before { background: var(--danger); }
.person-status[data-status="deleted"] { color: var(--text-muted); }
.person-status[data-status="deleted"]::before { background: var(--text-muted); }
.person-row--deleted { opacity: .6; }
.table-icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font-size: 18px; }
.table-icon-button:hover { background: var(--brand-soft); color: var(--brand); }
.people-table-footer { min-height: 68px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border); }
.people-table-footer p { margin: 0; font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination__button { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-muted); font-size: 12px; font-weight: 800; }
.pagination__button:hover, .pagination__button.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }

/* ========================================
   Person profile modal
======================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 28px;
    display: grid;
    place-items: center;
    background: rgba(28, 36, 50, .46);
    backdrop-filter: blur(7px);
}

.person-profile-modal {
    width: min(1000px, calc(100vw - 56px));
    max-height: calc(100vh - 112px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .3);
}

.person-profile-modal--compact { width: min(480px, calc(100vw - 56px)); }

.person-profile-modal__header,
.person-profile-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.person-profile-modal__header h2 {
    margin: 0;
    font-size: 19px;
}

.person-profile-modal__body {
    padding: 24px 22px 20px;
    overflow: auto;
}

.person-profile-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
}

.person-avatar--profile {
    width: 72px !important;
    height: 72px !important;
    flex: 0 0 72px !important;
    font-size: 28px;
}

.person-profile-hero__identity { min-width: 0; }
.person-profile-hero__title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.person-profile-hero h3 { margin: 0; font-size: 23px; line-height: 1.15; }
.person-profile-hero p { margin: 5px 0 0; color: var(--text-muted); font-size: 14px; }
.profile-status-chip,
.profile-score-chip {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 11px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--success-soft) 78%, var(--surface));
    color: #2b715c;
    font-size: 11px;
    font-weight: 800;
}

.person-profile-section { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.person-profile-section h3 { margin: 0; font-size: 17px; }
.person-profile-section__heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.person-profile-section__heading p { margin: 0 0 12px; color: var(--text-muted); font-size: 13px; }

.person-profile-groups-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.person-profile-groups-card__head,
.person-profile-group-row {
    display: grid;
    grid-template-columns: 1.3fr 1.9fr .55fr .9fr;
    align-items: center;
    gap: 18px;
}

.person-profile-groups-card__head {
    min-height: 39px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.person-profile-group-row { padding: 12px 16px; }
.person-profile-group-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person-profile-group-name .status-dot { width: 8px; height: 8px; flex: 0 0 8px; }
.person-profile-group-name strong { display: block; font-size: 14px; }
.person-profile-group-name small { display: block; margin-top: 2px; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.person-profile-role-list { display: flex; gap: 3px; padding: 4px; width: max-content; max-width: 100%; border-radius: 14px; background: var(--surface-alt); }
.person-profile-role { padding: 8px 12px; border-radius: 10px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.person-profile-role.is-active { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); font-weight: 700; }
.person-profile-group-count { font-size: 15px; text-align: center; }
.person-profile-group-timeliness { display: flex; align-items: center; gap: 10px; }
.person-profile-group-timeliness b { min-width: 36px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.person-profile-timeliness-bar,
.profile-score-bar,
.profile-mini-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4e8ef;
}
.person-profile-timeliness-bar { flex: 1; }
.person-profile-timeliness-bar span,
.profile-score-bar span,
.profile-mini-bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.person-profile-timeliness-bar span { background: #b55a0a; }
.person-profile-note { margin: 8px 0 18px; color: var(--text-muted); font-size: 12px; }

.person-profile-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.person-profile-details { margin: 0; }
.person-profile-details > div {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 12px;
    min-height: 39px;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.person-profile-details dt { color: var(--text-muted); font-size: 13px; }
.person-profile-details dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.person-profile-alias-block { padding-top: 12px; }
.person-profile-alias-block > span { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 13px; }
.person-profile-aliases { display: flex; flex-wrap: wrap; gap: 7px; }

.person-profile-score__summary { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.person-profile-score__summary strong { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 43px; line-height: 1; }
.person-profile-score__summary span:not(.profile-score-chip) { color: var(--text-muted); font-size: 12px; }
.profile-score-bar { height: 9px; margin-bottom: 18px; }
.profile-score-breakdown > div {
    display: grid;
    grid-template-columns: 1.55fr minmax(90px, 1fr) 68px;
    align-items: center;
    gap: 14px;
    min-height: 35px;
    border-bottom: 1px solid var(--border);
}
.profile-score-breakdown span { color: var(--text-muted); font-size: 13px; }
.profile-score-breakdown b { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.person-profile-score__note { margin: 12px 0 0; color: var(--text-muted); font-size: 12px; }

.person-profile-modal__footer {
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border);
    border-bottom: 0;
    background: var(--surface-alt);
}

.modal-close {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 25px;
    line-height: 1;
}
.modal-close:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

body.is-modal-open { overflow: hidden; }

@media (max-width: 820px) {
    .person-profile-modal { width: min(100%, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
    .person-profile-columns { grid-template-columns: 1fr; }
    .person-profile-groups-card { overflow-x: auto; }
    .person-profile-groups-card__head, .person-profile-group-row { min-width: 760px; }
}

@media (max-width: 560px) {
    .modal-backdrop { padding: 0; }
    .person-profile-modal { width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; }
    .person-profile-modal__header, .person-profile-modal__footer { padding: 16px; }
    .person-profile-modal__body { padding: 18px 16px; }
    .person-profile-hero { align-items: flex-start; }
    .person-avatar--profile { width: 58px !important; height: 58px !important; flex-basis: 58px !important; font-size: 22px; }
    .person-profile-hero h3 { font-size: 19px; }
    .person-profile-details > div { grid-template-columns: 1fr; gap: 3px; padding: 8px 0; }
    .profile-score-breakdown > div { grid-template-columns: 1fr 90px 56px; gap: 8px; }
}

@media (max-width: 900px) {
    .people-page__header { align-items: stretch; flex-direction: column; }
    .people-page__actions { width: 100%; }
    .field--inline { flex: 1; min-width: 0; }
}
@media (max-width: 620px) {
    .people-alert { grid-template-columns: 24px minmax(0, 1fr); }
    .people-alert .btn { grid-column: 2; justify-self: start; }
    .people-page__actions { flex-direction: column; align-items: stretch; }
    .people-select { width: 100%; }
    .people-table-footer { align-items: flex-start; flex-direction: column; }
    .person-edit-grid { grid-template-columns: 1fr; }
    .person-edit-grid__full { grid-column: auto; }
    .modal-backdrop { padding: 12px; }
    .person-modal__header, .person-edit-summary, .person-edit-grid, .person-modal__footer { padding-left: 16px; padding-right: 16px; }
}

/* ========================================
   Login page
======================================== */
.login-body {
    min-width: 320px;
    min-height: 100vh;
    overflow: auto;
    background: #eef1f5;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 31.25%) minmax(0, 1fr);
}

.login-brand-panel {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 52px 44px 18px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(52, 77, 159, .98), rgba(44, 66, 140, .98)),
        #304995;
}

.login-brand-panel__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-panel__mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .08);
    font-size: 17px;
    font-weight: 800;
}

.login-brand-panel__brand strong,
.login-brand-panel__brand span:not(.login-brand-panel__mark) {
    display: block;
}

.login-brand-panel__brand strong { font-size: 17px; }
.login-brand-panel__brand div span { margin-top: 3px; color: rgba(255, 255, 255, .72); font-size: 12px; }

.login-brand-panel__content {
    align-self: center;
    max-width: 390px;
    padding-bottom: 18px;
}

.login-brand-panel__content h1 {
    margin: 0;
    font-size: clamp(34px, 3vw, 44px);
    line-height: 1.18;
    letter-spacing: -.035em;
}

.login-brand-panel__content p {
    max-width: 430px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, .72);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.65;
}

.login-brand-panel__footer {
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    font-weight: 600;
}

.login-content {
    display: grid;
    place-items: center;
    padding: 42px 24px;
    background: linear-gradient(90deg, #f4f5f7 0%, #fbfcfd 100%);
}

.login-card-wrap {
    width: min(100%, 445px);
    transform: translateY(-4px);
}

.login-heading { margin-bottom: 20px; }
.login-heading h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.login-heading p { margin: 5px 0 0; color: var(--text-muted); font-size: 14px; }

.login-telegram-card {
    display: grid;
    justify-items: center;
    padding: 25px 30px 23px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .7);
    box-shadow: var(--shadow-sm);
}

.login-qr-art::before { top: 16px; left: 16px; }
.login-qr-art::after { right: 16px; top: 16px; }
.login-qr-art span {
    position: relative;
    z-index: 1;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--brand);
    box-shadow: 0 0 0 8px rgba(255, 255, 255, .92);
}

.login-telegram-card__title { margin: 15px 0 3px; font-size: 14px; font-weight: 800; }
.login-telegram-card__text { margin: 0; color: var(--text-muted); font-size: 13px; text-align: center; }
.login-telegram-card__text strong { color: var(--brand); }
.login-telegram-card__status {
    margin-top: 13px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    font-weight: 800;
}

.login-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 21px 0;
    color: var(--text-muted);
    font-size: 12px;
}
.login-divider::before,
.login-divider::after { content: ""; height: 1px; background: var(--border); }

.login-form { display: grid; gap: 11px; }
.login-field { display: grid; gap: 6px; }
.login-field span { color: var(--text); font-size: 12px; font-weight: 700; }
.login-field input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: 0;
    background: rgba(255, 255, 255, .76);
    color: var(--text);
    font: inherit;
}
.login-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.login-security-note {
    margin: 1px 0 3px;
    padding: 13px 15px;
    border: 1px solid #e8cb91;
    border-radius: 11px;
    background: #fff8e9;
    color: #996124;
    font-size: 12px;
    line-height: 1.45;
}

.login-submit {
    min-height: 46px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}
.login-submit:hover { filter: brightness(.96); }
.login-demo-note { margin: 1px 0 0; color: var(--text-muted); text-align: center; font-size: 12px; }

/* ========================================
   Security page — three-card layout
======================================== */
.security-page { max-width: 1440px; margin: 0 auto; }
.security-page__header { align-items: flex-start; }
.alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}
.alert ul { margin: 0; padding-left: 18px; font-weight: 500; }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.form-error-list {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}
.form-error-list ul { margin: 0; padding-left: 16px; font-weight: 500; }
.security-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}
.security-card {
    min-width: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.security-card__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.security-card__icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 18px;
    font-weight: 800;
}
.security-card__header h3 { margin: 0; font-size: 16px; }
.security-card__header p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.security-card .settings-form { margin-top: 18px; }
.security-card .settings-form .btn { width: 100%; margin-top: 2px; }

.security-logs-list,
.sessions-list { display: grid; margin-top: 8px; }
.security-log-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}
.security-log-item__marker {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}
.security-log-item__main { min-width: 0; }
.security-log-item strong,
.security-log-item span:not(.security-log-item__marker) { display: block; }
.security-log-item strong { font-size: 12px; line-height: 1.35; }
.security-log-item__main span { margin-top: 3px; color: var(--text-muted); font-size: 11px; line-height: 1.45; }
.security-log-item time { grid-column: 2; color: var(--text-muted); font-size: 10px; }
.security-card__link {
    margin-top: auto;
    padding-top: 14px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.session {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 11px;
    padding: 14px 0;
}
.session:last-child { border-bottom: 0; }
.session__main { min-width: 0; }
.session__title-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.session__current {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 9px;
    font-weight: 800;
}
.btn--danger { width: 100%; margin-top: 9px; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
.btn--danger:hover { color: var(--danger); border-color: var(--danger); }

@media (max-width: 1180px) {
    .security-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .security-card--sessions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .security-cards { grid-template-columns: 1fr; }
    .security-card--sessions { grid-column: auto; }
    .login-layout { grid-template-columns: 1fr; }
    .login-brand-panel { min-height: auto; padding: 28px 24px; }
    .login-brand-panel__content { padding: 56px 0; }
    .login-brand-panel__content h1 { font-size: 34px; }
    .login-brand-panel__footer { display: none; }
    .login-content { padding: 36px 18px; }
    .login-card-wrap { transform: none; }
}

@media (max-width: 420px) {
    .login-qr-art { width: 190px; }
    .login-brand-panel__content { padding: 42px 0; }
    .security-card { padding: 16px; }
}

/* ========================================
   Shared navigation, notification center & theme
======================================== */
.app-brand > span:last-child { display: grid; gap: 3px; }
.app-brand small { color: var(--text-muted); font-size: 11px; font-weight: 500; }
.workspace-switcher { display: block; }
.workspace-switcher select { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-alt); color: var(--text); font-weight: 700; }
.dashboard-profile { align-items: stretch; display: grid; gap: 8px; }
.dashboard-profile .app-sidebar__caption { display: block; margin: 0; }
.dashboard-profile__switch { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-alt); color: var(--text); text-align: left; }
.dashboard-profile__role { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 999px; background: var(--surface-alt); color: var(--text-muted); font-size: 10px; font-weight: 700; }
.sidebar-utility-actions { display: flex; gap: 8px; }
.sidebar-theme-toggle, .sidebar-logout { min-height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-alt); color: var(--text-muted); font-size: 11px; font-weight: 700; }
.sidebar-theme-toggle { flex: 1; }
.sidebar-logout { width: 38px; display: grid; place-items: center; text-decoration: none; }
.notification-trigger { position: relative; display: inline-grid; place-items: center; }
.notification-count { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; border: 2px solid var(--surface); }
.app-main { position: relative; }
.notification-card { position: absolute; z-index: 90; top: 72px; right: 24px; width: min(390px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: var(--shadow-lg); backdrop-filter: blur(18px); }
.notification-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 17px 18px 14px; border-bottom: 1px solid var(--border); }
.notification-card__header .eyebrow { margin-bottom: 4px; }
.notification-card__header h2 { margin: 0; font-size: 16px; }
.notification-card__clear { border: 0; background: transparent; color: var(--brand); font-size: 11px; font-weight: 800; }
.notification-card__list { max-height: min(58vh, 520px); overflow-y: auto; }
.notification-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notification-item[data-notification-read="true"] { opacity: .62; }
.notification-item__indicator { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.notification-item[data-notification-read="true"] .notification-item__indicator { background: var(--text-muted); box-shadow: none; }
.notification-item__content { min-width: 0; }
.notification-item__content strong { display: block; font-size: 12px; line-height: 1.4; }
.notification-item__content p { margin: 3px 0 5px; color: var(--text-muted); font-size: 11px; line-height: 1.45; }
.notification-item__content time { color: var(--text-muted); font-size: 10px; }
.notification-item__dismiss { width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 17px; }
.notification-item__dismiss:hover { background: var(--surface-alt); color: var(--danger); }
.notification-card__footer { padding: 12px 16px; background: var(--surface-alt); }
.notification-card__footer a { font-size: 11px; font-weight: 800; text-decoration: none; }

/* Dark theme hardening */
:root[data-theme="dark"] .app-header { background: color-mix(in srgb, var(--surface) 92%, transparent); }
:root[data-theme="dark"] .login-field input { background: var(--surface-alt); }
:root[data-theme="dark"] .login-security-note { background: var(--warning-soft); color: #e8bf79; border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
:root[data-theme="dark"] .login-qr-art { background-color: var(--surface); border-color: var(--border); }
:root[data-theme="dark"] .login-qr-art::before,
:root[data-theme="dark"] .login-qr-art::after { background: var(--surface); }
:root[data-theme="dark"] .login-qr-art span { box-shadow: 0 0 0 8px color-mix(in srgb, var(--surface) 92%, transparent); }

/* Login theme control */
.login-body { position: relative; }
.login-theme-toggle { position: fixed; z-index: 20; top: 18px; right: 22px; min-height: 38px; padding: 0 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(12px); font-size: 11px; font-weight: 800; }
:root[data-theme="dark"] .login-theme-toggle { border-color: var(--border); background: var(--surface); color: var(--text); }

.login-field-error {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 6px 0 0;
    padding: 9px 12px;

    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;

    color: #b42318;
    background: #fef3f2;

    border: 1px solid #fecdca;
    border-radius: 8px;
}

.login-field-error::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 16px;
    width: 16px;
    height: 16px;

    font-size: 11px;
    font-weight: 700;

    color: #fff;
    background: #d92d20;
    border-radius: 50%;
}

@media (max-width: 760px) {
    .notification-card { position: fixed; top: 68px; right: 16px; left: 16px; width: auto; }
    .sidebar-utility-actions { display: none; }
    .app-header__actions .theme-trigger { display: inline-grid; }
    .login-theme-toggle { top: 12px; right: 12px; }
}


/* =========================================================
   LOGIN PAGE — NIGHT THEME
   ========================================================= */

/*
|--------------------------------------------------------------------------
| Theme transition
|--------------------------------------------------------------------------
*/

.login-body,
.login-brand-panel,
.login-content,
.login-theme-toggle,
.login-field input,
.login-submit,
.login-telegram-card,
.login-divider::before,
.login-divider::after {
    transition:
        background-color 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}


/*
|--------------------------------------------------------------------------
| Light theme defaults
|--------------------------------------------------------------------------
*/

.login-body {
    background: #f6f7fb;
    color: #172033;
}

.login-content {
    background: #ffffff;
}

.login-theme-toggle {
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.login-theme-toggle:hover {
    background: #f8fafc;
}

.login-heading h2 {
    color: #172033;
}

.login-heading p {
    color: #64748b;
}

.login-telegram-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

.login-telegram-card__title {
    color: #172033;
}

.login-telegram-card__text {
    color: #64748b;
}

.login-telegram-card__status {
    color: #64748b;
}

.login-divider {
    color: #94a3b8;
}

.login-divider::before,
.login-divider::after {
    background: #e2e8f0;
}

.login-field > span {
    color: #334155;
}

.login-field input {
    background: #ffffff;
    color: #172033;
    border-color: #dbe1ea;
}

.login-field input::placeholder {
    color: #94a3b8;
}

.login-field input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}


/*
|--------------------------------------------------------------------------
| Dark / night theme
|--------------------------------------------------------------------------
|
| IMPORTANT:
| This supports both common theme implementations:
|
| <html data-theme="dark">
| <body data-theme="dark">
| <body class="dark">
|
*/

/* Main page */

html[data-theme="dark"] .login-body,
body[data-theme="dark"].login-body,
body.dark.login-body,
[data-theme="dark"] .login-body {
    background: #0f172a;
    color: #e2e8f0;
}


/* Right side login area */

html[data-theme="dark"] .login-content,
body[data-theme="dark"] .login-content,
body.dark .login-content,
[data-theme="dark"] .login-content {
    background: #111827;
}


/* Theme button */

html[data-theme="dark"] .login-theme-toggle,
body[data-theme="dark"] .login-theme-toggle,
body.dark .login-theme-toggle,
[data-theme="dark"] .login-theme-toggle {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

html[data-theme="dark"] .login-theme-toggle:hover,
body[data-theme="dark"] .login-theme-toggle:hover,
body.dark .login-theme-toggle:hover,
[data-theme="dark"] .login-theme-toggle:hover {
    background: #273449;
}


/* Login heading */

html[data-theme="dark"] .login-heading h2,
body[data-theme="dark"] .login-heading h2,
body.dark .login-heading h2,
[data-theme="dark"] .login-heading h2 {
    color: #f8fafc;
}

html[data-theme="dark"] .login-heading p,
body[data-theme="dark"] .login-heading p,
body.dark .login-heading p,
[data-theme="dark"] .login-heading p {
    color: #94a3b8;
}


/* Telegram QR card */

html[data-theme="dark"] .login-telegram-card,
body[data-theme="dark"] .login-telegram-card,
body.dark .login-telegram-card,
[data-theme="dark"] .login-telegram-card {
    background: #172033;
    border-color: #334155;
}

html[data-theme="dark"] .login-telegram-card__title,
body[data-theme="dark"] .login-telegram-card__title,
body.dark .login-telegram-card__title,
[data-theme="dark"] .login-telegram-card__title {
    color: #f1f5f9;
}

html[data-theme="dark"] .login-telegram-card__text,
html[data-theme="dark"] .login-telegram-card__status,
body[data-theme="dark"] .login-telegram-card__text,
body[data-theme="dark"] .login-telegram-card__status,
body.dark .login-telegram-card__text,
body.dark .login-telegram-card__status,
[data-theme="dark"] .login-telegram-card__text,
[data-theme="dark"] .login-telegram-card__status {
    color: #94a3b8;
}


/* Divider */

html[data-theme="dark"] .login-divider,
body[data-theme="dark"] .login-divider,
body.dark .login-divider,
[data-theme="dark"] .login-divider {
    color: #64748b;
}

html[data-theme="dark"] .login-divider::before,
html[data-theme="dark"] .login-divider::after,
body[data-theme="dark"] .login-divider::before,
body[data-theme="dark"] .login-divider::after,
body.dark .login-divider::before,
body.dark .login-divider::after,
[data-theme="dark"] .login-divider::before,
[data-theme="dark"] .login-divider::after {
    background: #334155;
}


/* Form labels */

html[data-theme="dark"] .login-field > span,
body[data-theme="dark"] .login-field > span,
body.dark .login-field > span,
[data-theme="dark"] .login-field > span {
    color: #cbd5e1;
}


/* Inputs */

html[data-theme="dark"] .login-field input,
body[data-theme="dark"] .login-field input,
body.dark .login-field input,
[data-theme="dark"] .login-field input {
    background: #0f172a;
    color: #f8fafc;
    border-color: #334155;
}

html[data-theme="dark"] .login-field input::placeholder,
body[data-theme="dark"] .login-field input::placeholder,
body.dark .login-field input::placeholder,
[data-theme="dark"] .login-field input::placeholder {
    color: #64748b;
}

html[data-theme="dark"] .login-field input:focus,
body[data-theme="dark"] .login-field input:focus,
body.dark .login-field input:focus,
[data-theme="dark"] .login-field input:focus {
    background: #111827;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14);
}


/* Error text */

html[data-theme="dark"] .login-field-error,
body[data-theme="dark"] .login-field-error,
body.dark .login-field-error,
[data-theme="dark"] .login-field-error {
    color: #f87171;
}


/*
|--------------------------------------------------------------------------
| QR image area
|--------------------------------------------------------------------------
*/

html[data-theme="dark"] .login-qr-art,
body[data-theme="dark"] .login-qr-art,
body.dark .login-qr-art,
[data-theme="dark"] .login-qr-art {
    background: #ffffff;
}


/*
|--------------------------------------------------------------------------
| Security note
|--------------------------------------------------------------------------
*/

html[data-theme="dark"] .login-security-note,
body[data-theme="dark"] .login-security-note,
body.dark .login-security-note,
[data-theme="dark"] .login-security-note {
    color: #94a3b8;
}


/*
|--------------------------------------------------------------------------
| Mobile
|--------------------------------------------------------------------------
*/

@media (max-width: 900px) {

    html[data-theme="dark"] .login-content,
    body[data-theme="dark"] .login-content,
    body.dark .login-content,
    [data-theme="dark"] .login-content {
        background: #111827;
    }

}
/* ========================================
   Staff profile
======================================== */
.person-row__profile--link { text-decoration: none; }
.person-row__profile--link:hover strong { color: var(--brand); }
.person-row__profile--link:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 10px; }
.people-page__header h2, .staff-profile-hero h2, .tasks-workspace-header h2 { font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.staff-profile-content { max-width: 100%; }
.staff-profile-hero { position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 28px 30px; background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--brand-soft) 72%, var(--surface))); }
.staff-profile-hero::after { content: ""; position: absolute; width: 240px; height: 240px; right: -90px; top: -130px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 13%, transparent); pointer-events: none; }
.staff-profile-hero__identity, .staff-profile-hero__meta { position: relative; z-index: 1; }
.staff-profile-back { display: inline-flex; margin-bottom: 22px; color: var(--text-muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.staff-profile-back:hover { color: var(--brand); }
.staff-profile-hero__person { display: flex; align-items: center; gap: 18px; }
.staff-profile-avatar { width: 76px !important; height: 76px !important; font-size: 23px !important; box-shadow: 0 12px 30px color-mix(in srgb, var(--brand) 22%, transparent); }
.staff-profile-kicker { margin-bottom: 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.staff-profile-hero h2 { margin: 0 0 7px; font-size: clamp(26px, 3vw, 36px); }
.staff-profile-hero p { margin: 0; color: var(--text-muted); }
.staff-profile-hero__meta { display: flex; gap: 10px; }
.staff-profile-hero__meta > div { min-width: 132px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); }
.staff-profile-hero__meta span, .staff-info-card__label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.staff-profile-hero__meta strong { font-size: 18px; }
.staff-profile-status { color: var(--success); }
.staff-profile-status[data-status="inactive"] { color: var(--warning); }
.staff-profile-status[data-status="blocked"] { color: var(--danger); }
.staff-profile-status[data-status="deleted"] { color: var(--text-muted); }
.staff-profile-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.staff-info-card { min-height: 120px; padding: 20px; display: flex; flex-direction: column; justify-content: center; }
.staff-info-card strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.staff-info-card small { margin-top: 7px; color: var(--text-muted); font-size: 11px; }
.staff-profile-content .tasks-page { margin-top: 24px; }
@media (max-width: 900px) { .staff-profile-hero { align-items: flex-start; flex-direction: column; } .staff-profile-info-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .staff-profile-hero { padding: 22px 18px; } .staff-profile-hero__meta { width: 100%; } .staff-profile-hero__meta > div { flex: 1; min-width: 0; } .staff-profile-hero__person { align-items: flex-start; } }


/* Staff detail tasks workspace */
.staff-tasks-workspace { width: 100%; margin-top: 24px; }
.staff-tasks-workspace .tasks-filters { width: auto; margin: 12px 0 0; }
.staff-tasks-workspace .tasks-board-shell { width: 100%; padding-left: 0; padding-right: 0; }
.staff-tasks-heading-card { display: flex; align-items: center; gap: 16px; padding: 22px 24px; border-radius: 18px; position: relative; overflow: hidden; }
.staff-tasks-heading-card::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; right: -60px; top: -100px; background: color-mix(in srgb, var(--brand) 10%, transparent); pointer-events: none; }
.staff-tasks-heading-card__icon { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-size: 21px; font-weight: 800; }
.staff-tasks-heading-card__content { min-width: 0; position: relative; z-index: 1; }
.staff-tasks-heading-card__eyebrow { display: block; margin-bottom: 5px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.staff-tasks-heading-card h2 { margin: 0 0 5px; font-size: 24px; font-weight: 800; letter-spacing: -.035em; }
.staff-tasks-heading-card p { margin: 0; }
.staff-tasks-heading-card__count { margin-left: auto; min-width: 88px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 12px; text-align: center; background: var(--surface-alt); position: relative; z-index: 1; }
.staff-tasks-heading-card__count strong { display: block; font-size: 18px; }
.staff-tasks-heading-card__count span { color: var(--text-muted); font-size: 10px; font-weight: 700; }
.staff-tasks-heading-card .tasks-filter-trigger { position: relative; z-index: 1; }
.person-row__profile--link { text-decoration: none !important; }
.person-row__profile--link strong, .person-row__profile--link small { text-decoration: none !important; }
@media (max-width: 700px) { .staff-tasks-heading-card { align-items: flex-start; flex-wrap: wrap; } .staff-tasks-heading-card__count { margin-left: 0; } }

/* --------------------------------------------------------------------------
   Task table badges — Uzbek status/priority visual hierarchy
   -------------------------------------------------------------------------- */
.tasks-table .status-badge,
.tasks-table .priority-badge {
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid transparent;
    letter-spacing: .01em;
    font-weight: 800;
    line-height: 1;
}

/* Status colors */
.status-badge[data-status="CREATED"],
.status-badge[data-status="NEW"] {
    background: #eaf0ff;
    color: #3156b6;
    border-color: #d7e2ff;
}
.status-badge[data-status="ASSIGNED"] {
    background: #f0edff;
    color: #5b46b8;
    border-color: #dfd8ff;
}
.status-badge[data-status="ACCEPTED"] {
    background: #e8f7ef;
    color: #17744d;
    border-color: #ccebd9;
}
.status-badge[data-status="IN_PROGRESS"] {
    background: #e8f5ff;
    color: #17698f;
    border-color: #cfe8f7;
}
.status-badge[data-status="PAUSED"] {
    background: #f3ecff;
    color: #6a3eb4;
    border-color: #e3d6f6;
}
.status-badge[data-status="SUBMITTED"],
.status-badge[data-status="AWAITING_ACCEPTANCE"] {
    background: #fff5df;
    color: #a66a06;
    border-color: #f2dfb4;
}
.status-badge[data-status="REVIEW"] {
    background: #e9f4f8;
    color: #236783;
    border-color: #d0e5ed;
}
.status-badge[data-status="COMPLETION_APPROVED"],
.status-badge[data-status="APPROVED"] {
    background: #e5f7f0;
    color: #16694f;
    border-color: #c8eadc;
}
.status-badge[data-status="RETURNED"] {
    background: #fff0e3;
    color: #a25a12;
    border-color: #f2d7bd;
}
.status-badge[data-status="CANCELLED"],
.status-badge[data-status="REJECTED"] {
    background: #fdebec;
    color: #b53939;
    border-color: #f3d1d3;
}
.status-badge[data-status="CLOSED"] {
    background: #eef0f3;
    color: #4b5563;
    border-color: #dfe3e8;
}

/* Priority colors */
.priority-badge[data-priority="CRITICAL"] {
    background: #fde8e8;
    color: #b42318;
    border-color: #f6c9c9;
}
.priority-badge[data-priority="HIGH"] {
    background: #fff1e6;
    color: #c85d0b;
    border-color: #f4d3b7;
}
.priority-badge[data-priority="MEDIUM"] {
    background: #fff7dc;
    color: #9a6700;
    border-color: #f1e2a6;
}
.priority-badge[data-priority="NORMAL"] {
    background: #eaf0ff;
    color: #3156b6;
    border-color: #d7e2ff;
}
.priority-badge[data-priority="LOW"] {
    background: #e8f7ef;
    color: #17744d;
    border-color: #ccebd9;
}

/* Slightly richer table presentation on task-related pages */
.tasks-table tbody .task-row {
    transition: background-color .18s ease, transform .18s ease;
}
.tasks-table tbody .task-row:hover {
    background: rgba(49, 86, 182, .035);
}
.tasks-table tbody .task-row:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

/* ========================================
   Error pages (403, etc.)
======================================== */
.error-page {
    display: grid;
    place-items: center;
    min-height: 60vh;
    padding: 24px;
}
.error-page__card {
    max-width: 480px;
    padding: 40px 36px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.error-page__icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--danger-soft);
    font-size: 30px;
}
.error-page__card h2 {
    margin: 0 0 10px;
    font-size: 20px;
}
.error-page__card p.muted {
    margin: 0 0 24px;
    line-height: 1.6;
}
