:root {
  --bg: #eef1f3;
  --surface: #ffffff;
  --surface-soft: #edf2f0;
  --surface-tint: #f7f9fb;
  --ink: #1d2422;
  --muted: #65716d;
  --line: #dce3e2;
  --line-strong: #b9c8c5;
  --green: #176b5b;
  --green-dark: #0f4f43;
  --plum: #59446f;
  --amber: #a86e12;
  --brick: #984237;
  --focus: #2f6f9f;
  --source-blue: #0a2a4f;
  --source-blue-mid: #1d5d93;
  --source-blue-soft: #edf6fc;
  --source-ice: #f6fbff;
  --shadow: 0 10px 28px rgba(22, 31, 29, 0.09);
  --shadow-soft: 0 4px 14px rgba(22, 31, 29, 0.07);
  --font-ui: "Aptos", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --font-reader: "Source Serif 4", "Literata", Cambria, Georgia, "Times New Roman", serif;
  --font-mono: "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --type-ui: 15px;
  --type-reader: 16px;
  --reader-line: 1.66;
  --reader-measure: 74ch;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--type-ui);
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.11), rgba(89, 68, 111, 0.11)),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: start center;
  padding: min(10vh, 92px) 18px 18px;
  background: rgba(20, 28, 26, 0.28);
  backdrop-filter: blur(10px);
}

.command-panel {
  width: min(680px, 100%);
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(185, 200, 197, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 80px rgba(20, 28, 26, 0.24);
}

.command-search {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 9px;
  padding: 6px 7px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.command-search > svg {
  color: var(--green-dark);
}

.command-search input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.command-title {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.command-list {
  max-height: min(56vh, 460px);
  overflow-y: auto;
  display: grid;
  gap: 6px;
}

.command-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.command-item:hover,
.command-item.is-active {
  border-color: #b7d3ca;
  background: #f3faf7;
}

.command-item-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #dce7e4;
  border-radius: 8px;
  background: var(--surface);
  color: var(--green-dark);
}

.command-item-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.command-item-copy strong,
.command-item-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-item-copy strong {
  font-size: 14px;
  font-weight: 850;
}

.command-item-copy span,
.command-item-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.command-item-meta {
  white-space: nowrap;
}

.command-empty {
  padding: 18px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-tint);
  text-align: center;
  font-weight: 750;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-error {
  min-height: 20px;
  color: var(--brick);
  font-weight: 650;
}

.app-shell.auth-pending {
  filter: blur(2px);
  pointer-events: none;
}

.app-shell.boot-pending {
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  display: grid;
  grid-template-columns:
    var(--lp-filter-col, 300px)
    6px
    minmax(360px, 1fr)
    6px
    var(--lp-reader-col, minmax(450px, 48vw));
  grid-template-rows: 74px minmax(0, 1fr);
  height: 100vh;
  min-height: 620px;
  min-width: 0;
  overflow: hidden;
}

.app-shell.case-view-active {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.app-shell.case-view-active .cases-view,
.app-shell.case-view-active .cases-layout,
.app-shell.case-view-active .case-main {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.app-shell.reader-empty-state {
  grid-template-columns:
    var(--lp-filter-col, 300px)
    6px
    minmax(420px, 1fr)
    0
    0;
}

.app-shell.reader-empty-state .reader-resizer,
.app-shell.reader-empty-state .reader-pane {
  display: none;
}

.app-shell.reader-empty-state .results-pane {
  grid-column: 3 / -1;
}

.app-shell.filters-collapsed {
  grid-template-columns:
    62px
    6px
    minmax(420px, 1fr)
    6px
    var(--lp-reader-col, minmax(450px, 48vw));
}

.app-shell.reader-empty-state.filters-collapsed {
  grid-template-columns:
    62px
    6px
    minmax(420px, 1fr)
    0
    0;
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(174px, 0.72fr) minmax(0, 1.72fr) minmax(210px, 0.72fr);
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 250, 0.92)),
    var(--surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-copy {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.98), rgba(69, 83, 111, 0.98));
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(23, 107, 91, 0.18);
}

.brand-mark-logo {
  width: 48px;
  height: 48px;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.brand-mark-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(9, 35, 63, 0.12));
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 850;
  line-height: 1.1;
  color: #08264d;
}

.brand-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.brand-tagline {
  position: relative;
  display: inline-block;
  width: max-content;
  max-width: 100%;
  padding-bottom: 7px;
  color: #1669a8;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.012em;
  text-transform: none;
}

.brand-tagline::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(8, 38, 77, 0.08), rgba(24, 135, 214, 0.74), rgba(23, 107, 91, 0.48), rgba(8, 38, 77, 0.04));
}

.brand-mode-label {
  margin-top: 2px;
  color: rgba(10, 42, 79, 0.50);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.command-trigger {
  flex: 0 0 auto;
  background: var(--surface);
  border-color: rgba(185, 200, 197, 0.9);
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.command-trigger[aria-expanded="true"] {
  color: var(--green-dark);
  border-color: #9fc8bb;
  background: #edf7f3;
}

.account-menu-wrap {
  position: relative;
  min-width: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 145px;
  max-width: 230px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--ink);
  text-align: left;
}

.account-trigger {
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.account-trigger:hover,
.account-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.user-pill-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.user-pill strong,
.user-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill strong {
  font-size: 12px;
}

.user-pill span {
  color: var(--muted);
  font-size: 11px;
}

.account-chevron {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--muted);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(280px, 86vw);
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 58px rgba(26, 38, 52, 0.18);
}

.account-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.account-menu-item:hover {
  border-color: var(--line);
  background: var(--surface-tint);
}

.account-menu-item svg {
  width: 18px;
  height: 18px;
  color: var(--green-dark);
}

.account-menu-item span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-menu-item strong {
  font-size: 13px;
  line-height: 1.2;
}

.account-menu-item small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

.top-tabs {
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(6, minmax(86px, 1fr));
  align-items: center;
  gap: 5px;
  width: min(100%, 780px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 249, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.top-tab {
  position: relative;
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.top-tab svg {
  width: 19px;
  height: 19px;
  justify-self: center;
  color: currentColor;
}

.top-tab-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.top-tab-copy strong,
.top-tab-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-tab-copy strong {
  color: inherit;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.1;
}

.top-tab-copy small {
  color: rgba(101, 113, 109, 0.86);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.1;
}

.top-tab:hover {
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
}

.top-tab.active {
  background: var(--surface);
  color: var(--green-dark);
  border-color: rgba(159, 200, 187, 0.9);
  box-shadow:
    0 8px 20px rgba(22, 31, 29, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  transform: translateY(-1px);
}

.top-tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--focus));
}

.top-tab.active .top-tab-copy small {
  color: rgba(15, 79, 67, 0.76);
}

.status-pill {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-tint);
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.status-pill.ready .dot {
  background: var(--green);
}

.status-pill.offline .dot {
  background: var(--brick);
}

.icon-button,
.primary-button,
.quiet-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  min-height: 36px;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    transform 120ms ease;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  flex: 0 0 36px;
  text-decoration: none;
}

.icon-button.active {
  border-color: #9fc8bb;
  background: #e4f1ec;
  color: var(--green-dark);
}

#favoriteDocBtn.active {
  border-color: #e0c15b;
  background: #fff7d9;
  color: #8a6400;
}

#copyCitationBtn.copied {
  border-color: var(--green);
  background: #edf7f3;
  color: var(--green-dark);
}

#copyCitationBtn[data-copy-state="failed"] {
  border-color: var(--amber);
  background: #fff8e7;
  color: #8a6400;
}

.icon-button:hover,
.quiet-button:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.icon-button:active,
.primary-button:active,
.quiet-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.danger-button {
  color: var(--brick);
}

.danger-button:hover {
  border-color: #d8aaa4;
  background: #fff3f1;
  color: #7e3028;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--green-dark);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  background: var(--surface-tint);
}

.full-width {
  width: 100%;
}

.filters-pane,
.results-pane,
.reader-pane {
  min-height: 0;
  overflow: hidden;
}

.filters-pane {
  grid-column: 1;
  grid-row: 2;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-tint);
  overflow-y: auto;
}

.workspace-resizer {
  grid-row: 2;
  position: relative;
  z-index: 6;
  cursor: col-resize;
  background:
    linear-gradient(90deg, transparent 0, transparent 2px, var(--line) 2px, var(--line) 4px, transparent 4px);
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.workspace-resizer::after {
  content: "";
  position: absolute;
  inset: 0 1px;
  border-radius: 999px;
}

.workspace-resizer:hover,
.workspace-resizer.is-dragging {
  background-color: rgba(47, 111, 159, 0.08);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 159, 0.18);
}

.filter-resizer {
  grid-column: 2;
}

.reader-resizer {
  grid-column: 4;
}

body.is-resizing-workspace {
  cursor: col-resize;
  user-select: none;
}

.pane-heading,
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.pane-heading {
  margin-bottom: 18px;
}

.filter-pane-heading {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-heading-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.filter-heading-copy svg {
  flex: 0 0 auto;
}

.filter-heading-copy > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.filter-heading-copy span {
  color: var(--ink);
  font-weight: 850;
}

.filter-heading-copy small {
  color: var(--muted);
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-panel-body {
  display: grid;
  gap: 10px;
}

.app-shell.filters-collapsed .filters-pane {
  padding: 16px 10px;
  overflow: hidden;
  background: #f7faf9;
}

.app-shell.filters-collapsed .filter-pane-heading {
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
}

.app-shell.filters-collapsed .filter-heading-copy {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  color: var(--green-dark);
}

.app-shell.filters-collapsed .filter-panel-body,
.app-shell.filters-collapsed .filter-heading-copy > div {
  display: none;
}

.app-shell.filters-collapsed .filter-heading-copy::after {
  content: "Filtre";
  color: #58756c;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.app-shell.filters-collapsed #filterPaneToggle {
  margin: 0 auto;
  border-color: rgba(159, 200, 187, 0.78);
  background: #ffffff;
  color: var(--green-dark);
  box-shadow: 0 6px 18px rgba(22, 31, 29, 0.05);
}

.filter-group,
.advanced-filter-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.02);
}

.filter-group-title {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.advanced-filter-panel > summary {
  display: grid;
  gap: 2px;
  cursor: pointer;
  list-style: none;
}

.advanced-filter-panel > summary::-webkit-details-marker {
  display: none;
}

.advanced-filter-panel > summary strong {
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.advanced-filter-panel > summary span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
}

.filter-group .field,
.advanced-filter-panel .field {
  margin-bottom: 0;
}

.compact-field {
  margin-bottom: 8px;
}

.field span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 159, 0.16);
}

.year-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.source-stack {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.source-stack-heading {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.stat-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-line strong {
  font-size: 13.5px;
}

.stat-line span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.compact-stat {
  padding: 8px 9px;
}

.results-pane {
  grid-column: 3;
  grid-row: 2;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background:
    linear-gradient(180deg, rgba(247, 250, 249, 0.92), rgba(255, 255, 255, 0) 180px),
    var(--surface);
}

.research-command {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.08), rgba(47, 111, 159, 0.06)),
    var(--surface);
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 0;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-input-wrap input {
  height: 48px;
  padding-left: 42px;
  border-color: rgba(185, 200, 197, 0.95);
  background: rgba(255, 255, 255, 0.96);
  font-size: 15.5px;
  box-shadow: 0 8px 24px rgba(22, 31, 29, 0.06);
}

.search-submit {
  min-width: 164px;
  min-height: 48px;
  font-weight: 850;
}

.active-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.active-filter-bar {
  align-items: center;
}

.active-filter-bar:empty {
  display: none;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 3px 8px 3px 10px;
  border: 1px solid #cbd9d5;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.active-filter-chip span {
  color: var(--muted);
  font-weight: 800;
}

.active-filter-chip strong {
  font-weight: 800;
}

.active-filter-chip svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.active-filter-chip .chip-leading-icon {
  width: 14px;
  height: 14px;
  color: currentColor;
}

.active-filter-chip .chip-remove-icon {
  width: 13px;
  height: 13px;
  margin-left: 1px;
  color: rgba(101, 113, 109, 0.72);
}

.active-filter-chip:hover .chip-remove-icon {
  color: var(--brick);
}

.query-token-chip {
  border-color: #a9c7bd;
  background: #edf7f3;
  color: var(--green-dark);
}

.query-token-chip span {
  color: #58756c;
}

.query-token-chip svg {
  color: var(--green-dark);
}

.query-token-chip:hover {
  border-color: #7fac9e;
  background: #e3f1ec;
}

.favorite-filter-chip {
  border-color: rgba(212, 167, 44, 0.42);
  background: #fffaf0;
  color: #73510f;
}

.favorite-filter-chip strong {
  color: #73510f;
}

.favorite-filter-chip:hover {
  border-color: rgba(212, 167, 44, 0.72);
  background: #fff6dc;
}

.research-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.research-toggle-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(185, 200, 197, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #38413e;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    transform 120ms ease;
}

.research-toggle-button svg {
  width: 16px;
  height: 16px;
}

.research-toggle-button:hover {
  border-color: #caa747;
  background: #fffaf0;
  color: #73510f;
  transform: translateY(-1px);
}

.research-toggle-button.active {
  border-color: #d4a72c;
  background: linear-gradient(135deg, rgba(212, 167, 44, 0.18), rgba(255, 255, 255, 0.86));
  color: #6a490c;
  box-shadow: inset 0 0 0 1px rgba(212, 167, 44, 0.16);
}

.research-toggle-button.is-applied {
  display: none;
}

.research-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(112px, 0.55fr));
  gap: 8px;
}

.research-overview:empty {
  display: none;
}

.research-overview-card {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid rgba(185, 200, 197, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.research-overview-card span {
  color: var(--muted);
  overflow: hidden;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.research-overview-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-overview-card.primary {
  border-color: rgba(23, 107, 91, 0.20);
  background: linear-gradient(135deg, rgba(23, 107, 91, 0.08), rgba(255, 255, 255, 0.86));
}

.results-toolbar,
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.results-toolbar select {
  width: 88px;
}

.results-toolbar.is-start-state {
  display: none;
}

.results-toolbar.is-start-state .result-limit-control {
  display: none;
}

.pager.is-start-state {
  display: none;
}

.result-list {
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #fbfcfc;
}

.result-list.is-loading {
  opacity: 0.76;
}

.research-start-state {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 42px 20px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 24%, rgba(23, 107, 91, 0.08), transparent 32%),
    #fbfcfc;
}

.research-start-main {
  max-width: 560px;
  display: grid;
  gap: 8px;
}

.research-start-main span {
  color: var(--green-dark);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.research-start-main strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.22;
}

.research-start-main p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.research-start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.research-start-actions button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid rgba(185, 200, 197, 0.88);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.90);
  color: #2d3935;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(22, 31, 29, 0.06);
}

.research-start-actions button:hover {
  border-color: rgba(23, 107, 91, 0.30);
  background: #f2faf7;
  color: var(--green-dark);
  transform: translateY(-1px);
}

.research-start-actions svg {
  width: 17px;
  height: 17px;
}

.result-skeleton {
  display: grid;
  gap: 9px;
}

.skeleton-row {
  display: grid;
  gap: 11px;
  min-height: 128px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #edf2f0 0%, #f7faf9 48%, #edf2f0 100%);
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-line.short {
  width: 38%;
}

.skeleton-line.medium {
  width: 64%;
}

.skeleton-line.long {
  width: 86%;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.result-row {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.result-row:hover,
.result-row.active {
  background: #f8fcfa;
  border-color: #b7d3ca;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.result-row:focus-visible,
.direct-match-card:focus-visible {
  border-color: var(--focus);
  box-shadow:
    0 0 0 3px rgba(47, 111, 159, 0.14),
    var(--shadow-soft);
  outline: none;
}

.result-row.active {
  border-left-color: var(--green);
  background: #f5fbf8;
  box-shadow:
    inset 0 0 0 1px rgba(23, 107, 91, 0.10),
    0 12px 28px rgba(22, 31, 29, 0.08);
}

.result-row.favorite {
  border-left-color: #d4a72c;
}

.result-row.favorite.active {
  border-left-color: #b8860b;
}

.authority-rail {
  --authority-color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}

.authority-rail strong {
  color: var(--ink);
  font-size: 12.5px;
}

.authority-rail span,
.authority-rail time {
  line-height: 1.2;
}

.authority-rank {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--authority-color) 42%, white);
  border-radius: 999px;
  background: color-mix(in srgb, var(--authority-color) 12%, white);
  color: color-mix(in srgb, var(--authority-color) 72%, black);
  font-variant-numeric: tabular-nums;
}

.authority-rail.very-high {
  --authority-color: var(--green);
}

.authority-rail.high {
  --authority-color: var(--focus);
}

.authority-rail.medium {
  --authority-color: var(--amber);
}

.authority-rail.low {
  --authority-color: var(--brick);
}

.authority-rail.support {
  --authority-color: #1f7a62;
}

.quiet-tags {
  opacity: 0.92;
}

.result-title-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.result-open-hint {
  align-self: start;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  opacity: 0;
  transform: translateX(-2px);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease;
}

.result-row:hover .result-open-hint,
.result-row.active .result-open-hint {
  border-color: rgba(23, 107, 91, 0.18);
  background: #edf7f3;
  color: var(--green-dark);
  opacity: 1;
  transform: translateX(0);
}

.result-authority-signal {
  --authority-color: var(--muted);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}

.result-authority-signal strong {
  color: #26312d;
  font-size: 12.5px;
}

.result-authority-signal.very-high {
  --authority-color: var(--green);
}

.result-authority-signal.high {
  --authority-color: var(--focus);
}

.result-authority-signal.medium {
  --authority-color: var(--amber);
}

.result-authority-signal.low {
  --authority-color: var(--brick);
}

.result-authority-signal.support {
  --authority-color: #1f7a62;
}

.result-relevance-line {
  --relevance-color: var(--muted);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--relevance-color) 18%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--relevance-color) 6%, white);
  color: #3b4642;
  font-size: 12.5px;
  line-height: 1.35;
}

.result-relevance-line strong {
  color: color-mix(in srgb, var(--relevance-color) 74%, #26312d);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.result-relevance-line span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-relevance-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--relevance-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--relevance-color) 14%, transparent);
}

.result-relevance-line.favorite {
  --relevance-color: #b8860b;
}

.result-relevance-line.direct,
.result-relevance-line.content {
  --relevance-color: var(--green);
}

.result-relevance-line.very-high {
  --relevance-color: var(--green);
}

.result-relevance-line.high {
  --relevance-color: var(--focus);
}

.result-relevance-line.medium {
  --relevance-color: var(--amber);
}

.result-relevance-line.low {
  --relevance-color: var(--brick);
}

.result-relevance-line.support {
  --relevance-color: #1f7a62;
}

.muted-chip {
  border-style: dashed;
  color: var(--muted);
  background: #f6f7f5;
}

.direct-match-stack {
  display: grid;
  gap: 8px;
  padding: 0 0 10px;
  border-bottom: 0;
  background: #f7faf8;
}

.direct-match-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #9fc8bb;
  border-left: 4px solid var(--green);
  border-radius: 10px;
  cursor: pointer;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.direct-match-card:hover {
  border-color: #74aa99;
  box-shadow:
    0 0 0 1px rgba(23, 107, 91, 0.08),
    0 14px 28px rgba(22, 31, 29, 0.09);
  transform: translateY(-1px);
}

.direct-match-head,
.result-card-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.direct-match-card.active {
  outline: 2px solid rgba(23, 107, 91, 0.16);
}

.direct-match-card.djv-direct,
.result-row.djv-row {
  border-color: rgba(31, 122, 98, 0.28);
  background:
    linear-gradient(90deg, rgba(31, 122, 98, 0.10), rgba(255, 255, 255, 0) 34%),
    var(--surface);
}

.direct-match-card.djv-direct {
  border-left-color: #1f7a62;
  box-shadow: inset 4px 0 0 rgba(31, 122, 98, 0.68), var(--shadow-soft);
}

.direct-match-kicker {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.result-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.result-identity > * {
  min-width: 0;
}

.result-identity > * + *::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 7px;
  border-radius: 999px;
  background: #b9c8c5;
  vertical-align: middle;
}

.result-citation {
  color: var(--ink);
  font-weight: 900;
}

.authority-badge {
  flex: 0 0 auto;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid #cbd9d5;
  border-radius: 999px;
  background: #f7faf9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.authority-badge.very-high {
  border-color: #abd2c5;
  background: #edf8f3;
  color: var(--green-dark);
}

.authority-badge.high {
  border-color: #b8d0df;
  background: #edf5fa;
  color: #285b78;
}

.authority-badge.medium {
  border-color: #e5cf94;
  background: #fff9e9;
  color: #7b520f;
}

.authority-badge.low {
  border-color: #e5b8ad;
  background: #fff1ee;
  color: #8d3325;
}

.authority-badge.support {
  border-color: rgba(31, 122, 98, 0.30);
  background: rgba(31, 122, 98, 0.09);
  color: #1f6b58;
}

.direct-match-title {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 850;
  line-height: 1.35;
}

.direct-match-meta,
.direct-match-reason {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.djv-chip {
  border-color: rgba(31, 122, 98, 0.34);
  background: rgba(31, 122, 98, 0.10);
  color: #1f6b58;
}

.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.result-title {
  border: 0;
  padding: 0;
  background: transparent;
  display: -webkit-box;
  overflow: hidden;
  text-align: left;
  font-weight: 750;
  font-size: 16px;
  line-height: 1.32;
  color: var(--ink);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-title:hover {
  color: var(--green-dark);
}

.result-snippet {
  display: -webkit-box;
  overflow: hidden;
  color: #38413e;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.result-preview-fallback {
  color: #59645f;
  background:
    linear-gradient(90deg, rgba(247, 250, 249, 0.96), rgba(255, 255, 255, 0));
  border-left: 2px solid rgba(185, 200, 197, 0.82);
  padding-left: 9px;
}

.result-empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
}

.result-empty-state strong {
  color: var(--ink);
  font-size: 15px;
}

.result-empty-state span {
  max-width: 440px;
  color: var(--muted);
  line-height: 1.5;
}

.result-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

mark {
  background: #ffec99;
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 28px;
  overflow: hidden;
}

.chip,
.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #3c4541;
  font-size: 12.5px;
  line-height: 1.2;
}

.label-remove {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.label-remove:hover {
  background: rgba(152, 66, 55, 0.1);
  color: var(--brick);
}

.label-remove svg {
  width: 12px;
  height: 12px;
}

.ai-chip {
  background: #e8eef8;
  color: #254b7a;
  border: 1px solid #bfd1ea;
}

.legal-chip {
  background: #edf7f3;
  color: var(--green-dark);
  border: 1px solid #9fc8bb;
  font-weight: 750;
}

.pager {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.reader-pane {
  grid-column: 5;
  grid-row: 2;
  background: var(--surface-tint);
  border-left: 1px solid var(--line);
}

.app-shell.reader-wide {
  grid-template-columns: 260px 6px minmax(320px, 0.72fr) 6px minmax(650px, 62vw);
}

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

.app-shell.reader-focus .filters-pane,
.app-shell.reader-focus .results-pane,
.app-shell.reader-focus .workspace-resizer {
  display: none;
}

.app-shell.reader-focus .reader-pane {
  grid-column: 1 / -1;
  border-left: 0;
}

.app-shell.reader-minimized {
  grid-template-columns: var(--lp-filter-col, 300px) 6px minmax(390px, 1fr) 6px 56px;
}

.app-shell.reader-minimized .reader-pane {
  overflow: hidden;
}

.app-shell.reader-wide.filters-collapsed {
  grid-template-columns: 62px 6px minmax(320px, 0.72fr) 6px minmax(650px, 62vw);
}

.app-shell.reader-minimized.filters-collapsed {
  grid-template-columns: 62px 6px minmax(390px, 1fr) 6px 56px;
}

.reader-empty {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.reader-empty svg {
  width: 38px;
  height: 38px;
  color: var(--green);
}

.reader-content {
  --reader-zoom: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.view-hidden {
  display: none !important;
}

.doc-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.doc-actions {
  position: relative;
  display: flex;
  align-items: start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.reader-size-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid rgba(185, 200, 197, 0.78);
  border-radius: 10px;
  background: #f7faf9;
}

.reader-navigation-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid rgba(185, 200, 197, 0.78);
  border-radius: 10px;
  background: #f7faf9;
}

.reader-navigation-actions .icon-button,
.reader-navigation-actions .compact-text-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  flex-basis: 34px;
  border-color: transparent;
  background: transparent;
}

.reader-navigation-actions .icon-button:hover,
.reader-navigation-actions .icon-button.active,
.reader-navigation-actions .compact-text-button:hover {
  border-color: rgba(159, 200, 187, 0.78);
  background: #ffffff;
}

.compact-text-button {
  color: #283632;
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
}

.reader-zoom-value {
  min-width: 50px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.reader-zoom-value:hover,
.reader-zoom-value.active {
  border-color: rgba(159, 200, 187, 0.78);
  background: #ffffff;
  color: var(--green-dark);
}

.reader-size-actions .icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  flex-basis: 34px;
  border-color: transparent;
  background: transparent;
}

.reader-size-actions .icon-button:hover,
.reader-size-actions .icon-button.active {
  border-color: rgba(159, 200, 187, 0.78);
  background: #ffffff;
}

.reader-more-actions-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 34;
  width: max-content;
  max-width: min(230px, 88vw);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 55px rgba(26, 38, 52, 0.18);
}

.reader-find-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 36;
  width: min(520px, calc(100vw - 36px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 55px rgba(26, 38, 52, 0.18);
}

.reader-find-row {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto auto auto auto;
  gap: 6px;
  align-items: center;
}

.reader-find-row > svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.reader-find-row input {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
}

.reader-find-row .icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.reader-find-count {
  min-width: 54px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.print-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 30;
  width: min(290px, 86vw);
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(26, 38, 52, 0.18);
}

.citation-copy-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 32;
  width: min(380px, 90vw);
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(26, 38, 52, 0.18);
}

.reader-settings-panel {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 33;
  width: min(280px, 90vw);
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(26, 38, 52, 0.18);
}

.reader-setting-group {
  display: grid;
  gap: 7px;
}

.reader-setting-group > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.reader-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.reader-toggle-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  color: #34413d;
  font-size: 12.5px;
  font-weight: 750;
}

.reader-toggle-row button:hover {
  border-color: var(--line-strong);
  background: #edf7f3;
}

.reader-toggle-row button.active {
  border-color: #8fbbae;
  background: #e3f1ec;
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(23, 107, 91, 0.08);
}

.citation-copy-panel textarea {
  min-height: 118px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
}

.print-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.print-panel input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.print-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.print-notes-summary {
  display: none;
}

.doc-kicker {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.doc-header h1 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.28;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reader-content.doc-header-collapsed {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.reader-content.doc-header-collapsed .doc-header {
  align-items: center;
  padding: 8px 10px 8px 12px;
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
}

.reader-content.doc-header-collapsed .doc-header > div:first-child {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.reader-content.doc-header-collapsed .doc-kicker {
  min-width: max-content;
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.reader-content.doc-header-collapsed .doc-header h1 {
  min-width: 0;
  overflow: hidden;
  color: #26312d;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-content.doc-header-collapsed .meta-grid,
.reader-content.doc-header-collapsed .legal-compass,
.reader-content.doc-header-collapsed .source-identity-banner,
.reader-content.doc-header-collapsed .doc-outline {
  display: none !important;
}

.doc-data-panel {
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.doc-data-panel > summary {
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 14px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.doc-data-panel > summary::-webkit-details-marker {
  display: none;
}

.doc-data-panel > summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.doc-data-panel > summary strong {
  min-width: 0;
  overflow: hidden;
  color: #26312d;
  font-size: 12.5px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-data-panel > summary small {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  max-height: 136px;
  overflow: auto;
  background: var(--line);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.meta-item {
  min-width: 0;
  padding: 9px 12px;
  background: var(--surface-tint);
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.meta-item strong {
  display: -webkit-box;
  overflow-wrap: anywhere;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reader-context-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(23, 107, 91, 0.14);
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.08), rgba(47, 111, 159, 0.05)),
    #fbfcfc;
}

.reader-context-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.reader-context-main span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.reader-context-main strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-context-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.reader-context-facts span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid rgba(185, 200, 197, 0.74);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #38413e;
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
}

.legal-compass {
  max-height: 154px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
  scrollbar-width: thin;
}

.legal-compass-card {
  --compass-color: var(--focus);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
  gap: 10px 14px;
  padding: 10px 14px;
  border-left: 4px solid var(--compass-color);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--compass-color) 7%, transparent), transparent 34%),
    #fbfcfc;
}

.legal-compass-card.very-high {
  --compass-color: var(--green);
}

.legal-compass-card.high {
  --compass-color: var(--focus);
}

.legal-compass-card.medium {
  --compass-color: var(--amber);
}

.legal-compass-card.low {
  --compass-color: var(--brick);
}

.legal-compass-card.support {
  --compass-color: #1f7a62;
}

.legal-compass-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.legal-compass-main span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.legal-compass-main strong {
  color: var(--ink);
  font-size: 15px;
}

.legal-compass-main small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.legal-compass-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.legal-compass-metrics span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.legal-compass-metrics strong {
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.legal-compass-signals {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.legal-compass-signals span {
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--compass-color) 22%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--compass-color) 8%, white);
  color: #34413d;
  font-size: 11.5px;
  font-weight: 750;
}

.source-identity-banner {
  max-height: 88px;
  overflow: auto;
  padding: 0;
  border-bottom: 1px solid rgba(31, 122, 98, 0.18);
  background: #fbfdfa;
  scrollbar-width: thin;
}

.source-identity-details {
  padding: 8px 12px 8px 14px;
  border-left: 3px solid rgba(31, 122, 98, 0.66);
}

.source-identity-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 750;
  list-style: none;
}

.source-identity-details summary::-webkit-details-marker {
  display: none;
}

.source-identity-details summary::after {
  content: "Vis";
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.source-identity-details[open] summary::after {
  content: "Skjul";
}

.source-identity-details strong {
  color: var(--ink);
  font-size: 13.5px;
}

.source-identity-details p {
  max-width: 860px;
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.source-pill {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid rgba(31, 122, 98, 0.30);
  border-radius: 999px;
  background: rgba(31, 122, 98, 0.10);
  color: #1f6b58;
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.source-identity-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
}

.source-identity-facts span {
  padding: 5px 7px;
  border: 1px solid rgba(84, 97, 114, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
}

.doc-outline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  max-height: 50px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.doc-outline > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.doc-outline > div {
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.doc-outline button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  color: #38413e;
  font-size: 12px;
  font-weight: 750;
}

.doc-outline button:hover {
  border-color: var(--line-strong);
  background: #edf7f3;
}

.workspace-split {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
}

.reader-focus .workspace-split {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.doc-text-panel {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 248, 248, 0)),
    #f4f7f6;
}

.doc-text-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  min-width: 100%;
  min-height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.doc-text-panel pre {
  position: relative;
  z-index: 2;
  width: min(100%, var(--reader-measure));
  min-height: 100%;
  margin: 0 auto;
  padding: 34px 42px 50px;
  border-left: 1px solid rgba(185, 200, 197, 0.55);
  border-right: 1px solid rgba(185, 200, 197, 0.55);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: #222c29;
  font-family: var(--font-reader);
  font-size: calc(var(--type-reader) * var(--reader-zoom, 1));
  line-height: var(--reader-line);
  background: var(--surface);
  tab-size: 2;
}

.reader-font-serif .doc-text-panel pre {
  font-family: var(--font-reader);
}

.reader-font-sans .doc-text-panel pre {
  font-family: var(--font-ui);
}

.reader-density-comfort .doc-text-panel pre {
  width: min(100%, 74ch);
  padding: 36px 44px 54px;
  font-size: calc(16px * var(--reader-zoom, 1));
  line-height: 1.66;
}

.reader-density-compact .doc-text-panel pre {
  width: min(100%, 82ch);
  padding: 24px 34px 42px;
  font-size: calc(15px * var(--reader-zoom, 1));
  line-height: 1.52;
}

.reader-focus .reader-density-comfort .doc-text-panel pre {
  width: min(100%, 78ch);
}

.reader-focus .reader-density-compact .doc-text-panel pre {
  width: min(100%, 88ch);
}

.side-workbench {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface-tint);
}

.workbench-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 250, 249, 0.96);
  backdrop-filter: blur(12px);
}

.workbench-tabs button {
  min-height: 34px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.workbench-tabs button:hover {
  border-color: rgba(23, 107, 91, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--green-dark);
}

.workbench-tabs button.active {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(23, 107, 91, 0.08);
}

.workbench-tab-panel {
  display: none;
}

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

.reader-collapsed {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  background: var(--surface-tint);
}

.reader-collapsed span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
}

.workbench-section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  margin-bottom: 10px;
}

.mini-heading {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.compact-empty {
  padding: 10px 0;
  text-align: left;
}

.citator-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.source-status-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(185, 200, 197, 0.84);
  border-left: 4px solid var(--focus);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 250, 0.92)),
    var(--surface);
  box-shadow: 0 8px 22px rgba(22, 31, 29, 0.06);
}

.source-status-card.very-high {
  border-left-color: var(--green);
}

.source-status-card.high {
  border-left-color: var(--focus);
}

.source-status-card.medium {
  border-left-color: var(--amber);
}

.source-status-card.low {
  border-left-color: var(--line-strong);
}

.source-status-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.source-status-head span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.source-status-head strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.source-status-head em {
  max-width: 112px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4b5653;
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
  line-height: 1.2;
  text-align: right;
}

.source-status-card p {
  margin: 0;
  color: #3e4a47;
  font-size: 12.5px;
  line-height: 1.35;
}

.source-status-verdict {
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  border: 1px solid rgba(185, 200, 197, 0.72);
  border-left: 3px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.source-status-verdict.watch {
  border-left-color: var(--amber);
  background: #fffaf0;
}

.source-status-verdict.linked {
  border-left-color: var(--focus);
  background: rgba(47, 111, 159, 0.055);
}

.source-status-verdict.stable {
  border-left-color: var(--green);
  background: rgba(31, 122, 98, 0.055);
}

.source-status-verdict strong {
  font-size: 12.5px;
  line-height: 1.25;
}

.source-status-verdict span {
  color: var(--muted);
  font-size: 11.6px;
  line-height: 1.3;
}

.source-status-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.source-status-metrics span {
  min-width: 0;
  padding: 6px 4px;
  border: 1px solid rgba(185, 200, 197, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 10.4px;
  font-weight: 720;
  line-height: 1.2;
  text-align: center;
}

.source-status-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
}

.source-hierarchy {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.source-hierarchy span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 7px 3px 4px;
  border: 1px solid rgba(185, 200, 197, 0.64);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: #59625f;
  font-size: 10px;
  font-weight: 760;
}

.source-hierarchy span.active {
  border-color: rgba(23, 107, 91, 0.36);
  background: rgba(23, 107, 91, 0.09);
  color: var(--green-dark);
}

.source-hierarchy i {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: rgba(22, 31, 29, 0.07);
  color: inherit;
  font-size: 9px;
  font-style: normal;
  font-weight: 850;
}

.authority-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 10px;
  background: var(--surface);
}

.authority-card.very-high {
  border-left-color: var(--green);
}

.authority-card.high {
  border-left-color: var(--focus);
}

.authority-card.medium {
  border-left-color: var(--amber);
}

.authority-card.low {
  border-left-color: var(--brick);
}

.authority-card span,
.authority-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.authority-card strong {
  display: block;
  margin-top: 2px;
}

.citator-verdict {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 9px;
  background: #fbfcfb;
}

.citator-verdict.watch,
.citator-verdict.linked {
  border-left-color: var(--amber);
  background: #fffdf7;
}

.citator-verdict.stable {
  border-left-color: var(--green);
  background: #f2f8f5;
}

.citator-verdict.quiet {
  border-left-color: var(--line-strong);
}

.citator-verdict strong {
  font-size: 13px;
}

.citator-verdict span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.authority-signals,
.authority-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.authority-signals span,
.authority-levels span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  color: #38413e;
  font-size: 11.5px;
  font-weight: 750;
}

.authority-levels {
  grid-column: 1 / -1;
}

.authority-levels span {
  justify-content: space-between;
  border-radius: 8px;
}

.authority-levels strong {
  margin: 0;
  color: var(--muted);
}

.citator-priority {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfb;
}

.citator-priority .mini-heading {
  margin-top: 0;
}

.citator-priority-list {
  display: grid;
  gap: 7px;
}

.citator-priority-item {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.relation-pill {
  justify-self: start;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(47, 111, 159, 0.22);
  background: rgba(47, 111, 159, 0.08);
  color: #245f8e;
  font-size: 11px;
  font-weight: 750;
}

.citator-list {
  display: grid;
  gap: 8px;
}

.citator-relation-group {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 9px;
  background: #fbfcfb;
}

.citator-relation-group.watch {
  border-left-color: var(--amber);
  background: #fffaf0;
}

.citator-relation-group.linked {
  border-left-color: var(--focus);
  background: rgba(47, 111, 159, 0.045);
}

.citator-relation-group.stable {
  border-left-color: var(--green);
  background: rgba(31, 122, 98, 0.045);
}

.citator-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.citator-group-head strong {
  display: block;
  color: var(--ink);
  font-size: 12.8px;
  line-height: 1.25;
}

.citator-group-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.6px;
  line-height: 1.35;
}

.citator-group-head em {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(185, 200, 197, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #41514d;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.citator-group-items {
  display: grid;
  gap: 7px;
}

.citator-item {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.4;
}

.citator-item.watch {
  border-color: rgba(212, 167, 44, 0.24);
}

.citator-item.linked {
  border-color: rgba(47, 111, 159, 0.22);
}

.citator-item.stable {
  border-color: rgba(31, 122, 98, 0.20);
}

.citator-item.unlinked {
  background: #fbfaf6;
}

.djv-support-section {
  border-left: 3px solid rgba(126, 142, 138, 0.34);
  opacity: 0.88;
}

.djv-support-list {
  display: grid;
  gap: 8px;
}

.djv-support-details {
  border: 1px solid rgba(185, 200, 197, 0.62);
  border-radius: 9px;
  background: rgba(248, 251, 250, 0.72);
}

.djv-support-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.djv-support-details > summary::-webkit-details-marker,
.citation-context-details summary::-webkit-details-marker {
  display: none;
}

.djv-support-details > summary strong {
  color: #4b5653;
  font-size: 13px;
}

.djv-support-details > summary span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
}

.djv-support-items {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.djv-support-item {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid rgba(185, 200, 197, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  line-height: 1.4;
}

.citator-title {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 750;
  line-height: 1.3;
}

.citator-title:hover {
  color: var(--green-dark);
}

.citator-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.citator-context {
  margin-top: 7px;
  color: #38413e;
  font-size: 13px;
  line-height: 1.5;
}

.citation-context-details {
  margin-top: 7px;
}

.citation-context-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--muted);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 800;
  list-style: none;
}

.citation-context-details[open] summary {
  border-color: #b5c8bf;
  background: #edf7f3;
  color: var(--green-dark);
}

.label-list,
.notes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.notes-list {
  display: grid;
}

.annotation-manager {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(250, 252, 251, 0.92), rgba(244, 248, 246, 0.72)),
    var(--surface);
}

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

.annotation-manager-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.annotation-manager-head strong {
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.annotation-manager-head span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
}

.annotation-owner-row {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(48px, 1fr));
  gap: 5px;
  align-self: start;
}

.annotation-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.annotation-manager button {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 750;
}

.annotation-manager button.active {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(80, 137, 118, 0.12);
}

.annotation-manager button span {
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.note-item {
  position: relative;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--note-color, var(--focus));
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  line-height: 1.45;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.note-item:hover {
  border-color: color-mix(in srgb, var(--note-color, var(--focus)) 38%, var(--line));
  box-shadow: 0 10px 22px rgba(22, 31, 29, 0.08);
  transform: translateY(-1px);
}

.note-item:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow:
    0 0 0 3px rgba(47, 111, 159, 0.14),
    var(--shadow-soft);
}

.note-item.star-note {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--note-color, #b57614) 13%, transparent), transparent 46%),
    var(--surface);
  border-color: color-mix(in srgb, var(--note-color, #b57614) 42%, var(--line));
  border-left-color: var(--note-color, #b57614);
}

.note-item.mark-note {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--note-color, #2f6f9f) 10%, transparent), transparent 44%),
    var(--surface);
}

.note-item.active {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 159, 0.12);
}

.note-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.passage-card {
  display: grid;
  gap: 8px;
}

.passage-card-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.passage-card-title strong {
  color: var(--ink);
  font-size: 13px;
}

.passage-card-title span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.passage-card-body {
  color: #2f3b38;
  font-size: 13px;
  line-height: 1.5;
}

.passage-card-empty {
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfb;
  font-size: 12.5px;
}

.passage-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.passage-card-footer > span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--note-color, var(--focus)) 28%, var(--line));
  border-radius: 999px;
  color: color-mix(in srgb, var(--note-color, var(--focus)) 74%, #26322f);
  background: color-mix(in srgb, var(--note-color, var(--focus)) 10%, white);
  font-size: 11px;
  font-weight: 850;
}

.note-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4f7;
  color: #315469;
  font-size: 11px;
  font-weight: 800;
}

.note-type-badge i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--note-color, var(--focus));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--note-color, var(--focus)) 18%, transparent);
}

.note-type-badge.star {
  background: color-mix(in srgb, var(--note-color, #b57614) 18%, white);
  color: color-mix(in srgb, var(--note-color, #b57614) 78%, black);
}

.note-type-badge.mark {
  background: color-mix(in srgb, var(--note-color, #2f6f9f) 15%, white);
  color: color-mix(in srgb, var(--note-color, #2f6f9f) 78%, black);
}

.note-quote,
.selection-preview {
  padding: 8px;
  border-left: 3px solid var(--note-color, var(--focus));
  background: color-mix(in srgb, var(--note-color, var(--focus)) 13%, white);
  color: #25445f;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.passage-card .note-quote {
  margin: 0;
  border-radius: 8px;
  color: #22332f;
}

.passage-empty {
  margin-top: 2px;
}

.selection-preview:empty {
  display: none;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

.note-color-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.passage-composer {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

.passage-composer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.passage-composer-actions .quiet-button {
  min-width: 0;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 850;
}

.note-color-option {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.note-color-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(50%);
}

.note-color-option.blue {
  --note-choice: #2f6f9f;
}

.note-color-option.green {
  --note-choice: #1f7a62;
}

.note-color-option.amber {
  --note-choice: #b57614;
}

.note-color-option.red {
  --note-choice: #b44b3f;
}

.note-color-option.violet {
  --note-choice: #6f5aa8;
}

.note-color-option span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border-top: 4px solid var(--note-choice);
}

.note-color-option:has(input:checked) {
  border-color: var(--note-choice);
  background: color-mix(in srgb, var(--note-choice) 12%, white);
  color: var(--ink);
}

.note-form-armed {
  border-radius: 10px;
  outline: 2px solid rgba(47, 111, 159, 0.18);
  outline-offset: 8px;
}

.note-mark {
  background: color-mix(in srgb, var(--note-color, #2f6f9f) 22%, white);
  border-bottom: 2px solid var(--note-color, #2f6f9f);
  color: inherit;
  padding: 0 2px;
  cursor: pointer;
  scroll-margin: 120px;
}

.note-mark.star-mark {
  --note-color: #c58a12;
  position: relative;
  border-bottom: 2px solid #c58a12;
  box-shadow: inset 0 -0.9em 0 rgba(255, 210, 93, 0.34);
  background:
    linear-gradient(90deg, rgba(255, 242, 201, 0.95), rgba(255, 248, 224, 0.72));
  border-radius: 4px;
}

.note-mark.star-mark::before {
  content: "★";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  border-radius: 999px;
  background: #c58a12;
  color: white;
  font-size: 10px;
  line-height: 1;
  vertical-align: 1px;
}

.note-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.selection-toolbar {
  position: fixed;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 34px rgba(26, 38, 52, 0.18);
  backdrop-filter: blur(10px);
}

.selection-colors {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  margin-right: 1px;
  border-right: 1px solid var(--line);
}

.selection-color {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--selection-choice);
  box-shadow: inset 0 0 0 2px white;
}

.selection-color.active {
  border-color: var(--ink);
  box-shadow:
    inset 0 0 0 2px white,
    0 0 0 2px color-mix(in srgb, var(--selection-choice) 28%, transparent);
}

.selection-color.blue {
  --selection-choice: #2f6f9f;
}

.selection-color.green {
  --selection-choice: #1f7a62;
}

.selection-color.amber {
  --selection-choice: #b57614;
}

.selection-color.red {
  --selection-choice: #b44b3f;
}

.selection-color.violet {
  --selection-choice: #6f5aa8;
}

.selection-tool {
  min-width: 0;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
}

.selection-tool:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.selection-tool svg {
  width: 15px;
  height: 15px;
}

#selectionStarBtn {
  color: #775000;
}

#selectionStarBtn:hover {
  border-color: rgba(197, 138, 18, 0.38);
  background: #fff4d5;
}

.note-mark.star-mark {
  position: relative;
  padding: 0 4px 0 13px;
  border-bottom: 0;
  border-left: 4px solid var(--note-color, #b57614);
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--note-color, #b57614) 16%, transparent) 0 10px,
      transparent 10px
    );
  border-radius: 9px 3px 3px 9px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.65);
}

.note-mark.star-mark::before {
  content: "\2605";
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin: 0 -3px 0 -11px;
  border-radius: 999px;
  background: var(--note-color, #b57614);
  color: white;
  font-size: 10px;
  line-height: 1;
  vertical-align: 1px;
}

.note-mark.star-mark {
  padding: 2px 3px 3px;
  border-left: 0;
  border-top: 2px solid var(--note-color, #b57614);
  border-bottom: 2px solid var(--note-color, #b57614);
  background:
    linear-gradient(
      transparent 0 48%,
      color-mix(in srgb, var(--note-color, #b57614) 24%, transparent) 48% 82%,
      transparent 82% 100%
    );
  border-radius: 2px;
  box-shadow: none;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.note-mark.star-mark::before {
  content: "\2605";
  display: inline;
  width: auto;
  height: auto;
  margin: 0 4px 0 0;
  border-radius: 0;
  background: transparent;
  color: var(--note-color, #b57614);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  vertical-align: 1px;
}

.note-mark.star-mark {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  text-decoration: none;
  box-decoration-break: slice;
  -webkit-box-decoration-break: slice;
}

.note-mark.star-mark::before {
  content: "";
  display: none;
}

.star-frame-segment {
  position: absolute;
  z-index: 3;
  display: block;
  padding: 0;
  border: 0;
  border-left: 2px solid var(--note-color, #b57614);
  border-right: 2px solid var(--note-color, #b57614);
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.98;
}

.star-frame-segment::before,
.star-frame-segment::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--note-color, #b57614);
  opacity: 0;
}

.star-frame-segment.first::before {
  top: 0;
  opacity: 1;
}

.star-frame-segment.last::after {
  bottom: 0;
  opacity: 1;
}

.star-frame-segment.first {
  box-shadow: -9px 0 0 -7px var(--note-color, #b57614);
}

.star-frame-segment.first::marker {
  display: none;
}

.star-frame-segment.first::before {
  box-shadow: -11px 0 0 -4px var(--note-color, #b57614);
}

.star-frame-segment.first::after {
  content: "\2605";
  left: -18px;
  right: auto;
  top: -7px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--note-color, #b57614);
  color: white;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  opacity: 1;
}

.star-frame-segment.last:not(.first)::after {
  content: "";
  left: 0;
  right: 0;
  top: auto;
  width: auto;
  height: 2px;
  display: block;
  border-radius: 0;
  color: transparent;
  font-size: 0;
  opacity: 1;
}

.star-frame-segment::before,
.star-frame-segment::after {
  content: none;
}

.star-frame-segment.first {
  border-top: 2px solid var(--note-color, #b57614);
}

.star-frame-segment.last {
  border-bottom: 2px solid var(--note-color, #b57614);
}

.star-frame-segment.first::before {
  content: "\2605";
  position: absolute;
  left: -18px;
  top: -9px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--note-color, #b57614);
  color: white;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.star-frame-segment.active {
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--note-color, #b57614) 32%, transparent));
}

.annotation-segment {
  position: absolute;
  z-index: 3;
  display: block;
  padding: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.mark-segment,
.note-segment {
  z-index: 2;
  border-radius: 2px;
  background: color-mix(in srgb, var(--note-color, #2f6f9f) 18%, transparent);
  border-bottom: 2px solid var(--note-color, #2f6f9f);
  mix-blend-mode: multiply;
}

.note-segment {
  background: color-mix(in srgb, var(--note-color, #2f6f9f) 24%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--note-color, #2f6f9f) 20%, transparent);
}

.find-segment {
  z-index: 1;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 243, 188, 0.18), rgba(255, 224, 122, 0.34));
  box-shadow: inset 0 -1px 0 rgba(176, 119, 20, 0.42);
  mix-blend-mode: multiply;
}

.find-segment.active {
  z-index: 5;
  background:
    linear-gradient(180deg, rgba(255, 239, 166, 0.42), rgba(255, 211, 86, 0.56));
  box-shadow:
    inset 0 -2px 0 rgba(176, 103, 10, 0.72),
    0 0 0 1px rgba(47, 111, 159, 0.16),
    0 10px 24px rgba(28, 72, 106, 0.10);
}

.star-segment {
  z-index: 4;
  border-left: 2px solid color-mix(in srgb, var(--note-color, #b57614) 86%, #5c4210);
  border-right: 2px solid color-mix(in srgb, var(--note-color, #b57614) 86%, #5c4210);
  border-radius: 0;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--note-color, #b57614) 9%, transparent),
      transparent 18%,
      transparent 82%,
      color-mix(in srgb, var(--note-color, #b57614) 9%, transparent));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--note-color, #b57614) 14%, transparent);
  opacity: 0.94;
}

.star-block-frame,
.star-block-frame.first,
.star-block-frame.last {
  border: 2px solid color-mix(in srgb, var(--note-color, #b57614) 84%, #5c4210);
  border-radius: 8px;
  background: transparent;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--note-color, #b57614) 10%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--note-color, #b57614) 10%, transparent);
}

.star-segment.first {
  border-top: 2px solid color-mix(in srgb, var(--note-color, #b57614) 86%, #5c4210);
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
}

.star-segment.last {
  border-bottom: 2px solid color-mix(in srgb, var(--note-color, #b57614) 86%, #5c4210);
  border-bottom-left-radius: 7px;
  border-bottom-right-radius: 7px;
}

.star-segment.first::before {
  content: none;
}

.annotation-segment.active {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--note-color, #b57614) 24%, transparent));
}

.star-segment.active {
  opacity: 1;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--note-color, #b57614) 28%, transparent),
    0 0 0 2px color-mix(in srgb, var(--note-color, #b57614) 16%, transparent);
}

.star-block-frame.active {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--note-color, #b57614) 18%, transparent),
    0 8px 18px color-mix(in srgb, var(--note-color, #b57614) 10%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--note-color, #b57614) 18%, transparent);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.segmented label {
  position: relative;
  min-width: 0;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(50%);
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.segmented input:checked + span {
  background: #e4f1ec;
  border-color: #9fc8bb;
  color: var(--green-dark);
}

.ai-section textarea {
  margin-bottom: 8px;
}

.ai-category-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-category-item {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.35;
}

.ai-category-item strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.ai-category-item span {
  color: var(--muted);
  font-size: 12px;
}

.ai-section .quiet-button {
  margin-bottom: 10px;
}

.ai-answer {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.55;
  white-space: pre-wrap;
  min-height: 70px;
  color: #26302d;
}

.empty-state,
.error-state {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.error-state {
  color: var(--brick);
}

.profiles-view,
.admin-view {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.deadlines-view {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.cases-view {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.templates-view {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.companies-view {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.profiles-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  background: var(--surface);
}

.admin-sidebar {
  min-height: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(23, 107, 91, 0.05), rgba(247, 249, 251, 0) 260px),
    var(--surface-tint);
  overflow-y: auto;
}

.admin-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-header h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.15;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.admin-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.admin-metric-card {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.admin-metric-card span,
.admin-metric-card small,
.admin-warning span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.admin-metric-card strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.05;
}

.admin-warning-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.admin-warning {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface-tint);
}

.admin-warning.green {
  border-left-color: var(--green);
}

.admin-warning.yellow {
  border-left-color: var(--amber);
}

.admin-warning.red {
  border-left-color: var(--brick);
}

.admin-operations {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfc, var(--surface));
}

.admin-operations-empty {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--muted);
  font-weight: 750;
}

.admin-operations-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
}

.admin-operations-head.green {
  border-left-color: var(--green);
}

.admin-operations-head.yellow {
  border-left-color: var(--amber);
}

.admin-operations-head.red {
  border-left-color: var(--brick);
}

.admin-operations-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-operations-head span,
.admin-operations-head small,
.admin-health-card span,
.admin-operations-foot {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-operations-head strong {
  font-size: 20px;
  line-height: 1.1;
}

.admin-operations-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.admin-operations-meta span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  white-space: nowrap;
}

.admin-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-health-card {
  min-width: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface-tint);
}

.admin-health-card.green {
  border-left-color: var(--green);
}

.admin-health-card.yellow {
  border-left-color: var(--amber);
}

.admin-health-card.red {
  border-left-color: var(--brick);
}

.admin-health-card div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.admin-health-card strong,
.admin-health-card span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-health-card em {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.admin-operations-foot {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.admin-operations-foot div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-operations-foot div span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
}

.admin-quality {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.admin-quality-details {
  display: block;
}

.admin-quality-details summary::-webkit-details-marker {
  display: none;
}

.admin-quality-summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 13px 11px 14px;
  border-left: 4px solid #c58b19;
  list-style: none;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease;
}

.admin-quality-summary.green {
  border-left-color: var(--green);
}

.admin-quality-summary.red {
  border-left-color: #b54735;
}

.admin-quality-summary:hover {
  background: #f8fbfa;
}

.admin-quality-details[open] .admin-quality-summary {
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.admin-quality-body {
  display: grid;
  gap: 12px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(47, 111, 159, 0.06), rgba(255, 255, 255, 0) 42%),
    var(--surface);
}

.admin-quality-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.admin-quality-actions > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.admin-quality-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.admin-quality-head.green,
.admin-quality-head.yellow,
.admin-quality-head.red {
  padding-left: 10px;
  border-left: 4px solid #c58b19;
}

.admin-quality-head.green {
  border-left-color: var(--green);
}

.admin-quality-head.red {
  border-left-color: #b54735;
}

.admin-quality-head > div:first-child,
.admin-quality-score {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-quality-head span,
.admin-quality-head small,
.admin-quality-summary span,
.admin-quality-summary small,
.admin-quality-metric span,
.admin-quality-metric small,
.admin-quality-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.admin-quality-head strong {
  overflow-wrap: anywhere;
}

.admin-quality-summary > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-quality-summary strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.admin-quality-score {
  text-align: right;
}

.admin-quality-score strong {
  font-size: 22px;
}

.admin-quality-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-quality-metric {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-quality-metric strong {
  font-size: 18px;
}

.admin-quality-queues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-quality-queues section {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.admin-quality-item {
  min-width: 0;
  display: grid;
  gap: 7px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid #c58b19;
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--ink);
  text-align: left;
  transition:
    border-color 150ms ease,
    transform 120ms ease,
    box-shadow 150ms ease;
}

.admin-quality-item.green {
  border-left-color: var(--green);
}

.admin-quality-item.red {
  border-left-color: #b54735;
}

.admin-quality-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.admin-quality-item-top {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.admin-quality-item-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.admin-quality-item-main:hover {
  color: var(--green-dark);
}

.admin-quality-item strong,
.admin-quality-item-main strong {
  overflow-wrap: anywhere;
  font-size: 12.5px;
}

.admin-quality-item-score {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
}

.admin-quality-item-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-quality-item-issues span {
  padding: 3px 7px;
  border: 1px solid #e5cf94;
  border-radius: 999px;
  background: #fff9e9;
  color: #7b520f;
  font-size: 10.5px;
  font-weight: 780;
}

.admin-quality-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 172px;
}

.admin-quality-item-actions button {
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #44514d;
  font-size: 10.5px;
  font-weight: 800;
}

.admin-quality-item-actions button:hover {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

@media (max-width: 1180px) {
  .admin-quality-item-top {
    grid-template-columns: 1fr;
  }

  .admin-quality-item-actions {
    justify-content: flex-start;
    max-width: none;
  }
}

.admin-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1fr) minmax(300px, 0.75fr);
  gap: 1px;
  background: var(--line);
  overflow: hidden;
}

.admin-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface-tint);
}

.admin-security-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #9fc8bb;
  border-radius: 999px;
  background: #edf7f3;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.admin-principle-card {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  line-height: 1.45;
}

.admin-principle-card.subdued {
  background: rgba(238, 243, 241, 0.56);
}

.admin-principle-card span,
.admin-policy-list span {
  color: var(--muted);
  font-size: 12.5px;
}

.admin-policy-list {
  display: grid;
  gap: 10px;
}

.admin-policy-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-audit-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.admin-audit-list {
  display: grid;
  gap: 8px;
}

.admin-audit-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid #c8d1d0;
  border-radius: 8px;
  background: var(--surface);
}

.admin-audit-item.green {
  border-left-color: var(--green);
}

.admin-audit-item.red {
  border-left-color: var(--brick);
}

.admin-audit-item.blue {
  border-left-color: var(--focus);
}

.admin-audit-item strong,
.admin-audit-item span,
.admin-audit-item small {
  display: block;
}

.admin-audit-item span,
.admin-audit-item small,
.user-list-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.admin-audit-item > span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  font-size: 11px;
  font-weight: 800;
}

.deadlines-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.deadlines-layout.quick-mode {
  grid-template-columns: minmax(0, 1fr);
}

.cases-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.templates-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  transition: grid-template-columns 180ms ease;
}

.templates-layout.templates-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}

.templates-layout.templates-sidebar-collapsed .templates-workspace {
  grid-template-columns: minmax(390px, 0.42fr) minmax(620px, 1.58fr);
}

.companies-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.profiles-sidebar {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-tint);
}

.deadlines-sidebar {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-tint);
}

.deadlines-layout.quick-mode .deadlines-sidebar {
  display: none;
}

.cases-sidebar {
  display: none;
}

.templates-sidebar {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--surface-tint);
  transition:
    opacity 140ms ease,
    padding 180ms ease,
    border-color 180ms ease;
}

.templates-layout.templates-sidebar-collapsed .templates-sidebar {
  padding: 0;
  border-left-color: transparent;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.template-sidebar-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.template-sidebar-close {
  width: 34px;
  height: 34px;
  margin-left: auto;
}

.companies-sidebar {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-tint);
}

.case-guidance-box,
.company-support-box {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 11px 12px;
  border: 1px solid #cddfda;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #f4faf7;
  line-height: 1.45;
}

.case-guidance-box span,
.company-support-box span {
  color: var(--muted);
  font-size: 12px;
}

.case-quick-actions {
  display: grid;
  gap: 8px;
}

.case-create-form,
.case-sidebar-section {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.legal-case-list,
.case-unlinked-list {
  display: grid;
  gap: 8px;
}

.legal-case-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition:
    border-color 150ms ease,
    transform 120ms ease,
    background 150ms ease;
}

.legal-case-item:hover,
.legal-case-item.active {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
  transform: translateY(-1px);
}

.legal-case-item strong,
.legal-case-item span,
.legal-case-item small {
  min-width: 0;
  grid-column: 2;
}

.legal-case-item span,
.legal-case-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-status-dot {
  grid-column: 1;
  grid-row: 1 / span 3;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent);
}

.case-status-dot.watch,
.case-status-dot.waiting {
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 16%, transparent);
}

.case-status-dot.dormant {
  background: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 15%, transparent);
}

.case-status-dot.closed {
  background: var(--muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 12%, transparent);
}

.case-unlinked-pill {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.case-unlinked-pill span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.company-search-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.company-source-box {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.4;
}

.company-source-box.ready {
  border-left-color: var(--green);
}

.company-source-box.offline {
  border-left-color: var(--amber);
}

.company-source-box span,
.company-source-box small {
  color: var(--muted);
  font-size: 12px;
}

.company-result-list {
  display: grid;
  gap: 8px;
}

.company-result-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.company-result-item:hover,
.company-result-item.active {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.company-result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.company-result-status {
  flex: 0 0 auto;
  max-width: 118px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

.company-result-status.green {
  border-color: rgba(22, 163, 74, 0.25);
  color: #15803d;
  background: rgba(22, 163, 74, 0.08);
}

.company-result-status.yellow {
  border-color: rgba(217, 119, 6, 0.26);
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
}

.company-result-status.red {
  border-color: rgba(220, 38, 38, 0.24);
  color: #991b1b;
  background: rgba(220, 38, 38, 0.08);
}

.company-result-status.blue {
  border-color: rgba(37, 99, 235, 0.24);
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
}

.company-result-item span {
  color: var(--muted);
  font-size: 12px;
}

.company-lookup-banner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(160px, auto);
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-soft);
}

.company-lookup-banner.green {
  border-left-color: var(--green);
}

.company-lookup-banner.yellow {
  border-left-color: var(--amber);
}

.company-lookup-banner.red {
  border-left-color: #dc2626;
}

.company-lookup-signal {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.company-lookup-signal span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.company-lookup-signal strong,
.company-lookup-signal small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.company-lookup-signal strong {
  color: var(--ink);
  font-size: 14px;
}

.company-lookup-signal small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.company-lookup-actions {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 6px;
}

.company-lookup-actions .company-inline-action {
  width: 100%;
}

@media (max-width: 920px) {
  .company-lookup-banner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-lookup-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .company-lookup-banner {
    grid-template-columns: 1fr;
  }

  .company-lookup-actions {
    grid-template-columns: 1fr;
  }
}

.template-search-form {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}

.template-search-host {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.template-library-search {
  max-width: 1180px;
  margin: 0 auto;
}

.template-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.template-query-field {
  margin: 0;
}

.template-search-tools {
  display: grid;
  grid-template-columns: minmax(164px, 190px) auto;
  align-items: end;
  gap: 8px;
}

.template-sort-field {
  margin: 0;
}

.template-search-row .template-actions-row {
  margin: 0;
  grid-template-columns: auto auto;
}

.template-quick-tracks {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 1px 4px;
  scrollbar-width: thin;
}

.template-quick-tracks > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-quick-chip {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.template-quick-chip:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.template-quick-chip.active {
  border-color: #7db9a7;
  background: #e9f6f1;
  color: #155c4d;
}

.template-filter-drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-filter-drawer > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 800;
}

.template-filter-drawer > summary::-webkit-details-marker {
  display: none;
}

.template-filter-drawer > summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.template-filter-drawer > summary::after {
  content: "Vis";
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-filter-drawer[open] > summary {
  border-bottom: 1px solid var(--line);
}

.template-filter-drawer[open] > summary::after {
  content: "Skjul";
}

.template-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.template-actions-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.template-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-stat-card {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.template-stat-card span,
.template-stat-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.template-stat-card strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.template-upload-form,
.template-dashboard-section {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-sidebar-admin {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.template-sidebar-admin > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
}

.template-sidebar-admin > summary::-webkit-details-marker {
  display: none;
}

.template-sidebar-admin > summary strong {
  min-width: 0;
  font-size: 12.5px;
}

.template-sidebar-admin > summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.template-sidebar-admin > summary::after {
  content: "Vis";
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-sidebar-admin[open] > summary {
  border-bottom: 1px solid var(--line);
}

.template-sidebar-admin[open] > summary::after {
  content: "Skjul";
}

.template-sidebar-admin .template-upload-form {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.template-upload-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.template-import-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.template-dashboard {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.template-dashboard.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.template-dashboard-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.template-dashboard-toolbar > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.template-dashboard-toolbar strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.template-dashboard-toolbar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.template-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-editor-status-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #c58b19;
  border-radius: 8px;
  background: var(--surface);
}

.template-editor-status-card.ready {
  border-left-color: var(--green);
}

.template-editor-status-card > div {
  display: grid;
  gap: 2px;
}

.template-editor-status-card span,
.template-editor-status-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.template-dash-metric {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-dash-metric span,
.template-dashboard-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.template-dash-metric strong {
  font-size: 20px;
}

.template-dashboard-item {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--ink);
  text-align: left;
}

.template-dashboard-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.template-dashboard-item strong {
  overflow-wrap: anywhere;
  font-size: 12.5px;
}

.template-dashboard-item span {
  color: var(--muted);
  font-size: 11px;
}

.templates-main {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(47, 111, 159, 0.05), rgba(247, 249, 251, 0) 220px),
    var(--surface-tint);
}

.templates-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(10px);
}

.templates-header h1 {
  margin: 3px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.template-header-actions {
  display: flex;
  gap: 8px;
}

.templates-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(390px, 0.88fr) minmax(430px, 1.12fr);
  gap: 1px;
  background: var(--line);
  overflow: hidden;
}

.template-results-panel,
.template-detail-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface-tint);
}

.template-section-title {
  align-items: center;
  justify-content: space-between;
}

.template-section-title small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.template-result-list {
  display: grid;
  gap: 10px;
}

.template-result-item {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.02);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease,
    background-color 150ms ease;
}

.template-result-item:hover,
.template-result-item.active {
  border-color: var(--line-strong);
  border-left-color: var(--green);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.template-open {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 12px 0 12px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.template-open > span,
.template-open p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.template-result-top {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.template-result-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.template-result-signal {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 3px;
  padding: 2px 7px;
  border: 1px solid #b9d8cc;
  border-radius: 999px;
  background: #eef8f3;
  color: #155c4d;
  font-size: 10.5px;
  font-weight: 850;
  line-height: 1.2;
}

.template-result-meta {
  display: grid;
  gap: 2px;
}

.template-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-file-pill {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #cbd7d5;
  border-radius: 8px;
  background: #eef5f1;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 850;
}

.template-fav {
  margin: 10px 10px 0 0;
}

.template-fav.active {
  border-color: #e0c15b;
  background: #fff7d9;
  color: #8a6400;
}

.template-flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-flag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #e2c487;
  border-radius: 999px;
  background: #fff8e8;
  color: #7b520f;
  font-size: 11px;
  font-weight: 750;
}

.template-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.template-status-pill.ready {
  border-color: #b9d8cc;
  background: #eef8f3;
  color: #155c4d;
}

.template-status-pill.pending,
.template-status-pill.stale {
  border-color: #e5cf94;
  background: #fff9e9;
  color: #7b520f;
}

.template-status-pill.error {
  border-color: #e6b5a9;
  background: #fff0ed;
  color: #933623;
}

.template-workflow-strip {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 122, 98, 0.08), rgba(255, 255, 255, 0) 42%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

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

.template-workflow-step {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid #c9d5d2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.template-workflow-step.ready {
  border-left-color: var(--green);
}

.template-workflow-step.pending,
.template-workflow-step.stale {
  border-left-color: #c58b19;
}

.template-workflow-step.error {
  border-left-color: #b54735;
}

.template-workflow-step span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-workflow-step strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.detail-flags {
  margin-top: -3px;
}

.template-detail-panel {
  background: #fbfcfc;
}

.template-empty {
  min-height: 360px;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
}

.template-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.template-detail-content {
  width: min(100%, 1120px);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.template-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.template-detail-head h2 {
  margin: 3px 0 6px;
  overflow-wrap: anywhere;
  font-size: 23px;
  line-height: 1.18;
  letter-spacing: 0;
}

.template-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.template-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-detail-actions.secondary {
  padding-top: 2px;
}

.template-use-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid #b9d8cc;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(31, 122, 98, 0.09), rgba(255, 255, 255, 0) 46%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.template-workcopy-strip {
  align-items: stretch;
}

.template-use-strip > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.template-use-main {
  align-content: center;
}

.template-use-eyebrow {
  width: fit-content;
  color: var(--green-dark) !important;
  font-size: 11px !important;
  font-weight: 850;
  text-transform: uppercase;
}

.template-use-strip strong {
  color: var(--ink);
  font-size: 14px;
}

.template-use-strip span {
  color: var(--muted);
  font-size: 12px;
}

.template-use-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.template-use-facts span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #c7dad4;
  border-radius: 999px;
  background: rgba(238, 248, 243, 0.86);
  color: #155c4d;
  font-size: 11px;
  font-weight: 800;
}

.template-primary-actions {
  align-content: center;
  justify-content: flex-end;
}

.template-action-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.template-editor-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #c58b19;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.template-editor-note.ready {
  border-left-color: var(--green);
  color: #155c4d;
}

.template-action-status.ready {
  color: #155c4d;
}

.template-action-status.pending,
.template-action-status.stale {
  color: #7b520f;
}

.template-action-status.error {
  color: #933623;
}

.template-document-viewer {
  position: relative;
  min-height: 740px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f0;
  box-shadow: var(--shadow-soft);
}

.template-document-viewer.error,
.template-document-viewer.neutral {
  background: #f4f6f6;
}

.template-document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.template-document-toolbar > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.template-document-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.template-document-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-preview-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.template-preview-status.ready {
  border-color: #b9d8cc;
  background: #eef8f3;
  color: #155c4d;
}

.template-preview-status.pending,
.template-preview-status.stale {
  border-color: #e5cf94;
  background: #fff9e9;
  color: #7b520f;
}

.template-preview-status.error {
  border-color: #e6b5a9;
  background: #fff0ed;
  color: #933623;
}

.template-preview-guidance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fffdf7;
}

.template-preview-guidance > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.template-preview-guidance strong {
  font-size: 13px;
}

.template-preview-guidance span {
  color: var(--muted);
  font-size: 12px;
}

.template-preview-guidance.error {
  background: #fff7f5;
}

.template-preview-guidance.neutral {
  background: #f8faf9;
}

.template-preview-stage {
  position: relative;
  min-height: 680px;
  background: #eef1f3;
}

.template-preview-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(23, 107, 91, 0.10), rgba(238, 241, 243, 0.95) 42%),
    rgba(238, 241, 243, 0.92);
  color: var(--muted);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.template-preview-loading strong {
  color: var(--ink);
  font-size: 14px;
}

.template-document-viewer.is-loaded .template-preview-loading,
.template-document-viewer.has-preview-error .template-preview-loading {
  opacity: 0;
  visibility: hidden;
}

.template-document-frame {
  width: 100%;
  height: 100%;
  min-height: 680px;
  border: 0;
  background: #eef1f3;
}

.template-secondary-details {
  border-left: 4px solid #cbd7d5;
}

.template-admin-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-admin-details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}

.template-admin-details > summary::-webkit-details-marker {
  display: none;
}

.template-admin-details > summary strong {
  color: var(--ink);
}

.template-admin-details > summary span {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.template-admin-details > summary::after {
  content: "Vis";
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-admin-details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.template-admin-details[open] > summary::after {
  content: "Skjul";
}

.template-admin-details > :not(summary) {
  margin: 12px;
}

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

.template-info-card {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-info-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-info-card strong {
  overflow-wrap: anywhere;
}

.template-detail-tags {
  margin-top: -2px;
}

.template-usage-note,
.template-metadata-form {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.template-usage-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.template-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-source-panel {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
}

.template-source-panel > summary {
  cursor: pointer;
  list-style: none;
}

.template-source-panel > summary::-webkit-details-marker {
  display: none;
}

.template-source-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.template-source-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.template-source-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.template-preview {
  max-height: 360px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #27302d;
  white-space: pre-wrap;
  overflow: auto;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
}

.template-no-preview {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.deadline-case-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.deadline-case-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  line-height: 1.35;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.deadline-case-item:hover,
.deadline-case-item.active {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.deadline-case-item.green {
  border-left-color: var(--green);
}

.deadline-case-item.yellow {
  border-left-color: var(--amber);
}

.deadline-case-item.red {
  border-left-color: var(--brick);
}

.deadline-case-item.blue {
  border-left-color: var(--focus);
}

.deadline-case-item span,
.deadline-case-item small {
  color: var(--muted);
  font-size: 12px;
}

.profile-create {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.profile-scope-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.profile-scope-field label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.profile-scope-field input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.profile-scope-field span {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.70);
  color: rgba(10, 42, 79, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.profile-scope-field strong,
.profile-scope-field small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-scope-field strong {
  color: var(--water-deep, var(--source-blue));
  font-size: 12px;
  font-weight: 860;
}

.profile-scope-field small {
  color: rgba(10, 42, 79, 0.50);
  font-size: 10.5px;
  font-weight: 720;
}

.profile-scope-field input:checked + span {
  border-color: rgba(15, 76, 154, 0.30);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 246, 255, 0.82));
  box-shadow:
    0 12px 26px rgba(6, 26, 51, 0.08),
    inset 0 -2px 0 rgba(30, 136, 229, 0.36);
}

.profile-list,
.profile-doc-list,
.insight-list,
.analysis-history,
.user-list,
.profile-annotation-list,
.profile-access-list,
.activity-list {
  display: grid;
  gap: 8px;
}

.profile-list-item,
.profile-doc-item,
.insight-item,
.analysis-item,
.user-list-item,
.access-item,
.annotation-item,
.activity-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.4;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.profile-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0;
  overflow: hidden;
}

.profile-list-item.active {
  border-color: rgba(15, 76, 154, 0.28);
  background:
    repeating-radial-gradient(ellipse at 92% 4%, rgba(79, 195, 247, 0.12) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 246, 255, 0.76));
  box-shadow:
    inset 3px 0 0 rgba(15, 76, 154, 0.74),
    0 14px 34px rgba(6, 26, 51, 0.08);
}

.profile-list-item:hover,
.profile-doc-item:hover,
.insight-item:hover,
.analysis-item:hover,
.user-list-item:hover,
.access-item:hover,
.annotation-item:hover,
.activity-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.profile-list-item:hover {
  border-color: rgba(30, 136, 229, 0.28);
  box-shadow: 0 12px 30px rgba(6, 26, 51, 0.08);
}

.profile-open {
  min-width: 0;
  padding: 11px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.profile-open:hover {
  color: var(--water-deep, var(--source-blue, #0a2a4f));
}

.profile-card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-bottom: 4px;
}

.profile-card-title strong {
  min-width: 0;
  margin-bottom: 0;
}

.profile-scope-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(10, 42, 79, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: rgba(10, 42, 79, 0.68);
  font-size: 10.5px;
  font-weight: 850;
}

.profile-scope-badge.team {
  border-color: rgba(15, 76, 154, 0.22);
  background: rgba(232, 246, 255, 0.9);
  color: var(--water-deep, var(--source-blue, #0a2a4f));
}

.profile-scope-badge.private {
  border-color: rgba(10, 42, 79, 0.22);
  background: rgba(246, 251, 255, 0.94);
  color: var(--water-navy, var(--source-blue, #0a2a4f));
}

.profile-card-access {
  display: block;
  margin-bottom: 3px;
  color: rgba(10, 42, 79, 0.56);
  font-size: 11.5px;
  font-weight: 760;
}

.profile-list-item strong,
.profile-doc-item strong,
.insight-item strong,
.analysis-item strong,
.access-item strong,
.annotation-item strong,
.activity-item strong {
  display: block;
  margin-bottom: 4px;
}

.profile-list-item span,
.profile-doc-item span,
.insight-item span,
.analysis-item span,
.user-list-item span,
.access-item span,
.annotation-item span,
.activity-item span,
.activity-item small,
.annotation-item small,
.byline,
.note-author {
  color: var(--muted);
  font-size: 12px;
}

.byline,
.note-author {
  display: block;
  margin-top: 4px;
  font-weight: 650;
}

.note-author {
  margin-bottom: 8px;
}

.team-panel {
  align-content: start;
}

.team-current {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface-tint);
}

.team-current span {
  color: var(--muted);
  font-size: 12px;
}

.team-create {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.user-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.user-list-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 170px;
}

.password-reset {
  width: 100%;
  max-width: 220px;
}

.password-reset > summary {
  display: inline-flex;
  justify-content: flex-end;
  width: 100%;
  cursor: pointer;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 750;
  list-style: none;
}

.password-reset > summary::-webkit-details-marker {
  display: none;
}

.password-reset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 8px;
}

.password-reset-form input {
  min-width: 0;
}

.password-reset-form small {
  grid-column: 1 / -1;
  min-height: 16px;
  color: var(--muted);
  text-align: right;
}

.password-reset-form small.success {
  color: var(--green-dark);
}

.password-reset-form small.error {
  color: #a33a3a;
}

.password-reset-form small.pending {
  color: var(--muted-strong);
}

.access-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.annotation-item {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  gap: 10px;
}

.annotation-manager-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.annotation-manager-summary article {
  display: grid;
  gap: 2px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.annotation-manager-summary strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.annotation-manager-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.annotation-author-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.annotation-author-row span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
  color: var(--green-dark);
}

.annotation-strip {
  border-radius: 999px;
  background: var(--note-color, var(--focus));
}

.activity-item {
  display: grid;
  gap: 3px;
}

.profile-access-form,
.client-room-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.profile-access-summary {
  display: grid;
  gap: 10px;
}

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

.access-summary-grid article {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.access-summary-grid strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.access-summary-grid span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
}

.danger-text {
  color: var(--brick);
}

.user-state {
  align-self: start;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.user-state.active {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

.profile-actions,
.item-actions,
.insight-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.profile-actions #profileContributorFilter {
  width: min(260px, 100%);
  min-width: 190px;
}

.profile-visibility-select {
  min-width: 122px;
  color: var(--water-deep, #0a2a4f);
  font-weight: 850;
}

.profile-actions #profileContributorFilter.is-filtered {
  border-color: rgba(15, 76, 154, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 246, 255, 0.76));
  color: var(--water-deep, var(--source-blue, #0a2a4f));
  font-weight: 750;
}

.profile-back-case {
  border-color: rgba(15, 76, 154, 0.24);
  color: var(--water-deep, var(--source-blue, #0a2a4f));
}

.entity-case-link {
  display: grid;
  gap: 4px;
  min-width: 176px;
  max-width: 310px;
}

.entity-case-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.entity-case-row select {
  min-width: 112px;
  max-width: 190px;
  height: 32px;
  padding: 0 28px 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
}

.entity-case-row .quiet-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

.entity-case-links {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 18px;
}

.entity-case-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #cddfda;
  border-radius: 999px;
  background: #f4faf7;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.entity-case-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-case-chip strong {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.entity-case-chip:hover:not(:disabled) {
  border-color: #9fc8bb;
  box-shadow: var(--shadow-soft);
}

.entity-case-chip:disabled {
  cursor: default;
  opacity: 0.74;
}

.entity-case-empty,
.entity-case-error {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.entity-case-error {
  color: var(--brick);
}

.template-case-link {
  margin: -2px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.template-case-link .entity-case-row,
.template-case-link .entity-case-links {
  justify-content: flex-start;
}

.item-actions {
  justify-content: space-between;
  margin-top: 10px;
}

.micro-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  flex-basis: 30px;
}

.micro-button svg {
  width: 15px;
  height: 15px;
}

.insight-head {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.insight-source {
  width: 100%;
  display: grid;
  gap: 2px;
  margin: 8px 0 10px;
  padding: 8px 9px;
  border: 1px solid #cddfda;
  border-radius: 8px;
  background: #f2faf7;
  color: var(--green-dark);
  text-align: left;
}

.insight-source:hover {
  border-color: #9fc8bb;
  box-shadow: var(--shadow-soft);
}

.insight-source span {
  color: var(--green-dark);
  font-weight: 750;
}

.insight-source small {
  color: var(--muted);
}

.muted-source {
  color: var(--muted);
  background: var(--surface-tint);
}

.profile-main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.deadline-main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.company-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.case-main {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(246, 251, 255, 0.96), rgba(238, 244, 248, 0.92) 58%, rgba(244, 248, 250, 0.98));
}

.case-header {
  display: none;
  order: 1;
}

.case-office-overview {
  order: 1;
}

.case-room-empty,
.case-room-content {
  display: none !important;
  order: 2;
}

.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.deadline-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.company-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
}

.case-header {
  display: none;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.profile-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.profile-mode-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-tint));
  overflow-x: auto;
}

.profile-mode-tabs button {
  min-width: 132px;
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  box-shadow: none;
}

.profile-mode-tabs button span {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.profile-mode-tabs button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.profile-mode-tabs button.active {
  border-color: color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--surface));
  box-shadow: inset 0 -2px 0 var(--green);
}

.deadline-mode-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-tint));
  overflow-x: auto;
}

.deadline-mode-tabs button {
  min-width: 168px;
  display: grid;
  gap: 2px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.deadline-mode-tabs button span {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.deadline-mode-tabs button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.deadline-mode-tabs button.active {
  border-color: color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--surface));
  box-shadow: inset 0 -2px 0 var(--green);
}

.deadline-mode-quick #deadlineAssistantWorkspace,
.deadline-mode-assistant #deadlineQuickWorkspace {
  display: none;
}

.deadline-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.company-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.case-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.case-room-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.case-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.case-header-actions select {
  max-width: 142px;
  border-color: rgba(10, 42, 79, 0.08);
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
}

.case-office-overview {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 22px 24px 26px;
  border-bottom: 0;
  background:
    radial-gradient(circle at 82% 0%, rgba(47, 111, 159, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 255, 0.88));
}

.case-office-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(246, 251, 255, 0.78)),
    var(--surface);
  box-shadow: 0 18px 48px rgba(10, 42, 79, 0.07);
}

.case-office-heading p {
  max-width: 560px;
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--source-blue) 54%, var(--muted));
  font-size: 13px;
  line-height: 1.45;
}

.case-office-heading-side {
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.case-office-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.case-office-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(10, 42, 79, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--source-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(6, 26, 51, 0.05);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.case-office-action svg {
  width: 15px;
  height: 15px;
}

.case-office-action:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 111, 159, 0.34);
  background: color-mix(in srgb, var(--source-blue-soft) 78%, white);
  box-shadow: 0 12px 26px rgba(10, 42, 79, 0.1);
}

.case-office-action.primary {
  border-color: rgba(47, 111, 159, 0.32);
  background:
    linear-gradient(135deg, #0a2a4f 0%, #1d5d93 58%, #2f6f9f 100%);
  color: white;
  box-shadow:
    0 12px 28px rgba(47, 111, 159, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.case-office-action.primary:hover {
  border-color: rgba(47, 111, 159, 0.52);
  background:
    linear-gradient(135deg, #071f3d 0%, #174f82 58%, #2f6f9f 100%);
}

.case-office-create {
  grid-template-columns: minmax(220px, 1.2fr) minmax(170px, 0.9fr) minmax(120px, 0.55fr) minmax(140px, 0.65fr) auto;
  align-items: end;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(47, 111, 159, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 246, 252, 0.72));
  box-shadow: 0 16px 42px rgba(10, 42, 79, 0.08);
}

.case-office-create.hidden {
  display: none;
}

.case-office-create-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 2px;
}

.case-office-create-head div {
  display: grid;
  gap: 1px;
}

.case-office-create-head span {
  color: var(--source-blue-mid);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-office-create-head strong {
  color: var(--ink);
  font-size: 14px;
}

.case-office-create .field {
  margin: 0;
}

.case-office-create .primary-button {
  min-height: 38px;
  white-space: nowrap;
}

.case-office-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 2px 0;
}

.case-office-toolbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.case-office-filters,
.case-team-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 3px;
  border: 1px solid rgba(10, 42, 79, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.case-office-filter,
.case-team-chip {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.case-office-filter {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12px;
}

.case-office-filter:hover,
.case-team-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 111, 159, 0.16);
  background: rgba(255, 255, 255, 0.76);
  color: var(--source-blue);
}

.case-office-filter.active,
.case-team-chip.active {
  border-color: rgba(47, 111, 159, 0.22);
  background: white;
  color: var(--source-blue);
  box-shadow: 0 8px 20px rgba(10, 42, 79, 0.08);
}

.case-office-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px));
  gap: 8px;
  margin-left: auto;
}

.case-office-controls label,
.case-operation-editor label {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.case-office-controls span,
.case-operation-editor span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-office-controls select,
.case-operation-editor input,
.case-operation-editor select,
.case-operation-editor textarea {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(10, 42, 79, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.case-operation-editor textarea {
  min-height: 58px;
  resize: vertical;
}

.case-office-metrics {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.case-office-metric {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(10, 42, 79, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  font: inherit;
  box-shadow: 0 8px 22px rgba(10, 42, 79, 0.04);
}

button.case-office-metric {
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

button.case-office-metric:hover,
button.case-office-metric.active {
  transform: translateY(-1px);
  border-color: rgba(47, 111, 159, 0.32);
  box-shadow: 0 12px 28px rgba(10, 42, 79, 0.09);
}

button.case-office-metric.active {
  background: color-mix(in srgb, var(--source-blue-soft) 78%, white);
}

.case-office-metric.tone-danger {
  border-color: rgba(152, 66, 55, 0.28);
  background: #fff1ef;
}

.case-office-metric.tone-watch {
  border-color: rgba(168, 110, 18, 0.28);
  background: #fff8e8;
}

.case-office-metric.tone-missing {
  border-color: rgba(89, 68, 111, 0.22);
  background: #f7f3fb;
}

.case-office-metric.tone-calm {
  border-color: rgba(47, 111, 159, 0.16);
  background: #f3f9fd;
}

.case-office-metric span,
.case-office-metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.case-office-metric strong {
  color: var(--source-blue);
  font-size: 13px;
}

.case-team-chip {
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  border-radius: 8px;
  text-align: left;
}

.case-team-chip strong {
  color: inherit;
  font-size: 12px;
}

.case-team-chip span,
.case-office-empty-inline {
  color: var(--muted);
  font-size: 11px;
}

.case-team-strip {
  display: none;
}

.case-office-controls {
  grid-template-columns: minmax(160px, 220px);
}

.case-office-table {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(237, 246, 252, 0.42));
  box-shadow:
    0 22px 60px rgba(10, 42, 79, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  overflow-x: auto;
  overflow-y: hidden;
}

.case-office-head,
.case-office-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.12fr) minmax(150px, 0.72fr) minmax(230px, 1fr) minmax(250px, 1.1fr) 118px 145px;
  gap: 10px;
  align-items: center;
  min-width: 1230px;
}

.case-office-head {
  padding: 7px 12px 4px;
  background: transparent;
  color: color-mix(in srgb, var(--source-blue) 54%, var(--muted));
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-office-row {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 13px 12px 13px 16px;
  border: 1px solid rgba(10, 42, 79, 0.07);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 253, 255, 0.86));
  color: inherit;
  text-align: left;
  box-shadow: 0 8px 24px rgba(10, 42, 79, 0.04);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 120ms ease;
}

.case-office-row::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 6px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.case-office-row:hover,
.case-office-row.active {
  border-color: rgba(47, 111, 159, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 255, 0.96));
  box-shadow: 0 14px 34px rgba(10, 42, 79, 0.09);
}

.case-office-row.tone-overdue::before,
.case-office-row.tone-due::before {
  background: var(--brick);
}

.case-office-row.tone-soon::before,
.case-office-row.tone-watch::before {
  background: var(--amber);
}

.case-office-row.tone-waiting::before,
.case-office-row.tone-missing::before {
  background: var(--plum);
}

.case-office-row.tone-steady::before {
  background: color-mix(in srgb, var(--source-blue-mid) 68%, white);
}

.case-office-row.tone-dormant::before,
.case-office-row.tone-closed::before {
  background: var(--line-strong);
}

.case-office-row:hover {
  transform: translateY(-2px);
}

.case-office-row > span,
.case-office-case {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.case-office-case {
  display: grid;
  gap: 3px;
}

.case-office-case strong,
.case-office-case small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-office-case small {
  color: color-mix(in srgb, var(--source-blue) 40%, var(--muted));
  font-size: 11px;
}

.case-office-next {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.case-office-next strong,
.case-office-next small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-office-next small {
  color: var(--muted);
  font-size: 11px;
}

.case-office-next.tone-overdue strong,
.case-office-next.tone-due strong {
  color: var(--brick);
}

.case-office-next.tone-soon strong,
.case-office-next.tone-watch strong {
  color: #7b520f;
}

.case-office-next.tone-missing strong {
  color: var(--plum);
}

.case-office-process {
  min-width: 0;
  display: grid;
  gap: 5px;
  white-space: normal;
}

.case-process-chip {
  min-width: 0;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid rgba(10, 42, 79, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.case-process-chip strong,
.case-process-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-process-chip strong {
  color: color-mix(in srgb, var(--source-blue) 72%, var(--ink));
  font-size: 10px;
  font-weight: 950;
}

.case-process-chip small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.case-process-chip.tone-pending {
  border-color: rgba(168, 110, 18, 0.22);
  background: linear-gradient(180deg, #fffaf0, #fff6df);
}

.case-process-chip.tone-done {
  border-color: rgba(47, 111, 159, 0.18);
  background: linear-gradient(180deg, #f4fbff, #edf6fc);
}

.case-process-chip.tone-blocked {
  border-color: rgba(152, 66, 55, 0.28);
  background: #fff1ef;
}

.case-process-chip.tone-unset {
  color: rgba(101, 113, 109, 0.82);
  background: rgba(248, 250, 252, 0.72);
}

.case-stage-cell {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid rgba(10, 42, 79, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.case-stage-cell strong,
.case-stage-cell small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-stage-cell strong {
  color: var(--source-blue);
  font-size: 11px;
  font-weight: 900;
}

.case-stage-cell small {
  color: var(--muted);
  font-size: 10px;
}

.case-stage-cell.pending {
  border-color: #e2c487;
  background: #fff8e8;
}

.case-stage-cell.overdue,
.case-stage-cell.due {
  border-color: rgba(152, 66, 55, 0.32);
  background: #fff1ef;
}

.case-stage-cell.overdue strong,
.case-stage-cell.due strong {
  color: var(--brick);
}

.case-stage-cell.soon,
.case-stage-cell.watch {
  border-color: rgba(168, 110, 18, 0.3);
  background: #fff8e8;
}

.case-stage-cell.soon strong,
.case-stage-cell.watch strong {
  color: #7b520f;
}

.case-stage-cell.good {
  border-color: rgba(47, 111, 159, 0.18);
  background: #f3f9fd;
}

.case-stage-cell.unset {
  background: rgba(248, 250, 252, 0.76);
}

.case-stage-cell.done {
  border-color: rgba(47, 111, 159, 0.2);
  background: #edf6fc;
}

.case-stage-cell b {
  color: var(--ink);
  font-weight: 950;
}

.case-stage-cell.blocked {
  border-color: #d99a92;
  background: #fff1ef;
}

.case-estimate-pill {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  background: rgba(255, 255, 255, 0.84);
  color: var(--source-blue);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.case-estimate-pill.unset {
  color: var(--muted);
  background: rgba(248, 250, 252, 0.72);
}

.case-office-owner {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.case-office-owner strong,
.case-office-owner small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-office-owner strong {
  color: var(--source-blue);
  font-size: 12px;
  font-weight: 950;
}

.case-office-owner small {
  color: var(--muted);
  font-size: 10px;
}

.case-office-inline-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  margin: -3px 4px 4px;
  padding: 16px;
  border: 1px solid rgba(47, 111, 159, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at right top, rgba(47, 111, 159, 0.11), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 249, 253, 0.9));
  box-shadow:
    0 16px 42px rgba(10, 42, 79, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
  overflow: hidden;
}

.case-office-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-office-inline-head div {
  display: grid;
  gap: 2px;
}

.case-office-inline-head span,
.case-office-inline-grid label > span {
  color: color-mix(in srgb, var(--source-blue) 58%, var(--muted));
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-office-inline-head strong {
  color: var(--ink);
  font-size: 15px;
}

.case-office-inline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.case-office-inline-grid label {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.case-office-inline-grid label.wide {
  grid-column: span 2;
}

.case-office-inline-grid input,
.case-office-inline-grid select,
.case-office-inline-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid rgba(10, 42, 79, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.case-office-inline-grid input:focus,
.case-office-inline-grid select:focus,
.case-office-inline-grid textarea:focus,
.case-office-controls select:focus,
.case-operation-editor input:focus,
.case-operation-editor select:focus,
.case-operation-editor textarea:focus {
  outline: none;
  border-color: rgba(47, 111, 159, 0.42);
  background: white;
  box-shadow:
    0 0 0 3px rgba(47, 111, 159, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.case-office-inline-grid textarea {
  min-height: 72px;
  resize: vertical;
}

.case-office-inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.case-office-action:focus-visible,
.case-office-filter:focus-visible,
.case-team-chip:focus-visible,
.case-office-metric:focus-visible,
.case-office-row:focus-visible {
  outline: 3px solid rgba(47, 111, 159, 0.18);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .case-office-overview {
    padding: 12px;
  }

  .case-office-heading,
  .case-office-toolbar {
    display: grid;
    gap: 8px;
  }

  .case-office-heading-side {
    justify-items: start;
    width: 100%;
  }

  .case-office-actions {
    justify-content: flex-start;
  }

  .case-office-create {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-office-controls {
    margin-left: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .case-office-table {
    overflow: visible;
  }

  .case-office-head {
    display: none;
  }

  .case-office-row {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(108px, auto);
    align-items: start;
    gap: 8px 10px;
    padding: 12px 12px 12px 16px;
  }

  .case-office-case {
    grid-column: 1;
  }

  .case-stage-cell {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    max-width: 132px;
  }

  .case-office-next {
    grid-column: 1 / -1;
  }

  .case-office-process {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-process-chip {
    grid-template-columns: minmax(62px, auto) minmax(0, 1fr);
  }

  .case-estimate-pill {
    grid-column: 1;
    justify-self: start;
  }

  .case-office-owner {
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }

  .case-office-inline-grid {
    grid-template-columns: 1fr;
  }

  .case-office-inline-grid label.wide {
    grid-column: 1;
  }
}

.case-next-pill {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.case-next-pill.good {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

.case-next-pill.watch,
.case-next-pill.soon {
  border-color: #e2c487;
  background: #fff8e8;
  color: #7b520f;
}

.case-next-pill.due,
.case-next-pill.overdue {
  border-color: #d99a92;
  background: #fff1ef;
  color: #8d2f24;
}

.case-process-pill,
.case-status-pill {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.case-status-pill.active {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

.case-status-pill.waiting {
  border-color: #e2c487;
  background: #fff8e8;
  color: #7b520f;
}

.case-status-pill.dormant {
  border-color: #bdd5e8;
  background: #eef5fa;
  color: #25445f;
}

.case-status-pill.closed {
  border-color: #d4d8de;
  background: #f4f6f8;
  color: #5f6b78;
}

.case-office-empty {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 18px;
  color: var(--muted);
}

.case-office-empty strong {
  color: var(--text);
}

.case-room-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 0;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.case-room-empty strong {
  color: var(--text);
  font-size: 18px;
}

.case-room-content {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(23, 107, 91, 0.04), rgba(247, 249, 251, 0) 240px),
    var(--surface-tint);
}

.case-room-hero {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.case-room-hero-main,
.case-link-panel,
.case-room-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.case-room-hero-main > .section-title {
  order: 1;
}

.case-room-hero-main > #caseProcessCards {
  order: 2;
}

.case-room-hero-main > #caseStatusActions {
  order: 3;
}

.case-room-hero-main > #caseProcessRail {
  order: 4;
}

.case-room-hero-main > #caseSummaryGrid {
  order: 5;
}

.case-room-hero-main > #caseNextBox {
  order: 6;
}

.case-link-panel small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-room-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 18px 0;
  overflow-x: auto;
}

.case-room-tabs button {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.case-room-tabs button.active {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 10%, var(--surface));
  color: var(--green-dark);
}

.case-room-panels {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 18px;
}

.case-room-panel {
  max-width: 1180px;
}

.case-overview-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.case-overview-item {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.case-overview-item small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-overview-item.wide {
  grid-column: span 2;
}

.case-overview-item span {
  color: var(--muted);
  font-size: 12px;
}

.case-overview-item strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
}

.case-empty-action {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.case-empty-action span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.case-activity-list {
  display: grid;
  gap: 10px;
}

.case-activity-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
}

.case-activity-item span,
.case-activity-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.deadline-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.company-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.company-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.company-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-tab:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.company-tab.active {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
  box-shadow: inset 0 -2px 0 var(--green);
}

.deadline-status {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.deadline-status.green {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

.deadline-status.yellow {
  border-color: #e2c487;
  background: #fff8e8;
  color: #7b520f;
}

.deadline-status.red {
  border-color: #d8aaa4;
  background: #fff3f1;
  color: #7e3028;
}

.deadline-status.blue {
  border-color: #bdd5e8;
  background: #eef5fa;
  color: #25445f;
}

.profile-grid,
.profile-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 1px;
  background: var(--line);
  overflow: hidden;
}

.profile-workspace {
  grid-template-columns: minmax(520px, 1.2fr) minmax(380px, 0.8fr);
}

.profile-workspace[data-profile-mode="notat"] .profile-contribution-panel,
.profile-workspace[data-profile-mode="notat"] .profile-report-panel,
.profile-workspace[data-profile-mode="sources"] .profile-contribution-panel,
.profile-workspace[data-profile-mode="sources"] .profile-report-panel,
.profile-workspace[data-profile-mode="contributions"] .profile-source-panel,
.profile-workspace[data-profile-mode="contributions"] .profile-report-panel,
.profile-workspace[data-profile-mode="report"] .profile-source-panel,
.profile-workspace[data-profile-mode="report"] .profile-contribution-panel {
  display: none;
}

.profile-workspace[data-profile-mode="sources"] {
  grid-template-columns: minmax(380px, 0.75fr) minmax(560px, 1.25fr);
}

.profile-workspace[data-profile-mode="sources"] .profile-source-panel {
  order: -1;
}

.profile-workspace[data-profile-mode="contributions"] {
  grid-template-columns: minmax(420px, 0.8fr) minmax(560px, 1.2fr);
}

.profile-workspace[data-profile-mode="contributions"] .profile-contribution-panel {
  order: -1;
}

.profile-workspace[data-profile-mode="report"] {
  grid-template-columns: minmax(420px, 0.8fr) minmax(620px, 1.2fr);
}

.profile-workspace[data-profile-mode="report"] .profile-report-panel {
  order: -1;
  background: var(--surface);
}

.deadline-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(460px, 1.1fr) minmax(360px, 0.9fr);
  gap: 1px;
  background: var(--line);
  overflow: hidden;
}

.deadline-quick-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(440px, 0.88fr) minmax(480px, 1.12fr);
  gap: 1px;
  background: var(--line);
  overflow: hidden;
}

.company-workspace {
  min-height: 0;
  min-width: 0;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(23, 107, 91, 0.04), rgba(247, 249, 251, 0) 220px),
    var(--surface-tint);
  overflow-y: auto;
  overflow-x: hidden;
}

.case-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 1px;
  background: var(--line);
  overflow: hidden;
}

.profile-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface-tint);
}

.profile-issue-panel {
  background:
    linear-gradient(180deg, rgba(23, 107, 91, 0.055), rgba(247, 249, 251, 0) 220px),
    var(--surface-tint);
}

.profile-form-title {
  margin-top: 18px;
}

.profile-issue-board,
.issue-insight-list {
  display: grid;
  gap: 10px;
}

.profile-empty-notat {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.profile-empty-notat span {
  color: var(--muted);
  font-size: 13px;
}

.issue-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}

.issue-card header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.issue-card header strong {
  display: block;
  font-size: 15px;
}

.issue-card header span,
.issue-card header small {
  color: var(--muted);
  font-size: 12px;
}

.issue-card header small {
  max-width: 220px;
  text-align: right;
}

.issue-card-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.issue-status-select {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 800;
}

.issue-status-select.working {
  border-color: #bdd5e8;
  background: #eef5fa;
  color: #25445f;
}

.issue-status-select.review {
  border-color: #e2c487;
  background: #fff8e8;
  color: #7b520f;
}

.issue-status-select.ready {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

.issue-status-select.blocked {
  border-color: #d8aaa4;
  background: #fff3f1;
  color: #7e3028;
}

.issue-insight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.45fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--note-color, var(--green));
  border-radius: 8px;
  background: var(--surface);
}

.issue-insight[draggable="true"] {
  cursor: grab;
}

.issue-insight.dragging {
  opacity: 0.58;
  border-style: dashed;
  box-shadow: 0 18px 36px rgba(27, 40, 36, 0.16);
}

.issue-insight-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.issue-insight-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drag-handle {
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.issue-order-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.micro-text-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

.issue-insight-main > span {
  color: var(--muted);
  font-size: 12px;
}

.issue-insight-main p {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
}

.issue-insight blockquote {
  margin: 0;
  padding: 9px 11px;
  border-left: 3px solid var(--note-color, var(--green));
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--note-color, var(--green)) 8%, white);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.issue-source-link {
  align-self: start;
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid #cddfda;
  border-radius: 8px;
  background: #f2faf7;
  color: var(--green-dark);
  text-align: left;
}

.issue-source-link span {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.issue-source-link small {
  color: var(--muted);
  font-size: 11px;
}

.source-pin {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e5f2ed;
  color: var(--green-dark);
  font-size: 10.5px;
  font-weight: 800;
}

.source-pin.legal-weight {
  border: 1px solid color-mix(in srgb, var(--gold) 42%, var(--line));
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
  color: #6a4a08;
}

.insight-source-preview {
  min-height: 46px;
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #cddfda;
  border-radius: 8px;
  background: #f2faf7;
  color: var(--green-dark);
  font-size: 12px;
}

.insight-source-preview.muted {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.profile-report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.profile-report-summary article {
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.profile-report-summary article.wide {
  grid-column: 1 / -1;
}

.profile-report-summary span,
.profile-report-summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.profile-report-summary strong {
  min-width: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.15;
}

.profile-report-preview {
  display: grid;
  gap: 12px;
}

.report-preview-cover,
.report-preview-sources,
.report-preview-issue {
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.report-preview-cover {
  border-top: 4px solid var(--green);
}

.report-preview-cover span {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-preview-cover h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
}

.report-preview-cover p,
.report-preview-sources span,
.report-preview-issue span,
.report-preview-issue small,
.report-preview-issue p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.report-preview-sources ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-preview-sources li {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.report-preview-issue header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.report-preview-issue article {
  display: grid;
  gap: 6px;
  padding: 11px 0 0;
}

.report-preview-issue blockquote {
  margin: 0;
  padding: 9px 11px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.report-preview-issue p {
  margin: 0;
}

.insight-source-preview strong {
  font-size: 12px;
}

.insight-source-preview span {
  color: inherit;
  font-size: 12px;
  line-height: 1.45;
}

.annotation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-2px);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 140ms ease;
}

.annotation-item:hover .annotation-actions,
.annotation-item:focus-within .annotation-actions {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.profile-collaboration {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.profile-collaboration summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.profile-collaboration > * + * {
  margin-top: 10px;
}

.deadline-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface-tint);
}

.company-panel {
  width: min(100%, 1180px);
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  overflow: visible;
}

.case-panel {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface-tint);
}

.company-overview-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.case-overview-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.case-summary-grid {
  display: block;
}

.case-status-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.case-status-action {
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(10, 42, 79, 0.11);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: left;
  font-weight: 850;
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    background 130ms ease,
    box-shadow 130ms ease;
}

.case-status-action span {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(10, 42, 79, 0.04);
}

.case-status-action strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.case-status-action:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 136, 229, 0.24);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 26px rgba(6, 26, 51, 0.07);
}

.case-status-action.is-selected {
  border-color: color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--green) 10%, white);
  color: var(--green-dark);
}

.case-status-action.is-selected span {
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 13%, transparent);
}

.case-status-action.tone-waiting.is-selected {
  border-color: #e2c487;
  background: #fff8e8;
  color: #7b520f;
}

.case-status-action.tone-waiting.is-selected span {
  background: var(--amber);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 15%, transparent);
}

.case-status-action.tone-dormant.is-selected {
  border-color: #bdd5e8;
  background: #eef5fa;
  color: #25445f;
}

.case-status-action.tone-dormant.is-selected span {
  background: var(--focus);
}

.case-status-action.tone-closed.is-selected {
  border-color: #d4d8de;
  background: #f4f6f8;
  color: #5f6b78;
}

.case-status-action.tone-closed.is-selected span {
  background: #8a97a5;
}

.case-process-rail {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(23, 107, 91, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(237, 247, 243, 0.82), rgba(255, 255, 255, 0.76));
}

.case-process-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.case-process-panel-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.case-process-panel-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-process-panel-head strong {
  color: var(--green-dark);
  font-size: 20px;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.1;
  text-transform: none;
  letter-spacing: 0;
}

.case-process-panel-head small {
  max-width: 240px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.case-process-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.case-process-check {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
}

.case-process-check > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-process-check > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.case-process-check button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    background 130ms ease,
    color 130ms ease;
}

.case-process-check button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
  color: var(--ink);
}

.case-process-check button.active {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 11%, white);
  color: var(--green-dark);
}

.case-process-check button.active.pending {
  border-color: #e2c487;
  background: #fff8e8;
  color: #7b520f;
}

.case-process-check button.active.done {
  border-color: #9fc8bb;
  background: #edf7f3;
  color: var(--green-dark);
}

.case-process-check button.active.blocked {
  border-color: #d99a92;
  background: #fff1ef;
  color: #8d2f24;
}

.case-process-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.case-status-actions,
.case-next-box,
.case-room-tabs,
.case-room-panels,
.case-support-data {
  display: none !important;
}

.case-command-card {
  position: relative;
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 250, 0.86));
  box-shadow: 0 18px 38px rgba(10, 42, 79, 0.07);
  overflow: hidden;
  scroll-margin-top: 18px;
}

.case-command-card.case-focus-pulse {
  animation: case-focus-pulse 1100ms ease;
}

@keyframes case-focus-pulse {
  0% {
    border-color: rgba(23, 107, 91, 0.36);
    box-shadow: 0 0 0 0 rgba(23, 107, 91, 0.16), 0 18px 38px rgba(10, 42, 79, 0.07);
  }
  100% {
    border-color: rgba(10, 42, 79, 0.10);
    box-shadow: 0 0 0 14px rgba(23, 107, 91, 0), 0 18px 38px rgba(10, 42, 79, 0.07);
  }
}

.case-command-card::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 70%, white);
}

.case-command-card.tone-overdue::before,
.case-command-card.tone-due::before {
  background: var(--brick);
}

.case-command-card.tone-soon::before,
.case-command-card.tone-watch::before {
  background: var(--amber);
}

.case-command-card.tone-missing::before,
.case-command-card.tone-waiting::before {
  background: var(--plum);
}

.case-command-card.tone-dormant::before,
.case-command-card.tone-closed::before {
  background: var(--line-strong);
}

.case-command-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.case-command-top > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.case-command-top span,
.case-command-field span,
.case-command-note summary,
.case-process-workbench-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-command-top strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.16;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-command-top small {
  color: var(--muted);
  font-size: 12px;
}

.case-command-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.case-command-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 900;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.case-command-chip.tone-overdue,
.case-command-chip.tone-due {
  border-color: rgba(152, 66, 55, 0.28);
  background: #fff1ef;
  color: var(--brick) !important;
}

.case-command-chip.tone-soon,
.case-command-chip.tone-watch {
  border-color: rgba(168, 110, 18, 0.28);
  background: #fff8e8;
  color: #7b520f !important;
}

.case-command-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(170px, 0.9fr) minmax(260px, 1.35fr) minmax(180px, 0.9fr) minmax(96px, 0.55fr) minmax(116px, 0.65fr) auto;
  gap: 8px;
  align-items: end;
}

.case-command-field {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.case-command-main {
  min-width: 220px;
}

.case-command-field input,
.case-command-field select,
.case-command-note textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.case-command-date-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.case-command-date-tools button {
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  transition:
    border-color 130ms ease,
    background 130ms ease,
    color 130ms ease;
}

.case-command-date-tools button:hover {
  border-color: color-mix(in srgb, var(--green) 30%, var(--line));
  background: #fff;
  color: var(--green-dark);
}

.case-command-save {
  min-height: 36px;
  white-space: nowrap;
}

.case-command-note {
  border-top: 1px solid rgba(10, 42, 79, 0.08);
  padding-top: 8px;
}

.case-command-note summary {
  width: fit-content;
  cursor: pointer;
  color: var(--green-dark);
}

.case-command-note textarea {
  margin-top: 8px;
  min-height: 58px;
  resize: vertical;
}

.case-process-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(10, 42, 79, 0.055);
}

.case-process-card.primary,
.case-process-card.full {
  grid-column: 1 / -1;
}

.case-process-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.case-process-card-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.case-process-card-head span,
.case-process-card-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-process-card-head strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
}

.case-process-card-head small {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.case-process-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.case-process-card-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.case-process-card-grid label {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.case-process-card-grid .wide {
  grid-column: span 2;
}

.case-process-card-grid input,
.case-process-card-grid select,
.case-process-card-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.case-process-card-grid textarea {
  min-height: 58px;
  resize: vertical;
}

.case-process-save {
  align-self: end;
  min-height: 38px;
  white-space: nowrap;
}

.case-process-actions {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 7px;
}

.case-process-step {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 66px;
  gap: 3px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    background 130ms ease,
    box-shadow 130ms ease;
}

.case-process-step:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 136, 229, 0.24);
  background: #fff;
  box-shadow: 0 10px 22px rgba(6, 26, 51, 0.06);
}

.case-process-step i {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--line-strong) 26%, white);
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}

.case-process-step.done {
  border-color: color-mix(in srgb, var(--green) 18%, var(--line));
  color: color-mix(in srgb, var(--green-dark) 72%, var(--muted));
}

.case-process-step.done i {
  background: color-mix(in srgb, var(--green) 18%, white);
  color: var(--green-dark);
}

.case-process-step.current {
  border-color: color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--green) 9%, white);
  color: var(--green-dark);
  box-shadow: 0 8px 20px rgba(23, 107, 91, 0.08);
}

.case-process-step.selected {
  border-color: color-mix(in srgb, var(--focus) 42%, var(--green) 22%);
  box-shadow:
    0 0 0 3px rgba(30, 136, 229, 0.08),
    0 12px 26px rgba(6, 26, 51, 0.08);
}

.case-process-step.current i {
  background: var(--green);
  color: white;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 12%, transparent);
}

.case-process-step strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-process-step span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(71, 92, 118, 0.72);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.case-process-step.current span {
  color: color-mix(in srgb, var(--green-dark) 72%, var(--muted));
}

.case-process-workbench {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.45fr);
  gap: 10px;
  min-width: 0;
  padding-top: 2px;
}

.case-process-workbench-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.case-process-workbench-title strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.case-process-step-list {
  display: grid;
  gap: 6px;
  align-content: start;
}

.case-process-step-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 2px 8px;
  padding: 9px 10px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-align: left;
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    background 130ms ease,
    box-shadow 130ms ease;
}

.case-process-step-row:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--green) 24%, var(--line));
  background: #fff;
  box-shadow: 0 12px 22px rgba(6, 26, 51, 0.06);
}

.case-process-step-row.active {
  border-color: color-mix(in srgb, var(--focus) 36%, var(--line));
  background: color-mix(in srgb, var(--focus) 5%, white);
}

.case-process-step-row.current {
  box-shadow: inset 3px 0 0 var(--green);
}

.case-process-step-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.case-process-step-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-process-step-row small {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-process-step-row.done strong {
  color: var(--green-dark);
}

.case-process-step-row.blocked strong {
  color: #8d2f24;
}

.case-process-editor-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(10, 42, 79, 0.1);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 250, 0.86));
  box-shadow: 0 18px 36px rgba(10, 42, 79, 0.07);
}

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

.case-operation-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(148px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(10, 42, 79, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.66);
}

.case-operation-editor .wide {
  grid-column: span 3;
}

.case-operation-editor .primary-button {
  min-height: 36px;
  align-self: end;
  white-space: nowrap;
}

.case-next-box {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.45;
}

.case-next-box.green {
  border-left-color: var(--green);
}

.case-next-box.yellow {
  border-left-color: var(--amber);
}

.case-next-box.red {
  border-left-color: var(--brick);
}

.case-next-box.blue {
  border-left-color: var(--focus);
}

.case-next-box span,
.case-next-box small {
  color: var(--muted);
  font-size: 12px;
}

.case-list {
  display: grid;
  gap: 9px;
}

.case-work-item {
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 120ms ease;
}

.case-work-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.case-work-item.green {
  border-left-color: var(--green);
}

.case-work-item.yellow {
  border-left-color: var(--amber);
}

.case-work-item.red {
  border-left-color: var(--brick);
}

.case-work-item.blue {
  border-left-color: var(--focus);
}

.case-work-item.profile-linked {
  border-left-color: color-mix(in srgb, var(--gold) 70%, var(--line));
}

.case-work-main {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.case-work-open {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  line-height: 1.4;
}

.case-work-open:hover {
  color: var(--green-dark);
}

.case-work-open span,
.case-work-open small {
  color: var(--muted);
  font-size: 12px;
}

.case-work-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.case-work-chip {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.case-work-chip.ready,
.case-work-chip.green {
  border-color: color-mix(in srgb, var(--green) 38%, var(--line));
  background: color-mix(in srgb, var(--green) 11%, var(--surface));
}

.case-work-chip.review,
.case-work-chip.yellow {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--line));
  background: color-mix(in srgb, var(--amber) 13%, var(--surface));
}

.case-work-chip.blocked,
.case-work-chip.red {
  border-color: color-mix(in srgb, var(--brick) 42%, var(--line));
  background: color-mix(in srgb, var(--brick) 10%, var(--surface));
}

.case-work-chip.working,
.case-work-chip.blue {
  border-color: color-mix(in srgb, var(--focus) 36%, var(--line));
  background: color-mix(in srgb, var(--focus) 10%, var(--surface));
}

.case-work-chip.muted {
  color: var(--muted);
  font-weight: 600;
}

.case-work-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-work-warning {
  color: var(--brick);
  font-weight: 700;
}

.case-work-note {
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  font-size: 12px;
  line-height: 1.35;
}

.case-work-note span {
  color: var(--muted);
}

.case-work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}

.case-analysis-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid color-mix(in srgb, var(--gold) 70%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.case-analysis-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr);
  gap: 14px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.case-analysis-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.case-analysis-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.case-issue-matrix {
  display: grid;
  gap: 8px;
}

.case-issue-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) minmax(0, 1.6fr) minmax(180px, 0.75fr);
  gap: 12px;
  align-items: stretch;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 64%, var(--surface));
}

.case-issue-row.ready {
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
}

.case-issue-row.review {
  border-color: color-mix(in srgb, var(--amber) 32%, var(--line));
}

.case-issue-row.blocked {
  border-color: color-mix(in srgb, var(--brick) 30%, var(--line));
}

.case-issue-status,
.case-issue-note {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
}

.case-issue-status strong,
.case-issue-note strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.case-issue-status small,
.case-issue-note span,
.case-issue-note small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.case-issue-source {
  min-width: 0;
  display: grid;
  align-content: start;
}

.case-source-button {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  line-height: 1.25;
}

.case-source-button:hover {
  border-color: color-mix(in srgb, var(--green) 38%, var(--line));
  color: var(--green-dark);
  box-shadow: var(--shadow-soft);
}

.case-source-button span,
.case-source-button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-source-button small {
  color: var(--muted);
  font-size: 11px;
}

.case-empty-action.compact {
  padding: 12px;
}

.insight-form {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.deadline-form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.deadline-quick-form.tax-mode .deadline-quick-vat-only,
.deadline-quick-form.vat-mode .deadline-quick-tax-only {
  display: none;
}

.legacy-deadline-field,
.deadline-form [data-deadline-group] {
  display: none !important;
}

.deadline-info-box,
.deadline-inline-help {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #cddfda;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #f4faf7;
  color: var(--ink);
  line-height: 1.45;
}

.deadline-info-box {
  margin-top: 10px;
}

.deadline-info-box strong {
  font-size: 13px;
}

.deadline-info-box span,
.deadline-inline-help {
  color: var(--muted);
  font-size: 12px;
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.deadline-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.deadline-line-form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.deadline-item-builder {
  grid-column: 1 / -1;
}

.deadline-kind-toggle {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.deadline-kind-toggle label {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 750;
}

.deadline-kind-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.deadline-kind-toggle label:has(input:checked) {
  background: var(--surface);
  color: var(--green-dark);
  box-shadow: var(--shadow-soft);
}

.deadline-kind-toggle.premium-toggle {
  width: 100%;
}

.deadline-kind-toggle.premium-toggle label {
  flex: 1;
  justify-content: center;
}

.deadline-line-form.tax-mode .deadline-vat-only,
.deadline-line-form.vat-mode .deadline-tax-only {
  display: none;
}

.deadline-item-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.deadline-line-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.deadline-line-card.green {
  border-left-color: var(--green);
}

.deadline-line-card.yellow {
  border-left-color: var(--amber);
}

.deadline-line-card.red {
  border-left-color: var(--brick);
}

.deadline-line-card.blue {
  border-left-color: var(--focus);
}

.deadline-line-open {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.deadline-line-open span,
.deadline-line-open small {
  color: var(--muted);
  font-size: 12px;
}

.deadline-subsection {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.knowledge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
}

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

.deadline-analysis-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.deadline-next-action {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
}

.deadline-next-action.green {
  border-left-color: var(--green);
}

.deadline-next-action.yellow {
  border-left-color: var(--amber);
}

.deadline-next-action.red {
  border-left-color: var(--brick);
}

.deadline-next-action.blue {
  border-left-color: var(--focus);
}

.deadline-next-action strong {
  font-size: 15px;
}

.deadline-next-action span,
.deadline-next-action small {
  color: var(--muted);
}

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

.deadline-summary-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.deadline-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 4px;
}

.deadline-summary-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.deadline-period-grid {
  display: grid;
  gap: 8px;
}

.deadline-period-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
}

.deadline-period-card.green {
  border-left-color: var(--green);
}

.deadline-period-card.yellow {
  border-left-color: var(--amber);
}

.deadline-period-card.red {
  border-left-color: var(--brick);
}

.deadline-period-card.blue {
  border-left-color: var(--focus);
}

.deadline-period-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.deadline-period-card header div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.deadline-period-card header span,
.deadline-period-card p,
.deadline-period-card li span,
.deadline-period-warnings small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.deadline-period-card mark {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef5fa;
  color: #25445f;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.deadline-period-card.green mark {
  background: #edf7f3;
  color: #176b5b;
}

.deadline-period-card.yellow mark {
  background: #fff8e8;
  color: #7b520f;
}

.deadline-period-card.red mark {
  background: #fff3f1;
  color: #7e3028;
}

.deadline-period-card ul {
  display: grid;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.deadline-period-card li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.deadline-period-card li strong {
  font-size: 12px;
}

.deadline-period-warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.deadline-period-warnings small {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-tint);
}

.vertical-actions {
  display: grid;
}

.company-empty {
  display: grid;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fbfa, #ffffff);
  line-height: 1.45;
}

.company-empty span {
  color: var(--muted);
}

.company-status-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--focus);
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #f8faf9);
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.04);
}

.company-status-panel.green {
  border-left-color: var(--green);
  background: linear-gradient(135deg, #f5fbf8, #ffffff);
}

.company-status-panel.yellow {
  border-left-color: var(--amber);
  background: linear-gradient(135deg, #fffaf0, #ffffff);
}

.company-status-panel.red {
  border-left-color: var(--brick);
  background: linear-gradient(135deg, #fff6f4, #ffffff);
}

.company-status-panel.blue {
  border-left-color: var(--focus);
}

.company-status-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
}

.company-status-eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-status-main strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 22px;
  letter-spacing: 0;
}

.company-status-main small,
.company-status-action small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.company-status-body {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: center;
}

.company-status-body p {
  margin: 0;
  color: #2f3a37;
  line-height: 1.45;
}

.company-status-action {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid rgba(185, 200, 197, 0.8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.company-status-action span {
  font-weight: 750;
  line-height: 1.35;
}

.company-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.company-summary-grid,
.company-owner-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.company-summary-card,
.company-insight-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: var(--surface);
  line-height: 1.4;
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.company-summary-card:nth-child(2),
.company-insight-card:nth-child(2) {
  border-left-color: var(--focus);
}

.company-summary-card:nth-child(3),
.company-insight-card:nth-child(3) {
  border-left-color: var(--plum);
}

.company-summary-card:nth-child(4),
.company-insight-card:nth-child(4) {
  border-left-color: var(--amber);
}

.company-summary-card span,
.company-insight-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.company-summary-card strong,
.company-insight-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.company-insight-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.company-quality {
  display: grid;
  grid-template-columns: minmax(145px, 0.24fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.company-quality-score {
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 10px;
  background: var(--surface);
}

.company-quality-score.high {
  border-left-color: var(--green);
}

.company-quality-score.low {
  border-left-color: var(--brick);
}

.company-quality-score span,
.company-quality-score small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.company-quality-score strong {
  display: block;
  margin: 2px 0;
  font-size: 22px;
}

.company-quality-checks {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.company-quality-checks-title {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.company-quality-check {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: default;
}

.company-quality-check i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-strong);
}

.company-quality-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.company-quality-check.ok {
  color: var(--green-dark);
}

.company-quality-check.ok i {
  background: var(--green);
}

.company-quality-check.missing {
  color: var(--brick);
}

.company-quality-check.missing i {
  background: var(--brick);
}

.company-metric,
.company-detail,
.company-check,
.company-relation-item,
.ownership-row,
.company-report-item {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.company-metric span,
.company-detail span,
.company-check span,
.company-relation-item span,
.ownership-row span,
.company-report-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.company-metric span,
.company-detail span {
  display: block;
  margin-bottom: 4px;
  font-weight: 750;
}

.company-metric strong,
.company-detail strong,
.company-relation-item strong,
.ownership-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.company-detail-grid,
.company-report-list,
.company-risk-list,
.company-relation-list,
.ownership-chart,
.company-timeline,
.company-evidence-list {
  display: grid;
  gap: 8px;
}

.company-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.company-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.company-filter-row select {
  width: 100%;
}

.company-accounts-shell {
  display: grid;
  gap: 12px;
}

.company-accounts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(8, 38, 77, 0.12);
  border-radius: 12px;
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 111, 159, 0.10), transparent 34%),
    linear-gradient(135deg, #ffffff, #f4f8fb);
}

.company-accounts-head span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
}

.company-accounts-head strong {
  color: var(--brand-navy);
  font-size: 18px;
  line-height: 1.2;
}

.company-accounts-list {
  display: grid;
  gap: 9px;
}

.company-accounts-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--premium-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
}

.company-accounts-empty strong {
  color: var(--brand-navy);
  font-size: 14px;
}

.company-report-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.company-report-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(47, 111, 159, 0.16);
  border-radius: 10px;
  background: rgba(47, 111, 159, 0.08);
  color: var(--focus);
}

.company-report-icon svg {
  width: 18px;
  height: 18px;
}

.company-report-main {
  min-width: 0;
}

.company-report-main > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-report-item strong,
.company-report-main strong {
  display: block;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
  color: var(--brand-navy);
  font-size: 14px;
  line-height: 1.28;
}

.company-report-item span,
.company-report-main small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.company-report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.company-report-actions .quiet-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  text-decoration: none;
}

.company-report-item.source-only {
  border-left: 3px solid var(--amber);
}

.company-report-item.downloadable {
  border-left: 3px solid var(--focus);
}

.company-report-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.company-group-structure {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #fbfcfc, #f6f9f8);
}

.company-network-expand {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.company-network-expand-head,
.company-network-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.company-network-expand-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-network-expand-head strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.company-network-options {
  border: 1px solid rgba(31, 84, 76, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.company-network-options summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}

.company-network-options summary::-webkit-details-marker {
  display: none;
}

.company-network-options summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--premium-border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
}

.company-network-options[open] summary {
  border-bottom: 1px solid var(--premium-border);
  background: rgba(247, 250, 249, 0.86);
}

.company-network-options[open] summary::after {
  content: "-";
}

.company-network-controls {
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 12px;
}

.company-network-controls > label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-network-controls select {
  min-width: 112px;
}

.company-network-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.company-network-type-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.company-network-status {
  min-height: 34px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 750;
}

.company-network-status.ready {
  border-left: 4px solid var(--green);
}

.company-network-status.loading,
.company-network-status.stale {
  border-left: 4px solid var(--focus);
}

.company-network-status.warning {
  border-left: 4px solid var(--amber);
  background: #fffaf0;
  color: #6b4a13;
}

.company-network-status.error {
  border-left: 4px solid var(--brick);
  background: #fff7f5;
  color: #8f2e1c;
}

.company-expanded-network {
  display: grid;
  gap: 12px;
}

.company-network-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.company-network-warnings {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #d9c99f;
  border-radius: 8px;
  background: #fffaf0;
}

.company-network-warnings span {
  color: #6b4a13;
  font-size: 12px;
}

.company-network-depths,
.company-network-edge-list {
  display: grid;
  gap: 10px;
}

.company-network-depth {
  display: grid;
  gap: 8px;
}

.company-network-node-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.company-network-node,
.company-network-edge {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
}

.company-network-node.green {
  border-left-color: var(--green);
}

.company-network-node.yellow {
  border-left-color: var(--amber);
}

.company-network-node.red {
  border-left-color: var(--brick);
}

.company-network-node span,
.company-network-edge span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-network-node strong,
.company-network-edge strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.company-network-node small,
.company-network-edge small,
.company-network-edge em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.company-network-node-side {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 6px;
}

.company-network-node-side em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

@media (max-width: 860px) {
  .company-network-summary,
  .company-network-node-list {
    grid-template-columns: 1fr;
  }
}

.company-group-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.company-group-header span,
.company-group-header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-group-header strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

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

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

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

.company-group-grid.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.company-group-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.company-group-node,
.company-group-empty {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.company-group-empty {
  display: grid;
  gap: 4px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.48);
}

.company-group-empty strong {
  color: var(--ink);
  font-size: 13px;
}

.company-group-node.current {
  box-shadow: 0 1px 0 rgba(22, 31, 29, 0.03);
}

.company-group-node.exited {
  border-style: dashed;
  background: #fffaf0;
}

.company-group-node-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.company-group-column.parent .company-group-node {
  border-left: 4px solid var(--plum);
}

.company-group-column.center .company-group-node {
  border-left: 4px solid var(--green);
}

.company-group-column.subsidiary .company-group-node {
  border-left: 4px solid var(--focus);
}

.company-group-node span,
.company-group-node small,
.company-group-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.company-group-node span {
  display: block;
  margin-bottom: 3px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-lifecycle-pill {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.1;
  white-space: nowrap;
}

.company-lifecycle-pill.current {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  color: var(--green-dark);
}

.company-lifecycle-pill.exited {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
  color: #6b4a13;
}

.company-group-node strong {
  display: block;
  overflow-wrap: anywhere;
}

.company-group-node small {
  display: block;
  margin-top: 4px;
}

.company-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.company-inline-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.company-inline-action:hover,
.company-inline-action:focus-visible {
  border-color: var(--line-strong);
  background: #fff;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
  outline: none;
}

.company-inline-action.primary {
  border-color: color-mix(in srgb, var(--focus) 46%, var(--line));
  color: var(--focus);
  background: color-mix(in srgb, var(--focus) 8%, #fff);
}

.company-group-subhead {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.company-group-gaps {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #d9c99f;
  border-radius: 10px;
  background: #fffaf0;
}

.company-group-gaps span {
  color: #6b4a13;
  font-size: 12px;
  line-height: 1.35;
}

.company-structure-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(185, 200, 197, 0.78);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.64);
}

.company-structure-note span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-structure-note strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.company-role-ledger {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.company-role-ledger:empty {
  display: none;
}

.company-role-ledger-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.company-role-ledger-head span,
.company-role-ledger-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-role-ledger-head strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.company-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.company-role-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.company-role-card.owner {
  border-left: 4px solid var(--green);
}

.company-role-card.management,
.company-role-card.board {
  border-left: 4px solid var(--focus);
}

.company-role-card.auditor,
.company-role-card.administration {
  border-left: 4px solid var(--plum);
}

.company-role-card.insolvency {
  border-left: 4px solid var(--amber);
}

.company-role-card.founder {
  border-left: 4px solid var(--amber);
}

.company-role-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 1px solid rgba(185, 200, 197, 0.7);
  border-radius: 8px;
  background: var(--surface);
}

.company-role-row strong,
.company-role-row span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.company-role-row span,
.company-role-more {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.company-role-more {
  font-weight: 800;
}

.ownership-row {
  display: grid;
  gap: 8px;
}

.ownership-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eceb;
}

.ownership-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--focus));
}

.company-graph-shell {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.company-graph-shell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.company-graph-shell-head span,
.company-graph-shell-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-graph-shell-head strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.company-graph-mode {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.company-graph-mode button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.company-graph-mode button.active {
  background: var(--ink);
  color: #fff;
}

.company-graph {
  min-height: 330px;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfc, #f7faf9);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.company-graph svg {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  display: block;
}

.company-graph-band {
  fill: rgba(255, 255, 255, 0.62);
  stroke: rgba(185, 200, 197, 0.68);
  stroke-width: 1;
}

.company-graph-band-label {
  fill: var(--muted);
  stroke: none;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-anchor: middle;
  text-transform: uppercase;
}

.company-graph-note {
  margin: 12px 12px 0;
  padding: 10px 12px;
  border: 1px solid #d9c99f;
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  background: #fffaf0;
  color: #6b4a13;
  font-size: 12px;
  line-height: 1.45;
}

.company-graph-note.neutral {
  border-color: var(--line);
  border-left-color: var(--focus);
  background: #f7fafb;
  color: var(--muted);
}

.company-graph-note.compact {
  width: max-content;
  max-width: calc(100% - 24px);
  margin-top: 8px;
  padding: 6px 9px;
  border-left-width: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: rgba(10, 42, 79, 0.70);
  font-size: 11.5px;
  font-weight: 750;
}

.company-graph-note button {
  appearance: none;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--focus);
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.company-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px 0;
}

.company-graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.company-graph-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--focus);
}

.company-graph-legend .legend-owner {
  background: var(--plum);
}

.company-graph-legend .legend-company {
  background: var(--green);
}

.company-graph-legend .legend-control {
  background: var(--focus);
}

.company-graph-legend .legend-exited {
  background: #a8a29a;
  background-image: repeating-linear-gradient(90deg, #a8a29a 0 5px, transparent 5px 9px);
}

.company-edge {
  fill: none;
  stroke: #9fb2ae;
  stroke-width: 1.8;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.company-edge.ownership {
  stroke: var(--green);
  stroke-width: 2.2;
}

.company-edge.management,
.company-edge.board {
  stroke: var(--focus);
}

.company-edge.parent {
  stroke: var(--plum);
  stroke-width: 2.2;
}

.company-edge.subsidiary {
  stroke: var(--green);
  stroke-width: 2.2;
}

.company-edge.auditor {
  stroke: var(--plum);
  stroke-dasharray: 5 5;
}

.company-edge.administration,
.company-edge.founder {
  stroke: var(--amber);
  stroke-dasharray: 5 5;
}

.company-edge.production_unit {
  stroke: var(--amber);
  stroke-dasharray: 2 6;
}

.company-edge.exited {
  stroke: #a8a29a;
  stroke-dasharray: 6 5;
  stroke-width: 1.6;
  opacity: 0.78;
}

.company-edge.role {
  stroke-dasharray: 4 4;
}

.company-edge-label {
  fill: #53605c;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.company-node rect {
  fill: #fff;
  stroke: var(--line-strong);
  stroke-width: 1.2;
  filter: drop-shadow(0 5px 10px rgba(21, 34, 31, 0.08));
}

.company-node.openable {
  cursor: pointer;
}

.company-node.openable:hover rect,
.company-node.openable:focus-visible rect {
  stroke: var(--focus);
  stroke-width: 2;
  filter: drop-shadow(0 8px 14px rgba(47, 111, 159, 0.18));
}

.company-node.company rect {
  fill: #edf7f3;
  stroke: #9fc8bb;
}

.company-node.owner rect {
  fill: #eef5fa;
  stroke: #bdd5e8;
}

.company-node.management rect,
.company-node.board rect {
  fill: #eef5fa;
  stroke: #9fc3df;
}

.company-node.auditor rect {
  fill: #f4f0f7;
  stroke: #c9bbd4;
}

.company-node.administration rect,
.company-node.founder rect {
  fill: #fff8e8;
  stroke: #e2c487;
}

.company-node.parent rect {
  fill: #f4f0f7;
  stroke: #b9aac8;
}

.company-node.subsidiary rect {
  fill: #edf7f3;
  stroke: #9fc8bb;
}

.company-node.production_unit rect {
  fill: #fff8e8;
  stroke: #e2c487;
}

.company-node.relation rect {
  fill: #f8faf9;
}

.company-node.exited rect {
  fill: #f7f4ef;
  stroke: #b8aea3;
  stroke-dasharray: 5 4;
  filter: none;
}

.company-node.exited text {
  fill: #6d6259;
}

.company-node text {
  fill: var(--ink);
  stroke: none;
  text-anchor: middle;
}

.company-node .node-title {
  font-size: 11.5px;
  font-weight: 850;
}

.company-node .node-meta {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.company-check {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--focus);
}

.company-check-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.company-check-top small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.company-check em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.company-check.green {
  border-left-color: var(--green);
}

.company-check.yellow {
  border-left-color: var(--amber);
}

.company-check.blue {
  border-left-color: var(--focus);
}

.company-check.red {
  border-left-color: var(--brick);
  background: #fff7f5;
}

.company-relation-workbench {
  margin-bottom: 12px;
}

.company-relation-workbench-shell {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--premium-border, var(--line));
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 249, 0.96)),
    radial-gradient(circle at 10% 8%, rgba(47, 111, 159, 0.08), transparent 30%);
  box-shadow: 0 16px 38px rgba(16, 42, 67, 0.055);
}

.company-relation-workbench-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.company-relation-workbench-head span,
.company-relation-view-grid button span,
.company-relation-workbench-stats span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-relation-workbench-head strong {
  display: block;
  margin-top: 3px;
  color: var(--brand-navy, var(--ink));
  font-size: 16px;
  font-weight: 900;
}

.company-relation-workbench-head small {
  display: block;
  margin-top: 4px;
  color: rgba(8, 38, 77, 0.56);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.company-relation-workbench-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 7px;
  min-width: 250px;
}

.company-relation-workbench-stats article {
  padding: 8px 10px;
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.company-relation-workbench-stats strong {
  display: block;
  margin-top: 3px;
  color: var(--brand-navy, var(--ink));
  font-size: 18px;
  font-weight: 900;
}

.company-relation-view-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.company-relation-view-grid button {
  min-width: 0;
  min-height: 86px;
  padding: 10px 11px;
  border: 1px solid rgba(16, 42, 67, 0.10);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.company-relation-view-grid button.active {
  border-color: rgba(8, 38, 77, 0.22);
  background: #fff;
  box-shadow: 0 13px 28px rgba(16, 42, 67, 0.08);
}

.company-relation-view-grid button strong {
  display: block;
  margin-top: 4px;
  color: var(--brand-navy, var(--ink));
  font-size: 19px;
  font-weight: 900;
}

.company-relation-view-grid button small {
  display: block;
  margin-top: 4px;
  color: rgba(8, 38, 77, 0.56);
  font-size: 11px;
  line-height: 1.32;
}

.company-relation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-color: rgba(16, 42, 67, 0.10);
  background: rgba(255, 255, 255, 0.82);
}

.company-relation-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.company-relation-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.company-relation-title-row small {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(23, 107, 91, 0.08);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 850;
}

.company-relation-main em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.company-relation-main p {
  margin: 3px 0 0;
  color: rgba(8, 38, 77, 0.68);
  font-size: 12px;
  line-height: 1.4;
}

.company-relation-side {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-items: end;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 6px;
  max-width: 260px;
}

.company-relation-item.exited {
  border-left: 4px solid rgba(168, 110, 18, 0.62);
  background: rgba(255, 250, 240, 0.74);
}

.company-relation-item.exited .company-relation-title-row small {
  background: rgba(168, 110, 18, 0.10);
  color: #6b4a13;
}

.company-relation-item small {
  color: var(--muted);
  white-space: nowrap;
}

.company-exit-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.company-exit-stat {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.company-exit-stat span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-exit-stat strong {
  font-size: 21px;
}

.company-exit-list {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.company-exit-item {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  background: #fffdf8;
}

.company-exit-item.person {
  border-left-color: var(--focus);
}

.company-exit-item.company {
  border-left-color: var(--plum);
}

.company-exit-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.company-exit-top strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.company-exit-top time {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(168, 110, 18, 0.26);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  color: #6b4a13;
  font-size: 11px;
  font-weight: 850;
}

.company-exit-type {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-exit-meta,
.company-exit-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.company-exit-meta span,
.company-exit-periods span {
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.company-exit-periods {
  padding-top: 2px;
}

.company-timeline {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.company-role-change-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--premium-border, var(--line));
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 249, 0.96)),
    radial-gradient(circle at 12% 10%, rgba(23, 107, 91, 0.08), transparent 30%);
  box-shadow: 0 18px 44px rgba(16, 42, 67, 0.06);
}

.company-role-change-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.company-role-change-head span,
.company-raw-timeline-head span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-role-change-head strong,
.company-raw-timeline-head strong {
  display: block;
  margin-top: 3px;
  color: var(--brand-navy, var(--ink));
  font-size: 16px;
  font-weight: 900;
}

.company-role-change-head small {
  display: block;
  margin-top: 4px;
  color: rgba(8, 38, 77, 0.55);
  font-size: 12px;
  font-weight: 650;
}

.company-role-change-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.company-role-change-pills button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid rgba(16, 42, 67, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.company-role-change-pills button.active {
  border-color: rgba(8, 38, 77, 0.22);
  background: var(--brand-navy, var(--ink));
  color: #fff;
  box-shadow: 0 10px 22px rgba(8, 38, 77, 0.14);
}

.company-role-change-pills button strong {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(8, 38, 77, 0.08);
  color: inherit;
  font-size: 11px;
}

.company-role-change-pills button.active strong {
  background: rgba(255, 255, 255, 0.18);
}

.company-role-change-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.company-role-change-grid article {
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
}

.company-role-change-grid span {
  display: block;
  color: rgba(8, 38, 77, 0.58);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-role-change-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--brand-navy, var(--ink));
  font-size: 21px;
  font-weight: 900;
}

.company-role-change-list {
  display: grid;
  gap: 8px;
}

.company-role-change-event {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 42, 67, 0.10);
  border-left: 4px solid var(--relation-accent, var(--brand-green, var(--green)));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.80);
}

.company-role-change-event.exit {
  border-left-color: #8e6f53;
  background: rgba(250, 248, 244, 0.88);
}

.company-role-change-event.status {
  border-left-color: var(--amber);
  background: rgba(255, 250, 240, 0.88);
}

.company-role-change-event time {
  color: rgba(8, 38, 77, 0.62);
  font-size: 12px;
  font-weight: 850;
}

.company-role-change-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.company-role-change-main strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.company-role-change-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.company-role-change-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.company-role-change-side small {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.company-raw-timeline {
  display: grid;
  gap: 8px;
}

.company-raw-timeline-head {
  padding: 6px 2px 2px;
}

.company-timeline-digest {
  display: grid;
  gap: 10px;
  margin-bottom: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.company-timeline-digest-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.company-timeline-digest-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-timeline-digest-head strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.company-timeline-digest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.company-timeline-signal {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
}

.company-timeline-signal.insolvency {
  border-left-color: var(--amber);
}

.company-timeline-signal span,
.company-timeline-signal small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.company-timeline-signal span {
  margin-bottom: 3px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-timeline-signal strong {
  display: block;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.company-timeline-item,
.company-evidence-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.company-timeline-item.ownership,
.company-timeline-item.ownership_exit {
  border-left: 4px solid var(--green);
}

.company-timeline-item.insolvency,
.company-timeline-item.insolvency_exit {
  border-left: 4px solid var(--amber);
}

.company-timeline-item time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-timeline-item strong,
.company-evidence-item strong {
  display: block;
  margin-bottom: 3px;
}

.company-timeline-item span,
.company-evidence-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.company-evidence-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.company-evidence-disclosure {
  border: 1px solid var(--premium-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.company-evidence-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
}

.company-evidence-disclosure summary::-webkit-details-marker {
  display: none;
}

.company-evidence-disclosure summary strong {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}

.company-evidence-disclosure-body {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--premium-border);
  background: rgba(247, 250, 249, 0.58);
}

.company-evidence-item a,
.company-evidence-item small {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.company-evidence-item.compliance {
  border-left: 4px solid var(--amber);
  background: #fffaf0;
}

.company-report-preview {
  min-height: 520px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: #27302d;
  white-space: pre-wrap;
  overflow: auto;
  font-family: Consolas, "Segoe UI Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
}

.deadline-timeline,
.deadline-warning-list {
  display: grid;
  gap: 8px;
}

.deadline-event {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.deadline-event-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--focus);
}

.deadline-event.done .deadline-event-dot {
  background: var(--green);
}

.deadline-event.due .deadline-event-dot {
  background: var(--amber);
}

.deadline-event.missed .deadline-event-dot {
  background: var(--brick);
}

.deadline-event span,
.deadline-event small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.deadline-warning {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  border-radius: 8px;
  background: var(--surface);
}

.deadline-warning.green {
  border-left-color: var(--green);
}

.deadline-warning.yellow {
  border-left-color: var(--amber);
}

.deadline-warning.blue {
  border-left-color: var(--focus);
}

.deadline-warning.red {
  border-left-color: var(--brick);
}

.deadline-warning span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.print-notes-summary {
  padding: 0 0 18px;
}

.print-notes-summary h2 {
  margin: 0 0 10px;
  color: black;
  font-size: 15pt;
}

.print-note-item {
  break-inside: avoid;
  margin: 0 0 10px;
  padding: 9px 10px;
  border-left: 4px solid var(--note-color, var(--focus));
  background: #f7f7f4;
}

.print-note-item strong {
  display: block;
  color: #111;
  font-size: 10pt;
}

.print-note-item blockquote {
  margin: 6px 0;
  color: #222;
  font-size: 9.5pt;
  line-height: 1.45;
}

.print-note-item p {
  margin: 6px 0 0;
  color: #333;
  font-size: 9pt;
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .filters-pane,
  .results-pane,
  .side-workbench,
  .reader-collapsed,
  .doc-actions,
  .print-panel,
  .reader-settings-panel,
  .selection-toolbar {
    display: none !important;
  }

  .app-shell,
  .reader-pane,
  .reader-content,
  .workspace-split,
  .doc-text-panel {
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: white !important;
    box-shadow: none !important;
    border: 0 !important;
  }

  .reader-pane,
  .reader-content {
    padding: 0 !important;
  }

  .doc-header,
  .meta-grid,
  .doc-text-panel {
    padding: 0 0 14px !important;
    border: 0 !important;
  }

  .doc-header h1 {
    color: black;
    font-size: 18pt;
  }

  .doc-kicker,
  .meta-item span,
  .meta-item strong {
    color: #333 !important;
  }

  #docText {
    white-space: pre-wrap;
    color: black;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  .note-mark {
    background: #f4f0c8 !important;
    border-bottom: 1px solid #8a6400 !important;
  }

  html[data-print-mode="with-notes"] .print-notes-summary,
  html[data-print-mode="passages"] .print-notes-summary {
    display: block !important;
  }

  html[data-print-mode="passages"] .source-identity-banner,
  html[data-print-mode="passages"] .doc-outline,
  html[data-print-mode="passages"] #docText {
    display: none !important;
  }
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 280px minmax(360px, 1fr);
    grid-template-rows: 74px minmax(0, 46vh) minmax(0, 1fr);
  }

  .app-shell.reader-empty-state {
    grid-template-columns: 280px minmax(360px, 1fr);
    grid-template-rows: 74px minmax(0, 1fr);
  }

  .app-shell.filters-collapsed,
  .app-shell.reader-empty-state.filters-collapsed {
    grid-template-columns: 62px minmax(360px, 1fr);
  }

  .workspace-resizer {
    display: none;
  }

  .filters-pane {
    grid-column: 1;
    grid-row: 2;
  }

  .results-pane {
    grid-column: 2;
    grid-row: 2;
  }

  .reader-pane {
    grid-column: 1 / -1;
    grid-row: 3;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }

  .app-shell.reader-empty-state {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .app-shell.filters-collapsed,
  .app-shell.reader-empty-state.filters-collapsed,
  .app-shell.reader-wide.filters-collapsed,
  .app-shell.reader-focus.filters-collapsed,
  .app-shell.reader-minimized.filters-collapsed {
    grid-template-columns: 1fr;
  }

  .topbar,
  .searchbar,
  .workspace-split,
  .meta-grid,
  .legal-compass-card,
  .legal-compass-metrics,
  .profiles-layout,
  .admin-layout,
  .admin-grid,
  .admin-dashboard,
  .admin-dashboard-metrics,
  .admin-quality-head,
  .admin-quality-summary,
  .admin-quality-metrics,
  .admin-quality-queues,
  .admin-audit-controls,
  .profile-grid,
  .profile-workspace,
  .deadlines-layout,
  .deadline-workspace,
  .deadline-quick-workspace,
  .cases-layout,
  .case-workspace,
  .case-room-hero,
  .case-overview-list,
  .case-summary-grid,
  .templates-layout,
  .templates-workspace,
  .template-stats-grid,
  .template-dashboard-toolbar,
  .template-dashboard-metrics,
  .template-workflow-steps,
  .template-classification-grid,
  .template-edit-grid,
  .companies-layout,
  .company-workspace,
  .company-detail-grid,
  .deadline-form-grid,
  .knowledge-grid {
    grid-template-columns: 1fr;
  }

  .issue-insight {
    grid-template-columns: 1fr;
  }

  .case-analysis-head,
  .case-issue-row {
    grid-template-columns: 1fr;
  }

  .profile-workspace[data-profile-mode="notat"],
  .profile-workspace[data-profile-mode="sources"],
  .profile-workspace[data-profile-mode="contributions"],
  .profile-workspace[data-profile-mode="report"],
  .profile-report-summary,
  .annotation-manager-summary {
    grid-template-columns: 1fr;
  }

  .case-analysis-meta {
    justify-content: flex-start;
  }

  .issue-card header {
    display: grid;
  }

  .issue-card header small {
    max-width: none;
    text-align: left;
  }

  .issue-card-actions {
    justify-items: start;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .top-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
    width: auto;
  }

  .user-pill {
    max-width: 172px;
  }

  .top-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
    overflow: hidden;
  }

  .top-tab {
    min-width: 0;
    min-height: 48px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 3px;
    padding: 7px 4px;
    text-align: center;
  }

  .top-tab svg {
    width: 18px;
    height: 18px;
  }

  .top-tab-copy strong {
    font-size: 11.5px;
  }

  .top-tab-copy small {
    display: none;
  }

  .status-pill {
    display: none;
  }

  .filters-pane,
  .results-pane,
  .reader-pane,
  .profiles-view,
  .profiles-layout,
  .admin-view,
  .admin-layout,
  .deadlines-view,
  .deadlines-layout,
  .cases-view,
  .cases-layout,
  .templates-view,
  .templates-layout,
  .companies-view,
  .companies-layout {
    overflow: visible;
  }

  .cases-sidebar {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .case-main {
    order: 1;
  }

  .case-room-content,
  .case-room-panels {
    overflow: visible;
  }

  .case-room-hero .case-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-room-hero,
  .case-room-panels {
    padding-left: 12px;
    padding-right: 12px;
  }

  .case-link-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .case-link-panel .mini-heading,
  .case-link-panel small {
    grid-column: 1 / -1;
  }

  .case-link-panel small {
    display: none;
  }

  .case-link-panel .field {
    margin: 0;
  }

  .case-room-panel {
    max-width: none;
  }

  .admin-main,
  .admin-grid {
    overflow: visible;
  }

  .filters-pane,
  .results-pane,
  .reader-pane {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .results-pane {
    order: 1;
  }

  .filters-pane {
    order: 2;
  }

  .app-shell.filters-collapsed .filters-pane {
    padding: 10px 12px;
  }

  .app-shell.filters-collapsed .filter-pane-heading {
    justify-content: space-between;
  }

  .app-shell.filters-collapsed .filter-heading-copy > div {
    display: grid;
  }

  .reader-pane {
    order: 3;
  }

  .templates-main {
    grid-column: 1;
    grid-row: 1;
    order: 1;
  }

  .templates-sidebar {
    grid-column: 1;
    grid-row: 2;
    order: 2;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .templates-layout.templates-sidebar-collapsed .templates-sidebar {
    display: none;
  }

  .templates-main,
  .template-results-panel,
  .template-detail-panel {
    overflow: visible;
  }

  .templates-header {
    flex-wrap: wrap;
  }

  .templates-workspace {
    min-height: 0;
  }

  .templates-view .template-results-panel {
    max-height: 48vh;
    overflow-y: auto;
  }

  .template-search-row,
  .template-search-tools,
  .template-filter-grid {
    grid-template-columns: 1fr;
  }

  .template-search-row .template-actions-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .template-use-strip,
  .template-preview-guidance {
    grid-template-columns: 1fr;
  }

  .template-primary-actions,
  .template-preview-guidance .template-detail-actions {
    justify-content: flex-start;
  }

  .template-document-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .template-document-toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .template-source-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .companies-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .company-main {
    overflow: visible;
  }

  .company-header {
    flex-wrap: wrap;
  }

  .company-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .company-workspace {
    padding: 12px;
    overflow: visible;
  }

  .company-panel {
    padding: 14px;
    border-radius: 10px;
  }

  .company-quality {
    grid-template-columns: 1fr;
  }

  .company-status-panel {
    grid-template-columns: 1fr;
  }

  .company-exit-summary {
    grid-template-columns: 1fr;
  }

  .company-accounts-head,
  .company-accounts-empty {
    align-items: flex-start;
    flex-direction: column;
  }

  .company-group-grid,
  .company-report-item {
    grid-template-columns: 1fr;
  }

  .company-report-actions {
    justify-content: flex-start;
  }

  .company-graph-shell-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .company-graph-summary,
  .company-expanded-network .company-network-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-graph {
    min-height: 280px;
  }

  .reader-content {
    height: auto;
  }

  .app-shell.reader-wide,
  .app-shell.reader-focus,
  .app-shell.reader-minimized {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.reader-minimized .reader-pane {
    width: auto;
    min-width: 0;
  }

  .workspace-split {
    min-height: 0;
  }

  .doc-text-panel {
    max-height: 70vh;
  }

  .doc-text-panel pre,
  .reader-density-comfort .doc-text-panel pre,
  .reader-density-compact .doc-text-panel pre {
    width: 100%;
    padding: 24px 22px 38px;
  }

  .reader-context-strip {
    grid-template-columns: 1fr;
  }

  .research-command {
    gap: 8px;
    padding: 12px;
  }

  .research-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .research-overview-card {
    padding: 7px 9px;
  }

  .research-overview-card span {
    font-size: 10px;
  }

  .research-overview-card strong {
    font-size: 12.5px;
  }

  .results-toolbar,
  .pager {
    padding: 8px 12px;
  }

  .result-list {
    padding: 10px;
  }

  .result-row {
    padding: 13px 14px;
  }

  .reader-context-facts {
    justify-content: flex-start;
  }

  .reader-content.doc-header-collapsed .doc-header {
    grid-template-columns: 1fr;
  }

  .reader-content.doc-header-collapsed .doc-header > div:first-child {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .reader-content.doc-header-collapsed .doc-kicker {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .source-identity-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-identity-facts {
    min-width: 0;
    justify-content: flex-start;
  }

  .side-workbench {
    order: 1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* Final safety guard: hidden overlays must never block interaction after responsive/theme overrides. */
#selectionToolbar.hidden,
#commandPalette.hidden,
.reader-find-panel.hidden,
.reader-settings-panel.hidden,
.print-panel.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 480px) {
  .top-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .top-tab {
    flex: 0 0 132px;
    grid-template-columns: 24px minmax(0, 1fr);
    justify-items: start;
    text-align: left;
    scroll-snap-align: start;
  }
}

/* Premium cohesion layer: keeps existing functionality, but removes visual noise. */
:root {
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --ease-premium: cubic-bezier(0.2, 0.8, 0.2, 1);
  --brand-navy: #08264d;
  --brand-green: #176b5b;
  --premium-border: rgba(16, 42, 67, 0.12);
  --premium-shadow: 0 14px 42px rgba(16, 42, 67, 0.08);
}

button,
a,
input,
select,
textarea,
.result-row,
.company-result-item,
.company-panel,
.company-inline-action,
.company-tab,
.top-tab {
  transition:
    background-color 170ms var(--ease-premium),
    border-color 170ms var(--ease-premium),
    box-shadow 170ms var(--ease-premium),
    color 170ms var(--ease-premium),
    opacity 170ms var(--ease-premium),
    transform 170ms var(--ease-premium);
}

.top-tabs {
  gap: 4px;
  padding: 3px;
  border-color: var(--premium-border);
  background: rgba(248, 250, 249, 0.74);
  box-shadow: none;
}

.top-tab {
  min-height: 44px;
  border-radius: var(--radius-md);
  color: #54615d;
}

.top-tab:hover {
  background: rgba(255, 255, 255, 0.74);
  color: var(--brand-navy);
}

.top-tab.active {
  border-color: rgba(8, 38, 77, 0.18);
  background: #fff;
  color: var(--brand-navy);
  box-shadow: 0 7px 20px rgba(16, 42, 67, 0.08);
  transform: none;
}

.top-tab.active::after {
  left: 11px;
  right: 11px;
  bottom: 4px;
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-green));
}

.top-tab.active .top-tab-copy small {
  color: rgba(8, 38, 77, 0.62);
}

.primary-button,
.quiet-button,
.icon-button,
.company-inline-action,
.company-tab,
.company-graph-mode,
.company-graph-mode button {
  border-radius: var(--radius-md);
}

.primary-button {
  border-color: #0f6b5b;
  background: #0f6b5b;
  box-shadow: none;
}

.primary-button:hover,
.quiet-button:hover,
.icon-button:hover,
.company-inline-action:hover,
.company-inline-action:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(16, 42, 67, 0.11);
}

.quiet-button,
.icon-button,
.company-inline-action {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.78);
}

.chip,
.label-chip,
.muted-chip,
.active-filter-chip,
.query-token-chip,
.favorite-filter-chip,
.source-pill,
.relation-pill,
.deadline-status,
.template-status-pill,
.template-preview-status,
.company-result-status,
.company-lifecycle-pill {
  border-color: var(--premium-border);
  border-radius: 999px;
  box-shadow: none;
}

.active-filter-bar {
  background: transparent;
}

.active-filter-chip,
.query-token-chip,
.favorite-filter-chip {
  background: rgba(255, 255, 255, 0.72);
}

.admin-quality,
.admin-dashboard,
.admin-operations,
.admin-panel {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
}

.admin-quality-summary {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.82);
}

.admin-quality-details:not([open]) .admin-quality-summary {
  opacity: 0.78;
}

.admin-quality-head,
.admin-quality-metric,
.admin-quality-item,
.admin-health-card,
.admin-warning {
  border-color: var(--premium-border);
  background: #fff;
  box-shadow: none;
}

.companies-layout,
.company-main {
  background:
    linear-gradient(180deg, rgba(8, 38, 77, 0.035), rgba(247, 249, 251, 0) 260px),
    var(--surface-tint);
}

.companies-sidebar {
  border-right: 1px solid var(--premium-border);
  background: rgba(248, 250, 249, 0.88);
}

.company-support-box,
.company-source-box {
  padding: 10px 11px;
  border: 1px solid var(--premium-border);
  border-left: 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: none;
}

.company-support-box strong,
.company-source-box strong {
  color: var(--brand-navy);
  font-size: 12px;
}

.company-support-box span,
.company-source-box span,
.company-source-box small {
  color: var(--muted);
  font-size: 12px;
}

.company-header {
  border-bottom-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.92);
}

.company-header h1 {
  color: var(--brand-navy);
  font-size: 28px;
  line-height: 1.08;
}

.company-tabs {
  margin: 0;
  padding: 8px 18px;
  border-top: 0;
  border-bottom-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: none;
}

.company-tab {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: #65716d;
}

.company-tab:hover {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.76);
  color: var(--brand-navy);
}

.company-tab.active {
  border-color: var(--brand-navy);
  background: var(--brand-navy);
  color: #fff;
  box-shadow: none;
}

.company-workspace {
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(8, 38, 77, 0.026), rgba(247, 249, 251, 0) 260px),
    var(--surface-tint);
}

.company-panel {
  border-color: var(--premium-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: none;
}

.company-overview-panel {
  background: #fff;
}

.company-empty {
  border: 1px solid var(--premium-border);
  border-left: 0;
  background:
    radial-gradient(circle at 50% 10%, rgba(23, 107, 91, 0.08), transparent 32%),
    #fff;
}

.company-lookup-banner,
.company-status-panel,
.company-summary-card,
.company-insight-card,
.company-metric,
.company-detail,
.company-check,
.company-relation-item,
.ownership-row,
.company-report-item,
.company-group-structure,
.company-network-expand,
.company-role-ledger,
.company-graph-shell,
.company-exit-item,
.company-timeline-item,
.company-evidence-item {
  border-color: var(--premium-border);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.company-status-panel {
  border-left-width: 0;
  background: #fff;
}

.company-status-panel.green,
.company-status-panel.yellow,
.company-status-panel.red,
.company-status-panel.blue {
  background: #fff;
}

.company-status-eyebrow,
.company-quality-checks-title,
.company-group-node span,
.company-group-header span,
.company-group-header small,
.company-role-ledger-head span,
.company-role-ledger-head small,
.company-graph-shell-head span,
.company-graph-shell-head small,
.company-network-expand-head span,
.company-network-controls > label,
.company-network-node span,
.company-network-edge span {
  text-transform: none;
  letter-spacing: 0;
}

.company-quality {
  opacity: 0.9;
}

.company-quality-score,
.company-quality-checks {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.76);
}

.company-quality-check {
  opacity: 0.78;
}

.company-quality-check.ok,
.company-quality-check.missing {
  color: var(--muted);
}

.company-summary-card,
.company-insight-card {
  border-left-width: 0;
}

.company-group-structure,
.company-network-expand,
.company-role-ledger,
.company-graph-shell {
  background: rgba(255, 255, 255, 0.78);
}

.company-group-node,
.company-group-empty,
.company-role-card,
.company-role-row,
.company-network-node,
.company-network-edge {
  border-color: var(--premium-border);
  box-shadow: none;
}

.company-graph-shell {
  padding: 14px;
}

.company-graph-shell-head {
  align-items: center;
}

.company-graph-shell-head small {
  display: block;
  margin-top: 3px;
  color: rgba(8, 38, 77, 0.52);
  font-size: 12px;
  font-weight: 650;
  text-transform: none;
}

.company-graph-mode {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 22px rgba(16, 42, 67, 0.06);
}

.company-graph-mode button {
  min-width: 96px;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.company-graph-mode button.active {
  background: var(--brand-navy);
  box-shadow: 0 8px 16px rgba(8, 38, 77, 0.15);
}

.company-graph-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.company-graph-summary-card {
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(16, 42, 67, 0.045);
}

.company-graph-summary-card span {
  display: block;
  color: rgba(8, 38, 77, 0.58);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-graph-summary-card strong {
  display: block;
  margin-top: 4px;
  color: var(--brand-navy);
  font-size: 17px;
  font-weight: 900;
}

.company-graph-summary-card small {
  display: block;
  margin-top: 3px;
  color: rgba(8, 38, 77, 0.55);
  font-size: 11px;
  font-weight: 650;
}

.company-graph {
  min-height: 380px;
  border-color: var(--premium-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 38%, rgba(23, 107, 91, 0.055), transparent 30%),
    linear-gradient(180deg, #ffffff, #f8faf9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.company-graph-band {
  fill: rgba(255, 255, 255, 0.52);
  stroke: rgba(16, 42, 67, 0.08);
}

.company-graph-band-label {
  fill: rgba(8, 38, 77, 0.58);
  font-size: 10px;
  font-weight: 800;
  text-transform: none;
}

.company-graph-legend {
  opacity: 0.78;
}

.company-graph-legend span {
  border-color: rgba(16, 42, 67, 0.08);
  background: rgba(255, 255, 255, 0.66);
}

.company-graph-note {
  border-color: rgba(168, 110, 18, 0.22);
  border-left: 0;
  background: rgba(255, 250, 240, 0.76);
}

.company-graph-note.neutral {
  border-color: rgba(16, 42, 67, 0.10);
  background: rgba(255, 255, 255, 0.74);
}

.company-edge {
  opacity: 0.84;
}

.company-edge.family-ownership,
.company-edge.family-group {
  stroke: var(--brand-green);
  stroke-width: 2.35;
}

.company-edge.family-governance,
.company-edge.family-insolvency {
  stroke: var(--brand-blue);
}

.company-edge.family-assurance {
  stroke: #78608c;
  stroke-dasharray: 5 5;
}

.company-edge.exited {
  opacity: 0.34;
}

.company-graph.is-history .company-edge.exited {
  opacity: 0.54;
}

.company-graph.is-dense .company-edge {
  opacity: 0.72;
}

.company-edge-label {
  opacity: 0.74;
}

.company-graph.is-dense .company-edge-label {
  font-size: 8.8px;
  opacity: 0.58;
}

.company-node rect {
  filter: drop-shadow(0 9px 18px rgba(16, 42, 67, 0.10));
}

.company-node.openable:hover rect,
.company-node.openable:focus-visible rect {
  filter: drop-shadow(0 14px 24px rgba(16, 42, 67, 0.16));
}

.company-node.family-ownership rect,
.company-node.family-group rect {
  fill: #edf7f3;
  stroke: rgba(23, 107, 91, 0.34);
}

.company-node.family-governance rect,
.company-node.family-insolvency rect {
  fill: #eef5fa;
  stroke: rgba(47, 111, 159, 0.30);
}

.company-node.family-assurance rect {
  fill: #f4f0f7;
  stroke: rgba(120, 96, 140, 0.30);
}

.company-network-controls {
  padding-top: 2px;
}

.company-network-type-grid label {
  border-color: var(--premium-border);
  background: rgba(255, 255, 255, 0.72);
}

.company-network-status {
  border-color: var(--premium-border);
  border-left-width: 0;
  background: rgba(255, 255, 255, 0.72);
}

.company-expanded-network .company-network-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.company-filter-row {
  padding: 8px;
  border: 1px solid var(--premium-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
}

.company-truth-strip {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(170px, 0.8fr) minmax(260px, 1.4fr);
  gap: 9px;
  margin-bottom: 12px;
}

.company-truth-card {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--premium-border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 249, 0.78));
}

.company-truth-card.primary {
  border-color: rgba(8, 38, 77, 0.18);
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 111, 159, 0.11), transparent 34%),
    #fff;
}

.company-truth-card span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 820;
}

.company-truth-card strong {
  color: var(--brand-navy);
  font-size: 17px;
  line-height: 1.15;
}

.company-truth-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.company-profile-brief {
  margin-bottom: 12px;
}

.company-profile-brief:empty {
  display: none;
}

.company-brief-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(420px, 1.12fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(8, 38, 77, 0.14);
  border-radius: 12px;
  background:
    radial-gradient(circle at 14% 4%, rgba(47, 111, 159, 0.14), transparent 34%),
    linear-gradient(135deg, #ffffff, #f4f8fb 58%, #eef5fa);
  box-shadow: 0 16px 44px rgba(16, 42, 67, 0.08);
}

.company-brief-shell.red,
.company-brief-shell.yellow {
  background:
    radial-gradient(circle at 12% 0%, rgba(168, 110, 18, 0.13), transparent 34%),
    linear-gradient(135deg, #ffffff, #f8fafb 56%, #fff8ea);
}

.company-brief-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 8px;
}

.company-brief-main > span,
.company-brief-card > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
}

.company-brief-main > strong {
  color: var(--brand-navy);
  font-size: 27px;
  line-height: 1.05;
  letter-spacing: 0;
}

.company-brief-main p {
  max-width: 58ch;
  margin: 0;
  color: #33413e;
  font-size: 13.5px;
  line-height: 1.48;
}

.company-brief-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.company-brief-facts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid rgba(16, 42, 67, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.70);
  color: #34423f;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.25;
}

.company-brief-facts b {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-brief-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.company-brief-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.company-brief-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(16, 42, 67, 0.10);
  border-left: 3px solid color-mix(in srgb, var(--relation-accent, #2f6f9f) 74%, transparent);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
}

.company-brief-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--brand-navy);
  font-size: 15px;
  line-height: 1.24;
}

.company-brief-card small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.36;
}

.company-status-panel-compact {
  display: block;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  border-left-width: 0;
  background: transparent;
}

.company-status-disclosure,
.company-quality-disclosure {
  border: 1px solid var(--premium-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.company-status-disclosure summary,
.company-quality-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  cursor: pointer;
}

.company-status-disclosure summary span,
.company-quality-disclosure summary span,
.company-quality-disclosure summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-status-disclosure summary strong,
.company-quality-disclosure summary strong {
  min-width: 0;
  color: var(--brand-navy);
  font-size: 13px;
  text-align: right;
}

.company-status-panel-compact .company-status-body {
  padding: 0 12px 12px;
}

.company-quality {
  display: block;
  margin-bottom: 12px;
  opacity: 1;
}

.company-source-disclosure {
  margin-top: 2px;
}

.company-source-disclosure summary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 249, 0.68));
}

.company-source-disclosure-body {
  display: grid;
  gap: 11px;
  padding: 12px;
  border-top: 1px solid var(--premium-border);
}

.company-source-note {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-left: 3px solid var(--focus);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.company-source-note strong {
  color: var(--brand-navy);
  font-size: 13px;
}

.company-source-note span,
.company-source-note small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.38;
}

.company-source-fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 8px;
}

.company-source-fact {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid rgba(16, 42, 67, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.70);
}

.company-source-fact span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-source-fact strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1d2c2a;
  font-size: 12.5px;
  line-height: 1.34;
}

.company-quality-disclosure .company-quality-checks {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.company-metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.company-metric {
  background: rgba(255, 255, 255, 0.78);
}

.company-truth-strip:empty,
.company-summary-grid:empty,
.company-metrics:empty,
.company-detail-grid:empty {
  display: none;
}

.company-family-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.company-family-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(16, 42, 67, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.relation-family-ownership,
.company-family-pill.relation-family-ownership {
  --relation-accent: #176b5b;
}

.relation-family-group,
.company-family-pill.relation-family-group {
  --relation-accent: #08264d;
}

.relation-family-governance,
.company-family-pill.relation-family-governance {
  --relation-accent: #2f6f9f;
}

.relation-family-assurance,
.company-family-pill.relation-family-assurance {
  --relation-accent: #54615d;
}

.relation-family-administration,
.company-family-pill.relation-family-administration {
  --relation-accent: #5d7184;
}

.relation-family-insolvency,
.company-family-pill.relation-family-insolvency {
  --relation-accent: #a86e12;
}

.relation-family-formation,
.company-family-pill.relation-family-formation {
  --relation-accent: #59446f;
}

.relation-family-unit,
.company-family-pill.relation-family-unit {
  --relation-accent: #6aa8c8;
}

.company-family-pill[class*="relation-family-"] {
  border-color: color-mix(in srgb, var(--relation-accent, #65716d) 28%, rgba(16, 42, 67, 0.10));
  background: color-mix(in srgb, var(--relation-accent, #65716d) 8%, white);
  color: color-mix(in srgb, var(--relation-accent, #65716d) 82%, #1d2422);
}

.company-relation-item[class*="relation-family-"] {
  border-left: 3px solid color-mix(in srgb, var(--relation-accent, #65716d) 72%, transparent);
}

.company-edge.insolvency,
.company-edge.curator,
.company-edge.reconstructor,
.company-edge.liquidator {
  stroke: #a86e12;
  stroke-width: 2.2;
}

.company-node.insolvency rect,
.company-node.curator rect,
.company-node.reconstructor rect,
.company-node.liquidator rect {
  fill: #fff7e8;
  stroke: rgba(168, 110, 18, 0.42);
}

@media (max-width: 920px) {
  .company-brief-shell {
    grid-template-columns: 1fr;
  }

  .company-brief-grid {
    grid-template-columns: 1fr;
  }

  .company-truth-strip {
    grid-template-columns: 1fr;
  }

  .company-graph-shell-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .company-graph-mode {
    width: 100%;
  }

  .company-graph-mode button {
    flex: 1 1 0;
  }

  .company-graph-summary,
  .company-expanded-network .company-network-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-role-change-head,
  .company-role-change-main {
    grid-template-columns: 1fr;
  }

  .company-role-change-pills,
  .company-role-change-side {
    justify-content: flex-start;
  }

  .company-role-change-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-relation-workbench-head,
  .company-relation-item {
    grid-template-columns: 1fr;
  }

  .company-relation-workbench-stats {
    min-width: 0;
  }

  .company-relation-view-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-relation-side {
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .company-graph-summary,
  .company-expanded-network .company-network-summary,
  .company-role-change-grid,
  .company-relation-workbench-stats,
  .company-relation-view-grid {
    grid-template-columns: 1fr;
  }

  .company-role-change-event {
    grid-template-columns: 1fr;
  }
}

/* Fase 8: Water Authority Legal UI design system. */
:root {
  --water-deep: #061a33;
  --water-navy: #0a2a4f;
  --water-royal: #0f4c9a;
  --water-blue: #1e88e5;
  --water-aqua: #4fc3f7;
  --water-ice: #f5faff;
  --water-foam: #ffffff;
  --water-mist: #eaf5fb;
  --water-teal: #0f766e;
  --water-amber: #b9871d;
  --ink: #0b1f38;
  --muted: #5c7188;
  --bg: #f3f8fc;
  --surface: #ffffff;
  --surface-tint: #f7fbff;
  --surface-soft: #eef7fb;
  --line: rgba(10, 42, 79, 0.12);
  --line-strong: rgba(10, 42, 79, 0.22);
  --green: var(--water-teal);
  --green-dark: #075e63;
  --focus: var(--water-royal);
  --brand-navy: var(--water-navy);
  --brand-green: var(--water-teal);
  --premium-border: rgba(10, 42, 79, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-soft: 0 10px 28px rgba(6, 26, 51, 0.07);
  --shadow: 0 22px 70px rgba(6, 26, 51, 0.13);
  --premium-shadow: 0 18px 54px rgba(6, 26, 51, 0.10);
  --water-glass: rgba(255, 255, 255, 0.78);
  --water-glass-strong: rgba(255, 255, 255, 0.90);
  --water-focus-ring: 0 0 0 3px rgba(79, 195, 247, 0.24);
  --water-gradient: linear-gradient(135deg, var(--water-navy), var(--water-royal) 58%, #1479c9);
  --water-sheen: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 250, 255, 0.72));
}

body {
  background:
    repeating-radial-gradient(ellipse at 74% -8%, rgba(79, 195, 247, 0.11) 0 1px, transparent 1px 42px),
    linear-gradient(135deg, rgba(245, 250, 255, 0.98), rgba(232, 244, 252, 0.88) 48%, rgba(247, 251, 255, 0.98));
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.45), transparent 28%, rgba(79, 195, 247, 0.08) 54%, transparent 78%),
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 22px);
  opacity: 0.58;
}

.app-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 160px),
    transparent;
}

.auth-gate {
  background:
    repeating-radial-gradient(ellipse at 70% 12%, rgba(79, 195, 247, 0.15) 0 1px, transparent 1px 54px),
    linear-gradient(135deg, #f8fcff, #eaf5fb 52%, #ffffff);
}

.auth-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(10, 42, 79, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 90px rgba(6, 26, 51, 0.16);
  backdrop-filter: blur(18px);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(79, 195, 247, 0.13), transparent 34%),
    repeating-radial-gradient(ellipse at 86% 12%, rgba(30, 136, 229, 0.08) 0 1px, transparent 1px 34px);
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.topbar {
  position: relative;
  z-index: 20;
  grid-template-columns: minmax(238px, 0.58fr) minmax(760px, 1.75fr) minmax(208px, 0.50fr);
  min-height: 78px;
  padding: 10px 20px 10px 18px;
  border-bottom: 1px solid rgba(10, 42, 79, 0.10);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(245, 250, 255, 0.76)),
    rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 34px rgba(6, 26, 51, 0.07);
  backdrop-filter: blur(18px) saturate(1.15);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 195, 247, 0.55), rgba(15, 76, 154, 0.26), transparent);
}

.brand {
  gap: 13px;
  min-width: 262px;
}

.brand-mark-logo {
  width: 72px;
  height: 56px;
  flex: 0 0 72px;
  display: grid;
  place-items: center;
  margin-left: -2px;
}

.auth-card .brand-mark-logo {
  width: 112px;
  height: 88px;
  flex-basis: 112px;
  margin-left: -4px;
}

.brand-mark-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 10px 22px rgba(6, 26, 51, 0.16));
}

.brand-name {
  color: var(--water-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  letter-spacing: 0;
}

.auth-card .brand-name {
  font-size: 25px;
}

.brand-meta {
  color: rgba(10, 42, 79, 0.62);
}

.brand-tagline {
  position: relative;
  display: inline-block;
  width: max-content;
  max-width: 100%;
  padding-bottom: 7px;
  color: var(--water-royal);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.012em;
  text-transform: none;
}

.brand-tagline::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(8, 38, 77, 0.08), rgba(24, 135, 214, 0.74), rgba(23, 107, 91, 0.48), rgba(8, 38, 77, 0.04));
}

.brand-mode-label {
  margin-top: 2px;
  color: rgba(10, 42, 79, 0.50);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-tabs {
  width: min(100%, 812px);
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.80), rgba(245, 250, 255, 0.58));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 12px 30px rgba(6, 26, 51, 0.06);
  overflow: visible;
}

.top-tab {
  min-height: 48px;
  flex: 1 1 124px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  color: rgba(10, 42, 79, 0.68);
  overflow: hidden;
}

.top-tab::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.12), rgba(255, 255, 255, 0.72));
  opacity: 0;
  transition: opacity 170ms var(--ease-premium);
}

.top-tab svg {
  width: 18px;
  height: 18px;
  color: rgba(10, 42, 79, 0.62);
}

.top-tab-copy strong {
  font-size: 12.05px;
  font-weight: 860;
}

.top-tab-copy small {
  color: rgba(10, 42, 79, 0.48);
  font-size: 9.25px;
}

.top-tab:hover {
  border-color: transparent;
  background: transparent;
  color: var(--water-navy);
  transform: translateY(-1px);
}

.top-tab:hover::before {
  opacity: 1;
}

.top-tab.active {
  border-color: rgba(15, 76, 154, 0.16);
  background: var(--water-gradient);
  color: #fff;
  box-shadow:
    0 13px 26px rgba(15, 76, 154, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
}

.top-tab.active svg,
.top-tab.active .top-tab-copy small {
  color: rgba(255, 255, 255, 0.80);
}

.top-tab.active::after {
  left: 28px;
  right: 28px;
  bottom: 5px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.88), transparent);
}

.top-actions {
  gap: 9px;
}

.user-pill,
.command-trigger,
.account-menu,
.icon-button,
.quiet-button,
.company-inline-action {
  border-color: rgba(10, 42, 79, 0.12);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(10px);
}

.user-pill {
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.account-trigger:hover,
.account-trigger[aria-expanded="true"],
.command-trigger:hover,
.icon-button:hover,
.quiet-button:hover {
  border-color: rgba(30, 136, 229, 0.24);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(6, 26, 51, 0.10);
}

.primary-button {
  position: relative;
  overflow: hidden;
  border-color: rgba(15, 76, 154, 0.82);
  background: var(--water-gradient);
  color: #fff;
  box-shadow: 0 14px 28px rgba(15, 76, 154, 0.18);
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0 34%, rgba(255, 255, 255, 0.32) 46%, transparent 58%);
  transform: translateX(-120%);
  transition: transform 420ms var(--ease-premium);
}

.primary-button:hover {
  border-color: rgba(79, 195, 247, 0.72);
  background: linear-gradient(135deg, #082f5f, #1062b8 58%, #1e88e5);
  box-shadow: 0 18px 36px rgba(15, 76, 154, 0.22);
}

.primary-button:hover::after {
  transform: translateX(120%);
}

.filters-pane,
.results-pane,
.reader-pane,
.profiles-view,
.deadlines-view,
.cases-view,
.templates-view,
.companies-view,
.admin-view {
  border-color: rgba(10, 42, 79, 0.10);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.40), transparent 210px),
    rgba(247, 251, 255, 0.82);
}

.filters-pane {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.70), rgba(240, 248, 253, 0.86)),
    rgba(245, 250, 255, 0.88);
}

.results-pane {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(241, 248, 253, 0.78) 260px, rgba(247, 251, 255, 0.94));
}

.research-command {
  position: relative;
  overflow: hidden;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom-color: rgba(10, 42, 79, 0.10);
  background:
    repeating-radial-gradient(ellipse at 78% 0%, rgba(79, 195, 247, 0.12) 0 1px, transparent 1px 38px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 246, 255, 0.82));
}

.research-command::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 195, 247, 0.50), transparent);
}

.searchbar {
  position: relative;
  z-index: 1;
  gap: 12px;
}

.search-input-wrap input {
  height: 54px;
  padding-left: 48px;
  border: 1px solid rgba(10, 42, 79, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--water-deep);
  font-size: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 44px rgba(6, 26, 51, 0.09);
}

.search-input-wrap svg {
  left: 16px;
  color: var(--water-royal);
}

.search-input-wrap input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(30, 136, 229, 0.48);
  box-shadow: var(--water-focus-ring), 0 18px 44px rgba(6, 26, 51, 0.08);
  outline: none;
}

.search-submit {
  min-height: 54px;
  min-width: 174px;
  border-radius: 16px;
}

.filter-group,
.advanced-filter-panel,
.research-overview-card,
.result-row,
.skeleton-row,
.doc-header,
.doc-text-panel pre,
.side-workbench,
.reader-settings-panel,
.print-panel,
.legal-compass-card,
.source-identity-banner,
.company-panel,
.company-result-item,
.template-preview-card,
.template-result-card,
.case-card,
.profile-card,
.deadline-card,
.admin-panel {
  border-color: rgba(10, 42, 79, 0.11);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 28px rgba(6, 26, 51, 0.055);
}

.filter-group,
.advanced-filter-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 251, 255, 0.78));
}

.filter-group-title,
.command-title,
.research-start-main span,
.company-status-eyebrow,
.section-title,
.mini-heading {
  color: rgba(10, 42, 79, 0.70);
  letter-spacing: 0.02em;
}

.result-list {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.86), rgba(255, 255, 255, 0.74));
}

.result-row {
  border-left-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 253, 255, 0.88));
}

.result-row:hover,
.result-row.active {
  border-color: rgba(30, 136, 229, 0.24);
  background: #fff;
  box-shadow:
    0 18px 42px rgba(6, 26, 51, 0.10),
    inset 0 0 0 1px rgba(79, 195, 247, 0.10);
}

.result-row.active {
  box-shadow:
    inset 4px 0 0 var(--water-royal),
    0 18px 42px rgba(6, 26, 51, 0.11);
}

.result-row.favorite {
  box-shadow: inset 4px 0 0 var(--water-amber);
}

.result-open-hint,
.active-filter-chip,
.query-token-chip,
.favorite-filter-chip,
.research-toggle-button,
.source-pill,
.relation-pill,
.label-chip,
.muted-chip,
.chip {
  border-color: rgba(10, 42, 79, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--water-navy);
}

.query-token-chip,
.research-toggle-button.active {
  border-color: rgba(30, 136, 229, 0.25);
  background: rgba(232, 246, 255, 0.82);
}

.research-toggle-button:hover,
.active-filter-chip:hover,
.query-token-chip:hover,
.favorite-filter-chip:hover {
  border-color: rgba(30, 136, 229, 0.28);
  background: #fff;
  box-shadow: 0 10px 26px rgba(6, 26, 51, 0.08);
}

.research-start-state {
  position: relative;
  isolation: isolate;
  min-height: clamp(460px, calc(100vh - 240px), 720px);
  overflow: hidden;
  padding: clamp(62px, 9vh, 108px) 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 255, 0.80));
}

.research-start-state::before {
  content: "";
  position: absolute;
  inset: -22% -18%;
  z-index: -2;
  pointer-events: none;
  background:
    repeating-radial-gradient(ellipse at 50% 42%, rgba(79, 195, 247, 0.22) 0 1px, transparent 1px 58px);
  opacity: 0.88;
  transform: scaleX(1.16);
}

.research-start-state::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.36) 34%, rgba(255, 255, 255, 0.00) 62%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.14) 50%, rgba(255, 255, 255, 0.72));
}

.research-start-main {
  max-width: 620px;
  gap: 10px;
}

.research-start-main span {
  color: rgba(7, 70, 122, 0.78);
}

.research-start-main strong {
  color: var(--water-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  font-weight: 850;
  line-height: 1.08;
}

.research-start-actions {
  margin-top: 4px;
}

.research-start-actions button {
  min-height: 44px;
  padding: 0 16px;
  border-color: rgba(10, 42, 79, 0.12);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 34px rgba(6, 26, 51, 0.08);
  backdrop-filter: blur(10px);
}

.reader-pane {
  background:
    linear-gradient(180deg, rgba(246, 251, 255, 0.94), rgba(237, 247, 253, 0.84));
}

.doc-header {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(242, 250, 255, 0.86));
  box-shadow: 0 12px 34px rgba(6, 26, 51, 0.06);
}

.doc-header h1 {
  color: var(--water-deep);
}

.doc-text-panel {
  background:
    repeating-radial-gradient(ellipse at 50% -10%, rgba(79, 195, 247, 0.08) 0 1px, transparent 1px 58px),
    linear-gradient(180deg, rgba(239, 248, 254, 0.95), rgba(248, 252, 255, 0.86));
}

.doc-text-panel pre {
  border-color: rgba(10, 42, 79, 0.10);
  background: rgba(255, 255, 255, 0.96);
  color: #17263a;
  box-shadow: 0 22px 70px rgba(6, 26, 51, 0.10);
}

.side-workbench {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(243, 250, 255, 0.86));
}

.workbench-tabs,
.profile-mode-tabs,
.deadline-mode-tabs,
.case-room-tabs,
.company-tabs {
  border-color: rgba(10, 42, 79, 0.10);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
}

.company-tab,
.profile-mode-tabs button,
.deadline-mode-tabs button,
.case-room-tabs button,
.workbench-tab {
  border-radius: 999px;
}

.company-tab.active,
.profile-mode-tabs button.active,
.deadline-mode-tabs button.active,
.case-room-tabs button.active,
.workbench-tab.active {
  background: var(--water-gradient);
  color: #fff;
  box-shadow: 0 12px 26px rgba(15, 76, 154, 0.17);
}

.empty-state,
.error-state,
.result-empty-state {
  border-color: rgba(10, 42, 79, 0.10);
  background:
    repeating-radial-gradient(ellipse at 50% 0%, rgba(79, 195, 247, 0.08) 0 1px, transparent 1px 38px),
    rgba(255, 255, 255, 0.68);
  border-radius: var(--radius-lg);
}

.skeleton-line {
  background:
    linear-gradient(90deg, rgba(232, 246, 255, 0.86) 0%, rgba(255, 255, 255, 0.96) 48%, rgba(232, 246, 255, 0.86) 100%);
  background-size: 220% 100%;
}

@media (max-width: 1260px) {
  .topbar {
    grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.72fr) minmax(190px, 0.72fr);
  }

  .top-tabs {
    width: min(100%, 700px);
  }

  .top-tab-copy small {
    display: none;
  }
}

@media (max-width: 820px) {
  .brand-mark-logo {
    width: 72px;
    height: 52px;
    flex-basis: 72px;
  }

  .top-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .top-tab {
    flex: 0 0 142px;
    scroll-snap-align: start;
  }
}

/* Fase 8C: Module coherence polish. */
.profiles-view,
.deadlines-view,
.cases-view,
.templates-view,
.companies-view {
  --module-card-bg: rgba(255, 255, 255, 0.88);
  --module-card-border: rgba(10, 42, 79, 0.105);
  --module-muted-bg: rgba(244, 250, 255, 0.72);
}

.profile-header,
.deadline-header,
.case-header,
.company-header,
.templates-header {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 249, 255, 0.82));
  box-shadow: 0 14px 34px rgba(6, 26, 51, 0.045);
}

.profile-header h1,
.deadline-header h1,
.case-header h1,
.company-header h1,
.templates-header h1 {
  color: var(--water-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(21px, 1.7vw, 29px);
  font-weight: 850;
  line-height: 1.08;
}

.profile-actions,
.case-header-actions,
.company-actions,
.template-header-actions {
  align-items: center;
  gap: 7px;
}

.profile-header {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(520px, 0.92fr);
}

.profile-header > div:first-child {
  min-width: 0;
}

.profile-actions {
  justify-content: flex-end;
}

.profile-actions .quiet-button,
.case-header-actions .quiet-button,
.company-actions .quiet-button,
.template-header-actions .quiet-button,
.profile-actions select,
.case-header-actions select,
.company-actions select {
  min-height: 38px;
  border-radius: 13px;
}

.profile-actions #profileDownloadBtn,
.profile-actions #profileHtmlBtn,
.profile-actions #profilePrintBtn,
.profile-actions #profileRefreshBtn,
.company-actions #companyCopyReportBtn,
.company-actions #companyDownloadReportBtn {
  padding-inline: 11px;
  color: rgba(10, 42, 79, 0.74);
  font-size: 13px;
}

.profile-actions #deleteProfileBtn,
.company-actions .entity-case-link button:disabled,
.profile-actions .entity-case-link button:disabled {
  opacity: 0.62;
}

.profile-actions .entity-case-link,
.company-actions .entity-case-link {
  border-color: rgba(10, 42, 79, 0.08);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
}

.profile-panel,
.case-room-hero-main,
.case-link-panel,
.case-room-panel,
.template-results-panel,
.template-detail-panel,
.company-panel {
  border-color: var(--module-card-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 252, 255, 0.86));
  box-shadow: 0 16px 42px rgba(6, 26, 51, 0.055);
}

.profile-mode-tabs,
.deadline-mode-tabs,
.case-room-tabs,
.company-tabs {
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(242, 249, 255, 0.68));
}

.profile-mode-tabs button,
.deadline-mode-tabs button,
.case-room-tabs button,
.company-tab {
  border-color: rgba(10, 42, 79, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition:
    transform 150ms var(--ease-premium),
    box-shadow 150ms var(--ease-premium),
    border-color 150ms var(--ease-premium),
    background-color 150ms var(--ease-premium);
}

.profile-mode-tabs button:hover,
.deadline-mode-tabs button:hover,
.case-room-tabs button:hover,
.company-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 136, 229, 0.24);
  box-shadow: 0 12px 24px rgba(6, 26, 51, 0.07);
}

.profile-mode-tabs button.active small,
.deadline-mode-tabs button.active small {
  color: rgba(255, 255, 255, 0.78);
}

.profile-issue-board article,
.profile-doc-list article,
.profile-annotation-list article,
.case-overview-item,
.case-activity-item {
  border-color: rgba(10, 42, 79, 0.10);
  border-radius: 14px;
  background: var(--module-card-bg);
  box-shadow: 0 10px 24px rgba(6, 26, 51, 0.04);
}

.case-room-hero {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.case-link-panel {
  align-self: start;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 251, 255, 0.66));
}

.case-link-panel .mini-heading {
  color: rgba(10, 42, 79, 0.62);
  font-size: 11px;
}

.case-link-panel small {
  color: rgba(71, 92, 118, 0.78);
}

.case-link-panel .field {
  gap: 5px;
}

.case-link-panel button {
  min-height: 38px;
}

.templates-workspace {
  grid-template-columns: minmax(340px, 0.70fr) minmax(620px, 1.30fr);
}

.template-results-panel,
.template-detail-panel {
  padding: 16px;
}

.template-result-list {
  gap: 8px;
}

.template-result-item {
  border-left-width: 0;
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 255, 0.88));
  box-shadow: 0 8px 22px rgba(6, 26, 51, 0.045);
}

.template-result-item:hover,
.template-result-item.active {
  border-color: rgba(30, 136, 229, 0.24);
  box-shadow: 0 18px 38px rgba(6, 26, 51, 0.085);
}

.template-result-item.active {
  background:
    linear-gradient(90deg, rgba(232, 246, 255, 0.92), rgba(255, 255, 255, 0.94));
  box-shadow:
    inset 4px 0 0 var(--water-royal),
    0 18px 38px rgba(6, 26, 51, 0.085);
}

.template-open {
  gap: 6px;
  padding: 12px 0 12px 12px;
}

.template-result-top strong {
  color: var(--water-deep);
  font-size: 14px;
  line-height: 1.25;
}

.template-result-signal {
  border-color: rgba(30, 136, 229, 0.20);
  background: rgba(232, 246, 255, 0.82);
  color: var(--water-royal);
}

.template-file-pill {
  min-width: 42px;
  min-height: 26px;
  border-color: rgba(10, 42, 79, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: rgba(10, 42, 79, 0.68);
}

.template-result-meta {
  gap: 1px;
}

.template-result-meta span,
.template-snippet {
  color: rgba(71, 92, 118, 0.82);
  font-size: 11.7px;
}

.template-result-item:not(.active):not(:hover) .result-tags,
.template-result-item:not(.active):not(:hover) .template-snippet {
  display: none;
}

.template-result-item .result-tags .chip:nth-child(n+3),
.template-use-facts span:nth-child(n+3) {
  display: none;
}

.template-snippet {
  -webkit-line-clamp: 2;
}

.template-fav {
  margin: 10px 10px 0 0;
  border-radius: 13px;
}

.template-detail-content {
  width: min(100%, 1180px);
  gap: 12px;
}

.template-detail-head,
.template-use-strip,
.template-document-viewer,
.template-admin-details {
  border-color: rgba(10, 42, 79, 0.10);
  border-radius: 16px;
}

.template-detail-head {
  background:
    radial-gradient(circle at right top, rgba(79, 195, 247, 0.13), transparent 36%),
    rgba(255, 255, 255, 0.92);
}

.template-use-strip {
  border-color: rgba(30, 136, 229, 0.18);
  background:
    linear-gradient(100deg, rgba(232, 246, 255, 0.92), rgba(255, 255, 255, 0.88) 58%);
}

.template-use-eyebrow {
  color: var(--water-royal) !important;
}

.template-use-facts span {
  border-color: rgba(30, 136, 229, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(10, 42, 79, 0.70);
}

.template-document-toolbar-actions > a.quiet-button {
  display: none;
}

.template-document-toolbar {
  background: rgba(255, 255, 255, 0.92);
}

.template-preview-status {
  min-height: 26px;
}

.template-admin-details {
  background: rgba(255, 255, 255, 0.72);
}

.template-admin-details > summary {
  border-radius: 14px;
}

.company-support-box,
.company-source-box {
  border-color: rgba(10, 42, 79, 0.10);
  border-radius: 15px;
  background:
    radial-gradient(circle at right top, rgba(79, 195, 247, 0.11), transparent 38%),
    rgba(255, 255, 255, 0.74);
}

.company-support-box strong,
.company-source-box strong {
  color: var(--water-deep);
}

.company-support-box span,
.company-source-box span,
.company-source-box small {
  color: rgba(71, 92, 118, 0.84);
}

.company-search-form .primary-button span {
  letter-spacing: 0;
}

@media (max-width: 1180px) {
  .profile-header {
    grid-template-columns: 1fr;
  }

  .templates-workspace,
  .case-room-hero {
    grid-template-columns: 1fr;
  }

  .case-link-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-office-head {
    display: none;
  }

  .case-office-row {
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
    gap: 7px 10px;
  }

  .case-office-case {
    grid-column: 1 / -1;
  }

  .case-office-heading,
  .case-office-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .case-office-metrics {
    justify-content: flex-start;
  }

  .case-office-controls {
    margin-left: 0;
  }

  .case-operation-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-status-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-command-top {
    display: grid;
  }

  .case-command-status {
    justify-content: flex-start;
  }

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

  .case-command-main {
    min-width: 0;
    grid-column: 1 / -1;
  }

  .case-command-save {
    grid-column: 1 / -1;
  }

  .case-process-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .case-process-checks {
    grid-template-columns: 1fr;
  }

  .case-process-cards,
  .case-process-card-grid,
  .case-process-card-grid.compact {
    grid-template-columns: 1fr;
  }

  .case-process-workbench {
    grid-template-columns: 1fr;
  }

  .case-process-card-grid .wide {
    grid-column: 1 / -1;
  }

  .case-operation-editor .wide,
  .case-operation-editor .primary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .case-office-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .case-office-controls,
  .case-status-actions,
  .case-operation-editor,
  .case-command-grid {
    grid-template-columns: 1fr;
  }

  .case-command-top strong {
    white-space: normal;
  }

  .case-process-panel-head {
    display: grid;
  }

  .case-process-panel-head small {
    max-width: none;
    text-align: left;
  }

  .case-process-step-row {
    grid-template-columns: 1fr;
  }

  .case-process-step-row small {
    grid-column: 1;
  }

  .case-link-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .brand-mark-logo {
    width: 64px;
    height: 48px;
    flex-basis: 64px;
  }

  .brand-name {
    font-size: 17px;
  }

  .searchbar {
    grid-template-columns: 1fr;
  }

  .search-submit {
    width: 100%;
  }
}

/* Sager is a long workflow surface; it must scroll like a page, not like the fixed document reader. */
.app-shell.case-view-active {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

.app-shell.case-view-active .cases-view,
.app-shell.case-view-active .cases-layout,
.app-shell.case-view-active .case-main,
.app-shell.case-view-active .case-room-content,
.app-shell.case-view-active .case-room-hero,
.app-shell.case-view-active .case-room-hero-main,
.app-shell.case-view-active .case-room-panels {
  height: auto;
  min-height: 0;
  overflow: visible;
}

/* Launch polish: Sager should feel like one calm Retskilden workspace, not stacked utility blocks. */
.app-shell.case-view-active .case-main {
  background:
    linear-gradient(180deg, rgba(247, 252, 255, 0.98) 0%, rgba(241, 248, 252, 0.94) 48%, rgba(247, 250, 252, 0.98) 100%);
}

.case-office-overview {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: clamp(14px, 1.6vw, 24px);
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(245, 251, 255, 0.52));
}

.case-office-heading {
  position: relative;
  align-items: center;
  padding: 15px 18px 14px;
  border-color: rgba(10, 42, 79, 0.075);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 253, 255, 0.84));
  box-shadow:
    0 18px 50px rgba(6, 26, 51, 0.065),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.case-office-heading::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: -1px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(10, 42, 79, 0.04), rgba(30, 136, 229, 0.46), rgba(23, 107, 91, 0.22), rgba(10, 42, 79, 0.03));
}

.case-office-heading .mini-heading {
  margin: 0;
  color: var(--source-blue);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.035em;
}

.case-office-heading p {
  max-width: 620px;
  margin-top: 4px;
  color: rgba(10, 42, 79, 0.62);
  font-size: 13px;
}

.case-office-heading-side {
  gap: 10px;
}

.case-office-metrics {
  gap: 8px;
}

.case-office-metric {
  min-height: 38px;
  padding: 7px 12px;
  border-color: rgba(10, 42, 79, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 24px rgba(6, 26, 51, 0.035);
}

.case-office-metric span,
.case-office-metric small {
  color: rgba(10, 42, 79, 0.54);
}

.case-office-metric strong {
  color: var(--source-blue);
  font-size: 13.5px;
}

.case-office-action {
  border-radius: 999px;
}

.case-office-action.primary {
  min-height: 40px;
  padding-inline: 16px;
  background: linear-gradient(135deg, #08264d 0%, #0f4c9a 55%, #1e88e5 100%);
  box-shadow:
    0 16px 32px rgba(15, 76, 154, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.case-office-toolbar {
  align-items: center;
  padding-top: 0;
}

.case-office-filters,
.case-team-strip {
  padding: 4px;
  border-color: rgba(10, 42, 79, 0.075);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.case-office-filter {
  min-height: 32px;
  border-radius: 999px;
  padding-inline: 13px;
  color: rgba(10, 42, 79, 0.62);
}

.case-office-filter.active,
.case-team-chip.active {
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  box-shadow:
    0 10px 22px rgba(6, 26, 51, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.case-office-controls select {
  min-height: 36px;
  border-radius: 999px;
  padding-inline: 13px;
}

.case-office-table {
  gap: 9px;
  padding: 9px;
  border-color: rgba(10, 42, 79, 0.07);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(239, 248, 253, 0.54));
  box-shadow:
    0 24px 64px rgba(6, 26, 51, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.case-office-head {
  padding: 8px 13px 3px;
  color: rgba(10, 42, 79, 0.48);
  font-size: 10.5px;
}

.case-office-row {
  padding: 14px 13px 14px 18px;
  border-color: rgba(10, 42, 79, 0.065);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(250, 253, 255, 0.9));
  box-shadow:
    0 9px 24px rgba(6, 26, 51, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.case-office-row::before {
  inset: 11px auto 11px 7px;
  width: 4px;
}

.case-office-row:hover,
.case-office-row.active {
  border-color: rgba(30, 136, 229, 0.20);
  background:
    linear-gradient(180deg, #ffffff, rgba(247, 252, 255, 0.98));
  box-shadow:
    0 18px 38px rgba(6, 26, 51, 0.085),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.case-office-case strong {
  color: var(--source-blue);
  font-size: 13.2px;
  font-weight: 950;
}

.case-office-case small,
.case-office-next small,
.case-office-owner small {
  color: rgba(10, 42, 79, 0.50);
}

.case-office-next strong {
  color: var(--ink);
  font-size: 12.2px;
}

.case-process-chip {
  grid-template-columns: 84px minmax(0, 1fr);
  min-height: 30px;
  padding: 5px 9px;
  border-color: rgba(10, 42, 79, 0.075);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.70);
}

.case-process-chip strong {
  color: rgba(10, 42, 79, 0.74);
  font-size: 10.2px;
}

.case-process-chip small {
  color: rgba(10, 42, 79, 0.54);
  font-size: 10.5px;
}

.case-process-chip.tone-done {
  border-color: rgba(30, 136, 229, 0.16);
  background: linear-gradient(180deg, #f7fcff, #edf7fd);
}

.case-process-chip.tone-pending {
  border-color: rgba(168, 110, 18, 0.20);
  background: linear-gradient(180deg, #fffaf0, #fff7e6);
}

.case-stage-cell {
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(249, 252, 255, 0.76));
}

.case-estimate-pill {
  min-height: 26px;
  border-color: rgba(10, 42, 79, 0.075);
  background: rgba(255, 255, 255, 0.72);
}

.case-office-inline-editor {
  margin-top: -2px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 250, 254, 0.92));
  transform-origin: top center;
  animation: caseInlineReveal 170ms var(--ease-premium, ease) both;
}

.case-office-inline-editor.is-dirty {
  border-color: rgba(168, 110, 18, 0.30);
  box-shadow:
    0 18px 46px rgba(10, 42, 79, 0.09),
    0 0 0 3px rgba(168, 110, 18, 0.075),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.case-office-inline-editor.needs-attention {
  animation:
    caseInlineReveal 170ms var(--ease-premium, ease) both,
    caseInlineNudge 460ms ease both;
}

.case-office-inline-head {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(10, 42, 79, 0.07);
}

.case-office-inline-grid {
  gap: 12px;
}

.case-office-inline-grid input,
.case-office-inline-grid select,
.case-office-inline-grid textarea {
  min-height: 38px;
  border-radius: 10px;
}

.case-office-inline-actions {
  gap: 8px;
}

.case-office-delete {
  color: #8d2f28;
}

.case-office-delete-confirm {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(152, 66, 55, 0.20);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 247, 246, 0.96), rgba(255, 241, 239, 0.84));
}

.case-office-delete-confirm.hidden {
  display: none;
}

.case-office-delete-confirm span {
  margin-right: auto;
  color: #7d312b;
  font-size: 12px;
  font-weight: 850;
}

.case-delete-confirm-button {
  min-height: 34px;
  padding-inline: 12px;
  border-radius: 999px;
}

.case-office-overview.is-dense {
  gap: 10px;
}

.case-office-overview.is-dense .case-office-heading {
  padding: 12px 16px;
  box-shadow:
    0 12px 32px rgba(6, 26, 51, 0.052),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.case-office-overview.is-dense .case-office-heading p {
  display: none;
}

.case-office-table.is-dense {
  gap: 6px;
  padding: 7px;
}

.case-office-table.is-dense .case-office-head {
  padding: 6px 11px 2px;
}

.case-office-table.is-dense .case-office-row {
  min-height: 92px;
  padding: 10px 11px 10px 16px;
  border-radius: 9px;
}

.case-office-table.is-dense .case-office-row::before {
  inset-block: 9px;
}

.case-office-table.is-dense .case-process-chip {
  min-height: 25px;
  padding-block: 3px;
}

.case-office-table.is-dense .case-stage-cell {
  padding-block: 6px;
}

.case-office-inline-status {
  margin-right: auto;
  color: rgba(10, 42, 79, 0.54);
  font-size: 11.5px;
  font-weight: 850;
}

.case-office-inline-editor.is-dirty .case-office-inline-status {
  color: #7b520f;
}

.case-office-discard {
  display: none;
}

.case-office-inline-editor.is-dirty .case-office-discard {
  display: inline-flex;
}

/* Sager launch polish: one calm work surface, no duplicate scaffolding. */
.app-shell.case-view-active .cases-layout {
  display: block;
}

.app-shell.case-view-active .cases-sidebar,
.app-shell.case-view-active .case-header,
.app-shell.case-view-active .case-room-empty,
.app-shell.case-view-active .case-room-tabs,
.app-shell.case-view-active .case-room-panels,
.app-shell.case-view-active .case-status-actions,
.app-shell.case-view-active .case-room-hero-main > #caseSummaryGrid,
.app-shell.case-view-active .case-room-hero-main > #caseProcessRail,
.app-shell.case-view-active .case-room-hero-main > #caseNextBox {
  display: none !important;
}

.app-shell.case-view-active .case-main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 100vh;
  padding: clamp(12px, 1.5vw, 22px);
}

.app-shell.case-view-active .case-office-overview,
.app-shell.case-view-active .case-room-content {
  width: min(100%, 1500px);
}

.app-shell.case-view-active .case-room-content.hidden {
  display: none !important;
}

.app-shell.case-view-active .case-room-content {
  margin: 0 auto 34px;
  border: 1px solid rgba(10, 42, 79, 0.075);
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 249, 255, 0.70));
  box-shadow:
    0 22px 58px rgba(6, 26, 51, 0.065),
    inset 0 1px 0 rgba(255, 255, 255, 0.80);
}

.app-shell.case-view-active .case-room-hero {
  padding: 0;
  border-bottom: 0;
}

.app-shell.case-view-active .case-room-hero-main {
  gap: 14px;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell.case-view-active .case-room-hero-main > .section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 0 2px;
  color: rgba(10, 42, 79, 0.68);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.app-shell.case-view-active .case-room-hero-main > .section-title svg {
  width: 16px;
  height: 16px;
  color: var(--source-blue);
}

.app-shell.case-view-active .case-process-workbench,
.app-shell.case-view-active .case-command-card {
  border-color: rgba(10, 42, 79, 0.085);
  box-shadow:
    0 16px 38px rgba(6, 26, 51, 0.052),
    inset 0 1px 0 rgba(255, 255, 255, 0.80);
}

.app-shell.case-view-active .case-command-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 252, 255, 0.90));
}

.app-shell.case-view-active .case-process-workbench {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(245, 251, 255, 0.74));
}

/* Final VA polish: Sager should read like a legal work ledger, not a technical dashboard. */
.app-shell.case-view-active .case-office-heading {
  border-color: rgba(10, 42, 79, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 252, 255, 0.58));
  box-shadow:
    0 12px 34px rgba(6, 26, 51, 0.045),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.app-shell.case-view-active .case-office-heading p {
  color: rgba(10, 42, 79, 0.56);
}

.app-shell.case-view-active .case-office-metric {
  min-height: 34px;
  padding: 5px 10px;
  border-color: rgba(10, 42, 79, 0.065);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.app-shell.case-view-active .case-office-metric strong {
  font-size: 13px;
}

.app-shell.case-view-active .case-office-metric.tone-danger {
  border-color: rgba(152, 66, 55, 0.18);
  background: linear-gradient(180deg, rgba(255, 248, 247, 0.88), rgba(255, 241, 239, 0.58));
}

.app-shell.case-view-active .case-office-metric.tone-missing {
  border-color: rgba(89, 68, 111, 0.15);
  background: linear-gradient(180deg, rgba(250, 248, 252, 0.88), rgba(246, 242, 250, 0.58));
}

.app-shell.case-view-active .case-office-metric.tone-calm {
  border-color: rgba(30, 136, 229, 0.11);
  background: linear-gradient(180deg, rgba(248, 253, 255, 0.9), rgba(240, 248, 253, 0.58));
}

.app-shell.case-view-active .case-office-table {
  border-color: rgba(10, 42, 79, 0.055);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(238, 247, 253, 0.34));
  box-shadow:
    0 16px 44px rgba(6, 26, 51, 0.052),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.app-shell.case-view-active .case-office-head,
.app-shell.case-view-active .case-office-row {
  grid-template-columns: minmax(270px, 1.22fr) minmax(136px, 0.58fr) minmax(270px, 1.18fr) minmax(230px, 0.92fr) minmax(92px, 0.38fr) minmax(132px, 0.56fr);
  min-width: 1210px;
}

.app-shell.case-view-active .case-office-head {
  padding-inline: 14px;
  color: rgba(10, 42, 79, 0.44);
  font-size: 10px;
  letter-spacing: 0.055em;
}

.app-shell.case-view-active .case-office-row {
  min-height: 82px;
  padding: 12px 12px 12px 18px;
  border-color: rgba(10, 42, 79, 0.055);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 253, 255, 0.82));
  box-shadow:
    0 6px 18px rgba(6, 26, 51, 0.032),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.app-shell.case-view-active .case-office-row:hover,
.app-shell.case-view-active .case-office-row.active {
  border-color: rgba(30, 136, 229, 0.18);
  box-shadow:
    0 14px 32px rgba(6, 26, 51, 0.072),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.app-shell.case-view-active .case-office-row.active {
  background:
    linear-gradient(180deg, #ffffff, rgba(245, 251, 255, 0.96));
}

.app-shell.case-view-active .case-office-case strong {
  font-size: 13.6px;
  letter-spacing: 0;
}

.app-shell.case-view-active .case-office-case small {
  color: rgba(10, 42, 79, 0.48);
  font-size: 11px;
}

.app-shell.case-view-active .case-office-next strong {
  font-size: 12.8px;
  line-height: 1.32;
}

.app-shell.case-view-active .case-office-next small {
  color: rgba(10, 42, 79, 0.46);
}

.app-shell.case-view-active .case-stage-cell {
  padding: 7px 9px;
  border-color: rgba(10, 42, 79, 0.06);
  background: rgba(255, 255, 255, 0.66);
}

.app-shell.case-view-active .case-stage-cell strong {
  font-size: 11.5px;
}

.app-shell.case-view-active .case-stage-cell small {
  color: rgba(10, 42, 79, 0.46);
}

.app-shell.case-view-active .case-office-process {
  gap: 4px;
}

.app-shell.case-view-active .case-process-chip {
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 26px;
  padding: 3px 8px;
  border-color: rgba(10, 42, 79, 0.055);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: none;
}

.app-shell.case-view-active .case-process-chip strong {
  color: rgba(10, 42, 79, 0.66);
  font-size: 9.8px;
}

.app-shell.case-view-active .case-process-chip small {
  color: rgba(10, 42, 79, 0.48);
  font-size: 10px;
}

.app-shell.case-view-active .case-process-chip.tone-unset {
  border-color: rgba(10, 42, 79, 0.075);
  background:
    linear-gradient(180deg, rgba(249, 251, 253, 0.92), rgba(243, 247, 250, 0.72));
}

.app-shell.case-view-active .case-process-chip.tone-unset strong {
  color: rgba(10, 42, 79, 0.56);
}

.app-shell.case-view-active .case-process-chip.tone-unset small {
  color: rgba(10, 42, 79, 0.44);
}

.app-shell.case-view-active .case-process-chip.tone-requested {
  border-color: rgba(30, 136, 229, 0.30);
  background:
    linear-gradient(180deg, rgba(244, 251, 255, 0.98), rgba(225, 241, 252, 0.84));
}

.app-shell.case-view-active .case-process-chip.tone-requested strong {
  color: #0f4c9a;
}

.app-shell.case-view-active .case-process-chip.tone-requested small {
  color: rgba(15, 76, 154, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-partial {
  border-color: rgba(168, 110, 18, 0.30);
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(255, 244, 219, 0.82));
}

.app-shell.case-view-active .case-process-chip.tone-partial strong {
  color: #7b520f;
}

.app-shell.case-view-active .case-process-chip.tone-partial small {
  color: rgba(123, 82, 15, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-pending {
  border-color: rgba(168, 110, 18, 0.30);
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(255, 244, 219, 0.82));
}

.app-shell.case-view-active .case-process-chip.tone-pending strong {
  color: #7b520f;
}

.app-shell.case-view-active .case-process-chip.tone-pending small {
  color: rgba(123, 82, 15, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-received {
  border-color: rgba(23, 107, 91, 0.26);
  background:
    linear-gradient(180deg, rgba(240, 250, 247, 0.98), rgba(225, 243, 238, 0.82));
}

.app-shell.case-view-active .case-process-chip.tone-received strong {
  color: #176b5b;
}

.app-shell.case-view-active .case-process-chip.tone-received small {
  color: rgba(23, 107, 91, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-done {
  border-color: rgba(23, 107, 91, 0.26);
  background:
    linear-gradient(180deg, rgba(240, 250, 247, 0.98), rgba(225, 243, 238, 0.82));
}

.app-shell.case-view-active .case-process-chip.tone-done strong {
  color: #176b5b;
}

.app-shell.case-view-active .case-process-chip.tone-done small {
  color: rgba(23, 107, 91, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-blocked {
  border-color: rgba(152, 66, 55, 0.30);
  background:
    linear-gradient(180deg, rgba(255, 247, 246, 0.98), rgba(255, 235, 232, 0.82));
}

.app-shell.case-view-active .case-process-chip.tone-blocked strong {
  color: #8d2f28;
}

.app-shell.case-view-active .case-process-chip.tone-blocked small {
  color: rgba(141, 47, 40, 0.74);
}

.app-shell.case-view-active .case-estimate-pill {
  min-height: 24px;
  padding-inline: 9px;
  border-color: rgba(10, 42, 79, 0.06);
  color: rgba(10, 42, 79, 0.68);
  background: rgba(255, 255, 255, 0.58);
}

.app-shell.case-view-active .case-office-owner strong {
  color: rgba(10, 42, 79, 0.78);
  font-size: 12px;
}

.app-shell.case-view-active .case-office-inline-editor {
  margin: -1px 8px 8px;
  padding: 15px;
  border-color: rgba(30, 136, 229, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 254, 0.90));
  box-shadow:
    0 14px 34px rgba(6, 26, 51, 0.064),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.app-shell.case-view-active .case-office-inline-head {
  min-height: 38px;
}

.app-shell.case-view-active .case-office-inline-head span,
.app-shell.case-view-active .case-office-inline-grid label > span {
  color: rgba(10, 42, 79, 0.52);
  font-size: 10.5px;
}

.app-shell.case-view-active .case-office-inline-head strong {
  color: var(--source-blue);
  font-size: 14.5px;
}

.app-shell.case-view-active .case-office-inline-grid {
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 0.85fr) minmax(260px, 1.35fr) minmax(150px, 0.65fr);
  gap: 11px;
}

.app-shell.case-view-active .case-office-inline-grid label.wide {
  grid-column: span 2;
}

.app-shell.case-view-active .case-office-inline-grid input,
.app-shell.case-view-active .case-office-inline-grid select,
.app-shell.case-view-active .case-office-inline-grid textarea {
  border-color: rgba(10, 42, 79, 0.10);
  background: rgba(255, 255, 255, 0.86);
}

.app-shell.case-view-active .case-office-inline-grid input:focus,
.app-shell.case-view-active .case-office-inline-grid select:focus,
.app-shell.case-view-active .case-office-inline-grid textarea:focus {
  border-color: rgba(30, 136, 229, 0.34);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.09);
}

.app-shell.case-view-active .case-office-inline-actions {
  padding-top: 2px;
}

.app-shell.case-view-active .case-office-inline-status {
  color: rgba(10, 42, 79, 0.46);
}

.app-shell.case-view-active .case-office-delete-confirm {
  background:
    linear-gradient(180deg, rgba(255, 249, 248, 0.96), rgba(255, 244, 242, 0.78));
}

@keyframes caseInlineReveal {
  from {
    opacity: 0;
    transform: translateY(-6px) scaleY(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

@keyframes caseInlineNudge {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-3px);
  }

  50% {
    transform: translateX(3px);
  }

  75% {
    transform: translateX(-2px);
  }
}

.top-tabs {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(245, 250, 255, 0.52));
}

.top-tab {
  min-height: 46px;
  border-radius: 14px;
}

.top-tab.active {
  border-radius: 14px;
  box-shadow:
    0 12px 24px rgba(15, 76, 154, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

@media (max-width: 1180px) {
  .case-office-heading {
    align-items: stretch;
  }

  .case-office-metrics {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .research-start-state {
    min-height: 420px;
    padding: 54px 18px;
  }

  .research-start-state::before {
    inset: -14% -48%;
    transform: scaleX(1.08);
  }

  .research-start-main strong {
    font-size: 29px;
  }

  .case-office-overview {
    padding: 12px;
  }

  .case-office-heading {
    padding: 15px;
  }

  .case-office-metric {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .case-office-filters {
    border-radius: 12px;
  }

  .case-office-table {
    padding: 7px;
    border-radius: 10px;
  }

  .case-office-row {
    border-radius: 10px;
  }

  .case-process-chip {
    grid-template-columns: 88px minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .case-office-overview {
    padding: 16px;
  }

  .case-office-heading {
    padding: 16px;
  }

  .case-office-table {
    padding: 8px;
    overflow: visible;
  }

  .case-office-row {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(138px, auto);
    align-items: start;
    gap: 9px 12px;
    padding: 14px 14px 14px 18px;
  }

  .case-office-case {
    grid-column: 1;
  }

  .case-stage-cell {
    grid-column: 2;
    grid-row: 1;
    justify-self: stretch;
    max-width: none;
  }

  .case-office-next,
  .case-office-process {
    grid-column: 1 / -1;
  }

  .case-office-process {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .case-estimate-pill {
    grid-column: 1;
    justify-self: start;
  }

  .case-office-owner {
    grid-column: 2;
    justify-self: end;
    text-align: right;
  }
}

@media (max-width: 720px) {
  .case-office-overview {
    padding: 12px;
  }

  .case-office-heading,
  .case-office-toolbar {
    border-radius: 8px;
  }

  .case-office-actions,
  .case-office-metrics {
    width: 100%;
  }

  .case-office-action.primary {
    flex: 1 1 auto;
    justify-content: center;
  }

  .case-office-table {
    gap: 7px;
    padding: 6px;
  }

  .case-office-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 13px 12px 13px 16px;
  }

  .case-office-case,
  .case-stage-cell,
  .case-office-next,
  .case-office-process,
  .case-estimate-pill,
  .case-office-owner {
    grid-column: 1;
  }

  .case-stage-cell,
  .case-office-owner {
    justify-self: stretch;
    text-align: left;
  }

  .case-office-process {
    grid-template-columns: 1fr;
  }

  .case-process-chip {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .case-office-inline-editor {
    margin-inline: 0;
    padding: 13px;
  }
}

/* Fix F5E: Sager is desktop/laptop-first. Keep the legal ledger dense, calm and readable at 1280px+. */
.case-office-date-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: -4px;
  padding: 8px 10px;
  border: 1px solid rgba(10, 42, 79, 0.06);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(248, 253, 255, 0.92), rgba(238, 248, 254, 0.68));
}

.case-office-date-strip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(10, 42, 79, 0.62);
  font-size: 11px;
  font-weight: 800;
}

.case-office-date-strip strong {
  color: rgba(10, 42, 79, 0.78);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

.case-office-date-strip.muted {
  color: rgba(10, 42, 79, 0.52);
}

@media (min-width: 1181px) {
  .app-shell.case-view-active .case-office-table {
    overflow-x: hidden;
  }

  .app-shell.case-view-active .case-office-head,
  .app-shell.case-view-active .case-office-row {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(220px, 1.24fr) minmax(116px, 0.56fr) minmax(210px, 1.14fr) minmax(258px, 1.12fr) minmax(76px, 0.34fr) minmax(112px, 0.50fr);
    gap: 8px;
  }

  .app-shell.case-view-active .case-office-row {
    min-height: 88px;
    padding: 9px 10px 9px 18px;
  }

  .app-shell.case-view-active .case-office-row:hover {
    transform: translateY(-1px);
  }

  .app-shell.case-view-active .case-stage-cell {
    padding: 6px 8px;
  }

  .app-shell.case-view-active .case-office-process {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 4px;
  }

  .app-shell.case-view-active .case-process-chip {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: minmax(78px, 0.55fr) minmax(0, 1fr);
    min-height: 21px;
    padding: 1px 7px;
    border-radius: 999px;
  }

  .app-shell.case-view-active .case-process-chip strong {
    font-size: 9.4px;
  }

  .app-shell.case-view-active .case-process-chip small {
    font-size: 9.6px;
  }

  .app-shell.case-view-active .case-estimate-pill {
    min-height: 23px;
    padding-inline: 8px;
  }

  .app-shell.case-view-active .case-office-inline-editor {
    margin: -2px 4px 8px;
    padding: 13px;
    scroll-margin-top: 96px;
  }

  .app-shell.case-view-active .case-office-inline-head {
    min-height: 34px;
  }

  .app-shell.case-view-active .case-office-inline-grid {
    grid-template-columns: minmax(130px, 0.58fr) minmax(160px, 0.72fr) minmax(240px, 1.22fr) minmax(136px, 0.58fr);
    gap: 9px;
  }

  .app-shell.case-view-active .case-office-inline-grid input,
  .app-shell.case-view-active .case-office-inline-grid select,
  .app-shell.case-view-active .case-office-inline-grid textarea {
    min-height: 34px;
  }

  .app-shell.case-view-active .case-office-table.is-dense .case-office-row {
    min-height: 86px;
    padding-block: 8px;
  }

  .app-shell.case-view-active .case-office-table.is-dense .case-process-chip {
    min-height: 22px;
    padding-block: 2px;
  }
}

@media (max-width: 1180px) {
  .app-shell.case-view-active .case-office-head {
    display: none;
  }

  .app-shell.case-view-active .case-office-table {
    overflow: visible;
  }

  .app-shell.case-view-active .case-office-row {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(138px, auto);
  }

  .app-shell.case-view-active .case-office-process {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell.case-view-active .case-process-chip {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .app-shell.case-view-active .case-office-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.case-view-active .case-office-process {
    grid-template-columns: 1fr;
  }

  .case-office-date-strip {
    align-items: stretch;
  }

  .case-office-date-strip span {
    width: 100%;
    justify-content: space-between;
  }
}

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

/* Retskilden visual language: the water-ring motif should belong to every module, not only search. */
.profiles-view,
.deadlines-view,
.cases-view,
.templates-view,
.companies-view,
.admin-view {
  background:
    repeating-radial-gradient(ellipse at 78% -10%, rgba(79, 195, 247, 0.10) 0 1px, transparent 1px 66px),
    linear-gradient(180deg, rgba(247, 252, 255, 0.96), rgba(239, 248, 255, 0.80) 310px, rgba(247, 251, 255, 0.92));
}

.profile-header,
.deadline-header,
.case-header,
.templates-header,
.company-header,
.admin-header {
  position: relative;
  overflow: hidden;
  background:
    repeating-radial-gradient(ellipse at 86% -22%, rgba(79, 195, 247, 0.13) 0 1px, transparent 1px 54px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 249, 255, 0.84));
}

.profile-card-title > strong {
  margin-bottom: 0;
}

/* Fase 9A: Blue Retskilden alignment for reader, authority and module controls. */
.app-shell.reader-wide.filters-collapsed {
  grid-template-columns: 62px 6px minmax(270px, 0.46fr) 6px minmax(760px, 1.34fr);
}

.app-shell.reader-wide .reader-pane {
  background:
    radial-gradient(ellipse at 72% -16%, rgba(79, 195, 247, 0.13), transparent 45%),
    linear-gradient(180deg, rgba(246, 251, 255, 0.98), rgba(238, 248, 254, 0.88));
}

.reader-navigation-actions,
.reader-size-actions,
.reader-find-panel,
.reader-settings-panel,
.print-panel {
  border-color: rgba(10, 42, 79, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 250, 255, 0.86));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 16px 42px rgba(6, 26, 51, 0.10);
}

.reader-navigation-actions .icon-button:hover,
.reader-navigation-actions .icon-button.active,
.reader-navigation-actions .compact-text-button:hover,
.reader-size-actions .icon-button:hover,
.reader-size-actions .icon-button.active,
.reader-zoom-value:hover,
.reader-zoom-value.active,
.reader-toggle-row button:hover,
.reader-toggle-row button.active {
  border-color: rgba(30, 136, 229, 0.30);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(231, 246, 255, 0.86));
  color: var(--water-navy);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 24px rgba(15, 76, 154, 0.10);
}

.reader-find-row > svg,
.reader-find-count,
.doc-data-panel > summary small {
  color: var(--water-royal);
}

.doc-data-panel,
.legal-compass {
  border-bottom-color: rgba(10, 42, 79, 0.10);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(242, 249, 255, 0.78));
}

.legal-compass-card,
.source-status-card,
.authority-rail {
  --compass-color: var(--water-royal);
  --authority-color: var(--water-royal);
  background:
    radial-gradient(ellipse at 10% -16%, rgba(79, 195, 247, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 251, 255, 0.86));
  box-shadow: 0 12px 32px rgba(6, 26, 51, 0.06);
}

.legal-compass-card.very-high,
.legal-compass-card.high,
.source-status-card.very-high,
.source-status-card.high,
.authority-rail.very-high,
.authority-rail.high {
  --compass-color: var(--water-royal);
  --authority-color: var(--water-royal);
  border-left-color: var(--water-royal);
}

.legal-compass-card.medium,
.source-status-card.medium,
.authority-rail.medium {
  --compass-color: var(--water-blue);
  --authority-color: var(--water-blue);
  border-left-color: rgba(30, 136, 229, 0.72);
}

.legal-compass-card.low,
.legal-compass-card.support,
.source-status-card.low,
.authority-rail.low,
.authority-rail.support {
  --compass-color: var(--water-teal);
  --authority-color: var(--water-teal);
  border-left-color: rgba(15, 118, 110, 0.72);
}

.legal-compass-main strong,
.source-status-head strong,
.authority-rail strong {
  color: var(--water-deep);
}

.legal-compass-main small,
.source-status-card p,
.source-status-head em,
.authority-rail span,
.authority-rail time {
  color: rgba(10, 42, 79, 0.62);
}

/* Fase 9B: Module chrome should feel like one Retskilden product. */
.profile-mode-tabs button.active,
.deadline-mode-tabs button.active,
.case-room-tabs button.active,
.company-tab.active,
.template-quick-chip.active,
.case-office-filter.active,
.case-team-chip.active,
button.case-office-metric.active {
  border-color: rgba(15, 76, 154, 0.26);
  background: var(--water-gradient);
  color: #fff;
  box-shadow:
    0 13px 28px rgba(15, 76, 154, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.profile-mode-tabs button.active span,
.profile-mode-tabs button.active small,
.deadline-mode-tabs button.active span,
.deadline-mode-tabs button.active small,
.case-room-tabs button.active small,
.company-tab.active small,
.template-quick-chip.active small,
.case-office-filter.active small,
.case-team-chip.active span,
.case-team-chip.active strong,
button.case-office-metric.active span,
button.case-office-metric.active strong {
  color: rgba(255, 255, 255, 0.82);
}

.profile-list-item.active,
.deadline-case-item.active,
.legal-case-item.active,
.template-result-item.active,
.company-result-item.active,
.case-office-row.active,
.user-list-item.active,
.access-item.active {
  border-color: rgba(30, 136, 229, 0.24);
  background:
    repeating-radial-gradient(ellipse at 94% 4%, rgba(79, 195, 247, 0.13) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 246, 255, 0.78));
  box-shadow:
    inset 4px 0 0 var(--water-royal),
    0 16px 38px rgba(6, 26, 51, 0.08);
}

.profile-list-item:hover,
.deadline-case-item:hover,
.legal-case-item:hover,
.template-result-item:hover,
.company-result-item:hover,
.case-office-row:hover,
.user-list-item:hover,
.access-item:hover {
  border-color: rgba(30, 136, 229, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 249, 255, 0.90));
  box-shadow: 0 14px 32px rgba(6, 26, 51, 0.075);
}

.profile-scope-badge.team,
.profile-scope-badge.private,
.entity-case-chip,
.template-file-pill {
  border-color: rgba(10, 42, 79, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(232, 246, 255, 0.72));
  color: var(--water-navy);
}

.activity-dot,
.template-fav.active,
.company-graph-mode-button.active::before {
  background: var(--water-blue);
  box-shadow: 0 0 0 4px rgba(79, 195, 247, 0.16);
}

.templates-view .section-title,
.profiles-view .section-title,
.deadlines-view .section-title,
.cases-view .section-title,
.companies-view .section-title,
.admin-view .section-title {
  color: rgba(10, 42, 79, 0.72);
}

.templates-view .section-title svg,
.profiles-view .section-title svg,
.deadlines-view .section-title svg,
.cases-view .section-title svg,
.companies-view .section-title svg,
.admin-view .section-title svg {
  color: var(--water-royal);
}

/* Final responsive guard: collapsed research state must not squeeze the source header into the content column. */
@media (max-width: 820px) {
  .app-shell,
  .app-shell.reader-empty-state,
  .app-shell.filters-collapsed,
  .app-shell.reader-empty-state.filters-collapsed,
  .app-shell.reader-wide.filters-collapsed,
  .app-shell.reader-focus.filters-collapsed,
  .app-shell.reader-minimized.filters-collapsed {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
  }

  .topbar {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
    padding: 10px 12px 12px;
    overflow: hidden;
  }

  .topbar > .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .topbar .brand-mark-logo {
    width: 58px;
    height: 46px;
    flex-basis: 58px;
  }

  .topbar .brand-name {
    font-size: 19px;
  }

  .topbar .brand-tagline {
    max-width: min(260px, 62vw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 0;
    justify-content: flex-end;
  }

  .user-pill {
    max-width: 150px;
  }

  .top-tabs {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100%;
    display: flex !important;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .top-tab {
    flex: 0 0 138px;
    scroll-snap-align: start;
  }

  .filters-pane {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }

  .results-pane {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100%;
  }

  .app-shell.filters-collapsed .results-pane,
  .app-shell.reader-empty-state.filters-collapsed .results-pane {
    grid-row: 2 !important;
  }

  .reader-pane,
  .profiles-view,
  .deadlines-view,
  .cases-view,
  .templates-view,
  .companies-view,
  .admin-view {
    grid-column: 1 / -1 !important;
  }
}

/* Fix F5B: final guard for premium top navigation responsiveness and semantics. */
@media (max-width: 820px) {
  .app-shell,
  .app-shell.filters-collapsed,
  .app-shell.reader-wide.filters-collapsed,
  .app-shell.reader-focus.filters-collapsed,
  .app-shell.reader-minimized.filters-collapsed {
    grid-template-rows: auto 56px minmax(0, 0.38fr) minmax(0, 0.62fr) !important;
    height: 100vh;
    overflow: hidden;
  }

  .app-shell.reader-empty-state,
  .app-shell.reader-empty-state.filters-collapsed {
    grid-template-rows: auto 56px minmax(0, 1fr) !important;
  }

  .filters-pane {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    max-height: 56px;
    overflow: hidden !important;
  }

  .app-shell:not(.filters-collapsed) .filters-pane {
    max-height: min(52vh, 420px);
    overflow-y: auto !important;
  }

  .results-pane,
  .app-shell.reader-empty-state .results-pane {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    width: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell.filters-collapsed .results-pane,
  .app-shell.reader-empty-state.filters-collapsed .results-pane {
    grid-row: 3 !important;
  }

  .reader-pane {
    grid-column: 1 / -1 !important;
    grid-row: 4 !important;
    min-height: 0;
    overflow: hidden;
  }
}

@media (min-width: 821px) and (max-width: 1360px) {
  .topbar {
    grid-template-columns: minmax(210px, 0.52fr) minmax(780px, 1.95fr) minmax(188px, 0.48fr);
    gap: 12px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .top-tabs {
    width: min(100%, 780px);
  }

  .top-tab {
    flex-basis: 120px;
    min-height: 46px;
    grid-template-columns: 19px minmax(0, 1fr);
    gap: 6px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .top-tab svg {
    width: 17px;
    height: 17px;
  }

  .top-tab-copy strong {
    font-size: 11.55px;
  }

  .top-tab-copy small {
    display: none;
  }

  .user-pill {
    max-width: 170px;
  }
}

@media (max-width: 820px) {
  .topbar > .brand {
    gap: 9px;
  }

  .topbar .brand-mark-logo {
    width: 50px;
    height: 42px;
    flex-basis: 50px;
  }

  .topbar .brand-name {
    font-size: 18px;
  }

  .topbar .brand-tagline {
    max-width: min(150px, 42vw);
    font-size: 10px;
  }

  .top-tabs {
    padding: 4px;
    border-radius: 22px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
  }

  .top-tabs::-webkit-scrollbar {
    display: none;
  }

  .top-tab {
    flex: 0 0 clamp(110px, 31vw, 128px);
    min-height: 42px;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 6px;
    padding: 6px 8px;
  }

  .top-tab svg {
    width: 17px;
    height: 17px;
  }

  .top-tab-copy strong {
    font-size: 11.35px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 8px 10px;
  }

  .top-actions {
    gap: 6px;
  }

  .user-pill {
    min-width: 88px;
    max-width: 104px;
    padding: 6px 8px;
  }

  .user-pill span {
    display: none;
  }

  .user-pill strong {
    font-size: 11.5px;
  }

  .topbar .brand-tagline {
    max-width: min(132px, 36vw);
  }

  #refreshBtn {
    width: 34px;
    height: 34px;
  }

  .top-tab {
    flex-basis: 108px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }
}

/* Fix F5C: calmer source-search start state and denser premium result cards. */
.result-list {
  overflow-x: hidden;
}

.research-start-state {
  width: 100%;
  max-width: 100%;
  contain: paint;
  padding-inline: clamp(18px, 4vw, 36px);
}

.research-start-state::before {
  inset: -18% 0 -12%;
  transform: none;
  background:
    repeating-radial-gradient(ellipse at 50% 42%, rgba(79, 195, 247, 0.18) 0 1px, transparent 1px 64px);
  opacity: 0.82;
  mask-image: radial-gradient(ellipse at 50% 42%, #000 0 52%, transparent 76%);
}

.research-start-state::after {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.34) 36%, rgba(255, 255, 255, 0.00) 64%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.18) 50%, rgba(255, 255, 255, 0.82));
}

.research-start-main {
  max-width: min(620px, calc(100% - 24px));
  margin-inline: auto;
}

.result-row {
  gap: 7px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border-radius: 14px;
}

.result-card-head {
  gap: 10px;
  align-items: center;
}

.result-title {
  font-size: 15.25px;
  line-height: 1.28;
}

.result-relevance-line {
  min-height: 0;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 10px;
  font-size: 11.8px;
  line-height: 1.25;
}

.result-relevance-line strong {
  font-size: 11.7px;
}

.result-snippet {
  font-size: 13.75px;
  line-height: 1.46;
  -webkit-line-clamp: 2;
}

.result-snippet mark {
  background: rgba(79, 195, 247, 0.24);
  box-shadow: inset 0 -1px 0 rgba(15, 76, 154, 0.24);
}

.result-tags {
  gap: 5px;
  max-height: 24px;
}

.result-tags .chip {
  min-height: 22px;
  padding: 2px 7px;
  font-size: 11.75px;
}

@media (max-width: 820px) {
  .research-start-state {
    min-height: 390px;
    padding-block: 54px;
  }

  .research-start-main strong {
    font-size: clamp(25px, 7vw, 32px);
  }

  .result-row {
    padding: 11px 12px;
  }
}

/* F5D: Frister becomes a quiet Retskilden control tool, not a parallel case module. */
.deadlines-view {
  --deadline-blue: #0f4c9a;
  --deadline-blue-soft: rgba(79, 195, 247, 0.16);
  --deadline-panel-bg: rgba(255, 255, 255, 0.88);
}

.deadlines-layout,
.deadlines-layout.quick-mode {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.deadlines-sidebar,
#deadlineCaseLinkBox,
#deleteDeadlineCaseBtn,
#saveDeadlineInsightBtn,
.deadline-support-field {
  display: none !important;
}

.deadline-main {
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 82% -8%, rgba(79, 195, 247, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(247, 252, 255, 0.96), rgba(239, 248, 255, 0.80));
}

.deadline-header {
  margin: 14px 14px 0;
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 18px;
  background:
    repeating-radial-gradient(ellipse at 88% -38%, rgba(79, 195, 247, 0.16) 0 1px, transparent 1px 52px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(233, 247, 255, 0.84));
  box-shadow: 0 18px 46px rgba(6, 26, 51, 0.075);
}

.deadline-header::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 14px;
  width: min(420px, 38vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15, 76, 154, 0.34), transparent);
}

.deadline-header-actions {
  min-width: 0;
}

.deadline-status {
  border-color: rgba(15, 76, 154, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--water-navy);
}

.deadline-mode-tabs {
  width: min(760px, calc(100% - 28px));
  margin: 12px 14px;
  padding: 5px;
  border-radius: 999px;
  justify-self: center;
}

.deadline-mode-tabs button {
  min-width: 0;
  min-height: 48px;
  padding: 8px 18px;
}

.deadline-quick-workspace,
.deadline-workspace {
  min-width: 0;
  margin: 0 14px 14px;
  gap: 14px;
  background: transparent;
  overflow: auto;
}

.deadline-quick-workspace {
  grid-template-columns: minmax(420px, 0.82fr) minmax(460px, 1.18fr);
}

.deadline-workspace {
  grid-template-columns: minmax(430px, 0.88fr) minmax(450px, 1.12fr);
}

.deadline-panel {
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 252, 255, 0.84));
  box-shadow: 0 16px 42px rgba(6, 26, 51, 0.06);
}

.deadline-info-box,
.deadline-inline-help {
  border-color: rgba(15, 76, 154, 0.13);
  border-left-color: var(--water-royal);
  background:
    radial-gradient(ellipse at 94% 0%, rgba(79, 195, 247, 0.12), transparent 42%),
    rgba(246, 251, 255, 0.92);
}

.deadline-kind-toggle {
  position: relative;
  border-color: rgba(10, 42, 79, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.deadline-kind-toggle input {
  display: none;
}

.deadline-kind-toggle label {
  border-radius: 999px;
  cursor: pointer;
}

.deadline-kind-toggle label:has(input:checked) {
  background: var(--water-gradient);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 76, 154, 0.16);
}

.deadline-summary-card,
.deadline-period-card,
.deadline-next-action,
.deadline-event,
.deadline-warning,
.deadline-subsection,
.deadline-line-card {
  border-color: rgba(10, 42, 79, 0.10);
  background: var(--deadline-panel-bg);
  box-shadow: 0 10px 26px rgba(6, 26, 51, 0.045);
}

.deadline-next-action.blue,
.deadline-period-card.blue,
.deadline-warning.blue,
.deadline-line-card.blue {
  border-left-color: var(--water-royal);
}

.deadline-period-card mark {
  background: rgba(232, 246, 255, 0.90);
  color: var(--water-navy);
}

.deadline-detail-drawer {
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  overflow: hidden;
}

.deadline-detail-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--water-navy);
  font-weight: 850;
  list-style: none;
}

.deadline-detail-drawer summary::-webkit-details-marker {
  display: none;
}

.deadline-detail-drawer summary small {
  color: rgba(10, 42, 79, 0.58);
  font-size: 12px;
  font-weight: 750;
}

.deadline-detail-drawer summary::after {
  content: "Åbn";
  padding: 5px 9px;
  border: 1px solid rgba(10, 42, 79, 0.10);
  border-radius: 999px;
  background: rgba(232, 246, 255, 0.72);
  color: var(--water-royal);
  font-size: 11px;
}

.deadline-detail-drawer[open] summary::after {
  content: "Luk";
}

.deadline-detail-content {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

@media (max-width: 1180px) {
  .deadline-quick-workspace,
  .deadline-workspace {
    grid-template-columns: minmax(0, 1fr);
    overflow: auto;
  }
}

@media (max-width: 820px) {
  .deadline-header,
  .deadline-mode-tabs,
  .deadline-quick-workspace,
  .deadline-workspace {
    margin-inline: 10px;
  }

  .deadline-header {
    border-radius: 16px;
  }

  .deadline-mode-tabs {
    width: calc(100% - 20px);
    overflow-x: auto;
    justify-self: stretch;
  }

  .deadline-mode-tabs button {
    flex: 1 0 170px;
    padding-inline: 12px;
  }

  .deadline-form-grid,
  .deadline-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .deadline-actions {
    flex-wrap: wrap;
  }
}

/* F5E correction: case process text and status colors must stay readable and consistent. */
.app-shell.case-view-active .case-office-process {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: center;
}

.app-shell.case-view-active .case-process-chip {
  --case-chip-border: rgba(10, 42, 79, 0.08);
  --case-chip-bg: linear-gradient(180deg, rgba(249, 251, 253, 0.95), rgba(243, 247, 250, 0.78));
  --case-chip-title: rgba(10, 42, 79, 0.62);
  --case-chip-value: rgba(10, 42, 79, 0.50);
  width: 100%;
  max-width: none;
  grid-template-columns: minmax(104px, 0.46fr) minmax(0, 1fr);
  min-height: 24px;
  padding: 2px 8px;
  border-color: var(--case-chip-border);
  background: var(--case-chip-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.app-shell.case-view-active .case-process-chip strong {
  color: var(--case-chip-title);
  font-size: 9.5px;
}

.app-shell.case-view-active .case-process-chip small {
  color: var(--case-chip-value);
  font-size: 9.8px;
}

.app-shell.case-view-active .case-process-chip.tone-requested {
  --case-chip-border: rgba(30, 136, 229, 0.26);
  --case-chip-bg: linear-gradient(180deg, rgba(244, 251, 255, 0.98), rgba(225, 241, 252, 0.86));
  --case-chip-title: #0f4c9a;
  --case-chip-value: rgba(15, 76, 154, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-received,
.app-shell.case-view-active .case-process-chip.tone-done {
  --case-chip-border: rgba(23, 107, 91, 0.24);
  --case-chip-bg: linear-gradient(180deg, rgba(240, 250, 247, 0.98), rgba(225, 243, 238, 0.84));
  --case-chip-title: #176b5b;
  --case-chip-value: rgba(23, 107, 91, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-partial,
.app-shell.case-view-active .case-process-chip.tone-pending {
  --case-chip-border: rgba(168, 110, 18, 0.25);
  --case-chip-bg: linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(255, 244, 219, 0.84));
  --case-chip-title: #7b520f;
  --case-chip-value: rgba(123, 82, 15, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-blocked {
  --case-chip-border: rgba(152, 66, 55, 0.28);
  --case-chip-bg: linear-gradient(180deg, rgba(255, 247, 246, 0.98), rgba(255, 235, 232, 0.84));
  --case-chip-title: #8d2f28;
  --case-chip-value: rgba(141, 47, 40, 0.74);
}

.app-shell.case-view-active .case-process-chip.tone-unset,
.app-shell.case-view-active .case-process-chip.tone-requested,
.app-shell.case-view-active .case-process-chip.tone-received,
.app-shell.case-view-active .case-process-chip.tone-done,
.app-shell.case-view-active .case-process-chip.tone-partial,
.app-shell.case-view-active .case-process-chip.tone-pending,
.app-shell.case-view-active .case-process-chip.tone-blocked {
  border-color: var(--case-chip-border);
  background: var(--case-chip-bg);
}

.app-shell.case-view-active .case-process-chip.tone-unset strong,
.app-shell.case-view-active .case-process-chip.tone-requested strong,
.app-shell.case-view-active .case-process-chip.tone-received strong,
.app-shell.case-view-active .case-process-chip.tone-done strong,
.app-shell.case-view-active .case-process-chip.tone-partial strong,
.app-shell.case-view-active .case-process-chip.tone-pending strong,
.app-shell.case-view-active .case-process-chip.tone-blocked strong {
  color: var(--case-chip-title);
}

.app-shell.case-view-active .case-process-chip.tone-unset small,
.app-shell.case-view-active .case-process-chip.tone-requested small,
.app-shell.case-view-active .case-process-chip.tone-received small,
.app-shell.case-view-active .case-process-chip.tone-done small,
.app-shell.case-view-active .case-process-chip.tone-partial small,
.app-shell.case-view-active .case-process-chip.tone-pending small,
.app-shell.case-view-active .case-process-chip.tone-blocked small {
  color: var(--case-chip-value);
}

@media (min-width: 1181px) {
  .app-shell.case-view-active .case-office-head,
  .app-shell.case-view-active .case-office-row {
    grid-template-columns: minmax(220px, 1.18fr) minmax(116px, 0.54fr) minmax(200px, 1.02fr) minmax(280px, 1.24fr) minmax(76px, 0.34fr) minmax(112px, 0.48fr);
  }

  .app-shell.case-view-active .case-office-row {
    min-height: 96px;
  }

  .app-shell.case-view-active .case-office-table.is-dense .case-office-row {
    min-height: 92px;
  }
}
