:root {
  --canvas: #f5f6f8;
  --paper: #fff;
  --ink: #192c32;
  --muted: #65777e;
  --line: #e0e7e9;
  --accent: #176959;
  --accent-soft: #e8f3ef;
  --amber: #795d24;
  --amber-soft: #faf3e4;
  --danger: #a43131;
  --danger-soft: #fff1f1;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
  font-synthesis: none;
}
.collection-nav { flex-wrap: wrap; }
.collection-tab { flex-shrink: 0; }
/* Table navigation: the parent table owns every visible sub-section. */
.app-shell { display:grid; grid-template-columns:248px minmax(0,1fr); max-width:1800px; margin:auto; min-height:calc(100vh - 76px); }
.app-shell .workspace { width:100%; min-width:0; padding:32px 32px 28px; }
.table-sidebar { background:#fff; border-right:1px solid var(--line); padding:26px 14px; min-width:0; }
.table-navigation { position:sticky; top:24px; }
.sidebar-caption { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:1.4px; font-weight:700; padding:0 12px; margin:0 0 16px; }
.table-link { display:flex; gap:10px; align-items:center; padding:12px; color:var(--ink); text-decoration:none; border-radius:10px; font-size:14px; font-weight:650; }
.table-link > span:nth-child(2) { min-width:0; flex:1; }
.table-link small { display:block; color:var(--muted); font-size:10px; font-weight:400; margin-top:2px; overflow-wrap:anywhere; }
.table-link.is-active { background:var(--accent-soft); color:var(--accent); }
.table-link:hover { background:#f3f7f5; }
.table-symbol { font-size:18px; width:20px; text-align:center; }
.table-submenu { margin:6px 0 18px 21px; border-left:1px solid var(--line); padding-left:10px; }
.table-submenu .collection-tab { display:flex; justify-content:space-between; gap:8px; min-height:40px; border:0; border-radius:7px; margin:3px 0; padding:10px; font-size:12px; font-weight:500; line-height:1.4; }
.table-submenu .collection-tab[aria-current="page"] { background:#f0f6f3; color:var(--accent); font-weight:650; border:0; }
.sidebar-footnote { margin:28px 12px 0; color:var(--muted); font-size:11px; line-height:1.6; }
.sidebar-toggle { display:none; }
@media (min-width:901px) and (max-width:1400px) {
  .app-shell .content-layout.has-detail { grid-template-columns:minmax(0,1fr); }
  .app-shell .detail-panel { position:static; max-height:none; order:-1; }
}
@media (max-width:900px) {
  .app-shell { display:block; }
  .table-sidebar { padding:10px 16px; border-right:0; border-bottom:1px solid var(--line); }
  .sidebar-toggle { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; min-height:44px; border:0; background:white; color:var(--ink); padding:8px 0; font-size:13px; text-align:left; }
  .sidebar-toggle span { font-size:11px; color:var(--accent); }
  .table-navigation { display:none; position:static; padding:12px 0; }
  .table-navigation.is-open { display:block; }
  .app-shell .workspace { padding:24px 16px; }
  .table-submenu .collection-tab { min-height:44px; align-items:center; }
}
.toolbar { flex-wrap: wrap; }
.preflight-report { padding: 20px 24px; }
.preflight-report li { margin-bottom: 9px; }
.preflight-report { font-size: 13px; }
.preflight-report h3 { margin-top: 0; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #51a798; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; top: -80px; left: 16px; background: var(--paper); padding: 12px; z-index: 20; }
.skip-link:focus { top: 8px; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1600px; margin: 0 auto; min-height: 76px; display: flex; align-items: center; gap: 20px; padding: 16px 40px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 750; text-decoration: none; letter-spacing: -.6px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); color: white; border-radius: 10px; font-size: 17px; }
.environment-badge { color: var(--muted); border-left: 1px solid var(--line); padding-left: 20px; font-size: 13px; }
.logout-form { margin-left: auto; }
.workspace { max-width: 1600px; margin: 0 auto; padding: 38px 40px 28px; }
.intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 25px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); text-transform: uppercase; font-size: 11px; font-weight: 750; letter-spacing: 1.5px; }
h1 { font-size: clamp(25px, 2.4vw, 34px); line-height: 1.25; letter-spacing: -.8px; margin: 0; font-weight: 650; }
h2 { font-size: 20px; line-height: 1.35; letter-spacing: -.3px; margin: 0; font-weight: 650; }
h3 { font-size: 14px; margin: 25px 0 12px; }
p { margin-top: 0; }
.intro-description { color: var(--muted); margin: 11px 0 0; font-size: 15px; }
.readonly-badge { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--accent); background: var(--accent-soft); padding: 8px 12px; font-size: 12px; border-radius: 30px; margin-top: 9px; font-weight: 600; }
.readonly-badge span { font-size: 9px; }
.context-note { border: 1px solid #e5e9e4; border-radius: 11px; padding: 13px 16px; background: #f0f3ef; font-size: 13px; color: #5b6b60; }
.context-note strong { color: #3d5547; font-weight: 600; }
.collection-nav { display: flex; gap: 5px; margin: 30px 0 18px; border-bottom: 1px solid var(--line); }
.collection-tab { display: inline-flex; align-items: center; gap: 10px; padding: 13px 19px 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.collection-tab:hover { color: var(--accent); }
.collection-tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; min-width: 25px; text-align: center; padding: 2px 6px; border-radius: 6px; background: #e8edf0; color: #53656c; font-variant-numeric: tabular-nums; }
.collection-tab[aria-current="page"] .tab-count { color: var(--accent); background: #dcece5; }
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.content-layout.has-detail { grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 12px #23353d03; min-width: 0; overflow: hidden; }
.panel-heading { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding: 23px 24px 18px; }
.subtle { color: var(--muted); font-size: 12px; }
.panel-heading p { margin: 4px 0 0; }
.button { min-height: 39px; border-radius: 8px; padding: 8px 13px; font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button-secondary { background: var(--paper); border-color: var(--line); color: var(--ink); }
.button-secondary:hover:not(:disabled) { background: #f4f8f6; border-color: #b9d0c8; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--canvas); color: var(--ink); }
.toolbar { display: flex; gap: 12px; padding: 0 24px; }
.search-field { flex: 1; min-width: 0; }
.filter-field { max-width: 210px; flex: .55; min-width: 130px; }
label { display: block; color: var(--muted); font-size: 11px; font-weight: 600; margin-bottom: 6px; }
input[type="search"], select { min-height: 42px; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
input::placeholder { color: #87959a; }
.search-hint { font-size: 11px; color: var(--muted); margin: 10px 24px 18px; }
.state-message { padding: 22px 24px; background: #f8faf9; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.state-message.is-error { color: #8c3d34; background: #fdf4f2; }
.state-message a { margin-left: 6px; }
.record-table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 13px; }
.record-table th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; text-align: left; font-weight: 600; padding: 11px 15px; background: #fafbfc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.record-table th:first-child, .record-table td:first-child { padding-left: 24px; }
.record-table th:last-child, .record-table td:last-child { padding-right: 24px; }
.record-table td { padding: 16px 15px; border-bottom: 1px solid #eef1f3; vertical-align: top; overflow-wrap: anywhere; }
.record-table tbody tr:last-child td { border-bottom: 0; }
.record-table tbody tr:hover { background: #fafcfb; }
.record-table tbody tr.is-selected { background: #f0f7f3; }
.record-table th:first-child { width: 39%; }
.record-table.completeness-table th:first-child { width: 22%; }
.record-table.completeness-table th:nth-child(2) { width: 13%; }
.record-table.completeness-table th:nth-child(3) { width: 35%; }
.record-table.completeness-table th:nth-child(4) { width: 18%; }
.record-table.completeness-table th:nth-child(5) { width: 12%; }
.record-table .record-link { font-weight: 600; color: var(--ink); text-decoration: none; }
.record-table .record-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.record-table.employees-table th:first-child { width: 26%; }
.record-table.employees-table th:nth-child(2) { width: 14%; }
.record-table.employees-table th:nth-child(3) { width: 12%; }
.record-table.employees-table th:nth-child(4) { width: 38%; }
.record-table.employees-table th:nth-child(5) { width: 10%; }
.employee-incomplete { box-shadow: inset 3px 0 #c68020; }
.record-table tr.employee-incomplete:not(.is-selected), .record-card.employee-incomplete:not(.is-selected) { background: #fffcf5; }
.employee-health { min-width: 0; padding: 10px 12px; border-radius: 8px; background: #f1f7f4; color: #275847; font-size: 12px; line-height: 1.5; }
.employee-health.has-missing, .employee-health.has-checks { background: #fff1d7; color: #754a0d; }
.employee-health .health-title, .employee-health .health-check-title, .employee-health .health-questions { display: block; }
.employee-health .health-check-title, .employee-health .health-questions { margin-top: 7px; }
.health-fields { margin: 5px 0 0; padding-left: 18px; }
.health-fields li { margin: 2px 0; overflow-wrap: anywhere; }
.record-card-meta > span:has(.employee-health) { flex: 1 1 100%; min-width: 0; }
.record-subline { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.status-pill { display: inline-block; font-size: 10px; border-radius: 5px; padding: 3px 7px; color: var(--muted); background: #eff2f4; }
.status-pill.pending { color: var(--amber); background: var(--amber-soft); }
.status-pill.confirmed { color: var(--accent); background: var(--accent-soft); }
.status-pill.requires-review { color: #9b1c2b; background: #fde9ed; font-weight: 700; }
.telegram-editor input[type="text"] { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; background: #fff; margin: 8px 0 12px; }
.record-cards { display: none; }
.record-card { display: block; padding: 17px 20px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.record-card.is-selected { background: #f0f7f3; box-shadow: inset 3px 0 var(--accent); }
.record-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.record-card-title { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.record-card-arrow { color: #90a09c; font-size: 20px; line-height: 1; }
.record-card-meta { display: flex; flex-wrap: wrap; gap: 8px 15px; color: var(--muted); font-size: 12px; margin-top: 8px; align-items: center; }
.pagination { border-top: 1px solid var(--line); padding: 15px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pagination .subtle { text-align: center; }
.detail-panel { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; overscroll-behavior: contain; }
.detail-heading { padding: 24px 24px 14px; display: flex; gap: 15px; justify-content: space-between; align-items: flex-start; }
.detail-heading h2 { overflow-wrap: anywhere; }
.icon-button { flex-shrink: 0; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--canvas); }
.detail-actions { padding: 0 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-note { font-size: 11px; color: var(--muted); margin: 11px 24px 19px; }
#detail-content { padding: 0 24px 24px; }
.field-list { margin: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 15px; padding: 12px 0; border-top: 1px solid #eef1f3; }
.field-row dt { color: var(--muted); font-size: 12px; }
.field-row dd { margin: 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.field-row dd.is-empty { color: #97a1a5; }
.structured-value { white-space: pre-wrap; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; margin: 0; word-break: break-word; }
.related-section { margin-top: 22px; border-top: 1px solid var(--line); }
.related-links { margin: 0; padding: 0; list-style: none; }
.related-links a { display: block; padding: 11px 0; border-bottom: 1px solid #eef1f3; color: var(--accent); font-size: 13px; text-decoration: none; overflow-wrap: anywhere; }
.related-links a:hover { text-decoration: underline; }
.workspace-footer { display: flex; flex-wrap: wrap; gap: 5px 20px; margin: 20px 0 0; font-size: 10px; color: #7a8b92; }
.workspace-footer span:last-child { flex-basis: 100%; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); border: 1px solid var(--line); border-radius: 20px; background: var(--paper); padding: 36px; box-shadow: 0 10px 40px #203b3210; }
.login-card h1 { font-size: 28px; margin-bottom: 15px; }
.login-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.login-card form { margin-top: 28px; }
.login-card label { margin-top: 16px; font-size: 12px; }
.login-card input:not([type="hidden"]) { width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); }
.login-card button { width: 100%; min-height: 46px; border: 0; border-radius: 9px; margin-top: 23px; padding: 10px 14px; color: white; background: var(--accent); font-size: 14px; font-weight: 600; }
.login-card button:hover { background: #105a4b; }
.login-card .muted { margin: 22px 0 0; font-size: 11px; }
.login-card .error-message { background: #fdf0ed; color: #8c3d34 !important; border: 1px solid #ebd0c9; border-radius: 9px; padding: 12px; }
@media (min-width: 1051px) and (max-width: 1280px) {
  .has-detail .record-table { display: none; }
  .has-detail .record-cards { display: block; }
}
@media (max-width: 1050px) {
  .header-inner { padding-inline: 24px; }
  .workspace { padding: 28px 24px; }
  .content-layout.has-detail { grid-template-columns: minmax(0, 1fr); }
  .detail-panel { position: static; max-height: none; overflow: visible; order: -1; }
}
@media (max-width: 640px) {
  .header-inner { padding: 10px 16px; gap: 12px; min-height: 65px; }
  .brand { font-size: 18px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; }
  .environment-badge { font-size: 10px; padding-left: 12px; }
  .button-quiet { padding: 8px 3px; min-height: 44px; }
  .workspace { padding: 25px 14px; }
  .intro { flex-direction: column; gap: 12px; margin-bottom: 17px; }
  h1 { font-size: 25px; letter-spacing: -.5px; }
  .intro-description { font-size: 13px; }
  .readonly-badge { margin-top: 0; padding: 5px 10px; font-size: 10px; }
  .context-note { font-size: 11px; padding: 11px 13px; }
  .collection-nav { margin-top: 22px; gap: 0; justify-content: space-between; }
  .collection-tab { gap: 5px; font-size: 12px; padding: 12px 7px; }
  .tab-count { min-width: 20px; font-size: 10px; padding: 1px 5px; }
  .panel-heading { padding: 18px 17px 15px; }
  h2 { font-size: 18px; }
  .panel-heading p { font-size: 11px; }
  .panel-heading .button { font-size: 11px; padding-inline: 10px; }
  .toolbar { padding-inline: 17px; flex-wrap: wrap; gap: 10px; }
  .search-field { flex-basis: 100%; }
  .filter-field { flex: 1; max-width: none; }
  input[type="search"], select { font-size: 16px; min-height: 44px; }
  .search-hint { margin-inline: 17px; font-size: 10px; }
  .record-table { display: none; }
  .record-cards { display: block; }
  .record-card { padding-inline: 17px; }
  .pagination { padding: 13px 14px; gap: 8px; }
  .pagination .button { font-size: 11px; padding: 8px; min-height: 44px; }
  .pagination .subtle { font-size: 10px; }
  .detail-heading { padding: 19px 17px 14px; }
  .detail-actions { padding-inline: 17px; }
  .detail-note { margin-inline: 17px; }
  #detail-content { padding-inline: 17px; }
  .field-row { grid-template-columns: 1fr; gap: 4px; }
  .field-row dt { font-size: 11px; }
  .state-message { padding: 20px 17px; }
  .workspace-footer { font-size: 10px; }
  .login-shell { padding: 18px; }
  .login-card { padding: 28px 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: background-color .12s, border-color .12s, color .12s; }
}
.review-actions { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0 22px; background: #f4faf7; }
.review-actions p { font-size: 13px; overflow-wrap: anywhere; }
.review-actions select { width: 100%; max-width: 100%; font-size: 16px; }
.review-diff-row { display: grid; grid-template-columns: 1fr 1fr 20px 1fr; gap: 8px; border-top: 1px solid var(--line); padding: 10px 0; font-size: 12px; }
.review-diff-row > * { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.review-actions button { margin: 8px 8px 0 0; min-height: 44px; max-width: 100%; white-space: normal; }
.review-feedback { font-weight: 600; }
.review-match-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 15px 0; background: var(--paper); }
.review-match-card h4 { margin: 0 0 12px; font-size: 13px; }
.review-match-headings, .review-match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.review-match-headings > div { min-width: 0; overflow-wrap: anywhere; }
.review-match-headings strong, .review-match-headings span, .review-match-headings a { display: block; font-size: 12px; }
.review-match-headings strong { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.review-group-choices { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 8px; align-items: start; }
.review-group-choices > div { min-width: 0; }
.review-group-choices .review-value-choice { min-height: 64px; height: auto; overflow-wrap: anywhere; }
.review-variant-summary { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 15px 0; background: var(--paper); font-size: 12px; }
.review-variant-summary p { margin: 8px 0; }
.review-variant-difference { display: grid; gap: 5px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.review-variant-marker { display: block; font-size: 11px; font-weight: 600; margin-top: 4px; color: var(--danger); }
.review-match-reasons { margin: 13px 0 5px; color: var(--accent); }
.review-match-row { padding: 10px 0; border-top: 1px solid var(--line); }
.review-match-field { grid-column: 1 / -1; min-width: 0; }
.review-match-field strong { display: block; font-size: 12px; }
.review-match-note { display: block; color: var(--muted); font-size: 10px; }
.review-match-value { min-width: 0; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-match-value > span { display: block; }
.review-match-cell-label { color: var(--muted); font-size: 10px; margin-bottom: 3px; }
.review-match-row.has-difference { background: var(--danger-soft); margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; }
.review-match-row.has-difference .review-match-note, .review-match-row.has-difference .review-match-value { color: var(--danger); }
.review-match-warnings { color: var(--amber); font-size: 12px; padding-left: 19px; }
.review-match-warnings li { margin-bottom: 5px; overflow-wrap: anywhere; }
.review-step-title { font-weight: 700; color: var(--ink); margin-top: 18px; }
.review-choice-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.review-choice-bulk .button { margin: 0; flex: 1 1 190px; }
.review-choice-progress { color: var(--accent); font-weight: 600; }
.review-value-choice { display: flex; align-items: flex-start; gap: 7px; padding: 10px 8px; margin: 0; min-height: 56px; background: #f8faf9; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); font-size: 11px; }
.review-field-inline-choice { min-height: 48px; font-size: 12px; }
.review-value-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.review-value-choice.is-unavailable { cursor: default; background: var(--canvas); color: var(--muted); }
.review-value-choice input { flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--accent); margin: 2px 0 0; }
.review-value-choice > span { min-width: 0; }
.review-choice-value { display: block; font-size: 12px; font-weight: 400; margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-choice-reason { display: block; margin-top: 5px; color: var(--amber); font-size: 11px; }
.review-confirmation { border-top: 2px solid #b9d0c8; padding-top: 15px; margin-top: 18px; }
.review-final-preview h4 { font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .review-diff-row { grid-template-columns: 1fr 20px 1fr; } .review-diff-row strong { grid-column: 1 / -1; } }

/* Sorting belongs to the employee list heading, above the search filters. */
.panel-heading { flex-wrap: wrap; }
.heading-sort { display: flex; gap: 12px; margin-left: auto; min-width: 0; }
.heading-sort .filter-field { flex: 1; width: 190px; }
.heading-sort:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
@media (max-width: 700px) {
  .panel-heading > div:first-child { flex: 1; }
  .heading-sort { order: 3; flex-basis: 100%; margin-left: 0; }
  .heading-sort .filter-field { width: auto; min-width: 0; max-width: none; }
}
