/* Kuotia gestoría portal. One token sheet: light on :root, dark by system
   preference unless the person chose light, or by choice. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --sunken: #eef1f4;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #5d6b7e;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #2e86c1;
  --accent-ink: #1f6fa5;
  --accent-ink-hover: #1a5276;
  --accent-soft: #eaf3fa;
  --on-accent: #ffffff;
  --success: #10b981;
  --success-ink: #067647;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-2: 0 12px 32px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-sheet: -24px 0 48px rgba(16, 24, 40, .12);
  --scrim: rgba(16, 24, 40, .36);
  --mark-ink: #12244a;
  --mark-tint: #1fc2c4;
  color-scheme: light;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 6px;
  --radius-btn: 8px; /* buttons and inputs, shared with the public site */
  --r: 10px;
  --r-lg: 14px;
  --header-h: 60px;
  --tabbar-h: 64px;
  --gutter: 32px;
  --measure: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1019;
    --surface: #12171e;
    --surface-2: #161c24;
    --sunken: #0e1318;
    --ink: #e7ecf2;
    --ink-2: #c3ccd7;
    --muted: #8e9aaa;
    --faint: #5f6b7a;
    --line: #232b35;
    --line-strong: #323c48;
    --accent: #4a9edb;
    --accent-ink: #6cb4e8;
    --accent-ink-hover: #9ccdf1;
    --accent-soft: rgba(46, 134, 193, .16);
    --success-ink: #3dd39e;
    --danger: #f97066;
    --danger-soft: rgba(249, 112, 102, .10);
    --warn: #f5a524;
    --warn-soft: rgba(245, 165, 36, .10);
    --shadow-1: none;
    --shadow-2: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px var(--line);
    --shadow-sheet: -24px 0 48px rgba(0, 0, 0, .45);
    --scrim: rgba(0, 0, 0, .6);
    --mark-ink: #e7ecf2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1019;
  --surface: #12171e;
  --surface-2: #161c24;
  --sunken: #0e1318;
  --ink: #e7ecf2;
  --ink-2: #c3ccd7;
  --muted: #8e9aaa;
  --faint: #5f6b7a;
  --line: #232b35;
  --line-strong: #323c48;
  --accent: #4a9edb;
  --accent-ink: #6cb4e8;
  --accent-ink-hover: #9ccdf1;
  --accent-soft: rgba(46, 134, 193, .16);
  --success-ink: #3dd39e;
  --danger: #f97066;
  --danger-soft: rgba(249, 112, 102, .10);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .10);
  --shadow-1: none;
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px var(--line);
  --shadow-sheet: -24px 0 48px rgba(0, 0, 0, .45);
  --scrim: rgba(0, 0, 0, .6);
  --mark-ink: #e7ecf2;
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss03";
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink); letter-spacing: -0.011em; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.022em; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent-ink-hover); text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
.num, time, td.num { font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.skip-link {
  position: absolute; left: 12px; top: 12px; z-index: 100; transform: translateY(-200%);
  background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--r-sm);
}
.skip-link:focus { transform: none; box-shadow: var(--shadow-2); }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

/* ── Mark ─────────────────────────────────────────────── */
.mark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; font-size: 17px; letter-spacing: -0.02em; }
.mark:hover { text-decoration: none; color: var(--ink); }
.mark .k-mark { width: 26px; height: 26px; flex: none; color: var(--ink); --k-mark-accent: var(--accent); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius-btn);
  border: 1px solid transparent; background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #1f6fa5; color: #fff; border-color: #1f6fa5; }
.btn-primary:hover { background: #1a5276; border-color: #1a5276; color: #fff; }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.btn-secondary:hover { border-color: var(--faint); color: var(--ink); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--accent-ink); padding: 0 10px; }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-ink-hover); }
.btn-danger { border-color: var(--line-strong); color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger-solid { color: #1a0b0a; }
.btn-block { width: 100%; }
.btn-lg { min-height: 46px; font-size: 15px; padding: 0 20px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; font-weight: 500; }
.link-btn:hover { color: var(--accent-ink-hover); text-decoration: underline; text-underline-offset: 3px; }

/* ── Forms ────────────────────────────────────────────── */
.field { display: grid; gap: 6px; margin: 0 0 18px; align-content: start; }
.field > label, .label-row > label, .field-label, fieldset.field > legend { font-size: 14px; font-weight: 550; color: var(--ink); }
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 8px; float: left; width: 100%; }
fieldset.field > legend + * { clear: both; }
.help { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-btn);
  background: var(--surface); color: var(--ink); font-size: 15px; line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 112px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e9aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="file"] { font-size: 14px; max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 550; font-size: 13px; margin-right: 12px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: #1f6fa5; margin: 0; flex: none; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.errorlist, .field-errors { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 13px; font-weight: 500; }
.form-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 18px;
  border: 1px solid var(--danger); border-left-width: 3px; border-radius: var(--r-sm);
  background: var(--danger-soft); color: var(--ink); font-size: 14px;
}
.form-alert .icon { color: var(--danger); margin-top: 1px; }
.form-alert ul { list-style: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { margin-top: 1px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 84px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--accent-ink);
  font-size: 13px; font-weight: 550; cursor: pointer; border-radius: 4px;
}
.password-toggle:hover { background: var(--accent-soft); }

/* Choice groups: Django radio widgets and our own segmented options. */
.choices, .field .choices > div, .field-choices > div { display: flex; flex-wrap: wrap; gap: 8px; }
.field-choices label, .choices label {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface);
  font-size: 14px; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.field-choices label:hover, .choices label:hover { border-color: var(--faint); }
.field-choices label:has(input:checked), .choices label:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft); color: var(--ink);
}
.field-choices.stacked > div { flex-direction: column; align-items: stretch; }
.field-choices.stacked label { width: 100%; }

/* Segmented control (kind of upload, theme). */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px; background: var(--sunken);
  border: 1px solid var(--line);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 6px;
  font-size: 13px; font-weight: 550; color: var(--muted); white-space: nowrap; transition: background-color .15s, color .15s;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--line); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Shell ────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 100%; max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 36px;
}
.topnav { display: flex; align-items: stretch; gap: 4px; height: 100%; }
.topnav a {
  position: relative; display: inline-flex; align-items: center; padding: 0 12px;
  color: var(--muted); font-size: 14px; font-weight: 550;
}
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--ink); }
.topnav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent);
}
.topnav .count { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px 0 4px; border-radius: 8px;
  color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.avatar-btn:hover { background: var(--sunken); }
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 650; text-transform: uppercase;
}
.avatar-btn .who { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 280px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2);
  padding: 6px;
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.menu-head span { font-size: 13px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 6px;
  color: var(--ink); font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--sunken); text-decoration: none; color: var(--ink); }
.menu-item .icon { color: var(--muted); }

.main {
  max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto;
  padding: 28px var(--gutter) 72px;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin-top: 6px; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 14px; }
.back-link:hover { color: var(--ink); text-decoration: none; }

.tabbar { display: none; }

/* ── Surfaces ─────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.panel-pad { padding: 20px 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.panel-head h2 { font-size: 15px; }
.panel-head a { font-size: 13px; font-weight: 550; }
.panel-body { padding: 14px 22px 20px; }
.section { margin-top: 32px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; }
.section-head p { font-size: 13px; color: var(--muted); }
.section-head a { font-size: 13px; font-weight: 550; }
.empty {
  padding: 18px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r);
  color: var(--muted); font-size: 14px;
}
.empty strong { display: block; color: var(--ink-2); font-weight: 550; margin-bottom: 2px; }
.dl { display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: 0; margin: 0; font-size: 14px; }
.dl dt, .dl dd { margin: 0; padding: 11px 0; border-top: 1px solid var(--line); }
.dl dt { color: var(--muted); padding-right: 16px; }
.dl dd { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.dl dt:first-of-type, .dl dt:first-of-type + dd { border-top: 0; }

/* ── State glyph + label ──────────────────────────────── */
.state {
  --glyph: var(--g-dot); --gc: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
}
.state::before {
  content: ""; width: 14px; height: 14px; flex: none; background: var(--gc);
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
}
.state-detail { display: block; font-size: 13px; color: var(--muted); font-weight: 400; white-space: normal; }
:root {
  --g-dot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='black'/%3E%3C/svg%3E");
  --g-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Ccircle cx='12' cy='12' r='7.5'/%3E%3C/svg%3E");
  --g-arc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M12 4.5a7.5 7.5 0 1 1-7.5 7.5'/%3E%3C/svg%3E");
  --g-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l5 5L19.5 7'/%3E%3C/svg%3E");
  --g-check-bold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 1.5a10.5 10.5 0 1 0 0 21 10.5 10.5 0 0 0 0-21Zm5.03 7.78-6 6a1 1 0 0 1-1.41 0l-2.65-2.65a1 1 0 1 1 1.41-1.41l1.94 1.94 5.3-5.3a1 1 0 0 1 1.41 1.42Z'/%3E%3C/svg%3E");
  --g-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/svg%3E");
  --g-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10.3 3.4a2 2 0 0 1 3.4 0l8.2 14.2A2 2 0 0 1 20.2 20.6H3.8a2 2 0 0 1-1.7-3l8.2-14.2ZM12 8.2a1.1 1.1 0 0 0-1.1 1.1v4.4a1.1 1.1 0 1 0 2.2 0V9.3A1.1 1.1 0 0 0 12 8.2Zm0 7.7a1.3 1.3 0 1 0 0 2.6 1.3 1.3 0 0 0 0-2.6Z'/%3E%3C/svg%3E");
  --g-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2.5a5 5 0 0 0-5 5V10H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-1V7.5a5 5 0 0 0-5-5Zm-3 5a3 3 0 1 1 6 0V10H9V7.5Z'/%3E%3C/svg%3E");
  --g-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Crect x='8.5' y='8.5' width='11' height='11' rx='2'/%3E%3Cpath d='M15.5 5.5V5a1.5 1.5 0 0 0-1.5-1.5H6A1.5 1.5 0 0 0 4.5 5v8A1.5 1.5 0 0 0 6 14.5h.5'/%3E%3C/svg%3E");
  --g-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
  --g-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6.5 12h11'/%3E%3C/svg%3E");
  --g-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 18.5v-13M6.5 11 12 5.5l5.5 5.5'/%3E%3C/svg%3E");
}
/* Documents */
.state[data-key="uploading"] { --glyph: var(--g-up); --gc: var(--accent); }
.state[data-key="queued"] { --glyph: var(--g-ring); --gc: var(--faint); }
.state[data-key="uploaded"], .state[data-key="reading"] { --glyph: var(--g-arc); --gc: var(--accent); }
.state[data-key="uploaded"]::before, .state[data-key="reading"]::before { animation: spin 1s linear infinite; }
.state[data-key="received"] { --glyph: var(--g-check); --gc: var(--ink-2); }
.state[data-key="accepted"], .state[data-key="done"], .state[data-key="verified"] { --glyph: var(--g-check-bold); --gc: var(--success); }
.state[data-key="rejected"] { --glyph: var(--g-x); --gc: var(--danger); color: var(--danger); }
/* Upload outcomes */
.state[data-key="duplicate"] { --glyph: var(--g-copy); --gc: var(--ink-2); }
.state[data-key="password_protected"] { --glyph: var(--g-lock); --gc: var(--warn); }
.state[data-key="empty"], .state[data-key="type"], .state[data-key="content"], .state[data-key="too_large"],
.state[data-key="save_failed"], .state[data-key="network"], .state[data-key="server"] { --glyph: var(--g-alert); --gc: var(--danger); color: var(--danger); }
.state[data-key="limit"] { --glyph: var(--g-clock); --gc: var(--warn); }
/* Requests, conversations, representation, engagement */
.state[data-key="open"], .state[data-key="pending"] { --glyph: var(--g-ring); --gc: var(--accent); }
.state[data-key="submitted"] { --glyph: var(--g-clock); --gc: var(--muted); }
.state[data-key="cancelled"], .state[data-key="closed"] { --glyph: var(--g-dash); --gc: var(--faint); color: var(--muted); }
.state[data-key="waiting_gestor"] { --glyph: var(--g-clock); --gc: var(--muted); color: var(--muted); }
.state[data-key="waiting_client"] { --glyph: var(--g-dot); --gc: var(--accent); color: var(--ink); }
.state[data-key="lead"] { --glyph: var(--g-ring); --gc: var(--faint); }
.state[data-key="starting"] { --glyph: var(--g-clock); --gc: var(--accent); }
.state[data-key="active"] { --glyph: var(--g-check-bold); --gc: var(--success); }
.state[data-key="ended"] { --glyph: var(--g-dash); --gc: var(--faint); }
.state[data-key="draft"] { --glyph: var(--g-ring); --gc: var(--warn); }
.state[data-key="internal"] { --glyph: var(--g-lock); --gc: var(--muted); }
/* Operator: something to check that does not block (gestoria/income_check.py) */
.state[data-key="check"] { --glyph: var(--g-alert); --gc: var(--warn); }

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

/* ── Upload: drop bar, rows, tray ─────────────────────── */
.drop {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.drop-zone {
  display: flex; align-items: center; gap: 18px; padding: 14px 14px 14px 20px; min-height: 76px;
  border-radius: inherit; cursor: pointer;
}
.drop-zone .drop-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px;
  border: 1px dashed var(--line-strong); color: var(--accent-ink);
}
.drop-copy { flex: 1; min-width: 0; }
.drop-copy strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.drop-copy > span { display: block; font-size: 13px; color: var(--muted); }
.drop-copy .on-phone { display: none; }
.drop-copy .pick { color: var(--accent-ink); font-weight: 600; }
.drop-controls { display: flex; align-items: center; gap: 12px; flex: none; }
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.drop.is-over .drop-icon { border-style: solid; border-color: var(--accent); }
.drop-note { padding: 0 20px 14px; font-size: 13px; color: var(--muted); }
.drop-alert { margin: 0 14px 14px; }

.uploads { border-top: 1px solid var(--line); }
.uploads-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px;
  font-size: 13px; color: var(--muted);
}
.uploads-head strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.upload-rows { list-style: none; }
.upload-row {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px;
  padding: 11px 20px; border-top: 1px solid var(--line); font-size: 14px;
  animation: row-in .22s ease-out;
}
.upload-row:first-child { border-top: 0; }
.upload-file { min-width: 0; }
.upload-name { display: block; font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-meta { display: block; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.upload-status { text-align: right; min-width: 0; }
.upload-status .state-detail { max-width: 300px; margin-left: auto; }
.upload-actions { display: flex; gap: 4px; justify-content: flex-end; min-width: 64px; }
.upload-actions .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }
.upload-progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent);
  transition: width .2s ease-out, opacity .4s; z-index: 1;
}
.upload-row[data-result]:not([data-result="uploading"]) .upload-progress { opacity: 0; }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
/* Files landing: the same motion as the landing animation (they drop in and settle; the state pops). */
.upload-row.is-landing { animation: row-land .46s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes row-land { 0% { opacity: 0; transform: translateY(-14px) scale(.97); } 60% { opacity: 1; } 100% { opacity: 1; transform: none; } }
.drop.is-landed { animation: drop-land .7s ease-out; }
@keyframes drop-land { 0% { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
.state.is-pop { animation: state-pop .42s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 0 50%; }
.state.is-pop::before { animation: glyph-in .42s ease-out; }
@keyframes state-pop { 0% { transform: scale(.82); opacity: .4; } 100% { transform: none; opacity: 1; } }
@keyframes glyph-in { 0% { transform: scale(.4) rotate(-20deg); } 70% { transform: scale(1.15); } 100% { transform: none; } }

.tray {
  position: fixed; right: 24px; bottom: 24px; z-index: 45; width: min(440px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  overflow: hidden;
}
.tray .uploads { border-top: 0; max-height: 50vh; overflow: auto; }
.tray .uploads-head { border-bottom: 1px solid var(--line); }
.tray .upload-row { grid-template-columns: minmax(0, 1fr) auto; }
.tray .upload-actions { grid-column: 1 / -1; justify-content: flex-start; min-width: 0; }
.tray .upload-actions:empty { display: none; }

.drag-veil {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .15s;
}
.drag-veil.on { opacity: 1; }
.drag-veil-box {
  padding: 28px 40px; border: 2px dashed var(--accent); border-radius: 18px; background: var(--surface);
  text-align: center; box-shadow: var(--shadow-2);
}
.drag-veil-box strong { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.drag-veil-box span { font-size: 14px; color: var(--muted); }

/* ── Inicio ───────────────────────────────────────────── */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 28px; align-items: start; margin-top: 28px; }
.home-side { display: grid; gap: 20px; position: sticky; top: calc(var(--header-h) + 24px); }
.verify {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r);
}
.verify-copy { flex: 1 1 320px; min-width: 0; font-size: 14px; color: var(--ink-2); }
.verify-copy strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.verify-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 14px; color: var(--muted); }
.status-line strong { color: var(--ink); font-weight: 600; }

/* Request cards */
.requests { display: grid; gap: 12px; }
.req { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.req[open] { border-color: var(--line-strong); }
.req > summary { list-style: none; cursor: pointer; }
.req > summary::-webkit-details-marker { display: none; }
.req-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; padding: 16px 20px; }
.req-head h3 { font-size: 15px; font-weight: 600; }
.req-why { grid-column: 1; font-size: 14px; color: var(--muted); }
.req-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 13px; color: var(--muted); }
.req-cta { grid-column: 2; grid-row: 1 / span 3; }
.req[open] .req-cta .when-closed, .req:not([open]) .req-cta .when-open { display: none; }
.req-body { padding: 4px 20px 20px; border-top: 1px solid var(--line); margin: 0 0; }
.req-body > *:first-child { margin-top: 18px; }
.req-body .form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.req-note { font-size: 14px; color: var(--ink-2); margin-bottom: 16px; }
.req-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.req-form-grid .field.wide { grid-column: 1 / -1; }
.req.is-done .req-head h3 { color: var(--ink-2); }
.dropmini {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r);
  background: var(--surface-2); margin-bottom: 18px;
}

/* Quarter */
.quarter-when { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.quarter-date { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.quarter-left { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.track { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin: 18px 0 6px; }
.track li { font-size: 12px; color: var(--muted); padding-top: 9px; position: relative; line-height: 1.3; }
.track li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.track li.past::before, .track li[aria-current="step"]::before { background: var(--accent); box-shadow: none; }
.track li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.quarter-counts { display: flex; gap: 18px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.quarter-counts div { font-size: 12.5px; color: var(--muted); }
.quarter-counts b { display: block; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.quarter-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.quarter-top .state { margin-top: 2px; font-size: 13px; }
/* The quarter's result, as in the landing animation's last frame */
.outcome { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.outcome .quarter-result { list-style: none; margin: 0; padding: 0 16px; }
.outcome .quarter-result li { padding: 13px 0; border-top: 1px solid var(--line); }
.outcome .quarter-result li:first-child { border-top: 0; }
.outcome-name { display: block; font-size: 13px; color: var(--muted); }
.outcome-name small { font-size: 12px; color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.outcome .quarter-result b { display: block; margin-top: 2px; font-size: 19px; font-weight: 600; color: var(--ink); letter-spacing: -0.018em; line-height: 1.25; }
.outcome-detail { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.outcome-foot { margin: 0; padding: 11px 16px 12px; border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink-2); }
.outcome + .track { margin-top: 20px; }

/* Start (lead) */
.start-steps { list-style: none; counter-reset: s; display: grid; gap: 12px; margin: 14px 0 18px; }
.start-steps li { counter-increment: s; display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 14px; color: var(--ink-2); }
.start-steps li::before { content: counter(s); font-size: 13px; font-weight: 650; color: var(--accent-ink); font-variant-numeric: tabular-nums; line-height: 1.55; }

/* Lists of items (recent documents, conversations in side) */
.rows { list-style: none; }
.rows > li { border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.row-link {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center;
  padding: 12px 22px; color: var(--ink);
}
.row-link:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.row-title { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { grid-column: 1; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { grid-column: 2; grid-row: 1 / span 2; text-align: right; }

/* ── Documentos ───────────────────────────────────────── */
.filters { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 28px 0 0; border-bottom: 1px solid var(--line); }
.state-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.state-tabs::-webkit-scrollbar { display: none; }
.state-tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px 12px; font-size: 14px; font-weight: 550; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.state-tabs a:hover { color: var(--ink); text-decoration: none; }
.state-tabs a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.state-tabs .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.filter-selects { display: flex; gap: 8px; padding-bottom: 8px; }
.filter-selects label { display: block; }
.filter-selects select { min-height: 36px; padding: 6px 32px 6px 10px; font-size: 13px; width: auto; background-position: right 8px center; }

.table-wrap { margin-top: 0; }
.doc-table { font-size: 14px; }
.doc-table th {
  text-align: left; font-size: 12px; font-weight: 550; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.doc-table td { padding: 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.doc-table td > a, .doc-table td > span.cell { display: block; padding: 13px 14px; color: inherit; }
.doc-table td > a:hover { text-decoration: none; }
.doc-table tbody tr { transition: background-color .12s; cursor: pointer; }
.doc-table tbody tr:hover { background: var(--surface); }
.doc-table tbody tr.is-current { background: var(--accent-soft); }
.doc-table th:first-child, .doc-table td:first-child > * { padding-left: 4px; }
.doc-table .name { font-weight: 550; color: var(--ink); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-table .name:hover { color: var(--accent-ink); }
.doc-table .meta { color: var(--ink-2); white-space: nowrap; }
.doc-table .state-detail { margin-top: 2px; }
.doc-cards { display: none; }

/* ── Sheet (document detail) ──────────────────────────── */
.sheet-scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); opacity: 0; transition: opacity .2s; }
.sheet-scrim.on { opacity: 1; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(560px, 100vw);
  background: var(--surface); box-shadow: var(--shadow-sheet); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet.on { transform: none; }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 12px 0 22px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-bar span { font-size: 13px; color: var(--muted); }
.sheet-body { overflow: auto; flex: 1; overscroll-behavior: contain; }
.sheet-loading { padding: 40px 22px; color: var(--muted); font-size: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }

.doc-detail { padding: 22px; }
.doc-detail h1 { font-size: 20px; line-height: 1.25; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.doc-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }
.doc-status { margin-top: 16px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.doc-status .state { font-size: 14px; }
.doc-status .state-detail { margin-top: 4px; font-size: 14px; }
.doc-status .btn { margin-top: 12px; }
.preview {
  margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--sunken);
  aspect-ratio: 1 / 1.1; max-height: 62vh; width: 100%;
}
.preview iframe, .preview img { width: 100%; height: 100%; border: 0; object-fit: contain; display: block; background: #fff; }
.preview-file { display: grid; place-items: center; text-align: center; aspect-ratio: auto; padding: 28px 16px; color: var(--muted); font-size: 14px; }
.preview-file strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.doc-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.doc-section h2 { font-size: 15px; margin-bottom: 4px; }
.doc-section > p { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.confirm-delete > summary { list-style: none; display: inline-flex; }
.confirm-delete > summary::-webkit-details-marker { display: none; }
.confirm-delete[open] > summary { display: none; }
.confirm-box { padding: 14px 16px; border: 1px solid var(--danger); border-radius: var(--r); background: var(--danger-soft); font-size: 14px; }
.confirm-box .row-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Mensajes ─────────────────────────────────────────── */
.inbox {
  display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: calc(100vh - var(--header-h) - 140px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden;
}
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.inbox-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.inbox-list-head h2 { font-size: 15px; }
.conv-list { list-style: none; overflow: auto; flex: 1; }
.conv-list a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--ink);
  border-left: 3px solid transparent;
}
.conv-list a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.conv-list a[aria-current="page"] { background: var(--accent-soft); border-left-color: var(--accent); }
.conv-subject { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.conv-topic { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.conv-list .state { grid-column: 1 / -1; font-size: 12.5px; }
.conv-list a.unread .conv-subject::after { content: ""; }
.inbox-empty { padding: 28px 20px; font-size: 14px; color: var(--muted); }
.inbox-main { display: flex; flex-direction: column; min-width: 0; }
.thread-head { padding: 18px 28px 16px; border-bottom: 1px solid var(--line); }
.thread-head h1 { font-size: 20px; line-height: 1.25; letter-spacing: -0.015em; }
.thread-head .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.composer { border-top: 1px solid var(--line); padding: 16px 28px 20px; background: var(--surface); position: sticky; bottom: 0; }
.composer textarea { min-height: 88px; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.composer-bar .hint { font-size: 12.5px; color: var(--muted); }
.attach-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer; }
.attach-btn:hover { background: var(--sunken); }
.attach-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.attach-list { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.attach-list.is-unsent { color: var(--danger); font-weight: 500; }
.new-conv { padding: 24px 28px 28px; max-width: 680px; }
.new-conv h1 { font-size: 20px; letter-spacing: -0.015em; }
.new-conv > p { margin: 6px 0 22px; color: var(--muted); font-size: 14px; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-chips label { position: relative; }
.topic-chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.topic-chips span {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 14px; color: var(--ink-2); transition: border-color .15s, background-color .15s;
}
.topic-chips input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 550; }
.topic-chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.closed-note { padding: 16px 28px 22px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

/* ── Impuestos ────────────────────────────────────────── */
.period { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.period-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px 18px; }
.period-head h2 { font-size: 20px; letter-spacing: -0.015em; }
.period-head p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.period-due { text-align: right; flex: none; }
.period-due span { display: block; font-size: 12.5px; color: var(--muted); }
.period-due strong { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.period .track { margin: 0 24px 20px; }
.filings { border-top: 1px solid var(--line); }
.filing { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 190px; gap: 16px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.filing:last-child { border-bottom: 0; }
.filing-name strong { display: block; font-size: 15px; font-weight: 600; }
.filing-name span { font-size: 13px; color: var(--muted); }
.filing-outcome { font-size: 14px; color: var(--ink-2); }
.filing-outcome b { display: block; font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.filing-end { text-align: right; font-size: 13px; }
.filing-end a { font-weight: 550; }
.filing-receipt { display: inline-flex; align-items: center; gap: 6px; }
.filing-receipt .icon { width: 15px; height: 15px; }
.period-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 24px; background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.period-foot p { font-size: 14px; color: var(--ink-2); max-width: 520px; }
.tax-empty { padding: 22px 24px 24px; border-top: 1px solid var(--line); }
.tax-empty p { font-size: 14px; color: var(--ink-2); max-width: 560px; }
.tax-empty .preview-rows { margin-top: 18px; display: grid; gap: 0; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.tax-empty .preview-rows div { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 16px; font-size: 14px; color: var(--muted); border-top: 1px dashed var(--line); }
.tax-empty .preview-rows div:first-child { border-top: 0; }
.tax-empty .preview-rows b { font-weight: 550; color: var(--ink-2); }

/* ── Mis datos ────────────────────────────────────────── */
.stack { display: grid; gap: 20px; max-width: 760px; }
.panel-section { padding: 20px 22px; }
.panel-section + .panel-section { border-top: 1px solid var(--line); }
.panel-section h2 { font-size: 15px; margin-bottom: 4px; }
.panel-section > p.lead { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.inline-disclosure > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: 14px; font-weight: 550; min-height: 36px; }
.inline-disclosure > summary::-webkit-details-marker { display: none; }
.inline-disclosure > summary .icon { transition: transform .15s; }
.inline-disclosure[open] > summary .icon { transform: rotate(180deg); }
.inline-disclosure .disclosure-body { padding-top: 10px; }

/* ── Toasts (Django messages) ─────────────────────────── */
.toasts { position: fixed; top: calc(var(--header-h) + 14px); right: 20px; z-index: 70; display: grid; gap: 8px; width: min(400px, calc(100vw - 32px)); list-style: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 16px; border-radius: var(--r);
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-2); font-size: 14px; line-height: 1.45;
  animation: toast-in .25s ease-out;
}
.toast p { flex: 1; padding-top: 1px; }
.toast .state { color: inherit; }
.toast::before {
  content: ""; width: 16px; height: 16px; flex: none; margin-top: 2px; background: var(--success);
  -webkit-mask: var(--g-check-bold) center / contain no-repeat; mask: var(--g-check-bold) center / contain no-repeat;
}
.toast[data-level~="error"]::before, .toast[data-level~="warning"]::before { background: #f97066; -webkit-mask-image: var(--g-alert); mask-image: var(--g-alert); }
.toast[data-level~="info"]::before { background: #6cb4e8; -webkit-mask-image: var(--g-dot); mask-image: var(--g-dot); }
.toast button { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; margin: -4px -2px 0 0; }
.toast button:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ── Upload sheet (phone "+ Subir") ───────────────────── */
dialog.bottom-sheet {
  margin: auto auto 0; width: 100%; max-width: 520px; max-height: 90vh; padding: 0; border: 0;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
}
dialog.bottom-sheet::backdrop { background: var(--scrim); }
dialog.bottom-sheet[open] { animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.bs-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 10px auto 4px; }
.bs-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 6px 20px; }
.bs-head h2 { font-size: 17px; }
.bs-body { padding: 6px 20px calc(20px + env(safe-area-inset-bottom)); }
.bs-kind { margin: 6px 0 16px; }
.bs-kind .segmented { width: 100%; }
.bs-kind .segmented label { flex: 1; }
.bs-kind .segmented span { width: 100%; justify-content: center; min-height: 36px; }
.bs-options { display: grid; gap: 8px; }
.bs-option {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; width: 100%;
}
.bs-option:hover { border-color: var(--line-strong); background: var(--surface-2); }
.bs-option .icon { color: var(--accent-ink); width: 22px; height: 22px; }
.bs-option strong { display: block; font-size: 15px; font-weight: 600; }
.bs-option span { display: block; font-size: 13px; color: var(--muted); }
.bs-option input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.bs-mail { margin-top: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.bs-mail p { font-size: 13px; color: var(--muted); }
.bs-mail-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.bs-mail code { flex: 1; min-width: 0; font: 550 14px/1.3 var(--font); color: var(--ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ── Auth ─────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-single { grid-template-columns: 1fr; background: var(--bg); }
.auth-form-col { display: flex; flex-direction: column; padding: 28px 48px 32px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.auth-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 400px; margin: 0 auto; padding: 40px 0; }
.auth-form-wrap h1 { font-size: 30px; letter-spacing: -0.025em; }
.auth-form-wrap .lead { margin: 10px 0 28px; color: var(--muted); font-size: 15px; }
.auth-form-wrap .btn-primary { margin-top: 6px; }
.auth-alt { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.auth-alt a { font-weight: 600; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); max-width: 400px; width: 100%; margin: 0 auto; }
.auth-foot a { color: var(--muted); }
.auth-foot a:hover { color: var(--ink); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-size: 13px; font-weight: 550; }
.proof { list-style: none; display: grid; gap: 8px; margin-top: 28px; }
.proof li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.proof li::before {
  content: ""; width: 14px; height: 14px; flex: none; background: var(--accent);
  -webkit-mask: var(--g-check) center / contain no-repeat; mask: var(--g-check) center / contain no-repeat;
}
.auth-aside {
  background: var(--bg); border-left: 1px solid var(--line); padding: 56px 56px 40px; display: flex; flex-direction: column; justify-content: center;
}
.auth-aside-inner { max-width: 470px; margin: 0 auto; width: 100%; }
.auth-aside h2 { font-size: 34px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 600; }
.auth-aside > .auth-aside-inner > p { margin-top: 14px; font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 440px; }
.sample { margin-top: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.sample .uploads-head { border-bottom: 1px solid var(--line); }
.sample .upload-row { animation: none; grid-template-columns: minmax(0, 1fr) auto; }
.sample-cap { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.auth-card { width: 100%; max-width: 420px; }

/* ── Operator ─────────────────────────────────────────── */
.op .topbar { background: var(--surface); }
.op-tag { font-size: 12px; font-weight: 600; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.queue { font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.queue th { text-align: left; font-size: 12px; font-weight: 550; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.queue th.num, .queue td.num { text-align: right; }
.queue td { padding: 0; border-bottom: 1px solid var(--line); }
.queue tr:last-child td { border-bottom: 0; }
.queue td > a, .queue td > span.cell { display: block; padding: 11px 14px; color: var(--ink); }
.queue td > a:hover { text-decoration: none; }
.queue tbody tr:hover { background: var(--surface-2); }
.queue .client { font-weight: 600; }
.queue .zero, .queue td > span.cell.zero { color: var(--faint); }
.queue .hot { color: var(--ink); font-weight: 650; }
.queue-summary { display: flex; gap: 28px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.queue-summary b { display: block; font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.op-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.op-rail { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; padding-bottom: 8px; }
.op-rail .panel-section { padding: 16px 18px; }
.op-rail .dl { grid-template-columns: 1fr; font-size: 13.5px; }
.op-rail .dl dt { padding: 10px 0 0; border-top: 1px solid var(--line); font-size: 12px; }
.op-rail .dl dd { padding: 2px 0 10px; border-top: 0; }
.op-rail .dl dt:first-of-type { border-top: 0; padding-top: 0; }
.op-source .state-detail { overflow-wrap: anywhere; }
.op-signups { margin: -8px 0 20px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.op-signups > summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; min-height: 44px; padding: 8px 0; cursor: pointer; list-style: none; }
.op-signups > summary::-webkit-details-marker { display: none; }
.op-signups strong { color: var(--ink); font-weight: 650; }
.op-signups-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.op-signups[open] > summary .chev { transform: rotate(180deg); }
.op-signups > summary:focus-visible, .op-signups-table:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.op-signups-body { padding: 12px 0 20px; }
.op-signups .queue-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; }
.op-signups .queue-summary dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.op-signups-note { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.op-signups-breakdowns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.op-signups-table { min-width: 0; overflow-x: auto; }
.op-signups table { table-layout: fixed; width: 100%; font-size: 12px; }
.op-signups caption { text-align: left; font-weight: 600; color: var(--ink); padding: 0 0 8px; }
.op-signups th, .op-signups td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.op-signups thead th { font-weight: 500; color: var(--muted); }
.op-signups td[colspan] { text-align: left; color: var(--muted); }
.op-signups th:first-child { width: 44%; text-align: left; padding-left: 0; overflow-wrap: anywhere; font-weight: 500; }
@media (max-width: 760px) {
  .op-signups .queue-summary { grid-template-columns: 1fr 1fr; }
  .op-signups-breakdowns { grid-template-columns: 1fr; }
  .op-signups th, .op-signups td { padding-right: 4px; padding-left: 4px; }
  .op-signups thead th { font-size: 11px; }
}
@media (max-width: 360px) { .op-signups th:first-child { width: 38%; } }
.op-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.op-table { font-size: 13.5px; }
.op-table th { text-align: left; font-size: 12px; font-weight: 550; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.op-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.op-table tr:last-child td { border-bottom: 0; }
.op-table .actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.op-table .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }
.op-table select { min-height: 32px; padding: 4px 28px 4px 8px; font-size: 13px; width: auto; }
.pop { position: relative; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); }
.op-thread { border-top: 1px solid var(--line); }
.op-thread:first-of-type { border-top: 0; }
.op-thread > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 22px; }
.op-thread > summary::-webkit-details-marker { display: none; }
.op-thread > summary:hover { background: var(--surface-2); }
.note { padding: 12px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.note:first-child { border-top: 0; padding-top: 0; }
.note p + p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.op-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.op-form-grid .field.wide { grid-column: 1 / -1; }
.op-doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.op-doc-grid .preview { aspect-ratio: 1 / 1.3; max-height: calc(100vh - 180px); margin-top: 0; position: sticky; top: calc(var(--header-h) + 20px); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
  .op-grid { grid-template-columns: 1fr; }
  .op-rail { position: static; max-height: none; }
}
@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .home-grid { grid-template-columns: 1fr; }
  .home-side { position: static; }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .op-doc-grid { grid-template-columns: 1fr; }
  .op-doc-grid .preview { position: static; aspect-ratio: 1 / 1.1; }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; --header-h: 56px; }
  body { font-size: 15px; }
  h1 { font-size: 24px; }
  input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea { font-size: 16px; }
  .topbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar-inner { gap: 12px; }
  .topnav { display: none; }
  .avatar-btn .who, .avatar-btn .chev { display: none; }
  .avatar-btn { padding: 0 4px; min-height: 44px; min-width: 44px; justify-content: center; }
  .menu-panel { position: fixed; top: calc(var(--header-h) + 6px); right: 12px; left: 12px; width: auto; }
  .main { padding: 20px var(--gutter) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px;
    font-size: 11px; font-weight: 550; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent-ink); }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar .tab-upload { color: var(--ink); }
  .tabbar .tab-upload .plus { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 9px; background: #1f6fa5; color: #fff; }
  .tabbar .tab-upload .plus .icon { width: 20px; height: 20px; stroke-width: 2.2; }
  .toasts { top: auto; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); right: 16px; left: 16px; width: auto; }
  .tray { left: 12px; right: 12px; width: auto; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }

  .drop-zone { gap: 12px; padding: 12px 12px 12px 14px; min-height: 64px; }
  .drop-zone .drop-icon { width: 36px; height: 36px; }
  .drop-copy strong { font-size: 14px; }
  .drop-copy .desk { display: none; }
  .drop-copy .on-phone { display: block; }
  .drop-controls .segmented { display: none; }
  .drop-note { padding: 0 14px 12px; }
  .upload-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 14px; }
  .upload-actions { grid-column: 1 / -1; justify-content: flex-start; min-width: 0; }
  .upload-actions:empty { display: none; }
  .upload-status .state-detail { max-width: 180px; }
  .uploads-head { padding: 10px 14px; }

  .verify { padding: 14px 14px; }
  .req-head { grid-template-columns: 1fr; padding: 14px 16px; }
  .req-cta { grid-column: 1; grid-row: auto; margin-top: 8px; }
  .req-cta .btn { width: 100%; }
  .req-body { padding: 4px 16px 16px; }
  .req-form-grid { grid-template-columns: 1fr; }
  .row-link { padding: 12px 16px; }
  .panel-head { padding: 16px 16px 0; }
  .panel-body, .panel-pad, .panel-section { padding-left: 16px; padding-right: 16px; }
  .quarter-date { font-size: 26px; }

  .filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 22px; border-bottom: 0; }
  .state-tabs { border-bottom: 1px solid var(--line); order: 2; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .filter-selects { order: 1; padding: 0; }
  .filter-selects label { flex: 1; }
  .filter-selects select { width: 100%; min-height: 44px; font-size: 15px; }
  .table-wrap { display: none; }
  .doc-cards { display: block; list-style: none; margin: 0 calc(-1 * var(--gutter)); }
  .doc-cards a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); color: var(--ink); }
  .doc-cards a:hover { text-decoration: none; background: var(--surface); }
  .doc-cards .name { font-weight: 550; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .doc-cards .meta { grid-column: 1; font-size: 13px; color: var(--muted); }
  .doc-cards .state { grid-column: 1 / -1; margin-top: 4px; }
  .doc-cards .state-detail { grid-column: 1 / -1; }
  .doc-cards .when { grid-column: 2; grid-row: 1; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

  .sheet { width: 100vw; border-left: 0; box-shadow: none; }
  .sheet-bar { height: 56px; padding: 0 8px 0 16px; }
  .doc-detail { padding: 18px 16px 32px; }
  .preview { max-height: 56vh; }

  .inbox { display: block; border: 0; border-radius: 0; box-shadow: none; background: transparent; min-height: 0; margin: 0 calc(-1 * var(--gutter)); }
  .inbox-list { border-right: 0; }
  .inbox-list-head { padding: 0 var(--gutter) 12px; border-bottom: 1px solid var(--line); }
  .inbox-list-head h2 { font-size: 24px; letter-spacing: -0.02em; }
  .conv-list a { padding: 14px var(--gutter); }
  .inbox.has-thread .inbox-list, .inbox.has-new .inbox-list { display: none; }
  .inbox:not(.has-thread):not(.has-new) .inbox-main { display: none; }
  .inbox-main { background: transparent; }
  .thread-head { padding: 0 var(--gutter) 14px; }
  .thread { padding: 18px var(--gutter) 8px; }
  .composer { padding: 12px var(--gutter) 14px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .new-conv { padding: 0 var(--gutter) 24px; }
  .closed-note { padding: 16px var(--gutter); }

  .period-head { flex-direction: column; gap: 10px; padding: 18px 16px 14px; }
  .period-due { text-align: left; }
  .period .track { margin: 0 16px 18px; }
  .filing { grid-template-columns: 1fr auto; padding: 14px 16px; gap: 8px 12px; }
  .filing-outcome { grid-column: 1 / -1; grid-row: 2; }
  .filing-end { grid-column: 2; grid-row: 1; }
  .period-foot { padding: 16px; }
  .tax-empty { padding: 18px 16px 20px; }

  .dl { grid-template-columns: 1fr; }
  .dl dt { padding: 12px 0 0; }
  .dl dd { padding: 2px 0 12px; border-top: 0; }

  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-form-col { padding: 16px 20px 24px; }
  .auth-form-wrap { justify-content: flex-start; padding: 32px 0 24px; }
  .auth-form-wrap h1 { font-size: 26px; }
  .auth-form-wrap .lead { margin-bottom: 22px; }

  .queue-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .queue { min-width: 720px; }
  .op-form-grid { grid-template-columns: 1fr; }
  .op-table-wrap { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .state[data-key="uploaded"]::before, .state[data-key="reading"]::before { --glyph: var(--g-clock); animation: none !important; }
}

/* Small panel parts */
.panel-head + .rows { margin-top: 8px; }
.panel-foot { padding: 12px 22px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.panel-note { margin-top: 14px; font-size: 13px; color: var(--muted); }
.panel-action { margin-top: 12px; }
.verify-change[open] { flex-basis: 100%; }
.verify-change .disclosure-body form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; max-width: 560px; }
.verify-change .field { flex: 1 1 240px; margin: 0; }
@media (max-width: 760px) { .panel-foot { padding: 12px 16px 14px; } }
.list-foot { margin-top: 14px; font-size: 13px; color: var(--muted); }
.list-empty { margin-top: 24px; }
.list-empty a { font-weight: 550; }
.doc-page { max-width: 760px; }
.doc-convs { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.doc-convs .row-link { padding: 10px 14px; }
.phone-only { display: none; }
.title-lg { font-size: 20px; letter-spacing: -0.015em; }
@media (max-width: 760px) { .phone-only { display: inline-flex; } }
.stack-wide { display: grid; gap: 20px; max-width: 880px; }
.filing-outcome span { display: block; font-size: 13px; color: var(--muted); }
.filing-csv { display: block; margin-top: 2px; }
.panel-section.split { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-section.split .lead { margin-bottom: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; max-width: 560px; }
.inline-form .field { flex: 1 1 240px; margin: 0; }
.form-help { margin: -4px 0 16px; }
.panel-section .dl { margin-bottom: 6px; }
.proof-phone { display: none; }
.sample-static::before { animation: none !important; }
@media (max-width: 760px) { .proof-phone { display: grid; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); } }
.stack-flow { display: grid; gap: 20px; min-width: 0; }
.pop-wide { width: 420px; }
.op-table .name-cell { font-weight: 550; display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.op-table .answer div { font-size: 13px; }
.op-table .answer .muted { margin-right: 6px; }
.panel-head + .op-table-wrap, .panel-head + .op-threads { margin-top: 12px; }
.op-threads { border-top: 1px solid var(--line); }
.op-thread > summary .conv-topic { font-size: 12.5px; color: var(--muted); }
.op-thread > summary .conv-topic .state { font-size: 12.5px; }
.panel-disclosure > summary { list-style: none; cursor: pointer; padding-bottom: 18px; align-items: center; }
.panel-disclosure > summary::-webkit-details-marker { display: none; }
.panel-disclosure[open] > summary .btn { display: none; }
.form-help-top { margin-bottom: 14px; }
.notes { margin-bottom: 8px; }
.reject-form { margin-top: 16px; }
.title-doc { font-size: 22px; overflow-wrap: anywhere; }
.op-rail h2 { margin-bottom: 10px; }
.op-rail .lead { margin: -6px 0 10px; color: var(--muted); }
.stack.narrow { max-width: 520px; }
.legal { max-width: 760px; } .legal p + p { margin-top: 12px; }
/* The hoja de encargo in the portal: the client's data, then the published text (carta_encargo.html) */
.hoja-parties { margin: 18px 0 8px; padding: 14px 16px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.hoja-parties h2 { font-size: 15px; margin: 0 0 4px; }
.legal-text { margin-top: 20px; font-size: 15px; line-height: 1.6; color: var(--ink); }
.legal-text h2 { font-size: 17px; margin: 28px 0 8px; letter-spacing: -0.01em; scroll-margin-top: 80px; }
.legal-text h2.annex { font-size: 19px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.legal-text p + p, .legal-text p + ul, .legal-text p + ol, .legal-text ul + p, .legal-text ol + p { margin-top: 10px; }
.legal-text ul, .legal-text ol { padding-left: 20px; display: grid; gap: 6px; }
.legal-text a { overflow-wrap: anywhere; }
.legal-text .table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; }
.legal-text table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
.legal-text th, .legal-text td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-text thead th { background: var(--surface-2); font-weight: 600; }
.legal-text tr:last-child td { border-bottom: 0; }
/* Documents list in a panel on desktop */
.doc-list { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.doc-list.is-empty:not(:has(.filters)) { background: none; border: 0; box-shadow: none; }
.doc-list .filters { margin: 0; padding: 6px 16px 0 10px; }
.doc-list .list-empty { margin: 20px; }
.doc-list .list-foot { margin: 0; padding: 12px 20px 14px; border-top: 1px solid var(--line); }
.doc-table col.c-kind { width: 150px; }
.doc-table col.c-period { width: 96px; }
.doc-table col.c-state { width: 300px; }
.doc-table col.c-date { width: 120px; }
.doc-table th:first-child, .doc-table td:first-child > * { padding-left: 20px; }
.doc-table th:last-child, .doc-table td:last-child > * { padding-right: 20px; }
.doc-table .r { text-align: right; }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table tbody tr:hover { background: var(--surface-2); }
.doc-table .name { max-width: none; }
.doc-table td:first-child { max-width: 0; }
@media (max-width: 760px) {
  .page-head p { display: none; }
  .filter-selects label { min-width: 0; }
  .doc-list { background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; margin-top: 20px; }
  .doc-list .filters { padding: 0; }
  .doc-list .list-foot { padding: 12px 0; border-top: 0; }
  .doc-list .list-empty { margin: 0; }
}
/* Inbox as an app pane on desktop: list and thread scroll inside, composer always visible. */
@media (min-width: 761px) {
  .inbox { height: calc(100vh - var(--header-h) - 56px); min-height: 520px; }
  .inbox-main { min-height: 0; overflow: hidden; }
  .inbox-list { min-height: 0; }
  .thread { overflow: auto; min-height: 0; }
  .new-conv { overflow: auto; flex: 1; max-width: none; }
  .new-conv form, .new-conv > p { max-width: 680px; }
  .new-conv textarea { min-height: 160px; }
  .composer { position: static; }
}
@media (max-width: 760px) {
  .inbox { overflow: visible; }
}
.stack-flow { grid-template-columns: minmax(0, 1fr); }
.op-table td:nth-child(2) { white-space: nowrap; }
.op-table .actions { flex-wrap: nowrap; }
.op-table .state-detail { max-width: 240px; }
.income-checks { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; }
.income-checks li { min-width: 0; }
.income-checks .state { white-space: normal; }
.help ul { margin: 2px 0 0; padding-left: 16px; display: grid; gap: 1px; }
.doc-list.is-empty:not(:has(.filters)) .list-empty { margin: 0; }
.new-conv textarea { height: 9.5em; }
@media (min-width: 761px) { .new-conv textarea { height: 180px; } }
a.op-tag:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 760px) {
  .op .main { padding-bottom: 48px; }
}

.drop-alert { border-color: var(--warn); background: var(--warn-soft); }
.drop-alert .icon { color: var(--warn); }
.field .dropmini { margin-bottom: 0; }
/* Hidden file inputs show their focus on the visible control. */
.drop:has(input[type="file"]:not([data-camera]):focus-visible) .drop-pick,
.drop-camera:has(input[type="file"]:focus-visible),
.bs-option:has(input[type="file"]:focus-visible),
.attach-btn:has(input[type="file"]:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Inbound email: operator review and the client's "not kept" list. */
.mail-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 14px; }
.mail-strip a { font-weight: 550; }
.mail-table td:nth-child(2) { white-space: normal; min-width: 180px; }
.mail-table .state-detail { max-width: 300px; }
.mail-table .mail-subject { color: var(--ink-2); }
.mail-file + .mail-file { margin-top: 6px; }
.mail-file .state { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-body { margin-top: 6px; font-size: 13px; }
.mail-body summary { cursor: pointer; color: var(--accent-ink); font-weight: 550; }
.mail-body p { margin-top: 6px; max-width: 420px; color: var(--ink-2); white-space: normal; overflow-wrap: anywhere; }
.email-rejections { margin-top: 24px; }
.email-rejections .row-link { cursor: default; }
.email-rejections .row-reason { grid-column: 1 / -1; margin-top: 4px; font-size: 13px; }
.email-rejections .row-reason .state { white-space: normal; }
@media (max-width: 760px) {
  .mail-table, .mail-table tbody, .mail-table tr, .mail-table td { display: block; width: 100%; }
  .mail-table thead { display: none; }
  .mail-table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .mail-table tr:last-child { border-bottom: 0; }
  .mail-table td, .mail-table tr:last-child td { padding: 3px 0; border: 0; }
  .mail-table td:nth-child(2) { min-width: 0; }
  .mail-table td:nth-child(3), .mail-table td:last-child:not(:empty) { padding-top: 10px; }
  .op-table.mail-table .actions { justify-content: flex-start; flex-wrap: wrap; }
  .mail-table .state-detail, .mail-file .state, .mail-body p { max-width: none; }
}
.doc-table td > a.name:has(+ .via) { padding-bottom: 1px; }
.doc-table td > .via { margin-top: 0; padding-top: 0; padding-bottom: 12px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Polish round: Inicio order and lead card */
.home-main { display: grid; gap: 28px; align-content: start; min-width: 0; }
.home-main > .section { margin-top: 0; }
.start-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.start-head h2 { font-size: 17px; }
.start-head p { margin-top: 4px; }
.start-card .start-steps { margin: 16px 0 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.start-card .start-steps li { grid-template-columns: 1fr; gap: 4px; }
.quarter-scope { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.quarter-scope + .quarter-counts { margin-top: 6px; padding-top: 0; border-top: 0; }
@media (max-width: 900px) {
  .home-grid { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
  .home-main, .home-side { display: contents; }
  .o-1 { order: 1; } .o-2 { order: 2; } .o-3 { order: 3; } .o-4 { order: 4; } .o-5 { order: 5; }
  .start-head { flex-direction: column; gap: 14px; }
  .start-head form, .start-head .btn { width: 100%; }
  .start-card .start-steps { grid-template-columns: 1fr; gap: 10px; }
  .start-card .start-steps li { grid-template-columns: 22px 1fr; gap: 10px; }
}
/* Upload rows: a constant right edge whatever the action label */
.upload-row { grid-template-columns: minmax(0, 1fr) auto 10rem; }
.upload-actions { min-width: 0; justify-content: flex-end; }
.tray .upload-row { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 760px) { .upload-row { grid-template-columns: minmax(0, 1fr) auto; } }
.composer-bar .hint { margin-left: auto; }
@media (max-width: 760px) { .composer-bar .hint { display: none; } }
/* Operator: request answers, rail, phone tables, anchors */
.answer-list { margin: 0; font-size: 13px; display: grid; gap: 0; }
.answer-list dt { color: var(--muted); font-size: 12px; margin-top: 6px; }
.answer-list dt:first-child { margin-top: 0; }
.answer-list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.op-rail { position: static; max-height: none; overflow: visible; }
.op-grid { grid-template-columns: minmax(0, 1fr) 360px; }
.op-thread, [id^="solicitud-"], .panel[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
@media (max-width: 1100px) {
  .op-grid { grid-template-columns: minmax(0, 1fr); }
}
.op-table-wrap, .queue-wrap { position: relative; } /* contain absolutely placed sr-only headers inside the scroller */
.op-table-wrap { overflow-x: auto; max-width: 100%; }
/* Document detail: actions above a capped preview so both fit at 768px high */
.doc-detail .doc-actions { margin-top: 14px; }
.doc-detail .preview { margin-top: 14px; aspect-ratio: auto; height: 44vh; max-height: none; }
.doc-detail .preview-file { height: auto; }
@media (max-width: 760px) { .doc-detail .preview { height: 52vh; } }
.no-placeholder input::placeholder { color: transparent; }
@media (min-width: 761px) { .toasts { top: auto; bottom: 24px; right: 24px; } }
.drop-zone { padding-right: 20px; }
.bs-mail code { font-size: 13px; letter-spacing: -0.01em; }
@media (max-width: 760px) { .drop-zone { padding-right: 12px; } }
/* Cola: six calm columns */
.queue { table-layout: fixed; }
.queue col.q-docs { width: 120px; } .queue col.q-req { width: 130px; } .queue col.q-msg { width: 170px; }
.queue col.q-fil { width: 210px; } .queue col.q-due { width: 130px; }
.queue td { vertical-align: top; }
.queue td > a.client { display: grid; gap: 3px; }
.queue .q-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue td > a.client .state { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.queue .q-main { display: block; color: var(--ink); }
.queue .zero { display: block; }
.queue .q-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.queue .q-sub.hot { color: var(--ink); font-weight: 600; }
.queue .q-fil { display: grid; gap: 4px; }
.queue .q-fil { justify-items: start; }
.queue .q-fil .state { white-space: nowrap; font-size: 12.5px; }
.mail-strip { border-color: var(--warn); background: var(--warn-soft); }
/* Operator fiscal screens */
.op-table th.num, .op-table td.num { text-align: right; }
.panel-section ul:not(.access-log):not(.rows) { padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.panel:not(.panel-pad) > .track { margin: 20px 22px 4px; }
#impuestos > .panel-head { flex-wrap: wrap; align-items: center; }
#impuestos > .panel-head > .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
#impuestos > .panel-head form.actions { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
#impuestos > .panel-head select { width: auto; min-height: 36px; padding: 6px 32px 6px 10px; font-size: 13px; }
#impuestos > .panel-body { border-top: 1px solid var(--line); margin-top: 14px; }
#impuestos > .panel-body + .op-table-wrap { margin-top: 0; }
#impuestos .panel-body > p strong { font-size: 15px; }
#impuestos .panel-body > p .state { margin-left: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
/* Lead start card steps align at the top */
.start-card .start-steps li { align-content: start; }
.track li.next::before { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 10px); box-shadow: none; }
.track li.next { color: var(--ink); font-weight: 600; }
.thread-empty { list-style: none; max-width: 520px; padding: 16px 18px; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--ink-2); font-size: 14px; }
@media (max-width: 760px) {
  .queue-wrap { overflow: visible; margin: 0; padding: 0; }
  .queue { min-width: 0; table-layout: auto; }
  .queue colgroup, .queue thead { display: none; }
  .queue, .queue tbody, .queue tr, .queue td { display: block; width: 100%; }
  .queue tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .queue tr:last-child { border-bottom: 0; }
  .queue td, .queue tr:last-child td { border: 0; padding: 0; }
  .queue td:first-child { grid-column: 1 / -1; }
  .queue td > a, .queue td > span.cell { padding: 0; }
  .queue td.num, .queue td.num .cell { text-align: left; }
  .queue td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
  .queue .q-email { white-space: normal; overflow-wrap: anywhere; }
}
.mail-table .actions { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; }
.mail-table td:last-child { width: 1%; }
@media (max-width: 760px) { .mail-table .actions { flex-direction: row; align-items: center; } }
@media (max-width: 760px) { .inbox:not(.has-thread) .conv-list a[aria-current] { background: none; border-left-color: transparent; } }

/* ═══════════════════════════════════════════════════════════
   D4 visual layer: depth, category families, thumbnails, chips,
   provenance, the quarter hero and the document sheet.
   Reference: Qonto (rows, side panel), Pennylane (category tiles),
   Revolut Business (hero card). Same tokens, light and dark.
   ═══════════════════════════════════════════════════════════ */
:root {
  --bg: #f3f5f8;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px -8px rgba(16, 24, 40, .08);
  --shadow-lift: 0 2px 4px rgba(16, 24, 40, .05), 0 14px 32px -12px rgba(16, 24, 40, .16);
  --r-xl: 18px;
  --hero-bg: #0f2341;
  --hero-glow: rgba(74, 158, 219, .30);
  --hero-ink: #ffffff;
  --hero-ink-2: rgba(226, 236, 248, .74);
  --hero-line: rgba(255, 255, 255, .12);
  --hero-panel: rgba(255, 255, 255, .06);
  --hero-rail: rgba(255, 255, 255, .16);
  --hero-accent: #62b6ee;
  --success-soft: #e9f9f1;
  --chip-neutral: #f0f2f5;
  --paper: #ffffff;
  --fam-income: #1f6fa5; --fam-income-bg: #e6f0f9; --fam-income-bar: #2e86c1;
  --fam-tech: #4351c4; --fam-tech-bg: #eceefc; --fam-tech-bar: #6875e2;
  --fam-place: #a35700; --fam-place-bg: #fdf0dc; --fam-place-bar: #f0a432;
  --fam-travel: #0b6f65; --fam-travel-bg: #e0f3f0; --fam-travel-bar: #22a596;
  --fam-services: #b22350; --fam-services-bg: #fcebf0; --fam-services-bar: #df5a83;
  --fam-fees: #475467; --fam-fees-bg: #edf0f4; --fam-fees-bar: #8b97aa;
  --fam-doc: #586678; --fam-doc-bg: #eff2f6; --fam-doc-bar: #c2c9d4;
  --fam-pending: #6b7689; --fam-pending-bg: #f1f3f6; --fam-pending-bar: #dde2e9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1019;
    --shadow-1: none;
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lift: 0 18px 40px -12px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-strong);
    --hero-bg: #12233b;
    --hero-glow: rgba(74, 158, 219, .22);
    --hero-line: rgba(255, 255, 255, .09);
    --hero-panel: rgba(255, 255, 255, .045);
    --success-soft: rgba(16, 185, 129, .13);
    --chip-neutral: rgba(148, 163, 184, .12);
    --paper: #e9edf2;
    --fam-income: #7fc1ee; --fam-income-bg: rgba(74, 158, 219, .16); --fam-income-bar: #4a9edb;
    --fam-tech: #a9b2fb; --fam-tech-bg: rgba(129, 140, 248, .15); --fam-tech-bar: #7c87ee;
    --fam-place: #f4b65c; --fam-place-bg: rgba(245, 165, 36, .14); --fam-place-bar: #d99230;
    --fam-travel: #5fd3c3; --fam-travel-bg: rgba(45, 212, 191, .13); --fam-travel-bar: #26a797;
    --fam-services: #f59bb5; --fam-services-bg: rgba(244, 114, 152, .14); --fam-services-bar: #d65a80;
    --fam-fees: #b6c1d0; --fam-fees-bg: rgba(148, 163, 184, .14); --fam-fees-bar: #77849a;
    --fam-doc: #a6b1c0; --fam-doc-bg: rgba(148, 163, 184, .10); --fam-doc-bar: #4b5668;
    --fam-pending: #8794a6; --fam-pending-bg: rgba(148, 163, 184, .08); --fam-pending-bar: #323c4a;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1019;
  --shadow-1: none;
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, .02);
  --shadow-lift: 0 18px 40px -12px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-strong);
  --hero-bg: #12233b;
  --hero-glow: rgba(74, 158, 219, .22);
  --hero-line: rgba(255, 255, 255, .09);
  --hero-panel: rgba(255, 255, 255, .045);
  --success-soft: rgba(16, 185, 129, .13);
  --chip-neutral: rgba(148, 163, 184, .12);
  --paper: #e9edf2;
  --fam-income: #7fc1ee; --fam-income-bg: rgba(74, 158, 219, .16); --fam-income-bar: #4a9edb;
  --fam-tech: #a9b2fb; --fam-tech-bg: rgba(129, 140, 248, .15); --fam-tech-bar: #7c87ee;
  --fam-place: #f4b65c; --fam-place-bg: rgba(245, 165, 36, .14); --fam-place-bar: #d99230;
  --fam-travel: #5fd3c3; --fam-travel-bg: rgba(45, 212, 191, .13); --fam-travel-bar: #26a797;
  --fam-services: #f59bb5; --fam-services-bg: rgba(244, 114, 152, .14); --fam-services-bar: #d65a80;
  --fam-fees: #b6c1d0; --fam-fees-bg: rgba(148, 163, 184, .14); --fam-fees-bar: #77849a;
  --fam-doc: #a6b1c0; --fam-doc-bg: rgba(148, 163, 184, .10); --fam-doc-bar: #4b5668;
  --fam-pending: #8794a6; --fam-pending-bg: rgba(148, 163, 184, .08); --fam-pending-bar: #323c4a;
}
.fam-income { --fi: var(--fam-income); --fb: var(--fam-income-bg); --fbar: var(--fam-income-bar); }
.fam-tech { --fi: var(--fam-tech); --fb: var(--fam-tech-bg); --fbar: var(--fam-tech-bar); }
.fam-place { --fi: var(--fam-place); --fb: var(--fam-place-bg); --fbar: var(--fam-place-bar); }
.fam-travel { --fi: var(--fam-travel); --fb: var(--fam-travel-bg); --fbar: var(--fam-travel-bar); }
.fam-services { --fi: var(--fam-services); --fb: var(--fam-services-bg); --fbar: var(--fam-services-bar); }
.fam-fees { --fi: var(--fam-fees); --fb: var(--fam-fees-bg); --fbar: var(--fam-fees-bar); }
.fam-doc { --fi: var(--fam-doc); --fb: var(--fam-doc-bg); --fbar: var(--fam-doc-bar); }
.fam-pending { --fi: var(--fam-pending); --fb: var(--fam-pending-bg); --fbar: var(--fam-pending-bar); }

/* Surfaces get gentle depth */
.panel, .req, .period, .drop { box-shadow: var(--shadow-card); }
.panel { border-radius: var(--r-xl); }
h1 { font-size: 30px; letter-spacing: -0.026em; font-weight: 650; }
.page-head { margin-bottom: 24px; }
.page-head p { font-size: 15px; }
.btn { transition: background-color .15s, border-color .15s, color .15s, transform .12s, box-shadow .15s; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary { box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-light { background: #ffffff; color: #0f2341; border-color: #ffffff; }
.btn-light:hover { background: #e7f1fa; border-color: #e7f1fa; color: #0f2341; }
.topnav a { border-radius: 8px; }
.panel-head h2, .section-head h2 { font-size: 16px; letter-spacing: -0.012em; }
.panel-head a { display: inline-flex; align-items: center; gap: 2px; }
.panel-head a .icon { width: 14px; height: 14px; }

/* Status chips: glyph + word on a soft tint (never colour alone) */
.state.chip { padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--chip-neutral); font-size: 12.5px; line-height: 1.35; gap: 5px; }
.state.chip::before { width: 13px; height: 13px; }
.state.chip[data-key="accepted"], .state.chip[data-key="done"], .state.chip[data-key="verified"], .state.chip[data-key="active"] { background: var(--success-soft); color: var(--success-ink); }
.state.chip[data-key="reading"], .state.chip[data-key="uploaded"], .state.chip[data-key="open"], .state.chip[data-key="waiting_client"] { background: var(--accent-soft); color: var(--accent-ink); }
.state.chip[data-key="rejected"] { background: var(--danger-soft); color: var(--danger); }
.state.chip[data-key="received"] { color: var(--ink-2); }

/* Provenance badge */
.prov {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 550; white-space: nowrap; line-height: 1.5;
}
.prov .icon { width: 13px; height: 13px; stroke-width: 1.9; color: var(--muted); }
.prov[data-key="stripe"] .icon { color: #635bff; }
:root[data-theme="dark"] .prov[data-key="stripe"] .icon { color: #a5a0ff; }
.prov[data-key="email"] .icon, .prov[data-key="mobile"] .icon { color: var(--accent-ink); }

/* Category tile and inline category */
.cat-tile { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--fb); color: var(--fi); }
.cat-tile .icon { width: 18px; height: 18px; stroke-width: 1.7; }
.cat-inline { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); min-width: 0; }
.cat-inline .icon { width: 14px; height: 14px; color: var(--fi); stroke-width: 1.8; }
.dot-sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 7px; vertical-align: middle; flex: none; }

/* Thumbnails: the real first page or photo, on a file tile */
.thumb {
  position: relative; display: block; width: 40px; height: 52px; flex: none; border-radius: 6px; overflow: hidden;
  background: var(--fb); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(16, 24, 40, .06);
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: var(--paper); z-index: 1; }
.thumb-tile { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--fi); }
.thumb-tile .icon { width: 18px; height: 18px; stroke-width: 1.7; }
.thumb-ext { font-size: 8.5px; font-weight: 700; letter-spacing: .04em; opacity: .85; }
:root[data-theme="dark"] .thumb img { filter: brightness(.9) contrast(1.02); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thumb img { filter: brightness(.9) contrast(1.02); } }

/* ── Inicio dashboard ─────────────────────────────────── */
.greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.greet h1 { font-size: 30px; }
.greet p { margin-top: 4px; color: var(--muted); font-size: 15px; }
.greet-actions { display: flex; gap: 10px; flex: none; }
.verify { align-items: center; border-left: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-card); }
.verify-tile { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); flex: none; }

.dash-top { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: stretch; margin-bottom: 20px; }
.hero {
  position: relative; display: flex; flex-direction: column; gap: 20px; padding: 24px 26px 22px; border-radius: var(--r-xl);
  background: radial-gradient(120% 130% at 100% 0%, var(--hero-glow), transparent 58%), var(--hero-bg);
  color: var(--hero-ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 18px 40px -18px rgba(15, 35, 65, .55);
  overflow: hidden; isolation: isolate;
}
.hero::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; z-index: -1;
  border: 1px solid var(--hero-line); box-shadow: 0 0 0 36px rgba(255, 255, 255, .015), 0 0 0 72px rgba(255, 255, 255, .012);
}
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hero-kicker { font-size: 13.5px; font-weight: 500; color: var(--hero-ink-2); letter-spacing: 0; }
.hero-title { margin-top: 6px; font-size: 27px; line-height: 1.15; font-weight: 650; letter-spacing: -0.024em; color: var(--hero-ink); }
.hero h2, .hero h3 { color: inherit; }
.hero-due { text-align: right; display: grid; gap: 2px; justify-items: end; flex: none; }
.hero-due-label { font-size: 12.5px; color: var(--hero-ink-2); }
.hero-due strong { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.hero-due-left { margin-top: 4px; padding: 2px 9px; border-radius: 999px; background: var(--hero-panel); border: 1px solid var(--hero-line); font-size: 12px; color: var(--hero-ink); }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 9px; border-radius: 999px; background: rgba(16, 185, 129, .18); color: #7ce8bf; font-size: 13px; font-weight: 600; flex: none; }
.hero-badge .icon { stroke-width: 2.4; }
.hero-result { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.hero-result li { padding: 14px 16px 15px; border-radius: 14px; background: var(--hero-panel); border: 1px solid var(--hero-line); }
.hero-result .outcome-name { color: var(--hero-ink-2); font-size: 13px; }
.hero-result .outcome-name small { color: var(--hero-ink-2); opacity: .75; margin-left: 4px; font-size: 12px; }
.hero-result b { display: block; margin-top: 4px; font-size: 23px; font-weight: 650; letter-spacing: -0.022em; line-height: 1.2; color: var(--hero-ink); }
.hero-result .outcome-detail { display: block; margin-top: 4px; color: var(--hero-ink-2); font-size: 12.5px; }
.hero-track { margin: 0; }
.hero-track li { color: var(--hero-ink-2); font-size: 12.5px; padding-top: 11px; }
.hero-track li::before { height: 5px; border-radius: 3px; background: var(--hero-rail); box-shadow: none; }
.hero-track li.past::before, .hero-track li[aria-current="step"]::before { background: var(--hero-accent); }
.hero-track li.next::before { background: repeating-linear-gradient(90deg, var(--hero-accent) 0 7px, transparent 7px 11px); }
.hero-track li[aria-current="step"] { color: var(--hero-ink); }
.hero-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--hero-line); }
.hero-foot p { font-size: 14px; color: var(--hero-ink-2); max-width: 52ch; }
.hero-foot .btn { flex: none; }
.hero a:not(.btn) { color: var(--hero-accent); }
.hero-steps { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hero-steps li { counter-increment: s; padding: 14px 16px; border-radius: 14px; background: var(--hero-panel); border: 1px solid var(--hero-line); display: grid; gap: 4px; font-size: 13px; color: var(--hero-ink-2); }
.hero-steps li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(98, 182, 238, .18); color: var(--hero-accent); font-weight: 650; font-size: 12.5px; margin-bottom: 6px; }
.hero-steps b { color: var(--hero-ink); font-size: 14px; font-weight: 600; }

.overview { display: flex; flex-direction: column; gap: 18px; padding: 20px 22px; }
.overview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.overview-head h2 { font-size: 16px; }
.ov-money { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ov-fig { display: grid; gap: 4px; padding: 14px 14px 13px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.ov-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.ov-label .icon { width: 14px; height: 14px; color: var(--fam-income); stroke-width: 2; }
.ov-exp .ov-label .icon { color: var(--fam-place); }
.ov-fig b { font-size: 20px; font-weight: 650; letter-spacing: -0.022em; line-height: 1.25; white-space: nowrap; }
.ov-bar { display: block; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; margin-top: 4px; }
.ov-bar i { display: block; height: 100%; border-radius: inherit; background: var(--fam-income-bar); transform-origin: left; animation: bar-grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.ov-exp .ov-bar i { background: var(--fam-place-bar); }
.ov-sub { font-size: 12px; color: var(--muted); }
.ov-docs { display: grid; gap: 10px; }
.ov-docs-head { font-size: 13px; color: var(--ink-2); }
.ov-docs-head b { font-size: 15px; color: var(--ink); font-weight: 650; }
.ov-stack { display: flex; gap: 3px; height: 10px; }
.ov-stack i { display: block; min-width: 6px; border-radius: 3px; background: var(--fbar); animation: bar-grow .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
.ov-legend { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.ov-legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.ov-legend li i { width: 8px; height: 8px; border-radius: 2px; background: var(--fbar); flex: none; }
.ov-legend li span { flex: 1; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-legend li b { font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: none; } }
.ov-empty, .panel-empty { display: grid; justify-items: start; gap: 12px; padding: 4px 0; font-size: 14px; color: var(--muted); }
.panel-empty { padding: 18px 22px 22px; }
.ov-empty b, .panel-empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.ov-empty-art { position: relative; display: block; width: 58px; height: 46px; }
.ov-empty-art i { position: absolute; width: 30px; height: 38px; border-radius: 5px; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(16, 24, 40, .06); }
.ov-empty-art i:nth-child(1) { left: 0; top: 6px; transform: rotate(-8deg); }
.ov-empty-art i:nth-child(2) { left: 14px; top: 2px; transform: rotate(3deg); }
.ov-empty-art i:nth-child(3) { left: 27px; top: 7px; transform: rotate(10deg); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(16, 24, 40, .06); }
.msg-empty-art { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }

/* Drop bar: a calm dashed landing zone */
.drop { border: 1.5px dashed var(--line-strong); box-shadow: none; background: var(--surface); }
.drop:hover { border-color: var(--accent); }
.drop-zone { min-height: 72px; }
.drop-zone .drop-icon { border: 0; background: var(--accent-soft); color: var(--accent-ink); border-radius: 12px; width: 42px; height: 42px; }
.drop-zone .drop-icon .icon { width: 20px; height: 20px; }
.drop:hover .drop-icon { transform: translateY(-1px); }
.drop-icon { transition: transform .2s; }

.section-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 650; }
.empty-ok { display: flex; align-items: flex-start; gap: 12px; border-style: solid; border-color: var(--line); background: var(--surface); }
.empty-ok > .icon { color: var(--success); stroke-width: 2.2; margin-top: 1px; }

/* Request cards with a kind tile */
.req { border-radius: var(--r-lg); transition: box-shadow .2s, border-color .2s, transform .2s; }
.req:not([open]):hover { box-shadow: var(--shadow-lift); }
.req-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; }
.req-tile { grid-column: 1; grid-row: 1 / span 3; align-self: start; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.req.is-done .req-tile { background: var(--chip-neutral); color: var(--muted); }
.req-head h3, .req-why, .req-meta { grid-column: 2; }
.req-cta { grid-column: 3; }
.req-due { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 550; font-size: 12.5px; }
.req-due .icon { width: 13px; height: 13px; stroke-width: 2; }

.dash-bottom { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 32px; }
.doc-rows .row-link, .row-link.doc-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 3px 14px; padding: 11px 22px; }
.doc-row .thumb { grid-row: 1 / span 2; }
.doc-row .row-title { grid-column: 2; font-size: 14.5px; }
.doc-row .row-sub { grid-column: 2; display: flex; align-items: center; min-width: 0; }
.doc-row .row-end { grid-column: 3; grid-row: 1 / span 2; display: grid; justify-items: end; gap: 4px; }
.amount { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.row-link { transition: background-color .12s; }
.row-link:hover .thumb { box-shadow: 0 0 0 1px var(--line-strong), 0 4px 10px -2px rgba(16, 24, 40, .14); }
.thumb { transition: box-shadow .2s, transform .2s; }
.row-link:hover .thumb { transform: translateY(-1px); }
.msg-rows .row-link, .row-link.msg-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 22px; }
.msg-avatar { grid-row: 1 / span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--chip-neutral); color: var(--muted); }
.msg-row.is-unread .msg-avatar { background: var(--accent-soft); color: var(--accent-ink); }
.msg-row .row-title { grid-column: 2; }
.msg-row.is-unread .row-title { font-weight: 650; }
.msg-row .row-sub { grid-column: 2; }
.row-when { grid-column: 3; grid-row: 1; font-size: 12px; color: var(--muted); align-self: start; padding-top: 2px; }
.panel-foot-action { border-top: 0; padding-top: 4px; padding-bottom: 18px; }

/* ── Documentos ──────────────────────────────────────── */
.doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 24px 0 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-link {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 550; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip-link:hover { text-decoration: none; border-color: var(--line-strong); color: var(--ink); }
.chip-link[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip-link .n { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-link[aria-current="true"] .n { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.chip-link .icon { width: 15px; height: 15px; }
.doc-search { position: relative; flex: 0 1 300px; min-width: 220px; }
.doc-filters-2 { flex: 0 1 300px; }
.doc-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.doc-search input { min-height: 38px; padding: 8px 12px 8px 36px; border-radius: 999px; font-size: 14px; }
.doc-filters-2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head .filter-selects { padding: 0; gap: 8px; }
.page-head .filter-selects select { min-height: 38px; width: auto; padding: 6px 32px 6px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 550; background-position: right 10px center; }
.doc-board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-card); overflow: hidden; }
.doc-board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.doc-table th { padding: 11px 14px; font-size: 12px; font-weight: 550; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--line); }
.doc-table td { border-bottom: 1px solid var(--line); }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table tbody tr:hover { background: var(--surface-2); }
.doc-table tbody tr.is-current { background: var(--accent-soft); }
.doc-table td > span.cell, .doc-table td > div.cell { display: block; padding: 11px 14px; }
.doc-table th:first-child, .doc-table td:first-child > * { padding-left: 18px; }
.doc-table th:last-child, .doc-table td:last-child > * { padding-right: 18px; }
.doc-table td > div.cell.doc-main { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 2px 14px; align-items: center; }
.doc-main .thumb { grid-row: 1 / span 2; }
.doc-title { font-size: 14.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-table a.name { position: static; display: block; font-weight: 450; font-size: 12.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-table a.name.is-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.doc-table a.name:hover { color: var(--accent-ink); text-decoration: none; }
.doc-table .state-detail { margin-top: 4px; max-width: 260px; font-size: 12.5px; }
.doc-table .state-detail.via { display: none; }
.doc-table .cat-cell { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink-2); font-size: 13.5px; }
.doc-table .cat-cell .cat-tile { width: 30px; height: 30px; border-radius: 9px; }
.doc-table .cat-cell .cat-tile .icon { width: 16px; height: 16px; }
.doc-table .cat-cell span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-table td.r .amount, .doc-table td.r { text-align: right; }
.doc-table .muted-dash { color: var(--faint); }
.doc-table col.c-cat { width: 22%; }
.doc-table col.c-date { width: 92px; }
.doc-table col.c-amount { width: 124px; }
.doc-table col.c-state { width: 150px; }
.doc-table col.c-prov { width: 118px; }
.doc-table .prov, .doc-table .state { position: relative; z-index: 1; }
.no-match { display: none; padding: 36px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.no-match strong { display: block; color: var(--ink); margin-bottom: 2px; }
.doc-board.is-filtered-empty .no-match { display: block; }
.doc-board.is-filtered-empty .table-wrap, .doc-board.is-filtered-empty .doc-cards { display: none !important; }
.list-empty.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 48px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-xl); background: var(--surface); }
.list-empty .ov-empty-art { margin-bottom: 8px; }

/* ── Document sheet / page ───────────────────────────── */
.sheet { width: min(620px, 100vw); border-radius: 18px 0 0 18px; border-left: 0; box-shadow: -1px 0 0 var(--line), -28px 0 60px rgba(16, 24, 40, .16); }
.sheet-bar { height: 54px; border-bottom: 0; }
.sheet-bar span { font-weight: 550; }
.doc-detail { padding: 4px 26px 32px; }
.doc-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: center; }
.doc-hero .cat-tile { grid-row: 1 / span 2; width: 46px; height: 46px; border-radius: 14px; }
.doc-hero .cat-tile .icon { width: 22px; height: 22px; }
.doc-hero h1 { font-size: 21px; line-height: 1.25; letter-spacing: -0.018em; overflow-wrap: anywhere; }
.doc-hero .doc-file { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-amount { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 20px; padding: 16px 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.doc-amount-fig span { display: block; font-size: 12.5px; color: var(--muted); }
.doc-amount-fig b { display: block; font-size: 28px; font-weight: 650; letter-spacing: -0.026em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.doc-amount-fig small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.doc-amount .state.chip { font-size: 13px; }
.doc-amount-side { display: grid; justify-items: end; gap: 8px; }
.doc-reason { margin-top: 12px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--ink); font-size: 14px; }
.doc-reason .icon { color: var(--danger); margin-top: 1px; }
.doc-reason .btn { margin-top: 10px; }
.doc-preview { position: relative; display: block; margin-top: 18px; padding: 18px; border-radius: 16px; background: var(--sunken); border: 1px solid var(--line); text-align: center; }
.doc-preview img { display: block; width: 100%; max-width: 420px; margin: 0 auto; height: auto; border-radius: 4px; background: var(--paper); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 12px 28px -10px rgba(16, 24, 40, .28); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.doc-preview:hover img { transform: translateY(-2px); }
.doc-preview-note { display: block; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.doc-preview .preview { margin: 0; }
.doc-actions { margin-top: 14px; }
.facts { margin-top: 26px; }
.facts h2, .doc-section h2 { font-size: 15px; margin-bottom: 10px; }
.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin: 0; }
.facts-grid > div { padding: 11px 0; border-top: 1px solid var(--line); min-width: 0; }
.facts-grid dt { font-size: 12.5px; color: var(--muted); }
.facts-grid dd { margin: 2px 0 0; font-size: 14px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.facts-grid dd.tnum { font-variant-numeric: tabular-nums; }
.facts-grid .wide { grid-column: 1 / -1; }
.facts-plain { display: grid; gap: 10px; margin-top: 14px; }
.fact-line { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.fact-line .icon { color: var(--accent-ink); margin-top: 1px; }
.fact-line b { display: block; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.returns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.return-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.timeline { list-style: none; position: relative; margin-top: 4px; }
.timeline li { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; font-size: 13.5px; color: var(--ink-2); }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: -8px; width: 1.5px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1.5px var(--line-strong); color: var(--muted); }
.timeline .tl-dot .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.timeline li.is-done .tl-dot { background: var(--accent); box-shadow: none; color: #fff; }
.timeline li.is-bad .tl-dot { background: var(--danger); box-shadow: none; color: #fff; }
.timeline time { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline b { color: var(--ink); font-weight: 550; }
.prov-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--muted); }
.doc-page { max-width: 720px; }
.doc-page .doc-detail { padding-top: 24px; }

/* ── Responsive (D4) ─────────────────────────────────── */
@media (max-width: 1100px) {
  .dash-top, .dash-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .doc-table col.c-prov { width: 0; }
  .doc-table .c-prov-cell, .doc-table th.c-prov-cell { display: none; }
}
@media (max-width: 900px) {
  .dash-top, .dash-bottom { grid-template-columns: 1fr; }
  .hero-steps { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  h1, .greet h1 { font-size: 26px; }
  .greet { margin-bottom: 16px; }
  .greet-actions { display: none; }
  .dash-top { gap: 14px; margin-bottom: 14px; }
  .dash-bottom { gap: 14px; margin-top: 24px; }
  .hero { padding: 20px 18px 18px; gap: 18px; border-radius: 16px; }
  .hero-head { flex-direction: column; gap: 12px; }
  .hero-title { font-size: 24px; }
  .hero-due { text-align: left; justify-items: start; grid-template-columns: auto auto; align-items: baseline; gap: 2px 10px; }
  .hero-due-label { grid-column: 1 / -1; }
  .hero-due strong { font-size: 20px; }
  .hero-due-left { margin-top: 0; }
  .hero-result { grid-template-columns: 1fr; gap: 10px; }
  .hero-result b { font-size: 21px; }
  .hero-foot { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero-foot .btn, .hero-foot form, .hero-foot form .btn { width: 100%; }
  .overview { padding: 18px 16px; }
  .ov-fig b { font-size: 18px; }
  .doc-rows .row-link, .row-link.doc-row, .msg-rows .row-link, .row-link.msg-row { padding: 11px 16px; }
  .req-head { grid-template-columns: auto minmax(0, 1fr); }
  .req-cta { grid-column: 1 / -1; }
  .req-tile { width: 36px; height: 36px; grid-row: 1 / span 3; }
  .drop { border-width: 1.5px; }

  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-head .filter-selects { display: flex; }
  .page-head .filter-selects label { flex: 1; }
  .page-head .filter-selects select { width: 100%; min-height: 42px; font-size: 15px; }
  .doc-row .row-end { display: contents; }
  .doc-row .amount { grid-column: 3; grid-row: 1; }
  .doc-row .state.chip { grid-column: 2 / -1; grid-row: 3; justify-self: start; margin-top: 4px; }
  .doc-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 18px 0 12px; }
  .doc-search { flex: none; min-width: 0; }
  .doc-search input { min-height: 44px; font-size: 16px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .chips::-webkit-scrollbar { display: none; }
  .chip-link { min-height: 40px; }
  .doc-filters-2 select { min-height: 40px; font-size: 15px; flex: 1; }
  .doc-board { border-radius: 16px; margin: 0; }
  .doc-board-head { padding: 10px 14px; }
  .doc-cards { margin: 0; }
  .doc-cards li:last-child a { border-bottom: 0; }
  .doc-cards a { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; align-items: center; }
  .doc-cards .thumb { grid-row: 1 / span 3; align-self: start; }
  .doc-cards .name { grid-column: 2; font-size: 14.5px; font-weight: 600; }
  .doc-cards .meta { grid-column: 2; font-size: 12.5px; display: flex; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; }
  .doc-cards .when { grid-column: 3; grid-row: 1; }
  .doc-cards .amount { grid-column: 3; grid-row: 1; font-size: 14px; }
  .doc-cards .state { grid-column: 2 / -1; grid-row: auto; justify-self: start; margin-top: 4px; }
  .doc-cards .state-detail { grid-column: 2 / -1; }

  .sheet { border-radius: 0; width: 100vw; }
  .doc-detail { padding: 4px 16px 32px; }
  .facts-grid { grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .doc-amount-fig b { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .ov-bar i, .ov-stack i { animation: none !important; }
}
.doc-amount-fig b.doc-amount-wait, .doc-amount-fig b.doc-amount-date { font-size: 19px; letter-spacing: -0.015em; }
.doc-reason b { display: block; font-weight: 600; margin-bottom: 2px; }
.doc-reason.is-note { background: var(--surface-2); border: 1px solid var(--line); }
.doc-reason.is-note .icon { color: var(--muted); }
.doc-preview-file { display: grid; justify-items: center; gap: 8px; padding: 28px 18px; }
.doc-preview-file .cat-tile { width: 52px; height: 52px; border-radius: 14px; }
.doc-preview-file strong { font-size: 13px; letter-spacing: .06em; color: var(--ink-2); }
.doc-preview-note { display: inline-flex; align-items: center; gap: 6px; }
a.doc-preview:hover { text-decoration: none; }
.facts-grid .is-unread dd { color: var(--muted); font-style: italic; font-weight: 400; }
.ask-form textarea { min-height: 96px; }
.return-tag[data-state="filed"] { background: var(--success-soft); color: var(--success-ink); }
/* Documentos: the list is one card, toolbar as its header */
.doc-list { border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
.doc-list.is-empty:not(:has(.doc-toolbar)) { background: none; border: 0; box-shadow: none; }
.doc-list .doc-toolbar { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.doc-list .doc-board { border: 0; border-radius: 0; box-shadow: none; }
.doc-list.is-empty .doc-toolbar { border-bottom: 0; }
.doc-list.is-empty:has(.doc-toolbar) .list-empty { margin: 0 16px 16px; }
@media (max-width: 760px) {
  .doc-list .doc-toolbar { padding: 0; border-bottom: 0; margin-bottom: 12px; }
  .doc-list .doc-board { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-card); }
  .doc-list.is-empty:has(.doc-toolbar) .list-empty { margin: 0; }
}
.doc-preview { padding: 14px 14px 12px; }
.doc-preview img { max-width: 100%; max-height: 300px; object-fit: cover; object-position: top center; width: 100%; }
.doc-preview .doc-preview-note { margin-top: 10px; color: var(--accent-ink); font-weight: 550; }
@media (max-width: 760px) {
  .doc-filters-2 { flex: none; width: 100%; }
  .doc-search { width: 100%; }
  .doc-amount-side { grid-auto-flow: column; justify-items: start; justify-content: start; align-items: center; }
}

/* ── Mensajes (D4) ───────────────────────────────────── */
.inbox { border-radius: var(--r-xl); box-shadow: var(--shadow-card); }
.inbox-list { background: var(--surface-2); }
.inbox-list-head { background: var(--surface); }
.inbox-list-head h2 { font-size: 16px; }
.conv-list a { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 12px; border-left: 0; padding: 14px 18px; margin: 6px 8px 0; border-radius: 12px; border-bottom: 0; }
.conv-list li:last-child a { margin-bottom: 8px; }
.conv-list a[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-card); }
.conv-avatar { grid-row: 1 / span 3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--chip-neutral); color: var(--muted); }
.conv-avatar[data-topic="documentos"] { background: var(--fam-tech-bg); color: var(--fam-tech); }
.conv-avatar[data-topic="impuestos"] { background: var(--fam-income-bg); color: var(--fam-income); }
.conv-avatar[data-topic="alta"] { background: var(--fam-travel-bg); color: var(--fam-travel); }
.conv-list .conv-subject, .conv-list .conv-topic, .conv-list .state { grid-column: 2; }
.conv-list .conv-when { grid-column: 3; grid-row: 1; }
.conv-list a.is-unread .conv-subject { font-weight: 700; }
.conv-list a.is-unread .conv-when { color: var(--accent-ink); font-weight: 600; }
.thread-head { padding: 20px 28px 16px; }
.thread-empty { color: var(--muted); font-size: 14px; }
.composer { padding: 14px 24px 18px; }
.composer textarea { border-radius: 14px; background: var(--surface-2); }
.composer textarea:focus { background: var(--surface); }
.topic-chips span { border-radius: 999px; }
.new-conv { max-width: 720px; }

/* ── Impuestos (D4) ──────────────────────────────────── */
.stack-wide { max-width: none; gap: 18px; }
.period { border-radius: var(--r-xl); overflow: hidden; }
.period-head { padding: 22px 24px 16px; }
.period-head h2 { font-size: 20px; font-weight: 650; }
.period-head p { margin-top: 8px; }
.period-due strong { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.period > .track { margin: 0 24px 20px; }
.filings { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; padding: 18px 24px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.filing { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "tile name end" "tile out out"; gap: 4px 14px; align-items: start; padding: 16px 18px; border: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-1); }
.modelo-tile { grid-area: tile; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.filing[data-outcome="compensate"] .modelo-tile, .filing[data-outcome="refund"] .modelo-tile { background: var(--success-soft); color: var(--success-ink); }
.filing[data-outcome="zero"] .modelo-tile { background: var(--chip-neutral); color: var(--muted); }
.filing-name { grid-area: name; }
.filing-name strong { font-size: 14px; }
.filing-name span { font-size: 12.5px; color: var(--muted); display: block; }
.filing-outcome { grid-area: out; margin-top: 8px; }
.filing-outcome b { display: block; font-size: 21px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.filing-end { grid-area: end; text-align: right; }
.filing-receipt { font-weight: 600; font-size: 13px; }
.period-foot { border-radius: 0; background: var(--surface); }
.period[data-state="filed"] .filings { background: var(--surface); }
.tax-empty { background: var(--surface-2); }

/* ── Mis datos (D4) ──────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-layout .stack { max-width: none; }
.profile-card { position: sticky; top: calc(var(--header-h) + 24px); display: grid; justify-items: start; gap: 14px; padding: 22px; }
.profile-avatar { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--hero-bg); color: #fff; font-size: 24px; font-weight: 650; }
.profile-who strong { display: block; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.profile-who span { display: block; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.profile-facts { list-style: none; display: grid; gap: 10px; width: 100%; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.profile-facts li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; }
.profile-facts .icon { color: var(--muted); margin-top: 2px; }
.profile-facts code { font-size: 12px; background: var(--sunken); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.sec-title { display: flex; align-items: center; gap: 10px; }
.sec-tile { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.sec-tile .icon { width: 16px; height: 16px; }
.panel-section .lead { margin-left: 40px; }
.panel-section .dl, .panel-section > details { margin-left: 40px; }
.panel-section.split .lead { margin-left: 40px; }
.hoja .panel-section .lead, .hoja .panel-section .dl { margin-left: 0; }  /* no title icon on the hoja de encargo */

@media (max-width: 900px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-card { position: static; }
}
@media (max-width: 760px) {
  .conv-list a { margin: 0; border-radius: 0; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); }
  .inbox-list { background: transparent; }
  .inbox-list-head { background: transparent; }
  .conv-list a[aria-current="page"] { box-shadow: none; }
  .inbox .thread { background: transparent; }
  .filings { grid-template-columns: 1fr; padding: 14px 16px 16px; }
  .period > .track { margin: 0 16px 18px; }
  .panel-section .lead, .panel-section .dl, .panel-section > details, .panel-section.split .lead { margin-left: 0; }
}
@media (max-width: 760px) {
  .inbox { box-shadow: none; border-radius: 0; }
  .filing { grid-template-areas: "tile name end" "out out out"; }
}
/* Ready (scheduled) reads differently from filed: accent + calendar, never the green check */
:root { --g-cal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round'%3E%3Crect x='4' y='5.5' width='16' height='14.5' rx='2'/%3E%3Cpath d='M4 10h16M8.5 3.5v4M15.5 3.5v4'/%3E%3C/svg%3E"); }
.state[data-key="scheduled"] { --glyph: var(--g-cal); --gc: var(--accent); }
.state.chip[data-key="scheduled"] { background: var(--accent-soft); color: var(--accent-ink); }
.track li[aria-current="step"], .track li.next { font-weight: 500; }
.hero-track li[aria-current="step"] { font-weight: 600; }
.period-foot.is-quiet { justify-content: flex-end; padding-top: 12px; padding-bottom: 14px; }
.period-foot .link-btn { font-size: 14px; }
.quiet-ok { display: flex; align-items: center; gap: 8px; margin: 14px 2px 0; font-size: 13.5px; color: var(--muted); }
.quiet-ok .icon { color: var(--success); stroke-width: 2.4; }
.hero-foot:has(> .btn:only-child) { justify-content: flex-end; }

/* ── Operator (D4): dense but modern ─────────────────── */
.op .main { max-width: calc(1240px + 2 * var(--gutter)); }
.op-grid { grid-template-columns: minmax(0, 1fr) 320px; }
.op-grid > *, .op-grid .panel { min-width: 0; }
.op-doc { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: center; }
.op-doc .thumb { width: 36px; height: 46px; }
.op-doc-text { min-width: 0; display: grid; gap: 1px; }
.op-doc-sub { display: flex; align-items: center; gap: 10px; font-size: 12.5px; min-width: 0; }
.op-doc-sub .cat-inline { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.op-doc-sub b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.op-table tbody tr:hover { background: var(--surface-2); }
.op-table th { background: var(--surface-2); }
.queue { border-radius: var(--r-xl); }
@media (max-width: 1100px) { .op-grid { grid-template-columns: minmax(0, 1fr); } }
.account-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 22px; margin-left: 40px; }
.account-actions > details { margin-left: 0; flex-basis: auto; }
.account-actions > details[open] { flex-basis: 100%; order: 2; }
.inline-link { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; font-size: 14px; font-weight: 550; }
@media (max-width: 760px) { .account-actions { margin-left: 0; } }
.hero-steps-rail li { padding-top: 0; min-height: 6px; }
.drop { scroll-margin-top: calc(var(--header-h) + 12px); }
.cat-inline { overflow: hidden; flex: 0 1 auto; }
.cat-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub time, .meta time { flex: none; }
.filing-name span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.filing-name { align-self: center; }

/* ═══ D4 fix round (RD3) ═══ */
.fam-rejected { --fi: var(--danger); --fb: var(--danger-soft); --fbar: var(--danger); }
.ov-next { font-size: 12.5px; color: var(--muted); margin-top: -8px; }
.menu-head span { display: block; }
.op-email { font-size: 14px; margin-top: 2px; }
.q-name { display: block; font-weight: 600; color: var(--ink); }
.q-name + .q-email { font-size: 12.5px; color: var(--muted); font-weight: 400; }

/* Toasts sit bottom-left on desktop, away from card buttons on the right */
@media (min-width: 761px) { .toasts { left: 24px; right: auto; bottom: 24px; top: auto; } }

/* Documentos: month groups, short reasons, origin as quiet text */
.doc-table tr.group-row th { padding: 16px 18px 8px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: left; letter-spacing: .01em; }
.doc-table tr.group-row:first-child th { padding-top: 10px; }
.doc-cards li.group-row { padding: 14px 14px 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.doc-table .state-detail.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 220px; }
.prov { border: 0; background: none; padding: 0; color: var(--muted); font-weight: 500; }
.prov .icon { color: var(--faint); }

/* Document sheet: thumbnail opens the file; actions right under the amount */
.doc-amount.has-thumb { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 18px; }
.doc-thumb { position: relative; display: block; width: 88px; height: 114px; border-radius: 8px; overflow: hidden; background: var(--fb); box-shadow: 0 0 0 1px var(--line), 0 6px 16px -6px rgba(16, 24, 40, .22); transition: transform .2s, box-shadow .2s; }
.doc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: var(--paper); z-index: 1; }
.doc-thumb:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-strong), 0 12px 22px -8px rgba(16, 24, 40, .28); }
.doc-amount-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.doc-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.doc-actions .confirm-delete { margin-left: auto; }
.doc-actions .confirm-delete[open] { flex-basis: 100%; margin-left: 0; }
.link-danger { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; font-size: 13.5px; font-weight: 550; color: var(--muted); border-radius: 8px; }
.link-danger::-webkit-details-marker { display: none; }
.link-danger:hover { color: var(--danger); }
.sheet h1:focus:not(:focus-visible), .sheet h2:focus:not(:focus-visible), .doc-detail h1:focus:not(:focus-visible) { outline: none; }

/* Inicio on the phone: what to do comes right after the quarter */
@media (max-width: 760px) {
  .home-flow { display: flex; flex-direction: column; gap: 14px; }
  .home-flow > .dash-top, .home-flow > .dash-bottom { display: contents; }
  .home-flow > * , .home-flow .dash-top > *, .home-flow .dash-bottom > * { margin: 0 !important; }
  .home-flow .hero { order: 1; }
  .home-flow .needs { order: 2; }
  .home-flow .recent { order: 3; }
  .home-flow .overview { order: 4; }
  .home-flow .latest-msgs { order: 5; }
  .home-flow > .drop { display: none; }
  .home-flow .needs .section-head { margin-bottom: 10px; }
  .ov-legend { grid-template-columns: 1fr; }
}

/* Operator: a section bar so the day's work is one tap away */
.op-sections { position: sticky; top: calc(var(--header-h) + 8px); z-index: 20; display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; margin-bottom: 18px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.op-sections a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); }
.op-sections a:hover { background: var(--sunken); text-decoration: none; color: var(--ink); }
.op-sections .n { font-size: 11.5px; font-weight: 650; padding: 1px 6px; border-radius: 999px; background: var(--chip-neutral); color: var(--muted); }
.op-sections .n.hot { background: var(--accent); color: #fff; }
.op-main > .panel, .op-main > section { scroll-margin-top: calc(var(--header-h) + 70px); }
.op .topbar-inner, .op .main { max-width: calc(1240px + 2 * var(--gutter)); }
.op-table { table-layout: auto; }
#impuestos .op-table { table-layout: fixed; }
@media (max-width: 760px) { .op-sections { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .op-sections a { flex: none; } }
.ov-kinds { grid-template-columns: repeat(3, 1fr); }
.ov-kinds .ov-fig b { font-size: 24px; }
.ov-doc .ov-label .icon { color: var(--muted); }
.ov-note { font-size: 13px; color: var(--muted); margin-top: -6px; }
.doc-amount-fig .doc-amount-chips { display: flex; font-size: inherit; color: inherit; }
.doc-amount-fig .doc-amount-chips .state, .doc-amount-fig .doc-amount-chips .prov { display: inline-flex; width: auto; }
.doc-amount-fig .doc-amount-chips .prov { font-size: 12.5px; }
@media (max-width: 760px) {
  .hero-steps { gap: 10px; }
  .hero-steps li { grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; row-gap: 0; padding: 0; background: none; border: 0; }
  .hero-steps li::before { grid-row: 1 / span 2; margin: 0; }
  .doc-amount.has-thumb { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
  .doc-thumb { width: 72px; height: 94px; }
}
.filing { grid-template-areas: "tile name end" "tile out out" "tile csv csv"; }
.filing-end { display: contents; }
.filing-end .filing-receipt { grid-area: end; justify-self: end; align-self: start; }
.filing-end .filing-csv { grid-area: csv; margin-top: 6px; font-size: 12px; }
.filing-csv abbr { text-decoration: none; }
@media (max-width: 760px) { .filing { grid-template-areas: "tile name end" "out out out" "csv csv csv"; } }
.op-sections { margin-bottom: 0; }
#necesitamos { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ═══════════════════════════════════════════════════════════
   Mis archivos (D7): folders, rows, sheets, notes, operator chips.
   Same tokens and components as Documentos; each folder keeps a
   quiet tint of an existing category family.
   ═══════════════════════════════════════════════════════════ */
.f-contratos { --fi: var(--fam-tech); --fb: var(--fam-tech-bg); }
.f-seguros { --fi: var(--fam-travel); --fb: var(--fam-travel-bg); }
.f-hacienda { --fi: var(--fam-place); --fb: var(--fam-place-bg); }
.f-banco { --fi: var(--fam-income); --fb: var(--fam-income-bg); }
.f-justificantes { --fi: var(--success-ink); --fb: var(--success-soft); }
.f-otros { --fi: var(--fam-fees); --fb: var(--fam-fees-bg); }
.f-todo { --fi: var(--accent-ink); --fb: var(--accent-soft); }
:root[data-theme="dark"] .f-justificantes { --fb: rgba(16, 185, 129, .12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .f-justificantes { --fb: rgba(16, 185, 129, .12); } }

/* Phone switch between Documentos and Mis archivos (one tab) */
.docs-switch { display: none; }

.arch-actions { display: flex; gap: 8px; flex: none; }

/* Folder grid */
.arch-folders { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0; }
.arch-folder {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0; height: 100%; min-height: 112px;
  padding: 14px 14px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-card); transition: border-color .15s, box-shadow .15s, transform .15s, background-color .15s;
}
.arch-folder:hover { text-decoration: none; color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.arch-folder[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-card); }
.arch-folder-tile { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--fb); color: var(--fi); }
.arch-folder-tile .icon { width: 19px; height: 19px; stroke-width: 1.7; }
.arch-folder-name { margin-top: 12px; font-size: 14px; font-weight: 600; line-height: 1.3; letter-spacing: -0.008em; }
.arch-folder-count { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 4px; font-size: 12.5px; color: var(--muted); }
.arch-folder-count .icon { width: 12px; height: 12px; stroke-width: 2; }
.arch-folder-drop { display: none; align-items: center; gap: 5px; margin-top: auto; padding-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }
.arch-folder-drop .icon { width: 14px; height: 14px; }
.arch-folder.is-bumped .arch-folder-count { animation: state-pop .42s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 0 50%; color: var(--ink); }

/* Dragging files over the page: folders become the drop targets */
.arch-drag-hint { display: flex; align-items: center; gap: 8px; min-height: 30px; margin: 0 0 2px; font-size: 13px; color: var(--accent-ink); font-weight: 550; visibility: hidden; }
.arch.is-dragging .arch-drag-hint { visibility: visible; }
.arch.is-dragging .arch-folder[data-folder-drop] { border-style: dashed; border-color: var(--accent); box-shadow: none; transform: none; }
.arch.is-dragging .arch-folder[data-folder-drop] .arch-folder-count { display: none; }
.arch.is-dragging .arch-folder[data-folder-drop] .arch-folder-drop { display: inline-flex; }
.arch.is-dragging .arch-folder.is-readonly { opacity: .45; }
.arch-folder.is-over { background: var(--accent-soft); border-style: solid !important; box-shadow: 0 0 0 3px var(--accent-soft) !important; transform: translateY(-2px) !important; }

/* The list: one card, toolbar as its header */
.arch-board { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-card); overflow: hidden; }
.arch-board-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.arch-board-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.arch-board-title h2 { font-size: 16px; letter-spacing: -0.012em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-board-title .n { font-size: 13px; font-weight: 600; color: var(--muted); }
.arch-clear { font-size: 13px; font-weight: 550; white-space: nowrap; }
.arch-search { flex: 0 1 320px; }
.arch-search .doc-search { display: block; width: 100%; min-width: 0; }
.arch-list { transition: opacity .15s; }
.arch.is-loading .arch-list { opacity: .55; }

.arch-cols, .arch-row { --arch-grid: 40px minmax(0, 1fr) 190px 104px 76px 40px; display: grid; grid-template-columns: var(--arch-grid); column-gap: 14px; align-items: center; }
.arch-cols.in-folder, .in-folder .arch-row { --arch-grid: 40px minmax(0, 1fr) 104px 76px 40px; }
.arch-cols.in-folder .arch-col-folder, .in-folder .arch-col-folder { display: none; }
.arch-cols { padding: 9px 20px; font-size: 12px; font-weight: 550; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.arch-cols > span:first-child { grid-column: 1 / 3; }
.arch-cols .r { text-align: right; }
.arch-rows { list-style: none; }
.arch-row { position: relative; padding: 11px 20px; border-top: 1px solid var(--line); transition: background-color .12s; }
.arch-row:first-child { border-top: 0; }
.arch-row:hover { background: var(--surface-2); }
.arch-row:hover .thumb { box-shadow: 0 0 0 1px var(--line-strong), 0 4px 10px -2px rgba(16, 24, 40, .14); transform: translateY(-1px); }
.arch-thumb { transition: box-shadow .2s, transform .2s; }
.arch-main { display: grid; gap: 1px; min-width: 0; }
.arch-name { font-size: 14.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-name:hover { color: var(--accent-ink); text-decoration: none; }
.arch-name::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.arch-name:focus-visible { outline: none; }
.arch-name:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.arch-desc { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.arch-desc > span, .arch-desc.is-excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arch-desc.is-note { color: var(--ink-2); }
.arch-desc .icon { width: 13px; height: 13px; flex: none; color: var(--faint); transform: translateY(2px); }
.arch-meta { display: none; }
.arch-col { font-size: 13px; color: var(--ink-2); min-width: 0; }
.arch-col-date { white-space: nowrap; }
.arch-col-size { text-align: right; color: var(--muted); white-space: nowrap; }
.arch-col-folder .cat-inline .icon { color: var(--fi); }
.arch-col-act { position: relative; z-index: 2; display: flex; justify-content: flex-end; }
.arch-col-act .icon-btn { width: 36px; height: 36px; opacity: .7; }
.arch-row:hover .arch-col-act .icon-btn, .arch-col-act .icon-btn:focus-visible { opacity: 1; }
.arch-row .muted-dash { color: var(--faint); }
.arch-row.is-new { animation: arch-new 1.8s ease-out; }
@keyframes arch-new { 0%, 35% { background: var(--accent-soft); } 100% { background: transparent; } }
.arch-row.is-leaving { opacity: 0; transform: translateX(10px); transition: opacity .22s, transform .22s; }

/* Note and receipt thumbnails */
.arch-thumb.k-note, .k-note > .arch-thumb { background: var(--paper); }
.note-mini { position: absolute; inset: 0; display: grid; align-content: start; gap: 4px; padding: 9px 7px 0; }
.note-mini i { display: block; height: 2px; border-radius: 1px; background: var(--line-strong); }
.note-mini i:first-child { height: 3px; width: 70%; background: var(--fi); opacity: .8; margin-bottom: 2px; }
.note-mini i:nth-child(3) { width: 86%; }
.note-mini i:nth-child(5) { width: 55%; }
:root[data-theme="dark"] .k-note > .arch-thumb { background: var(--surface-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .k-note > .arch-thumb { background: var(--surface-2); } }

/* Operator: classification suggestions as quiet chips */
.sugg-row { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
/* A chip is answer · confidence · what code did; the pieces wrap as units, never inside a number */
.sugg { display: inline-flex; flex-wrap: wrap; align-items: center; column-gap: 0; row-gap: 0; max-width: 100%; padding: 1px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.sugg b, .sugg-note { white-space: nowrap; }
.sugg b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sugg-v + b::before, .sugg-note::before { content: "·"; padding: 0 6px; color: var(--faint); font-weight: 400; }
.sugg-note { display: inline-flex; align-items: center; color: var(--muted); }
.sugg-note .icon { width: 12px; height: 12px; margin-right: 3px; stroke-width: 2.4; }
.sugg.is-applied .sugg-note { color: var(--success-ink); font-weight: 550; }
.sugg-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.sugg-aside { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.sugg-aside .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.sugg-cell.is-applied .sugg-aside { color: var(--success-ink); font-weight: 550; }
.panel-section ul.sugg-list:not(.access-log):not(.rows) { padding-left: 0; gap: 0; }
.op-doc-grid > div { display: grid; gap: 16px; min-width: 0; }
.sugg-list { list-style: none; display: grid; gap: 0; }
.sugg-list li { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.sugg-list li:first-child { border-top: 0; }
.sugg-label { color: var(--muted); }
.sugg-list .sugg { justify-self: start; border-radius: 10px; }
.arch-board-note { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-src { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* Empty states */
.arch-empty { display: grid; justify-items: center; gap: 6px; padding: 48px 24px 52px; text-align: center; font-size: 14px; color: var(--muted); }
.arch-empty strong { color: var(--ink); font-size: 15px; font-weight: 600; }
.arch-empty > span:not(.arch-folder-tile):not(.ov-empty-art):not(.arch-empty-actions) { max-width: 52ch; text-wrap: pretty; }
.arch-empty .arch-folder-tile, .arch-empty .ov-empty-art { margin-bottom: 8px; }
.arch-empty .arch-folder-tile { width: 46px; height: 46px; border-radius: 13px; }
.arch-empty .arch-folder-tile .icon { width: 22px; height: 22px; }
.arch-empty a { font-weight: 550; margin-top: 4px; }
.arch-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

/* Footer: storage, calm, and the ZIP */
.arch-board-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.arch-usage { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.arch-usage b { color: var(--ink); font-weight: 600; }
.arch-meter { position: relative; display: block; width: 120px; height: 6px; flex: none; border-radius: 3px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.arch-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--muted); }
.arch-usage.is-high .arch-meter i { background: var(--warn); }
.arch-usage.is-high b { color: var(--warn); }
.arch-zip { flex: none; }

/* Upload and note dialogs: a bottom sheet on the phone, a centred card on desktop */
dialog.arch-sheet { max-width: 560px; }
.arch-sheet .bs-body { display: grid; gap: 16px; }
.arch-sheet .bs-options { margin-top: 2px; }
.arch-pick { border: 0; margin: 0; padding: 0; min-width: 0; }
.arch-pick legend, .arch-move legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.arch-pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.arch-pick-grid label { position: relative; display: block; }
.arch-pick-grid input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.arch-pick-grid label > span {
  display: flex; align-items: center; gap: 9px; min-height: 48px; height: 100%; padding: 8px 26px 8px 11px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font-size: 13.5px; font-weight: 550; line-height: 1.25; color: var(--ink-2); transition: border-color .15s, background-color .15s, color .15s;
}
.arch-pick-grid label > span .icon { width: 18px; height: 18px; color: var(--fi); flex: none; }
.arch-pick-grid label:hover > span { border-color: var(--faint); }
.arch-pick-grid input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.arch-pick-grid input:checked + span::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; background: var(--accent-ink);
  -webkit-mask: var(--g-check) center / contain no-repeat; mask: var(--g-check) center / contain no-repeat;
}
.arch-pick-grid input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.arch-pick-grid.is-compact { display: flex; flex-wrap: wrap; gap: 6px; }
.arch-pick-grid.is-compact label > span { min-height: 38px; padding: 0 14px 0 10px; border-radius: 999px; font-size: 13px; }
.arch-pick-grid.is-compact input:checked + span { padding-right: 30px; }
.arch-pick-grid.is-compact input:checked + span::after { right: 11px; width: 12px; height: 12px; margin-top: -6px; }
.arch-note-field { margin: 0; }
.arch-pick-files { min-height: 76px; border-style: dashed; border-color: var(--line-strong); }
.arch-pick-files.is-over { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
.arch-pick-files .on-phone { display: none; }
.phone-flex { display: none !important; }
.arch-nojs { margin-top: 4px; }

/* Notes: a sheet of paper, edited in place */
.note-paper {
  position: relative; padding: 24px 28px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -16px rgba(16, 24, 40, .22);
}
:root[data-theme="dark"] .note-paper { background: var(--surface-2); box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note-paper { background: var(--surface-2); box-shadow: none; } }
.note-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0 2px; margin-bottom: 10px; font-size: 12.5px; color: var(--muted); }
.note-meta .icon { width: 14px; height: 14px; margin-right: 6px; color: var(--fi); }
.note-paper .field { margin: 0; }
.note-paper .note-title-input, .note-title {
  display: block; width: 100%; padding: 0 !important; border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important;
  font-size: 24px !important; font-weight: 650; line-height: 1.25; letter-spacing: -0.022em; color: var(--ink); min-height: 0 !important; resize: none; overflow: hidden;
}
.note-title-input::placeholder { color: var(--faint); opacity: 1; }
.note-paper .note-body-input, .note-body {
  display: block; width: 100%; max-width: 64ch; margin-top: 14px; padding: 0 !important; border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important;
  font-size: 16px !important; line-height: 1.75; color: var(--ink-2); min-height: 150px; resize: none; overflow: hidden; letter-spacing: -0.003em;
}
.note-body { min-height: 0; }
.note-body p { margin: 0 0 1em; }
.note-body p:last-child { margin-bottom: 0; }
.note-body-input::placeholder { color: var(--faint); opacity: 1; }
.note-paper:focus-within { border-color: var(--line-strong); }
.note-sheet .bs-body { gap: 14px; }
.note-sheet .note-paper { padding: 20px 22px 18px; box-shadow: none; }
.note-sheet .note-body-input { min-height: 180px; max-height: 46vh; overflow: auto; }
.note-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-folder { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.note-folder select { width: auto; min-height: 40px; padding: 6px 34px 6px 12px; font-size: 14px; }
.note-paper .field-errors { margin-top: 6px; }

/* File and note detail (sheet and page) */
.arch-hero { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 14px; align-items: start; }
.arch-hero .arch-folder-tile { width: 46px; height: 46px; border-radius: 14px; }
.arch-hero .arch-folder-tile .icon { width: 22px; height: 22px; }
.arch-hero-text { min-width: 0; padding-top: 1px; }
.arch-title { position: relative; margin: 0; }
.arch-title-input, .arch-title-static {
  display: block; width: calc(100% + 8px); margin: -2px 0 0 -8px; padding: 2px 30px 2px 8px; min-height: 0; border: 1px solid transparent; border-radius: 8px;
  background: transparent; box-shadow: none; font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -0.018em; color: var(--ink);
  resize: none; overflow: hidden; overflow-wrap: anywhere;
}
.arch-title-static { width: auto; margin: 0; padding: 0; border: 0; }
.arch-title-input:hover { background: var(--sunken); border-color: transparent; }
.arch-title-input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.arch-pen { position: absolute; right: 2px; top: 9px; color: var(--faint); pointer-events: none; transition: opacity .15s; }
.arch-title-input:focus ~ .arch-pen { opacity: 0; }
.arch-hero-meta { display: flex; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--muted); }
.arch-preview img { max-height: 340px; }
.arch-detail .doc-actions { margin-top: 14px; }
.arch-edit { margin-top: 22px; display: grid; gap: 18px; }
.arch-detail.k-note .arch-edit { margin-top: 4px; }
.arch-field { margin: 0; }
.arch-field textarea { min-height: 0; resize: none; overflow: hidden; }
.arch-move { border: 0; margin: 0; padding: 0; min-width: 0; }
.save-line { min-height: 20px; margin-top: -8px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.save-line::before { content: ""; width: 13px; height: 13px; flex: none; background: currentColor; display: none; -webkit-mask: var(--g-check-bold) center / contain no-repeat; mask: var(--g-check-bold) center / contain no-repeat; }
.save-line.is-saved { color: var(--success-ink); }
.save-line.is-saved::before { display: block; }
.save-line.is-error { color: var(--danger); }
.save-line.is-error::before { display: block; -webkit-mask-image: var(--g-alert); mask-image: var(--g-alert); }
.arch-note-actions { margin-top: 6px; }
.arch-client-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.arch-client-note span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.arch-client-note p { margin-top: 2px; font-size: 14px; color: var(--ink); }
.arch-sugg h2 { margin-bottom: 4px; }
.confirm-box .btn-secondary { min-height: 40px; }

@media (max-width: 1100px) {
  .arch-folders { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .arch-folder { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 12px; }
  .arch-folder-name { margin-top: 0; flex: 1 1 0; min-width: 0; }
  .arch-folder-count, .arch-folder-drop { flex-basis: 100%; padding-left: 48px; margin-top: 2px; padding-top: 0; }
}
@media (max-width: 900px) {
  .arch-cols, .arch-row { --arch-grid: 40px minmax(0, 1fr) 150px 96px 40px; }
  .arch-cols.in-folder, .in-folder .arch-row { --arch-grid: 40px minmax(0, 1fr) 96px 40px; }
  .arch-col-size, .arch-cols > span:nth-child(4) { display: none; }
}
@media (min-width: 761px) {
  dialog.arch-sheet { margin: auto; border-radius: 18px; width: calc(100% - 48px); }
  dialog.arch-sheet .bs-grip { display: none; }
  dialog.arch-sheet .bs-head { padding: 16px 14px 4px 24px; }
  dialog.arch-sheet .bs-body { padding: 8px 24px 24px; }
  dialog.arch-sheet[open] { animation: arch-pop .2s cubic-bezier(.2, .8, .2, 1); }
  dialog.note-sheet { max-width: 640px; }
}
@keyframes arch-pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .docs-switch {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: -4px 0 18px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line);
  }
  .docs-switch a { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
  .docs-switch a:hover { text-decoration: none; color: var(--ink); }
  .docs-switch a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--line); }

  .arch-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .arch-actions .btn { min-height: 44px; }
  .arch-folders { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
  .arch-folder { flex-direction: column; flex-wrap: nowrap; align-items: center; text-align: center; min-height: 0; padding: 11px 3px 9px; border-radius: 12px; box-shadow: none; }
  .arch-folder:hover { transform: none; box-shadow: none; }
  .arch-folder-tile { width: 34px; height: 34px; border-radius: 10px; }
  .arch-folder-tile .icon { width: 18px; height: 18px; }
  .arch-folder-name { flex: none; margin-top: 7px; font-size: 12.5px; line-height: 1.25; letter-spacing: -0.01em; }
  .arch-folder-count, .arch-folder-drop { flex-basis: auto; padding: 3px 0 0; margin-top: auto; font-size: 11.5px; justify-content: center; }
  .arch-drag-hint { display: none !important; }
  .arch-folders { margin-bottom: 18px; }
  .arch-board-note { white-space: normal; flex-basis: 100%; }
  .arch-board-title { flex-wrap: wrap; row-gap: 2px; }

  .arch-board { border-radius: 16px; }
  .arch-board-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .arch-search { flex: none; }
  .arch-search .doc-search input { min-height: 44px; font-size: 16px; }
  .arch-cols { display: none; }
  .arch-row, .in-folder .arch-row { --arch-grid: 40px minmax(0, 1fr); padding: 12px 14px; column-gap: 12px; align-items: start; }
  .arch-row > .arch-col { display: none; }
  .arch-main { gap: 2px; }
  .arch-desc { order: 3; }
  .arch-desc.is-excerpt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .arch-meta { display: flex; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; order: 2; font-size: 12.5px; color: var(--muted); }
  .arch-meta-folder { overflow: hidden; text-overflow: ellipsis; }
  .arch-meta time, .arch-meta .tnum { flex: none; }
  .sugg-row { order: 4; }
  .arch-empty { padding: 36px 18px 40px; }
  .arch-empty-actions { display: grid; width: 100%; grid-template-columns: 1fr; }
  .arch-board-foot { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 14px 8px; }
  .arch-usage { justify-content: space-between; }
  .arch-zip { justify-content: center; min-height: 44px; }

  .arch-pick-grid { grid-template-columns: 1fr 1fr; }
  .phone-flex { display: flex !important; }
  .arch-pick-files .desk { display: none; }
  .arch-pick-files .on-phone { display: block; }
  .note-paper { padding: 18px 18px 16px; }
  .note-title-input, .note-title { font-size: 21px !important; }
  .note-sheet-foot { flex-direction: column; align-items: stretch; }
  .note-folder select { flex: 1; }
  .note-sheet-foot .btn { min-height: 46px; }
  .arch-title-input { font-size: 19px; }
  .sugg-list li { grid-template-columns: 1fr; gap: 4px; }
}
.note-hint { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
.note-hint .icon { width: 13px; height: 13px; color: var(--faint); }
.arch-edit .note-hint { margin-top: -8px; }
.arch-sheet .bs-option strong { color: var(--ink); }
.arch.is-op .arch-folders { margin-bottom: 22px; }
.op-move .lead { margin-bottom: 12px; }
.op-move-quick { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.op-move-quick .btn .icon { color: var(--fi); }
.op-move-other { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-move-other select { width: auto; min-height: 38px; padding: 6px 34px 6px 12px; font-size: 14px; }
.arch-zip[aria-busy="true"] { opacity: .7; cursor: progress; }
.op-move .lead, .panel-section:has(.sugg-list) .lead { margin-left: 0; }
/* Mis archivos: the upload tray keeps each file on one line (state and "Ver" side by side) */
body:has([data-archive]) .tray .upload-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; }
body:has([data-archive]) .tray .upload-actions { grid-column: auto; min-width: 0; }
body:has([data-archive]) .tray .upload-actions .btn { padding: 0 8px; }

/* ── P1 polish ─────────────────────────────────────────── */
/* Request cards that take files reuse the Inicio drop zone, rows and phone options. */
.req-drop { box-shadow: none; }
.req-drop .drop-zone { min-height: 68px; padding: 12px 14px 12px 16px; }
.req-drop .drop-copy strong { font-weight: 550; }
.req-drop-phone { display: none; }
.req-drop .uploads-head { padding: 10px 16px; }
.req-drop .upload-row { padding: 11px 16px; }
@media (max-width: 760px) {
  .req-drop { border: 0; background: none; }
  .req-drop > .drop-zone { display: none; }
  .req-drop-phone { display: grid; }
  .req-drop .uploads { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .req-drop .uploads-head { padding: 10px 14px; }
  .req-drop .upload-row { padding: 11px 14px; }
}
.returns-note { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
/* Unread for longer than the reading takes: a person reads it. Static, neutral (no spinner). */
.state[data-key="review"] { --glyph: var(--g-clock); --gc: var(--muted); }
.state.chip[data-key="review"] { background: var(--chip-neutral); color: var(--ink-2); }
.fam-review { --fi: var(--fam-pending); --fb: var(--fam-pending-bg); --fbar: var(--fam-pending-bar); }
/* Inicio: the quarter card is as tall as its content and the upload bar sits under it, beside "Lo que tenemos". */
.dash-top { align-items: start; grid-template-areas: "hero ov" "drop ov"; grid-template-rows: auto 1fr; }
.dash-top > .hero { grid-area: hero; }
.dash-top > .overview { grid-area: ov; }
.dash-top > .drop { grid-area: drop; }
.dash-top .drop-zone { flex-wrap: wrap; row-gap: 12px; }
.dash-top .drop-copy { flex: 1 1 260px; }
.dash-top .drop-controls { flex: 1 1 100%; justify-content: space-between; padding-left: 58px; }
@media (max-width: 900px) { .dash-top .drop-controls { padding-left: 0; } }

@media (max-width: 900px) { .dash-top { grid-template-areas: "hero" "drop" "ov"; grid-template-rows: auto; } }
@media (max-width: 760px) { .home-flow .dash-top > .drop { display: none; } }
.hero-steps-row { display: flex; align-items: center; gap: 14px; }
.hero-steps-row .track { flex: 1; margin: 0; }
.hero-steps-count { flex: none; font-size: 13px; color: var(--hero-ink-2); white-space: nowrap; }
/* A rejected document says why in full, under its name (the Estado column only holds the chip). */
.doc-reject-line { grid-column: 2; font-size: 13px; line-height: 1.45; color: var(--ink-2); white-space: normal; max-width: 60ch; margin-top: 2px; }
/* "Informe o extracto" picked: contracts and letters have their own home. */
.drop-hint { display: none; padding: 0 20px 14px 78px; font-size: 13px; color: var(--muted); }
.drop:has([data-kind][value="document"]:checked) .drop-hint,
.bottom-sheet:has([data-kind][value="document"]:checked) .bs-hint { display: block; }
.bs-hint { padding: 0 0 12px; }
@media (max-width: 760px) { .drop-hint { padding: 0 14px 12px; } }
/* Mis archivos: a note's excerpt ends with an ellipsis (text-overflow needs a block box), titles keep their quarter on the phone. */
@media (min-width: 761px) { .arch-desc.is-excerpt { display: block; } }
@media (max-width: 760px) {
  .arch-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
@media (max-width: 760px) { .arch-title-input { min-height: 44px; padding-top: 7px; padding-bottom: 7px; } .arch-pen { top: 14px; } }
.panel-section.split .lead { font-size: 14px; color: var(--muted); }
.req-drop .bs-option strong { color: var(--ink); }
/* Theme: one moon/sun button (moon while light, sun while dark). */
.theme-toggle { width: 40px; height: 40px; border-radius: 10px; color: var(--muted); }
.theme-toggle .icon { width: 19px; height: 19px; }
.theme-toggle .to-light { display: none; }
:root[data-theme="dark"] .theme-toggle .to-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .to-light { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .to-dark { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .to-light { display: block; }
}
.topbar-end .theme-toggle { margin-right: 2px; }
.auth-foot .theme-toggle { width: 36px; height: 36px; }
@media (max-width: 760px) { .topbar-end .theme-toggle { width: 44px; height: 44px; } }
/* AEAT apoderamiento guide (gestoria/_apoderamiento_guide.html): four steps, each with a simplified
   illustration rebuilt in HTML/CSS (never a screenshot of the AEAT site). Phone first. */
.apod { container-type: inline-size; max-width: 880px; }
.apod-intro { margin: 0 0 18px; max-width: 62ch; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.apod-steps { list-style: none; margin: 0; padding: 0; }
.apod-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 14px; row-gap: 12px; padding: 18px 0; border-top: 1px solid var(--line); }
.apod-step:first-child { border-top: 0; padding-top: 0; }
.apod-n { grid-row: span 3; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; font-weight: 650; }
.apod-body { min-width: 0; }
.apod-h { margin: 3px 0 4px; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink); letter-spacing: -0.005em; }
.apod-body > p { margin: 0 0 10px; max-width: 60ch; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.apod-body > p.apod-small { font-size: 13px; color: var(--muted); }
.apod-go { min-height: 44px; margin-top: 2px; }
.apod-ids { display: grid; gap: 8px; margin: 10px 0 8px; max-width: 460px; }
.apod-id { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 5px 5px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.apod-id-k { font-size: 12.5px; color: var(--muted); }
.apod-id code { min-width: 0; font: 600 14.5px/1.3 var(--font); color: var(--ink); letter-spacing: .01em; overflow-wrap: anywhere; }
.apod-copy { min-height: 40px; padding: 0 12px; }
.apod-codes { display: grid; gap: 8px; margin: 12px 0 10px; max-width: 520px; }
.apod-codes > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.apod-codes dt { font-size: 12.5px; font-weight: 650; color: var(--ink); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.apod-codes dd { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.apod-done { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 4px; }
.apod-done .btn { min-height: 44px; padding: 0 20px; }
.apod-fig { grid-column: 2; position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 300px; padding: 26px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 12.5px; line-height: 1.3; color: var(--ink-2); }
.apod-fig-k { position: absolute; top: 7px; left: 12px; font-size: 11px; color: var(--muted); }
.apod-fig-t { margin: 0 0 2px; font-weight: 600; color: var(--ink); }
.apod-opt { display: block; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); font-weight: 500; }
.apod-opt.is-on { border: 2px solid var(--accent); padding: 7px 9px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.apod-opt.is-off { opacity: .55; }
.apod-sign { align-self: flex-start; padding-left: 16px; padding-right: 16px; }
.apod-field { display: block; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); }
.apod-field small { display: block; font-size: 10.5px; color: var(--muted); }
.apod-field b { font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: .02em; }
.apod-row { display: flex; align-items: center; gap: 8px; padding: 3px 2px; font-weight: 600; letter-spacing: .01em; }
.apod-box { position: relative; width: 15px; height: 15px; flex: none; border-radius: 4px; background: #1f6fa5; }
.apod-box::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.apod-revoke { margin: 0 0 6px; max-width: 64ch; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.apod .apod-revoke { max-width: none; margin: 4px 0 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.panel-section > .apod-revoke { margin: 0 0 4px 40px; }
.apod-clave .disclosure-body p { margin: 0; max-width: 62ch; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
@container (min-width: 620px) {
  .apod-step { grid-template-columns: 28px minmax(0, 1fr) 248px; column-gap: 20px; }
  .apod-n { grid-row: auto; }
  .apod-fig { grid-column: 3; grid-row: span 2; align-self: start; }
  .apod-done { grid-column: 2; margin-top: 0; }
}
@container (max-width: 340px) {
  .apod-codes > div { grid-template-columns: 1fr; gap: 1px; }
  .apod-id { grid-template-columns: minmax(0, 1fr) auto; }
  .apod-id-k { grid-column: 1 / -1; margin-bottom: -6px; }
}
@media (max-width: 760px) { .apod-copy { min-height: 44px; } .panel-section > .apod-revoke { margin-left: 0; } }

/* ═══════════════════════════════════════════════════════════
   D8 Factura desde tu Excel: operator sheet list and sheet page (steps, column mapping,
   VAT per concept, the draft as a real invoice), the client's "Tu factura está lista" cards.
   ═══════════════════════════════════════════════════════════ */
/* Sheet states: glyph + word, never colour alone */
.sheet-state[data-key="reading"] { --glyph: var(--g-arc); --gc: var(--accent); }
.sheet-state[data-key="reading"]::before { animation: spin 1s linear infinite; }
.sheet-state[data-key="needs_mapping"], .sheet-state[data-key="needs_setup"] { --glyph: var(--g-ring); --gc: var(--warn); }
.sheet-state[data-key="draft"] { --glyph: var(--g-dot); --gc: var(--accent); }
.sheet-state[data-key="correction"] { --glyph: var(--g-alert); --gc: var(--warn); }
.sheet-state[data-key="issued"], .sheet-state[data-key="imported"] { --glyph: var(--g-check-bold); --gc: var(--success); }
.sheet-state[data-key="context"], .sheet-state[data-key="not_sheet"] { --glyph: var(--g-dash); --gc: var(--faint); color: var(--muted); }
.sheet-state[data-key="failed"] { --glyph: var(--g-x); --gc: var(--danger); color: var(--danger); }
.state.chip.sheet-state[data-key="needs_mapping"], .state.chip.sheet-state[data-key="needs_setup"], .state.chip.sheet-state[data-key="correction"] { background: var(--warn-soft); color: var(--warn); }
.state.chip.sheet-state[data-key="draft"] { background: var(--accent-soft); color: var(--accent-ink); }
.state.chip.sheet-state[data-key="issued"], .state.chip.sheet-state[data-key="imported"] { background: var(--success-soft); color: var(--success-ink); }
.state.chip.sheet-state[data-key="failed"] { background: var(--danger-soft); }

/* Page frame */
.sh-head { margin-bottom: 20px; }
.sh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.sh-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.sh-main { display: grid; gap: 14px; min-width: 0; }
.sh-rail { display: grid; gap: 14px; min-width: 0; }

@media (max-width: 1100px) {
  .sh-grid { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .sh-main, .sh-rail { display: contents; }
  .sh-rows { order: 1; }
  .sh-file { order: 2; }
}
.sh-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.sh-note .icon { flex: none; margin-top: 2px; color: var(--muted); }
.sh-note.is-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.sh-note.is-warn .icon { color: var(--warn); }
.sh-private { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.sh-private .icon { width: 13px; height: 13px; color: var(--faint); flex: none; }
.sh-private-block { display: flex; align-items: flex-start; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); line-height: 1.45; }
.sh-private-block .icon { margin-top: 2px; }
.sh-form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 18px; }
.sh-form-foot .help { flex: 1 1 280px; line-height: 1.45; }

/* Steps: a card each; done ones fold to one line, the pending one opens */
.sh-step { overflow: clip; }
.sh-step-head { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 22px; list-style: none; cursor: pointer; }
.sh-step-head::-webkit-details-marker { display: none; }
.sh-step-head.as-title { cursor: default; padding: 4px 2px 12px; }
details.sh-step > .sh-step-head:hover { background: var(--surface-2); }
.sh-step-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px; font-weight: 650; }
.sh-step.is-done .sh-step-mark { background: var(--success-soft); color: transparent; position: relative; }
.sh-step.is-done .sh-step-mark::after { content: ""; position: absolute; inset: 6px; background: var(--success); -webkit-mask: var(--g-check) center / contain no-repeat; mask: var(--g-check) center / contain no-repeat; }
.sh-step.is-locked .sh-step-mark { background: var(--sunken); color: var(--faint); }
.sh-step-title { display: grid; gap: 2px; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.sh-step-sum { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; line-height: 1.45; }
details.sh-step.is-done:not([open]) .sh-step-sum { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.sh-step[open] .sum-closed, details.sh-step:not([open]) .sum-open { display: none; }
.sum-list > span + span::before { content: " · "; }
.sum-list > span:first-child { color: var(--ink-2); font-weight: 550; }
.sh-step-go { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 550; color: var(--accent-ink); white-space: nowrap; }
.sh-step-go .icon { transition: transform .15s; color: var(--muted); }
details.sh-step[open] .go-text { display: none; }
details.sh-step:not(.is-done):not([open]) .sh-step-go::before { content: "Abrir"; }
details.sh-step[open] .sh-step-go .icon { transform: rotate(180deg); }
.sh-step-body { padding: 4px 22px 22px 64px; }
section.sh-step { background: none; border: 0; box-shadow: none; }
.sh-step-invoice.is-locked .sh-step-title { color: var(--muted); }
@media (max-width: 760px) {
  .sh-step-head { padding: 14px 16px; gap: 12px; }
  .sh-step-body { padding: 2px 16px 18px; }
}

/* Column mapping: each column with its header, samples, one role select and the patient switch */
.map-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.map-kind .field-label { font-size: 14px; font-weight: 550; color: var(--ink); }
.map-cols { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.map-col { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(200px, 250px) auto; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.map-col:first-child { border-top: 0; }
.map-col-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--sunken); font-size: 12px; font-weight: 600; color: var(--muted); }
.map-col-text { display: grid; gap: 5px; min-width: 0; }
.map-col-header { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.map-samples { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.map-cell { max-width: 220px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-private { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.map-private .icon { width: 13px; height: 13px; color: var(--faint); }
.map-col-role { display: grid; gap: 3px; min-width: 0; }
.map-col-role select { min-height: 38px; padding: 6px 32px 6px 10px; font-size: 13.5px; }
.map-col-role select:disabled { opacity: .5; cursor: not-allowed; }
.map-source { font-size: 11.5px; color: var(--faint); padding-left: 2px; }
.map-personal { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; white-space: nowrap; }
.map-personal input { width: 16px; height: 16px; }
.map-personal:has(input:checked) { border-color: var(--line-strong); background: var(--sunken); color: var(--ink-2); }
.map-col.is-personal { background: var(--surface-2); }
.map-col.is-personal .map-col-header { color: var(--ink-2); }
.map-form:has(input[name="kind"][value="actividad"]:checked) .role-libro,
.map-form:has(input[name="kind"][value="libro"]:checked) .role-actividad,
.map-form:not(:has(input[name="kind"]:checked)) .role-libro { display: none; }
.map-extra { display: none; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0 24px; margin-top: 20px; }
.map-form:has(input[name="kind"][value="actividad"]:checked) .map-extra-actividad,
.map-form:has(input[name="kind"][value="libro"]:checked) .map-extra-libro { display: grid; }
.map-extra .field { margin-bottom: 0; }
.sh-step-body .field > .segmented { justify-self: start; }
.sh-unchanged { margin: 0 0 22px; }
.sh-unchanged .icon { color: var(--success); }
.map-extra .help { line-height: 1.45; }
.seg-lg span { min-height: 38px; padding: 0 16px; font-size: 14px; }
.segmented { flex-wrap: wrap; }
@media (max-width: 900px) {
  .map-col { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .map-col-role { grid-column: 2 / -1; grid-row: 2; }
  .map-personal { grid-column: 3; grid-row: 1; align-self: start; }
  .map-extra { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}
@media (max-width: 760px) {
  .map-col { padding: 12px; column-gap: 10px; row-gap: 8px; }
  .map-col-text { display: contents; }
  .map-col-n { grid-column: 1; grid-row: 1; }
  .map-col-header { grid-column: 2; grid-row: 1; align-self: center; }
  .map-samples { grid-column: 1 / -1; grid-row: 2; }
  .map-col-role { grid-column: 1 / -1; grid-row: 3; }
  .map-col.is-personal .map-col-role { display: none; }
  .map-kind .segmented { display: flex; width: 100%; }
  .map-kind .segmented label { flex: 1; display: flex; }
  .map-kind .segmented span { width: 100%; justify-content: center; text-align: center; white-space: normal; min-height: 40px; line-height: 1.2; }
  .map-col-role select { min-height: 44px; font-size: 15px; }
  .map-personal { min-height: 34px; }
  .seg-lg span { min-height: 42px; }
}

/* Billing: the client's clinics as cards */
.pick-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pick-card { position: relative; display: grid; gap: 2px; padding: 12px 14px 12px 40px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s; }
.pick-card input { position: absolute; left: 14px; top: 14px; }
.pick-card:hover { border-color: var(--faint); }
.pick-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pick-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-card-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.pick-card-sub { font-size: 12.5px; color: var(--muted); }
.pick-card-sub .is-warn { color: var(--warn); font-weight: 550; }
.sh-billing-more { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.sh-billing-more details { flex: 1 1 320px; }
.sh-billing-more details[open] { flex-basis: 100%; }
.sh-new-recipient { max-width: 620px; }

/* VAT per concept: one segmented choice, exempt first */
.vat-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.vat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; padding: 12px 14px; border-top: 1px solid var(--line); }
.vat-row:first-child { border-top: 0; }
.vat-concept { display: grid; gap: 2px; min-width: 0; }
.vat-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.vat-why { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.vat-why b { font-weight: 600; color: var(--warn); }
.vat-seg label:first-child input:checked + span { color: var(--success-ink); }
.vat-mention { grid-column: 1 / -1; display: none; font-size: 12.5px; color: var(--muted); }
.vat-row:has([data-vat-choice][value="exenta"]:checked) .vat-mention { display: block; }
.vat-mention > summary { list-style: none; cursor: pointer; line-height: 1.45; }
.vat-mention > summary::-webkit-details-marker { display: none; }
.vat-mention[open] > summary .link-like { display: none; }
.vat-mention input { margin-top: 8px; min-height: 38px; font-size: 13.5px; }
.link-like { color: var(--accent-ink); font-weight: 550; margin-left: 4px; white-space: nowrap; }
@media (max-width: 760px) {
  .vat-row { grid-template-columns: minmax(0, 1fr); }
  .vat-seg { display: flex; }
  .vat-seg label { flex: 1; }
  .vat-seg span { justify-content: center; width: 100%; min-height: 40px; }
}

/* The draft, as the invoice it will be */
.inv-sheet { display: grid; gap: 10px; margin-bottom: 22px; }
.inv-sheet .sh-note { margin: 0; }
.inv-paper-sheet {
  padding: 30px 34px 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: #101828;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 18px 40px -22px rgba(16, 24, 40, .28);
  --inv-ink: #101828; --inv-ink-2: #344054; --inv-muted: #667085; --inv-line: #e4e7ec;
}
:root[data-theme="dark"] .inv-paper-sheet { background: var(--surface-2); color: var(--ink); box-shadow: none; --inv-ink: var(--ink); --inv-ink-2: var(--ink-2); --inv-muted: var(--muted); --inv-line: var(--line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .inv-paper-sheet { background: var(--surface-2); color: var(--ink); box-shadow: none; --inv-ink: var(--ink); --inv-ink-2: var(--ink-2); --inv-muted: var(--muted); --inv-line: var(--line-strong); } }
.inv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 2px solid var(--inv-ink); }
.inv-kind { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--inv-ink); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.inv-draft-tag { padding: 2px 8px; border: 1px dashed var(--warn); border-radius: 5px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); }
.inv-number { margin: 4px 0 0; font-size: 13px; color: var(--inv-muted); }
.inv-vat-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; background: var(--accent-soft); color: var(--accent-ink); }
.inv-vat-tag::before { content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--g-dot) center / contain no-repeat; mask: var(--g-dot) center / contain no-repeat; }
.inv-vat-tag[data-treatment="exenta"] { background: var(--success-soft); color: var(--success-ink); }
.inv-vat-tag[data-treatment="exenta"]::before { -webkit-mask-image: var(--g-ring); mask-image: var(--g-ring); }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr minmax(170px, .8fr); gap: 18px 24px; padding: 18px 0; font-size: 13px; line-height: 1.45; color: var(--inv-ink-2); }
.inv-parties > div { display: grid; align-content: start; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.inv-parties b { font-size: 14px; font-weight: 650; color: var(--inv-ink); }
.inv-k { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--inv-muted); margin-bottom: 3px; }
.inv-dates .inv-k + b { margin-bottom: 8px; }
.inv-dates b { font-size: 13.5px; font-weight: 600; }
.inv-lines { width: 100%; border-collapse: collapse; font-size: 13.5px; color: var(--inv-ink); }
.inv-lines th { padding: 9px 0; border-bottom: 1px solid var(--inv-line); border-top: 1px solid var(--inv-line); text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--inv-muted); }
.inv-lines td { padding: 11px 0; border-bottom: 1px solid var(--inv-line); vertical-align: top; }
.inv-lines .num { text-align: right; padding-left: 16px; white-space: nowrap; }
.inv-lines th.num { width: 1%; }
.inv-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 24px; align-items: start; padding-top: 16px; }
.inv-legal { font-size: 12px; line-height: 1.5; color: var(--inv-muted); }
.inv-legal p { margin: 0 0 6px; max-width: 46ch; }
.inv-legal b { color: var(--inv-ink); }
.inv-totals { margin: 0; display: grid; font-size: 13.5px; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; color: var(--inv-ink-2); }
.inv-totals dt, .inv-totals dd { margin: 0; }
.inv-totals dd { color: var(--inv-ink); font-weight: 550; }
.inv-totals .inv-total { margin-top: 6px; padding-top: 12px; border-top: 2px solid var(--inv-ink); font-size: 17px; font-weight: 700; color: var(--inv-ink); }
.inv-totals .inv-total dd { font-weight: 700; letter-spacing: -0.01em; }
.inv-pdf { margin: 0; font-size: 13.5px; }
.inv-pdf a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-weight: 550; }
@media (max-width: 900px) { .inv-parties { grid-template-columns: 1fr 1fr; } .inv-dates { grid-column: 1 / -1; grid-template-columns: auto auto; column-gap: 18px; } }
@media (max-width: 760px) {
  .inv-paper-sheet { padding: 20px 16px 18px; }
  .inv-top { flex-direction: column; gap: 10px; }
  .inv-kind { font-size: 19px; }
  .inv-parties { grid-template-columns: 1fr; gap: 14px; }
  .inv-dates { grid-template-columns: 1fr 1fr; }
  .inv-dates .inv-k:nth-of-type(2) { grid-column: 2; grid-row: 1; }
  .inv-dates b:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .inv-foot { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .inv-legal { order: 2; }
  .inv-lines { font-size: 13px; }
  .inv-lines .num { padding-left: 8px; }
}

/* Rows read */
.sh-rows-head { display: flex; align-items: center; gap: 14px; padding: 15px 22px; list-style: none; cursor: pointer; font-size: 15px; font-weight: 600; }
.sh-rows-head::-webkit-details-marker { display: none; }
.sh-rows-head:hover { background: var(--surface-2); }
.sh-rows-head > span:first-child { flex: 1; }
.sh-rows-head .muted { font-weight: 500; margin-left: 4px; }
.sh-rows-chev { color: var(--muted); transition: transform .15s; }
.sh-rows[open] .sh-rows-chev { transform: rotate(180deg); }
.sh-rows-note { margin: 0 22px 12px; }
.sh-rows .op-table-wrap { border-top: 1px solid var(--line); }
.sh-lines th:first-child, .sh-lines td:first-child { padding-left: 22px; width: 48px; }
.sh-lines tr.is-problem td { background: var(--warn-soft); }
.sh-problem { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12.5px; font-weight: 550; color: var(--warn); }

/* Rail: issue, the file, other exits */
.sh-issue { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.sh-issue h2 { font-size: 16px; margin-bottom: 12px; }
.sh-issue-list { list-style: none; margin: 0 0 16px; padding: 0 !important; display: grid; gap: 0 !important; }
.sh-issue-list li.is-skip > b { font-size: 13px; font-weight: 550; color: var(--muted); }
.sh-issue-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sh-issue-list li:first-child { border-top: 0; padding-top: 0; }
.sh-issue-list li > span { display: grid; min-width: 0; }
.sh-issue-list li > span b { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-issue-list li > b { font-size: 15px; font-weight: 650; color: var(--ink); white-space: nowrap; }
.sh-issue .field { margin-bottom: 14px; }
.sh-issue .help { margin-top: 2px; line-height: 1.45; }
.sh-issue > .panel-section > .help { margin-top: 10px; }
.sh-discard { margin-top: 8px; }
.sh-file-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; }
.sh-file-text { display: grid; min-width: 0; font-size: 13px; }
.sh-file-text b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.sh-file-links { display: grid; gap: 2px; margin-top: 12px; font-size: 13.5px; font-weight: 550; }
.sh-file-links a { display: inline-flex; min-height: 30px; align-items: center; }
.sh-exits { display: grid; gap: 4px; }
.sh-exits .link-btn { min-height: 32px; text-align: left; font-size: 13.5px; color: var(--muted); }
.sh-exits .link-btn:hover { color: var(--accent-ink-hover); }
.sh-exits-inline { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Big state panels: reading, failed, set aside, imported, issued */
.sh-state-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 17px; font-weight: 650; }
.sh-state-title .state { font-size: 17px; font-weight: 650; color: var(--ink); gap: 9px; }
.sh-state-title .state::before { width: 18px; height: 18px; }
.sh-state-panel.is-error { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.sh-state-panel.is-error .sh-state-title .icon { color: var(--danger); }
.sh-state-panel .lead { max-width: 62ch; font-size: 14px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.sh-big { margin: 10px 0 6px; font-size: 34px; font-weight: 650; letter-spacing: -0.03em; color: var(--ink); }
.sh-big span { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.sh-sub { font-size: 14px; margin: 0 0 8px; }
.sh-skipped { list-style: none; margin: 0; padding: 0 !important; display: grid; gap: 0 !important; font-size: 13.5px; }
.sh-skipped li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.sh-skipped li:first-child { border-top: 0; }
.sh-skipped li span { color: var(--muted); }

/* Invoice cards (operator "issued" and the client's home) */
.inv-paper { position: relative; display: grid; align-content: start; gap: 4px; width: 38px; height: 48px; flex: none; padding: 9px 7px; border-radius: 5px; background: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 4px 10px -4px rgba(16, 24, 40, .18); }
.inv-paper i { display: block; height: 3px; border-radius: 2px; background: var(--line-strong); }
.inv-paper i:first-child { width: 60%; height: 4px; background: var(--accent); }
.inv-paper i:nth-child(3) { width: 80%; }
.inv-paper i:last-child { width: 45%; justify-self: end; margin-top: 6px; background: var(--ink-2); }
:root[data-theme="dark"] .inv-paper { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .inv-paper { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-strong); } }
.inv-cards { list-style: none; margin: 4px 0 0; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px !important; }
.inv-card { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); transition: border-color .15s, background-color .15s; }
.inv-card:hover { border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; color: var(--ink); }
.inv-card-text { display: grid; gap: 2px; min-width: 0; }
.inv-card-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-card-sub { font-size: 12.5px; color: var(--muted); }
.inv-card-amount { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }

/* Sheet list page */
.sh-row.row-link { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 14px; padding: 13px 22px; }
.sh-row .cat-tile { grid-row: 1 / span 2; }
.sh-row .row-title, .sh-row .row-sub { grid-column: 2; }
.sh-row .row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.sh-row .row-end { grid-column: 3; grid-row: 1 / span 2; display: grid; justify-items: end; gap: 4px; }
.sh-row time { font-size: 12.5px; color: var(--muted); }
.sh-rows-list li.is-closed .row-title { font-weight: 500; color: var(--ink-2); }
.sh-list-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.sh-layout { padding: 14px 0; border-top: 1px solid var(--line); }
.sh-layout:first-child { border-top: 0; padding-top: 4px; }
.sh-layout-title { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; }
.sh-layout-title b { font-weight: 600; color: var(--ink); }
.sh-layout-cols { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.sh-layout-cols > span { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.sh-layout-cols > span.is-personal { background: none; border-style: dashed; color: var(--faint); }
.sh-layout-cols .icon { width: 12px; height: 12px; }
.sh-layout-by { margin: 0; font-size: 12.5px; color: var(--muted); }
.sh-vat-list { list-style: none; margin: 0 0 12px; padding: 0 !important; display: grid; gap: 0 !important; }
.sh-vat-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.sh-vat-list li:first-child { border-top: 0; padding-top: 2px; }
@media (max-width: 900px) { .sh-list-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .sh-row.row-link { padding: 12px 16px; grid-template-columns: 34px minmax(0, 1fr); }
  .sh-row .row-sub { -webkit-line-clamp: 2; }
  .sh-row .row-end { grid-column: 2; grid-row: 3; display: flex; justify-content: flex-start; align-items: center; gap: 10px; margin-top: 6px; }
}

/* Client home: "Tu factura está lista" */
.ready-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.ready-grid:has(> li:only-child) { max-width: 560px; }
.ready-card { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-card); overflow: hidden; }
.ready-main { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: start; gap: 16px; padding: 20px 22px 18px; color: var(--ink); }
.ready-main:hover { text-decoration: none; color: var(--ink); }
.ready-main:hover .ready-recipient { color: var(--accent-ink); }
.ready-main .inv-paper { width: 48px; height: 62px; padding: 12px 9px; gap: 5px; }
.ready-text { display: grid; gap: 2px; min-width: 0; }
.ready-kicker { display: flex; flex-wrap: wrap; align-items: center; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.ready-recipient { font-size: 15.5px; font-weight: 600; line-height: 1.35; color: var(--ink); letter-spacing: -0.01em; transition: color .15s; }
.ready-amount { margin-top: 8px; font-size: 26px; font-weight: 650; line-height: 1.1; letter-spacing: -0.03em; white-space: nowrap; }
.ready-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.ready-actions .btn { min-height: 40px; }
.ready-open { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; font-size: 13.5px; font-weight: 550; }
.ready-date { font-size: 13px; color: var(--muted); }
.ready-note { margin: 10px 2px 0; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  .ready-grid { grid-template-columns: minmax(0, 1fr); }
  .ready-main { padding: 16px 16px 14px; gap: 14px; grid-template-columns: 40px minmax(0, 1fr); }
  .ready-main .inv-paper { width: 40px; height: 52px; padding: 10px 7px; gap: 4px; }
  .ready-amount { font-size: 23px; }
  .ready-actions { padding: 10px 16px 12px; }
  .ready-actions .btn { min-height: 44px; }
}

/* Operator client page: quiet reminder under the representation state */
.op-reminder { margin-top: 4px; font-size: 12.5px; line-height: 1.45; }
.ready-kicker .tnum { margin-left: .3em; }
@media (max-width: 760px) { .home-flow .ready-invoices { order: 2; margin: 0 !important; } }

/* D8 review item (Rob, 5 Oct): the sheet is read automatically; the gestor reviews the invoice next to
   what we understood and opens "Corregir" only when something is wrong. */
.sh-edit:not([open]):not(:target) { display: none; }
.sh-edit { scroll-margin-top: calc(var(--header-h) + 16px); }
.sh-edit-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; list-style: none; cursor: pointer; font-size: 15px; font-weight: 650; border-bottom: 1px solid var(--line); }
.sh-edit-head::-webkit-details-marker { display: none; }
.sh-edit-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
.sh-edit-head:hover .sh-edit-close { background: var(--sunken); color: var(--ink); }
.sh-edit-sec { scroll-margin-top: calc(var(--header-h) + 16px); }
.sh-edit-sec[open] { padding-bottom: 22px; }
.sh-edit-sec > :not(summary) { margin-left: 22px; margin-right: 22px; }
.sh-edit-sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; list-style: none; cursor: pointer; }
.sh-edit-sum::-webkit-details-marker { display: none; }
.sh-edit-sum:hover { background: var(--surface-2); }
.sh-edit-sum > span { display: grid; gap: 1px; font-size: 14.5px; font-weight: 650; color: var(--ink); }
.sh-edit-sum small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.sh-edit-sum .icon { color: var(--muted); transition: transform .15s; flex: none; }
.sh-edit-sec[open] > .sh-edit-sum .icon { transform: rotate(180deg); }
.sh-edit-sec + .sh-edit-sec { border-top: 1px solid var(--line); }
.sh-edit-sec > h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 650; }
.sh-edit-lead { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.sh-edit-sec > h3 + form, .sh-edit-sec > h3 + .sh-note { margin-top: 12px; }
.sh-papers { display: grid; }
.sh-placeholder { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 18px; padding: 26px 24px; border-style: dashed; box-shadow: none; background: transparent; }
.sh-placeholder p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.sh-placeholder b { display: block; color: var(--ink-2); font-weight: 600; }
.sh-ghost-paper { display: grid; align-content: start; gap: 6px; width: 56px; height: 72px; padding: 12px 10px; border-radius: 6px; border: 1px dashed var(--line-strong); }
.sh-ghost-paper i { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.sh-ghost-paper i:first-child { width: 60%; }
.sh-ghost-paper i:last-child { width: 40%; justify-self: end; margin-top: 8px; }
/* Rail: the action card, then what we understood */
.sh-act { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.sh-act h2 { font-size: 16px; margin-bottom: 12px; }
.sh-act-lead { margin: -4px 0 14px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.sh-act .sh-note { margin-bottom: 10px; }
.sh-act .sh-note a { white-space: nowrap; }
.sh-act-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sh-act-more > *, .sh-act-more form .btn { flex: 1 1 0; }
.sh-act-more form { display: flex; flex: 1 1 0; }
.sh-act-more .btn { width: 100%; }
.sh-act-help { margin-top: 10px; line-height: 1.45; }
.sh-date { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.sh-date > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); }
.sh-date > summary::-webkit-details-marker { display: none; }
.sh-date > summary b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.sh-date > summary .link-like { margin-left: auto; }
.sh-date[open] > summary .link-like { display: none; }
.sh-date .field { margin: 10px 0 0; }
.sh-understood h2 { font-size: 15px; margin-bottom: 8px; }
.sh-facts { margin: 0; display: grid; font-size: 13.5px; }
.sh-facts > div { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }
.sh-facts > div:first-child { border-top: 0; padding-top: 2px; }
.sh-facts dt { color: var(--muted); font-size: 12px; }
.sh-facts dd { margin: 0; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.sh-facts dd a { font-size: 13px; font-weight: 550; margin-left: 6px; }
.sh-colmap, .sh-vatmap { list-style: none; margin: 0; padding: 0 !important; display: grid; gap: 4px !important; }
.sh-colmap li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: baseline; gap: 10px; font-size: 13px; }
.sh-colmap-h { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-colmap-r { font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.sh-colmap li.is-personal .sh-colmap-r { font-weight: 500; color: var(--muted); }
.sh-colmap .icon { width: 12px; height: 12px; color: var(--faint); flex: none; }
.sh-colmap .sh-conf { grid-column: 2; margin-top: -3px; }
.sh-conf { font-size: 11.5px; color: var(--faint); }
.sh-vatmap li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; font-size: 13px; }
.sh-vatmap li > span:first-child { min-width: 0; }
.sh-vatmap .sh-conf { grid-column: 1; margin-top: -2px; }
.sh-vatmap .inv-vat-tag { padding: 2px 8px; font-size: 12px; grid-column: 2; grid-row: 1; }
.sh-missing { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); font-weight: 600; }
.sh-missing::before { content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--g-ring) center / contain no-repeat; mask: var(--g-ring) center / contain no-repeat; }
@media (max-width: 1100px) { .sh-act { order: 0; } .sh-understood { order: 0; } }
@media (max-width: 760px) {
  .sh-edit-head { padding: 14px 16px; }
  .sh-edit-sec { padding: 16px 16px 18px; }
  .sh-placeholder { grid-template-columns: 48px minmax(0, 1fr); padding: 18px 16px; gap: 14px; }
  .sh-act-more .btn { min-height: 44px; }
}

/* "Así leímos la hoja": the stored preview with each column's role under its header */
.sh-peek .panel-head { flex-wrap: wrap; padding-bottom: 12px; }
.sh-peek-wrap { border-top: 1px solid var(--line); overflow-x: auto; }
.sh-peek-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sh-peek-table th { padding: 10px 12px 9px; text-align: left; vertical-align: bottom; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.sh-peek-h { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.sh-peek-r { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11.5px; font-weight: 550; color: var(--faint); }
.sh-peek-table th.is-used .sh-peek-r { padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.sh-peek-table th.is-personal .sh-peek-h { color: var(--muted); }
.sh-peek-r .icon { width: 11px; height: 11px; }
.sh-peek-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.sh-peek-table tr:last-child td { border-bottom: 0; }
.sh-peek-table td.is-personal { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--sunken) 6px 12px); }
.sh-peek-foot { margin: 0; padding: 12px 22px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .sh-peek-foot { padding: 12px 16px 14px; } }
.sh-main > *, .sh-rail > * { min-width: 0; }

/* Client: "¿A quién facturamos esta hoja?" as cards; "Otra" reveals what the invoice needs */
.pick-who { margin-bottom: 14px; }
.pick-card.is-other { border-style: dashed; }
.pick-card.is-other:has(input:checked) { border-style: solid; }
.pick-other { display: none; margin-top: 4px; padding: 14px 16px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.req-body form:has(.pick-card.is-other input:checked) .pick-other,
.req-body form:has(.pick-other .field-error) .pick-other { display: block; }
.pick-other .req-note { margin: 0 0 12px; }
@media (max-width: 760px) { .pick-cards { grid-template-columns: minmax(0, 1fr); } .pick-card { min-height: 52px; align-content: center; } }
.sh-decided { margin: -4px 0 10px; font-size: 12.5px; color: var(--muted); }
.sh-unused { margin: 6px 0 0; font-size: 12px; color: var(--faint); }
.sh-missing.is-wait { color: var(--accent-ink); }
.sh-missing.is-wait::before { -webkit-mask-image: var(--g-clock); mask-image: var(--g-clock); }
.sheet-state[data-key="waiting_client"], .sheet-state[data-key="desk"] { --glyph: var(--g-clock); --gc: var(--accent); }
.state.chip.sheet-state[data-key="waiting_client"], .state.chip.sheet-state[data-key="desk"] { background: var(--accent-soft); color: var(--accent-ink); }
.sh-desk-q { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.sh-desk-q::before { content: "«"; } .sh-desk-q::after { content: "»"; }
q.sh-desk-q { quotes: none; }

/* ── Alta como autónomo (docs/ALTA_AUTONOMO.md) ─────────────────────────────── */
/* Datos básicos: "¿Ya eres autónomo?" first; "Todavía no" swaps the date label and hides the local and previous-gestoría
   question. The server validates either way (BasicFactsForm.clean). */
.datos-ya .pick-cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.datos-ya .pick-card-sub { font-size: 12.5px; color: var(--muted); }
.datos-fecha .when-alta { display: none; }
.datos-grid:has(input[name$="-ya_autonomo"][value="no"]:checked) .datos-fecha .when-alta { display: inline; }
.datos-grid:has(input[name$="-ya_autonomo"][value="no"]:checked) .datos-fecha div.when-alta { display: block; }
.datos-grid:has(input[name$="-ya_autonomo"][value="no"]:checked) .datos-fecha .when-ya,
.datos-grid:has(input[name$="-ya_autonomo"][value="no"]:checked) .datos-ya-only { display: none; }
.datos-ya-only { grid-column: 1 / -1; }

/* "Tu alta como autónomo": numbered groups in the order the 036 and the RETA ask */
.alta-form { display: grid; gap: 4px; }
.alta-group { padding: 16px 0 6px; border-top: 1px solid var(--line); }
.alta-group:first-child { border-top: 0; padding-top: 0; }
.alta-group-h { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.005em; }
.alta-group-n { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 650; }
.alta-group-why { margin: 0 0 12px 34px; max-width: 62ch; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.alta-group > .req-form-grid, .alta-group > .field, .alta-group > .alta-where, .alta-group > .alta-before, .alta-group > .alta-colegio { margin-left: 34px; }
.alta-group-h + .req-form-grid, .alta-group-h + .alta-where, .alta-group-h + .field { margin-top: 12px; }
.alta-local, .alta-before-more, .alta-colegio-more { display: none; margin: 2px 0 10px; padding: 14px 16px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.alta-where:has(input[name$="-lugar_trabajo"][value="local"]:checked) .alta-local,
.alta-where:has(.alta-local .field-error) .alta-local,
.alta-before:has(input[name$="-autonomo_antes"][value="si"]:checked) .alta-before-more,
.alta-before:has(.alta-before-more .field-error) .alta-before-more,
.alta-colegio:has(input[name$="-colegiado_mutualidad"][value="si"]:checked) .alta-colegio-more,
.alta-colegio:has(.alta-colegio-more .field-error) .alta-colegio-more { display: grid; }
.input-suffix { display: flex; align-items: stretch; max-width: 320px; }
.input-suffix input { min-width: 0; flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; font-variant-numeric: tabular-nums; }
.input-suffix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-btn) var(--radius-btn) 0; background: var(--surface-2); color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.field-error .input-suffix span { border-color: var(--danger); }
@media (max-width: 760px) {
  .alta-group-why, .alta-group > .req-form-grid, .alta-group > .field, .alta-group > .alta-where, .alta-group > .alta-before, .alta-group > .alta-colegio { margin-left: 0; }
  .input-suffix { max-width: none; }
}

/* The altas we filed: receipt rows with the justificante */
.alta-receipts { display: grid; gap: 12px; }
.alta-receipts.is-partial { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.alta-receipts-lead { margin: 0; max-width: 64ch; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.alta-receipt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alta-receipt { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.alta-receipt-tile { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success-ink); }
.alta-receipt-text { display: grid; gap: 2px; min-width: 0; }
.alta-receipt-text b { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.alta-receipt-text span { font-size: 13px; color: var(--muted); }
.alta-receipt-open { min-height: 40px; }
@media (max-width: 760px) {
  .alta-receipt { grid-template-columns: 40px minmax(0, 1fr); }
  .alta-receipt-open { grid-column: 1 / -1; min-height: 44px; }
}

/* Seguridad Social guide extras (same .apod language) */
.apod-pre { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; margin: 0 0 20px; padding: 16px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); border-radius: 12px; background: var(--warn-soft); }
.apod-pre-tile { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); color: var(--warn); }
.apod-pre .apod-h { margin-top: 2px; }
.apod-pre p { margin: 0 0 10px; max-width: 62ch; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.apod-pre p.apod-small { font-size: 13px; color: var(--muted); }
.apod-codes-wide > div { grid-template-columns: 1fr; gap: 2px; }
.apod-codes-wide dt { letter-spacing: 0; font-size: 13.5px; }
@media (max-width: 760px) { .apod-pre { grid-template-columns: 1fr; } }

/* Operator: "Alta como autónomo" panel */
.alta-panel-body { display: grid; gap: 18px; }
.alta-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.alta-kpi { display: grid; align-content: start; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.alta-kpi-k { font-size: 12.5px; color: var(--muted); }
.alta-kpi b { font-size: 18px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.alta-kpi b .state { font-size: 15px; }
.alta-kpi-sub { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.alta-kpi-sub.is-hot { color: var(--danger); font-weight: 600; }
.alta-dl dd > span { display: block; }
.alta-apod { display: block; margin-bottom: 4px; }
.alta-apod-check { margin: 6px 0; }
.alta-flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alta-flags li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: start; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.alta-flags li .icon { margin-top: 2px; color: var(--muted); }
.alta-flags li.is-hot { background: var(--warn-soft); color: var(--ink); }
.alta-flags li.is-hot .icon { color: var(--warn); }
.alta-records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.alta-record { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.alta-record.is-done { border-color: color-mix(in srgb, var(--success) 45%, var(--line)); }
.alta-record-h { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.alta-record-done { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13.5px; color: var(--ink-2); }
.alta-record-done .icon { color: var(--success-ink); }
@media (max-width: 900px) { .alta-kpis, .alta-records { grid-template-columns: minmax(0, 1fr); } }
.panel-section > .alta-receipts { margin-left: 40px; }
@media (max-width: 760px) { .panel-section > .alta-receipts { margin-left: 0; } }

/* ── The portal as an app: camera button, photos sheet, install hint ── */
.drop-camera { display: none; position: relative; }
@media (max-width: 760px) {
  .drop .drop-zone { flex-wrap: wrap; row-gap: 10px; }
  .drop .drop-copy { flex: 1 1 0; }
  .drop .drop-controls { flex: 1 1 100%; gap: 8px; }
  .drop .drop-controls .btn { flex: 1; min-height: 44px; }
  .drop-camera { display: inline-flex; }
  .drop-camera { background: #1f6fa5; border-color: #1f6fa5; color: #fff; box-shadow: none; }
  .drop-camera:hover { background: #1a5276; border-color: #1a5276; color: #fff; }
}

.shots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shot { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r); overflow: hidden; background: var(--sunken); border: 1px solid var(--line); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot.is-busy { display: grid; place-items: center; }
.shot-wait { font-size: 12.5px; color: var(--muted); }
.shot.is-busy .shot-wait::before { content: ""; display: block; width: 18px; height: 18px; margin: 0 auto 6px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: shot-spin .8s linear infinite; }
@keyframes shot-spin { to { transform: rotate(360deg); } }
.shot-x { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(16, 24, 40, .62); color: #fff; cursor: pointer; }
.shot-x:hover { background: rgba(16, 24, 40, .82); }
.shot-n { position: absolute; left: 6px; bottom: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgba(16, 24, 40, .62); color: #fff; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.shots-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.shots-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.shots-actions .btn { min-height: 48px; }
.shots-more { position: relative; }
.shots-more:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.shots-send:disabled { opacity: .55; cursor: default; }
@media (prefers-reduced-motion: reduce) { .shot.is-busy .shot-wait::before { animation: none; } }

.install-hint {
  display: flex; align-items: center; gap: 12px; margin-top: 24px; padding: 12px 8px 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1);
}
.install-hint-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); }
.install-hint-copy { flex: 1; min-width: 0; }
.install-hint-copy strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.install-hint-copy span { display: block; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.install-hint-go { flex: none; min-height: 36px; padding: 0 12px; font-size: 13px; }
.install-hint-x { flex: none; width: 36px; height: 36px; }
.install-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 14px; }
.install-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.install-steps strong { color: var(--ink); font-weight: 600; }
.install-step-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 650; }
.install-share { display: inline-block; vertical-align: -3px; margin: 0 2px; color: var(--accent-ink); }
.install-sheet-ok { width: 100%; min-height: 48px; margin-top: 20px; }

/* ══ Resumen: the year at a glance (gestoria/templates/gestoria/resumen.html) ══════════════ */
:root { --rs-in: #2e86c1; --rs-out: #d17f12; --rs-in-soft: #e6f0f9; --rs-out-soft: #fbefdf; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --rs-in: #3d8fcc; --rs-out: #c98425; --rs-in-soft: rgba(61, 143, 204, .18); --rs-out-soft: rgba(201, 132, 37, .16); }
}
:root[data-theme="dark"] { --rs-in: #3d8fcc; --rs-out: #c98425; --rs-in-soft: rgba(61, 143, 204, .18); --rs-out-soft: rgba(201, 132, 37, .16); }

.rs-head { flex-wrap: wrap; }
.rs-head p { max-width: 62ch; }
.rs-years { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); flex: none; }
.rs-years a { min-width: 58px; min-height: 34px; display: inline-grid; place-items: center; padding: 0 12px; border-radius: 7px; color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rs-years a:hover { color: var(--ink); text-decoration: none; }
.rs-years a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--line); }

.rs-mark { font-size: .6em; font-weight: 600; margin-left: 2px; color: inherit; opacity: .7; vertical-align: super; line-height: 0; }

/* Hero: rendimiento neto and the two figures behind it */
.rs-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px 32px; margin-bottom: 28px; padding: 26px 28px 24px; }
.rs-hero-main { display: grid; align-content: start; gap: 4px; }
.rs-hero-label { margin-top: 10px; font-size: 14px; font-weight: 550; color: var(--hero-ink-2); }
.rs-hero-figure { font-size: 44px; line-height: 1.05; font-weight: 650; letter-spacing: -0.03em; color: var(--hero-ink); white-space: nowrap; }
.rs-hero-sub { margin-top: 8px; font-size: 13.5px; color: var(--hero-ink-2); max-width: 46ch; }
.rs-hero-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; align-content: start; }
.rs-hero-fig { margin: 0; padding: 15px 16px 14px; border-radius: 14px; background: var(--hero-panel); border: 1px solid var(--hero-line); min-width: 0; }
.rs-hero-fig dt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hero-ink-2); }
.rs-hero-fig dt .icon { width: 15px; height: 15px; stroke-width: 2.1; }
.rs-in dt .icon { color: #7cc4f4; }
.rs-out dt .icon { color: #f2b765; }
.rs-hero-fig dd { margin: 4px 0 0; font-size: 22px; font-weight: 650; letter-spacing: -0.022em; color: var(--hero-ink); white-space: nowrap; }
.rs-hero-fig dd.rs-hero-note { margin-top: 2px; font-size: 12.5px; font-weight: 400; letter-spacing: 0; color: var(--hero-ink-2); white-space: normal; }
.rs-split { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 18px; border-top: 1px solid var(--hero-line); }
.rs-split-bar { display: flex; height: 10px; border-radius: 5px; background: #4fa7e3; overflow: hidden; }
.rs-split-bar i { display: block; height: 100%; background: #e8a245; border-right: 2px solid var(--hero-bg); transform-origin: left; animation: bar-grow .8s cubic-bezier(.2, .8, .2, 1) both; }
.rs-split-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--hero-ink-2); }
.rs-split-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.rs-split-legend i { width: 9px; height: 9px; border-radius: 2px; }
.rs-split .rs-key-out { background: #e8a245; }
.rs-split .rs-key-net { background: #4fa7e3; }

/* Tax cards */
.rs-section { margin-bottom: 28px; }
.rs-h { font-size: 16px; letter-spacing: -0.012em; margin-bottom: 12px; }
.rs-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.rs-card { display: flex; flex-direction: column; padding: 18px 20px 16px; }
.rs-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rs-card-head h3 { font-size: 15px; }
.rs-card-tile { display: inline-grid; place-items: center; min-width: 38px; height: 30px; padding: 0 7px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.rs-card-tile.is-ss { background: var(--success-soft); color: var(--success-ink); }
.rs-dl { margin: 0; display: grid; }
.rs-dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rs-dl > div:first-child { border-top: 0; padding-top: 0; }
.rs-dl dt { font-size: 14px; color: var(--ink-2); min-width: 0; }
.rs-dl dt span { display: block; font-size: 12.5px; color: var(--muted); }
.rs-dl dd { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.rs-dl .rs-total { margin-top: 2px; border-top: 1px solid var(--line-strong); }
.rs-dl .rs-total dt { font-weight: 600; color: var(--ink); }
.rs-dl .rs-total dd { font-size: 19px; font-weight: 650; letter-spacing: -0.018em; }
.rs-dl .rs-solo { border-top: 0; padding-top: 0; flex-direction: column; align-items: flex-start; gap: 4px; }
.rs-dl .rs-solo dd { font-size: 26px; letter-spacing: -0.024em; }
.rs-card-foot { margin-top: auto; padding-top: 10px; font-size: 12.5px; color: var(--muted); }

/* Monthly chart */
.rs-chart-panel { margin-bottom: 28px; }
.rs-chart-head { flex-wrap: wrap; }
.rs-legend { list-style: none; display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.rs-legend li { display: inline-flex; align-items: center; gap: 7px; }
.rs-legend i, .rs-key-in, .rs-key-out { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.rs-key-in { background: var(--rs-in); }
.rs-key-out { background: var(--rs-out); }
.rs-chart { position: relative; height: 280px; padding: 14px 18px 4px 12px; }
.rs-table-toggle { padding: 4px 22px 16px; font-size: 13px; }
.rs-table-toggle summary { cursor: pointer; color: var(--accent-ink); font-weight: 550; width: fit-content; }
.rs-scroll { overflow-x: auto; margin-top: 10px; }
.rs-month-table { font-size: 13.5px; max-width: 420px; }
.rs-month-table th, .rs-month-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.rs-month-table .num { text-align: right; }
.rs-month-table thead th { color: var(--muted); font-weight: 550; font-size: 12.5px; }

/* Quarters */
.rs-quarters { margin-bottom: 28px; overflow: hidden; }
.rs-qtable { margin-top: 12px; font-size: 14px; }
.rs-qtable thead th { padding: 10px 14px; font-size: 12.5px; font-weight: 550; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rs-qtable th:first-child, .rs-qtable td:first-child { padding-left: 22px; }
.rs-qtable th:last-child, .rs-qtable td:last-child { padding-right: 22px; }
.rs-qtable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-q-row th, .rs-q-row td { padding: 16px 14px 8px; vertical-align: top; }
.rs-q-row th { text-align: left; font-weight: 400; }
.rs-q-row td.num { font-size: 15px; font-weight: 600; color: var(--ink); }
.rs-q-name { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }
.rs-q-months { display: block; font-size: 12.5px; color: var(--muted); }
.rs-q-state { width: 1%; white-space: nowrap; }
.rs-q-detail td { padding: 4px 22px 16px; border-bottom: 1px solid var(--line); }
.rs-q:last-of-type .rs-q-detail td { border-bottom-color: var(--line-strong); }
.rs-q[data-state="none"] .rs-q-row td.num, .rs-q[data-state="preparing"] .rs-q-row td.num { color: var(--ink-2); }
.rs-q-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.rs-q-foot .rs-excel { margin-left: auto; }
.rs-excel, .rs-pay-receipt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 550; white-space: nowrap; }
.rs-pays { list-style: none; display: grid; gap: 8px; margin-bottom: 10px; }
.rs-pays li { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: 4px 14px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.rs-pays .modelo-tile { grid-area: auto; width: 40px; height: 40px; border-radius: 10px; font-size: 12.5px; }
.rs-pays li[data-outcome="compensate"] .modelo-tile, .rs-pays li[data-outcome="refund"] .modelo-tile { background: var(--success-soft); color: var(--success-ink); }
.rs-pays li[data-outcome="zero"] .modelo-tile { background: var(--chip-neutral); color: var(--muted); }
.rs-pay-name, .rs-pay-out { display: grid; min-width: 0; }
.rs-pay-name b { font-size: 14px; font-weight: 600; }
.rs-pay-name span, .rs-pay-out span { font-size: 12.5px; color: var(--muted); }
.rs-pay-out b { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
.rs-pay-receipt.muted { font-weight: 400; color: var(--muted); }
.rs-qtable tfoot th, .rs-qtable tfoot td { padding: 14px; font-size: 15px; font-weight: 650; color: var(--ink); background: var(--surface-2); text-align: left; }
.rs-qtable tfoot td.num { text-align: right; }

/* Annual returns */
.rs-annual { margin-bottom: 28px; }
.rs-annual .panel-head { align-items: center; }
.rs-pays-annual { padding: 14px 22px 18px; margin: 0; }
.rs-annual-pending { padding: 12px 22px 20px; font-size: 14px; color: var(--ink-2); }

/* Top clients and expense categories */
.rs-tops { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.rs-top .panel-head { align-items: baseline; }
.rs-bars { list-style: none; display: grid; gap: 14px; padding: 16px 22px 20px; }
.rs-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.rs-bar-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.rs-bar-name small { margin-left: 8px; font-size: 12.5px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.rs-bar-name .cat-tile { width: 28px; height: 28px; border-radius: 8px; }
.rs-bar-name .cat-tile .icon { width: 15px; height: 15px; }
.rs-bars b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.rs-bar { grid-column: 1 / -1; display: block; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.rs-bar i { display: block; height: 100%; min-width: 3px; border-radius: inherit; transform-origin: left; animation: bar-grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.rs-bar-in i { background: var(--rs-in); }
.rs-bar-out i { background: var(--rs-out); }
.rs-bars li.is-rest .rs-bar-name { color: var(--muted); font-weight: 500; }
.rs-bars li.is-rest .rs-bar i { background: var(--faint); }

/* The one note, below the data */
.rs-notes { display: grid; gap: 6px; max-width: 78ch; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.rs-notes .rs-mark { opacity: 1; }

.rs-empty { display: flex; align-items: flex-start; gap: 16px; padding: 24px; max-width: 720px; }
.rs-empty b { display: block; font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.rs-empty p { font-size: 14px; color: var(--ink-2); max-width: 56ch; }

@media (max-width: 900px) {
  .rs-hero { grid-template-columns: 1fr; }
  .rs-tops { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .rs-years { width: 100%; overflow-x: auto; }
  .rs-years a { flex: 1; }
  .rs-hero { padding: 20px 18px 18px; gap: 18px; margin-bottom: 22px; }
  .rs-hero-figure { font-size: 36px; }
  .rs-hero-figs { gap: 10px; }
  .rs-hero-fig { padding: 12px 12px 11px; }
  .rs-hero-fig dd { font-size: 18px; }
  .rs-section, .rs-chart-panel, .rs-quarters, .rs-annual { margin-bottom: 22px; }
  .rs-cards { grid-template-columns: 1fr; gap: 12px; }
  .rs-card { padding: 16px; }
  .rs-chart { height: 230px; padding: 10px 8px 2px 4px; }
  .rs-table-toggle { padding: 4px 16px 14px; }
  /* Quarters become cards: name and state on top, the figures in a 2-column grid */
  .rs-qtable, .rs-qtable tbody, .rs-qtable tfoot, .rs-qtable tr, .rs-qtable th, .rs-qtable td { display: block; }
  .rs-qtable thead { display: none; }
  .rs-q { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .rs-q-row { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .rs-qtable .rs-q-row th, .rs-qtable .rs-q-row td { padding: 0; }
  .rs-q-row th { grid-column: 1; grid-row: 1; }
  .rs-q-row .rs-q-state { grid-column: 2; grid-row: 1; justify-self: end; width: auto; }
  .rs-q-row td.num, .rs-qtable tfoot td.num { text-align: left; font-size: 15px; }
  .rs-q-row td.num::before, .rs-qtable tfoot td.num::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
  .rs-qtable .rs-q-detail td { padding: 12px 0 0; border-bottom: 0; }
  .rs-pays li { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .rs-pay-out { grid-column: 2 / -1; }
  .rs-pay-receipt { grid-column: 3; grid-row: 1; }
  .rs-q-foot .rs-excel { margin-left: 0; min-height: 44px; }
  .rs-qtable tfoot tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px 16px; background: var(--surface-2); }
  .rs-qtable tfoot th { grid-column: 1 / -1; padding: 0; }
  .rs-qtable tfoot td { padding: 0; }
  .rs-qtable tfoot td:empty { display: none; }
  .rs-bars { padding: 14px 16px 18px; }
  .rs-pays-annual { padding: 12px 16px 16px; }
  .rs-annual-pending { padding: 10px 16px 18px; }
  .rs-empty { padding: 18px 16px; }
}
/* ══ end Resumen ═══════════════════════════════════════════════════════════════════════ */
/* Resumen: projection (estimates, marked with ≈ and explained once in the note) */
:root { --rs-in-proj: rgba(46, 134, 193, .22); --rs-out-proj: rgba(209, 127, 18, .22); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rs-in-proj: rgba(61, 143, 204, .26); --rs-out-proj: rgba(201, 132, 37, .26); } }
:root[data-theme="dark"] { --rs-in-proj: rgba(61, 143, 204, .26); --rs-out-proj: rgba(201, 132, 37, .26); }
.rs-key-proj { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--muted); background: repeating-linear-gradient(135deg, transparent 0 2px, var(--line-strong) 2px 3px); }
.rs-est { border-style: dashed; border-color: var(--line-strong); }
.rs-card-tile.is-est { background: var(--chip-neutral); color: var(--ink-2); }
.rs-card-tile.is-gold { background: var(--warn-soft); color: var(--warn); }
.rs-dl dd.is-good { color: var(--success-ink); }
.rs-reserve .rs-total dd { color: var(--ink); }
/* ══ end Resumen projection ══ */
/* ══ Mis archivos: what Kuotia sorted from Otros (gestoria/_archive_sorted.html) ══════════════════ */
.arch-sorted { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 13px; color: var(--ink-2); }
.arch-sorted > .icon { width: 13px; height: 13px; flex: none; color: var(--success); transform: translateY(2px); }
.arch-sorted form { display: inline; margin: 0; }
.arch-sorted .link-btn, .arch-sorted a { font-size: 13px; }
.arch-hero-text .arch-sorted { margin-top: 6px; }
.arch-moved { margin: 0 0 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--accent-soft); }
.arch-moved h2 { margin: 0 0 2px; font-size: 15px; }
.arch-moved p { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.arch-moved ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.arch-moved li { display: grid; gap: 2px; min-width: 0; }
.arch-moved-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .arch-sorted { order: 4; } }
/* Impuestos period card: Excel of the quarter next to the question (Resumen block above owns .rs-excel) */
.period-actions { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 760px) { .period-actions { margin-left: 0; width: 100%; justify-content: space-between; } }
/* ══ Instant preview (static/gestoria/preview.js, gestoria/_peek.html) ═══════════════════════════ */
tr[data-peek] { cursor: pointer; }
.doc-table tbody tr.peek-current, .op-table tbody tr.peek-current, .arch-row.peek-current, .doc-cards li.peek-current > a { background: var(--accent-soft); }
.peek-scrim { position: fixed; inset: 0; z-index: 64; background: var(--scrim); opacity: 0; transition: opacity .2s; }
.peek-scrim.on { opacity: 1; }
.peek {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 65; width: min(1080px, calc(100vw - 48px));
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border-radius: 18px 0 0 18px; box-shadow: -1px 0 0 var(--line), var(--shadow-sheet);
  transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); overflow: hidden;
}
.peek.on { transform: none; }
.peek-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 56px; padding: 0 10px; border-bottom: 1px solid var(--line); flex: none; }
.peek-nav { display: flex; align-items: center; }
.peek-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.peek-count { min-width: 56px; text-align: center; font-size: 13px; color: var(--muted); }
.peek-count:empty { display: none; }
.peek-title { margin: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-title:focus { outline: none; }  /* focused by script to announce the dialog; never typed into */
.peek-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.peek-view { position: relative; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: auto; padding: 20px; background: var(--sunken); }
.peek-view[data-mode="pdf"]:not(.is-page) { padding: 0; }
.peek-view iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.peek-view img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .10); }
.peek-view.is-page { grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.peek-caption { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.peek-loading { margin: 0; font-size: 14px; color: var(--muted); }
.peek-view.is-loaded .peek-loading { visibility: hidden; }
.peek-tile { display: grid; justify-items: center; gap: 12px; max-width: 280px; text-align: center; }
.peek-tile p { margin: 0; font-size: 14px; color: var(--muted); }
.peek-tile-ext { display: grid; place-items: center; width: 76px; height: 92px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.peek-side { min-height: 0; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 18px; padding: 20px 20px 24px; border-left: 1px solid var(--line); }
.peek-file { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.peek-facts { margin: 0; display: grid; gap: 14px; }
.peek-facts div { display: grid; gap: 3px; min-width: 0; }
.peek-facts dt { font-size: 12.5px; color: var(--muted); }
.peek-facts dd { margin: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.peek-facts .is-amount dd { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.peek-actions { display: grid; gap: 8px; }
.peek-actions .btn { width: 100%; }
.peek-actions .btn-ghost { justify-content: center; }
.peek-actions .btn[hidden] { display: none; }
.peek-keys { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: auto 0 0; font-size: 12px; color: var(--muted); }
.peek-keys kbd { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); font: inherit; font-size: 11px; color: var(--ink-2); }
@media (hover: none) { .peek-keys { display: none; } }
@media (max-width: 760px) {
  .peek { width: 100vw; height: 100dvh; bottom: auto; border-radius: 0; box-shadow: none; }
  .peek-bar { padding: 0 4px 0 2px; gap: 4px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  .peek-count { min-width: 44px; }
  .peek-main { display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; }
  .peek-view { flex: none; height: 52dvh; padding: 14px; }
  .peek-view.is-tile { height: auto; min-height: 220px; }
  .peek-side { flex: 1 0 auto; overflow: visible; border-left: 0; border-top: 1px solid var(--line); padding: 16px 16px 0; gap: 16px; }
  .peek-facts { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .peek-facts .is-amount, .peek-facts .is-wide { grid-column: 1 / -1; }
  /* Abrir and Descargar stay in reach while the facts scroll */
  .peek-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: auto -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .peek-actions .btn { flex: 1 1 140px; width: auto; min-height: 44px; }
  .peek-actions .btn-ghost { flex-basis: 100%; min-height: 36px; }
  .peek-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) { .peek, .peek-scrim { transition: none; } }
/* ══ end Instant preview ══ */

/* ══ Retirar (gestoria/withdrawal.py): row action, detail action, the question and "Deshacer" ══ */
.doc-table col.c-act { width: 52px; }
.doc-table td.c-act-cell { padding: 0 8px 0 0; text-align: right; }
.doc-table td.c-act-cell:last-child > * { padding-right: 0; }
.row-withdraw {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent;
  color: var(--faint); cursor: pointer; opacity: 0; transition: opacity .12s, background-color .12s, color .12s;
}
.row-withdraw .icon { width: 18px; height: 18px; }
.row-withdraw:hover { background: var(--danger-soft); color: var(--danger); }
.row-withdraw:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.doc-table tbody tr:hover .row-withdraw, .doc-table tbody tr:focus-within .row-withdraw, .doc-table tbody tr.peek-current .row-withdraw { opacity: 1; }
@media (hover: none) { .row-withdraw { opacity: 1; } }
.doc-cards .row-withdraw { display: none; }
@media (max-width: 760px) {
  .doc-cards li.has-withdraw { position: relative; }
  .doc-cards li.has-withdraw .row-withdraw { display: inline-grid; position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px; opacity: 1; }
  .doc-cards li.has-withdraw .state-detail { padding-right: 44px; }
}
/* Leaving the list while "Deshacer" lasts; back when undone */
.doc-table tbody tr.is-withdrawn, .doc-cards li.is-withdrawn { display: none; }
.state[data-key="withdrawn"] { --glyph: var(--g-dash); --gc: var(--faint); color: var(--muted); }

/* Detail: "Retirar" at the end of the file actions; in use, the same word says why and offers the question */
.doc-actions .doc-withdraw { margin-left: auto; }
.doc-actions .doc-withdraw[open] { flex-basis: 100%; margin-left: 0; }
button.link-danger { border: 0; background: none; gap: 6px; }
.doc-withdraw .link-danger { gap: 6px; }
.doc-withdraw .link-danger .icon { width: 16px; height: 16px; }
.doc-withdraw.is-locked > summary { color: var(--muted); }
.doc-withdraw.is-locked > summary:hover { color: var(--ink); }
.doc-withdraw.is-locked[open] > summary { color: var(--ink); }
.withdraw-why { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.withdraw-why p { flex: 1 1 240px; display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 14px; color: var(--ink-2); }
.withdraw-why p .icon { flex: none; margin-top: 2px; color: var(--muted); }
.withdraw-why .btn { min-height: 40px; }

/* The question: a bottom sheet on the phone, a centred card on desktop (same as the archive's dialogs) */
dialog.withdraw-sheet { max-width: 460px; }
.withdraw-sheet .bs-head h2 { overflow-wrap: anywhere; line-height: 1.3; }
.withdraw-sheet .bs-body { gap: 12px; }
.withdraw-text { margin: 0; font-size: 15px; color: var(--ink-2); }
.withdraw-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: 14px; }
.withdraw-note .icon { flex: none; margin-top: 2px; color: var(--warn); }
.withdraw-note[hidden] { display: none; }
.withdraw-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.withdraw-actions .btn { min-height: 44px; }
@media (max-width: 760px) {
  .withdraw-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

/* "Deshacer" inside the toast: works on the dark toast in the light theme and on the light one in the dark theme */
.toast .toast-action {
  width: auto; height: 30px; margin: -5px 0 0; padding: 0 12px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 999px; font-size: 13.5px; font-weight: 650; opacity: 1; white-space: nowrap;
}
.toast .toast-action:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.toast .toast-action:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Preview panel: Retirar under the file actions; in use, why not and the question */
.peek-withdraw { display: grid; gap: 8px; }
.peek-withdraw[hidden], .peek-withdraw [hidden] { display: none; }
.peek-withdraw .link-danger { justify-content: center; width: 100%; }
.peek-locked { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.peek-locked p { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13.5px; color: var(--ink-2); }
.peek-locked p .icon { flex: none; margin-top: 2px; color: var(--muted); }
.peek-withdraw .link-danger.is-muted:hover, .peek-withdraw .link-danger.is-muted[aria-expanded="true"] { color: var(--ink); }
@media (max-width: 760px) {
  .peek-withdraw { order: 2; }
  .peek-side > .peek-actions { order: 3; }
}

/* Operator: what the client withdrew */
.op-withdrawn { border-top: 1px solid var(--line); }
.op-withdrawn > summary { display: flex; align-items: center; gap: 8px; padding: 12px 22px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none; }
.op-withdrawn > summary::-webkit-details-marker { display: none; }
.op-withdrawn > summary .n { font-weight: 550; color: var(--muted); }
.op-withdrawn .rows { padding: 0 22px 12px; }
.op-withdrawn .rows > li { display: grid; gap: 2px; padding: 9px 0; }
.op-withdrawn-name { font-weight: 550; color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .op-withdrawn > summary, .op-withdrawn .rows { padding-left: 16px; padding-right: 16px; } }
/* ══ end Retirar ══ */

/* ══ Conversation thread: the client's Mensajes and the operator's client page (gestoria/_message.html) ══
   Read like a support inbox: the viewer's own messages on the right (.is-mine), the other side on the left,
   one header per run of messages (|grouped), a divider per day, notes and drafts marked in their own style. */
.thread { --bubble-theirs: var(--surface-2); list-style: none; padding: 20px 28px 12px; display: grid; align-content: start; gap: 14px; flex: 1; }
.inbox .thread { background: var(--surface); }
.thread-day { display: flex; align-items: center; gap: 12px; margin: 4px 0 -2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.thread-day::before, .thread-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.thread-day span { display: inline-block; }
.thread-day span::first-letter { text-transform: uppercase; }
.msg { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.msg.is-mine { flex-direction: row-reverse; }
.msg.is-cont { margin-top: -9px; }
.msg.is-cont > .msg-face { visibility: hidden; height: 0; }
.msg.is-cont .msg-head { display: none; }
.msg-face { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 650; }
.msg[data-role="gestor"] .msg-face, .msg[data-role="agent"] .msg-face { background: var(--hero-bg); color: #fff; --k-mark-accent: var(--hero-accent); }
.msg-face .k-mark { width: 18px; height: 18px; }
.msg-col { display: grid; justify-items: start; gap: 5px; min-width: 0; max-width: min(600px, 80%); }
.msg.is-mine .msg-col { justify-items: end; }
.msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 18px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.msg.is-mine .msg-head { justify-content: flex-end; }
.msg-head strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.msg-head time { font-variant-numeric: tabular-nums; }
.msg-head .state.chip { padding: 1px 8px 1px 6px; font-size: 11.5px; }
.msg-head .state.chip[data-key="internal"] { background: var(--warn-soft); color: var(--warn); --gc: var(--warn); }
.msg-head .state.chip[data-key="draft"] { background: var(--accent-soft); color: var(--accent-ink); --gc: var(--accent); }
.msg-body {
  max-width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px;
  background: var(--bubble-theirs); color: var(--ink); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere;
}
.msg-body p, .msg-body ol, .msg-body ul { margin: 0; }
.msg-body > :is(p, ol, ul) + :is(p, ol, ul) { margin-top: .75em; }
.msg-body ol, .msg-body ul { display: grid; gap: .4em; padding-left: 1.5em; }
.msg-body ol { list-style: decimal; }
.msg-body ul { list-style: disc; }
.msg-body li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.msg.is-mine .msg-body { border-color: transparent; border-radius: 14px 4px 14px 14px; background: var(--accent-soft); }
.msg.is-cont .msg-body { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.msg[data-internal] .msg-body { border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent); background: var(--warn-soft); }
.msg[data-draft] .msg-col { width: min(600px, 80%); }
.msg[data-draft] .msg-body { width: 100%; border: 1px dashed var(--accent); background: var(--surface); }
.msg[data-draft] .msg-body:focus-within { border-style: solid; }
.draft-form { display: grid; gap: 10px; justify-items: end; }
.draft-form textarea {
  width: 100%; min-height: 4.65em; max-height: 60vh; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-size: 15px; line-height: 1.55; resize: vertical; field-sizing: content;
}
.draft-form textarea:focus { outline: none; box-shadow: none; }
.attachments { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.msg.is-mine .attachments { justify-content: flex-end; }
.attachments li { min-width: 0; max-width: 100%; }
.attachment {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 100%; padding: 0 11px 0 9px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.attachment .icon { flex: none; color: var(--muted); }
.attachment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment:hover { border-color: var(--line-strong); color: var(--ink); text-decoration: none; }
/* Operator: the thread sits on a sunken canvas under its row; one composer with one primary action. */
.op-thread .thread { --bubble-theirs: var(--surface); padding: 6px 22px 18px; background: var(--surface-2); border-top: 1px solid var(--line); }
.op-thread .composer { position: static; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.op-thread .composer textarea { min-height: 88px; }
.composer-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; }
.composer-attach .attach-list { margin: 0; overflow-wrap: anywhere; }
.composer-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; margin-left: auto; }
.composer-end .btn-ghost { color: var(--ink-2); }
.composer-end .btn-ghost:hover { background: var(--sunken); color: var(--ink); }
@media (max-width: 760px) {
  .thread { padding: 16px var(--gutter) 10px; }
  .inbox .thread { background: transparent; }
  .msg-col { max-width: 88%; }
  .msg[data-draft] .msg-col { width: 88%; }
  .msg.is-mine > .msg-face { display: none; }
  .msg-face { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
  .op-thread .thread, .op-thread .composer { padding-left: 16px; padding-right: 16px; }
  .op-thread .composer-bar { flex-wrap: wrap; }
  .op-thread .composer-end { width: 100%; }
  .op-thread .composer-end .btn-primary { flex: 1 0 100%; }
}
/* ══ end conversation thread ══ */
