/* ============================================================
   FILIPPO LEGAL — DESIGN SYSTEM (token layer única, 2026-07)
   Un solo origen de verdad. Consolidó 3 capas apiladas
   (original + premium refresh + glassmorphism) del prototipo.
   Superficies sólidas, jerarquía real, dark mode theme-aware.
   ============================================================ */
:root {
  color-scheme: light;

  /* Marca — carbón mármol + oro (tomado del logo real del estudio) */
  --navy: #1c1a15;
  --navy-2: #2c2820;
  --gold: #c6a24c;
  --gold-2: #a5842f;
  --gold-soft: #f4edda;

  /* Texto */
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-text: #475569;

  /* Superficies y líneas */
  --paper: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e6e9f0;
  --line-strong: #d5dae4;

  /* Semánticos (color + soft de fondo) */
  --success: #167c54;
  --warning: #a56320;
  --danger: #cf4152;
  --info: #2f6b8f;
  --teal-soft: #e4f4ec;
  --rose-soft: #fbe8ea;
  --blue-soft: #e8eef6;

  /* Escala de espaciado (base 4px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radios */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Sombras en capas (tinte navy, sutiles — estilo Linear/Stripe) */
  --shadow-xs: 0 1px 2px rgba(15, 28, 51, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 28, 51, 0.08), 0 1px 2px rgba(15, 28, 51, 0.04);
  --shadow: 0 4px 14px rgba(15, 28, 51, 0.07), 0 1px 3px rgba(15, 28, 51, 0.05);
  --shadow-strong: 0 16px 40px rgba(15, 28, 51, 0.14);

  /* Aliases de compatibilidad: la vieja capa "glass" pedía superficies
     translúcidas; acá las neutralizamos a sólido premium. */
  --glass-bg: var(--surface);
  --glass-strong: var(--surface);
  --glass-border: var(--line);
  --glass-shadow: var(--shadow);

  --focus-ring: 0 0 0 3px rgba(193, 154, 60, 0.45);
  --btn-primary-bg: var(--navy);
  --btn-primary-bg-hover: var(--navy-2);
  --btn-primary-fg: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --navy: #0d0c09;
  --navy-2: #1f1c15;
  --gold: #d3af5b;
  --gold-2: #c6a24c;
  --gold-soft: rgba(211, 175, 91, 0.14);

  --ink: #eeeae2;
  --ink-2: #cdc7bb;
  --muted: #a49d8f;
  --muted-text: #c2bbac;

  --paper: #0b0a08;
  --surface: #17150f;
  --surface-2: #1f1c15;
  --line: #302c22;
  --line-strong: #3d382c;

  --success: #34b47e;
  --warning: #d69445;
  --danger: #e2687a;
  --info: #5b9fc4;
  --teal-soft: rgba(52, 180, 126, 0.14);
  --rose-soft: rgba(226, 104, 122, 0.15);
  --blue-soft: rgba(91, 159, 196, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 18px 44px rgba(0, 0, 0, 0.55);

  --focus-ring: 0 0 0 3px rgba(214, 180, 95, 0.5);
  --btn-primary-bg: var(--gold);
  --btn-primary-bg-hover: #e0bd68;
  --btn-primary-fg: #1c1a15;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Roboto, Arial, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

body.large-text {
  font-size: 18px;
}

body.high-contrast {
  --navy: #07101f;
  --navy-2: #0c1930;
  --gold: #f0c94e;
  --gold-soft: #2d260d;
  --ink: #05070b;
  --muted: #263247;
  --line: #1b2a4a;
  --paper: #ffffff;
  --surface: #ffffff;
  --shadow: 0 0 0 2px #05070b;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 10;
  padding: 10px 12px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(221, 227, 238, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.topbar-actions,
.button-row,
.form-actions,
.inline-actions,
.filter-row,
.document-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button,
.nav-button,
.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
}

.icon-button {
  min-width: 44px;
  padding: 8px 10px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--navy);
}

.primary-button {
  padding: 10px 14px;
  background: var(--navy);
  color: #fff;
}

.primary-button:hover,
.nav-button.active {
  background: var(--navy-2);
}

.secondary-button {
  padding: 10px 14px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--navy);
}

.ghost-button {
  padding: 9px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--navy);
}

.danger-button {
  padding: 10px 14px;
  border-color: rgba(185, 59, 74, 0.35);
  background: var(--rose-soft);
  color: var(--danger);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body.is-busy {
  cursor: progress;
}

.layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 20px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.workspace-nav {
  position: sticky;
  top: 86px;
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin: 42px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 33, 47, 0.18);
  backdrop-filter: blur(3px);
}

.busy-overlay.show {
  display: flex;
}

.busy-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 800;
}

.busy-spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

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

.login-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.login-card {
  display: grid;
  gap: 5px;
  min-height: 124px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.login-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
}

.login-card span,
.login-card small {
  color: var(--muted);
}

.session-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.nav-button.active {
  color: #fff;
}

.nav-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
}

.workspace {
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.worker-grid,
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.panel,
.tool-panel,
.visual-strip,
.metric,
.case-card,
.assignee-column,
.doc-output,
.chat-panel,
.calculator-panel,
.timeline-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.tool-panel,
.chat-panel,
.calculator-panel,
.timeline-panel {
  padding: 18px;
}

.visual-strip {
  position: relative;
  min-height: 182px;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
}

.visual-strip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.58;
}

.visual-content {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 182px;
  padding: 18px;
  background: linear-gradient(90deg, rgba(27, 42, 74, 0.94), rgba(27, 42, 74, 0.48));
}

.visual-content h2,
.panel h2,
.tool-panel h2,
.timeline-panel h2,
.calculator-panel h2,
.chat-panel h2 {
  margin: 4px 0 8px;
  font-size: 1.2rem;
  line-height: 1.25;
}

.visual-content p,
.panel p,
.tool-panel p,
.timeline-panel p,
.calculator-panel p,
.chat-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.visual-content p {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.88);
}

.stack {
  display: grid;
  gap: 16px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.step-button {
  min-height: 62px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.step-button.active {
  border-color: var(--navy);
  background: var(--blue-soft);
  color: var(--navy);
}

.step-number {
  display: block;
  width: 24px;
  height: 24px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  line-height: 24px;
  text-align: center;
}

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

.field {
  display: grid;
  gap: 7px;
}

fieldset.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

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

.field label,
.filter-row label,
.mini-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

legend.mini-label {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0 0 7px;
}

.field input,
.field select,
.field textarea,
.filter-row select,
.filter-row input,
.chat-compose input,
.doc-output textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.field input,
.field select,
.filter-row select,
.filter-row input,
.chat-compose input {
  padding: 10px 11px;
}

.field textarea,
.doc-output textarea {
  min-height: 108px;
  padding: 11px;
  resize: vertical;
}

.helper-text {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.legal-warning {
  color: var(--danger);
  font-weight: 800;
}

.legal-inline-warning {
  color: var(--danger);
  display: block;
  font-weight: 700;
  margin-top: 3px;
}

.privacy-box,
.compliance-note {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.compliance-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  line-height: 1.45;
}

.compliance-list a {
  color: var(--navy);
  font-weight: 800;
}

.json-response {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.json-response summary {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--navy);
  cursor: pointer;
  font-weight: 800;
}

.json-response pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

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

.procedure-flow div {
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.procedure-flow strong {
  display: grid;
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
}

.procedure-flow span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.operational-focus {
  border-color: rgba(212, 175, 55, 0.24);
}

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

.focus-grid div {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
}

.focus-grid span,
.focus-list span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.focus-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.7rem;
}

.focus-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.focus-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.48);
}

.focus-list strong {
  display: block;
  color: var(--ink);
}

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

.choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.choice:has(input:checked) {
  border-color: #9aa7ba;
  background: var(--surface-2);
}

.choice input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.upload-zone {
  display: grid;
  gap: 12px;
  min-height: 142px;
  padding: 18px;
  border: 2px dashed #aeb9cc;
  border-radius: var(--radius);
  background: var(--surface-2);
  place-items: center;
  text-align: center;
}

.evidence-list,
.audit-list,
.notification-list,
.deadline-list,
.generated-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li,
.audit-list li,
.notification-list li,
.deadline-list li,
.generated-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.review-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-list li {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.review-list strong {
  color: var(--muted);
}

.signature-pad {
  display: grid;
  gap: 10px;
}

.signature-pad canvas {
  width: 100%;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  touch-action: none;
}

.status-badge,
.pill,
.deadline-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge {
  background: var(--blue-soft);
  color: var(--info);
}

.status-badge.success {
  background: var(--teal-soft);
  color: var(--success);
}

.status-badge.warning {
  background: #fff0dd;
  color: var(--warning);
}

.status-badge.danger {
  background: var(--rose-soft);
  color: var(--danger);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-text);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.success {
  border-color: rgba(41, 121, 90, 0.25);
  background: #edf7f1;
  color: #1f684d;
}

.status-pill.warning {
  border-color: rgba(181, 132, 36, 0.28);
  background: #fff8e8;
  color: #87611b;
}

.pill {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: normal;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 12px 0 0;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 0 0 14px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 26px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.timeline-item.done .timeline-dot,
.timeline-item.current .timeline-dot {
  border-color: var(--success);
  background: var(--success);
}

.timeline-item.current .timeline-dot {
  box-shadow: 0 0 0 4px rgba(45, 128, 102, 0.18);
}

.timeline-item strong {
  display: block;
  margin-bottom: 2px;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.metric {
  min-height: 112px;
  padding: 14px;
  box-shadow: none;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 1.4rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.84rem;
}

.amount {
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--success);
  font-size: 1.2rem;
  font-weight: 900;
}

.indemnity-breakdown {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.indemnity-breakdown > div {
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.indemnity-breakdown span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.indemnity-breakdown strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 1rem;
}

.chat-log {
  display: grid;
  max-height: 260px;
  overflow: auto;
  gap: 10px;
  margin: 14px 0;
  padding-right: 4px;
}

.message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--blue-soft);
  line-height: 1.45;
}

.message.mine {
  justify-self: end;
  background: var(--gold-soft);
}

.message small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

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

.studio-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.studio-header h2 {
  margin: 2px 0 0;
  font-size: 1.35rem;
}

.filter-row {
  justify-content: flex-end;
}

.filter-row > * {
  min-width: 160px;
}

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

.case-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  box-shadow: none;
}

.case-card[draggable="true"] {
  cursor: grab;
}

.case-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.case-title h3 {
  margin: 0;
  font-size: 1rem;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

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

.assignee-column {
  min-height: 210px;
  padding: 12px;
  box-shadow: none;
}

.assignee-column.drag-over {
  border-color: var(--gold);
  background: #fffaf0;
}

.assignee-column h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.mini-case {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.deadline-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 10px;
}

.deadline-chip {
  display: grid;
  gap: 4px;
  min-height: 92px;
  align-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  white-space: normal;
}

.deadline-chip strong {
  color: var(--navy);
}

.deadline-chip span {
  color: var(--muted);
  font-size: 0.78rem;
}

.doc-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.doc-output {
  display: grid;
  gap: 10px;
  padding: 12px;
  box-shadow: none;
}

.doc-output textarea {
  min-height: 260px;
  line-height: 1.5;
}

.chart-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--line);
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--gold), var(--success));
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #1f684d;
}

.toast.warning {
  background: #8d5b20;
}

.toast.error {
  background: #9f3441;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Redisenio sobrio y moderno */
* {
  scrollbar-width: thin;
  scrollbar-color: #aeb7c5 transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #aeb7c5;
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

.topbar {
  padding: 12px 24px;
  border-bottom: 1px solid rgba(216, 222, 232, 0.82);
  background: rgba(250, 251, 253, 0.92);
  box-shadow: 0 1px 0 rgba(21, 25, 34, 0.03);
}

.brand-mark {
  border: 1px solid #2f3a4d;
  background: #151922;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  letter-spacing: 0;
}

.eyebrow,
.section-kicker {
  color: #7a8494;
  letter-spacing: 0.06em;
}

.topbar h1 {
  color: #1c2330;
  font-weight: 760;
}

.layout {
  gap: 18px;
  padding-top: 18px;
}

.workspace-nav {
  gap: 6px;
  padding: 8px;
  border-color: rgba(216, 222, 232, 0.9);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(21, 25, 34, 0.06);
}

.nav-button {
  min-height: 46px;
  border-color: transparent;
  background: transparent;
  color: #475467;
  font-weight: 760;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-button:hover {
  background: #f1f4f8;
  color: var(--ink);
}

.nav-button.active {
  background: #151922;
  color: #fff;
}

.nav-button:active {
  transform: translateY(1px);
}

.nav-dot {
  width: 8px;
  height: 8px;
  background: #a78b45;
}

.panel,
.tool-panel,
.visual-strip,
.metric,
.case-card,
.assignee-column,
.doc-output,
.chat-panel,
.calculator-panel,
.timeline-panel {
  border-color: rgba(216, 222, 232, 0.92);
  box-shadow: 0 8px 22px rgba(21, 25, 34, 0.055);
}

.panel,
.tool-panel,
.chat-panel,
.calculator-panel,
.timeline-panel {
  padding: 20px;
}

.visual-strip {
  min-height: 168px;
  background: #151922;
  box-shadow: 0 10px 26px rgba(21, 25, 34, 0.1);
}

.visual-strip img {
  opacity: 0.42;
  filter: saturate(0.65) contrast(1.02);
}

.visual-content {
  min-height: 168px;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(21, 25, 34, 0.96), rgba(21, 25, 34, 0.72) 52%, rgba(21, 25, 34, 0.38)),
    rgba(21, 25, 34, 0.2);
}

.visual-content h2,
.panel h2,
.tool-panel h2,
.timeline-panel h2,
.calculator-panel h2,
.chat-panel h2 {
  color: #171c26;
  font-size: 1.12rem;
  font-weight: 780;
}

.visual-content h2 {
  color: #fff;
  font-size: 1.22rem;
}

.visual-content p,
.panel p,
.tool-panel p,
.timeline-panel p,
.calculator-panel p,
.chat-panel p {
  color: #667085;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  border-radius: 7px;
  font-weight: 760;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.primary-button {
  background: #151922;
  box-shadow: 0 6px 14px rgba(21, 25, 34, 0.12);
}

.primary-button:hover,
.nav-button.active {
  background: #222a37;
}

.secondary-button,
.icon-button {
  border-color: #d8dee8;
  background: var(--surface);
  color: #293244;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: #b9c2cf;
  background: var(--surface-2);
}

.ghost-button:hover {
  background: #f1f4f8;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.stepper {
  gap: 6px;
}

.step-button {
  border-color: #dce2eb;
  background: var(--surface-2);
  color: #667085;
  font-weight: 760;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.step-button:hover {
  border-color: #b9c2cf;
  background: #f4f7fb;
}

.step-button.active {
  border-color: #9aa7ba;
  background: var(--surface-2);
  color: #151922;
}

.step-number,
.procedure-flow strong {
  background: #151922;
}

.field input,
.field select,
.field textarea,
.filter-row select,
.filter-row input,
.chat-compose input,
.doc-output textarea {
  border-color: #d8dee8;
  background: var(--surface-2);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.filter-row select:hover,
.filter-row input:hover,
.chat-compose input:hover,
.doc-output textarea:hover {
  border-color: #b9c2cf;
  background: var(--surface);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-row select:focus,
.filter-row input:focus,
.chat-compose input:focus,
.doc-output textarea:focus {
  border-color: #8d99aa;
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(141, 153, 170, 0.14);
  outline: none;
}

.privacy-box,
.compliance-note,
.json-response,
.procedure-flow div,
.indemnity-breakdown > div,
.mini-case {
  border-color: #dce2eb;
  background: var(--surface-2);
}

.upload-zone {
  border-color: #b7c0ce;
  background: var(--surface-2);
}

.status-badge {
  background: var(--surface-2);
  color: #3b4a5f;
}

.status-badge.success,
.amount {
  background: #e7f1ed;
  color: #286d58;
}

.status-badge.warning {
  background: #f5eddf;
  color: #8d5b20;
}

.status-badge.danger {
  background: #f4e7e9;
  color: #9f3441;
}

.pill,
.deadline-chip {
  background: var(--surface-2);
}

.metric {
  background: var(--surface);
}

.metric strong,
.indemnity-breakdown strong,
.deadline-chip strong,
.compliance-list a,
.json-response summary {
  color: #1f2937;
}

.message {
  background: var(--surface-2);
}

.message.mine {
  background: #f1ead9;
}

.assignee-column.drag-over {
  border-color: #a78b45;
  background: #fbf8ef;
}

.bar-fill {
  background: linear-gradient(90deg, #59677a, #2d8066);
}

.toast {
  background: #151922;
  box-shadow: 0 12px 28px rgba(21, 25, 34, 0.18);
}

.toast.success {
  background: #1f684d;
}

.toast.warning {
  background: #8d5b20;
}

.toast.error {
  background: #9f3441;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1180px) {
  .worker-grid,
  .studio-grid,
  .doc-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

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

  .stepper,
  .form-grid,
  .choice-grid,
  .calculator-grid,
  .metrics-grid,
  .indemnity-breakdown,
  .procedure-flow,
  .focus-grid,
  .assignment-board,
  .deadline-grid {
    grid-template-columns: 1fr;
  }

  .review-list li,
  .case-actions,
  .chat-compose {
    grid-template-columns: 1fr;
  }

  .studio-header {
    display: grid;
  }

  .filter-row {
    justify-content: stretch;
  }

  .filter-row > * {
    min-width: 0;
    width: 100%;
  }

  .inline-actions,
  .document-actions,
  .form-actions,
  .button-row {
    align-items: stretch;
  }

  .inline-actions > *,
  .document-actions > *,
  .form-actions > *,
  .button-row > * {
    flex: 1 1 180px;
  }

  .status-pill {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .icon-button {
    flex: 1 1 0;
  }

  .panel,
  .tool-panel,
  .chat-panel,
  .calculator-panel,
  .timeline-panel {
    padding: 14px;
  }

  .visual-strip,
  .visual-content {
    min-height: 210px;
  }

  .workspace-nav {
    grid-template-columns: 1fr;
  }

  .case-title,
  .session-strip,
  .evidence-list li,
  .audit-list li,
  .notification-list li,
  .deadline-list li,
  .generated-list li {
    display: grid;
    align-items: stretch;
  }

  .review-list li {
    grid-template-columns: 1fr;
  }

  .step-button,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
  }
}

/* Premium legal UI refresh — tokens ahora viven en el :root único de arriba. */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

/* Serif solo para el wordmark y el hero del portal (cara al cliente = confianza).
   El panel operativo va todo en Inter (herramienta de trabajo = claridad/velocidad). */
.brand-mark,
.nav-head strong,
.worker-hero h2 {
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: 0;
}

.topbar {
  min-height: 76px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(15, 26, 44, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(15, 26, 44, 0.06);
}

.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px;
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--navy);
  transition: transform 300ms ease-in-out, opacity 300ms ease-in-out;
}

.brand-mark {
  border: 1px solid rgba(201, 168, 76, 0.75);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--navy), #223456);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 10px 22px rgba(15, 26, 44, 0.18);
}

.layout {
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 24px;
  max-width: 1560px;
  padding-top: 24px;
}

.workspace-nav {
  top: 100px;
  gap: 12px;
  padding: 18px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--navy) 0%, #0b1424 100%);
  color: #fff;
  box-shadow: var(--shadow-strong);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.nav-head {
  display: grid;
  gap: 2px;
  padding: 6px 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.nav-head strong {
  color: #fff;
  font-size: 1.22rem;
}

.nav-head span {
  color: rgba(255,255,255,0.62);
  font-size: 0.82rem;
}

.nav-button {
  justify-content: flex-start;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.045);
  color: rgba(255,255,255,0.78);
  transition: transform 240ms ease, background 240ms ease, color 240ms ease;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(201, 168, 76, 0.16);
  color: #fff;
  transform: translateX(4px);
}

.nav-dot {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(201, 168, 76, 0.14);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 19;
  display: none;
  border: 0;
  background: rgba(15, 26, 44, 0);
  transition: background 300ms ease-in-out;
}

.view {
  display: none;
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 320ms ease, transform 320ms ease;
  will-change: transform, opacity;
}

.view.active {
  display: block;
  opacity: 1;
  transform: translate3d(0, 0, 0);
  animation: viewSlideUp 360ms ease both;
}

@keyframes viewSlideUp {
  from { opacity: 0; transform: translate3d(0, 22px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.panel,
.tool-panel,
.auth-panel,
.chat-panel,
.calculator-panel,
.timeline-panel {
  border: 1px solid rgba(15, 26, 44, 0.08);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.visual-strip.worker-hero {
  min-height: 300px;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow-strong);
}

.worker-hero::after {
  background: linear-gradient(90deg, rgba(15,26,44,0.9), rgba(15,26,44,0.48));
}

.worker-hero .section-kicker {
  color: var(--gold);
  font-size: 0.88rem;
}

.worker-hero h2 {
  max-width: 620px;
  color: var(--gold);
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 0.98;
  text-transform: uppercase;
}

.worker-hero p:not(.section-kicker) {
  max-width: 640px;
  color: rgba(255,255,255,0.84);
  font-size: 1.02rem;
}

.claim-panel {
  overflow: hidden;
}

.stepper {
  position: relative;
  gap: 10px;
  margin: 18px 0;
}

.stepper::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 27px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), rgba(15, 26, 44, 0.12));
}

.step-button {
  position: relative;
  z-index: 1;
  min-height: 74px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(15, 26, 44, 0.05);
  transition: transform 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}

.step-button:hover,
.step-button.active {
  border-color: rgba(201, 168, 76, 0.7);
  box-shadow: 0 10px 24px rgba(201, 168, 76, 0.16);
  transform: translateY(-2px);
}

.step-number {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 0 0 5px rgba(15, 26, 44, 0.08);
}

.step-button.active .step-number {
  background: var(--gold);
  color: var(--navy);
}

.step-slide {
  animation-duration: 360ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
  will-change: transform, opacity;
}

.step-slide-forward {
  animation-name: slideStepForward;
}

.step-slide-back {
  animation-name: slideStepBack;
}

@keyframes slideStepForward {
  from { opacity: 0; transform: translate3d(44px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes slideStepBack {
  from { opacity: 0; transform: translate3d(-44px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 20px -24px -24px;
  padding: 14px 24px;
  border-top: 1px solid rgba(15, 26, 44, 0.08);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.field textarea,
.field select,
.auth-form input,
.chat-compose input,
.doc-output textarea {
  border-width: 0 0 2px;
  border-radius: 0;
  background: linear-gradient(180deg, transparent, rgba(244,246,249,0.72));
}

input[type="range"] {
  width: 100%;
  height: 10px;
  accent-color: var(--gold);
}

.primary-button {
  background: linear-gradient(135deg, var(--gold), #d6bd68);
  color: var(--navy);
  box-shadow: 0 10px 20px rgba(201, 168, 76, 0.24);
}

.secondary-button,
.icon-button,
.ghost-button {
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 26, 44, 0.12);
}

.premium-navbar {
  position: sticky;
  top: 90px;
  z-index: 4;
  border: 1px solid rgba(15, 26, 44, 0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.studio-actions {
  position: relative;
}

.avatar-button {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(201, 168, 76, 0.55);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
}

.online-dot {
  position: absolute;
  right: 2px;
  bottom: 4px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--success);
  animation: pulseOnline 1.8s ease-in-out infinite;
}

@keyframes pulseOnline {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4); }
  50% { box-shadow: 0 0 0 7px rgba(46, 204, 113, 0); }
}

.user-menu {
  position: relative;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 10;
  display: grid;
  min-width: 230px;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-strong);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -12px, 0);
  transition: opacity 240ms ease, transform 240ms ease;
}

.user-menu-open .user-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.metrics-grid {
  gap: 16px;
}

.metric {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  border: 1px solid rgba(15, 26, 44, 0.06);
  background: linear-gradient(145deg, #fff, #f8fafc);
  transition: transform 260ms ease, box-shadow 260ms ease;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto -30px -42px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.12);
}

.metric:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-strong);
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--navy), var(--gold));
  color: #fff;
  font-weight: 900;
}

.premium-calculator {
  overflow: hidden;
  background: linear-gradient(145deg, #101b2e 0%, #0b1424 100%);
  color: #fff;
}

.premium-calculator .section-kicker,
.premium-calculator .helper-text,
.premium-calculator label,
.premium-calculator span,
.premium-calculator li {
  color: rgba(255,255,255,0.78);
}

.premium-calculator h2,
.premium-calculator strong {
  color: #fff;
}

.premium-calculator .field input,
.premium-calculator .field select {
  color: #fff;
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
}

.premium-calculator .field select {
  color-scheme: dark;
}

.premium-calculator .field select option {
  background: var(--surface);
  color: var(--ink);
}

.range-control {
  display: grid;
  gap: 10px;
}

.range-control input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.18) !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(255,255,255,0.12) !important;
  color: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.range-control input[type="number"]::placeholder {
  color: rgba(255,255,255,0.58);
}

.range-control input[type="range"] {
  display: none !important;
}

.amount-glow,
.premium-calculator .indemnity-breakdown div:nth-child(3) {
  border: 1px solid rgba(201, 168, 76, 0.68);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.95), rgba(245, 225, 145, 0.88));
  color: var(--navy);
  box-shadow: 0 0 28px rgba(201, 168, 76, 0.28);
}

.premium-calculator .amount {
  color: var(--navy);
}

.timeline {
  position: relative;
}

.timeline::before {
  width: 4px;
  background: linear-gradient(180deg, var(--gold), rgba(15,26,44,0.12));
  animation: timelineGrow 900ms ease both;
  transform-origin: top;
}

@keyframes timelineGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.timeline-item {
  animation: staggerIn 440ms ease both;
}

.timeline-item:nth-child(2) { animation-delay: 80ms; }
.timeline-item:nth-child(3) { animation-delay: 160ms; }
.timeline-item:nth-child(4) { animation-delay: 240ms; }
.timeline-item:nth-child(5) { animation-delay: 320ms; }
.timeline-item:nth-child(6) { animation-delay: 400ms; }
.timeline-item:nth-child(7) { animation-delay: 480ms; }

@keyframes staggerIn {
  from { opacity: 0; transform: translate3d(-18px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.timeline-dot {
  transition: transform 240ms ease, background 240ms ease;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.18);
}

.timeline-item:hover::after {
  content: "Fecha registrada en el legajo";
  display: block;
  width: max-content;
  max-width: 220px;
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  animation: tooltipUp 180ms ease both;
}

@keyframes tooltipUp {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.deadline-list > li,
.case-card,
.mini-case {
  animation: staggerIn 420ms ease both;
}

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

.accordion-card {
  display: grid !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 76, 0.24);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 260ms ease, opacity 260ms ease;
}

.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 14px;
  text-align: left;
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 14px;
  opacity: 0;
  transform: translate3d(0, -8px, 0);
  transition: max-height 300ms ease-in-out, opacity 260ms ease, transform 260ms ease, padding 260ms ease;
}

.accordion-card.expanded .accordion-body {
  max-height: 260px;
  padding: 0 14px 14px;
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.toast {
  transform: translate3d(120%, 0, 0);
  transition: transform 300ms ease, opacity 300ms ease;
}

.toast.show {
  transform: translate3d(0, 0, 0);
}

@media (max-width: 900px) {
  .sidebar-toggle {
    display: grid;
    align-content: center;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .workspace-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(80vw, 330px);
    border-radius: 0 18px 18px 0;
    transform: translate3d(-105%, 0, 0);
    transition: transform 300ms ease-in-out;
  }

  .sidebar-open .workspace-nav {
    transform: translate3d(0, 0, 0);
  }

  .sidebar-open .nav-overlay {
    display: block;
    background: rgba(15, 26, 44, 0.42);
  }

  .premium-navbar {
    top: 84px;
  }

  .studio-actions {
    justify-content: stretch;
  }

  .stepper {
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(138px, 1fr);
    scroll-snap-type: x mandatory;
  }

  .step-button {
    scroll-snap-align: start;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
  }

  .brand h1 {
    font-size: 0.95rem;
  }

  .topbar-actions {
    width: auto;
  }

  .worker-hero h2 {
    font-size: 2.2rem;
  }

  .sticky-actions {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .premium-navbar {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   IDENTIDAD FINAL — superficies sólidas premium (reemplaza la
   antigua capa "glassmorphism": el translúcido lavaba jerarquía
   y legibilidad, inadecuado para paneles densos de trabajo).
   ============================================================ */
html {
  background: var(--paper);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

h1,
h2,
h3,
.topbar h1,
.panel h2,
.tool-panel h2,
.timeline-panel h2,
.calculator-panel h2,
.chat-panel h2 {
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.glass-card,
.panel,
.tool-panel,
.visual-strip,
.metric,
.case-card,
.mini-case,
.chat-panel,
.calculator-panel,
.timeline-panel,
.session-strip,
.premium-navbar,
.user-dropdown,
.busy-card,
.accordion-card,
.privacy-box,
.compliance-note,
.upload-zone,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.topbar {
  top: 12px;
  width: min(1560px, calc(100% - 24px));
  margin: 12px auto 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--glass-border) !important;
}

.brand-mark {
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: rgba(255,255,255,0.22);
  color: var(--ink);
  box-shadow: none;
  font-family: "Inter", sans-serif;
  font-weight: 300;
}

.eyebrow,
.section-kicker {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.12em;
}

.layout {
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 22px;
  padding-top: 24px;
}

.workspace-nav {
  left: 12px;
  top: 104px;
  padding: var(--space-4);
  color: #fff;
  border: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--navy) 0%, #0a1322 100%);
  box-shadow: var(--shadow-strong);
}

.nav-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 8px 16px;
}

.nav-head strong {
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-head span {
  color: rgba(255, 255, 255, 0.6);
}

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 550;
  transition: background 160ms ease, color 160ms ease;
}

.nav-button.active {
  background: rgba(193, 154, 60, 0.16);
  color: #fff;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-dot {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  box-shadow: none;
}

.nav-button.active .nav-dot {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(193, 154, 60, 0.18);
}

.panel,
.tool-panel,
.chat-panel,
.calculator-panel,
.timeline-panel,
.auth-panel {
  padding: 26px;
}

.panel:hover,
.tool-panel:hover,
.metric:hover,
.case-card:hover,
.accordion-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.055) !important;
  transform: translateY(-4px);
}

.visual-strip.worker-hero {
  position: relative;
  min-height: 260px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--navy);
  box-shadow: var(--shadow-strong);
}

.worker-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
}

.worker-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(15, 28, 51, 0.92) 0%, rgba(15, 28, 51, 0.55) 100%);
}

.worker-hero .visual-content {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: end;
  gap: var(--space-3);
  min-height: 260px;
  padding: clamp(24px, 4vw, 44px);
}

.worker-hero .section-kicker {
  color: var(--gold);
}

.worker-hero h2 {
  max-width: 820px;
  color: #fff;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-transform: none;
}

.worker-hero p:not(.section-kicker) {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
}

.stepper::before {
  top: 25px;
  height: 1px;
  background-image: linear-gradient(90deg, rgba(28,28,30,0.18) 50%, transparent 0);
  background-size: 8px 1px;
  background-color: transparent;
}

.step-button {
  min-height: 68px;
  border: 1px solid var(--glass-border) !important;
  background: rgba(255,255,255,0.34) !important;
  box-shadow: none !important;
  color: var(--muted);
  font-weight: 500;
}

.step-number {
  border: 1px solid rgba(28,28,30,0.22);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.step-button.active {
  background: rgba(255,255,255,0.64) !important;
  color: var(--ink);
}

.step-button.active .step-number {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}

.step-slide {
  animation-duration: 420ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

.field label,
.field span,
.auth-form label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: lowercase;
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.field textarea,
.field select,
.auth-form input,
.chat-compose input,
.doc-output textarea,
.legal-config-control,
.admin-filter,
.official-calc-control,
.doc-control {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.auth-form input:focus,
.chat-compose input:focus,
.doc-output textarea:focus,
.legal-config-control:focus,
.admin-filter:focus,
.official-calc-control:focus,
.doc-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
}

.choice {
  border: 1px solid var(--line);
  background: var(--surface);
}

.primary-button {
  border: 1px solid var(--btn-primary-bg);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
  transition: background 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  border-color: var(--btn-primary-bg-hover);
  background: var(--btn-primary-bg-hover);
  box-shadow: var(--shadow-sm);
}

.primary-button:active {
  transform: translateY(1px);
}

.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
  transition: border-color 160ms ease, background 160ms ease;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--gold);
  background: var(--surface-2);
}

.ghost-button {
  border-color: transparent;
  box-shadow: none;
}

.ghost-button:hover {
  background: var(--surface-2);
}

.metric {
  min-height: 0;
  align-content: end;
  gap: var(--space-2);
  padding: var(--space-5);
}

.metric::after,
.metric-icon {
  display: none;
}

.metric strong {
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.metric span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.premium-calculator {
  background: rgba(255,255,255,0.46) !important;
  color: var(--ink);
}

.premium-calculator .section-kicker,
.premium-calculator .helper-text,
.premium-calculator label,
.premium-calculator span,
.premium-calculator li,
.premium-calculator h2,
.premium-calculator strong {
  color: inherit;
}

.premium-calculator .helper-text,
.premium-calculator label,
.premium-calculator span,
.premium-calculator li {
  color: var(--muted);
}

.premium-calculator .field input,
.premium-calculator .field select,
.range-control input[type="number"] {
  color: var(--ink) !important;
  border-color: #e5e5ea !important;
  background: transparent !important;
}

.range-control {
  grid-template-columns: minmax(120px, 0.35fr) minmax(160px, 1fr);
  align-items: center;
}

.range-control input[type="number"] {
  min-height: 42px;
  padding-left: 0;
  box-shadow: none;
}

.range-control input[type="range"] {
  height: 18px;
  accent-color: var(--gold);
}

.amount-glow,
.premium-calculator .indemnity-breakdown div:nth-child(3) {
  border: 2px solid rgba(201, 168, 76, 0.4) !important;
  background: transparent !important;
  color: var(--ink);
  box-shadow: none;
}

.premium-calculator .amount {
  color: var(--ink);
  font-weight: 200;
}

.indemnity-breakdown div {
  background: rgba(255,255,255,0.28);
  border: 1px solid rgba(255,255,255,0.65);
}

.deadline-chip {
  border: 1px solid rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.32);
}

.deadline-list > li {
  border-left: 4px solid rgba(201,168,76,0.55);
  background: rgba(255,255,255,0.36);
}

.accordion-card {
  border-left: 4px solid rgba(201,168,76,0.72) !important;
}

.accordion-card .accordion-head {
  background: transparent;
}

.timeline {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.timeline::before,
.timeline-item::before {
  display: none !important;
}

.timeline-item {
  grid-template-columns: 18px minmax(0, 1fr);
  flex: 1 1 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.74);
  border-radius: 14px;
  background: rgba(255,255,255,0.3);
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(28,28,30,0.3);
  background: transparent;
}

.timeline-item.done .timeline-dot,
.timeline-item.current .timeline-dot {
  border-color: var(--gold);
  background: var(--gold);
}

.toast {
  border-radius: 16px;
  background: rgba(255,255,255,0.72) !important;
  color: var(--ink);
  transform: translate3d(0, 120%, 0);
}

.toast.show {
  transform: translate3d(0, 0, 0);
}

.sidebar-open .workspace {
  transform: scale(0.98);
  transition: transform 300ms ease;
}

@media (min-width: 1025px) {
  .workspace-nav {
    position: sticky;
    margin-left: 12px;
    align-self: start;
  }

  .metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .official-calculator .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 86px;
  }

  .layout {
    display: block;
    padding: 12px;
  }

  .workspace-nav {
    position: fixed;
    inset: auto 12px 12px 12px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    padding: 8px;
    border-radius: 24px !important;
    transform: none !important;
  }

  .nav-head {
    display: none;
  }

  .nav-button {
    min-height: 54px;
    justify-content: center;
    padding: 8px;
    text-align: center;
  }

  .nav-button.active {
    border-left: 0 !important;
    border-bottom: 2px solid var(--gold) !important;
  }

  .nav-dot {
    display: none;
  }

  .nav-overlay,
  .sidebar-toggle {
    display: none !important;
  }

  .worker-grid,
  .studio-grid {
    display: block;
  }

  .worker-hero h2 {
    font-size: 2.5rem;
  }

  .timeline {
    display: grid;
  }

  .timeline-item {
    flex: none;
  }

  .range-control {
    grid-template-columns: 1fr;
  }

  .panel,
  .tool-panel,
  .chat-panel,
  .calculator-panel,
  .timeline-panel,
  .auth-panel {
    padding: 18px;
  }
}

/* Calculator cleanup: remove slider bars and keep simple editable controls */
.range-control {
  display: block !important;
}

input[type="range"],
.range-control input[type="range"] {
  display: none !important;
}

.premium-calculator .form-grid,
.premium-calculator .calculator-grid {
  align-items: end;
}

.premium-calculator .field {
  min-width: 0;
}

.premium-calculator .field input[type="number"],
.premium-calculator .field input[type="text"],
.premium-calculator .field select,
.official-calc-control,
[data-calc] {
  width: 100%;
  min-height: 46px;
  padding: 8px 0 10px !important;
  border: 0 !important;
  border-bottom: 2px solid #d8dbe2 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ink) !important;
  font-size: 1rem;
  box-shadow: none !important;
}

.premium-calculator .field select,
.official-calc-control:is(select) {
  padding-right: 28px !important;
}

.premium-calculator .field label,
.premium-calculator .field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  line-height: 1.3;
}

.premium-calculator .field strong {
  color: var(--ink);
  font-weight: 700;
}

.official-calculator .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
}

.calculator-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
}

.premium-calculator .field.full {
  grid-column: span 2;
}

@media (max-width: 720px) {
  .premium-calculator .field.full {
    grid-column: 1 / -1;
  }
}

/* Worker portal cleanup: readable hero, sane timeline, no cramped cards */
#workerView .worker-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 18px;
}

#workerView .premium-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: auto;
  padding: 14px 16px;
}

#workerView .worker-hero,
#workerView .visual-strip.worker-hero {
  min-height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  color: var(--ink) !important;
}

#workerView .worker-hero img,
#workerView .worker-hero::after {
  display: none !important;
}

#workerView .worker-hero .visual-content {
  position: relative;
  min-height: auto !important;
  padding: clamp(24px, 4vw, 44px) !important;
  padding-left: clamp(28px, 4vw, 48px) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-lg) !important;
  background:
    radial-gradient(circle at 0% 0%, var(--gold-soft), transparent 42%),
    var(--surface) !important;
  box-shadow: var(--shadow-sm) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: hidden;
}

#workerView .worker-hero .visual-content::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold);
}

#workerView .worker-hero .section-kicker {
  color: var(--gold-2) !important;
}

#workerView .worker-hero h2 {
  max-width: 760px;
  margin: 10px 0 12px;
  color: var(--ink) !important;
  font-size: clamp(1.9rem, 4vw, 3rem) !important;
  font-weight: 700 !important;
  line-height: 1.08 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}

#workerView .worker-hero p:not(.section-kicker) {
  max-width: 760px;
  color: var(--muted) !important;
  font-size: 1rem !important;
}

#workerView .timeline-panel {
  padding: 18px !important;
}

#workerView .timeline {
  display: grid !important;
  gap: 10px !important;
}

#workerView .timeline-item {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr) !important;
  align-items: start;
  min-height: auto !important;
  padding: 10px 12px !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--surface-2) !important;
}

#workerView .timeline-item strong,
#workerView .timeline-item span {
  display: block;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

#workerView .timeline-item strong {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.25;
}

#workerView .timeline-item span:not(.timeline-dot) {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 2px;
}

#workerView .timeline-dot {
  margin-top: 4px;
}

#workerView .stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  overflow-x: auto;
  padding-bottom: 4px;
}

#workerView .step-button {
  min-height: 82px;
  align-content: start;
  gap: 7px;
  padding: 10px;
  text-align: left;
}

#workerView .step-button .step-number {
  width: 26px;
  height: 26px;
  font-size: 0.82rem;
}

#workerView .tool-panel,
#workerView .timeline-panel,
#workerView .calculator-panel,
#workerView .chat-panel,
#workerView .panel {
  border-radius: 18px !important;
}

@media (max-width: 1180px) {
  #workerView .worker-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #workerView .premium-session {
    display: grid;
    gap: 10px;
  }

  #workerView .worker-hero h2 {
    font-size: 2.1rem !important;
  }

  #workerView .stepper {
    grid-template-columns: repeat(6, minmax(118px, 1fr));
  }
}

/* Studio case workflow */
.case-detail-panel {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.case-detail-empty {
  margin-top: 14px;
}

.detail-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  overflow-x: auto;
}

.detail-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
}

.detail-tabs button.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.detail-grid > div,
.mini-deadline-grid > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.detail-grid span,
.mini-deadline-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-grid strong,
.mini-deadline-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-note {
  margin-top: 12px;
  padding: 14px;
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.detail-note p {
  margin: 6px 0 0;
  color: var(--muted);
}

.mini-deadline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.evidence-summary-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.evidence-summary-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.evidence-summary-list small {
  display: block;
  color: var(--muted);
}

.contact-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.contact-actions > * {
  text-decoration: none;
}

.case-actions {
  gap: 8px;
}

.case-actions .secondary-button,
.case-actions select {
  min-height: 38px;
}

@media (max-width: 720px) {
  .case-actions,
  .contact-actions,
  .evidence-summary-list li {
    display: grid;
  }
}

/* Principal lawyer assignment workflow */
.assignment-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.4fr);
  gap: 14px;
  margin-top: 14px;
}

.helper-list,
.assignment-case-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.helper-card,
.assignment-case {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.helper-card strong,
.assignment-case strong {
  display: block;
  color: var(--ink);
}

.helper-card span,
.assignment-case span,
.assignment-case small {
  display: block;
  color: var(--muted);
}

.helper-card p {
  margin: 8px 0 10px;
  color: var(--muted);
}

.assignment-case {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

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

.assignment-actions .secondary-button {
  min-height: 36px;
  padding: 8px 10px;
}

@media (max-width: 900px) {
  .assignment-layout {
    grid-template-columns: 1fr;
  }

  .assignment-actions {
    display: grid;
  }
}

/* Ordered section bars and layout fixes */
.app-section {
  scroll-margin-top: 116px;
}

.section-nav {
  position: sticky;
  top: 92px;
  z-index: 12;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.section-nav a:hover,
.section-nav a:focus-visible {
  border-color: rgba(201, 168, 76, 0.28);
  background: rgba(201, 168, 76, 0.12);
  color: var(--ink);
  transform: translateY(-1px);
}

.studio-section-nav {
  top: 92px;
}

.worker-grid,
.studio-grid {
  align-items: start;
}

.stack {
  min-width: 0;
}

.panel,
.tool-panel,
.chat-panel,
.calculator-panel,
.timeline-panel,
.auth-panel {
  overflow: hidden;
}

.panel:hover,
.tool-panel:hover,
.metric:hover,
.case-card:hover,
.accordion-card:hover {
  transform: translateY(-2px);
}

/* ============================================================
   Toggle de tema (sol/luna) + ajustes finales del sistema
   ============================================================ */
.icon-button {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  line-height: 1;
}

.theme-icon-sun {
  display: none;
  font-size: 1.05rem;
}

.theme-icon-moon {
  display: inline;
  font-size: 1.05rem;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: inline;
}

/* Topbar: sólido y coherente con el sistema en ambos temas */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.brand-mark {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--gold);
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Barra de secciones: pill activa con acento gold */
.section-nav a.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
  font-weight: 600;
}

/* Estado de conexión backend legible en ambos temas */
.api-status,
.api-badge {
  font-variant-numeric: tabular-nums;
}

.case-title {
  gap: 12px;
}

.premium-navbar {
  position: relative;
  top: auto;
  z-index: 5;
  margin-bottom: 16px;
}

.metrics-panel {
  padding: 18px;
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.metric {
  min-height: 130px;
  padding: 18px;
}

.metric strong {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
}

.deadline-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.deadline-chip {
  min-height: 74px;
  align-content: center;
}

.filter-row,
.document-actions,
.inline-actions {
  min-width: 0;
}

.doc-layout {
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
}

.doc-output textarea {
  min-height: 280px;
}

.official-calculator .form-grid,
.calculator-grid {
  gap: 18px;
}

.premium-calculator .indemnity-breakdown {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 1024px) {
  .section-nav {
    top: 86px;
  }

  .doc-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-section {
    scroll-margin-top: 84px;
  }

  .section-nav {
    top: 8px;
    margin: 8px 0 14px;
    padding: 7px;
  }

  .section-nav a {
    padding: 8px 11px;
    font-size: 0.82rem;
  }

  .studio-header,
  .premium-navbar {
    display: grid;
    gap: 12px;
  }

  .metrics-grid,
  .deadline-grid,
  .premium-calculator .indemnity-breakdown {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 104px;
  }
}
