:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --accent: #0066cc;
  --accent-soft: #e8f1fb;
  --green: #1a7f37;
  --green-soft: #e8f5ec;
  --amber: #9a6700;
  --amber-soft: #fff4d6;
  --red: #b42318;
  --red-soft: #fdecea;
  --violet: #5e5ce6;
  --violet-soft: #efeffd;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.035);
  --sidebar: 258px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: 0; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Shell */
.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: rgba(251,251,253,.92);
  border-right: 1px solid var(--line-soft);
  padding: 22px 14px 18px;
  display: flex; flex-direction: column; z-index: 40;
  backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: -.04em;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }
.nav-group { margin: 14px 0 4px; }
.nav-label { font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); padding: 0 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px;
  color: #3a3a3c; font-weight: 500; font-size: 13.5px; margin: 1px 0;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 17px; height: 17px; stroke-width: 1.7; color: #6e6e73; }
.nav-item:hover { background: rgba(0,0,0,.035); color: var(--ink); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-item.active svg { color: #fff; }
.nav-item .nav-badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 6px; font-weight: 650; }
.nav-item.active .nav-badge { background: #fff; color: var(--ink); }
.sidebar-foot { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid var(--line-soft); }
.policy-pill { display: flex; gap: 9px; align-items: center; padding: 9px 10px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line-soft); }
.policy-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.policy-pill strong { display: block; font-size: 11.5px; }
.policy-pill span { color: var(--muted); font-size: 10.5px; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; gap: 16px; padding: 0 32px;
  background: rgba(245,245,247,.84); border-bottom: 1px solid rgba(210,210,215,.55);
  backdrop-filter: saturate(180%) blur(20px);
}
.burger { display: none; border: 0; background: transparent; width: 34px; height: 34px; border-radius: 9px; align-items: center; justify-content: center; }
.burger:hover { background: rgba(0,0,0,.04); }
.crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; min-width: 0; }
.crumbs strong { color: var(--ink); font-weight: 600; }
.crumb-sep { color: #c7c7cc; }
.topbar-search { margin-left: auto; position: relative; width: 250px; }
.topbar-search svg { position: absolute; left: 11px; top: 9px; width: 15px; height: 15px; color: var(--muted-2); }
.topbar-search input {
  width: 100%; border: 1px solid var(--line-soft); background: rgba(255,255,255,.72);
  border-radius: 10px; padding: 8px 12px 8px 33px; font-size: 12.5px; outline: none;
}
.topbar-search input:focus { border-color: #a7c7e8; background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.icon-btn { position: relative; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(0,0,0,.045); }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); border: 1.5px solid var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 650; }
.user-menu { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 10px; border: 0; background: transparent; }
.user-menu:hover { background: rgba(0,0,0,.04); }
.user-meta { text-align: left; line-height: 1.2; }
.user-meta strong { display: block; font-size: 12px; font-weight: 600; }
.user-meta span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.content { max-width: 1330px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; line-height: 1.12; letter-spacing: -.035em; margin: 0; font-weight: 650; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; max-width: 660px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; font-weight: 650; }
.section-head .link { margin-left: auto; color: var(--accent); font-size: 12.5px; font-weight: 550; }
.section-head .link:hover { text-decoration: underline; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 13px; font-size: 12.5px; font-weight: 550; color: var(--ink);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  min-height: 34px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #c3c3c8; }
.btn:active { transform: scale(.985); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #333336; border-color: #333336; }
.btn.blue { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.blue:hover { background: #0058b0; border-color: #0058b0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(0,0,0,.04); color: var(--ink); }
.btn.danger { color: var(--red); border-color: #f0c8c3; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 5px 9px; min-height: 28px; font-size: 11.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); border-color: var(--line); }

/* Cards and grids */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.015em; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-head .btn { margin-left: auto; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; font-weight: 550; }
.stat-icon { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); }
.stat-icon svg { width: 14px; height: 14px; }
.stat-value { font-size: 30px; font-weight: 650; letter-spacing: -.04em; margin: 10px 0 2px; line-height: 1; }
.stat-foot { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 5px; }
.stat-foot .up { color: var(--green); font-weight: 600; }
.stat-foot .warn { color: var(--amber); font-weight: 600; }
.dashboard-hero { display: grid; grid-template-columns: 1.35fr .9fr; gap: 12px; margin-top: 12px; }
.hero-card { padding: 22px; display: flex; gap: 26px; align-items: center; min-height: 176px; background: linear-gradient(135deg,#fff 0%,#fbfbfd 100%); }
.hero-copy h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; font-weight: 650; }
.hero-copy p { margin: 7px 0 14px; color: var(--muted); font-size: 12.5px; max-width: 420px; }
.hero-metrics { display: flex; gap: 24px; }
.hero-metric strong { display: block; font-size: 18px; letter-spacing: -.03em; }
.hero-metric span { color: var(--muted); font-size: 11px; }
.ring { position: relative; width: 116px; height: 116px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-label strong { font-size: 26px; letter-spacing: -.04em; line-height: 1; }
.ring-label span { display: block; margin-top: 3px; color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; }
.split { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 12px; margin-top: 12px; }
.stack { display: grid; gap: 12px; }
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
.row-main { min-width: 0; flex: 1; }
.row-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.row-main span { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.row-side { text-align: right; }
.row-side strong { display: block; font-size: 12px; }
.row-side span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.alert { display: flex; gap: 11px; padding: 13px 16px; border-top: 1px solid var(--line-soft); align-items: flex-start; }
.alert:first-child { border-top: 0; }
.alert-icon { width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 auto; }
.alert-icon svg { width: 13px; height: 13px; }
.alert.critical .alert-icon { background: var(--red-soft); color: var(--red); }
.alert.warning .alert-icon { background: var(--amber-soft); color: var(--amber); }
.alert.info .alert-icon { background: var(--accent-soft); color: var(--accent); }
.alert strong { font-size: 12px; display: block; }
.alert span { color: var(--muted); font-size: 11px; display: block; margin-top: 2px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 8px; font-size: 10.5px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.chip.low { background: var(--green-soft); color: var(--green); }
.chip.medium { background: var(--amber-soft); color: var(--amber); }
.chip.high { background: var(--red-soft); color: var(--red); }
.chip.neutral { background: #f0f0f2; color: var(--muted); }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.no-dot::before { display: none; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 550; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--green); }
.status.warn { color: var(--amber); }
.status.bad { color: var(--red); }
.status.info { color: var(--accent); }

/* Progress */
.progress { height: 5px; background: #ededf0; border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--ink); }
.progress.green > i { background: var(--green); }
.progress.amber > i { background: #d9a514; }
.progress.red > i { background: var(--red); }
.progress-row { display: flex; align-items: center; gap: 9px; }
.progress-row span { font-size: 10.5px; color: var(--muted); min-width: 30px; text-align: right; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-title { font-weight: 600; font-size: 12.5px; }
.cell-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.mono-cell { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; letter-spacing: 0; font-weight: 550; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #efeff2; color: #4a4a4f; font-size: 10px; font-weight: 650; flex: 0 0 auto; }
.avatar-sm.blue { background: var(--accent-soft); color: var(--accent); }
.avatar-sm.violet { background: var(--violet-soft); color: var(--violet); }

/* Tabs */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; padding: 10px 12px; color: var(--muted); font-size: 12.5px; font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar .search { flex: 1; min-width: 200px; position: relative; }
.filter-select { height: 34px; max-width: 200px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); padding: 0 10px; font-size: 12px; }
.client-filters .search { flex-basis: 260px; }
.client-count { margin: -5px 0 10px; }
.help-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; vertical-align: middle; margin-left: 5px; cursor: help; line-height: 1; padding: 0; }
.help-dot:hover { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.filter-bar .search svg { position: absolute; left: 11px; top: 10px; width: 14px; height: 14px; color: var(--muted-2); }
.filter-bar input, .filter-bar select { border: 1px solid var(--line-soft); background: var(--surface); border-radius: 9px; padding: 8px 11px; font-size: 12px; outline: none; }
.filter-bar .search input { width: 100%; padding-left: 33px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: #a7c7e8; box-shadow: 0 0 0 3px var(--accent-soft); }
.segmented { display: inline-flex; background: #ededf0; border-radius: 9px; padding: 2px; gap: 1px; }
.segmented button { border: 0; background: transparent; border-radius: 7px; padding: 6px 10px; font-size: 11.5px; color: var(--muted); font-weight: 550; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Detail */
.detail-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; margin-bottom: 9px; }
.back-link:hover { color: var(--ink); }
.detail-title h1 { font-size: 25px; margin: 0; letter-spacing: -.035em; }
.detail-title .sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 6px; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 12px; align-items: start; }
.detail-main { min-width: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: #fff; }
.summary-cell { padding: 14px 16px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.summary-cell:nth-child(4n) { border-right: 0; }
.summary-cell:nth-last-child(-n+4) { border-bottom: 0; }
.summary-cell span { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.summary-cell strong { display: block; font-size: 13px; font-weight: 600; margin-top: 5px; }
.summary-cell em { font-style: normal; color: var(--muted); font-size: 11px; display: block; margin-top: 2px; }
.rail-card { padding: 18px; }
.rail-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 0 0 13px; font-weight: 650; }
.rail-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.rail-row:last-child { border-bottom: 0; }
.rail-row span { color: var(--muted); }
.rail-row strong { font-weight: 600; text-align: right; }
.row-link { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; font-weight: 600; text-align: right; }
.row-link svg { width: 12px; height: 12px; color: var(--muted-2); }
.row-link:hover { color: var(--accent); }
.row-link:hover svg { color: var(--accent); }

/* Resumen del expediente */
.summary-stack { display: grid; gap: 14px; }
.overview-card { padding: 20px 22px; }
.overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.overview-head h3 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.overview-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.overview-head .btn, .overview-head .link { flex: 0 0 auto; margin-top: 1px; }
.overview-progress { margin-top: 18px; }
.overview-progress-label { display: flex; align-items: baseline; justify-content: flex-start; gap: 10px; }
.overview-progress-label strong { font-size: 30px; line-height: 1; letter-spacing: -.05em; font-weight: 650; }
.overview-progress-label span { color: var(--muted); font-size: 11px; }
.overview-bar { height: 6px; margin-top: 10px; border-radius: 999px; background: #f0f0f3; overflow: hidden; }
.overview-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ink); transition: width .3s ease; }
.overview-bar.warn i { background: #c48a16; }
.overview-bar.bad i { background: var(--red); }
.overview-bar.ok i { background: var(--green); }
.overview-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; margin-top: 18px; border-top: 1px solid var(--line-soft); }
.overview-stats > div { padding: 13px 14px 0 0; min-width: 0; }
.overview-stats > div + div { border-left: 1px solid var(--line-soft); padding-left: 14px; }
.overview-stats span { display: block; color: var(--muted); font-size: 10.5px; }
.overview-stats strong { display: block; margin-top: 3px; font-size: 19px; line-height: 1.15; letter-spacing: -.03em; font-weight: 620; }
.overview-stats strong small { color: var(--muted); font-size: 10.5px; font-weight: 400; letter-spacing: 0; }
.overview-stats .warn strong { color: var(--amber); }
.overview-stats .bad strong { color: var(--red); }
.overview-stats .ok strong { color: var(--green); }
.overview-list { margin-top: 6px; }
.overview-list .list-row { padding: 12px 0; }
.overview-list .list-row:first-child { border-top: 0; }
.overview-list .row-side { padding-right: 2px; }
.overview-alerts { margin-top: 4px; }
.overview-alerts .alert { padding: 12px 0; }
.overview-alerts .alert:first-child { border-top: 0; }
.overview-alerts .alert strong { font-size: 12px; }
.overview-alerts .alert span { font-size: 11px; }
.threshold-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0; margin-top: 16px; border-top: 1px solid var(--line-soft); }
.threshold-item { padding: 14px 16px 0 0; }
.threshold-item + .threshold-item { border-left: 1px solid var(--line-soft); padding-left: 16px; }
.threshold-item > span { display: block; color: var(--muted); font-size: 10.5px; }
.threshold-item > strong { display: block; margin: 3px 0; font-size: 19px; letter-spacing: -.03em; color: var(--muted); }
.threshold-item.applies > strong { color: var(--green); }
.threshold-item > p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.notice-callout { border-radius: 14px; padding: 15px; margin-top: 12px; background: var(--amber-soft); border: 1px solid #f1dda2; }
.notice-callout.critical { background: var(--red-soft); border-color: #f3c6c1; }
.notice-callout.ok { background: var(--green-soft); border-color: #c6e4cd; }
.notice-callout span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.notice-callout strong { display: block; font-size: 20px; letter-spacing: -.03em; margin: 4px 0 2px; }
.notice-callout p { margin: 0; font-size: 11.5px; color: var(--muted); }
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.documents-toolbar { flex-wrap: wrap; }
.documents-toolbar > div:first-child { min-width: 0; }
.doc-card { border: 1px solid var(--line-soft); border-radius: 13px; padding: 14px; background: #fff; display: flex; gap: 11px; align-items: flex-start; }
.doc-icon { width: 33px; height: 38px; border-radius: 6px; background: #f2f2f5; display: grid; place-items: center; flex: 0 0 auto; color: var(--muted); }
.doc-icon svg { width: 16px; height: 16px; }
.doc-body { min-width: 0; flex: 1; }
.doc-body strong { font-size: 12px; display: block; }
.doc-body .muted { font-size: 10.5px; margin-top: 2px; }
.doc-actions { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.check-group { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: #fff; margin-bottom: 12px; }
.check-group-head { padding: 13px 17px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.check-group-head strong { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.check-item { display: flex; gap: 12px; padding: 12px 17px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.check-item:last-child { border-bottom: 0; }
.check-mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; margin-top: 1px; }
.check-mark svg { width: 11px; height: 11px; }
.check-mark.pass { background: var(--green-soft); color: var(--green); }
.check-mark.pending { background: var(--amber-soft); color: var(--amber); }
.check-mark.fail { background: var(--red-soft); color: var(--red); }
.check-mark.na { background: #f0f0f2; color: var(--muted); }
.check-body { flex: 1; min-width: 0; }
.check-body strong { display: block; font-size: 12px; }
.check-body p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.check-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.factor { display: grid; grid-template-columns: 160px 1fr 46px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.factor:last-child { border-bottom: 0; }
.factor span { color: var(--muted); }
.factor-bar { height: 6px; background: #ededf0; border-radius: 99px; overflow: hidden; }
.factor-bar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.factor strong { font-size: 11.5px; text-align: right; }
.gauge { display: flex; align-items: center; gap: 14px; }
.gauge-num { font-size: 36px; font-weight: 650; letter-spacing: -.05em; line-height: 1; }
.gauge-label { color: var(--muted); font-size: 11px; margin-top: 2px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.source { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 11.5px; }
.source .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.source-link { color: inherit; transition: border-color .15s ease, background .15s ease; }
.source-link:hover { border-color: #a7c7e8; background: var(--accent-soft); }
.source-link svg { width: 12px; height: 12px; margin-left: auto; color: var(--muted-2); flex: 0 0 auto; }
.lists-context { margin-top: -2px; }
.demo-strip { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid #f1dda2; border-radius: 11px; background: var(--amber-soft); color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.demo-strip .chip { flex: 0 0 auto; }
.demo-strip > span:last-child { padding-top: 1px; }
.demo-warning { margin: 0 0 12px; border: 1px solid #f1dda2; border-radius: 12px; background: var(--amber-soft); }
.demo-warning + .card { margin-top: 0; }
.list-reload { padding: 5px 7px; color: var(--muted); }
.list-reload:hover { color: var(--accent); border-color: #a7c7e8; background: var(--accent-soft); }
.preview-frame { width: 100%; height: 66vh; border: 0; border-radius: 10px; background: #f5f5f7; }
.preview-image-wrap { background: #f5f5f7; border-radius: 10px; padding: 12px; display: grid; place-items: center; min-height: 280px; }
.preview-image { max-width: 100%; max-height: 62vh; object-fit: contain; border-radius: 6px; background: #fff; }
.preview-text { margin: 0; background: #1d1d1f; color: #e8e8ed; border-radius: 10px; padding: 14px; max-height: 62vh; overflow: auto; white-space: pre-wrap; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 11px; line-height: 1.55; }
.upload-zone { position: relative; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--surface-2); padding: 22px 18px; text-align: center; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.upload-zone:hover, .upload-zone.dragover, .upload-zone.has-file { border-color: var(--ink); background: #fff; }
.upload-zone-icon { display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 50%; background: #fff; border: 1px solid var(--line-soft); color: var(--muted); }
.upload-zone strong { display: block; font-size: 12.5px; }
.upload-zone > span:not(.upload-zone-icon) { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.upload-zone .upload-file { margin-top: 9px; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; color: var(--ink); overflow-wrap: anywhere; }
.upload-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 22px; }
.permission-group strong { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin-bottom: 5px; }
.permission-item { display: flex; align-items: flex-start; gap: 7px; padding: 4px 0; font-size: 11.5px; color: #3a3a3c; cursor: pointer; }
.permission-item input { margin: 2px 0 0; accent-color: #1d1d1f; }
.permission-item span { line-height: 1.35; }
.permission-item.disabled { color: var(--muted-2); cursor: default; }
.permission-item.disabled input { opacity: .35; }
.xml-preview { background: #1d1d1f; color: #e8e8ed; border-radius: 12px; padding: 15px; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; line-height: 1.6; overflow: auto; max-height: 380px; white-space: pre-wrap; }
.timeline { display: grid; }
.timeline-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: #c7c7cc; margin-top: 5px; flex: 0 0 auto; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-body strong { font-size: 11.5px; display: block; }
.timeline-body span { color: var(--muted); font-size: 10.5px; display: block; margin-top: 2px; }
.timeline-body p { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.report-split { grid-template-columns: 1.2fr .8fr; }
.chart-card { padding: 18px 20px; }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 12px; }
.chart-bar-wrap { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.chart-bar { width: 100%; max-width: 36px; border-radius: 6px 6px 2px 2px; background: var(--ink); min-height: 3px; }
.chart-bar.soft { background: #c9c9cf; }
.chart-label { font-size: 9.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--ink); }
.hbar { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 11.5px; }
.hbar-label { width: 90px; color: var(--muted); flex: 0 0 auto; }
.hbar-track { flex: 1; height: 7px; background: #ededf0; border-radius: 99px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 99px; background: var(--ink); }
.hbar-value { width: 28px; text-align: right; font-weight: 600; }

/* Empty and loading */
.empty { padding: 42px 24px; text-align: center; color: var(--muted); }
.empty-icon { width: 44px; height: 44px; border-radius: 13px; background: #f0f0f2; display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted); }
.empty h3 { margin: 0 0 5px; color: var(--ink); font-size: 14px; }
.empty p { margin: 0 auto 14px; font-size: 12px; max-width: 360px; }
.skeleton { background: linear-gradient(90deg,#eee 25%,#f5f5f5 37%,#eee 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Login */
.login-shell { min-height: 100vh; display: flex; flex-direction: column; background: #f5f5f7; padding: 26px 32px 20px; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.login-brand { display: flex; align-items: center; gap: 9px; }
.login-brand .brand-mark { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
.login-brand-text { font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.login-brand-sub { color: var(--muted); font-size: 10.5px; font-weight: 500; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line); }
.login-secure { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10.5px; }
.login-secure svg { width: 13px; height: 13px; }
.login-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 0; }
.login-card { width: 100%; max-width: 384px; background: #fff; border: 1px solid #e5e5ea; border-radius: 15px; padding: 30px 30px 26px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.login-card h1 { font-size: 22px; letter-spacing: -.035em; margin: 0 0 6px; font-weight: 650; }
.login-card .lead { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin: 0 0 24px; }
.login-card .field { margin-bottom: 14px; }
.login-card .field label { font-size: 11.5px; }
.login-card .field input { padding: 9px 11px; }
.login-card .field input:focus { border-color: #9a9aa0; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.login-submit { width: 100%; height: 40px; margin-top: 6px; }
.login-help { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.login-help strong { color: var(--ink); font-weight: 600; }
.login-demo { margin-top: 18px; text-align: center; color: var(--muted-2); font-size: 10px; line-height: 1.6; }
.login-demo .mono { font-size: 10px; }
.login-demo-access { width: 100%; max-width: 384px; margin-top: 14px; }
.login-demo-title { text-align: center; color: var(--muted-2); font-size: 9.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 7px; }
.demo-role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.demo-role { border: 1px solid #d9d9de; background: #fff; border-radius: 8px; padding: 7px 9px; text-align: left; display: grid; gap: 1px; transition: background .15s ease, border-color .15s ease; box-shadow: 0 1px 1px rgba(0,0,0,.02); }
.demo-role:hover { background: #fafafa; border-color: #a7a7ad; }
.demo-role strong { font-size: 10.5px; font-weight: 600; color: var(--ink); }
.demo-role span { font-size: 9.5px; color: var(--muted); }
.login-demo-note { text-align: center; color: var(--muted-2); font-size: 9px; margin: 6px 0 0; }
.login-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted-2); font-size: 10px; padding-top: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 11.5px; font-weight: 600; color: #3a3a3c; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font-size: 13px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #a7c7e8; box-shadow: 0 0 0 3px var(--accent-soft); }
.field small { color: var(--muted); font-size: 10.5px; }
.form-error { background: var(--red-soft); color: var(--red); border: 1px solid #f3c6c1; border-radius: 9px; padding: 9px 11px; font-size: 11.5px; margin-bottom: 12px; }

/* Modal / toast */
body.modal-open { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; background: rgba(20,20,22,.34); backdrop-filter: blur(8px); z-index: 100; display: grid; place-items: center; padding: 18px; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: #fff; border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.modal.wide { max-width: 680px; }
.modal.full { max-width: 1120px; }
.modal.full .modal-body { padding: 0 18px 14px; }
.preview-shell { padding-top: 12px; }
.preview-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 11px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-2); }
.preview-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.preview-kind { background: #fff; border: 1px solid var(--line-soft); border-radius: 6px; padding: 2px 7px; color: var(--ink); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.preview-tools { display: flex; align-items: center; gap: 5px; margin-left: auto; flex-wrap: wrap; }
.preview-tool { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer; }
.preview-tool:hover { background: var(--surface); }
.preview-zoom-label { min-width: 48px; text-align: center; font-size: 10.5px; color: var(--muted); }
.preview-stage { margin-top: 10px; border-radius: 14px; overflow: auto; background: #2b2b2f; max-height: 68vh; }
.preview-stage.pdf { background: #525659; }
.preview-frame { width: 100%; height: 68vh; border: 0; background: #525659; }
.preview-stage.image { display: grid; place-items: center; padding: 14px; background: #e9e9ed; }
.preview-stage.image .preview-image { transform-origin: top center; transition: transform .15s ease; }
.preview-stage.text { background: transparent; max-height: 68vh; }
.preview-note { margin: 8px 2px 0; color: var(--muted); font-size: 10.5px; }
.help-copy { margin: 0; color: var(--ink); font-size: 12.5px; line-height: 1.65; white-space: pre-line; }
.payment-detail-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 14px; background: var(--surface-2); margin-bottom: 16px; }
.payment-detail-hero span, .payment-detail-hero em { display: block; color: var(--muted); font-size: 10.5px; font-style: normal; }
.payment-detail-hero strong { display: block; font-size: 28px; letter-spacing: -.04em; margin: 3px 0; }
.payment-hero-chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.payment-section-title { margin: 14px 0 2px; color: var(--muted-2); font-size: 9.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.payment-section-title:first-of-type { margin-top: 0; }
.payment-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.payment-detail-grid div { border-bottom: 1px solid var(--line-soft); padding: 9px 0; }
.payment-detail-grid span { display: block; color: var(--muted); font-size: 10px; }
.payment-detail-grid strong { display: block; margin-top: 2px; font-size: 12.5px; overflow-wrap: anywhere; }
.payment-evidence { margin-top: 16px; padding: 14px 16px; border-radius: 14px; border: 1px solid #f1dda2; background: var(--amber-soft); }
.payment-evidence.ok { border-color: #c6e4cd; background: var(--green-soft); }
.payment-evidence.critical { border-color: #f3c6c1; background: var(--red-soft); }
.payment-evidence > span { display: block; color: var(--muted); font-size: 9.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.payment-evidence > strong { display: block; margin: 4px 0 3px; font-size: 14px; letter-spacing: -.015em; }
.payment-evidence p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.payment-evidence .btn { margin-top: 10px; }
.payment-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.payment-summary > div { border: 1px solid var(--line-soft); border-radius: 11px; background: #fff; padding: 11px 13px; }
.payment-summary span { display: block; color: var(--muted); font-size: 10.5px; }
.payment-summary strong { display: block; font-size: 17px; letter-spacing: -.03em; margin-top: 3px; }
.payment-summary strong.bad { color: var(--red); }
.history-card { overflow: hidden; }
.history-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line-soft); }
.history-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.history-tabs a:hover { color: var(--ink); }
.history-tabs a.active { color: var(--ink); border-bottom-color: var(--ink); }
.history-tabs a span { display: inline-grid; place-items: center; min-width: 19px; height: 17px; padding: 0 5px; border-radius: 99px; background: #efeff2; color: var(--muted); font-size: 9.5px; font-weight: 650; }
.history-tabs a.active span { background: var(--ink); color: #fff; }
.history-filters { padding: 12px 12px 0; margin-bottom: 0; }
.history-filters .search { min-width: 180px; }
.history-card .pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 11px 14px; border-top: 1px solid var(--line-soft); }
.pagination-info { margin-right: auto; color: var(--muted); font-size: 11px; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; text-decoration: none; }
.page-btn:hover { background: var(--surface-2); }
.page-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-btn.disabled { opacity: .35; pointer-events: none; }
.pagination-ellipsis { padding: 0 3px; color: var(--muted); font-size: 12px; }
.form-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 700; margin: 16px 0 9px; }
.form-section-title:first-child { margin-top: 0; }
.history-list { display: grid; gap: 0; }
.history-item { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.history-item:last-child { border-bottom: 0; }
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-top: 6px; flex: 0 0 auto; }
.history-main { min-width: 0; flex: 1; }
.history-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.history-top strong { font-size: 12.5px; }
.history-top span { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.history-meta { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.history-diff { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
.history-diff b { color: var(--ink); font-weight: 600; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 22px 20px; }
.modal-close { margin-left: auto; border: 0; background: #f2f2f4; border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; }
.modal-close:hover { background: #e8e8ec; }
.toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; border-radius: 11px; padding: 11px 15px; font-size: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); display: flex; align-items: center; gap: 8px; max-width: 380px; animation: toastIn .2s ease; }
.toast.error { background: var(--red); }
.toast.success { background: #146c2e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sidebar-overlay { display: none; }

/* Utility */
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-20 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-12 { margin-bottom: 12px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .ml-auto { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.text-right { text-align: right; }
.hr { height: 1px; background: var(--line-soft); margin: 14px 0; border: 0; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-hero { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-cell:nth-child(2n) { border-right: 0; }
  .summary-cell:nth-last-child(-n+4) { border-bottom: 1px solid var(--line-soft); }
  .summary-cell:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(84vw, 300px); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.18); }
  .sidebar.open { transform: none; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 35; }
  .burger { display: flex; }
  .topbar { padding: 0 16px; height: 58px; gap: 8px; }
  .topbar-search { display: none; }
  .user-meta { display: none; }
  .content { padding: 20px 16px 52px; }
  .page-head { flex-direction: column; gap: 12px; margin-bottom: 18px; }
  .page-head h1 { font-size: 24px; }
  .page-actions { margin-left: 0; width: 100%; }
  .page-actions .btn { flex: 1; }
  .detail-head { flex-direction: column; }
  .detail-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
  .detail-title h1 { font-size: 21px; }
  .doc-grid, .grid-2, .grid-3, .source-grid { grid-template-columns: 1fr; }
  .documents-toolbar > div:first-child { flex: 1 1 100%; }
  .documents-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .documents-actions .btn { flex: 1 1 auto; justify-content: center; }
  .permission-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-metrics { gap: 18px; }
  .factor { grid-template-columns: 112px 1fr 38px; gap: 8px; }
  .login-shell { padding: 18px 16px 16px; overflow-x: hidden; }
  .login-secure { display: none; }
  .login-main { padding: 24px 0; justify-content: flex-start; width: 100%; min-width: 0; }
  .login-card { width: 100%; max-width: calc(100vw - 32px); padding: 24px 22px; }
  .login-demo-access { max-width: calc(100vw - 32px); }
  .login-card .field input { min-width: 0; }
  .login-brand-sub { font-size: 10px; }
  .login-footer { font-size: 9.5px; }
  .report-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-cell { border-right: 1px solid var(--line-soft) !important; border-bottom: 1px solid var(--line-soft) !important; }
  .summary-cell:nth-child(2n) { border-right: 0 !important; }
  .summary-cell:nth-last-child(-n+2) { border-bottom: 0 !important; }
  .table-wrap { margin: 0 -1px; }
  th, td { padding-left: 12px; padding-right: 12px; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
  .split { grid-template-columns: minmax(0,1fr); }
  .chart-card { min-width: 0; }
  .chart-bars { gap: 3px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
  .chart-bar-wrap { min-width: 0; }
  .chart-label { font-size: 7px; letter-spacing: -.02em; white-space: nowrap; }
  .summary-stack { gap: 12px; }
  .overview-card { padding: 17px 18px; }
  .overview-head { flex-wrap: wrap; }
  .overview-progress-label strong { font-size: 27px; }
  .overview-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .overview-stats > div { padding: 12px 12px 0 0; }
  .overview-stats > div + div { padding-left: 12px; }
  .overview-stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .overview-stats > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); margin-top: 12px; padding-top: 12px; }
  .threshold-grid { grid-template-columns: 1fr; }
  .threshold-item + .threshold-item { border-left: 0; border-top: 1px solid var(--line-soft); padding-left: 0; margin-top: 12px; padding-top: 12px; }
  .overview-list .list-row { padding: 11px 0; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 24px; }
  .stat-foot { font-size: 10.5px; }
  .client-filters .filter-select { flex: 1 1 calc(50% - 8px); max-width: none; }
  .payment-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .payment-detail-hero { flex-direction: column; }
  .payment-hero-chips { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .payment-detail-grid { grid-template-columns: 1fr; }
  .client-payments-table th, .client-payments-table td { padding: 9px 10px; }
  .client-payments-table th:nth-child(2), .client-payments-table td:nth-child(2),
  .client-payments-table th:nth-child(4), .client-payments-table td:nth-child(4),
  .client-payments-table th:nth-child(6), .client-payments-table td:nth-child(6) { display: none; }
  .preview-toolbar { align-items: flex-start; }
  .preview-tools { margin-left: 0; width: 100%; }
  .preview-frame { height: 62vh; }
  .preview-stage { max-height: 62vh; }
  .modal.full .modal-body { padding: 0 10px 10px; }
  .clients-table th, .clients-table td { padding: 9px 10px; }
  .clients-table th:nth-child(2), .clients-table td:nth-child(2),
  .clients-table th:nth-child(3), .clients-table td:nth-child(3),
  .clients-table th:nth-child(5), .clients-table td:nth-child(5),
  .clients-table th:nth-child(6), .clients-table td:nth-child(6) { display: none; }
  .users-table th, .users-table td { padding: 9px 10px; }
  .permissions-btn { padding: 6px 9px; }
  .permissions-btn .permissions-label { display: none; }
  .notices-table th, .notices-table td { padding: 9px 10px; }
  .notices-table th:nth-child(2), .notices-table td:nth-child(2),
  .notices-table th:nth-child(3), .notices-table td:nth-child(3),
  .notices-table th:nth-child(5), .notices-table td:nth-child(5),
  .notices-table th:nth-child(7), .notices-table td:nth-child(7) { display: none; }
  .history-tabs { overflow-x: auto; padding: 8px 10px 0; }
  .history-tabs a { padding: 8px 9px; white-space: nowrap; }
  .history-filters { padding: 10px 10px 0; }
  .history-filters .filter-select { flex: 1 1 calc(50% - 4px); max-width: none; }
  .history-card .pagination { padding: 10px 12px; }
  .pagination-info { flex-basis: 100%; }
  .operations-filters .filter-select { flex: 1 1 calc(50% - 4px); max-width: none; }
  .operations-filters .segmented { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; background: transparent; padding: 0; gap: 6px; overflow: visible; }
  .operations-filters .segmented button { grid-column: span 2; background: #fff; border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 6px; }
  .operations-filters .segmented button:nth-child(4), .operations-filters .segmented button:nth-child(5) { grid-column: span 3; }
  .operations-filters .segmented button.active { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: none; }
  .operations-table thead { display: none; }
  .operations-table, .operations-table tbody, .operations-table tr, .operations-table td { display: block; width: 100%; }
  .operations-table tbody tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
  }
  .operations-table tbody tr:last-child { border-bottom: 0; }
  .operations-table td { display: none; padding: 0; border: 0; }
  .operations-table td:nth-child(1) { display: block; grid-column: 1 / -1; }
  .operations-table td:nth-child(4),
  .operations-table td:nth-child(7) { display: block; }
  .operations-table td:nth-child(8) { display: block; justify-self: end; text-align: right; }
  .operations-table td:nth-child(4)::before,
  .operations-table td:nth-child(7)::before,
  .operations-table td:nth-child(8)::before { display: block; margin-bottom: 5px; color: var(--muted-2); font-size: 9px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
  .operations-table td:nth-child(4)::before { content: 'Riesgo'; }
  .operations-table td:nth-child(7)::before { content: 'Pago'; }
  .operations-table td:nth-child(8)::before { content: 'Estado'; }
  .operations-table .cell-main { gap: 9px; min-width: 0; }
  .operations-table .cell-main > div { min-width: 0; }
  .operations-table .cell-title { overflow-wrap: anywhere; }
  .operations-table td:nth-child(7) .cell-sub { font-size: 10.5px; white-space: nowrap; }
  .operations-table td:nth-child(8) .chip { white-space: nowrap; }
  .client-ops-table th, .client-ops-table td,
  .lists-table th, .lists-table td,
  .catalog-table th, .catalog-table td { padding: 9px 10px; }
  .client-ops-table th:nth-child(2), .client-ops-table td:nth-child(2),
  .client-ops-table th:nth-child(5), .client-ops-table td:nth-child(5),
  .client-ops-table th:nth-child(6), .client-ops-table td:nth-child(6) { display: none; }
  .lists-table th:nth-child(2), .lists-table td:nth-child(2),
  .lists-table th:nth-child(4), .lists-table td:nth-child(4),
  .lists-table th:nth-child(5), .lists-table td:nth-child(5) { display: none; }
  .audit-table thead { display: none; }
  .audit-table, .audit-table tbody, .audit-table tr, .audit-table td { display: block; width: 100%; }
  .audit-table tr { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
  .audit-table tr:last-child { border-bottom: 0; }
  .audit-table td { border: 0; padding: 2px 0; }
  .audit-table td:nth-child(1) { color: var(--muted); font-size: 10.5px; }
  .audit-table td:nth-child(2) { font-weight: 600; font-size: 12.5px; }
  .audit-table td:nth-child(2) .cell-sub { display: inline; margin-left: 6px; }
  .audit-table td:nth-child(3) { margin-top: 2px; }
  .audit-table td:nth-child(3) .cell-sub { display: none; }
  .audit-table td:nth-child(4) { color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
  .audit-table td:nth-child(5) { display: none; }
  .users-table th:nth-child(2), .users-table td:nth-child(2),
  .users-table th:nth-child(3), .users-table td:nth-child(3),
  .users-table th:nth-child(5), .users-table td:nth-child(5),
  .users-table th:nth-child(6), .users-table td:nth-child(6) { display: none; }
  .hero-metrics { width: 100%; justify-content: space-between; }
  .filter-bar { align-items: stretch; }
  .filter-bar .search { flex-basis: 100%; }
  .segmented { overflow-x: auto; max-width: 100%; }
  .check-item { flex-wrap: wrap; }
  .check-side { width: 100%; justify-content: flex-start; padding-left: 32px; }
  .topbar .crumbs { font-size: 11.5px; }
}
@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ---------------------------- Flujos operativos ---------------------------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wf-inline-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.wf-inline-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.wf-row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wf-cell-wrap { max-width: 230px; white-space: normal; overflow-wrap: anywhere; }
.wf-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.wf-summary-item { display: block; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 13px 15px; box-shadow: var(--shadow); }
a.wf-summary-item:hover { border-color: #a7c7e8; background: var(--accent-soft); }
.wf-summary-item span { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.wf-summary-item strong { display: block; margin: 4px 0 2px; font-size: 23px; line-height: 1.1; letter-spacing: -.035em; }
.wf-summary-item em { display: block; color: var(--muted); font-size: 10.5px; font-style: normal; }
.wf-month-field { display: flex; align-items: center; gap: 7px; }
.wf-month-field input { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 10px; font-size: 12px; }
.wf-filter-note { margin-left: auto; }
.wf-accordion { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.wf-accordion > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid transparent; font-size: 12px; font-weight: 650; }
.wf-accordion[open] > summary { border-bottom-color: var(--line-soft); }
.wf-accordion > summary::-webkit-details-marker { display: none; }
.wf-accordion > summary::before { content: "＋"; color: var(--muted); font-weight: 600; }
.wf-accordion[open] > summary::before { content: "−"; }
.wf-accordion-meta { margin-left: auto; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.wf-accordion-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; padding: 13px 16px 5px; }
.wf-accordion-body .field { margin-bottom: 10px; }
.wf-field-missing input, .wf-field-missing select, .wf-field-missing textarea { border-color: #d9a514; background: #fffdf5; }
.wf-missing-hint { color: var(--amber) !important; }
.req { color: var(--red); font-weight: 700; }
.field-error { display: block; color: var(--red); font-size: 10.5px; margin-top: 2px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red) !important; box-shadow: 0 0 0 3px var(--red-soft) !important; }
.form-error[role="alert"] { outline: none; }
.form-error[role="alert"]:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.wf-form-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.wf-form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin: 18px 0 4px; }
.wf-retired-docs > summary { list-style: none; cursor: pointer; }
.wf-retired-docs > summary::-webkit-details-marker { display: none; }
.wf-retired-docs > summary::before { content: "＋"; margin-right: 5px; color: var(--muted); }
.wf-retired-docs[open] > summary::before { content: "−"; }
.doc-card.is-retired { opacity: .82; background: var(--surface-2); }
.wf-doc-reason { margin: 7px 0 0; font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
.wf-replace-note { color: var(--amber) !important; }
.wf-check-list { display: grid; gap: 1px; }
.wf-check-row { padding: 8px 9px; border-bottom: 1px solid var(--line-soft); }
.wf-check-row:last-child { border-bottom: 0; }
.wf-check-row span { min-width: 0; }
.wf-check-row strong { display: inline; }
.wf-check-row small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.wf-scroll-box { max-height: 290px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--surface-2); }
.wf-cards-stack { display: grid; gap: 10px; }
.wf-card-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.wf-card-head h3 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.wf-chip-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.wf-finding-card, .wf-case-card, .wf-batch-item { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow); }
.wf-finding-description { margin: 9px 0 12px; color: #3a3a3c; font-size: 12px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.wf-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.wf-meta-grid > div { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.wf-meta-grid span { display: block; color: var(--muted); font-size: 10px; }
.wf-meta-grid strong { display: block; margin-top: 2px; font-size: 12px; overflow-wrap: anywhere; }
.wf-response { border-left: 3px solid var(--accent); padding: 8px 11px; margin-top: 10px; background: var(--accent-soft); border-radius: 0 9px 9px 0; }
.wf-response.ok { border-left-color: var(--green); background: var(--green-soft); }
.wf-response.muted { border-left-color: var(--line); background: var(--surface-2); }
.wf-response span { display: block; color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.wf-response p { margin: 3px 0 0; font-size: 11.5px; white-space: pre-line; overflow-wrap: anywhere; }
.wf-card-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.wf-case-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wf-case-card { display: flex; flex-direction: column; }
.wf-case-card .wf-card-actions { margin-top: auto; padding-top: 12px; }
.wf-link-list { display: grid; gap: 7px; }
.wf-link-card { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 9px; }
.wf-link-card:hover { border-color: #a7c7e8; background: var(--accent-soft); }
.wf-link-card > div { min-width: 0; flex: 1; }
.wf-link-card strong { display: block; font-size: 11.5px; }
.wf-link-card span { display: block; color: var(--muted); font-size: 10.5px; }
.wf-link-card svg { width: 12px; height: 12px; color: var(--muted-2); }
.wf-batch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.wf-batch-head strong { display: block; font-size: 14px; }
.wf-batch-head span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.wf-missing-list { margin-top: 9px; border: 1px solid #f3c6c1; background: var(--red-soft); border-radius: 9px; padding: 9px 11px; }
.wf-missing-list > span { display: block; color: var(--red); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.wf-missing-list ul { margin: 4px 0 0; padding-left: 17px; color: var(--muted); font-size: 11px; }
.wf-receipt-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.wf-capture-card { overflow: visible; }
.wf-tabs { padding: 9px 12px 0; }
.wf-capture-body { padding: 16px 14px 4px; }
.wf-capture-panel { box-shadow: none; border: 0; padding: 0; }
.wf-capture-panel .card-head { margin-bottom: 14px; }
.wf-capture-preview { margin-top: 14px; }
.wf-preview-shell { border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-2); padding: 14px; }
.wf-preview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.wf-preview-head span { display: block; color: var(--muted); font-size: 10.5px; }
.wf-preview-head strong { display: block; margin-top: 2px; font-size: 14px; }
.wf-preview-errors { margin: 10px 0; }
.wf-preview-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.wf-preview-table { margin-top: 10px; }
.wf-preview-note { margin: 4px 0 0; }
.wf-error-table td:last-child { color: var(--red); }
.wf-loading-inline { display: grid; gap: 8px; }
.wf-token-box { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.wf-token-box code { flex: 1 1 240px; min-width: 0; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.wf-code { margin: 5px 0 0; padding: 9px 11px; border-radius: 9px; background: #1d1d1f; color: #e8e8ed; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wf-contract-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wf-contract-decisions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.wf-matrix-version { margin-bottom: 12px; }
.wf-matrix-section { margin-bottom: 12px; }
.wf-matrix-section .card-head { padding-bottom: 10px; }
.wf-levels { display: grid; gap: 8px; }
.wf-level-row { display: grid; grid-template-columns: minmax(130px, 1.4fr) 90px 90px auto; gap: 10px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.wf-level-row:last-child { border-bottom: 0; }
.wf-level-row .field { margin: 0; }
.wf-factor-card { border: 1px solid var(--line-soft); border-radius: 12px; padding: 13px; margin-bottom: 10px; background: var(--surface-2); }
.wf-factor-head { display: grid; grid-template-columns: minmax(150px, 1.8fr) 90px minmax(150px, 1.2fr) auto; gap: 10px; align-items: end; }
.wf-factor-head .field { margin: 0; }
.wf-factor-code { display: flex; align-items: center; gap: 6px; min-height: 34px; }
.wf-factor-scale { margin: 9px 0 4px; }
.wf-remove { align-self: end; }
.wf-editor { border-top: 1px solid var(--line-soft); padding-top: 9px; margin-top: 6px; }
.wf-editor-head { display: grid; grid-template-columns: minmax(140px, 1fr) 120px 32px; gap: 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; padding: 0 2px 4px; }
.wf-score-row { display: grid; grid-template-columns: minmax(140px, 1fr) 120px 32px; gap: 8px; align-items: center; margin-bottom: 5px; }
.wf-score-row input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 9px; font-size: 12px; }
.wf-add-factor { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.wf-add-factor > div { flex: 1 1 240px; }
.wf-add-factor p { margin: 2px 0 0; }
.wf-add-factor select, .wf-add-inline select { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 9px; font-size: 11.5px; }
.wf-add-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.wf-override-row { display: grid; grid-template-columns: 1fr 120px minmax(180px, 1.5fr) 32px; gap: 8px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.wf-override-row:last-child { border-bottom: 0; }
.wf-override-row .field { margin: 0; }
.wf-factor-read-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wf-read-scores { margin-top: 10px; border-top: 1px solid var(--line-soft); }
.wf-read-scores > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 5px 0; font-size: 11.5px; }
.wf-read-scores span { color: var(--muted); overflow-wrap: anywhere; }
.wf-card-title { margin: 0 0 10px; font-size: 13px; letter-spacing: -.01em; }
.wf-existing-response { border: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.wf-existing-response span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.wf-existing-response p { margin: 3px 0 0; white-space: pre-line; font-size: 12px; }
.wf-version-row { align-items: center; }
.wf-version-row .doc-icon { width: 30px; height: 32px; }

@media (max-width: 1180px) {
  .wf-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wf-case-grid, .wf-factor-read-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .wf-accordion-body { grid-template-columns: 1fr; }
  .wf-factor-head { grid-template-columns: minmax(0, 1fr) 90px; }
  .wf-factor-code, .wf-remove { grid-column: auto; }
  .wf-factor-code { min-height: 0; }
  .wf-level-row { grid-template-columns: minmax(0, 1fr) 80px 80px; }
  .wf-level-row > .chip { grid-column: 1 / -1; justify-self: start; }
  .wf-override-row { grid-template-columns: 1fr 110px; }
  .wf-override-reason { grid-column: 1 / -1; }
  .wf-contract-grid { grid-template-columns: 1fr; }
  .wf-filter-note { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .wf-summary { grid-template-columns: 1fr 1fr; }
  .wf-summary-item { padding: 11px 12px; }
  .wf-summary-item strong { font-size: 20px; }
  .wf-pending-table thead, .wf-batch-table thead, .wf-audit-table thead, .wf-connections-table thead, .wf-capture-clients thead { display: none; }
  .wf-pending-table, .wf-pending-table tbody, .wf-pending-table tr, .wf-pending-table td,
  .wf-batch-table, .wf-batch-table tbody, .wf-batch-table tr, .wf-batch-table td,
  .wf-audit-table, .wf-audit-table tbody, .wf-audit-table tr, .wf-audit-table td,
  .wf-connections-table, .wf-connections-table tbody, .wf-connections-table tr, .wf-connections-table td,
  .wf-capture-clients, .wf-capture-clients tbody, .wf-capture-clients tr, .wf-capture-clients td { display: block; width: 100%; }
  .wf-pending-table tr, .wf-batch-table tr, .wf-audit-table tr, .wf-connections-table tr, .wf-capture-clients tr { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .wf-pending-table tbody tr:last-child, .wf-batch-table tbody tr:last-child, .wf-audit-table tbody tr:last-child, .wf-connections-table tbody tr:last-child, .wf-capture-clients tbody tr:last-child { border-bottom: 0; }
  .wf-pending-table td, .wf-batch-table td, .wf-audit-table td, .wf-connections-table td, .wf-capture-clients td { border: 0; padding: 3px 0; }
  .wf-pending-table td[data-label], .wf-batch-table td[data-label], .wf-audit-table td[data-label], .wf-connections-table td[data-label], .wf-capture-clients td[data-label] { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; align-items: start; }
  .wf-pending-table td[data-label]::before, .wf-batch-table td[data-label]::before, .wf-audit-table td[data-label]::before, .wf-connections-table td[data-label]::before, .wf-capture-clients td[data-label]::before { content: attr(data-label); color: var(--muted-2); font-size: 9px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; padding-top: 2px; }
  .wf-row-actions { justify-content: flex-start; }
  .wf-meta-grid { grid-template-columns: 1fr; }
  .wf-form-actions .btn { flex: 1 1 auto; }
  .wf-factor-head, .wf-level-row, .wf-override-row { grid-template-columns: 1fr 1fr; }
  .wf-factor-head .field:first-child, .wf-level-row .field:first-child, .wf-override-row .field:first-child { grid-column: 1 / -1; }
  .wf-factor-code { grid-column: 1 / -1; }
  .wf-score-row { grid-template-columns: minmax(0, 1fr) 72px 30px; }
  .wf-editor-head { grid-template-columns: minmax(0, 1fr) 72px 30px; }
  .wf-add-factor > div { flex-basis: 100%; }
  .wf-inline-actions { align-items: flex-start; }
  .wf-form-toolbar { flex-direction: column; gap: 3px; }
  .wf-token-box { align-items: stretch; }
  .wf-token-box .btn { width: 100%; }
  .wf-preview-head { flex-direction: column; }
}
@media (max-width: 360px) {
  .wf-summary { grid-template-columns: 1fr; }
}

.presentation-cases { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin:0 0 20px; }
.presentation-case { display:flex; flex-direction:column; align-items:flex-start; gap:9px; padding:20px; color:var(--text,#1f2937); text-decoration:none; }
.presentation-case > strong { font-size:17px; }
.presentation-case > span:not(.chip), .presentation-case small { font-size:12px; color:var(--muted,#667085); }
.presentation-case .presentation-case-link { display:flex; align-items:center; gap:8px; color:var(--text,#1f2937); font-weight:600; margin-top:4px; }
.presentation-cases > p { grid-column:1 / -1; margin:0; }
@media(max-width:700px) { .presentation-cases { grid-template-columns:1fr; } }
.operations-scope-note { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; padding:10px 14px; margin-bottom:12px; border:1px solid var(--line-soft); border-radius:10px; background:#fff; font-size:12px; color:var(--muted); }
.operations-scope-note strong { color:var(--ink); }

/* Matriz: una sección por vez y escalas desplegables. */
#wf-matrix-form { --matrix-color-0:#344d46; --matrix-color-1:#76938b; --matrix-color-2:#9faeb9; --matrix-color-3:#c6d0d5; }
#wf-matrix-form [data-matrix-panel][hidden] { display:none; }
.matrix-page-head p { max-width:680px; }
.matrix-overview { display:grid; grid-template-columns:220px minmax(120px,1fr) minmax(200px,320px); gap:28px; align-items:center; padding:22px 26px; background:#fff; border:1px solid var(--line-soft); border-radius:14px; }
.matrix-weight { display:grid; grid-template-columns:auto auto; gap:4px 12px; align-items:baseline; }
.matrix-weight > span { font-size:12px; font-weight:600; }
.matrix-weight > strong { font-size:26px; letter-spacing:-.04em; text-align:right; font-variant-numeric:tabular-nums; }
.matrix-weight > small { grid-column:1 / -1; font-size:11px; color:var(--muted); }
.matrix-weight .is-balanced { color:#2d6251; }
.matrix-weight .is-unbalanced { color:var(--red); }
.matrix-weight-distribution { display:flex; height:12px; gap:3px; border-radius:3px; overflow:hidden; background:var(--surface-2); }
.matrix-weight-distribution i { min-width:0; }
.matrix-overview-note { display:grid; gap:4px; border-left:1px solid var(--line-soft); padding-left:25px; }
.matrix-overview-note strong { font-size:12px; }
.matrix-overview-note span { font-size:11px; color:var(--muted); line-height:1.5; }
.matrix-navigation { display:flex; gap:4px; margin:20px 0 15px; border-bottom:1px solid var(--line); }
.matrix-navigation button { display:flex; align-items:center; gap:8px; padding:13px 16px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--muted); font:inherit; font-size:12px; font-weight:600; cursor:pointer; }
.matrix-navigation button span { background:#e9ecef; padding:2px 6px; border-radius:5px; font-size:10px; font-variant-numeric:tabular-nums; }
.matrix-navigation button[aria-pressed="true"] { color:var(--ink); border-bottom-color:#344d46; }
.matrix-navigation button[aria-pressed="true"] span { background:#e2ece7; color:#344d46; }
.matrix-navigation button:hover { background:rgba(0,0,0,.025); }
.matrix-navigation button:focus-visible, .matrix-factor > summary:focus-visible { outline:2px solid #344d46; outline-offset:-3px; }
#wf-matrix-form .wf-matrix-section > .card-head { padding:21px 24px 16px; border-bottom:1px solid var(--line-soft); }
#wf-matrix-form .wf-matrix-section > .card-head h3 { font-size:15px; }
#wf-matrix-form .wf-matrix-section > .card-head p { max-width:650px; }
#wf-matrix-form .matrix-factor-list { padding:0; }
.matrix-factor.wf-factor-card { margin:0; border:0; border-radius:0; padding:0; background:#fff; border-bottom:1px solid var(--line-soft); }
.matrix-factor > summary { display:flex; align-items:center; gap:12px; padding:17px 24px; list-style:none; cursor:pointer; }
.matrix-factor > summary::-webkit-details-marker { display:none; }
.matrix-factor > summary:hover { background:#f8faf9; }
.matrix-factor-mark { display:flex; align-items:center; justify-content:center; width:24px; height:24px; background:#f0f3f2; border-radius:6px; color:#586a64; }
.matrix-factor-mark svg { width:13px; height:13px; }
.matrix-factor[open] .matrix-factor-mark svg { transform:rotate(90deg); }
.matrix-factor-caption { display:grid; flex:1; min-width:0; gap:4px; }
.matrix-factor-caption strong { font-size:13px; line-height:1.4; }
.matrix-factor-caption small { font-size:11px; color:var(--muted); }
.matrix-factor-weight { display:grid; min-width:50px; gap:2px; text-align:right; }
.matrix-factor-weight b { font-size:17px; font-weight:600; font-variant-numeric:tabular-nums; }
.matrix-factor-weight small { color:var(--muted); font-size:10px; }
.matrix-factor[open] > summary { background:#f3f7f5; }
.matrix-factor-body { padding:20px 24px 22px 60px; border-top:1px solid #e9eeeb; }
.matrix-factor-body .wf-factor-head { grid-template-columns:minmax(0,1fr) 100px auto; align-items:end; }
.matrix-factor-body .wf-factor-scale { margin-top:17px; }
.matrix-factor-body .wf-editor { max-width:790px; }
.matrix-factor-body .wf-score-row, .matrix-factor-body .wf-editor-head { grid-template-columns:minmax(0,1fr) 120px 34px; }
.matrix-factor-list > .wf-add-factor { margin:0; padding:20px 24px; border-top:0; background:#fafbfc; border-radius:0 0 14px 14px; }
.matrix-save-bar { margin-top:20px; border:1px solid #d8dfdb; border-radius:12px; background:#fff; box-shadow:0 4px 14px rgba(30,50,40,.06); }
.matrix-save-bar > summary { display:flex; align-items:center; justify-content:space-between; gap:15px; cursor:pointer; list-style:none; padding:14px 20px; }
.matrix-save-bar > summary::-webkit-details-marker { display:none; }
.matrix-save-expand { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:600; white-space:nowrap; }
.matrix-save-expand svg { width:14px; height:14px; }
.matrix-save-bar[open] .matrix-save-expand svg { transform:rotate(90deg); }
.matrix-save-fields { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; align-items:end; gap:14px; padding:0 20px 16px; }
.matrix-save-note { display:grid; gap:4px; align-self:center; }
.matrix-save-note strong { font-size:12px; }
.matrix-save-note span { font-size:10.5px; color:var(--muted); line-height:1.5; max-width:240px; }
.matrix-save-bar .field { margin:0; min-width:0; }
.matrix-save-bar input { width:100%; min-width:0; }
.matrix-save-actions { display:flex; gap:6px; align-items:center; }
#wf-matrix-form .wf-level-row { background:#fafbfc; border:1px solid var(--line-soft); border-left:3px solid #6f8e7e; border-radius:9px; padding:14px; }
#wf-matrix-form .wf-level-row[data-code="medio"] { border-left-color:#c49842; }
#wf-matrix-form .wf-level-row[data-code="alto"] { border-left-color:#b75b5b; }
#wf-matrix-form [data-wf-mitigant] { grid-template-columns:minmax(0,1fr) 140px 36px; align-items:center; gap:18px; padding:16px 0; }
#wf-matrix-form [data-wf-mitigant] .mono { display:none; }
#wf-matrix-form .wf-override-row { padding:17px 0; }
@media(max-width:1100px) {
  .matrix-overview { grid-template-columns:210px 1fr; gap:18px; }
  .matrix-overview-note { grid-column:1 / -1; border-left:0; border-top:1px solid var(--line-soft); padding:13px 0 0; }
  .matrix-save-note span { max-width:none; }
}
@media(max-width:640px) {
  .matrix-overview { padding:17px; grid-template-columns:1fr; gap:15px; }
  .matrix-weight { grid-template-columns:1fr auto; }
  .matrix-overview-note { display:none; }
  .matrix-navigation { display:grid; grid-template-columns:1fr 1fr; gap:0; }
  .matrix-navigation button { justify-content:space-between; padding:12px 9px; font-size:11px; }
  .matrix-navigation button span { font-size:9px; }
  #wf-matrix-form .wf-matrix-section > .card-head { padding:16px; flex-wrap:wrap; }
  .matrix-factor > summary { padding:16px 12px; gap:9px; }
  .matrix-factor-caption strong { font-size:12px; }
  .matrix-factor-caption small { font-size:10px; }
  .matrix-factor-mark { flex-shrink:0; width:21px; height:21px; }
  .matrix-factor-body { padding:16px 12px; }
  .matrix-factor-body .wf-factor-head { grid-template-columns:1fr 90px; }
  .matrix-factor-body .wf-remove { grid-column:1 / -1; justify-self:start; }
  .matrix-factor-body .wf-score-row, .matrix-factor-body .wf-editor-head { grid-template-columns:minmax(0,1fr) 78px 30px; gap:6px; }
  .matrix-factor-body .wf-editor-head { font-size:9px; }
  .matrix-factor-list > .wf-add-factor { padding:16px; }
  .matrix-save-bar > summary { padding:13px 12px; }
  .matrix-save-fields { grid-template-columns:1fr 1fr; gap:10px; padding:0 12px 12px; }
  .matrix-save-expand { font-size:11px; }
  .matrix-save-note strong { font-size:11px; }
  .matrix-save-note span { display:none; }
  .matrix-save-actions { grid-column:1 / -1; justify-content:flex-end; }
  #wf-matrix-form [data-wf-mitigant] { grid-template-columns:minmax(0,1fr) 85px 30px; gap:8px; }
  #wf-matrix-form .wf-level-row .field:first-child { grid-column:1 / -1; }
  #wf-matrix-form .wf-level-row { grid-template-columns:1fr 1fr; }
}
