:root {
  color-scheme: light;
  --sidebar: #172521;
  --sidebar-soft: #22352f;
  --accent: #1f7a4d;
  --accent-dark: #16613d;
  --accent-soft: #e6f3ec;
  --bg: #eef3f1;
  --panel: #ffffff;
  --line: #d9e3df;
  --text: #20312d;
  --muted: #667873;
  --danger: #9b2c2c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: #f5fbf8;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

.brand-title {
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle,
.nav-item small {
  color: rgba(245, 251, 248, 0.62);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item,
.diagnostics-link {
  min-height: 38px;
  border-radius: 6px;
  padding: 9px 10px;
  color: #f5fbf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.nav-item.active,
.diagnostics-link.active {
  background: var(--accent);
  text-decoration: none;
}

.nav-item.disabled {
  color: rgba(245, 251, 248, 0.46);
  cursor: default;
}

.diagnostics-link {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.06);
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  background: #fbfdfc;
  border-bottom: 1px solid var(--line);
  padding: 16px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content {
  padding: 20px 26px 32px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.panel h2 {
  margin: 0;
  padding: 13px 16px;
  font-size: 14px;
  color: #38534c;
  background: #f4f8f6;
  border-bottom: 1px solid var(--line);
}

.panel-header {
  padding: 13px 16px;
  background: #f4f8f6;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  padding: 0;
  border: 0;
  background: transparent;
}

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

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 24px;
}

.button {
  min-height: 34px;
  border: 1px solid #b8c9c3;
  border-radius: 6px;
  padding: 7px 13px;
  background: #ffffff;
  color: #243b34;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.button:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.ghost {
  background: transparent;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e4ebe8;
  text-align: left;
  vertical-align: top;
}

th {
  color: #49645d;
  font-weight: 600;
  background: #fbfdfc;
}

.search-row {
  padding: 14px 16px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.search-row input {
  flex: 1;
  min-width: 220px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bacac4;
  border-radius: 6px;
  padding: 8px 9px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: #ffffff;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 122, 77, 0.18);
  border-color: var(--accent);
}

.form-section {
  overflow: visible;
}

.form-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 13px 14px;
}

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

.court-case-layout { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 14px; align-items: start; }
.court-case-list-panel { min-width: 0; }.court-case-filters { flex-wrap: wrap; align-items: end; }.court-case-filters input, .court-case-filters select { width: auto; min-width: 140px; flex: 1 1 150px; }.court-case-table { min-width: 1100px; }.court-case-table tbody tr { cursor: pointer; }.court-case-table tbody tr:hover, .court-case-table tbody tr.selected { background: #eaf5ef; }.court-case-table td { font-size: 12px; }.status-chip { display: inline-block; padding: 3px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; white-space: nowrap; }
.court-case-inspector { position: sticky; top: 14px; padding: 0; }.inspector-header { padding: 14px 16px; background: #f4f8f6; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; position: relative; }.inspector-header span { color: var(--muted); font-size: 11px; letter-spacing: .08em; }.inspector-header button { position: absolute; right: 14px; top: 9px; border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }.court-case-inspector.collapsed > :not(.inspector-header) { display: none; }.inspector-ident, .inspector-facts, .case-nav, .storage-path { padding: 14px 16px; margin: 0; }.inspector-ident { display: flex; flex-direction: column; gap: 5px; }.inspector-ident strong { font-size: 17px; margin-bottom: 5px; }.inspector-facts { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }.inspector-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }.inspector-facts dt { color: var(--muted); }.inspector-facts dd { margin: 0; text-align: right; font-weight: 600; }.case-nav { display: flex; flex-direction: column; gap: 4px; }.case-nav a { padding: 9px 8px; border-radius: 5px; color: var(--text); }.case-nav a:hover { background: var(--accent-soft); text-decoration: none; }.storage-path { color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); word-break: break-word; }
.court-case-detail h2 { margin-bottom: 0; }.court-case-detail h3 { margin: 0 0 8px; font-size: 14px; }.court-case-detail p { line-height: 1.6; }.court-case-detail .summary-grid { padding: 16px; }.document-dropzone { margin: 16px; padding: 16px; border: 1px dashed #9db8aa; border-radius: 8px; background: #f7fbf8; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }.document-dropzone span { color: var(--muted); font-size: 12px; }.document-dropzone input[type=file] { width: auto; }.field-wide { grid-column: span 2; }.form-error { padding: 12px 16px; color: var(--danger); background: #fff3f3; }.questions-editor { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.questions-editor .muted { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }.form-actions { padding: 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.placeholder-content { padding: 20px; }.placeholder-content .muted { color: var(--muted); }
.folder-path { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 400; }.file-manager-toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fbfdfc; }.file-manager-toolbar form { display: flex; gap: 6px; flex-wrap: wrap; }.file-manager-toolbar input[type=file] { width: 220px; }.file-manager-toolbar input:not([type=file]) { width: 210px; }.file-breadcrumbs { display: flex; align-items: center; gap: 7px; padding: 12px 16px 5px; font-size: 13px; flex-wrap: wrap; }.file-breadcrumbs span { color: var(--muted); }.file-breadcrumbs .current { color: var(--text); font-weight: 700; }.file-manager-caption { padding: 5px 16px 12px; color: var(--muted); font-size: 12px; }.file-manager-table td { vertical-align: middle; }.file-manager-table td:first-child { min-width: 300px; }.excerpt-form-row td { background: #f5faf7; }.excerpt-form-row form { display: flex; gap: 7px; flex-wrap: wrap; }.excerpt-form-row input { width: 220px; }.excerpt-form-row input[name=page_spec] { width: 190px; }
.inline-file-action { display: inline-flex; gap: 4px; margin-right: 4px; }.inline-file-action input { width: 125px; padding: 5px 6px; font-size: 12px; }.inline-file-action .button { min-height: 28px; padding: 4px 7px; font-size: 11px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 0 16px 14px; }.image-tile { display: flex; flex-direction: column; gap: 5px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fbfdfc; font-size: 11px; cursor: pointer; }.image-tile img { width: 100%; height: 100px; object-fit: contain; background: #eef3f1; }.image-tile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-hint { color: var(--muted); font-size: 11px; }
.date-text { min-width: 150px; }
.investigation-picker { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; min-width: 0; }
.investigation-picker legend { padding: 0 5px; font-weight: 700; color: var(--text); }
.investigation-options { display: flex; flex-wrap: wrap; gap: 8px; }
.investigation-option { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fbfdfc; cursor: pointer; }
.investigation-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.investigation-option span { font-size: 13px; }
.investigation-option small { color: var(--muted); font-size: 11px; }
.investigation-dependency-note { margin: 8px 0 0; color: var(--accent-dark); font-size: 12px; }
.investigation-dependency-note .button { margin-left: 6px; min-height: 26px; padding: 4px 8px; font-size: 11px; }
.investigation-summary { margin-top: 8px; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.investigation-summary span { display: inline-block; padding: 3px 7px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-dark); white-space: nowrap; font-size: 11px; }
.investigation-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.investigation-chips span { display: inline-block; padding: 2px 5px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-dark); white-space: nowrap; font-size: 10px; }
.inspector-investigation-chips { justify-content: flex-end; }
@media (max-width: 1100px) { .court-case-layout { grid-template-columns: 1fr; }.court-case-inspector { position: static; }.court-case-detail .summary-grid { grid-template-columns: 1fr; } }

/* Court cases stage 1: dense desktop registry, inspector and scoped file manager. */
.court-case-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.court-case-filters { padding: 10px 12px; gap: 7px; }
.court-case-filters input,
.court-case-filters select { min-height: 30px; }
.court-case-table th,
.court-case-table td { padding: 7px 9px; line-height: 1.25; }
.court-case-table tbody tr.selected { box-shadow: inset 3px 0 0 var(--accent); }
.court-case-inspector { overflow: hidden; }
.inspector-header { padding: 11px 14px; gap: 2px; }
.inspector-header strong { font-size: 20px; line-height: 1.1; }
.inspector-ident,
.inspector-facts,
.case-nav,
.storage-path,
.inspector-state,
.inspector-next { padding: 10px 14px; }
.number-edit-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: end; padding: 10px 14px; border-top: 1px solid var(--line); }
.number-edit-form label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.number-edit-form input { min-width: 0; min-height: 30px; }
.inspector-facts div { padding: 4px 0; }
.inspector-facts dd { max-width: 190px; }
.case-nav { gap: 2px; }
.case-nav a { display: flex; justify-content: space-between; align-items: center; min-height: 30px; padding: 6px 8px; border-radius: 5px; }
.case-nav a.active { background: #e7f4ec; box-shadow: inset 3px 0 0 var(--accent); color: var(--accent-dark); font-weight: 700; }
.storage-path { font-size: 11px; }
.inspector-state { border-top: 1px solid var(--line); }
.inspector-next { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.inspector-next span { display: block; margin-bottom: 3px; }
.inspector-next strong { color: var(--text); font-size: 13px; }
.court-overview { padding: 14px 16px; }
.overview-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.overview-title-row h2 { margin: 0; font-size: 20px; line-height: 1.2; }
.overview-subtitle { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
.court-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 !important; }
.court-summary-grid > div { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fff; }
.court-summary-grid h3 { margin: 0 0 7px; color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.court-summary-grid dl { margin: 0; display: grid; gap: 4px; }
.court-summary-grid dt { color: var(--muted); font-size: 11px; }
.court-summary-grid dd { margin: 0 0 3px; font-weight: 650; overflow-wrap: anywhere; }
.case-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.case-read-actions { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.case-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.case-section-title h3 { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.case-questions-read ol { margin: 8px 0 0 20px; padding: 0; display: grid; gap: 6px; }
.case-questions-read li { line-height: 1.45; }
.case-edit-form { margin-top: 8px; }
.case-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 9px 10px; }
.case-edit-grid textarea { min-height: 48px; resize: vertical; }
.case-inline-edit-form { display: grid; gap: 8px; margin-top: 8px; }
.case-inline-edit-form textarea { min-height: 72px; resize: vertical; }
.case-edit-actions { padding-top: 10px; border-top: 1px solid var(--line); }
.court-materials { position: relative; overflow: hidden; }
.court-materials .materials-browser-mode { position: relative; min-width: 0; }
.court-materials .materials-header { position: relative; z-index: 3; display: grid; gap: 8px; padding: 10px 12px 9px; border-bottom: 1px solid var(--line); background: #fff; overflow: visible; }
.court-materials .materials-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.court-materials .materials-toolbar > .button { min-height: 30px; padding: 5px 9px; white-space: nowrap; }
.court-materials .materials-upload-form { display: contents; }
.court-materials .materials-operation-error { margin: 8px 12px 0; }
.court-materials .materials-tree-section { display: grid; gap: 5px; padding: 9px 12px 10px; border-bottom: 1px solid var(--line); background: #fbfdfc; }
.court-materials .materials-section-heading h3,
.court-materials .materials-content-heading h3 { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.court-materials .materials-tree { max-height: clamp(150px, 27vh, 280px); padding: 2px 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.court-materials .materials-tree-row { display: flex; min-width: 0; min-height: 29px; align-items: center; gap: 3px; padding: 2px 4px 2px calc(3px + (var(--materials-depth) * 16px)); border-radius: 5px; color: var(--text); }
.court-materials .materials-tree-row[hidden] { display: none; }
.court-materials .materials-tree-row:hover { background: #f0f6f3; }
.court-materials .materials-tree-row.active { background: #e7f4ec; box-shadow: inset 3px 0 0 var(--accent); color: var(--accent-dark); }
.court-materials .materials-tree-toggle,
.court-materials .materials-tree-toggle-placeholder { width: 22px; min-width: 22px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 4px; background: transparent; color: #61736a; font: inherit; font-size: 15px; line-height: 1; }
.court-materials .materials-tree-toggle { cursor: pointer; }
.court-materials .materials-tree-toggle:hover,
.court-materials .materials-tree-toggle:focus-visible { background: #dbece3; color: var(--accent-dark); outline: none; }
.court-materials .materials-folder-name { display: flex; min-width: 0; flex: 1; align-items: center; gap: 7px; color: inherit; font-size: 12px; font-weight: 650; overflow: hidden; text-decoration: none; }
.court-materials .materials-folder-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.court-materials .materials-folder-icon { flex: 0 0 auto; width: 18px; color: #b58724; font-size: 14px; line-height: 1; text-align: center; }
.court-materials .materials-tree-row .materials-menu-button { opacity: 0; }
.court-materials .materials-tree-row:hover .materials-menu-button,
.court-materials .materials-tree-row.active .materials-menu-button,
.court-materials .materials-tree-row .materials-menu-button:focus-visible { opacity: 1; }
.court-materials .materials-tree-create-row { min-width: 0; display: flex; align-items: center; gap: 5px; margin: 2px 4px 3px calc(29px + (var(--materials-depth) * 16px)); padding: 4px 5px; border: 1px solid #abd0bd; border-radius: 5px; background: #fff; box-shadow: 0 4px 12px rgba(31, 45, 58, .08); }
.court-materials .materials-tree-create-row[hidden] { display: none; }
.court-materials .materials-tree-create-row input:not([type=hidden]) { min-width: 0; width: 100%; height: 29px; padding: 4px 7px; }
.court-materials .materials-tree-editor-action { width: 28px; min-width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); font: inherit; font-weight: 800; cursor: pointer; }
.court-materials .materials-tree-editor-action:hover { border-color: #9bbdac; color: var(--accent-dark); }
.court-materials .materials-tree-editor-action.confirm { border-color: var(--accent); background: var(--accent); color: #fff; }
.court-materials .materials-content-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.court-materials .materials-content-heading > div { display: grid; gap: 3px; min-width: 0; }
.court-materials .materials-content-heading span { color: var(--muted); font-size: 12px; }
.court-materials .materials-directory-row { cursor: default; }
.court-materials .materials-directory-row:hover,
.court-materials .materials-directory-row:focus-visible { background: #f3f8f5; outline: none; }
.court-materials .materials-table-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.court-materials .empty-cell { height: auto; padding: 22px 12px; color: var(--muted); line-height: 1.45; text-align: center; white-space: normal; }
.court-materials .empty-cell span { font-size: 11px; }
.court-materials .materials-drop-overlay { position: absolute; z-index: 20; inset: 8px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; border: 2px dashed #6eae8b; border-radius: 9px; background: rgba(238, 248, 242, .96); color: var(--text); text-align: center; pointer-events: none; opacity: 0; transform: scale(.99); transition: opacity .12s ease, transform .12s ease; }
.court-materials .materials-drop-overlay strong { font-size: 16px; }
.court-materials .materials-drop-overlay span { color: var(--muted); font-size: 12px; }
.court-materials .materials-drop-overlay b { color: var(--accent-dark); font-size: 13px; }
.court-materials.drag-active .materials-drop-overlay { opacity: 1; transform: scale(1); }
.court-materials .materials-extract-mode { min-width: 0; }
.court-materials .materials-extract-header { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f4f8f6; }
.court-materials .materials-extract-header h2 { margin: 0; font-size: 14px; }
.court-materials .materials-extract-header p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.court-materials .materials-excerpt-workspace { display: grid; gap: 10px; padding: 12px; }
.materials-file-menu { position: fixed; z-index: 90; display: grid; min-width: 210px; padding: 4px; border: 1px solid #bfd2c8; border-radius: 7px; background: #fff; box-shadow: 0 12px 28px rgba(31, 45, 58, .22); }
.materials-file-menu-item { width: 100%; padding: 8px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.materials-file-menu-item:hover, .materials-file-menu-item:focus-visible { background: var(--accent-soft); color: var(--accent-dark); outline: 0; }
.materials-file-menu-item.danger { color: var(--danger); }
.materials-file-menu-item.danger:hover, .materials-file-menu-item.danger:focus-visible { background: #fff1f1; color: var(--danger); }
.materials-menu-button { min-width: 28px; width: 28px; min-height: 26px; height: 26px; padding: 0; font-size: 17px; line-height: 1; }
.materials-popover-field { display: grid; gap: 5px; color: var(--text); font-size: 11px; font-weight: 700; text-align: left; }
.materials-popover-field small { color: var(--muted); font-size: 10px; font-weight: 500; }
.materials-popover-field input { width: 100%; min-height: 34px; }
.materials-popover-actions { display: flex; justify-content: flex-end; gap: 7px; padding-top: 2px; }
.materials-upload-status { flex: 1 0 100%; min-height: 18px; padding-top: 1px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.materials-upload-status.error { color: var(--danger); }
.materials-upload-status.saved { color: #12643f; font-weight: 700; }
.materials-upload-panel { margin: 7px 12px 0; padding: 7px 9px; border: 1px solid #bfd2c8; border-radius: 7px; background: #fbfdfc; box-shadow: 0 3px 10px rgba(31, 45, 58, .05); }
.materials-upload-panel[hidden] { display: none; }
.materials-upload-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.materials-upload-panel > header strong { color: var(--text); font-size: 12px; }
.materials-upload-panel > header span { color: var(--muted); font-size: 11px; text-align: right; }
.materials-upload-overall,
.materials-upload-job-progress { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: 8px; }
.materials-upload-overall[hidden] { display: none; }
.materials-upload-overall { margin-top: 5px; padding-bottom: 5px; border-bottom: 1px solid #dce8e1; }
.materials-upload-progress { height: 5px; overflow: hidden; border-radius: 999px; background: #dfe9e4; }
.materials-upload-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .12s linear; }
.materials-upload-overall > b,
.materials-upload-job-progress > b { color: var(--muted); font-size: 10px; text-align: right; }
.materials-upload-jobs { max-height: 230px; overflow-y: auto; }
.materials-upload-job { display: grid; gap: 4px; padding: 6px 0; border-bottom: 1px solid #e5ece8; }
.materials-upload-job:last-child { border-bottom: 0; padding-bottom: 1px; }
.materials-upload-panel.single-file { padding-block: 6px; }
.materials-upload-panel.single-file > header,
.materials-upload-panel.single-file .materials-upload-overall { display: none; }
.materials-upload-panel.single-file .materials-upload-job { padding-top: 0; }
.materials-upload-job-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.materials-upload-job-heading strong { min-width: 0; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.materials-upload-job-heading span { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 700; }
.materials-upload-job.uploaded .materials-upload-job-heading span { color: #12643f; }
.materials-upload-job.error .materials-upload-job-heading span { color: var(--danger); }
.materials-upload-job.cancelled .materials-upload-job-heading span { color: #7b6a55; }
.materials-upload-job.error .materials-upload-progress i { background: var(--danger); }
.materials-upload-job-details { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; color: var(--muted); font-size: 10px; }
.materials-upload-job-details > span + span::before { content: "·"; margin-right: 8px; }
.materials-upload-job-error { flex: 1 0 100%; margin: 0; color: var(--danger); line-height: 1.35; }
.materials-upload-job-action { margin-left: auto; padding: 2px 5px; border: 0; background: transparent; color: var(--accent-dark); font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; }
.materials-upload-job-action:hover,
.materials-upload-job-action:focus-visible { text-decoration: underline; outline: none; }
.materials-empty-excerpt-message { padding: 8px 9px; border-radius: 6px; background: #f6fbf8; color: var(--text); font-size: 12px; line-height: 1.45; text-align: left; }
.materials-excerpt-list { display: grid; gap: 6px; margin: 0; padding-left: 18px; color: var(--text); font-size: 12px; }
.materials-excerpt-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.materials-excerpt-list span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.materials-excerpt-list form { margin: 0; }
.materials-inline-rename { display: flex; min-width: 0; flex: 1; align-items: center; gap: 5px; }
.materials-inline-rename input:not([type=hidden]) { width: min(210px, 100%); min-width: 0; height: 29px; }
.materials-inline-rename span { color: var(--muted); }
.materials-inline-rename .materials-file-menu-item { width: auto; padding: 5px 6px; white-space: nowrap; }
@media (max-width: 620px) {
  .court-materials .materials-toolbar > .button { padding-inline: 7px; font-size: 11px; }
  .court-materials .materials-tree { max-height: 220px; }
  .court-materials .materials-extract-header { align-items: flex-start; flex-direction: column; gap: 7px; }
  .materials-upload-panel > header { align-items: flex-start; flex-direction: column; gap: 3px; }
  .materials-upload-panel > header span { text-align: left; }
  .materials-upload-job-details { align-items: flex-start; flex-direction: column; gap: 3px; }
  .materials-upload-job-details > span + span::before { content: none; }
  .materials-upload-job-action { margin-left: 0; padding-left: 0; }
}
.viewer-file-sequence { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.case-physical-path { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; background: #fbfdfc; overflow-wrap: anywhere; }
.case-physical-path strong { min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-manager { display: block; min-height: 300px; }
.file-list { min-width: 0; }
.file-list > .table-wrap { overflow: visible; }
.file-manager-table { width: 100%; min-width: 0; table-layout: fixed; }
.file-manager-table .file-name-column { width: auto; }
.file-manager-table .file-size-column { width: 82px; }
.file-manager-table .file-date-column { width: 86px; }
.file-manager-table .file-actions-column { width: 46px; }
.file-manager-table th,
.file-manager-table td { min-width: 0; padding: 6px 8px; font-size: 12px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-manager-table th { overflow: hidden; text-overflow: ellipsis; }
.file-name-content { display: flex; min-width: 0; align-items: center; gap: 7px; }
.file-name-content > a { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name-content input[type=checkbox],
.file-select-placeholder { width: 16px; min-width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; flex: 0 0 16px; }
.file-name-content .file-icon { flex: 0 0 auto; }
.file-manager-table td:last-child { overflow: visible; text-align: right; }
.file-name-content > .file-preview-thumb { width: 64px; height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: #f4f7f5; cursor: zoom-in; overflow: hidden; flex: 0 0 64px; }
.file-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-icon { min-width: 34px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 4px; background: #f6f8fa; color: var(--muted); font-size: 10px; font-weight: 800; }
.folder-link { font-weight: 700; }
.file-info-box { display: grid; gap: 4px; min-width: min(420px, 72vw); padding: 8px 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.file-info-box strong { color: var(--text); font-size: 12px; }
.inline-file-action { display: grid; gap: 6px; margin-top: 7px; }
.rename-file-action { grid-template-columns: minmax(130px, 1fr) auto auto; align-items: center; }
.rename-file-action span { color: var(--muted); font-size: 12px; font-weight: 700; }
.image-preview-dialog { max-width: min(1000px, 92vw); border: 0; border-radius: 8px; padding: 12px; }
.image-preview-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.image-preview-dialog img { max-width: 88vw; max-height: 78vh; object-fit: contain; display: block; margin-top: 10px; }
.court-placeholder { padding: 18px; min-height: 180px; }
.court-finance { padding: 0; overflow: hidden; }
.finance-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-height: 70px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f4f8f6; }
.finance-header h2 { padding: 0; border: 0; background: transparent; font-size: 18px; }
.finance-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.finance-next-action { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; max-width: 620px; }
.finance-next-action strong { color: var(--accent-dark); font-size: 13px; text-align: right; }
.finance-summary-strip { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); border-bottom: 1px solid var(--line); }
.finance-summary-strip div { padding: 8px 12px; border-right: 1px solid var(--line); }
.finance-summary-strip div:last-child { border-right: 0; }
.finance-summary-strip span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.finance-summary-strip strong { font-size: 15px; }
.finance-progress-label { padding: 6px 12px 4px; color: var(--muted); font-size: 11px; }
.finance-progress { height: 5px; background: #edf3f0; border-bottom: 1px solid var(--line); }
.finance-progress span { display: block; height: 100%; background: var(--accent); }
.finance-sections { display: grid; gap: 8px; padding: 10px; }
.finance-section { border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.finance-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; list-style: none; background: #fbfdfc; color: #38534c; font-size: 13px; font-weight: 800; }
.finance-section > summary::-webkit-details-marker { display: none; }
.finance-section > summary strong { color: var(--muted); font-size: 12px; font-weight: 700; text-align: right; }
.finance-subsection { border-top: 1px solid var(--line); }
.finance-subsection-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: #fbfdfc; color: #38534c; font-size: 12px; font-weight: 800; }
.finance-subsection-title strong { color: var(--muted); font-size: 12px; text-align: right; }
.finance-funding-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr); gap: 10px; padding: 10px; }
.finance-compact-pane { min-width: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.finance-pane-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fbfdfc; }
.finance-pane-title strong { color: var(--text); }
.finance-pane-title span { color: var(--muted); font-size: 12px; margin-right: auto; }
.finance-hint { margin: 0; padding: 6px 10px; color: var(--muted); font-size: 11px; background: #f8fbfa; }
.finance-row-list { padding: 8px 10px; }
.finance-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 12px; }
.finance-row:first-of-type { border-top: 0; }
.finance-row strong { display: block; font-size: 12px; }
.finance-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.court-execution .finance-summary-strip strong { font-size: 14px; }
.execution-not-required,
.execution-start { padding: 12px; }
.execution-not-required { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.execution-not-required > span { color: var(--muted); font-size: 13px; margin-right: auto; }
.execution-compact { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) auto; gap: 10px; align-items: center; padding: 10px 12px; }
.execution-compact span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.execution-compact strong { font-size: 13px; }
.compact-empty { margin: 0; padding: 12px 10px; color: var(--muted); font-size: 12px; }
.court-expert-entry { padding: 0; }
.expert-entry-header { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #f4f8f6; }
.expert-entry-header h2 { padding: 0; border: 0; background: transparent; font-size: 18px; }
.expert-entry-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.expert-object-list { padding: 12px; }
.expert-object-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.expert-object-row span,
.expert-object-row small { display: block; color: var(--muted); font-size: 12px; }
.expert-object-row strong { display: block; margin: 3px 0; font-size: 15px; }
.expert-compact-sections { display: grid; gap: 9px; padding: 10px; }
.expert-compact-section,
.drawer-editor-panel,
.execution-writ-card { border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.expert-compact-section { padding: 10px; }
.expert-section-heading,
.drawer-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.expert-section-heading h3,
.drawer-editor-heading h3 { margin: 0; color: #38534c; font-size: 12px; letter-spacing: .04em; }
.expert-compact-section p { margin: 4px 0; line-height: 1.45; }
.expert-compact-section span,
.expert-compact-section small { color: var(--muted); font-size: 12px; }
.expert-compact-section strong { display: block; margin-top: 2px; font-size: 15px; }
.expert-work-list { display: grid; gap: 6px; }
.expert-work-row { display: grid; grid-template-columns: minmax(90px, 1.1fr) minmax(90px, 1fr) minmax(90px, 1fr) auto; gap: 8px; align-items: center; padding: 7px 8px; border-top: 1px solid var(--line); font-size: 12px; }
.expert-work-row:first-child { border-top: 0; }
.drawer-editor-panel { margin: 10px; padding: 10px; background: #fbfdfc; }
.drawer-editor-panel .finance-form { padding: 0; }
.finance-result-section { margin: 10px; }
.status-chip.success { color: #14633f; background: #e8f6ef; }
.execution-writ-list { display: grid; gap: 8px; padding: 10px; }
.execution-writ-card { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; padding: 9px 10px; }
.execution-writ-card > div span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.execution-writ-card dl { display: grid; grid-template-columns: repeat(4, minmax(80px, 1fr)); gap: 8px; margin: 0; }
.execution-writ-card dt { color: var(--muted); font-size: 11px; }
.execution-writ-card dd { margin: 2px 0 0; font-weight: 700; font-size: 12px; }
.execution-add-writ { justify-self: end; }
.finance-dialog { width: min(760px, 92vw); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 22px 70px rgba(0,0,0,.26); }
.finance-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.finance-dialog h3 { grid-column: 1 / -1; margin: 0; padding: 0 0 4px; color: #38534c; font-size: 15px; }
.finance-dirty-note { align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #d9b44a; border-radius: 6px; background: #fff9df; color: #6f5610; font-size: 12px; font-weight: 800; }
.finance-dirty-note:not([hidden]) { display: flex; }
.finance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; }
.finance-block { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.finance-block.span-2, .span-2 { grid-column: span 2; }
.finance-block h3 { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfdfc; color: #38534c; font-size: 13px; }
.finance-block-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); background: #fbfdfc; }
.finance-block-title h3 { border: 0; background: transparent; }
.finance-block-title strong { padding-right: 12px; font-size: 13px; }
.finance-note { margin: 0; padding: 8px 12px; color: var(--muted); background: #f8fbfa; font-size: 12px; line-height: 1.45; }
.finance-inline-metrics { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 12px; color: var(--muted); font-size: 12px; }
.finance-form { padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.compact-finance-form { padding: 10px; gap: 8px; }
.finance-form label, .finance-mini-form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.finance-form input, .finance-form select, .finance-form textarea, .finance-mini-form input, .finance-mini-form select { min-width: 0; min-height: 30px; }
.finance-form textarea { min-height: 62px; resize: vertical; }
.finance-details { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.finance-details summary { width: fit-content; list-style: none; cursor: pointer; }
.finance-details summary::-webkit-details-marker { display: none; }
.finance-details[open] summary { margin-bottom: 10px; }
.finance-table th, .finance-table td { padding: 7px 9px; font-size: 12px; vertical-align: middle; }
.finance-table small, .court-case-table small { color: var(--muted); font-size: 11px; }
.finance-mini-form { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 6px; margin-top: 6px; }
.form-actions-inline { display: flex; justify-content: flex-end; gap: 7px; }
.checkbox-line { flex-direction: row !important; align-items: center; font-weight: 600 !important; }
.checkbox-line input { min-height: auto; width: auto; }
.muted-row { color: var(--muted); background: #f8f9f8; }
.questions-editor { grid-template-columns: 1fr; gap: 9px; }
.question-field { position: relative; }
.question-field textarea { min-height: 46px; overflow: hidden; resize: none; }
.question-remove { position: absolute; right: 7px; top: 24px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; }
.question-field:hover .question-remove,
.question-field:focus-within .question-remove { opacity: 1; }
.question-add-button { justify-self: flex-start; margin: 0 0 10px; }
.investigation-options { gap: 6px; }
.investigation-option { min-height: 44px; max-width: 210px; padding: 6px 8px; align-items: flex-start; flex-direction: column; gap: 2px; }
.investigation-option input { position: absolute; opacity: 0; pointer-events: none; }
.investigation-option span { line-height: 1.2; }
.investigation-option:has(input:checked) { border-color: var(--accent); background: #e7f4ec; box-shadow: inset 0 0 0 1px rgba(59, 145, 91, .18); }
@media (max-width: 1280px) { .court-summary-grid, .case-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.finance-summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }.finance-grid { grid-template-columns: 1fr; }.finance-block.span-2, .span-2 { grid-column: span 1; } }
@media (max-width: 900px) { .court-summary-grid, .case-card-grid, .case-edit-grid { grid-template-columns: 1fr; }.finance-summary-strip { grid-template-columns: 1fr 1fr; }.finance-form { grid-template-columns: 1fr; }.finance-header { flex-direction: column; }.finance-next-action { justify-content: flex-start; }.finance-next-action strong { text-align: left; }.finance-funding-grid { grid-template-columns: 1fr; }.execution-compact, .execution-writ-card, .execution-writ-card dl, .expert-work-row { grid-template-columns: 1fr; }.expert-object-row { align-items: flex-start; flex-direction: column; } }

.court-document-viewer-screen { min-height: 100vh; margin: 0; overflow: hidden; background: #eef3f1; color: var(--text); }
.viewer-toolbar { min-height: 44px; height: 44px; display: grid; grid-template-columns: minmax(92px, .7fr) auto minmax(0, 1fr) auto; align-items: center; gap: 4px; padding: 3px 7px; border-bottom: 1px solid #cbd8d2; background: #f8faf9; box-shadow: 0 1px 7px rgba(31, 55, 45, .06); }
.viewer-title { grid-column: 1; min-width: 0; display: grid; gap: 2px; }
.viewer-title span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.viewer-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.viewer-title small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.viewer-file-sequence { grid-column: 2; }
.viewer-controls { grid-column: 3; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 2px; overflow: visible; padding: 0; scrollbar-width: thin; scrollbar-color: #b8cbc2 transparent; }
.viewer-control-group { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 1px; min-height: 25px; padding: 1px; border: 1px solid #d4e1db; border-radius: 6px; background: #eef4f1; }
.viewer-control-group + .viewer-control-group { margin-left: 1px; }
.viewer-page-controls { background: #e8f2ed; }
.viewer-toolbar-actions { grid-column: 4; min-width: max-content; display: flex; align-items: flex-start; justify-self: end; gap: 4px; }
.viewer-toolbar .button { min-height: 23px; padding: 1px 6px; font-size: 11px; }
.viewer-toolbar-actions .button { white-space: nowrap; min-height: 23px; padding-inline: 6px; }
.viewer-toolbar .viewer-icon-button { width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-color: #bfd0c8; border-radius: 6px; background: linear-gradient(180deg, #ffffff 0%, #f5f9f7 100%); color: #29483f; box-shadow: 0 1px 2px rgba(31, 55, 45, .07); transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease, color 120ms ease, transform 120ms ease; }
.viewer-toolbar .viewer-icon-button:hover { border-color: #86ad9b; background: #fff; color: var(--accent-dark); box-shadow: 0 2px 6px rgba(31, 55, 45, .12); transform: translateY(-1px); }
.viewer-toolbar .viewer-icon-button:active { background: #e9f3ee; box-shadow: inset 0 1px 2px rgba(31, 55, 45, .12); transform: translateY(0); }
.viewer-toolbar .viewer-icon-button:focus-visible { outline: 2px solid rgba(31, 126, 81, .28); outline-offset: 2px; }
.viewer-button-icon { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.viewer-action-label { display: none; }
.viewer-download-control { position: relative; display: inline-flex; padding-bottom: 4px; }
.viewer-download-progress { position: absolute; right: 2px; bottom: 0; left: 2px; height: 3px; overflow: hidden; border-radius: 999px; background: #d8e4df; }
.viewer-download-progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .12s linear; }
.viewer-download-progress.indeterminate .viewer-download-progress-bar { width: 38%; animation: viewer-download-progress 1s ease-in-out infinite; }
.viewer-download-progress.error { background: #f0d0d0; }
.viewer-download-progress.error .viewer-download-progress-bar { width: 100%; background: var(--danger); }
.viewer-download-progress[hidden] { display: none !important; }
.viewer-toolbar-actions [data-viewer-download][aria-disabled="true"] { pointer-events: none; opacity: .62; }
@keyframes viewer-download-progress { from { transform: translateX(-115%); } to { transform: translateX(300%); } }
.viewer-control-group .button:not(.viewer-icon-button) { white-space: nowrap; min-height: 22px; padding-inline: 5px; }
.viewer-controls .button:disabled { opacity: .42; cursor: default; border-color: #cbd8d2; color: #83948e; }
.viewer-controls .button.active { border-color: var(--accent); background: #e5f4ec; color: var(--accent-dark); box-shadow: inset 0 0 0 1px rgba(31, 126, 81, .18), 0 1px 2px rgba(31, 55, 45, .08); }
.viewer-nav-button { min-width: 23px; padding-left: 4px; padding-right: 4px; font-size: 12px; line-height: 1; }
.viewer-counter,
.viewer-zoom { text-align: center; color: var(--muted); font-size: 11px; font-weight: 800; }
.viewer-counter { min-width: 70px; }
.viewer-zoom { min-width: 40px; }
.viewer-shell { height: calc(100vh - 44px); display: grid; grid-template-columns: 116px minmax(0, 1fr) 260px; min-height: 0; }
.viewer-thumbnails { min-height: 0; padding: 8px; display: grid; align-content: start; gap: 7px; overflow: auto; border-right: 1px solid #cbd8d2; background: #f9fbfa; }
.viewer-thumb { min-height: 46px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: #38534c; cursor: pointer; font-weight: 800; }
.viewer-thumb.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: #eef8f2; }
.viewer-thumb.image-thumb { position: relative; height: 74px; padding: 0; overflow: hidden; }
.viewer-thumb.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-thumb.image-thumb span { position: absolute; right: 4px; bottom: 4px; padding: 2px 5px; border-radius: 4px; color: #fff; background: rgba(31, 55, 45, .78); font-size: 10px; }
.viewer-thumb-note { color: var(--muted); font-size: 12px; line-height: 1.4; }
.viewer-stage { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; background: #dfe8e4; }
.viewer-pdf-viewport { flex: 0 0 auto; overflow: visible; background: #fff; line-height: 0; }
.viewer-pdf-page { display: block; max-width: none; max-height: none; background: #fff; box-shadow: 0 8px 22px rgba(31, 45, 58, .22); }
.viewer-pdf-page[hidden] { display: none; }
.viewer-pdf-viewport[hidden] { display: none; }
.viewer-preview-status { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; gap: 7px; width: min(420px, calc(100% - 40px)); padding: 18px 20px; border: 1px solid #c4d6ce; border-radius: 10px; background: rgba(251, 253, 252, .97); color: var(--text); text-align: center; box-shadow: 0 12px 30px rgba(31, 45, 58, .16); }
.viewer-preview-status[hidden] { display: none !important; }
.viewer-preview-status strong { color: #38534c; font-size: 14px; }
.viewer-preview-status span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.viewer-preview-status.error { border-color: #efc1c1; background: #fff8f8; }
.viewer-preview-status.error strong { color: var(--danger); }
.viewer-image { max-width: 100%; max-height: calc(100vh - 112px); object-fit: contain; transform-origin: center center; transition: transform 120ms ease; }
.viewer-actions { padding: 12px; border-left: 1px solid #cbd8d2; background: #f9fbfa; overflow: auto; }
.viewer-actions h2 { margin: 0 0 10px; font-size: 14px; color: #38534c; }
.viewer-excerpt-form { display: grid; gap: 9px; }
.viewer-excerpt-form label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.viewer-excerpt-form input { width: 100%; min-height: 32px; }
.viewer-excerpt-status { min-height: 18px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.viewer-excerpt-status.error { color: var(--danger); }
.viewer-excerpt-status.saved { color: #12643f; font-weight: 800; }
.viewer-native-fullscreen .viewer-thumbnails,
.viewer-native-fullscreen .viewer-actions { display: none; }
.viewer-native-fullscreen .viewer-shell { grid-template-columns: minmax(0, 1fr); }
.viewer-native-fullscreen .viewer-stage { background: #dfe8e4; }
@media (max-width: 980px) {
  .court-document-viewer-screen { overflow: auto; }
  .viewer-toolbar { height: auto; min-height: 0; grid-template-columns: 1fr; grid-template-rows: auto; align-items: stretch; }
  .viewer-title, .viewer-file-sequence, .viewer-controls, .viewer-toolbar-actions { grid-column: 1; grid-row: auto; }
  .viewer-controls { justify-content: flex-start; }
  .viewer-toolbar-actions { justify-content: flex-start; justify-self: start; flex-wrap: wrap; }
  .viewer-shell { height: auto; min-height: calc(100vh - 100px); grid-template-columns: 1fr; }
  .viewer-thumbnails { grid-auto-flow: column; grid-auto-columns: 82px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #cbd8d2; }
  .viewer-actions { border-left: 0; border-top: 1px solid #cbd8d2; }
}

.field span {
  color: #4f6760;
  font-size: 12px;
  font-weight: 600;
}

.field.wide {
  grid-column: 1 / -1;
}

.form-actions {
  position: sticky;
  bottom: 0;
  padding: 12px 0;
  background: linear-gradient(rgba(238, 243, 241, 0), var(--bg) 25%);
  display: flex;
  gap: 8px;
}

.notice {
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 14px;
  font-size: 14px;
}

.notice.success {
  background: var(--accent-soft);
  border: 1px solid #b9dbc9;
  color: #145a39;
}

.notice.error {
  background: #fff0f0;
  border: 1px solid #e8b8b8;
  color: var(--danger);
}

.empty,
.empty-cell {
  color: var(--muted);
  padding: 16px;
}

.ok,
.text-ok {
  color: #12643f;
  font-weight: 700;
}

.bad,
.text-bad {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Desktop-parity shell patterns for EVexpertMSK web screens. */
:root {
  --ev-navy: #10263a;
  --ev-navy-2: #17324a;
  --ev-bg: #edf4f9;
  --ev-panel: #ffffff;
  --ev-panel-line: #cfdde8;
  --ev-header: #e8f1f8;
  --ev-text: #26313c;
  --ev-muted: #728394;
  --ev-green-field: #eef9f4;
  --ev-green-line: #b8dccb;
  --ev-save: #ff0b63;
  --ev-blue-button: #5f8ab1;
}

.app-shell {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  background: var(--ev-navy);
  padding: 8px 4px;
  gap: 12px;
  align-items: center;
}

.brand {
  width: 100%;
  padding: 4px 0 10px;
  flex-direction: column;
  gap: 3px;
  border-bottom: 0;
}

.brand-mark {
  width: 31px;
  height: 31px;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
}

.brand-text {
  text-align: center;
}

.brand-title {
  font-size: 10px;
}

.brand-subtitle {
  display: none;
}

.nav {
  width: 100%;
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  width: 100%;
  padding: 0;
  border-radius: 0;
  justify-content: center;
  position: relative;
}

.nav-item.active {
  background: #244158;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: #ff0b63;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #c5d5e2;
  font-size: 17px;
  font-weight: 800;
}

.nav-icon svg,
.nav-icon img,
.ev-icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0;
  object-fit: contain;
}

.nav-icon img {
  filter: brightness(0) invert(1);
  opacity: .86;
}

.nav-item[data-nav-key="damage"] .nav-icon img {
  width: 36px;
  height: 28px;
  opacity: .98;
}

.nav-label,
.diagnostics-link {
  display: none;
}

.workspace {
  background: var(--ev-bg);
}

.object-screen .topbar {
  display: none;
}

.object-screen .content {
  padding: 0 14px 16px;
}

.ev-object-form {
  color: var(--ev-text);
}

.ev-toolbar {
  min-height: 43px;
  margin: 0 -14px 6px;
  padding: 4px 12px 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e6f0f8;
  border-bottom: 1px solid #d0deea;
}

.ev-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ev-toolbar-group > span {
  color: #536a80;
  font-size: 12px;
  font-weight: 800;
}

.ev-object-select .ev-select {
  width: 360px;
}

.ev-case-number .ev-input {
  width: 140px;
}

.ev-toolbar-spacer {
  flex: 1;
}

.ev-user-badge {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #2c4560;
  font-size: 11px;
  font-weight: 800;
}

.ev-user-text {
  color: #32495f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.ev-icon-button {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #36536b;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.ev-icon-button:hover { color: #173d60; }

.ev-page-title {
  margin: 0 0 6px;
  color: #171b20;
  font-family: Baskerville, Georgia, "Times New Roman", serif;
  font-size: 27px;
  line-height: 1;
  font-weight: 800;
}

.ev-object-layout {
  display: grid;
  grid-template-columns: minmax(840px, 1fr) 290px;
  gap: 8px;
  align-items: stretch;
  min-height: calc(100vh - 105px);
}

.ev-main-column {
  min-width: 0;
}

.ev-hero-grid {
  padding: 6px;
  display: grid;
  grid-template-columns: 1.06fr 0.84fr 1.24fr;
  gap: 6px;
  background: #e8f0f7;
  border: 1px solid #d1deea;
  border-radius: 8px;
}

.ev-right-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ev-panel,
.ev-info-card,
.ev-section {
  background: var(--ev-panel);
  border: 1px solid var(--ev-panel-line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(17, 38, 58, 0.03);
}

.ev-panel-primary {
  border-left: 4px solid var(--ev-save);
}

.ev-panel-body {
  padding: 8px 10px 9px;
  min-width: 0;
}

.ev-panel h2 {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #25313d;
  font-size: 15px;
  line-height: 1.05;
}

.ev-panel-caption {
  margin: 0 0 7px;
  color: #7a8896;
  font-size: 10px;
  font-weight: 650;
}

.ev-grid {
  display: grid;
  gap: 6px;
}

.ev-grid-two {
  grid-template-columns: minmax(220px, 1.18fr) minmax(135px, .82fr);
}

.ev-grid-date {
  grid-template-columns: repeat(6, 1fr);
}

.ev-grid-date .ev-field:nth-child(1) {
  grid-column: span 3;
}

.ev-grid-date .ev-field:nth-child(2) {
  grid-column: span 3;
}

.ev-grid-date .ev-field:nth-child(3),
.ev-grid-date .ev-field:nth-child(4),
.ev-grid-date .ev-field:nth-child(5) {
  grid-column: span 2;
}

.ev-grid-norm {
  grid-template-columns: minmax(0, 1fr) 160px;
}

.ev-grid-norm .ev-field:first-child,
.ev-grid-norm .ev-field:last-child {
  grid-column: 1;
}

.ev-length-field {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
}

.ev-field,
.ev-row-field,
.ev-paint-grid label,
.ev-equipment-summary label,
.ev-headlights-row label,
.ev-tab-select,
.ev-notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ev-field span,
.ev-row-field > span,
.ev-paint-grid span,
.ev-equipment-summary span,
.ev-headlights-row span,
.ev-tab-select span,
.ev-notes span {
  color: #647180;
  font-size: 10px;
  font-weight: 800;
}

.ev-wide {
  grid-column: 1 / -1;
}

.ev-input,
.ev-select,
.ev-object-form textarea {
  min-height: 32px;
  height: 32px;
  border: 1px solid #c7d4df;
  border-radius: 5px;
  padding: 4px 8px;
  color: #252a31;
  background: #fff;
  font-size: 16px;
  line-height: 1.2;
}

.ev-object-form textarea {
  height: auto;
  min-height: 44px;
}

/* Keep the research-object workspace on the same type scale as calculations. */
.ev-object-form .ev-input,
.ev-object-form .ev-select,
.ev-object-form textarea {
  min-height: 29px;
  height: 29px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 12px;
}

.ev-object-form textarea {
  height: auto;
  min-height: 44px;
}

.ev-green {
  background: #fff;
  border-color: #c7d4df;
}

.ev-button,
.ev-small-button {
  min-height: 31px;
  border: 1px solid #b7cadb;
  border-radius: 5px;
  padding: 5px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #2d455b;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.ev-save-button {
  min-width: 118px;
  color: #fff;
  border-color: #f31359;
  background: linear-gradient(90deg, var(--ev-save), #ff3a36);
  font-size: 15px;
}

.ev-secondary-button {
  min-width: 138px;
}

.ev-small-button {
  min-height: 28px;
  padding: 4px 11px;
  font-size: 12px;
  background: #eef5fb;
}

.ev-inline-action {
  display: grid;
  grid-template-columns: 1fr 94px;
  gap: 6px;
}

.ev-autoru {
  justify-content: end;
}

.ev-vin-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 29px;
  align-items: center;
  gap: 6px;
}

.ev-vin-control .ev-input {
  width: 100%;
  min-width: 0;
}

.ev-vin-link {
  width: 29px;
  height: 29px;
  padding: 5px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: #edf3f8;
  cursor: pointer;
}

.ev-vin-link:hover {
  background: #dfeaf3;
}

.ev-vin-link:disabled {
  opacity: .45;
  cursor: default;
}

.ev-vin-link img {
  width: 18px;
  height: 18px;
  opacity: .78;
}

.ev-plate-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 29px;
  align-items: center;
  gap: 6px;
  width: 157px;
}

.ev-plate-control .ev-input {
  width: 100% !important;
  min-width: 0;
}

.ev-autoru-link {
  flex: 0 0 29px;
}

.ev-mod-status {
  margin-left: 4px;
  font-size: 10px;
  color: #bb8200;
}

.ev-mod-status.confirmed {
  color: #168a51;
}

.ev-mod-status.unconfirmed {
  color: #8792a0;
}

.ev-mod-details {
  display: none;
}

.ev-action-status {
  display: none;
}

.ev-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  padding: 34px;
  display: grid;
  place-items: center;
  background: rgba(16, 38, 58, 0.38);
}

.ev-modal-backdrop[hidden] {
  display: none;
}

.ev-mod-dialog {
  width: min(980px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  padding: 13px 14px 12px;
  overflow: auto;
  border-radius: 8px;
  background: #eef3f7;
  color: #24313d;
  box-shadow: 0 18px 42px rgba(16, 38, 58, 0.26);
}

.ev-mod-dialog h2 {
  margin: 0 0 10px;
  color: #26313c;
  font-size: 17px;
}

.ev-mod-dialog h3 {
  margin: 0 0 8px;
  color: #394a5b;
  font-size: 13px;
}

.ev-mod-dialog-grid {
  display: grid;
  grid-template-columns: 4fr 6fr;
  gap: 12px;
}

.ev-mod-dialog-panel {
  padding: 9px;
  border: 1px solid #d8dee5;
  border-radius: 6px;
  background: #fff;
}

.ev-scan-drop {
  min-height: 300px;
  display: grid;
  place-items: center;
  border: 1px dashed #b9c6d1;
  border-radius: 5px;
  background: #f7f9fb;
  color: #667789;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.ev-scan-drop img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.ev-camera-panel {
  margin-top: 8px;
  border: 1px solid #cddae5;
  border-radius: 5px;
  padding: 6px;
  background: #f7fafc;
}

.ev-camera-panel video {
  width: 100%;
  max-height: 220px;
  display: block;
  object-fit: contain;
  background: #122637;
}

.ev-mod-dialog-actions,
.ev-mod-dialog-footer {
  margin-top: 8px;
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.ev-mod-dialog-spacer {
  flex: 1;
}

.ev-modal-field {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ev-modal-field span,
.ev-ocr-text summary {
  color: #607286;
  font-size: 12px;
  font-weight: 800;
}

.ev-mod-feature-box {
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid #dce5ed;
  border-radius: 5px;
  background: #f8fafc;
  color: #526a7d;
  font-size: 12px;
  line-height: 1.35;
}

.ev-mod-preview-status {
  margin-bottom: 6px;
}

.ev-ocr-text {
  margin-top: 8px;
}

.ev-ocr-text textarea {
  margin-top: 5px;
  height: auto;
  min-height: 125px;
  font-size: 12px;
}

.ev-mod-dialog-message {
  min-height: 16px;
  margin: 8px 0 0;
  color: #6b7785;
  font-size: 12px;
  font-weight: 700;
}

.ev-field-info {
  position: relative;
  padding-right: 26px;
}

.ev-field-info i,
.ev-field-info .ev-info-button,
.ev-norm-title i,
.ev-norm-title .ev-info-button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #53789b;
  background: #edf5fb;
  border: 1px solid #c6d8e7;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ev-field-info i,
.ev-field-info .ev-info-button {
  position: absolute;
  right: 0;
  bottom: 6px;
}

.ev-info-button {
  padding: 0;
}

.ev-info-button:focus-visible {
  outline: 2px solid rgba(32, 131, 195, 0.3);
  outline-offset: 2px;
}

.ev-info-popover {
  position: fixed;
  z-index: 20;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid #c7d8e6;
  border-radius: 6px;
  background: #fff;
  color: #2a3d4f;
  box-shadow: 0 12px 28px rgba(16, 38, 58, 0.18);
  font-size: 12px;
  line-height: 1.35;
}

.ev-norm-title {
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #17213a;
  font-size: 12px;
}

.ev-norm-title i,
.ev-norm-title .ev-info-button {
  margin-left: auto;
}

.ev-section {
  margin-top: 8px;
  border-radius: 6px;
  overflow: hidden;
}

.ev-section-header {
  min-height: 36px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  background: #e9eef4;
  border-bottom: 1px solid #d6dde5;
  color: #303a46;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.ev-tech-grid {
  padding: 7px 10px 8px;
  display: grid;
  grid-template-columns: minmax(335px, 370px) minmax(405px, 470px);
  gap: 24px;
  align-items: start;
  justify-content: start;
}

.ev-tech-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ev-row-field {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.ev-row-field > span {
  min-height: 0;
  color: #303942;
  font-size: 11px;
  white-space: nowrap;
}

.ev-tech-engine .ev-select { max-width: 205px; }
.ev-tech-volume .ev-unit { max-width: 195px; }
.ev-tech-power .ev-power { max-width: 255px; }
.ev-tech-turbo .ev-select { max-width: 110px; }
.ev-tech-dimensions .ev-dimensions { max-width: 275px; }
.ev-tech-transmission .ev-select { max-width: 180px; }
.ev-tech-drive .ev-drive-control { max-width: 220px; }
.ev-tech-doors .ev-input { max-width: 100px; }
.ev-tech-steering .ev-select { max-width: 160px; }

.ev-drive-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 6px;
}

.ev-dimensions,
.ev-unit,
.ev-power {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ev-dimensions input {
  width: 0;
  min-width: 0;
  flex: 1 1 0;
}

.ev-unit input {
  width: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.ev-power input {
  width: 0;
  min-width: 0;
  flex: 1 1 0;
}

.ev-dimensions b,
.ev-unit b,
.ev-power b {
  color: #2d3945;
  font-size: 13px;
}

.ev-paint-grid {
  padding: 7px 10px;
  display: grid;
  grid-template-columns: 360px 280px 230px;
  gap: 10px;
  align-items: center;
  justify-content: start;
}

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

/* Object card fields should match the expected value length instead of stretching. */
#vehicle-identification .ev-grid-two {
  grid-template-columns: 220px 150px;
  justify-content: start;
  align-items: start;
}

#vehicle-identification input[name="make"] { width: 155px; }
#vehicle-identification input[name="model"] { width: 150px; }
#vehicle-identification input[name="vin"] { width: 220px; }
#vehicle-identification input[name="vin2"] { width: 150px; }
#vehicle-identification input[name="registration_plate"] { width: 122px; }
#vehicle-identification .ev-vin-control { width: 250px; max-width: 250px; }
#vehicle-identification .ev-plate-control { width: 157px; }
#vehicle-identification .ev-inline-action {
  grid-template-columns: 260px 94px;
  justify-content: start;
}

.ev-grid-date {
  grid-template-columns: 125px 155px;
  justify-content: start;
  align-items: start;
}

.ev-grid-date .ev-field:nth-child(1) { grid-column: 1; grid-row: 1; }
.ev-grid-date .ev-field:nth-child(2) { grid-column: 2; grid-row: 1; }
.ev-grid-date .ev-field:nth-child(3) { grid-column: 1; grid-row: 2; }
.ev-grid-date .ev-field:nth-child(4) { grid-column: 2; grid-row: 2; }
.ev-grid-date .ev-field:nth-child(5) { grid-column: 1; grid-row: 3; }

.ev-grid-date input[name="accident_date"],
.ev-grid-date input[name="production_date"] {
  width: 125px;
}

.ev-grid-date input[name="valuation_date"] {
  width: 155px;
}

.ev-grid-date input[name="mileage"] {
  width: 120px;
}

.ev-grid-date input[name="production_year"] {
  width: 90px;
}

.ev-grid-norm {
  grid-template-columns: 150px 150px;
  justify-content: start;
}

.ev-grid-norm .ev-field:first-child,
.ev-grid-norm .ev-field:last-child,
.ev-length-field {
  grid-column: auto;
  grid-row: auto;
}

.ev-grid-norm select[name="normative_mileage_usage_conditions"],
.ev-grid-norm select[name="normative_mileage_origin"] {
  width: 120px;
}

.ev-length-field .ev-input {
  width: 145px;
}

.ev-tech-engine .ev-select { max-width: 170px; }
.ev-tech-volume .ev-unit { max-width: 150px; }
.ev-tech-volume .ev-unit input { flex-basis: 92px; }
.ev-tech-power .ev-power { max-width: 225px; }
.ev-tech-power .ev-power input { flex-basis: 76px; }
.ev-tech-dimensions .ev-dimensions { max-width: 255px; }
.ev-tech-dimensions .ev-dimensions input { flex-basis: 72px; }
.ev-tech-transmission .ev-select { max-width: 155px; }
.ev-tech-drive .ev-drive-control { max-width: 185px; }
.ev-tech-doors .ev-input { max-width: 82px; }
.ev-tech-steering .ev-select { max-width: 135px; }

.ev-paint-grid {
  grid-template-columns: 260px 300px 170px;
}

.ev-paint-grid input[name="paint_color"] { width: 210px; }
.ev-paint-grid select[name="paint_type"] { width: 230px; }
.ev-paint-grid input[name="paint_code"] { width: 120px; }

.ev-equipment {
  min-height: 0;
}

.ev-equipment-summary {
  padding: 7px 10px 6px;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr);
  gap: 10px;
}

.ev-equipment-summary label {
  display: grid;
  align-items: center;
  gap: 8px;
}

.ev-equipment-summary label:first-child {
  grid-template-columns: 190px minmax(0, 1fr);
}

.ev-equipment-summary label:last-child {
  grid-template-columns: 105px minmax(0, 1fr);
}

.ev-tab-buttons {
  display: flex;
  padding-left: 12px;
}

.ev-tab-button {
  min-width: 92px;
  height: 35px;
  border: 1px solid #d2dde7;
  border-bottom-color: #c8d5df;
  background: #eef3f7;
  color: #7a8794;
  font-size: 12px;
  font-weight: 800;
}

.ev-tab-button.active {
  color: #ff0b63;
  background: #fff;
  border-bottom-color: #fff;
}

.ev-tab-panel {
  display: none;
  padding: 10px 16px 12px;
  border-top: 1px solid #d2dde7;
}

.ev-tab-panel.active {
  display: block;
}

.ev-headlights-row {
  margin: 0 auto 10px;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr 20px;
  gap: 8px;
  align-items: end;
}

.ev-headlights-row label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ev-light-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.ev-light-grid h3 {
  margin: 0 0 4px;
  color: #4d6176;
  font-size: 11px;
}

.ev-options-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 4px 22px;
}

.ev-check {
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #2f3842;
  font-size: 12px;
}

.ev-light-grid .ev-check span {
  cursor: help;
}

.ev-check input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.ev-tab-select {
  max-width: 470px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.ev-notes {
  margin-top: 8px;
}

.ev-side-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 8px;
  align-self: start;
  min-height: calc(100vh - 105px);
  padding-left: 8px;
  border-left: 1px solid #d3dde6;
}

.ev-info-card {
  padding: 8px 10px 9px;
}

.ev-info-card h2 {
  margin: 0 0 6px;
  padding: 0 0 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #263848;
  border-bottom: 1px solid #dce5ed;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.ev-info-card h2 span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #9eb5c8;
  background: #edf5fb;
  border: 1px solid #d5e3ef;
}

.ev-info-card h2 span img {
  width: 14px;
  height: 14px;
  opacity: .72;
}

.ev-info-card dl {
  margin: 0;
}

.ev-info-card dt,
.ev-info-card dd {
  min-height: 21px;
  padding: 3px 0;
  border-bottom: 1px solid #e4ebf1;
  font-size: 11px;
}

.ev-info-card dt {
  width: 105px;
  float: left;
  clear: left;
  color: #687b8c;
  font-weight: 800;
}

.ev-info-card dd {
  margin-left: 116px;
  color: #2e4050;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ev-status {
  padding: 2px 16px;
  border-radius: 5px;
  color: #063c28;
  background: #19d486;
}

.ev-hints ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ev-hints li {
  position: relative;
  margin: 0 0 8px;
  padding-left: 22px;
  color: #526b82;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.18;
}

.ev-hints li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2083c3;
}

.ev-ai-status {
  padding: 9px 10px;
  margin-bottom: 8px;
  border: 1px solid #d7e1eb;
  border-radius: 5px;
  background: #f5f8fb;
  color: #758292;
  font-size: 12px;
  font-weight: 700;
}

.ev-ai-card button,
.ev-ai-button {
  width: 100%;
  min-height: 28px;
  margin-bottom: 7px;
  border: 1px solid #c7d6e4;
  border-radius: 4px;
  background: #fff;
  color: #526d86;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.ev-ai-card button:first-of-type,
.ev-ai-button {
  color: #fff;
  background: var(--ev-blue-button);
}

.ev-ai-button:hover {
  text-decoration: none;
}

.ev-ai-card p {
  margin: 3px 0 0;
  color: #38a16b;
  font-size: 12px;
  font-weight: 700;
}

.ev-toast {
  position: fixed;
  right: 24px;
  top: 52px;
  z-index: 5;
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(20, 42, 63, 0.14);
}

.ev-toast-ok {
  color: #145a39;
  background: #e6f6ed;
  border: 1px solid #afd8c4;
}

.ev-toast-error {
  color: #8d2525;
  background: #fff1f1;
  border: 1px solid #e8b8b8;
}

.assistant-panel textarea {
  width: 100%;
  min-height: 120px;
}

.assistant-status {
  font-size: 12px;
  font-weight: 800;
}

.assistant-form {
  padding: 16px;
}

.assistant-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.assistant-answer {
  padding-bottom: 14px;
}

.assistant-answer-body,
.assistant-answer h3,
.assistant-answer ul {
  margin-left: 16px;
  margin-right: 16px;
}

.assistant-answer-body {
  white-space: pre-wrap;
  line-height: 1.45;
}

@media (max-width: 1280px) {
  .ev-object-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .ev-side-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: static;
    min-height: 0;
    padding-left: 0;
    border-left: 0;
  }
}

/* Shared desktop calculation workspaces. */
.app-shell {
  height: 100vh;
  min-height: 720px;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 42px;
  grid-template-areas:
    "sidebar workspace"
    "bottom bottom";
}

.sidebar { grid-area: sidebar; min-height: 0; }
.workspace { grid-area: workspace; min-height: 0; overflow: auto; }
.bottom-utility {
  grid-area: bottom;
  min-width: 0;
  height: 42px;
  padding: 4px 12px 4px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c7d1dc;
  background: #202a35;
  border-top: 1px solid #33404e;
  font-size: 11px;
  font-weight: 700;
}

.bottom-placeholder,
.bottom-item,
.bottom-log {
  min-height: 31px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 5px;
  color: #c7d1dc;
  white-space: nowrap;
}

.bottom-placeholder { color: #9da9b5; background: #2b3846; }
.bottom-item img { width: 17px; height: 17px; filter: brightness(0) invert(1); opacity: .82; }
.bottom-item:hover,
.bottom-log:hover,
.bottom-item.active { color: #fff; background: #2b3846; text-decoration: none; }
.bottom-item.active { border-bottom: 2px solid #66a9e6; }
.bottom-spacer { flex: 1; }
.bottom-log { min-height: 25px; border: 1px solid #435262; }
.bottom-version { color: #8291a0; font-size: 10px; }
.nav-divider { height: 1px; margin: 2px 7px; background: #3a4652; }

.calculation-screen .topbar { display: none; }
.calculation-screen .content {
  min-height: 100%;
  padding: 0 14px 14px;
  color: #252a31;
  background: #f4f6f8 url('/ui-assets/brand-wallpaper.png') repeat;
}

.calc-form { min-width: 0; }
.calc-toolbar {
  min-height: 43px;
  margin: 0 -14px 6px;
  padding: 4px 12px 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e6f0f8;
  border-bottom: 1px solid #d0deea;
}
.calc-toolbar label { display: flex; align-items: center; gap: 6px; }
.calc-toolbar label > span { color: #536a80; font-size: 12px; font-weight: 800; }
.calc-toolbar select { width: min(410px, 36vw); }
.calc-save-status { display: none; color: #657b8e; font-size: 11px; font-weight: 700; }
.calc-save-status.saving { display: inline; color: #9a6a00; }
.calc-save-status.saved { display: inline; color: #168a51; }
.calc-save-status.error { display: inline; color: #a62b2b; }

.calc-title-row {
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.calc-title-row h1 { margin: 0; color: #171b20; font-size: 21px; line-height: 1.15; font-weight: 800; }
.calc-title-row h1 small { margin-left: 7px; color: #3b78a5; font-size: 11px; vertical-align: middle; }
.calc-title-row p { margin: 2px 0 0; color: #69727d; font-size: 12px; }
.calc-badge {
  padding: 5px 10px;
  border: 1px solid #d7c689;
  border-radius: 5px;
  color: #765b00;
  background: #fff9dc;
  font-size: 11px;
  font-weight: 800;
}
.calc-badge.ready { color: #13623e; border-color: #b8dccb; background: #edf9f3; }

.object-overview {
  min-height: 82px;
  margin-bottom: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #cfdbe5;
  border-radius: 7px;
  background: #fff;
}
.vehicle-thumb {
  width: 96px;
  height: 54px;
  flex: 0 0 96px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe4eb;
  border-radius: 5px;
  color: #708396;
  background: #f7f9fb;
}
.vehicle-thumb span { font-size: 24px; font-weight: 800; }
.vehicle-thumb small { font-size: 10px; }
.vehicle-thumb img { width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.object-identity { min-width: 180px; display: flex; flex: 1 1 260px; flex-direction: column; gap: 2px; }
.object-identity strong { color: #223140; font-size: 16px; }
.object-identity b { color: #3d5367; font-size: 12px; }
.object-identity span { color: #728293; font-size: 11px; }
.object-facts { margin: 0; display: grid; flex: 4 1 760px; grid-template-columns: repeat(5, minmax(100px, 1fr)); }
.object-facts div { min-height: 48px; padding: 2px 10px; border-left: 1px solid #e0e7ed; }
.object-facts dt { color: #748392; font-size: 10px; font-weight: 700; }
.object-facts dd { margin: 5px 0 0; color: #314252; font-size: 12px; font-weight: 800; }
.market-overview .object-identity { max-width: 380px; }
.ev-object-overview { min-height: 76px; }
.ev-object-overview .vehicle-thumb { width: 72px; height: 48px; flex-basis: 72px; }
.ev-object-overview .vehicle-thumb span { color: #60788e; font-size: 14px; letter-spacing: .04em; }

.status-strip {
  height: 72px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #d6dfe7;
  border-radius: 7px;
  background: #fff;
}
.status-strip > div { padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; border-left: 1px solid #e2e8ee; }
.status-strip > div:first-child { border-left: 0; }
.status-strip span { color: #6b7b8b; font-size: 10px; font-weight: 800; }
.status-strip b { color: #2b4053; font-size: 12px; }

.result-summary {
  min-height: 98px;
  margin-bottom: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid #d6dfe7;
  border-radius: 7px;
  background: #fff;
}
.result-summary > div { padding: 4px 10px; display: flex; flex-direction: column; justify-content: center; border-left: 1px solid #e1e8ee; }
.result-summary > div:first-child { min-width: 220px; flex: 2; border-left: 0; }
.result-summary span { color: #6e7e8c; font-size: 10px; font-weight: 800; }
.result-summary strong { margin-top: 2px; color: #1b7650; font-size: 21px; }
.result-summary small { margin-top: 2px; color: #748493; font-size: 9px; }
.result-summary .formula { flex: 5; align-items: center; text-align: center; }
.result-summary .formula b { color: #30475c; font-size: 13px; }
.result-summary .formula span { margin-top: 5px; font-size: 10px; }
.summary-metric { min-width: 72px; flex: 1; align-items: center; }
.summary-metric b { margin-top: 6px; color: #30475c; font-size: 12px; }
.market-summary > div:first-child { min-width: 255px; }

.calc-layout { min-width: 0; display: grid; gap: 8px; align-items: start; }
.calc-layout.with-sidebar { grid-template-columns: minmax(700px, 1fr) 320px; }
.calc-layout.single-column { grid-template-columns: minmax(0, 1fr); }
.calc-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.calc-section {
  overflow: hidden;
  border: 1px solid #d6dde5;
  border-radius: 7px;
  background: #fff;
}
.calc-section > summary,
.calc-section > header {
  min-height: 36px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #303a46;
  background: #e9eef4;
  border-bottom: 1px solid #d6dde5;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}
.calc-section > summary::-webkit-details-marker { display: none; }
.calc-section > summary::before { content: "▸"; color: #6d8194; font-size: 12px; }
.calc-section[open] > summary::before { content: "▾"; }
.calc-section > summary > span { flex: 1; }
.calc-section > header { cursor: default; }
.section-status { color: #60778b; font-size: 10px; font-weight: 800; text-transform: none; }
.tone-green { color: #16734a; }
.tone-yellow { color: #936e00; }
.tone-red { color: #a52d2d; }
.calc-section-body { padding: 9px 11px 10px; }

.field-grid { display: grid; gap: 7px 10px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-grid.six { grid-template-columns: repeat(6, minmax(120px, 1fr)); }
.field-grid label,
.reference-columns label,
.compact-field,
.check-stack > label:not(.ev-check),
.object-bind-grid label,
.document-panel label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.field-grid label > span,
.reference-columns label > span,
.compact-field > span,
.check-stack label > span,
.object-bind-grid label > span,
.document-panel label > span { color: #657485; font-size: 10px; font-weight: 800; }
.field-grid .wide { grid-column: span 2; }
.coefficient-grid { padding: 0 11px 10px; display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 10px; }
.coefficient-grid label { display: flex; flex-direction: column; gap: 3px; }
.coefficient-grid label > span { color: #526b81; font-size: 10px; font-weight: 900; }
.coefficient-grid small { color: #708292; font-size: 9px; }
.calc-form .ev-input,
.calc-form .ev-select,
.calc-form input,
.calc-form select,
.document-panel .ev-input,
.object-bind-grid .ev-input {
  min-height: 29px;
  height: 29px;
  padding: 3px 7px;
  border: 1px solid #c9d3dc;
  border-radius: 4px;
  color: #27333e;
  background: #fff;
  font-size: 12px;
}
.calc-form input:not([readonly]):not([type="checkbox"]),
.calc-form select { background: #fff; border-color: #c9d3dc; }
.calc-form input[type="checkbox"],
.calc-form input[type="radio"] { width: 15px; height: 15px; min-height: 0; padding: 0; }
.control-callout,
.inline-result { color: #5e7182; font-size: 11px; }
.inline-result { margin: 8px 0 0; padding: 7px 9px; border-radius: 4px; background: #f5f8fa; }

.method-sidebar {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 66px);
  padding: 9px;
  overflow-y: auto;
  border: 1px solid #d1dce5;
  border-radius: 7px;
  background: #f4f7fa;
}
.method-sidebar > h2 { margin: 0 0 8px; color: #34495b; font-size: 12px; }
.method-sidebar section,
.progress-card { margin-bottom: 7px; padding: 7px 8px; border: 1px solid #dce4eb; border-radius: 5px; background: #fff; }
.method-sidebar section h3 { margin: 0 0 6px; color: #51697e; font-size: 9px; letter-spacing: .03em; }
.method-sidebar section p { margin: 0; color: #5c6f80; font-size: 10px; line-height: 1.35; }
.method-sidebar section.ready { border-color: #bcdccb; background: #f0faf5; }
.method-sidebar section.warning { border-color: #e4d49b; background: #fffbea; }
.method-sidebar dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; }
.method-sidebar dt { color: #6c7d8c; font-size: 9px; }
.method-sidebar dd { margin: 0; color: #30475a; font-size: 9px; font-weight: 800; text-align: right; overflow-wrap: anywhere; }
.progress-card > div { display: flex; justify-content: space-between; color: #40576a; font-size: 10px; }
.progress-card progress { width: 100%; height: 8px; margin-top: 6px; accent-color: #1b9d69; }

.method-selector { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: 5px; }
.method-availability { margin-top: 6px; display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: 5px; }
.method-availability label { display: grid; gap: 3px; }
.method-availability span { color: #647789; font-size: 8px; font-weight: 800; }
.method-availability input,
.method-availability select { height: 25px !important; min-height: 25px !important; font-size: 9px !important; }
.method-card { min-width: 0; padding: 7px; display: flex; align-items: flex-start; gap: 5px; border: 1px solid #d7e0e7; border-radius: 5px; background: #f8fafb; }
.method-card:has(input:checked) { border-color: #72a0c7; background: #ecf5fc; }
.method-card span { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.method-card b { color: #3d5367; font-size: 9px; line-height: 1.2; }
.method-card small { color: #788998; font-size: 8px; }
.method-workspace { margin-top: 8px; padding: 8px; border: 1px solid #dce4ea; border-radius: 5px; background: #fbfcfd; }
.method-workspace[hidden] { display: none; }
.subsection-title { min-height: 26px; margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #40566a; font-size: 10px; }
.reference-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.reference-columns > div { padding: 7px; border: 1px solid #dfe6ec; border-radius: 4px; background: #fff; }
.reference-columns h3 { margin: 0 0 7px; color: #567086; font-size: 9px; }
.reference-columns dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 5px; font-size: 9px; }
.reference-columns dt { color: #7b8996; }
.reference-columns dd { margin: 0; color: #344b5f; font-weight: 800; }
.reference-columns label { margin-top: 4px; }
.price-ladder { margin-top: 7px; padding: 7px; display: flex; align-items: center; gap: 6px; border-radius: 4px; color: #617487; background: #edf3f7; font-size: 9px; }
.price-ladder span { flex: 1; display: flex; flex-direction: column; }
.price-ladder b { margin-top: 2px; color: #29465c; font-size: 11px; }
.price-ladder i { color: #8ca1b2; }
.compact-field { max-width: 260px; margin-bottom: 7px; }

/* Desktop wear workflow: the formula belongs to step 4, not the page header. */
.wear-title-row {
  align-items: center;
}

.wear-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wear-report-button {
  width: 100%;
  min-width: 0;
  color: #fff;
  border-color: #00a96f;
  background: #00a96f;
}

.wear-report-button:disabled {
  opacity: 1;
  color: #fff;
}

.method-sidebar-actions {
  margin-top: auto;
  padding-top: 4px;
}

.wear-object-overview {
  position: relative;
  padding-top: 34px;
}

.wear-object-overview > h2 {
  position: absolute;
  top: 10px;
  left: 14px;
  margin: 0;
  color: #172c53;
  font-size: 13px;
}

.wear-object-overview + .status-strip > div {
  align-items: flex-start;
}

.wear-object-overview + .status-strip small {
  margin-top: 3px;
  color: #8493a1;
  font-size: 9px;
  line-height: 1.15;
}

.wear-route-header {
  min-height: 32px;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wear-route-header h2 {
  margin: 0;
  color: #182a4f;
  font-size: 17px;
  font-weight: 850;
}

.wear-route-header > div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #587088;
  font-size: 10px;
  font-weight: 700;
}

.wear-route-header progress {
  width: 110px;
  height: 8px;
  accent-color: #00a66d;
}

.wear-workflow {
  gap: 7px;
}

.wear-step {
  border-color: #b8cad8;
  border-radius: 6px;
  background: #fbfcfd;
}

.wear-step[open] {
  border-color: #67d8b0;
}

.wear-step > summary {
  min-height: 52px;
  padding: 6px 10px 6px 10px;
  gap: 10px;
  border-bottom: 0;
  background: #fbfcfd;
}

.wear-step[open] > summary {
  background: #f9fffc;
}

.wear-step > summary::before,
.wear-step[open] > summary::before {
  content: attr(data-step);
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #00a66d;
  font-size: 14px;
  font-weight: 900;
}

.wear-step-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wear-step-copy strong {
  color: #172c53;
  font-size: 14px;
  line-height: 1.1;
}

.wear-step-copy small {
  color: #5f7285;
  font-size: 10px;
  font-weight: 650;
}

.wear-step .section-status {
  color: #087c57;
  font-size: 10px;
}

.wear-step > .calc-section-body,
.wear-step > .coefficient-grid,
.wear-step > .wear-step-banner,
.wear-step > .inline-result {
  margin-left: 18px;
  border-left: 1px solid #cddce7;
}

.wear-step-banner {
  width: min(590px, calc(100% - 120px));
  margin: 0 0 0 50px !important;
  padding: 8px 12px;
  border: 1px solid #bcebd8 !important;
  border-radius: 5px;
  color: #00875a;
  background: #effbf6;
  font-size: 12px;
  font-weight: 850;
}

.wear-section-intro {
  margin: 0 0 8px;
  color: #687d91;
  font-size: 11px;
}

.wear-inline-summary {
  margin: 9px 0 0;
  background: #f6f9fb;
}

.wear-final-step > p {
  margin: 0 0 6px;
  color: #687d91;
  font-size: 11px;
}

.wear-final-result {
  margin-top: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 10px;
  border: 1px solid #bcebd8;
  border-radius: 5px;
  background: #effbf6;
  color: #52697c;
}

.wear-final-result b {
  color: #087c57;
  font-size: 18px;
}

/* Desktop market profile and collapsible sections. */
.market-desktop-profile {
  margin-bottom: 6px;
  overflow: hidden;
  border: 1px solid #cfdbe5;
  border-radius: 7px;
  background: #fff;
}

.market-desktop-profile > header {
  min-height: 54px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e0e7ed;
}

.market-desktop-profile > header > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-desktop-profile > header strong {
  color: #223140;
  font-size: 15px;
}

.market-desktop-profile > header span {
  color: #728293;
  font-size: 10px;
}

.market-desktop-profile > header b {
  color: #087c57;
  font-size: 10px;
}

.market-profile-groups {
  padding: 7px 12px 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.market-profile-groups dl {
  margin: 0;
  padding: 0 14px;
  border-left: 1px solid #e0e7ed;
}

.market-profile-groups dl:first-child {
  padding-left: 0;
  border-left: 0;
}

.market-profile-groups h3 {
  margin: 0 0 5px;
  color: #40566a;
  font-size: 10px;
}

.market-profile-groups dl > div {
  min-height: 18px;
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 8px;
}

.market-profile-groups dt {
  color: #748392;
  font-size: 9px;
}

.market-profile-groups dd {
  margin: 0;
  overflow: hidden;
  color: #314252;
  font-size: 9px;
  font-weight: 800;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-desktop-section > summary {
  min-height: 36px;
  background: #e9eef4;
}

.market-desktop-section:not([open]) > summary {
  border-bottom: 0;
}

.market-desktop-section .method-card {
  min-height: 34px;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.market-desktop-section .method-card > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.market-desktop-section .method-card span {
  align-items: center;
}

.editable-table { min-width: 940px; font-size: 10px; }
.editable-table th,
.editable-table td { padding: 4px; vertical-align: middle; }
.editable-table input,
.editable-table select { min-width: 76px; height: 27px; font-size: 10px; }
.editable-table button { width: 26px; height: 26px; margin-right: 3px; border: 1px solid #d7bcbc; border-radius: 4px; color: #a43b3b; background: #fff; cursor: pointer; }
.editable-table button[data-open-offer] { color: #356b96; border-color: #bbccdc; }
.offer-actions { display: inline-flex; align-items: center; gap: 6px; }
.offer-import { position: relative; min-width: 150px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease; }
.offer-import b { font-size: inherit; }
.offer-import small { margin-top: 1px; color: #71879a; font-size: 8px; font-weight: 600; }
.offer-import.drag-active { border-color: #ff0054; color: #bd0040; background: #fff0f5; box-shadow: 0 0 0 3px rgba(255,0,84,.13); }
.offer-import.drag-active small { color: #bd0040; }
.offer-import input { position: absolute; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.offers-editor { min-width: 3050px; }
.offers-editor th { min-width: 105px; white-space: nowrap; }
.offers-editor th:nth-child(2),
.offers-editor th:nth-child(7),
.offers-editor th:nth-child(17),
.offers-editor th:nth-child(22) { min-width: 170px; }
.check-stack { display: flex; flex-direction: column; gap: 7px; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; }

/* Market value mirrors the accepted PySide6 workspace. */
.market-desktop-layout { display: grid; grid-template-columns: minmax(760px, 1fr) 330px; gap: 10px; align-items: start; }
.market-desktop-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.market-desktop-profile { margin-bottom: 0; }
.market-desktop-profile > header { min-height: 42px; padding: 7px 12px; }
.market-desktop-profile > footer { padding: 5px 12px; border-top: 1px solid #e0e7ed; color: #64788a; background: #f8fafc; font-size: 9px; }
.desktop-market-summary { margin-bottom: 0; background: #f3f7fa; }
.desktop-market-summary > div:first-child { min-width: 225px; }
.desktop-market-summary strong { color: #c63f3f; }
.desktop-market-summary .summary-metric b { color: #a84d4d; }
.desktop-market-summary .summary-metric:first-of-type b { color: #087c57; }

.desktop-method-selector { padding: 7px; border: 1px solid #d5e0e8; border-radius: 6px; background: #f3f7fa; }
.desktop-method-caption { margin-bottom: 7px; color: #5d7285; font-size: 9px; font-weight: 800; }
.desktop-method-caption i,
.desktop-vestnik-block h3 i { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; border: 1px solid #c8d4df; border-radius: 50%; color: #75899a; font-size: 10px; font-style: normal; }
.desktop-method-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.desktop-method-card { min-height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid #cbd8e3; border-radius: 4px; background: #fff; cursor: pointer; text-align: center; }
.desktop-method-card input { position: absolute; opacity: 0; pointer-events: none; }
.desktop-method-card span { display: flex; align-items: center; justify-content: center; gap: 5px; }
.desktop-method-card b { color: #3f5668; font-size: 10px; line-height: 1.15; }
.desktop-method-card small { color: #7b8d9b; font-size: 10px; }
.desktop-method-card:has(input:checked) { border-color: #e6245d; background: #f02d63; }
.desktop-method-card:has(input:checked) b,
.desktop-method-card:has(input:checked) small { color: #fff; }

.desktop-workspace-title { min-height: 28px; margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; color: #2f5069; font-size: 12px; }
.desktop-vestnik-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.desktop-vestnik-block { padding: 7px; border: 1px solid #dbe5ec; border-radius: 4px; background: #fff; }
.desktop-vestnik-block h3 { margin: 0 0 8px; color: #587087; font-size: 9px; }
.desktop-vestnik-block label { min-height: 30px; display: grid; grid-template-columns: 145px minmax(0, 1fr); align-items: center; gap: 8px; }
.desktop-vestnik-block label > span { color: #313d48; font-size: 10px; }
.desktop-vestnik-block input { width: 100%; height: 25px !important; min-height: 25px !important; font-size: 10px !important; }
.desktop-vestnik-block input[readonly] { color: #34556c; background: #edf3f7 !important; border-color: #d0dbe4 !important; font-weight: 700; }
.desktop-average-result { margin-top: 8px; padding: 8px 12px; display: flex; flex-direction: column; border: 1px solid #b9ddcf; border-radius: 4px; background: #edf7f3; }
.desktop-average-result span { color: #53697b; font-size: 10px; font-weight: 700; }
.desktop-average-result b { color: #087c57; font-size: 15px; }

.desktop-market-sidebar { min-height: 100%; padding: 11px; border-left: 1px solid #cbd8e3; background: #fff; }
.desktop-market-sidebar h2 { margin: 0 0 8px; color: #2e4356; font-size: 12px; }
.desktop-market-sidebar h3 { margin: 9px 0 7px; color: #53697b; font-size: 10px; }
.desktop-market-sidebar section { margin-bottom: 7px; }
.desktop-pp-check { padding: 8px; border: 1px solid #d3e1eb; border-radius: 4px; background: #f7fafc; }
.desktop-pp-check dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; }
.desktop-pp-check dt { color: #65798a; font-size: 9px; }
.desktop-pp-check dd { margin: 0; color: #2f4f66; font-size: 10px; font-weight: 800; text-align: right; }
.desktop-stage-list { padding: 7px 8px; border: 1px solid #dbe5ec; color: #40586a; background: #f7fafc; font-size: 10px; }
.desktop-stage-list p { margin: 0 0 7px; line-height: 1.3; }
.desktop-stage-list p:last-child { margin-bottom: 0; }
.desktop-vestnik-control { padding: 7px; border: 1px solid #d3e1eb; border-radius: 4px; color: #31536b; background: #f5f9fc; font-size: 10px; font-weight: 700; }
.desktop-vestnik-control.ok { border-color: #b8ddc9; color: #216b45; background: #eef9f3; }
.desktop-vestnik-control.mismatch { border-color: #e5b48e; color: #8a451d; background: #fff4ec; }
.desktop-market-warning { color: #a06300; font-size: 10px; line-height: 1.35; }

.desktop-limited-workspace { padding: 0; overflow: hidden; }
.limited-desktop-heading { min-height: 48px; padding: 7px 12px; display: flex; align-items: center; border-bottom: 1px solid #d6e0e8; background: #e9f1f7; }
.limited-desktop-heading div { display: flex; flex-direction: column; }
.limited-desktop-heading b { color: #2f5069; font-size: 12px; }
.limited-desktop-heading small { color: #718497; font-size: 9px; }
.limited-desktop-toolbar { padding: 10px 12px 7px; display: flex; align-items: center; gap: 8px; }
.limited-desktop-toolbar > div:first-child { margin-right: auto; display: flex; flex-direction: column; }
.limited-desktop-toolbar h3 { margin: 0; color: #263746; font-size: 15px; }
.limited-desktop-toolbar small { color: #718497; font-size: 9px; }
.limited-desktop-metrics { display: flex; gap: 6px; }
.limited-desktop-metrics span { min-width: 76px; padding: 5px 8px; display: flex; flex-direction: column; border: 1px solid #d6e0e8; border-radius: 4px; color: #718497; font-size: 9px; }
.limited-desktop-metrics b { color: #29465c; font-size: 11px; }
.desktop-limited-workspace > .calc-save-status { margin: 0 12px 7px; }
.desktop-offer-matrix-wrap { margin: 0 12px; overflow: auto; border: 1px solid #d6e0e8; }
.desktop-offer-matrix { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9px; }
.desktop-offer-matrix th,
.desktop-offer-matrix td { min-width: 145px; height: 22px; padding: 1px 4px; border-right: 1px solid #d6e0e8; border-bottom: 1px solid #d6e0e8; }
.desktop-offer-matrix th:first-child { position: sticky; left: 0; z-index: 2; min-width: 180px; max-width: 180px; color: #2f4355; background: #eef3f7; text-align: left; }
.desktop-offer-matrix thead th { color: #2f4355; background: #e9f0f5; text-align: center; }
.desktop-offer-matrix thead th span { margin-left: 5px; white-space: nowrap; }
.desktop-offer-matrix thead button { width: 18px; height: 18px; padding: 0; border: 0; color: #8a4a4a; background: transparent; }
.desktop-offer-matrix input,
.desktop-offer-matrix select { width: 100%; height: 19px !important; min-height: 19px !important; padding: 0 3px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; font-size: 9px !important; }
.limited-desktop-stats { margin: 8px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.limited-desktop-stats dl { margin: 0; padding: 9px 11px; border: 1px solid #d6e0e8; border-radius: 5px; background: #fff; }
.limited-desktop-stats dl > div { min-height: 23px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.limited-desktop-stats dt { font-size: 11px; }
.limited-desktop-stats dd { margin: 0; color: #29465c; font-size: 11px; font-weight: 800; text-align: right; }
.limited-desktop-stats input { width: 180px; height: 25px !important; min-height: 25px !important; }
.limited-preliminary { margin: 8px 12px 12px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border-left: 4px solid #f02d63; background: #fff0f4; }
.limited-preliminary span { display: flex; flex-direction: column; color: #697b8c; font-size: 9px; }
.limited-preliminary small { margin-top: 4px; color: #27333e; font-size: 11px; }
.limited-preliminary b { color: #263746; font-size: 22px; }

@media (max-width: 1180px) {
  .market-desktop-layout { grid-template-columns: minmax(0, 1fr); }
  .desktop-market-sidebar { border: 1px solid #cbd8e3; border-radius: 6px; }
  .desktop-method-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.split-control { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; }
.eligibility-card { padding: 12px; border: 1px solid #d8e0e6; border-radius: 5px; background: #f6f8fa; }
.eligibility-card strong { font-size: 13px; }
.eligibility-card ul { margin: 8px 0 0; padding-left: 17px; font-size: 10px; }
.eligibility-card.tone-green { border-color: #b9dcc8; background: #effaf4; }
.eligibility-card.tone-yellow { border-color: #e3d290; background: #fff9e2; }
.eligibility-card.tone-red { border-color: #e2b7b7; background: #fff1f1; }
.special-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.special-grid > div { display: grid; grid-template-columns: 110px minmax(0, 1fr) 90px; gap: 6px; align-items: center; }
.special-grid span { color: #4f6375; font-size: 10px; }
.control-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.control-metrics div { padding: 8px; display: flex; justify-content: space-between; border: 1px solid #e0e6eb; border-radius: 4px; color: #617586; font-size: 10px; }
.control-metrics b { color: #2d6f50; }
.uts-total { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.uts-total dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 11px; }
.uts-total dd { margin: 0; font-weight: 800; }
.uts-total > div { display: flex; flex-direction: column; align-items: center; justify-content: center; border-left: 1px solid #e1e7ec; }
.uts-total > div > span { color: #65798a; font-size: 11px; }
.uts-total > div > b { margin: 5px 0; color: #19734d; font-size: 22px; }
.uts-total > div > small { color: #7c8b98; }
.warning-text { color: #936000 !important; }

.static-section { margin-bottom: 8px; }
.object-bind-grid { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 10px; }
.future-workspace { min-height: 420px; }
.future-workspace p { color: #607080; font-size: 12px; }
.document-panel { display: flex; flex-direction: column; gap: 8px; }
.document-status { margin: 0; padding: 8px 10px; border: 1px solid #d7e0e7; border-radius: 4px; color: #526779; background: #f7f9fb; font-size: 11px; }
.document-status.ready { color: #176343; border-color: #b9ddc9; background: #eff9f4; }
.document-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.document-actions form { margin: 0; }
.document-upload { display: inline-flex !important; }
.document-upload input { position: absolute; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.final-action { color: #fff; border-color: #1e7552; background: #25845f; }
.document-note { color: #637687; font-size: 11px; }
.document-preview-placeholder { min-height: 360px; display: grid; place-items: center; align-content: center; gap: 7px; border: 1px dashed #c8d3dd; border-radius: 5px; color: #718393; background: #f7f9fb; text-align: center; }
.document-preview-placeholder span { max-width: 640px; font-size: 11px; }
.document-preview-frame { min-height: 520px; overflow: hidden; border: 1px solid #c8d3dd; border-radius: 5px; background: #f7f9fb; }
.document-preview-frame object { width: 100%; min-height: 520px; height: calc(100vh - 430px); border: 0; }

@media (max-width: 1440px) {
  .calc-layout.with-sidebar { grid-template-columns: minmax(650px, 1fr) 292px; }
  .field-grid.six { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .method-selector { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .object-facts { grid-template-columns: repeat(5, minmax(84px, 1fr)); }
}

@media (max-width: 1180px) {
  .calc-layout.with-sidebar { grid-template-columns: 1fr; }
  .method-sidebar { position: static; max-height: none; }
  .field-grid.four,
  .coefficient-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .reference-columns { grid-template-columns: 1fr; }
  .object-overview { align-items: flex-start; flex-wrap: wrap; }
  .object-facts { flex-basis: 100%; }
}

/* Desktop navigation rail parity: compact 60 px rail, explicit 180 px expansion. */
.app-shell {
  grid-template-columns: 58px minmax(0, 1fr);
  transition: grid-template-columns 160ms ease;
}

.app-shell.sidebar-expanded {
  grid-template-columns: 218px minmax(0, 1fr);
}

.sidebar {
  padding: 10px 7px 12px;
  gap: 6px;
  align-items: stretch;
  overflow: hidden;
}

.sidebar .brand {
  min-height: 43px;
  max-height: 43px;
  padding: 0;
}

.sidebar .brand-mark {
  width: 25px;
  height: 25px;
}

.sidebar .brand-title {
  color: #f1f5f9;
  font-size: 9px;
}

.nav-toggle,
.sidebar .nav-item {
  width: 100%;
  min-height: 40px;
  max-height: 40px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 5px;
  color: #c7d1dc;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.nav-toggle:hover,
.nav-toggle:focus-visible,
.sidebar .nav-item:hover {
  color: #fff;
  background: #2b3846;
  text-decoration: none;
}

.nav-toggle .nav-icon,
.sidebar .nav-item .nav-icon {
  width: 24px;
  min-width: 24px;
  height: 24px;
}

.sidebar .nav-item .nav-icon img,
.sidebar .nav-item .nav-icon svg {
  width: 24px;
  height: 24px;
}

.sidebar .nav-item[data-nav-key="cases"],
.sidebar .nav-item[data-nav-key="judicial_cases"],
.sidebar .nav-item[data-nav-key="clients"],
.sidebar .nav-item[data-nav-key="document_templates"],
.sidebar .nav-item[data-nav-key="references"],
.sidebar .nav-item[data-nav-key="administration"] {
  min-height: 46px;
}

.sidebar .nav-item[data-nav-key="cases"] .nav-icon,
.sidebar .nav-item[data-nav-key="judicial_cases"] .nav-icon,
.sidebar .nav-item[data-nav-key="clients"] .nav-icon,
.sidebar .nav-item[data-nav-key="document_templates"] .nav-icon,
.sidebar .nav-item[data-nav-key="references"] .nav-icon,
.sidebar .nav-item[data-nav-key="administration"] .nav-icon {
  width: 23px;
  min-width: 23px;
  height: 23px;
}

.sidebar .nav-item[data-nav-key="cases"] .nav-icon img,
.sidebar .nav-item[data-nav-key="judicial_cases"] .nav-icon img,
.sidebar .nav-item[data-nav-key="clients"] .nav-icon img,
.sidebar .nav-item[data-nav-key="document_templates"] .nav-icon img,
.sidebar .nav-item[data-nav-key="references"] .nav-icon img,
.sidebar .nav-item[data-nav-key="administration"] .nav-icon img {
  width: 23px;
  height: 23px;
  opacity: .96;
}

.nav-toggle .nav-icon img,
.sidebar .nav-item .nav-icon img {
  width: 19px;
  height: 19px;
}

.nav-toggle .nav-label,
.sidebar .nav-item .nav-label {
  display: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-expanded .nav-toggle,
.sidebar-expanded .nav-item {
  justify-content: flex-start;
}

.sidebar-expanded .nav-toggle .nav-label,
.sidebar-expanded .nav-item .nav-label {
  display: inline;
}

.sidebar .nav {
  gap: 6px;
}

.sidebar .nav-divider {
  width: calc(100% - 14px);
  min-height: 1px;
  margin: 5px 7px;
}

@media (prefers-reduced-motion: reduce) {
  .app-shell {
    transition: none;
  }
}

/* Administrative Server Health panel. */
.server-health-trigger {
  min-height: 31px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #435262;
  border-radius: 5px;
  color: #e8eef3;
  background: #2b3846;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.server-health-trigger:hover,
.server-health-trigger:focus-visible {
  color: #fff;
  border-color: #687989;
  outline: none;
}

.server-health-trigger.is-normal { border-color: #3f7e61; background: #253d34; }
.server-health-trigger.is-warning { border-color: #a7812c; background: #493f28; }
.server-health-trigger.is-critical { border-color: #a84a4a; background: #4c2d31; }
.server-health-trigger.is-unknown,
.server-health-trigger.is-loading { border-color: #68717a; background: #37404a; }

.bottom-user {
  min-height: 31px;
  margin: 0;
  padding-left: 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-left: 1px solid #3a4652;
  color: #aab5bf;
}

.bottom-user span {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-user button {
  border: 0;
  padding: 3px 6px;
  color: #cbd4dc;
  background: transparent;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.bottom-user button:hover { color: #fff; }

.server-health-scrim {
  position: fixed;
  inset: 0 0 42px;
  z-index: 70;
  background: rgba(20, 38, 32, 0.16);
}

.server-health-scrim[hidden] { display: none; }

.ups-warning {
  position: fixed; z-index: 150; top: 18px; left: 50%; width: min(630px, calc(100vw - 34px));
  transform: translateX(-50%); display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 13px;
  padding: 16px 18px; border: 1px solid #d78138; border-left: 5px solid #be5327; border-radius: 9px;
  color: #55321f; background: #fff8f0; box-shadow: 0 16px 38px rgba(86, 46, 22, .24);
}
.ups-warning[hidden], .ups-restored-toast[hidden] { display: none; }
.ups-warning.is-emergency { border-color: #c44a45; border-left-color: #a9302d; color: #6b2423; background: #fff4f3; }
.ups-warning-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #c96b2e; font-size: 21px; }
.ups-warning.is-emergency .ups-warning-icon { background: #b73b36; }
.ups-warning-kicker { margin: 0 0 3px; color: #96612d; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.ups-warning h2 { margin: 0; font-size: 18px; }
.ups-warning > div > p:not(.ups-warning-kicker) { margin: 6px 0 0; font-size: 13px; line-height: 1.4; }
.ups-warning-details { margin: 13px 0 0; display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 8px; }
.ups-warning-details div { padding: 7px 9px; border-radius: 5px; background: rgba(255,255,255,.68); }
.ups-warning-details dt { color: #8c6a4c; font-size: 10px; }
.ups-warning-details dd { margin: 2px 0 0; font-weight: 800; font-size: 13px; }
.ups-warning-details div:first-child dd { font-size: 25px; line-height: 1; letter-spacing: .04em; }
.ups-restored-toast { position: fixed; z-index: 151; top: 18px; left: 50%; transform: translateX(-50%); padding: 11px 16px; border: 1px solid #6aa682; border-radius: 7px; color: #225b39; background: #f2fbf5; box-shadow: 0 10px 28px rgba(29, 77, 48, .18); font-size: 13px; font-weight: 700; }

.server-health-panel {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  bottom: 42px;
  width: min(500px, calc(100vw - 18px));
  display: flex;
  flex-direction: column;
  color: #263934;
  background: #f4f7f6;
  border-left: 1px solid #cedbd6;
  box-shadow: -14px 0 34px rgba(24, 48, 40, 0.18);
  transform: translateX(104%);
  visibility: hidden;
  transition: transform 180ms ease, visibility 180ms step-end;
}

.server-health-panel.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 180ms ease;
}

.server-health-header {
  min-height: 56px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d4e0dc;
  background: #fff;
}

.server-health-header h2 { margin: 0; font-size: 18px; }
.server-health-header button,
.server-events-modal header button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  color: #60716c;
  background: #edf3f1;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.server-health-scroll {
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
}

.server-health-summary,
.server-health-card,
.server-health-legend {
  margin-bottom: 10px;
  border: 1px solid #d8e3df;
  border-radius: 8px;
  background: #fff;
}

.server-health-summary {
  padding: 14px;
  border-left: 4px solid #87948f;
}

.server-health-summary.is-normal { border-left-color: #2f8b5f; background: #f4fbf7; }
.server-health-summary.is-warning { border-left-color: #c99a2f; background: #fffaf0; }
.server-health-summary.is-critical { border-left-color: #c34a4a; background: #fff5f5; }

.server-health-summary > strong { display: block; font-size: 15px; }
.server-health-summary dl { margin: 11px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.server-health-summary dl div { min-width: 0; }
.server-health-summary dt { color: #71817c; font-size: 10px; }
.server-health-summary dd { margin: 3px 0 0; color: #273c35; font-size: 12px; font-weight: 800; }
.server-health-summary p { margin: 9px 0 0; color: #6b7d77; font-size: 11px; }

.server-health-card { overflow: hidden; }
.server-health-card h3 {
  margin: 0;
  padding: 9px 12px;
  color: #39544c;
  background: #e8f1ee;
  border-bottom: 1px solid #d5e1dd;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.server-health-rows { padding: 3px 11px; }
.server-health-row {
  min-height: 35px;
  padding: 7px 0;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #edf1ef;
  font-size: 12px;
}
.server-health-row:last-child { border-bottom: 0; }
.server-health-row-label { color: #5e716a; }
.server-health-row-value { min-width: 0; color: #273b35; font-weight: 700; overflow-wrap: anywhere; }
.server-health-state { font-size: 11px; font-weight: 800; white-space: nowrap; }
.server-health-state.is-normal { color: #187048; }
.server-health-state.is-warning { color: #927000; }
.server-health-state.is-critical { color: #a63232; }
.server-health-state.is-unknown { color: #7f8b87; }

.server-health-online { margin: 0; padding: 11px 12px 8px; font-size: 14px; font-weight: 800; }
.server-health-users { padding: 0 11px 8px; }
.server-health-user { border-top: 1px solid #e6ece9; }
.server-health-user summary {
  min-height: 37px;
  padding: 8px 1px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 800;
}
.server-health-user summary::-webkit-details-marker { display: none; }
.server-health-user-status.working { color: #187048; }
.server-health-user-status.idle { color: #7f8b87; }
.server-health-user-meta { padding: 0 6px 9px; color: #65766f; font-size: 11px; line-height: 1.5; }
.server-health-device { margin-top: 6px; padding: 7px 8px; border-radius: 5px; background: #f5f8f7; }
.server-health-device b { display: block; color: #354b44; }

.server-health-legend { padding: 10px 11px; color: #697a74; font-size: 10px; }
.server-health-legend > div { margin-top: 7px; display: flex; gap: 14px; color: #3c514a; }
.server-health-events { padding: 2px 11px; }
.server-health-event { padding: 8px 0; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 7px; border-bottom: 1px solid #edf1ef; font-size: 11px; }
.server-health-event time { color: #768680; }
.server-health-event span { color: #344840; }
.server-health-event.is-warning span { color: #806300; }
.server-health-event.is-critical span { color: #9c3030; }
.server-health-link { width: 100%; padding: 9px 12px; border: 0; color: #246447; background: #fbfdfc; font: inherit; font-size: 11px; font-weight: 800; text-align: right; cursor: pointer; }

.server-events-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 28px;
  display: grid;
  place-items: center;
  background: rgba(18, 35, 30, .34);
}
.server-events-modal[hidden] { display: none; }
.server-events-modal > section { width: min(760px, calc(100vw - 36px)); max-height: calc(100vh - 56px); display: flex; flex-direction: column; border-radius: 9px; overflow: hidden; background: #fff; box-shadow: 0 20px 55px rgba(20, 38, 32, .28); }
.server-events-modal header { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #d9e3df; }
.server-events-modal h2 { margin: 0; font-size: 17px; }
.server-events-list { min-height: 220px; padding: 4px 14px; overflow-y: auto; }
.server-events-list .server-health-event { grid-template-columns: 120px minmax(0, 1fr); }
.server-events-modal footer { padding: 10px 14px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; border-top: 1px solid #d9e3df; background: #f7faf8; }
.server-events-modal footer span { min-width: 90px; text-align: center; color: #687973; font-size: 11px; }

.maintenance-lock { position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center; padding: 24px; background: rgba(16, 27, 24, .88); opacity: 1; visibility: visible; transition: opacity .16s ease, visibility 0s linear; }
.maintenance-lock[hidden] { display: grid; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .16s ease, visibility 0s linear .16s; }
.maintenance-lock-card { width: min(520px, calc(100vw - 32px)); padding: 28px 30px 26px; border: 1px solid rgba(255, 255, 255, .7); border-radius: 14px; background: #fff; color: #233a33; text-align: center; box-shadow: 0 24px 70px rgba(0, 0, 0, .38); }
.maintenance-lock-indicator { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: #e5f2ec; }
.maintenance-lock-indicator i { width: 24px; height: 24px; display: block; border: 3px solid #1f7e51; border-radius: 50%; }
.maintenance-lock-kicker { margin: 0 0 7px; color: #1f7e51; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.maintenance-lock-card h2 { margin: 0; font-size: clamp(22px, 4vw, 30px); line-height: 1.2; color: #203a32; }
.maintenance-lock-card > p:not(.maintenance-lock-kicker) { margin: 14px auto 0; max-width: 430px; color: #4f655e; font-size: 15px; line-height: 1.5; }
.maintenance-lock-note { margin-top: 18px; display: block; color: #6d7e78; font-size: 12px; }
html.maintenance-active, html.maintenance-active body { overflow: hidden; }
html.maintenance-active [data-app-shell] { pointer-events: none; user-select: none; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef3f1 url('/ui-assets/brand-wallpaper.png') repeat; }
.login-card { width: min(390px, 100%); padding: 24px; border: 1px solid #d4e0dc; border-radius: 10px; background: #fff; box-shadow: 0 18px 45px rgba(25, 52, 42, .12); }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand img { width: 38px; height: 38px; object-fit: contain; }
.login-brand div { display: flex; flex-direction: column; }
.login-brand strong { color: #233a32; }
.login-brand span { color: #6d7d77; font-size: 12px; }
.login-card h1 { margin: 22px 0 5px; font-size: 21px; }
.login-card > p { margin: 0 0 16px; color: #697b74; font-size: 13px; }
.login-form { display: grid; gap: 12px; }
.login-form label { display: grid; gap: 5px; color: #50655d; font-size: 12px; font-weight: 700; }
.login-form input { min-height: 38px; padding: 7px 9px; border: 1px solid #c7d7d1; border-radius: 6px; font: inherit; }
.login-error { margin-bottom: 12px; padding: 9px 10px; border: 1px solid #e4bcbc; border-radius: 6px; color: #9a3030; background: #fff5f5; font-size: 12px; }

body.modal-open { overflow: hidden; }

/* Administrative users and security workspace. */
.bottom-users {
  min-height: 31px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #435262; border-radius: 5px; color: #e8eef3; background: #2b3846;
  font-size: 11px; font-weight: 800; text-decoration: none; white-space: nowrap;
}
.bottom-users:hover, .bottom-users:focus-visible, .bottom-users.active { color: #fff; border-color: #5b806d; background: #274338; outline: none; }
.bottom-users-dot { color: #39b779; font-size: 9px; }
.bottom-users b { min-width: 18px; padding: 1px 5px; border-radius: 9px; color: #d8f4e4; background: rgba(57,183,121,.16); text-align: center; }
.users-admin { min-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.users-tabs { min-height: 39px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid #cbd9d4; }
.users-tabs button { min-height: 38px; padding: 7px 15px; border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; color: #5d7169; background: transparent; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.users-tabs button span { margin-left: 5px; padding: 1px 6px; border-radius: 9px; background: #e9efed; font-size: 10px; }
.users-tabs button.active { color: #1d6744; border-color: #cbd9d4; background: #fff; }
.users-tabs button.active span { color: #fff; background: #3f8362; }
.users-pane { min-height: 0; display: flex; flex: 1; flex-direction: column; gap: 10px; }
.users-pane[hidden] { display: none; }
.users-filters { min-height: 52px; padding: 8px 10px; display: grid; grid-template-columns: minmax(240px, 1fr) 145px 125px 145px auto; align-items: end; gap: 8px; border: 1px solid #d2dfda; border-radius: 8px; background: #f8fbfa; }
.users-filters label:not(.users-search) { display: grid; gap: 3px; color: #687b74; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.users-filters input, .users-filters select, .users-dialog input, .users-dialog select, .user-drawer input, .user-drawer select { min-width: 0; min-height: 34px; padding: 6px 9px; border: 1px solid #c6d6d0; border-radius: 5px; color: #243932; background: #fff; font: inherit; font-size: 12px; }
.users-filters input:focus, .users-filters select:focus, .users-dialog input:focus, .users-dialog select:focus, .user-drawer input:focus, .user-drawer select:focus { outline: 0; border-color: #408667; box-shadow: 0 0 0 2px rgba(64,134,103,.12); }
.users-online-summary { min-height: 34px; display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; color: #567069; font-size: 11px; white-space: nowrap; }
.users-online-summary i { width: 8px; height: 8px; border-radius: 50%; background: #35a96f; box-shadow: 0 0 0 3px rgba(53,169,111,.12); }
.users-online-summary b { color: #21724d; }
.users-table-wrap { min-height: 0; flex: 1; overflow: auto; border: 1px solid #d2dfda; border-radius: 8px; background: #fff; }
.users-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
.users-table th { position: sticky; top: 0; z-index: 2; height: 34px; padding: 7px 9px; border-bottom: 1px solid #d5e1dd; color: #587067; background: #edf4f1; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.users-table td { height: 48px; padding: 7px 9px; border-bottom: 1px solid #e6edeb; color: #31453e; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-table tbody tr { cursor: pointer; }
.users-table tbody tr:hover, .users-table tbody tr:focus-within { background: #f5faf7; }
.users-table tbody tr.selected { background: #e9f4ee; box-shadow: inset 3px 0 #278456; }
.users-table th:nth-child(1) { width: 20%; }.users-table th:nth-child(2) { width: 11%; }.users-table th:nth-child(3) { width: 10%; }.users-table th:nth-child(4) { width: 9%; }.users-table th:nth-child(5) { width: 15%; }.users-table th:nth-child(6) { width: 11%; }.users-table th:nth-child(7) { width: 14%; }.users-table th:nth-child(8) { width: 7%; }.users-table th:nth-child(9) { width: 36px; }
.user-name-cell { display: grid; gap: 2px; }
.user-name-cell strong { overflow: hidden; color: #1e543d; text-overflow: ellipsis; }
.user-name-cell small { overflow: hidden; color: #788982; text-overflow: ellipsis; }
.user-status-chip, .user-presence-chip, .session-state-chip, .security-result-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 21px; padding: 2px 7px; border: 1px solid #d0dcd8; border-radius: 11px; color: #5f706a; background: #f5f8f7; font-size: 9px; font-weight: 900; letter-spacing: .03em; }
.user-status-chip.is-active { color: #23734d; border-color: #b8d8c8; background: #edf8f2; }
.user-status-chip.is-blocked { color: #8a6420; border-color: #e3d09e; background: #fff8e8; }
.user-status-chip.is-disabled { color: #7a5555; border-color: #dcc7c7; background: #f8f2f2; }
.user-presence-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #98a59f; }
.user-presence-chip.is-online { color: #216f4a; border-color: transparent; background: transparent; }
.user-presence-chip.is-online::before { background: #35a96f; box-shadow: 0 0 0 3px rgba(53,169,111,.12); }
.user-row-menu { width: 28px; height: 28px; border: 1px solid #cad9d3; border-radius: 5px; color: #345047; background: #fff; font-size: 15px; cursor: pointer; }
.users-loading, .users-empty { height: 100px !important; color: #758780 !important; text-align: center; white-space: normal !important; }
.users-security-filters { grid-template-columns: minmax(240px, 1fr) 250px auto; }
.users-security-note { align-self: center; color: #71837c; font-size: 10px; text-align: right; }
.security-table th:nth-child(1) { width: 15%; }.security-table th:nth-child(2) { width: 16%; }.security-table th:nth-child(3) { width: 15%; }.security-table th:nth-child(4) { width: 12%; }.security-table th:nth-child(5) { width: 15%; }.security-table th:nth-child(6) { width: 18%; }.security-table th:nth-child(7) { width: 12%; }
.security-table tbody tr { cursor: default; }
.security-event-type { color: #315d4a; font-weight: 900; font-size: 10px; }
.security-event-type.is-alert { color: #946420; }
.security-result-chip.is-success { color: #23734d; border-color: #c2dece; background: #eff8f3; }
.security-result-chip.is-failure { color: #8d4a3d; border-color: #e1c5bd; background: #fff5f2; }
.suspicious-summary { border: 1px solid #dfd2ad; border-left: 4px solid #b98b31; border-radius: 8px; background: #fffaf0; }
.suspicious-summary[hidden] { display: none; }
.suspicious-summary > header { padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #eadfc2; }
.suspicious-summary header span { color: #9a7126; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.suspicious-summary h2 { margin: 2px 0 0; color: #5b4825; font-size: 13px; }
.suspicious-summary header p { margin: 0; color: #776848; font-size: 10px; }
.suspicious-summary > div { display: flex; gap: 7px; padding: 8px 10px; overflow-x: auto; }
.suspicious-item { min-width: 260px; padding: 7px 9px; border: 1px solid #e7dbc0; border-radius: 6px; color: #6c5a36; background: rgba(255,255,255,.7); font-size: 10px; }
.suspicious-item strong { display: block; margin-bottom: 2px; color: #634718; font-size: 11px; }
.users-drawer-scrim { position: fixed; inset: 0 0 42px; z-index: 88; background: rgba(20,38,32,.18); }
.users-drawer-scrim[hidden] { display: none; }
.user-drawer { position: fixed; z-index: 89; top: 0; right: 0; bottom: 42px; width: min(540px, calc(100vw - 18px)); display: flex; flex-direction: column; border-left: 1px solid #cbd9d4; color: #283d35; background: #f5f8f7; box-shadow: -16px 0 38px rgba(23,47,39,.2); transform: translateX(104%); visibility: hidden; transition: transform 180ms ease, visibility 180ms step-end; }
.user-drawer.open { transform: translateX(0); visibility: visible; transition: transform 180ms ease; }
.user-drawer > header { min-height: 68px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #d3dfdb; background: #fff; }
.user-drawer > header span, .users-dialog header span { color: #54816c; font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.user-drawer h2, .users-dialog h2 { margin: 2px 0 0; font-size: 18px; }.user-drawer header p { margin: 3px 0 0; color: #71837c; font-size: 10px; }
.user-drawer > header button, .users-dialog header > button { width: 32px; height: 32px; border: 0; border-radius: 5px; color: #60736b; background: #edf3f1; font-size: 23px; cursor: pointer; }
.user-drawer-scroll { min-height: 0; padding: 10px; overflow-y: auto; }
.user-detail-section { margin-bottom: 9px; border: 1px solid #d7e2de; border-radius: 7px; overflow: hidden; background: #fff; }
.user-detail-section > header { min-height: 33px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e0e8e5; color: #49655b; background: #eaf2ef; font-size: 10px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.user-detail-grid { margin: 0; padding: 6px 10px; display: grid; grid-template-columns: 145px minmax(0, 1fr); }
.user-detail-grid dt, .user-detail-grid dd { min-height: 31px; margin: 0; padding: 7px 0; border-bottom: 1px solid #edf1ef; font-size: 11px; }.user-detail-grid dt { color: #71827c; }.user-detail-grid dd { color: #2a4038; font-weight: 700; overflow-wrap: anywhere; }.user-detail-grid dt:last-of-type, .user-detail-grid dd:last-of-type { border-bottom: 0; }
.user-permissions-form { padding: 9px 10px; display: grid; gap: 7px; }.user-permissions-form label { display: grid; gap: 4px; color: #61756d; font-size: 10px; }.user-permissions-form small { color: #82918c; line-height: 1.4; }
.user-session, .user-device { padding: 9px 10px; border-bottom: 1px solid #e7eeeb; }.user-session:last-child, .user-device:last-child { border-bottom: 0; }.user-session-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.user-session-top strong { font-size: 11px; }.user-session-meta { margin-top: 5px; color: #6b7c75; font-size: 10px; line-height: 1.5; }.user-session-actions { margin-top: 7px; display: flex; justify-content: flex-end; }.user-session-actions .button { min-height: 28px; padding: 4px 8px; font-size: 10px; }
.session-state-chip.is-online, .session-state-chip.is-active { color: #22724c; border-color: #b9d9c8; background: #eef8f3; }.session-state-chip.is-stale, .session-state-chip.is-inactive { color: #68766f; border-color: #d4dfdb; background: #f3f6f5; }.session-state-chip.is-revoked, .session-state-chip.is-expired, .session-state-chip.is-logout { color: #815d59; border-color: #dfcbc7; background: #faf4f3; }
.user-history-more, .user-security-open { min-height: 29px; margin: 8px 10px; padding: 4px 9px; font-size: 10px; }.user-history-more[hidden] { display: none; }.user-security-event { padding: 7px 10px; border-bottom: 1px solid #e7eeeb; }.user-security-event strong, .user-security-event span { display: block; font-size: 10px; }.user-security-event span { margin-top: 2px; color: #6b7c75; }
.user-actions { padding: 9px 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }.user-actions .button { min-height: 32px; padding: 5px 8px; font-size: 10px; }.user-actions .wide { grid-column: 1 / -1; }
.users-dialog { width: min(480px, calc(100vw - 30px)); padding: 0; border: 1px solid #c9d8d2; border-radius: 9px; color: #283d35; background: #fff; box-shadow: 0 22px 58px rgba(20,42,34,.28); }.users-dialog::backdrop { background: rgba(18,35,30,.38); }.users-dialog > form, .users-dialog > section { margin: 0; }.users-dialog header { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #d7e2de; }.users-dialog-body { padding: 13px 14px; display: grid; gap: 10px; }.users-dialog-body > label:not(.users-check) { display: grid; gap: 4px; color: #5e746b; font-size: 11px; font-weight: 800; }.users-dialog-body small { color: #82918c; font-weight: 400; }.users-dialog-body > p { margin: 0; color: #65786f; font-size: 11px; line-height: 1.45; }.users-check { display: flex; align-items: center; gap: 8px; color: #405a50; font-size: 11px; }.users-check input { width: 16px; min-height: 16px; }.users-dialog footer { padding: 10px 14px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #d7e2de; background: #f7faf9; }.users-form-error { padding: 8px 9px; border: 1px solid #e2bdb8; border-radius: 5px; color: #933e35 !important; background: #fff4f2; }.password-once { padding: 10px; display: grid; gap: 9px; border: 1px solid #c7ddd2; border-radius: 6px; background: #f2faf6; }.password-once code { padding: 7px; color: #174b34; background: #fff; font-size: 14px; font-weight: 900; text-align: center; letter-spacing: .04em; user-select: all; }.users-toast { position: fixed; z-index: 140; right: 20px; bottom: 58px; max-width: 380px; padding: 10px 13px; border: 1px solid #9bc8b2; border-radius: 6px; color: #205f40; background: #eff9f4; box-shadow: 0 10px 28px rgba(25,72,51,.18); font-size: 11px; font-weight: 700; }.users-toast.error { color: #8e3d35; border-color: #dfaaa4; background: #fff3f1; }

@media (max-width: 1180px) {
  .users-filters { grid-template-columns: minmax(210px, 1fr) 125px 110px 125px auto; }
  .users-table th:nth-child(6), .users-table td:nth-child(6), .users-table th:nth-child(7), .users-table td:nth-child(7) { display: none; }
  .users-table th:nth-child(1) { width: 25%; }.users-table th:nth-child(2) { width: 14%; }.users-table th:nth-child(3) { width: 12%; }.users-table th:nth-child(4) { width: 12%; }.users-table th:nth-child(5) { width: 22%; }
  .security-table th:nth-child(5), .security-table td:nth-child(5) { display: none; }
}
@media (max-width: 820px) {
  .bottom-users span:not(.bottom-users-dot) { display: none; }
  .users-filters, .users-security-filters { grid-template-columns: 1fr 1fr; }.users-search, .users-security-note, .users-online-summary { grid-column: 1 / -1; }.users-online-summary { justify-content: flex-start; }
  .users-table th:nth-child(2), .users-table td:nth-child(2), .users-table th:nth-child(5), .users-table td:nth-child(5) { display: none; }
  .user-drawer { width: min(100vw, 540px); bottom: 0; }
}
.market-offer-modal { position: fixed; inset: 0; z-index: 180; padding: 18px; display: grid; place-items: center; background: rgba(18,34,49,.48); }
.market-offer-modal[hidden] { display: none; }
.market-offer-dialog { width: min(1380px, calc(100vw - 30px)); height: min(900px, calc(100vh - 30px)); display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; overflow: hidden; border: 1px solid #b9cad8; border-radius: 9px; background: #f4f8fb; box-shadow: 0 24px 65px rgba(17,38,56,.3); }
.market-offer-dialog > header { min-height: 82px; padding: 16px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid #cbd9e4; background: #edf5fa; }
.market-offer-dialog h2 { margin: 0; color: #182d41; font-size: 24px; }
.market-offer-dialog header p { margin: 6px 0 0; color: #6a8093; font-size: 15px; }
.market-offer-dialog header button { width: 34px; height: 34px; border: 0; border-radius: 5px; color: #60798d; background: transparent; font-size: 28px; cursor: pointer; }
.market-offer-dialog-body { min-height: 0; padding: 14px 18px; display: grid; grid-template-columns: minmax(360px,.92fr) minmax(440px,1.08fr); gap: 18px; }
.market-offer-preview { min-height: 0; display: grid; place-items: center; overflow: auto; border: 1px solid #c3d3df; border-radius: 7px; background: #fff; }
.market-offer-preview img { width: 100%; height: 100%; object-fit: contain; }
.market-offer-fields { min-height: 0; padding: 2px 8px 2px 0; display: grid; align-content: start; gap: 8px; overflow-y: auto; }
.market-offer-fields label { display: grid; grid-template-columns: minmax(160px,240px) minmax(0,1fr); align-items: center; gap: 12px; color: #17202a; font-size: 14px; }
.market-offer-fields input { min-width: 0; min-height: 39px; padding: 7px 10px; border: 1px solid #bfd0dd; border-radius: 6px; color: #17222d; background: #fff; font: inherit; }
.market-offer-fields input:focus { outline: 0; border-color: #2785c5; box-shadow: 0 0 0 2px rgba(39,133,197,.13); }
.market-offer-fields input.missing { border-color: #ff185d; background: #fffafb; }
.market-offer-fields input:disabled { color: #8293a1; background: #eef3f6; }
.market-offer-dialog-message { margin: 0 18px 10px; padding: 10px 13px; border: 1px solid #b9d2e1; border-radius: 5px; color: #3e6178; background: #edf7fc; font-size: 13px; }
.market-offer-dialog-message.warning { border-color: #e5bd61; color: #805600; background: #fff8e6; }
.market-offer-dialog-message.success { border-color: #8bcbb2; color: #126644; background: #effaf5; }
.market-offer-dialog-message.error { border-color: #e4a2a2; color: #a42e2e; background: #fff2f2; }
.market-offer-dialog > footer { min-height: 55px; padding: 9px 18px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; border-top: 1px solid #cbd9e4; background: #f8fbfd; }
.market-offer-dialog > footer button { min-width: 130px; min-height: 36px; }
.market-offer-dialog > footer .ev-primary-button { border: 1px solid #d80a4d; border-radius: 5px; color: #fff; background: #ff0054; font: inherit; font-weight: 800; cursor: pointer; }
.market-offer-dialog > footer .ev-primary-button:disabled { border-color: #b9c4cc; color: #81909b; background: #dbe2e7; cursor: default; }

@media (max-width: 980px) {
  .bottom-version,
  .bottom-user span { display: none; }
  .server-health-trigger { max-width: 235px; overflow: hidden; }
  .market-offer-dialog-body { grid-template-columns: 1fr; }
  .market-offer-preview { min-height: 280px; }
  .market-offer-fields { max-height: 42vh; }
}

@media (max-width: 640px) {
  .ups-warning { top: 9px; grid-template-columns: 35px minmax(0, 1fr); padding: 12px; }
  .ups-warning-icon { width: 34px; height: 34px; font-size: 17px; }
  .ups-warning-details { grid-template-columns: 1fr 1fr; }
  .server-health-panel { width: 100vw; bottom: 42px; }
  .server-health-summary dl { grid-template-columns: 1fr 1fr; }
  .server-health-row { grid-template-columns: 105px minmax(0, 1fr); }
  .server-health-state { grid-column: 2; }
  .server-events-modal { padding: 10px; }
  .market-offer-modal { padding: 5px; }
  .market-offer-dialog { width: calc(100vw - 10px); height: calc(100vh - 10px); }
  .market-offer-dialog h2 { font-size: 18px; }
  .market-offer-dialog header p { font-size: 12px; }
  .market-offer-dialog-body { padding: 8px; gap: 8px; }
  .market-offer-preview { min-height: 180px; }
  .market-offer-fields label { grid-template-columns: 1fr; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .server-health-panel { transition: none; }
}

/* Adaptive two-level application/case shell. Calculation and persistence rules stay unchanged. */
:root { --shell-sidebar-width: 180px; --shell-rail-width: 60px; --shell-footer-height: 30px; }
body { min-width: 0; font-size: 14px; }
.app-shell { min-height: 100vh; height: 100vh; grid-template-columns: var(--shell-rail-width) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) var(--shell-footer-height); }
.app-shell.sidebar-expanded { grid-template-columns: var(--shell-sidebar-width) minmax(0, 1fr); }
.workspace { background: #f2f5f7; }
.content { min-width: 0; padding: 14px 18px 24px; }
.object-screen .content, .calculation-screen .content { padding: 10px 14px 18px; background: #f2f5f7; }
.object-screen .topbar, .calculation-screen .topbar { display: flex; }
.sidebar { position: relative; z-index: 50; width: 100%; overflow: hidden; padding: 8px 7px 10px; }
.sidebar .brand { min-width: 0; flex: 0 0 46px; border: 0; color: #fff; background: transparent; font: inherit; cursor: pointer; }
.sidebar .brand:hover { background: #2b3846; }
.sidebar .brand:focus-visible { outline-color: #9ed2ff; }
.sidebar .brand-text { display: none; min-width: 0; text-align: left; }
.sidebar-expanded .brand { justify-content: flex-start; padding: 0 9px; }
.sidebar-expanded .brand-text { display: block; }
.sidebar-expanded .brand-title { font-size: 13px; }
.sidebar-expanded .brand-subtitle { display: block; color: #91a4b4; font-size: 9px; }
.sidebar .nav { min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }
.sidebar .nav-item { flex: 0 0 auto; max-height: none; }
.sidebar .nav-label { white-space: normal; line-height: 1.2; }
.sidebar .nav-label small { display: block; margin-top: 2px; color: #91a4b4; font-size: 9px; font-weight: 500; }
.nav-group-label, .current-case { display: none; }
.sidebar-expanded .nav-group-label { display: block; padding: 12px 10px 4px; color: #7f95a7; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-expanded .current-case { display: flex; margin: 3px 2px 5px; padding: 11px; flex-direction: column; gap: 5px; border: 1px solid #385064; border-radius: 6px; color: #f4f8fb; background: #193149; }
.current-case-kicker { color: #8fa9bd; font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.current-case strong { font-size: 14px; }
.current-case-vehicle { font-size: 12px; line-height: 1.3; }
.current-case-plate { color: #c5d5e2; font-size: 11px; }
.current-case-edit { margin-top: 4px; color: #9ed2ff; font-size: 10px; text-decoration: underline; }
.current-object-select { display: grid; gap: 4px; color: #b9cbd9; font-size: 9px; }
.current-object-select select { min-height: 32px; padding: 5px 7px; border-color: #4b6275; color: #fff; background: #243f56; font-size: 11px; }
.case-tools { display: block; margin-top: 2px; }
.case-tools summary { display: none; padding: 9px 10px; color: #a9bbc9; font-size: 10px; font-weight: 700; cursor: pointer; }
.sidebar-expanded .case-tools { margin-top: 4px; }
.sidebar-expanded .case-tools summary { display: list-item; }
.case-tools .nav-item { margin-top: 3px; }
.case-tools-collapsed { display: none; }
.nav-item.disabled { opacity: .68; }
.topbar { position: sticky; z-index: 45; top: 0; min-height: 62px; padding: 9px 18px; align-items: center; background: #fff; box-shadow: 0 1px 0 rgba(43, 65, 82, .08); }
.topbar-heading { min-width: 0; flex: 1; }
.topbar-title-row { min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar-section-icon { width: 34px; min-width: 34px; height: 34px; object-fit: contain; }
.topbar h1 { font-size: 19px; }
.topbar p { margin-top: 2px; }
.topbar-case-context { min-width: 0; margin-top: 0; padding-left: 8px; display: flex; align-items: center; gap: 5px; border-left: 1px solid #d7e2ea; color: #526b7d; font-size: 11px; line-height: 1.25; white-space: nowrap; }
.topbar-case-context label { min-width: 0; }
.topbar-case-context select { max-width: 330px; min-height: 24px; padding: 2px 24px 2px 5px; border: 1px solid #ccd8e1; border-radius: 4px; color: #405a6d; background: #fff; font: inherit; }
.sidebar-expanded .topbar-case-context { display: flex; }
.topbar-actions { flex-wrap: nowrap; align-items: center; }
.topbar-save-status { max-width: 280px; margin-top: 2px; display: block; color: #6e8190; font-size: 10px; line-height: 1.2; }
.topbar-save-status.saving { color: #8a6412; }
.topbar-save-status.saved { color: #23724e; }
.topbar-save-status.error { color: #a33a3a; }
.topbar-icon { width: 34px; min-width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border: 1px solid #c8d4dd; border-radius: 6px; color: #3f596d; background: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.topbar-icon:hover { border-color: #6b8eaa; text-decoration: none; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.bottom-utility { height: var(--shell-footer-height); min-height: var(--shell-footer-height); padding: 2px 10px; font-size: 10px; }
.bottom-log { min-height: 23px; }
.pending-section { min-height: 210px; padding: 34px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.pending-section h2 { padding: 0; border: 0; background: transparent; font-size: 18px; }
.pending-section p { max-width: 660px; color: var(--muted); }
.pending-section-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: #55728a; background: #e7eff5; font-size: 25px; }
.case-filters { align-items: end; flex-wrap: wrap; }
.case-filters label { width: 190px; display: grid; gap: 4px; color: #536b7b; font-size: 10px; font-weight: 700; }
.case-filters .search-field { min-width: 260px; flex: 1; }
.case-number-link { font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.table-wrap { max-width: 100%; }
td small { display: block; margin-top: 2px; color: var(--muted); }
.case-shell .ev-object-layout { grid-template-columns: minmax(0, 1fr); }
.case-shell .ev-side-column { position: static; min-height: 0; padding: 0; border: 0; }
.calculation-local-actions { min-height: 34px; margin: 0 0 8px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.calc-layout.with-sidebar, .market-desktop-layout { grid-template-columns: minmax(0, 1fr); }
.method-sidebar, .desktop-market-sidebar { position: static; max-height: none; border: 1px solid #cbd8e3; border-radius: 6px; }
.table-scroll, .table-wrap, .offers-table-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(42, 126, 185, .35); outline-offset: 2px; }

@media (max-width: 1099px) {
  .app-shell, .app-shell.sidebar-expanded { grid-template-columns: var(--shell-rail-width) minmax(0, 1fr); }
  .sidebar-expanded .sidebar { width: var(--shell-sidebar-width); box-shadow: 12px 0 28px rgba(14, 29, 42, .24); }
  .ev-hero-grid, .ev-tech-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 819px) {
  .topbar { min-height: 58px; padding: 7px 9px; gap: 8px; }
  .topbar h1 { font-size: 16px; }
  .topbar p { display: none; }
  .topbar-case-context { max-width: 330px; flex-wrap: wrap; font-size: 10px; }
  .topbar-case-context select { max-width: 245px; }
  .topbar-actions { gap: 5px; }
  .workspace-save { min-width: 0; padding: 7px 9px; }
  .content { padding: 10px; }
  .object-screen .content, .calculation-screen .content { padding: 8px 8px 14px; }
  .search-row { align-items: stretch; }
  .case-filters label, .case-filters .search-field { width: 100%; min-width: 0; flex-basis: 100%; }
  .summary-grid, .form-grid, .field-grid.four, .field-grid.three, .coefficient-grid, .object-facts, .ev-side-column { grid-template-columns: minmax(0, 1fr); }
  .ev-paint-grid { grid-template-columns: minmax(0, 1fr); }
  .pending-section { padding: 22px; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Final expert workspace shell: navigation, work area, context. */
:root {
  --shell-sidebar-width: 166px;
  --shell-rail-width: 60px;
  --shell-topbar-height: 62px;
  --case-context-width: 258px;
  --context-card-gap: 8px;
  --context-card-padding: 8px 9px 9px;
  --context-card-radius: 6px;
  --context-card-border: #d8e2ea;
}

html,
body {
  overflow: hidden;
}

.app-shell,
.app-shell.sidebar-expanded {
  min-width: 0;
}

.app-shell {
  grid-template-columns: var(--shell-rail-width) minmax(0, 1fr);
  transition: none;
}

.app-shell.sidebar-expanded {
  grid-template-columns: var(--shell-sidebar-width) minmax(0, 1fr);
}

.workspace,
.content {
  min-width: 0;
}

.content {
  overflow-x: hidden;
}

.sidebar {
  padding: 8px 6px 10px;
}

.sidebar .brand {
  min-height: 50px;
  max-height: none;
  padding: 4px 0 7px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border-radius: 5px;
}

.sidebar .brand-mark {
  width: 25px;
  height: 25px;
  border-radius: 0;
  background: transparent;
}

.sidebar .brand-text {
  display: block;
  text-align: center;
}

.sidebar .brand-title {
  color: #f3f7fb;
  font-size: 9px;
  line-height: 1;
}

.sidebar-expanded .brand {
  min-height: 50px;
  padding: 4px 0 7px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.sidebar-expanded .brand-text {
  text-align: center;
}

.sidebar-expanded .brand-title {
  font-size: 9px;
}

.sidebar .nav {
  gap: 3px;
}

.sidebar .nav-item {
  min-height: 34px;
  max-height: none;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
}

.sidebar .nav-item .nav-icon {
  width: 24px;
  min-width: 24px;
  height: 24px;
}

.sidebar .nav-item .nav-icon img,
.sidebar .nav-item .nav-icon svg {
  width: 24px;
  height: 24px;
}

.sidebar .nav-item[data-nav-key="objects"],
.sidebar .nav-item[data-nav-key="wear"],
.sidebar .nav-item[data-nav-key="damage"],
.sidebar .nav-item[data-nav-key="market_value"],
.sidebar .nav-item[data-nav-key="uts"],
.sidebar .nav-item[data-nav-key="gots"],
.sidebar .nav-item[data-nav-key="judicial_expertise"] {
  min-height: 38px;
}

.sidebar .nav-item[data-nav-key="objects"] .nav-icon,
.sidebar .nav-item[data-nav-key="wear"] .nav-icon,
.sidebar .nav-item[data-nav-key="damage"] .nav-icon,
.sidebar .nav-item[data-nav-key="market_value"] .nav-icon,
.sidebar .nav-item[data-nav-key="uts"] .nav-icon,
.sidebar .nav-item[data-nav-key="gots"] .nav-icon,
.sidebar .nav-item[data-nav-key="judicial_expertise"] .nav-icon {
  width: 30px;
  min-width: 30px;
  height: 30px;
}

.sidebar .nav-item[data-nav-key="objects"] .nav-icon img,
.sidebar .nav-item[data-nav-key="wear"] .nav-icon img,
.sidebar .nav-item[data-nav-key="damage"] .nav-icon img,
.sidebar .nav-item[data-nav-key="market_value"] .nav-icon img,
.sidebar .nav-item[data-nav-key="uts"] .nav-icon img,
.sidebar .nav-item[data-nav-key="gots"] .nav-icon img,
.sidebar .nav-item[data-nav-key="judicial_expertise"] .nav-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  opacity: 1;
}

.app-shell:not(.sidebar-expanded) .nav-item.disabled {
  min-height: 30px;
  opacity: .5;
}

.app-shell:not(.sidebar-expanded) .nav-item.disabled .nav-icon,
.app-shell:not(.sidebar-expanded) .nav-item.disabled .nav-icon img,
.app-shell:not(.sidebar-expanded) .nav-item.disabled .nav-icon svg {
  width: 20px;
  min-width: 20px;
  height: 20px;
}

.app-shell:not(.sidebar-expanded) .case-tools {
  display: none;
}

.app-shell:not(.sidebar-expanded) .case-tools-collapsed {
  margin: 6px 8px 0;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid rgba(143, 169, 189, .22);
}

.case-tool-shortcut {
  width: 34px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #b9c8d6;
  text-decoration: none;
  opacity: .68;
}

.case-tool-shortcut img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: .92;
}

.case-tool-shortcut span {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.case-tool-shortcut:hover,
.case-tool-shortcut:focus-visible {
  color: #fff;
  background: #26394b;
  opacity: .95;
}

.case-tool-shortcut.active {
  color: #fff;
  background: #2d3b49;
  opacity: 1;
}

.case-tool-shortcut.active img {
  filter: none;
  opacity: 1;
}

.sidebar-expanded .case-tools-collapsed {
  display: none;
}

.sidebar-expanded .nav-item {
  gap: 7px;
  font-size: 10px;
  line-height: 1.1;
}

.sidebar-expanded .nav-item .nav-label {
  max-width: 76px;
  line-height: 1.1;
}

.sidebar-expanded .nav-item[data-nav-key="market_value"] .nav-label {
  max-width: 62px;
}

.sidebar-expanded .nav-item[data-nav-key="objects"],
.sidebar-expanded .nav-item[data-nav-key="wear"],
.sidebar-expanded .nav-item[data-nav-key="damage"],
.sidebar-expanded .nav-item[data-nav-key="market_value"],
.sidebar-expanded .nav-item[data-nav-key="uts"],
.sidebar-expanded .nav-item[data-nav-key="gots"],
.sidebar-expanded .nav-item[data-nav-key="judicial_expertise"] {
  min-height: 34px;
}

.sidebar-expanded .nav-item[data-nav-key="objects"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="wear"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="damage"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="market_value"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="uts"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="gots"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="judicial_expertise"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="objects"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="wear"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="damage"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="market_value"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="uts"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="gots"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="judicial_expertise"] .nav-icon img {
  width: 25px;
  min-width: 25px;
  height: 25px;
}

.sidebar-expanded .nav-item[data-nav-key="cases"],
.sidebar-expanded .nav-item[data-nav-key="judicial_cases"],
.sidebar-expanded .nav-item[data-nav-key="clients"],
.sidebar-expanded .nav-item[data-nav-key="document_templates"],
.sidebar-expanded .nav-item[data-nav-key="references"],
.sidebar-expanded .nav-item[data-nav-key="administration"] {
  min-height: 46px;
  gap: 7px;
}

.sidebar-expanded .nav-item[data-nav-key="cases"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="judicial_cases"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="clients"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="document_templates"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="references"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="administration"] .nav-icon,
.sidebar-expanded .nav-item[data-nav-key="cases"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="judicial_cases"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="clients"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="document_templates"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="references"] .nav-icon img,
.sidebar-expanded .nav-item[data-nav-key="administration"] .nav-icon img {
  width: 22px;
  min-width: 22px;
  height: 22px;
}

.sidebar-expanded .nav-item[data-nav-key="cases"] .nav-label,
.sidebar-expanded .nav-item[data-nav-key="judicial_cases"] .nav-label,
.sidebar-expanded .nav-item[data-nav-key="clients"] .nav-label,
.sidebar-expanded .nav-item[data-nav-key="document_templates"] .nav-label,
.sidebar-expanded .nav-item[data-nav-key="references"] .nav-label,
.sidebar-expanded .nav-item[data-nav-key="administration"] .nav-label {
  max-width: 76px;
  font-size: 10px;
  line-height: 1.1;
}

.sidebar-expanded .nav-group-label {
  padding: 8px 8px 3px;
  font-size: 8px;
}

.sidebar-expanded .current-case {
  margin: 2px 1px 4px;
  padding: 8px 9px;
  gap: 3px;
}

.current-case strong {
  font-size: 13px;
  line-height: 1.15;
}

.case-tools summary {
  padding: 7px 9px;
}

.topbar {
  height: var(--shell-topbar-height);
  min-height: var(--shell-topbar-height);
  padding: 8px 16px;
  flex: 0 0 var(--shell-topbar-height);
}

.topbar-heading {
  display: flex;
  min-height: 44px;
  flex-direction: column;
  justify-content: center;
}

.topbar-title-row {
  min-width: 0;
  gap: 8px;
}

.topbar-section-icon {
  width: 30px;
  min-width: 30px;
  height: 30px;
  object-fit: contain;
  opacity: .95;
  filter: brightness(0) saturate(100%) invert(14%) sepia(16%) saturate(735%) hue-rotate(128deg) brightness(94%) contrast(90%);
}

.topbar h1 {
  font-size: 16px;
  line-height: 1.12;
  font-weight: 800;
}

.topbar-case-context {
  max-width: 300px;
  margin-left: 5px;
  padding: 1px 0 1px 12px;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 7px;
  border-left: 1px solid #d8e1e8;
  color: #6f8190;
  background: transparent;
  font-size: 9px;
  line-height: 1.15;
}

.topbar-case-label {
  color: #7a8b99;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.topbar-case-context b {
  color: #2f4d63;
  font-size: 12px;
  font-weight: 900;
}

.sidebar-expanded .topbar-case-context {
  display: flex;
}

.workspace-save {
  width: 124px;
  min-width: 124px;
  transition: background 120ms ease, border-color 120ms ease;
}

.topbar-actions {
  min-height: 36px;
}

.button,
.topbar-icon,
.server-health-trigger {
  flex: 0 0 auto;
}

.workspace-save.saving {
  border-color: #b98519;
  background: #b98519;
}

.workspace-save.saved {
  border-color: #168a51;
  background: #168a51;
}

.workspace-save.error {
  border-color: #a63232;
  background: #a63232;
}

.server-health-trigger {
  width: auto;
  min-width: 82px;
  padding: 0 10px;
  gap: 6px;
  color: #3f596d;
  border-color: #c8d4dd;
  background: #fff;
  box-shadow: none;
}

.server-health-trigger:hover,
.server-health-trigger:focus-visible {
  color: #22394d;
  border-color: #7f9bb2;
  background: #f8fbfd;
}

.server-health-trigger-dot {
  width: 9px;
  height: 9px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: transparent;
  background: #8f9ca7;
}

.server-health-trigger.is-normal,
.server-health-trigger.is-warning,
.server-health-trigger.is-critical,
.server-health-trigger.is-unknown,
.server-health-trigger.is-loading {
  background: #fff;
}

.server-health-trigger.is-normal { border-color: #b8d8c8; }
.server-health-trigger.is-warning { border-color: #e2ca82; }
.server-health-trigger.is-critical { border-color: #e0a6a6; }
.server-health-trigger.is-unknown,
.server-health-trigger.is-loading { border-color: #c8d4dd; }
.server-health-trigger.is-normal .server-health-trigger-dot { background: #1f9d62; }
.server-health-trigger.is-warning .server-health-trigger-dot { background: #c4911f; }
.server-health-trigger.is-critical .server-health-trigger-dot { background: #c54444; }
.server-health-trigger.is-unknown .server-health-trigger-dot,
.server-health-trigger.is-loading .server-health-trigger-dot { background: #8f9ca7; }

.server-health-trigger-label {
  font-size: 11px;
  font-weight: 800;
}

.context-toggle {
  display: none;
  width: auto;
  min-width: 78px;
  padding: 0 10px;
  font-size: 11px;
}

.case-shell .ev-object-layout,
.calc-layout.with-sidebar,
.market-desktop-layout {
  grid-template-columns: minmax(0, 1fr) var(--case-context-width);
  gap: 10px;
  align-items: start;
}

.case-shell .ev-side-column,
.case-context-panel,
.method-sidebar,
.desktop-market-sidebar {
  position: sticky;
  top: calc(var(--shell-topbar-height) + 10px);
  max-height: calc(100vh - var(--shell-footer-height) - var(--shell-topbar-height) - 24px);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.case-shell .ev-side-column,
.desktop-market-sidebar,
.method-sidebar {
  width: 100%;
  padding: var(--context-card-gap);
  border: 1px solid #cfdbe5;
  border-radius: 7px;
  background: #f8fafc;
}

.case-shell .ev-side-column {
  display: flex;
  flex-direction: column;
  gap: var(--context-card-gap);
  align-self: start;
}

.method-sidebar > h2,
.desktop-market-sidebar > h2 {
  margin: 1px 0 8px;
  color: #2e4356;
  font-size: 11px;
  letter-spacing: .02em;
}

.ev-info-card,
.method-sidebar section,
.progress-card,
.desktop-market-sidebar section {
  border-color: var(--context-card-border);
  border-radius: var(--context-card-radius);
  background: #fff;
  box-shadow: none;
}

.ev-info-card,
.method-sidebar section,
.progress-card,
.desktop-market-sidebar section,
.desktop-pp-check {
  padding: var(--context-card-padding);
}

.method-sidebar section h3,
.desktop-market-sidebar section h3 {
  margin: 0 0 6px;
  color: #51697e;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .03em;
}

.method-sidebar dl {
  grid-template-columns: minmax(78px, .85fr) minmax(0, 1.15fr);
  gap: 6px 8px;
}

.method-sidebar dt,
.method-sidebar dd {
  font-size: 10px;
  line-height: 1.25;
}

.method-sidebar section p {
  color: #526779;
  font-size: 10px;
  line-height: 1.45;
}

.context-case-card h3,
.tone-card h3,
.desktop-market-sidebar .desktop-pp-check h3 {
  margin: 0 0 6px;
  color: #51697e;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .03em;
}

.context-case-card dl,
.tone-card dl,
.desktop-market-sidebar .desktop-pp-check dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(78px, .85fr) minmax(0, 1.15fr);
  gap: 6px 8px;
}

.context-case-card dt,
.tone-card dt,
.desktop-market-sidebar .desktop-pp-check dt {
  color: #65798a;
  font-size: 10px;
  line-height: 1.25;
}

.context-case-card dd,
.tone-card dd,
.desktop-market-sidebar .desktop-pp-check dd {
  margin: 0;
  color: #2f4f66;
  font-size: 10px;
  line-height: 1.25;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.desktop-market-sidebar .desktop-pp-check p,
.tone-card p,
.tone-card ul {
  margin: 0;
  color: #40586a;
  font-size: 10px;
  line-height: 1.4;
}

.tone-card ul {
  padding-left: 16px;
}

.tone-card.tone-green {
  border-color: #b8ddc9;
  background: #eff9f4;
}

.tone-card.tone-yellow {
  border-color: #e4d49b;
  background: #fffbea;
}

.tone-card.tone-red {
  border-color: #e2b7b7;
  background: #fff1f1;
}

.split-control {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-critical-status {
  display: none;
}

.context-scrim {
  display: none;
}

@media (min-width: 1100px) and (max-width: 1279px) {
  :root {
    --case-context-width: 250px;
  }

  .content,
  .object-screen .content,
  .calculation-screen .content {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 1099px) {
  .app-shell,
  .app-shell.sidebar-expanded {
    grid-template-columns: var(--shell-rail-width) minmax(0, 1fr);
  }

  .sidebar-expanded .sidebar {
    width: var(--shell-sidebar-width);
    box-shadow: 12px 0 28px rgba(14, 29, 42, .24);
  }

  .case-shell .ev-object-layout,
  .calc-layout.with-sidebar,
  .market-desktop-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-shell .ev-side-column,
  .case-context-panel,
  .method-sidebar,
  .desktop-market-sidebar {
    position: fixed;
    z-index: 76;
    top: var(--shell-topbar-height);
    right: 0;
    bottom: var(--shell-footer-height);
    width: min(330px, calc(100vw - var(--shell-rail-width) - 10px));
    max-height: none;
    border-radius: 0;
    border-top: 1px solid #cfdbe5;
    border-right: 0;
    border-bottom: 0;
    transform: translateX(104%);
    visibility: hidden;
    transition: transform 160ms ease, visibility 160ms step-end;
    box-shadow: -12px 0 28px rgba(18, 36, 50, .18);
  }

  .app-shell.context-open .case-context-panel,
  .app-shell.context-open .ev-side-column,
  .app-shell.context-open .method-sidebar,
  .app-shell.context-open .desktop-market-sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 160ms ease;
  }

  .context-toggle {
    display: inline-grid;
  }

  .context-scrim {
    position: fixed;
    z-index: 74;
    inset: var(--shell-topbar-height) 0 var(--shell-footer-height) var(--shell-rail-width);
    background: rgba(23, 40, 54, .18);
  }

  .app-shell.context-open .context-scrim:not([hidden]) {
    display: block;
  }

  .mobile-critical-status {
    margin: 0 0 8px;
    padding: 8px 10px;
    display: block;
    border: 1px solid #d8e2ea;
    border-radius: 6px;
    color: #40586a;
    background: #fff;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-critical-status.tone-yellow {
    color: #7b5c00;
    border-color: #e4d49b;
    background: #fffbea;
  }

  .mobile-critical-status.tone-red {
    color: #9d3030;
    border-color: #e2b7b7;
    background: #fff1f1;
  }
}

@media (max-width: 819px) {
  :root {
    --shell-topbar-height: 58px;
  }

  .topbar {
    padding: 7px 9px;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 16px;
  }

  .topbar p {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .workspace-save {
    width: 100px;
    min-width: 100px;
    padding: 7px 8px;
  }

  .server-health-trigger-label {
    display: none;
  }

  .server-health-trigger {
    min-width: 34px;
    width: 34px;
    padding: 0;
  }

  .context-toggle {
    min-width: 34px;
    width: 34px;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  .context-toggle::before {
    content: "К";
    color: #3f596d;
    font-weight: 900;
  }

  #vehicle-identification .ev-grid-two,
  .ev-grid-date,
  .ev-grid-norm,
  .ev-paint-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ev-grid-date .ev-field:nth-child(1),
  .ev-grid-date .ev-field:nth-child(2),
  .ev-grid-date .ev-field:nth-child(3),
  .ev-grid-date .ev-field:nth-child(4),
  .ev-grid-date .ev-field:nth-child(5) {
    grid-column: auto;
    grid-row: auto;
  }

  #vehicle-identification input[name="make"],
  #vehicle-identification input[name="model"],
  #vehicle-identification input[name="vin"],
  #vehicle-identification input[name="vin2"],
  #vehicle-identification input[name="registration_plate"],
  #vehicle-identification .ev-vin-control,
  #vehicle-identification .ev-plate-control,
  .ev-grid-date input[name="accident_date"],
  .ev-grid-date input[name="valuation_date"],
  .ev-grid-date input[name="mileage"],
  .ev-grid-date input[name="production_year"],
  .ev-grid-date input[name="production_date"],
  .ev-grid-norm select[name="normative_mileage_usage_conditions"],
  .ev-grid-norm select[name="normative_mileage_origin"],
  .ev-length-field .ev-input,
  .ev-paint-grid input[name="paint_color"],
  .ev-paint-grid select[name="paint_type"],
  .ev-paint-grid input[name="paint_code"] {
    width: 100%;
    max-width: none;
  }

  #vehicle-identification .ev-inline-action {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.sidebar .nav-item[data-nav-key="damage"] .nav-icon img,
.topbar-section-icon[src$="nav-damage-topbar.png"] {
  filter: none;
  opacity: 1;
}

/* The shell owns the viewport; wide working tables scroll inside their panels. */
html,
body {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

.app-shell,
.app-shell.sidebar-expanded {
  width: 100%;
  min-width: 0;
}

.app-shell {
  grid-template-columns: var(--shell-rail-width) minmax(0, 1fr);
}

.app-shell.sidebar-expanded {
  grid-template-columns: var(--shell-sidebar-width) minmax(0, 1fr);
}

.case-shell .ev-object-layout,
.calc-layout.with-sidebar,
.market-desktop-layout {
  grid-template-columns: minmax(0, 1fr) var(--case-context-width);
}

.case-shell .ev-side-column,
.case-context-panel,
.method-sidebar,
.desktop-market-sidebar {
  position: sticky;
  top: calc(var(--shell-topbar-height) + 10px);
  right: auto;
  bottom: auto;
  width: 100%;
  max-height: calc(100vh - var(--shell-footer-height) - var(--shell-topbar-height) - 24px);
  transform: none;
  visibility: visible;
  box-shadow: none;
}

.context-toggle,
.context-scrim {
  display: none !important;
}

.ev-hero-grid {
  grid-template-columns: 1.06fr 0.84fr 1.24fr;
}

.ev-tech-grid {
  grid-template-columns: minmax(335px, 370px) minmax(405px, 470px);
}

#vehicle-identification .ev-grid-two {
  grid-template-columns: 220px 150px;
}

#vehicle-identification input[name="make"] { width: 155px; }
#vehicle-identification input[name="model"] { width: 150px; }
#vehicle-identification input[name="vin"] { width: 220px; }
#vehicle-identification input[name="vin2"] { width: 150px; }
#vehicle-identification input[name="registration_plate"] { width: 122px; }
#vehicle-identification .ev-vin-control { width: 250px; max-width: 250px; }
#vehicle-identification .ev-plate-control { width: 157px; max-width: none; }
#vehicle-identification .ev-inline-action {
  grid-template-columns: 260px 94px;
}

.ev-grid-date {
  grid-template-columns: 125px 155px;
}

.ev-grid-date .ev-field:nth-child(1) { grid-column: 1; grid-row: 1; }
.ev-grid-date .ev-field:nth-child(2) { grid-column: 2; grid-row: 1; }
.ev-grid-date .ev-field:nth-child(3) { grid-column: 1; grid-row: 2; }
.ev-grid-date .ev-field:nth-child(4) { grid-column: 2; grid-row: 2; }
.ev-grid-date .ev-field:nth-child(5) { grid-column: 1; grid-row: 3; }

.ev-grid-date input[name="accident_date"],
.ev-grid-date input[name="production_date"] {
  width: 125px;
}

.ev-grid-date input[name="valuation_date"] { width: 155px; }
.ev-grid-date input[name="mileage"] { width: 120px; }
.ev-grid-date input[name="production_year"] { width: 90px; }

.ev-grid-norm {
  grid-template-columns: 150px 150px;
}

.ev-grid-norm select[name="normative_mileage_usage_conditions"],
.ev-grid-norm select[name="normative_mileage_origin"] {
  width: 120px;
  max-width: none;
}

.ev-length-field .ev-input {
  width: 145px;
  max-width: none;
}

.ev-paint-grid {
  grid-template-columns: 260px 300px 170px;
}

.ev-paint-grid input[name="paint_color"] { width: 210px; max-width: none; }
.ev-paint-grid select[name="paint_type"] { width: 230px; max-width: none; }
.ev-paint-grid input[name="paint_code"] { width: 120px; max-width: none; }

.topbar {
  height: var(--shell-topbar-height);
  min-height: var(--shell-topbar-height);
  padding: 8px 16px;
  gap: 10px;
}

.topbar p {
  display: block;
}

.topbar-actions {
  gap: 8px;
}

.workspace-save {
  width: 124px;
  min-width: 124px;
  padding: 0 10px;
}

.server-health-trigger {
  width: auto;
  min-width: 82px;
  padding: 0 10px;
}

.server-health-trigger-label {
  display: block;
}

.court-case-form-error {
  margin: 0 0 12px;
  border-radius: 8px;
}

.case-edit-form input.is-invalid,
.case-edit-form select.is-invalid,
.case-edit-form textarea.is-invalid {
  border-color: var(--danger);
  background: #fff3f3;
  box-shadow: 0 0 0 2px rgb(184 69 69 / 14%);
}
