:root {
  /* --- Kömmerling-inspired reskin (attempt 1) ---
     To fully revert: `git revert` this commit, or restore the previous
     :root block (Inter font, terracotta --accent #df6b45, teal --navy
     #19384f) and the radius/font tweaks noted below. */
  --ink: #1c1f2e;
  --ink-soft: #6b7280;
  --navy: #23263d;
  --navy-deep: #16182a;
  --accent: #f39325;
  --accent-dark: #d97b12;
  --cream: #eef1f5;
  --paper: #ffffff;
  --line: #dde1e8;
  --success: #39866a;
  --danger: #b9483e;
  --shadow: 0 18px 50px rgba(20, 24, 40, .16);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-soft); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.button { min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink); background: transparent; font-weight: 700; text-decoration: none; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--accent); box-shadow: 0 8px 18px rgba(243, 147, 37, .28); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: white; background: var(--navy); }
.button-ghost { border-color: var(--line); background: rgba(255,255,255,.52); }
.button-danger { color: var(--danger); border-color: #e9c6c2; background: #fff8f7; }
.button-full { width: 100%; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; color: var(--ink); background: #edf1f1; font-size: 27px; line-height: 1; }

.login-page { display: grid; place-items: center; padding: 28px; background: var(--navy-deep); }
.login-page::before { content: ""; position: fixed; inset: 0; background: radial-gradient(circle at 18% 28%, rgba(243,147,37,.2), transparent 30%), radial-gradient(circle at 82% 75%, rgba(90,100,140,.16), transparent 28%); pointer-events: none; }
.login-shell { width: min(1080px, 100%); min-height: 650px; display: grid; grid-template-columns: 1.15fr .85fr; border-radius: 8px; overflow: hidden; background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.28); position: relative; }
.login-brand { padding: 76px; display: flex; flex-direction: column; justify-content: center; color: white; background: linear-gradient(145deg, #1a1c30, #2a2d47); position: relative; z-index: 0; overflow: hidden; }
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 700' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0%25' stop-color='%23f39325'/%3E%3Cstop offset='100%25' stop-color='%23ffcf7a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0,700 L0,430 C160,540 340,190 600,270 L600,700 Z' fill='url(%23g)' opacity='.15'/%3E%3Cpath d='M0,700 L0,540 C200,610 380,340 600,410 L600,700 Z' fill='%23f39325' opacity='.09'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: bottom;
  pointer-events: none;
}
.login-brand::after { content: ""; width: 340px; height: 340px; position: absolute; right: -150px; bottom: -155px; border: 65px solid rgba(255,255,255,.055); border-radius: 50%; }
.brand-mark { width: 58px; height: 58px; margin-bottom: 58px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--accent); font-size: 19px; font-weight: 900; letter-spacing: -.04em; box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.brand-mark svg { width: 55%; height: 55%; }
.login-brand h1 { margin: 0; font-size: clamp(40px, 5vw, 60px); font-weight: 800; line-height: .98; letter-spacing: -.02em; }
.login-intro { max-width: 530px; margin: 28px 0 44px; color: #dce8ec; font-size: 18px; line-height: 1.65; }
.login-proof { display: flex; flex-wrap: wrap; gap: 12px 22px; color: #bcd0d8; font-size: 13px; font-weight: 650; }
.login-card { padding: 80px 64px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin: 0 0 8px; font-size: 38px; font-weight: 800; }
.login-form { margin-top: 28px; display: grid; gap: 20px; }
.login-form label, .form-field, .upload-box label { display: grid; gap: 8px; color: #324d5d; font-size: 13px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd7da; border-radius: 4px; color: var(--ink); background: white; outline: none; }
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #4d8296; box-shadow: 0 0 0 3px rgba(77,130,150,.14); }
.login-help { margin: 24px 0 0; color: #78909b; font-size: 12px; text-align: center; }
.alert { padding: 12px 14px; margin-top: 18px; border-radius: 4px; font-size: 13px; }
.alert-error { color: #82362f; border: 1px solid #efcbc7; background: #fff2f0; }

.app-shell { min-height: 100vh; min-height: 100dvh; padding-top: 72px; }
.topbar { height: 72px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--paper); position: fixed; top: 0; left: 0; right: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 17px; }
.brand-mark-small { width: 38px; height: 38px; margin: 0; border-radius: 50%; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.account-button { padding: 5px 10px 5px 5px; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 6px; color: var(--ink); background: transparent; text-align: left; }
.account-button small { display: block; margin-top: 1px; color: var(--ink-soft); font-size: 11px; }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 4px; color: white; background: var(--navy); font-size: 12px; font-weight: 800; }
.workspace { display: grid; grid-template-columns: 222px minmax(0, 1fr); height: calc(100vh - 72px); height: calc(100dvh - 72px); }
.sidebar { padding: 28px 18px 22px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); background: #eef0ec; overflow-y: auto; }
.sidebar-label { padding: 0 12px; margin: 0 0 10px; color: #829199; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-item { width: 100%; min-height: 44px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 4px; color: #3d5664; background: transparent; font-weight: 700; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.65); }
.nav-item.active { color: white; background: var(--navy); box-shadow: 0 8px 18px rgba(25,56,79,.14); }
.nav-count { min-width: 23px; padding: 2px 7px; border-radius: 20px; color: var(--navy); background: white; font-size: 11px; text-align: center; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--ink-soft); font-size: 12px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: #48a47f; box-shadow: 0 0 0 4px rgba(72,164,127,.12); }
.content { width: min(1480px, 100%); height: 100%; padding: 38px 42px 54px; margin: 0 auto; display: flex; flex-direction: column; min-height: 0; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin: 0 0 4px; font-size: 38px; font-weight: 800; letter-spacing: -.01em; }
.page-heading p:last-child { margin: 0; }
.metrics { margin: 28px 0 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 116px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.72); box-shadow: 0 5px 18px rgba(19,51,70,.035); position: relative; z-index: 0; overflow: hidden; }
.metric-card span, .metric-card small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.metric-card strong { display: block; margin: 6px 0 2px; font-size: 32px; font-weight: 800; }
.metric-main { color: white; border-color: var(--navy); background: var(--navy); }
.metric-main::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 116' preserveAspectRatio='none'%3E%3Cpath d='M0,116 L0,70 C90,100 220,20 340,55 L340,116 Z' fill='%23f39325' opacity='.16'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: bottom;
}
.metric-main span, .metric-main small { color: #bed0d8; }
.panel { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: 0 8px 25px rgba(19,51,70,.045); overflow: hidden; }
.claim-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.toolbar { padding: 16px; display: flex; gap: 10px; border-bottom: 1px solid var(--line); }
.search-field { flex: 1; position: relative; }
.search-field > span:not(.sr-only) { position: absolute; left: 14px; top: 9px; color: #7f939d; font-size: 23px; }
.search-field input { padding-left: 42px; }
.filter-field { width: 235px; }
.columns-menu { position: relative; }
.columns-popover { width: 300px; max-height: 360px; padding: 14px; position: absolute; top: calc(100% + 6px); right: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow); z-index: 30; }
.columns-group { margin-bottom: 14px; }
.columns-group:last-child { margin-bottom: 0; }
.columns-group h4 { margin: 0 0 8px; color: var(--navy); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.columns-option { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.columns-option input { width: auto; min-height: 0; }
.table-wrap { flex: 1; min-height: 200px; overflow: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th { padding: 0; color: #748892; background: #f4f5f1; font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; position: sticky; top: 0; z-index: 5; }
.th-inner { display: flex; align-items: center; }
.th-sort { flex: 1 1 auto; width: auto; padding: 13px 16px; display: inline-flex; align-items: center; gap: 5px; border: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; }
.th-sort:hover { color: var(--navy); }
.sort-indicator { opacity: .45; }
.sort-indicator.active { color: var(--accent); opacity: 1; }
.th-filter { flex: 0 0 auto; padding: 0 14px 0 2px; border: 0; background: transparent; color: inherit; font-size: 11px; opacity: .5; }
.th-filter:hover { opacity: .85; }
.th-filter.active { color: var(--accent); opacity: 1; }
.filter-popover { width: 230px; max-height: 320px; padding: 12px; position: fixed; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: var(--shadow); z-index: 60; }
.filter-popover-actions { display: flex; justify-content: space-between; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.button-link { padding: 0; border: 0; color: var(--navy); background: transparent; font-size: 12px; font-weight: 800; }
.button-link:hover { text-decoration: underline; }
.filter-option { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.filter-option input { width: auto; min-height: 0; }
td { padding: 15px 16px; border-top: 1px solid #edf0ef; font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #faf8f2; }
/* Status color: accent bar on the first cell plus a faint tint over the row. */
tbody tr.has-status-color td { background: color-mix(in srgb, var(--status-color) 9%, white); }
tbody tr.has-status-color:hover td { background: color-mix(in srgb, var(--status-color) 16%, white); }
tbody tr.has-status-color td:first-child { box-shadow: inset 5px 0 0 var(--status-color); }
.claim-link { border: 0; color: var(--navy); background: transparent; font-weight: 850; padding: 0; }
.cell-secondary { display: block; margin-top: 3px; color: #80919a; font-size: 11px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 4px; color: #315f55; background: #e5f1ec; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-pill.finished { color: #607079; background: #e9edef; }
.attention { color: var(--accent); font-weight: 900; }
.row-open { border: 0; color: #78909b; background: transparent; font-size: 21px; }
.loading-state, .empty-state { padding: 70px 20px; color: var(--ink-soft); text-align: center; }
.empty-state h3 { margin: 10px 0 4px; color: var(--ink); }
.empty-state p { margin: 0; }
.empty-icon { font-size: 36px; }

.modal-layer { position: fixed; inset: 0; z-index: 100; }
.modal-layer:not([hidden]) { display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,31,44,.5); backdrop-filter: blur(6px); }
.drawer { width: min(1100px, 100%); height: min(90vh, 100%); max-width: 100%; max-height: 100%; display: flex; flex-direction: column; border-radius: 8px; background: var(--paper); box-shadow: 0 24px 70px rgba(0,0,0,.28); position: relative; overflow: hidden; animation: modal-in .18s ease-out; }
@keyframes modal-in { from { transform: scale(.97); opacity: .6; } }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.modal-size-button { font-size: 19px; }
.modal-maximized { width: 100% !important; height: 100% !important; }
/* Centered modal: the JS doubles the pointer delta so the corner follows the cursor. */
.modal-resize-handle { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize; touch-action: none; z-index: 2;
  background: linear-gradient(135deg, transparent 50%, var(--line) 50%, var(--line) 58%, transparent 58%, transparent 70%, var(--line) 70%, var(--line) 78%, transparent 78%); }
.modal-maximized .modal-resize-handle { display: none; }
.drawer-header { padding: 23px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; font-size: 27px; font-weight: 800; }
.tabs { padding: 0 26px; display: flex; gap: 24px; border-bottom: 1px solid var(--line); }
.tab { padding: 15px 2px 12px; border: 0; border-bottom: 3px solid transparent; color: var(--ink-soft); background: transparent; font-size: 13px; font-weight: 800; }
.tab.active { color: var(--navy); border-bottom-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; }
.subtabs { margin: -26px -26px 22px; padding: 0 26px; display: flex; gap: 20px; background: #f7f8f5; border-bottom: 1px solid var(--line); }
.subtab { padding: 13px 2px 11px; border: 0; border-bottom: 3px solid transparent; color: var(--ink-soft); background: transparent; font-size: 12px; font-weight: 800; }
.subtab.active { color: var(--navy); border-bottom-color: var(--accent); }
[data-claim-form], [data-tab-panel="documents"], [data-tab-panel="history"] { padding: 26px; }
.form-section { margin-bottom: 28px; }
.form-section h3 { margin: 0 0 14px; color: var(--navy); font-size: 13px; letter-spacing: .04em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-field.wide { grid-column: 1 / -1; }
.form-field small { color: #87979e; font-weight: 500; }
.form-field input[readonly] { color: #71838c; background: #f1f3f2; }
.geometry-editor { margin-top: 18px; }
.geometry-editor h4 { margin: 0 0 10px; color: var(--navy); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.geometry-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.geometry-row { display: grid; grid-template-columns: 1.4fr 90px 1fr auto; gap: 8px; align-items: center; }
.geometry-row select, .geometry-row input { min-height: 40px; }
.geometry-row .button-danger { min-height: 40px; padding: 0 14px; }
.form-actions { padding-top: 20px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.form-actions-top { margin-bottom: 24px; padding-top: 0; padding-bottom: 18px; border-top: 0; border-bottom: 1px solid var(--line); }
.form-spacer { flex: 1; }
.upload-box { padding: 16px; display: grid; grid-template-columns: 180px minmax(0,1fr) auto; align-items: end; gap: 12px; border: 1px dashed #b8c8cc; border-radius: 6px; background: #f7f8f5; }
[data-rescan-duplicates] { margin: 12px 0; }
.file-picker input { padding: 8px; }
.document-list { margin-top: 18px; display: grid; gap: 9px; }
.document-row { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 4px; }
.document-row a { color: var(--navy); font-weight: 750; text-decoration: none; }
.document-row a:hover { text-decoration: underline; }
.document-row small { display: block; margin-top: 3px; color: var(--ink-soft); }
.document-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.document-thumb { flex-shrink: 0; display: block; width: 48px; height: 48px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.document-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.document-row-duplicate { border-color: #d9a441; background: #fdf8ee; }
.document-duplicate-flag { color: #9a6b0a !important; }
.timeline { display: grid; gap: 0; }
.timeline-item { padding: 0 0 22px 24px; border-left: 2px solid #dbe4e3; position: relative; }
.timeline-item::before { content: ""; width: 10px; height: 10px; position: absolute; top: 3px; left: -6px; border: 2px solid var(--paper); border-radius: 50%; background: var(--accent); }
.timeline-item strong { display: block; font-size: 13px; }
.timeline-item p { margin: 5px 0; color: var(--ink-soft); font-size: 13px; }
.timeline-item small { color: #91a0a6; font-size: 11px; }
.action-add { margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.action-add select, .action-add input { flex: 1; min-width: 160px; }
.reanalyze-result { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 4px; background: #f7f8f5; }
.reanalyze-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.reanalyze-controls label { display: flex; align-items: center; gap: 7px; }
.reanalyze-controls input[type="checkbox"] { width: auto; min-height: 0; }
.action-list { display: grid; gap: 10px; }
.action-row { padding: 12px 14px; display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 4px; }
.action-row.done { background: #f7f8f5; }
.action-row.done .action-row-head strong { color: var(--ink-soft); text-decoration: line-through; }
.action-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.action-row-head label { display: flex; align-items: center; gap: 8px; }
.action-row-head { flex-wrap: wrap; }
.action-row-head label { flex: 1; min-width: 180px; }
.action-row-head input[type=checkbox] { width: auto; min-height: 0; flex-shrink: 0; }
.due-badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 4px; color: #3d5360; background: #eef2f4; font-size: 11px; font-weight: 800; white-space: nowrap; }
.due-badge.due-soon { color: #8a4b00; background: #fdf0dc; }
.due-badge.due-overdue { color: white; background: var(--danger); }
.due-badge.due-none { color: #7a8a93; background: transparent; border: 1px dashed var(--line); }
.postpone-control { display: inline-flex; align-items: center; gap: 4px; }
.postpone-control input { width: 64px; min-height: 0; padding: 6px 8px; }
.postpone-control .button { padding: 6px 10px; }
.nav-count-alert { color: white; background: var(--danger); }
.open-actions-list { display: grid; gap: 10px; }
.open-action { padding: 12px 14px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; background: white; }
.open-action-main { flex: 1; min-width: 240px; }
.open-action-main p { margin: 6px 0; }
.open-action-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.open-action-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.triage-case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.action-type-term { margin-top: 10px; padding: 10px; display: grid; gap: 8px; border: 1px dashed var(--line); border-radius: 4px; }
[data-actions] > .intake-case { border-color: var(--accent); background: #fffaf2; }
.action-row p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.action-row-links { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 6px; border-top: 1px dashed var(--line); }
.action-email pre { white-space: pre-wrap; background: #f7f8f5; border-radius: 4px; padding: 10px; font: inherit; }
.action-documents-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; padding: 8px; background: #f7f8f5; border-radius: 4px; }
.action-shrink-all { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.action-shrink-all input[type="checkbox"] { width: auto; min-height: 0; flex-shrink: 0; }
.action-documents-toolbar input[type="range"] { width: 100px; min-height: 0; }
.action-documents-toolbar input[type="range"]:disabled { opacity: 0.4; }
.action-documents-toolbar > span { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.action-documents-toolbar-hint { flex-basis: 100%; font-size: 11px; color: var(--ink-soft); font-style: italic; }
.action-drag-all { cursor: grab; user-select: none; }
.action-drag-all:active { cursor: grabbing; }
.action-document-resize input[type="range"]:disabled { opacity: 0.4; }
.action-documents { display: grid; gap: 8px; }
.action-document-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
.action-document-checkbox input[type="checkbox"] { width: auto; min-height: 0; flex-shrink: 0; }
.action-document-row .document-thumb { cursor: grab; }
.action-document-row .document-thumb:active { cursor: grabbing; }
.action-document-meta { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-soft); }
.action-document-meta a { font-size: 13px; }
.action-document-meta small { display: block; margin-top: 2px; }
.action-document-drag-hint { font-style: italic; }
.action-document-buttons { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
[data-remove-document] { flex-shrink: 0; font-size: 16px; color: var(--ink-soft); line-height: 1; }
[data-remove-document]:hover { color: var(--danger); }
.action-document-resize { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.action-document-resize input[type="range"] { width: 100px; min-height: 0; }
.action-document-resize span { white-space: nowrap; }
.action-edit-form { margin-top: 8px; display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 4px; }
.action-edit-form textarea { min-height: 70px; }
.action-document-picker-wrap span { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.action-document-picker { display: grid; gap: 4px; max-height: 160px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 4px; }
.action-document-option { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.action-document-option input[type="checkbox"] { width: auto; min-height: 0; flex-shrink: 0; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.action-instructions-panel { margin-top: 8px; }
.action-instructions-panel form { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 4px; }
.action-instructions-panel textarea { min-height: 70px; }
.action-instructions-confirm { padding: 10px; border: 1px solid var(--accent); border-radius: 4px; background: #f7f8f5; display: grid; gap: 8px; }
.action-instructions-confirm pre { white-space: pre-wrap; background: var(--paper); border-radius: 4px; padding: 10px; font: inherit; }
.dialog { width: min(760px, 100%); max-width: 100%; max-height: 100%; display: flex; flex-direction: column; border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.dialog-body { flex: 1; min-height: 0; padding: 22px 26px 28px; overflow-y: auto; }
.manager-tabs { margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.manager-tabs button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-soft); background: white; font-weight: 700; }
.manager-tabs button.active { color: white; border-color: var(--navy); background: var(--navy); }
.open-threshold-form { margin-bottom: 18px; padding: 12px 14px; display: flex; align-items: flex-end; gap: 10px; border: 1px solid var(--line); border-radius: 4px; background: #f7f8f5; }
.open-threshold-form label { flex: 1; display: grid; gap: 6px; color: #324d5d; font-size: 12px; font-weight: 700; }
.open-threshold-form input { width: 110px; }
.manager-add { margin-bottom: 15px; display: grid; grid-template-columns: 1fr 110px auto; gap: 9px; }
.manager-add.no-sequence { grid-template-columns: 1fr auto; }
.manager-add.user-add-grid { grid-template-columns: 1fr 1fr 120px; }
.user-add-password { grid-column: 1 / 3; }
.manager-list { display: grid; gap: 7px; }
.manager-row { padding: 9px; display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 4px; background: white; }
.manager-row.no-sequence { grid-template-columns: 1fr auto; }
.manager-add.with-color { grid-template-columns: 1fr 110px auto auto; }
.manager-row.with-color { grid-template-columns: 1fr 90px auto auto; }
.lookup-color { display: flex; align-items: center; gap: 6px; }
.lookup-color input[type=checkbox] { width: auto; min-height: 0; }
.lookup-color input[type=color] { width: 42px; min-height: 0; height: 34px; padding: 2px; cursor: pointer; }
.preferences-form { display: grid; gap: 10px; margin-bottom: 18px; }
.preferences-form h4 { margin: 8px 0 0; }
.preference-colors { display: grid; gap: 6px; }
.preference-color-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; border: 1px solid var(--line); }
.guidelines-view { display: grid; gap: 24px; }
.guidelines-view h3 { margin: 0 0 6px; }
.guidelines-view p { margin: 0 0 10px; }
.guidelines-view details { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.guidelines-view summary { cursor: pointer; font-weight: 700; }
.guidelines-view details .guidelines-text { margin: 10px 0 0; }
.guidelines-text { padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: white; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; line-height: 1.5; }
.markdown-body { white-space: normal; font-size: 14px; line-height: 1.6; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: 22px 0 8px; color: var(--navy); line-height: 1.3; }
.markdown-body h1 { font-size: 22px; }
.markdown-body h2 { font-size: 18px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.markdown-body h3 { font-size: 15px; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: 14px; }
.markdown-body p { margin: 0 0 10px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 10px; padding-left: 22px; }
.markdown-body li { margin: 3px 0; }
.markdown-body li > ul, .markdown-body li > ol { margin: 3px 0 0; }
.markdown-body code { padding: 1px 5px; border-radius: 3px; background: #eef1ee; font-family: Consolas, "Courier New", monospace; font-size: .92em; }
.markdown-body pre { margin: 0 0 12px; padding: 12px; border-radius: 4px; background: #f3f5f2; overflow-x: auto; white-space: pre; }
.markdown-body pre code { padding: 0; background: none; }
.markdown-body blockquote { margin: 0 0 12px; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--ink-soft); }
.markdown-body hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.markdown-body a { color: var(--navy); }
.markdown-table { margin: 0 0 14px; overflow-x: auto; }
.markdown-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.markdown-table th, .markdown-table td { overflow-wrap: normal; padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-table th { position: static; color: var(--ink); background: #f3f5f2; font-size: 13px; font-weight: 800; letter-spacing: normal; text-transform: none; white-space: normal; }
.markdown-table tbody tr:nth-child(even) { background: #fafbf9; }
.guideline-note { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.guideline-note p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.guideline-impact { margin: 12px 0; padding: 10px; background: #f7f8f5; border-radius: 4px; }
.guideline-impact ul { margin: 8px 0; padding-left: 20px; }
.guideline-impact li { margin: 6px 0; }
.guideline-impact small { display: block; color: var(--ink-soft); }
.guideline-note [data-impact-panel] { margin-top: 10px; }
.action-type-create, .action-type-proposal { display: grid; gap: 10px; padding: 12px; margin: 12px 0 20px; border: 1px solid var(--line); border-radius: 4px; background: #f7f8f5; }
.action-type-create label, .action-type-proposal label { display: grid; gap: 5px; }
.action-type-create textarea, .action-type-proposal textarea { min-height: 80px; }
.action-type-proposal form { display: grid; gap: 10px; }
.action-type-proposal h4, .action-type-proposal p { margin: 0; }
[data-action-types-view] details { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; }
.guideline-note [data-impact-panel] label { display: grid; gap: 6px; margin: 10px 0; }

.email-import { margin-bottom: 20px; }
.email-drop-zone { padding: 22px; display: grid; justify-items: center; gap: 8px; text-align: center; border: 2px dashed var(--line); border-radius: 6px; background: #f8fafc; cursor: pointer; transition: border-color .15s, background .15s; }
.email-drop-zone span { max-width: 620px; color: var(--ink-soft); }
.email-drop-zone.drag-active { border-color: var(--accent); background: #fdece3; }
.email-drop-zone.busy { opacity: .65; pointer-events: none; }
.email-drop-zone-compact { margin-bottom: 16px; padding: 12px 16px; }
.email-drop-zone-compact span { max-width: none; }
.intake-instruction-prompt { display: grid; gap: 10px; }
.intake-instruction-prompt textarea { min-height: 80px; }
.loading-bar { height: 3px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: #f0d9c5; position: relative; }
[data-manager-loading].loading-bar { margin-top: 0; border-radius: 0; }
.loading-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 3px;
  background: var(--accent); animation: loading-bar-sweep 1.1s ease-in-out infinite;
}
@keyframes loading-bar-sweep {
  0% { left: -40%; }
  100% { left: 100%; }
}
.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.proposal-fields { margin: 0 0 14px; padding: 10px 12px; list-style: none; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; font-size: 13px; }
.proposal-fields li { padding: 2px 0; }
.proposal-manual-search { margin: 14px 0; }
.proposal-manual-search label span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-soft); }
.proposal-manual-search input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.proposal-manual-search .manager-list { margin-top: 8px; }
.intake-case { margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.intake-case:last-child { margin-bottom: 0; }
.intake-case h4 { margin: 0 0 8px; }
.intake-case.confirmed { background: #f8fafc; }
.intake-actions { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 12px; }
.intake-actions li { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.intake-actions li:last-child { padding-bottom: 0; border-bottom: none; }
.intake-actions label { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.intake-actions input[type="checkbox"] { width: auto; min-height: 0; flex-shrink: 0; margin-top: 3px; }
.intake-action-body { display: grid; gap: 5px; }
.intake-action-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.intake-action-description { color: var(--ink-soft); line-height: 1.5; }
.intake-feedback { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.intake-feedback label span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-soft); }
.intake-feedback textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font: inherit; resize: vertical; margin-bottom: 8px; }
.guideline-suggestion { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 6px; background: #fdece3; font-size: 13px; }
.guideline-suggestion p { margin: 0 0 8px; }
.email-analysis-result { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.email-analysis-result h4 { margin: 0 0 8px; }
.email-analysis-result p { margin: 6px 0; }
.user-row { grid-template-columns: 1fr 120px 100px auto; }
.user-guideline-access { margin-top: 6px; color: var(--ink-soft); }
.row-actions { display: flex; gap: 6px; }
.password-form { grid-template-columns: 1fr; max-width: 360px; }
.manager-subtitle { margin: 22px 0 8px; font-size: 15px; }
.manager-subtitle:first-child { margin-top: 0; }
.alert-info { color: #24507a; border: 1px solid #c8dbee; background: #f1f7fc; margin: 0 0 16px; }
.checkbox-label input { width: auto; min-height: 0; flex-shrink: 0; }
.login-remember { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.login-remember input { width: auto; min-height: 0; flex-shrink: 0; }
.manager-forced .icon-button[data-close-manager] { display: none; }
.manager-forced .modal-backdrop { cursor: not-allowed; }
.mfa-steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.mfa-setup { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.mfa-qr { border: 1px solid var(--line); border-radius: 6px; background: white; }
.mfa-secret { display: block; padding: 10px 12px; border-radius: 4px; background: #f7f8f5; font-size: 15px; letter-spacing: 0.06em; word-break: break-all; }
.mfa-code-form { grid-template-columns: 1fr auto; max-width: 360px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.recovery-codes code { padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; background: #f7f8f5; font-size: 15px; letter-spacing: 0.08em; text-align: center; }
.recovery-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 13px 16px; border-radius: 6px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; max-width: 520px; }
  .login-brand { min-height: 280px; padding: 42px; }
  .login-brand .brand-mark { margin-bottom: 30px; }
  .login-brand h1 { font-size: 43px; }
  .login-intro { margin: 18px 0 22px; font-size: 15px; }
  .login-card { padding: 44px 42px; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 28px 22px 44px; }
  .metrics { grid-template-columns: 1fr 1fr 1fr; }
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex; }
}

@media (max-width: 650px) {
  .app-shell { padding-top: 64px; }
  .workspace { height: calc(100vh - 64px); height: calc(100dvh - 64px); }
  .topbar { height: 64px; padding: 0 14px; }
  .brand > span:last-child { display: none; }
  .topbar-actions { gap: 5px; }
  .account-button { padding-right: 2px; }
  .content { padding: 22px 14px 36px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 34px; }
  .page-heading .button { min-width: 46px; padding: 10px; font-size: 0; }
  .page-heading .button span { font-size: 21px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 100px; padding: 16px; }
  .metric-card:last-child { display: none; }
  .toolbar { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .filter-field { width: auto; flex: 1; }
  th, td { padding: 13px 11px; }
  .th-sort { padding: 13px 11px; }
  .columns-popover { width: min(300px, 92vw); }
  .modal-layer:not([hidden]) { padding: 0; }
  .drawer { width: 100% !important; height: 100% !important; border-radius: 0; }
  .modal-resize-handle, .modal-size-button { display: none; }
  .drawer-header, [data-claim-form], [data-tab-panel="documents"], [data-tab-panel="actions"], [data-tab-panel="history"] { padding-left: 18px; padding-right: 18px; }
  .subtabs { margin: -18px -18px 22px; padding: 0 18px; gap: 14px; }
  .tabs { padding: 0 18px; gap: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.wide { grid-column: auto; }
  .geometry-row { grid-template-columns: 1fr; }
  .upload-box { grid-template-columns: 1fr; }
  .manager-add, .manager-row, .user-row, .manager-add.user-add-grid { grid-template-columns: 1fr; }
  .user-add-password { grid-column: auto; }
  .dialog { width: 100% !important; max-height: 100%; height: 100% !important; margin: 0; border-radius: 0; }
}

/* Only rendered when RECLAMATIE_INSTANCE is set (test Pi); never blocks clicks. */
.instance-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 300; padding: 3px 14px; border-radius: 0 0 6px 6px; background: repeating-linear-gradient(135deg, #b3261e 0 12px, #8c1d17 12px 24px); color: white; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
body:has(.instance-banner)::after { content: ""; position: fixed; inset: 0; z-index: 300; border: 4px solid #b3261e; pointer-events: none; }
