:root {
  --ink: #172321;
  --muted: #687570;
  --line: #dfe7e4;
  --surface: #ffffff;
  --canvas: #f3f7f5;
  --brand: #0f654a;
  --brand-dark: #0a3f31;
  --brand-soft: #e4f3ed;
  --gold: #ae751d;
  --danger: #bd3c3c;
  --warning: #e0a229;
  --shadow: 0 12px 34px rgba(22, 58, 48, .075);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 30; height: 100vh; display: flex; flex-direction: column; padding: 26px 17px 20px; color: #fff; background: var(--brand-dark); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 27px; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 12px; color: var(--brand-dark); background: #fff; font-weight: 900; letter-spacing: -.05em; }
.brand-name { font-size: 14px; font-weight: 850; letter-spacing: .055em; }
.brand-caption { margin-top: 3px; color: rgba(255,255,255,.63); font-size: 12px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 0; border-radius: 10px; color: rgba(255,255,255,.72); background: transparent; text-align: left; transition: .15s ease; }
.nav-item span { width: 22px; color: rgba(255,255,255,.52); font-size: 17px; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.14); font-weight: 750; }
.nav-item.active span { color: #fff; }
.sidebar-foot { margin-top: auto; padding: 17px 10px 0; border-top: 1px solid rgba(255,255,255,.11); }
.local-badge { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.74); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #79d1a6; box-shadow: 0 0 0 4px rgba(121,209,166,.12); }
.save-state { margin-top: 9px; color: rgba(255,255,255,.48); font-size: 10px; }
.version { margin-top: 7px; color: rgba(255,255,255,.34); font-size: 10px; }

.main-content { min-width: 0; padding: 0 32px 46px; }
.topbar { min-height: 100px; display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.topbar-copy { min-width: 0; }
.topbar h1 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.mobile-menu { display: none; border: 0; color: var(--ink); background: transparent; font-size: 22px; }
.backup-reminder.is-due { border-color: #e6c785; color: #875c12; background: #fff9ea; }

.page-section { max-width: 1500px; margin: 0 auto; padding-top: 27px; }
.button { min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; font-size: 13px; transition: .15s ease; }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 6px 16px rgba(15,101,74,.16); }
.button-primary:hover { background: #0b5740; transform: translateY(-1px); }
.button-secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.button-secondary:hover, .button-quiet:hover { border-color: #b8c9c3; background: #f8faf9; }
.button-quiet { min-height: 34px; padding: 6px 10px; border-color: var(--line); color: var(--brand); background: transparent; }
.button-danger { border-color: #edc9c9; color: #9f3030; background: #fff5f5; }
.button-danger:hover { background: #ffe8e8; }

.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { padding: 21px 22px 12px; }
.panel-heading h2, .settings-card h2, .data-note h2, .settings-actions h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.panel-heading p, .settings-card p, .data-note p, .settings-actions p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.panel-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.kpi-card { min-height: 132px; padding: 21px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.kpi-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-size: 16px; }
.kpi-value { margin-top: 14px; font-size: 26px; font-weight: 850; letter-spacing: -.04em; }
.kpi-note { margin-top: 7px; color: var(--muted); font-size: 11px; }
.kpi-note strong { color: var(--brand); }
.kpi-card.alert .kpi-icon { color: #9b6817; background: #fff1d2; }
.kpi-card.alert .kpi-value { color: #946317; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, .8fr); gap: 15px; margin-top: 15px; }
.equal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.thirds-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bar-chart { display: grid; gap: 14px; padding: 13px 22px 24px; }
.bar-row { display: grid; grid-template-columns: 100px minmax(120px,1fr) 100px; align-items: center; gap: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #34433f; font-size: 12px; font-weight: 750; }
.bar-track { height: 10px; overflow: hidden; border-radius: 99px; background: #edf2f0; }
.bar-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #2e9473); }
.bar-value { color: var(--muted); font-size: 11px; text-align: right; }
.status-summary { display: flex; align-items: center; gap: 24px; min-height: 225px; padding: 10px 22px 26px; }
.donut { width: 138px; height: 138px; flex: 0 0 auto; display: grid; place-items: center; position: relative; border-radius: 50%; background: conic-gradient(var(--brand) 0 100%); }
.donut::after { content: ""; width: 86px; height: 86px; position: absolute; border-radius: 50%; background: white; }
.donut > div { position: relative; z-index: 1; display: grid; text-align: center; }
.donut strong { font-size: 25px; }
.donut span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.legend { min-width: 0; display: grid; gap: 8px; }
.legend-row { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 8px; font-size: 11px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }
.legend-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4e5c58; }
.legend-count { font-weight: 800; }
.attention-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 5px 22px 22px; }
.attention-card { min-height: 83px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; color: inherit; background: #fafcfb; text-align: left; }
.attention-card:hover { border-color: #b9cbc4; background: var(--brand-soft); }
.attention-card strong { display: block; font-size: 21px; }
.attention-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.rank-list { display: grid; padding: 4px 22px 21px; }
.rank-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid #edf2f0; color: inherit; background: transparent; text-align: left; }
button.rank-row { width: 100%; border: 0; border-bottom: 1px solid #edf2f0; }
.rank-row:last-child { border-bottom: 0; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 750; }
.rank-note { margin-top: 3px; color: var(--muted); font-size: 10px; }
.rank-value { color: var(--brand); font-size: 11px; font-weight: 800; white-space: nowrap; }
.empty-block { padding: 25px 0; color: var(--muted); font-size: 12px; text-align: center; }

.clients-panel, .control-panel { overflow: hidden; }
.toolbar { display: grid; grid-template-columns: minmax(250px,1fr) repeat(4, minmax(145px,.42fr)) auto; gap: 9px; padding: 17px; border-bottom: 1px solid var(--line); }
.search-field { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.search-field span { color: var(--muted); font-size: 18px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; }
.toolbar select, .field input, .field select, .field textarea, .settings-table input, .settings-table select, .table-tools select { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; outline: 0; }
.toolbar select { padding: 0 10px; }
.field input, .field select, .field textarea, .settings-table input, .settings-table select { padding: 9px 11px; }
.field textarea { resize: vertical; }
.toolbar select:focus, .field input:focus, .field select:focus, .field textarea:focus, .search-field:focus-within, .settings-table input:focus { border-color: #4b967e; box-shadow: 0 0 0 3px rgba(75,150,126,.11); }
.table-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 17px; color: var(--muted); font-size: 11px; }
.table-meta > div { display: flex; align-items: center; gap: 14px; }
.table-meta strong { color: var(--ink); }
.table-tools label { display: flex; align-items: center; gap: 7px; }
.table-tools select { width: auto; min-height: 34px; padding: 0 8px; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table, .settings-table, .mini-table { width: 100%; border-collapse: collapse; }
.data-table th, .settings-table th { padding: 11px 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #71807b; background: #f7f9f8; font-size: 10px; font-weight: 800; letter-spacing: .035em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td, .settings-table td { padding: 12px 13px; border-bottom: 1px solid #edf1ef; color: #42504c; font-size: 12px; vertical-align: middle; }
.data-table tbody tr[data-edit] { cursor: pointer; }
.data-table tbody tr[data-edit]:hover { background: #fafcfb; }
.data-table .numeric, .settings-table .numeric { text-align: right; white-space: nowrap; }
.sort-button { padding: 0; border: 0; color: inherit; background: none; font: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; }
.sort-button.active { color: var(--brand); }
.sort-button span::after { content: "↕"; opacity: .38; }
.sort-button.active.asc span::after { content: "↑"; opacity: 1; }
.sort-button.active.desc span::after { content: "↓"; opacity: 1; }
.client-name { max-width: 260px; color: var(--ink); font-weight: 800; }
.client-sub { margin-top: 3px; color: #87928f; font-size: 10px; font-weight: 400; }
.activity-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { display: inline-flex; align-items: center; max-width: 200px; padding: 5px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.archive-chip { margin-left: 5px; color: #5a6662; background: #e9edeb; }
.positive { color: #a36b13; font-weight: 750; }
.row-action { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; color: var(--brand); background: #fff; }
.row-action:hover { background: var(--brand-soft); }
.empty-row { padding: 42px 18px !important; color: var(--muted) !important; text-align: center; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 17px; }
.pagination span { color: var(--muted); font-size: 11px; }
.pagination button:disabled { opacity: .4; cursor: default; }

.control-toolbar { display: grid; grid-template-columns: 180px 220px 180px minmax(220px,1fr); gap: 14px; align-items: end; padding: 17px; }
.compact-field, .compact-search { margin: 0; }
.control-kpis { margin-top: 15px; }
.control-panel { margin-top: 15px; }
.control-table th:not(:first-child), .control-table td:not(:first-child) { text-align: center; }
.control-client { min-width: 220px; text-align: left; }
.task-check { display: inline-grid; place-items: center; }
.task-check input { width: 17px; height: 17px; accent-color: var(--brand); }
.task-check.na { color: #aab3b0; font-size: 13px; }
.problem-check input { accent-color: var(--danger); }
.progress-cell { min-width: 100px; }
.progress-value { font-size: 10px; font-weight: 800; }
.mini-progress { width: 88px; height: 6px; margin: 5px auto 0; overflow: hidden; border-radius: 20px; background: #eaf0ed; }
.mini-progress div { height: 100%; border-radius: inherit; background: var(--brand); }
.mini-progress.warning div { background: var(--warning); }
.note-indicator { color: var(--gold); }

.analytics-panel { margin-top: 15px; overflow: hidden; }
.load-meter { min-width: 145px; }
.load-label { display: flex; justify-content: flex-end; gap: 5px; font-size: 10px; }
.load-bar { height: 7px; margin-top: 5px; overflow: hidden; border-radius: 20px; background: #edf2f0; }
.load-bar div { height: 100%; border-radius: inherit; background: var(--brand); }
.load-meter.over .load-bar div { background: var(--danger); }
.load-meter.over .load-label { color: var(--danger); font-weight: 800; }
.compact-table-wrap { padding: 0 22px 18px; }
.mini-table td { padding: 10px 0; border-bottom: 1px solid #edf2f0; font-size: 11px; }
.mini-table td:last-child { text-align: right; }
.mini-status { display: flex; align-items: center; gap: 7px; }

.team-grid { display: grid; grid-template-columns: repeat(3, minmax(260px,1fr)); gap: 15px; }
.team-card { padding: 20px; cursor: pointer; }
.team-card:hover { border-color: #b9cbc4; transform: translateY(-1px); }
.team-head { display: flex; align-items: center; gap: 12px; }
.avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: #fff; background: var(--brand); font-weight: 850; }
.team-name { font-weight: 800; }
.team-role { margin-top: 3px; color: var(--muted); font-size: 11px; }
.team-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 18px; }
.team-stat { padding: 10px; border-radius: 9px; background: #f5f8f7; }
.team-stat strong { display: block; font-size: 15px; }
.team-stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.team-load { margin-top: 16px; }

.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; padding: 4px 1px; }
.settings-section { margin-top: 15px; overflow: hidden; }
.settings-section:first-of-type { margin-top: 0; }
.settings-table th:first-child { min-width: 190px; }
.settings-table input[type="color"] { width: 50px; min-height: 36px; padding: 3px; }
.settings-table input[type="checkbox"] { width: 17px; min-height: 17px; accent-color: var(--brand); }
.settings-table .remove-setting { width: 34px; height: 34px; border: 1px solid #f0d0d0; border-radius: 8px; color: var(--danger); background: #fffafa; }
.settings-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.settings-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 8px 22px 22px; }
.settings-form-grid textarea { min-height: 165px; }
.settings-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.settings-card { padding: 23px; }
.settings-icon { display: grid; width: 42px; height: 42px; margin-bottom: 18px; place-items: center; border-radius: 11px; color: var(--brand); background: var(--brand-soft); font-size: 20px; }
.settings-card .button { margin-top: 19px; }
.import-mode { margin-top: 15px; }
.snapshots-panel { margin-top: 15px; }
.snapshot-list { display: grid; padding: 0 22px 20px; }
.snapshot-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 9px; padding: 11px 0; border-bottom: 1px solid #edf2f0; }
.snapshot-row:last-child { border-bottom: 0; }
.snapshot-title { font-size: 12px; font-weight: 750; }
.snapshot-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.data-note { padding: 21px; }
.data-note .button { margin-top: 17px; }
.danger-card { border-color: #efd9d9; }
.storage-info { display: grid; gap: 9px; margin-top: 15px; }
.storage-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.storage-row strong { color: var(--ink); }

.client-dialog, .small-dialog { width: min(810px, calc(100vw - 28px)); max-height: calc(100vh - 36px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 30px 80px rgba(11,49,38,.25); }
.small-dialog { width: min(560px, calc(100vw - 28px)); }
.client-dialog::backdrop, .small-dialog::backdrop { background: rgba(14,30,25,.46); }
.client-dialog form, .small-dialog form { padding: 0; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 21px 24px 17px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 20px; }
.dialog-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: #f3f6f5; font-size: 22px; }
.form-scroll { max-height: calc(100vh - 195px); overflow-y: auto; }
.form-section { padding: 18px 24px; border-bottom: 1px solid #edf2f0; }
.form-section h3 { margin: 0 0 14px; color: #364640; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title-row h3 { margin-bottom: 14px; }
.section-title-row .button { margin-top: -5px; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field > span, .check-group legend { color: #53615d; font-size: 11px; font-weight: 700; }
.check-group { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; padding: 8px 0 0; border: 0; }
.check-group legend { margin-bottom: 9px; }
.check-group label { color: #43514d; font-size: 12px; }
.check-group input, .toggle-field input { accent-color: var(--brand); }
.toggle-field { display: flex; align-items: flex-start; gap: 9px; color: #43514d; font-size: 12px; line-height: 1.5; }
.toggle-field input { width: 17px; height: 17px; flex: 0 0 auto; }
.dialog-body { display: grid; gap: 18px; padding: 22px 24px; }
.dialog-actions { display: flex; align-items: center; gap: 9px; padding: 14px 24px 18px; border-top: 1px solid var(--line); }
.action-spacer { flex: 1; }
.updated-label { color: var(--muted); font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(390px,calc(100vw - 48px)); padding: 13px 17px; border-radius: 10px; color: #fff; background: #173e32; box-shadow: 0 12px 35px rgba(0,0,0,.18); font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1250px) {
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toolbar { grid-template-columns: 1fr 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .team-grid, .settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .thirds-grid { grid-template-columns: 1fr 1fr; }
  .thirds-grid > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 950px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: 260px; transform: translateX(-105%); transition: .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 0 18px 38px; }
  .mobile-menu { display: block; }
  .topbar { min-height: 88px; }
  .topbar h1 { font-size: 23px; }
  .topbar p { display: none; }
  .backup-reminder { display: none; }
  .content-grid, .equal-grid, .thirds-grid, .settings-columns { grid-template-columns: 1fr; }
  .thirds-grid > :first-child { grid-column: auto; }
  .control-toolbar { grid-template-columns: 1fr 1fr; }
  .compact-search { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .main-content { padding-inline: 12px; }
  .page-section { padding-top: 18px; }
  .kpi-grid, .team-grid, .settings-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 118px; }
  .topbar-actions .button-primary { font-size: 0; padding-inline: 12px; }
  .topbar-actions .button-primary::after { content: "+ Клиент"; font-size: 12px; }
  .status-summary { align-items: flex-start; flex-direction: column; }
  .toolbar, .control-toolbar { grid-template-columns: 1fr; }
  .search-field, .compact-search { grid-column: auto; }
  .table-meta, .table-meta > div { align-items: flex-start; flex-direction: column; }
  .attention-grid { grid-template-columns: 1fr; }
  .form-grid, .settings-form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .dialog-actions { flex-wrap: wrap; }
  .action-spacer, .updated-label { display: none; }
  .dialog-actions .button { flex: 1 1 42%; }
  .bar-row { grid-template-columns: 72px minmax(80px,1fr) 78px; gap: 8px; }
  .settings-actions { align-items: flex-start; flex-direction: column; }
}

/* Version 4: split runner, encrypted files and staff activity */
.segment-tabs { display: inline-flex; gap: 4px; margin-bottom: 15px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #eef3f1; }
.segment-tab { min-height: 38px; padding: 8px 17px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 750; }
.segment-tab.active { color: var(--brand); background: #fff; box-shadow: 0 2px 9px rgba(19,58,46,.09); }
.runner-cell { position: relative; }
.runner-cell.has-file::after { position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; content: ""; background: #258b68; }
.runner-cell.missing-proof { border-color: #d85c5c; box-shadow: 0 0 0 2px rgba(216,92,92,.14); }
.proof-box { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px; border: 1px dashed #b8ccc4; border-radius: 11px; background: #f7faf9; }
.proof-box > div { display: grid; gap: 4px; }
.proof-box strong { font-size: 11px; }
.proof-box span { color: var(--muted); font-size: 9px; line-height: 1.4; }
.file-button { flex: 0 0 auto; cursor: pointer; }
.attachment-list { display: grid; gap: 7px; }
.attachment-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.attachment-row > span:first-child { min-width: 0; }
.attachment-row strong { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-row small, .data-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.pending-file { border-style: dashed; background: #f5faf7; }
.empty-attachment { padding: 11px; color: var(--muted); border-radius: 8px; background: #f5f7f6; font-size: 10px; text-align: center; }
.attachment-actions { display: inline-flex; align-items: center; gap: 5px; }
.attachment-actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--brand); background: #fff; font-size: 9px; }
.attachment-actions button:last-child:not(:first-child) { color: var(--danger); }
.document-toolbar { grid-template-columns: minmax(240px,1fr) 220px 170px auto; }
.document-type { display: inline-flex; padding: 5px 7px; border-radius: 7px; color: #376153; background: #e7f3ee; font-size: 9px; font-weight: 750; }
.document-type.ecp { color: #785417; background: #fff0cc; }
.expired { color: var(--danger) !important; font-weight: 750; }
.ecp-note { margin: 0; padding: 11px 12px; border-radius: 9px; color: #765616; background: #fff4d9; font-size: 10px; line-height: 1.5; }
.activity-toolbar { display: flex; gap: 12px; margin-bottom: 15px; padding: 15px; }
.activity-toolbar .compact-field { width: 240px; }
.activity-feed { display: grid; max-height: 520px; overflow: auto; padding: 0 20px 20px; }
.activity-item { display: grid; grid-template-columns: 12px minmax(0,1fr); gap: 9px; padding: 10px 0; border-bottom: 1px solid #edf2f0; }
.activity-mark { width: 8px; height: 8px; margin-top: 4px; border: 2px solid #d9eee6; border-radius: 50%; background: var(--brand); }
.activity-item strong { font-size: 10px; }
.activity-item p { margin: 3px 0; color: #40514b; font-size: 10px; line-height: 1.35; }
.activity-item time { color: var(--muted); font-size: 9px; }
.online-label { color: #267957 !important; font-weight: 750; }

@media (max-width: 1050px) {
  .document-toolbar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .segment-tabs { display: grid; width: 100%; }
  .proof-box, .attachment-row { align-items: stretch; flex-direction: column; }
  .document-toolbar { grid-template-columns: 1fr; }
  .activity-toolbar { align-items: stretch; flex-direction: column; }
  .activity-toolbar .compact-field { width: 100%; }
}

/* Version 3: users, roles, runner and encrypted access directory */
.auth-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #e6f2ed 0, transparent 38%), linear-gradient(145deg, #f7faf9, #edf4f1); }
.auth-screen.hidden { display: none; }
body.auth-locked { overflow: hidden; }
body.auth-locked .app-shell { display: none; }
.auth-card { width: min(470px, 100%); padding: 30px; border: 1px solid #d8e5e0; border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 28px 80px rgba(11,63,49,.16); }
.auth-brand { display: flex; align-items: center; gap: 13px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.auth-brand strong { display: block; font-size: 14px; letter-spacing: .05em; }
.auth-brand span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.auth-form { display: grid; gap: 15px; padding-top: 24px; }
.auth-form h1 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.auth-form p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.auth-form .form-error { min-height: 18px; margin: -3px 0; color: var(--danger); font-size: 11px; }
.button-large { min-height: 46px; }
.auth-note { display: grid; gap: 4px; margin-top: 22px; padding: 13px 14px; border-radius: 10px; color: #5d6c67; background: #f1f5f3; font-size: 10px; line-height: 1.5; }
.auth-note strong { color: #3a4b45; }

body.no-financial .financial-only { display: none !important; }
.nav-item b { font-weight: inherit; }
.user-menu { display: flex; align-items: center; gap: 6px; margin-left: 4px; }
.user-chip { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; text-align: left; }
.user-chip > span:last-child { display: grid; gap: 2px; }
.user-chip strong { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.user-chip small { color: var(--muted); font-size: 9px; }
.user-avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; color: #fff; background: var(--brand); font-size: 12px; font-weight: 800; }
.logout-button { min-height: 34px; padding: 6px 8px; border: 0; color: var(--muted); background: transparent; font-size: 10px; }
.logout-button:hover { color: var(--danger); }

.directory-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 18px; border-bottom: 1px solid var(--line); }
.directory-head h2 { margin: 0; font-size: 16px; }
.directory-head p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.directory-head .search-field { width: min(390px, 45%); }

.runner-help { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 15px; padding: 12px 16px; box-shadow: none; }
.runner-help > div { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 10px; }
.runner-help strong { color: var(--ink); }
.runner-help p { margin: 0; color: var(--muted); font-size: 10px; }
.runner-dot { display: inline-grid; width: 20px; height: 20px; margin-right: 4px; place-items: center; border-radius: 6px; font-style: normal; font-weight: 900; }
.runner-dot.pending { color: #7c8985; background: #edf1ef; }
.runner-dot.done { color: #17623f; background: #dff3e7; }
.runner-dot.na { color: #697570; background: #e9edeb; }
.runner-dot.problem { color: #a33434; background: #fde5e5; }
.runner-wrap { max-height: calc(100vh - 345px); }
.control-table thead th span { display: inline-block; max-width: 92px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
.control-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.runner-cell { display: inline-grid; width: 31px; height: 31px; place-items: center; border: 1px solid transparent; border-radius: 8px; font-size: 15px; font-weight: 900; transition: transform .12s ease, box-shadow .12s ease; }
.runner-cell:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(18,61,48,.12); }
.runner-cell.pending { color: #6f7b77; background: #edf1ef; }
.runner-cell.done { color: #17623f; background: #dff3e7; }
.runner-cell.na { color: #697570; background: #e9edeb; }
.runner-cell.problem { color: #a33434; background: #fde5e5; }
.runner-cell.overdue { border-color: #e3a343; box-shadow: inset 0 0 0 1px #fff1d3; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #f6faf8; }
.archived-row { opacity: .62; }
.danger-text { color: var(--danger) !important; }
.control-table { min-width: max-content; }
.control-table th, .control-table td { min-width: 63px; text-align: center; }
.control-table th:first-child, .control-table td:first-child { position: sticky; left: 0; z-index: 3; min-width: 230px; text-align: left; background: #fff; box-shadow: 5px 0 10px rgba(20,50,40,.035); }
.control-table thead th:first-child { z-index: 5; background: #f7f9f8; }
.control-table th:nth-last-child(2), .control-table td:nth-last-child(2) { min-width: 100px; }
.task-column-head { max-width: 86px; white-space: normal !important; line-height: 1.25; }
.task-column-head small { display: block; margin-top: 4px; color: #9a6d24; font-size: 9px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.task-state-button { display: inline-grid; width: 31px; height: 31px; place-items: center; border: 1px solid transparent; border-radius: 8px; font-weight: 900; }
.task-state-button:hover { border-color: #a9beb6; transform: translateY(-1px); }
.task-state-button.pending { color: #7c8985; background: #f0f3f2; }
.task-state-button.done { color: #17623f; background: #dff3e7; }
.task-state-button.na { color: #697570; background: #e7ecea; }
.task-state-button.problem { color: #a33434; background: #fde5e5; }
.task-state-button.overdue { box-shadow: 0 0 0 2px rgba(189,60,60,.28); }
.task-note-mark { position: absolute; width: 5px; height: 5px; margin: 3px 0 0 -2px; border-radius: 50%; background: var(--gold); }
.control-client { min-width: 220px; }
.task-history { padding: 10px 12px; border-radius: 9px; color: var(--muted); background: #f5f8f7; font-size: 10px; line-height: 1.5; }

.vault-warning { display: flex; align-items: center; gap: 14px; margin-bottom: 15px; padding: 14px 17px; border-color: #e9d7a9; color: #6f531e; background: #fffaf0; box-shadow: none; }
.vault-warning strong { font-size: 12px; }
.vault-warning span { color: #836d44; font-size: 10px; line-height: 1.45; }
.vault-toolbar { grid-template-columns: minmax(260px,1fr) 210px auto; }
.secret-mask { letter-spacing: .12em; color: #7b8783; }
.secret-input { display: grid; grid-template-columns: minmax(0,1fr) auto; }
.secret-input input { border-radius: 9px 0 0 9px; }
.secret-input button { border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; color: var(--brand); background: #f8faf9; font-size: 10px; }
.access-chip { display: inline-flex; padding: 4px 7px; border-radius: 99px; color: #315c4e; background: var(--brand-soft); font-size: 9px; font-weight: 750; }

.audit-list { display: grid; padding: 0 22px 20px; }
.audit-row { display: grid; grid-template-columns: 145px 130px minmax(0,1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf2f0; font-size: 10px; }
.audit-row:last-child { border-bottom: 0; }
.audit-row time, .audit-row span { color: var(--muted); }
.role-chip { display: inline-flex; padding: 4px 7px; border-radius: 99px; font-size: 9px; font-weight: 800; }
.role-admin { color: #714f11; background: #fff0c8; }
.role-reviewer { color: #285d7c; background: #e2f0f8; }
.role-employee { color: #315f50; background: #e3f3ed; }

@media (max-width: 950px) {
  .user-chip > span:last-child, .logout-button { display: none; }
  .topbar-actions { gap: 5px; }
  .directory-head { align-items: stretch; flex-direction: column; }
  .directory-head .search-field { width: 100%; }
  .runner-help { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .auth-card { padding: 23px; }
  .user-menu { margin-left: 0; }
  .user-chip { padding-right: 6px; }
  .vault-toolbar { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr; gap: 3px; }
}

.server-saving .app-shell,.server-saving dialog{pointer-events:none;opacity:.7}.server-save-error{position:fixed;top:8px;left:10%;right:10%;z-index:10000;background:#fff0ed;border:2px solid #b84732;padding:16px;display:flex;gap:12px;flex-wrap:wrap;box-shadow:0 3px 20px #0003}.server-save-error.hidden{display:none}.server-save-error button{padding:8px;cursor:pointer}.server-saving{cursor:progress}

.server-save-error{margin:0;max-width:none;width:auto;height:auto}.server-save-error::backdrop{background:#0006}
