/* Cabinet redesign (TASK-0074) — design system ported from the approved
   prototype .impeccable/mockups/site/. All classes are `c-` prefixed to avoid
   clashing with the legacy app.css. Reuses the shared tokens from app.css. */

.c-app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.c-side {
  background: var(--panel-warm);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}
.c-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  text-decoration: none;
}
.c-brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: none;
  background: linear-gradient(135deg, var(--blue-ink), var(--blue-quiet));
  display: grid;
  place-items: center;
  color: #fff;
}
.c-brand__mark svg {
  width: 18px;
  height: 18px;
}
.c-brand__name {
  font-weight: 700;
  font-size: 18px;
  color: var(--deep-sea-blue);
}
.c-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.c-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--deep-sea-blue);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.c-nav__item svg {
  width: 19px;
  height: 19px;
  color: var(--blue-quiet);
  flex: none;
}
.c-nav__item:hover {
  background: rgba(221, 234, 243, 0.55);
}
.c-nav__item--active {
  background: var(--soft-sky);
  font-weight: 700;
}
.c-nav__item--active svg {
  color: var(--deep-sea-blue);
}
.c-nav__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(217, 154, 61, 0.18);
  color: #9a6a1e;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.c-side__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  border-radius: 8px;
}
.c-side__foot:hover {
  background: rgba(221, 234, 243, 0.45);
}
.c-side__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--warm-sand);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--blue-ink);
  font-size: 13px;
}

/* ---------------- Main ---------------- */
.c-main {
  padding: 30px clamp(20px, 4vw, 48px) 64px;
  max-width: 1180px;
  width: 100%;
}
.c-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.c-head h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--deep-sea-blue);
  letter-spacing: -0.01em;
  margin: 0;
}
.c-head p {
  color: var(--muted);
  font-size: 15px;
  margin: 6px 0 0;
  max-width: 70ch;
}
.c-crumbs {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.c-crumbs a {
  text-decoration: none;
  font-weight: 500;
  color: var(--action-blue);
}
.c-crumbs svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

/* ---------------- Buttons ---------------- */
.c-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.c-btn svg {
  width: 17px;
  height: 17px;
}
.c-btn:active {
  transform: scale(0.98);
}
.c-btn--primary {
  background: var(--action-blue);
  color: #fff;
  box-shadow: 0 10px 24px rgba(42, 91, 135, 0.18);
}
.c-btn--primary:hover {
  background: var(--action-blue-hover);
  box-shadow: 0 14px 30px rgba(42, 91, 135, 0.24);
  transform: translateY(-1px);
}
.c-btn--secondary {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  color: var(--deep-sea-blue);
}
.c-btn--secondary:hover {
  background: var(--soft-sky);
  border-color: var(--deep-sea-blue);
}
.c-btn--ghost {
  background: transparent;
  color: var(--action-blue);
  height: auto;
  padding: 6px 4px;
}
.c-btn--sm {
  height: 36px;
  padding: 0 13px;
  font-size: 13px;
}
.c-btn--danger {
  background: transparent;
  border-color: rgba(196, 106, 74, 0.5);
  color: var(--soft-red);
}
.c-btn--danger:hover {
  background: rgba(196, 106, 74, 0.1);
}

/* Keyboard focus: every cabinet interactive gets a designed ring, not the raw
   UA outline that clips against the 1px row dividers. */
.c-row:focus-visible,
.c-list a:focus-visible,
.c-col__all:focus-visible,
.c-nav__item:focus-visible,
.c-side__foot:focus-visible,
.c-tree a:focus-visible,
.c-btn:focus-visible {
  outline: 2px solid var(--action-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- Panels ---------------- */
.c-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.c-panel--warm {
  background: var(--panel-warm);
}
.c-panel--quiet {
  background: transparent;
  border-style: dashed;
}
.c-panel + .c-panel {
  margin-top: 18px;
}
.c-panel__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.c-panel__title svg {
  width: 20px;
  height: 20px;
  color: var(--blue-quiet);
}
.c-panel__title h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--deep-sea-blue);
  margin: 0;
}
.c-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

/* ---------------- Triage board ---------------- */
.c-board {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
  align-items: start;
}
.c-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 18px 8px;
  display: flex;
  flex-direction: column;
}
/* The lead triage column is the page's focal anchor — a warm-sand wash (the
   token DESIGN.md reserves for first-level focus surfaces) so it reads as the
   priority pile, not a barely-tinted near-white. */
.c-col--lead {
  background: rgba(233, 216, 181, 0.2);
  border-color: rgba(217, 154, 61, 0.28);
}
.c-col__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
/* Column heads are a structural label tier, not content titles — a smaller
   small-caps register so the 15px row titles below read as the content level.
   Without this the board has two competing 15px/700 heading tiers. */
.c-col__head h2 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-quiet);
  margin: 0;
}
.c-col__hint {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 12px;
}
.c-count {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--soft-sky);
  color: var(--blue-ink);
}
.c-count--lead {
  margin-left: auto;
}
.c-count--urgent {
  background: rgba(217, 154, 61, 0.18);
  color: #855517;
}

.c-row {
  display: flex;
  gap: 11px;
  padding: 13px 4px;
  border-top: 1px solid rgba(216, 211, 200, 0.7);
  text-decoration: none;
  color: inherit;
}
.c-row:first-of-type {
  border-top: 0;
}
a.c-row:hover .c-row__title {
  color: var(--action-blue);
}
.c-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 7px;
  flex: none;
}
.c-dot--amber {
  background: var(--attention-amber);
}
.c-dot--blue {
  background: var(--blue-quiet);
}
.c-dot--green {
  background: var(--success-green);
}
.c-dot--red {
  background: var(--soft-red);
}
.c-dot--grey {
  background: var(--muted);
}
.c-row__body {
  min-width: 0;
  flex: 1;
}
.c-row__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--deep-sea-blue);
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
.c-crumb {
  color: var(--muted);
  font-weight: 500;
}
.c-row__meta {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 3px;
}
.c-row__meta b {
  color: var(--soft-red);
  font-weight: 700;
}
.c-col__all {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--action-blue);
  text-decoration: none;
}
.c-col__all svg {
  width: 15px;
  height: 15px;
}

/* ---------------- Chips / status pills ---------------- */
.c-chip {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(125, 139, 104, 0.16);
  color: #566049;
  flex: none;
}
.c-chip--doc {
  background: rgba(42, 91, 135, 0.12);
  color: var(--blue-quiet);
}
.c-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* Stay a compact pill even inside grid/flex parents that stretch children
     (e.g. .dashboard-list li, which is display:grid). */
  width: fit-content;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.c-status::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
/* Five semantic tones. Every status across the app resolves to one of these
   via the status_chip() macro in _status.html — one vocabulary, one source of
   truth. Text colours are darkened off the raw tokens to clear WCAG AA (≥4.5:1)
   on the tinted chip background. Dot keeps the brighter token. */
.c-status--blue {
  background: rgba(42, 91, 135, 0.1);
  color: var(--blue-quiet);
}
.c-status--blue::before {
  background: var(--blue-quiet);
}
.c-status--amber {
  background: rgba(217, 154, 61, 0.16);
  color: #8a5e1c;
}
.c-status--amber::before {
  background: var(--attention-amber);
}
.c-status--green {
  background: rgba(77, 124, 91, 0.16);
  color: #3f6b4d;
}
.c-status--green::before {
  background: var(--success-green);
}
.c-status--red {
  background: rgba(196, 106, 74, 0.16);
  color: #a94c2b;
}
.c-status--red::before {
  background: var(--soft-red);
}
.c-status--grey {
  background: rgba(101, 114, 124, 0.12);
  color: #586169;
}
.c-status--grey::before {
  background: #586169;
}

/* ---------------- Lists ---------------- */
.c-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}
.c-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid rgba(216, 211, 200, 0.7);
  flex-wrap: wrap;
}
/* The date pins to a right-aligned column so a stack of rows reads as a ledger;
   everything else packs left next to the title it belongs to. */
.c-list .c-date {
  margin-inline-start: auto;
}
.c-list li:first-child {
  border-top: 0;
}
.c-list strong {
  font-weight: 700;
  color: var(--deep-sea-blue);
  font-size: 15px;
}
.c-list a {
  text-decoration: none;
}
.c-list a:hover strong {
  color: var(--action-blue);
}
/* Plain (classless) meta spans are muted; any classed span (c-status, c-chip,
   c-date) keeps its own styling. */
.c-list span:not([class]) {
  font-size: 13.5px;
  color: var(--muted);
}
/* The date is the payload of the deadlines list — give it weight, a calendar
   glyph, and tabular figures so dates align into a column. */
.c-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue-quiet);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.c-date svg {
  flex: none;
  width: 14px;
  height: 14px;
  opacity: 0.85;
}
/* Horizon group headings for the deadlines list. Overdue is marked by label
   text + icon + red date, never colour alone. */
.c-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 2px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.c-group-label:first-child {
  margin-top: 0;
}
.c-group-label svg {
  width: 14px;
  height: 14px;
}
.c-group-label--overdue {
  color: #a94c2b;
}
.c-list-group--overdue .c-date {
  color: #a94c2b;
}

/* case tree */
.c-tree {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
}
.c-tree__case {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px 18px;
}
.c-tree__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.c-tree__row a {
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--deep-sea-blue);
}
.c-tree__row a:hover {
  color: var(--action-blue);
}
.c-tree__meta {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.c-tree__ws {
  list-style: none;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.c-tree__ws li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.c-tree__ws a {
  text-decoration: none;
  color: var(--blue-quiet);
  font-weight: 700;
  font-size: 14.5px;
}

/* ---------------- Forms ---------------- */
.c-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.c-field label {
  font-size: 14px;
  font-weight: 700;
  color: var(--deep-sea-blue);
}
.c-input,
.c-select,
.c-textarea {
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 46px;
  padding: 10px 13px;
  color: var(--ink);
  width: 100%;
}
.c-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
.c-input:focus,
.c-select:focus,
.c-textarea:focus {
  outline: none;
  border-color: var(--action-blue);
  box-shadow: 0 0 0 3px rgba(42, 91, 135, 0.12);
}
.c-inline-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.c-inline-row .c-input {
  flex: 1;
  min-width: 160px;
}
.c-form-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* segmented control */
.c-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.c-seg button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.c-seg button:last-child {
  border-right: 0;
}
.c-seg button[aria-pressed="true"] {
  background: var(--soft-sky);
  color: var(--deep-sea-blue);
}

/* ---------------- Detail layouts ---------------- */
.c-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
  margin-top: 18px;
}
.c-detail__aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.c-kv {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin: 0;
  padding: 0;
}
.c-kv li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 14.5px;
}
.c-kv span {
  color: var(--muted);
}
.c-kv strong {
  color: var(--deep-sea-blue);
  text-align: right;
}

/* tasks */
.c-tasks {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}
.c-task {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 0;
  border-top: 1px solid rgba(216, 211, 200, 0.7);
}
.c-task:first-child {
  border-top: 0;
}
.c-task__check {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid var(--line);
  flex: none;
  margin-top: 2px;
  display: grid;
  place-items: center;
}
.c-task__check svg {
  width: 13px;
  height: 13px;
  color: #fff;
}
.c-task--done .c-task__check {
  background: var(--success-green);
  border-color: var(--success-green);
}
.c-task--done .c-task__title {
  color: var(--muted);
  text-decoration: line-through;
}
.c-task__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--deep-sea-blue);
}
.c-task__meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* misc */
.c-callout {
  background: rgba(233, 216, 181, 0.18);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.55;
}
.c-steps2 {
  list-style: none;
  counter-reset: s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}
.c-steps2 li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15px;
}
.c-steps2 li::before {
  counter-increment: s;
  content: counter(s);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--soft-sky);
  color: var(--blue-ink);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.c-deadline-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(217, 154, 61, 0.16);
  color: #9a6a1e;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
}
.c-deadline-flag svg {
  width: 16px;
  height: 16px;
}
.c-emptybox {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 14.5px;
  padding: 6px 0;
}
.c-disclaimer {
  margin-top: 30px;
  font-size: 13px;
  color: var(--muted);
  max-width: 80ch;
  line-height: 1.55;
}
.c-quota-line {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.c-quota-line svg {
  width: 17px;
  height: 17px;
  color: var(--success-green);
}
.c-quota-line strong {
  color: var(--deep-sea-blue);
}
.c-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 16px 0 6px;
}
.c-tab {
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.c-tab--active {
  background: var(--soft-sky);
  color: var(--deep-sea-blue);
  border-color: transparent;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .c-detail {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 920px) {
  .c-app {
    grid-template-columns: 1fr;
  }
  .c-side {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 16px;
  }
  .c-side__foot,
  .c-brand__name,
  .c-nav__item span,
  .c-nav__badge {
    display: none;
  }
  .c-nav {
    flex-direction: row;
    gap: 2px;
  }
  .c-board {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .c-btn {
    transition: none;
  }
}

/* ---------------- Legal gate + legal pages + cookie notice ---------------- */
.legal-gate {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.legal-gate__card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 28px 84px rgba(15, 47, 71, 0.18);
}
.legal-gate__lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 16px;
}
.legal-gate__links {
  font-size: 14px;
  margin: 0 0 20px;
}
.legal-gate__links a {
  color: var(--action-blue);
  text-decoration: none;
}
.legal-gate__check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  border-top: 1px solid rgba(216, 211, 200, 0.7);
}
.legal-gate__check input {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  flex: none;
}
.legal-gate__check--optional {
  color: var(--muted);
}

.legal-doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px clamp(18px, 4vw, 40px) 64px;
}
.legal-doc h1 {
  font-size: 28px;
  color: var(--deep-sea-blue);
  margin: 0 0 18px;
}
.legal-doc__body {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink);
}
.legal-doc__body h1,
.legal-doc__body h2,
.legal-doc__body h3,
.legal-doc__body h4 {
  color: var(--deep-sea-blue);
  margin: 24px 0 8px;
  line-height: 1.3;
}
.legal-doc__body h2 { font-size: 20px; }
.legal-doc__body h3 { font-size: 17px; }
.legal-doc__body ul { padding-left: 22px; margin: 8px 0; }
.legal-doc__body li { margin: 4px 0; }
.legal-doc__body blockquote {
  border-left: 3px solid var(--warm-sand);
  background: rgba(233, 216, 181, 0.18);
  margin: 14px 0;
  padding: 10px 16px;
  color: var(--muted);
}
.legal-doc__body table {
  border-collapse: collapse;
  width: 100%;
  margin: 14px 0;
  font-size: 14px;
}
.legal-doc__body th,
.legal-doc__body td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.legal-doc__body th { background: var(--soft-sky); color: var(--blue-ink); }
.legal-doc__back { margin-top: 28px; }
.legal-doc__back a { color: var(--action-blue); text-decoration: none; }

.footer-legal {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.footer-legal a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.footer-legal a:hover { color: var(--action-blue); }

/* The author `display: flex` below beats the UA `[hidden] { display: none }`
   rule (author stylesheet wins at equal specificity), so the notice would never
   hide. This higher-specificity rule restores the hidden behaviour. */
.cookie-notice[hidden] {
  display: none;
}
.cookie-notice {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  background: var(--blue-ink);
  color: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  box-shadow: 0 22px 58px rgba(15, 47, 71, 0.32);
  font-size: 14px;
  line-height: 1.5;
}
.cookie-notice a { color: var(--warm-sand); }
.cookie-notice__ok {
  flex: none;
  background: #fff;
  color: var(--blue-ink);
  border: 0;
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
@media (max-width: 600px) {
  .cookie-notice { flex-direction: column; align-items: stretch; }
  .cookie-notice__ok { width: 100%; }
}

/* ---------------- First-run route takeover (TASK-0076) ---------------- */
/* Shown only to a brand-new user with an empty cabinet, after the legal gate.
   The triage board stays in the DOM behind the scrim; «Пропустить пока»
   dismisses to it. z-index sits above the sidebar (100) and cookie notice
   (300) so the route step is the single focus on first run. */
.c-firstrun {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  overflow-y: auto;
  background: rgba(15, 47, 71, 0.46);
  backdrop-filter: blur(2px);
  animation: c-firstrun-scrim 0.32s ease-out both;
}
.c-firstrun__card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(24px, 3.4vw, 36px);
  max-width: 600px;
  width: 100%;
  box-shadow: 0 36px 96px rgba(15, 47, 71, 0.32);
  animation: c-firstrun-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.c-firstrun__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue-ink), var(--blue-quiet));
  color: #fff;
  margin-bottom: 18px;
}
.c-firstrun__mark svg {
  width: 22px;
  height: 22px;
}
.c-firstrun__card h1 {
  font-size: clamp(22px, 2.6vw, 27px);
  line-height: 1.22;
  font-weight: 700;
  color: var(--deep-sea-blue);
  margin: 0 0 12px;
  text-wrap: balance;
}
.c-firstrun__lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 22px;
  max-width: 60ch;
}
.c-firstrun__steps {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.c-firstrun__steps li {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}
.c-firstrun__num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft-sky);
  color: var(--deep-sea-blue);
  font-weight: 700;
  font-size: 13px;
}
.c-firstrun__steps strong {
  display: block;
  font-size: 15px;
  color: var(--deep-sea-blue);
}
.c-firstrun__steps span {
  font-size: 14px;
  color: var(--muted);
}
.c-firstrun__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.c-firstrun__skip {
  margin: 0;
  margin-inline-start: auto;
}
@keyframes c-firstrun-scrim {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes c-firstrun-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .c-firstrun,
  .c-firstrun__card {
    animation: none;
  }
}
@media (max-width: 560px) {
  .c-firstrun__actions {
    align-items: stretch;
  }
  .c-firstrun__actions .c-btn {
    width: 100%;
    justify-content: center;
  }
  .c-firstrun__skip {
    margin-inline-start: 0;
    width: 100%;
  }
  .c-firstrun__skip .c-btn {
    width: 100%;
  }
}

/* Compact first-run banner: cabinet already has work, route not built yet. */
.c-firstbanner {
  margin-bottom: 22px;
  border-color: rgba(217, 154, 61, 0.4);
}
.c-firstbanner__lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 16px;
  max-width: 70ch;
}
.c-firstbanner__skip {
  margin: 0;
}

/* ---------------- Auth (sign-in + verify code) ---------------- */
/* One calm centered card on the cabinet design system, matching the legal gate,
   so sign-in -> consent -> cabinet read as one continuous space. */
.site-header--minimal {
  justify-content: space-between;
}
.auth {
  min-height: calc(100vh - 168px);
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.auth__card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 28px 84px rgba(15, 47, 71, 0.16);
}
.auth__lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 22px;
}
.auth__form {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.auth__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--deep-sea-blue);
}
.auth__submit {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}
.auth__submit + .auth__submit {
  margin-top: 8px;
}
.auth__code {
  text-align: center;
  letter-spacing: 0.3em;
  font-size: 19px;
  font-weight: 600;
}
.auth__code::placeholder {
  letter-spacing: normal;
}
.auth__note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(216, 211, 200, 0.7);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.auth__note svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  color: var(--blue-quiet);
}
.auth__error,
.auth__flash {
  font-size: 14px;
  line-height: 1.45;
  border-radius: 8px;
  padding: 10px 13px;
  margin: 0 0 16px;
}
.auth__error {
  background: rgba(196, 106, 74, 0.1);
  border: 1px solid rgba(196, 106, 74, 0.4);
  color: #9a4a2e;
}
.auth__flash {
  background: var(--soft-sky);
  color: var(--deep-sea-blue);
}
.auth__submit.is-loading {
  opacity: 0.8;
  pointer-events: none;
}
.auth__alt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(216, 211, 200, 0.7);
  font-size: 14px;
}
.auth__alt .link-button {
  color: var(--action-blue);
  font-weight: 600;
}
.auth__resend[disabled] {
  color: var(--muted);
  font-weight: 500;
  cursor: default;
}

/* ── Document analysis progress overlay ──────────────────────────────────────
   Calming full-screen overlay shown while analysis runs in the background.
   Animation is decorative (cycles independent of real phase timing). */
.c-analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(15, 47, 71, 0.46);
  backdrop-filter: blur(2px);
  animation: c-firstrun-scrim 0.32s ease-out both;
}
.c-analysis-overlay__card {
  background: var(--warm-white);
  border-radius: 16px;
  padding: clamp(28px, 3.4vw, 38px) clamp(24px, 3vw, 34px);
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 36px 96px rgba(15, 47, 71, 0.34);
  animation: c-firstrun-rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.c-analysis-overlay__card h2 {
  margin: 0 0 8px;
  font-size: 19px;
  color: var(--deep-sea-blue);
}
/* "Breathing" orb */
.c-analysis-overlay__orb {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, var(--action-blue), var(--blue-ink));
  animation: c-overlay-breathe 2.4s ease-in-out infinite;
}
.c-analysis-overlay__orb svg {
  width: 28px;
  height: 28px;
}
@keyframes c-overlay-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(42, 91, 135, 0.3); transform: scale(1); }
  50% { box-shadow: 0 0 0 16px rgba(42, 91, 135, 0); transform: scale(1.04); }
}
/* Cross-fading phrase line; each phrase shows for a third of the 9s cycle */
.c-analysis-overlay__phrases {
  position: relative;
  height: 24px;
  margin: 0 0 16px;
}
.c-analysis-overlay__phrases span {
  position: absolute;
  left: 0;
  right: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--deep-sea-blue);
  opacity: 0;
  animation: c-overlay-phrase 9s linear infinite;
}
.c-analysis-overlay__phrases span:nth-child(2) { animation-delay: 3s; }
.c-analysis-overlay__phrases span:nth-child(3) { animation-delay: 6s; }
@keyframes c-overlay-phrase {
  0% { opacity: 0; transform: translateY(6px); }
  5% { opacity: 1; transform: translateY(0); }
  28% { opacity: 1; transform: translateY(0); }
  33% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 0; }
}
/* Static fallback line shown only when animation is disabled */
.c-analysis-overlay__static {
  display: none;
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--deep-sea-blue);
}
.c-analysis-overlay__note {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.c-analysis-overlay__dots {
  display: flex;
  gap: 7px;
  justify-content: center;
}
.c-analysis-overlay__dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  animation: c-overlay-dot 3s ease-in-out infinite;
}
.c-analysis-overlay__dots i:nth-child(2) { animation-delay: 1s; }
.c-analysis-overlay__dots i:nth-child(3) { animation-delay: 2s; }
@keyframes c-overlay-dot {
  0%, 100% { background: var(--line); }
  33% { background: var(--action-blue); }
}
.c-analysis-overlay__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
}
.c-analysis-overlay__icon--error {
  background: rgba(196, 106, 74, 0.12);
  color: var(--soft-red);
}
.c-analysis-overlay__icon svg { width: 28px; height: 28px; }

@media (prefers-reduced-motion: reduce) {
  .c-analysis-overlay,
  .c-analysis-overlay__card,
  .c-analysis-overlay__orb {
    animation: none;
  }
  .c-analysis-overlay__phrases { display: none; }
  .c-analysis-overlay__static { display: block; }
  .c-analysis-overlay__dots i { animation: none; background: var(--action-blue); }
}

/* ── Table (admin matrices) ─────────────────────────────────────────────── */
.c-tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.c-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.c-table th,
.c-table td {
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.c-table thead th {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--panel-warm);
  position: sticky;
  top: 0;
}
.c-table tbody tr:last-child td {
  border-bottom: none;
}
.c-table tbody tr:hover {
  background: var(--soft-sky);
}
.c-table td strong {
  color: var(--deep-sea-blue);
}
.c-table td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.c-table--compact th,
.c-table--compact td {
  padding: 8px 12px;
}

/* Stacked detail list (admin log/summary items: title + muted meta lines) */
.c-itemlist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.c-itemlist li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.c-itemlist li:first-child {
  border-top: none;
}
.c-itemlist strong {
  display: block;
  color: var(--deep-sea-blue);
  font-size: 14px;
}
.c-itemlist span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
