/* Tramitia: sistema visual del portal.
   Paleta de la hoja de marca (docs/marca/hoja-de-marca.png): Navy #0B1F44, Blue #2563EB y
   Light Blue #60A5FA; el fondo neutro #F7FAFF es el de la hoja. */

@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url("/static/fonts/dm-sans-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --navy: #0b1f44; --navy-deep: #06142f; --ink: #121c33; --secondary: #50617a; --muted: #7c8aa0;
  --line: #e4e9f1; --line-soft: #eef2f7; --bg: #f7faff; --white: #fff;
  --brand: #2563eb; --brand-bright: #3b82f6; --brand-deep: #1d4ed8; --brand-soft: #eaf1ff;
  --light-blue: #60a5fa;  /* celeste de la hoja de marca (el cuadrito del símbolo) */
  --green: #08875f; --green-soft: #eaf8f1; --green-line: #b5e2cd;
  --amber: #9a5d12; --amber-soft: #fff7e9; --amber-line: #ffe0b2;
  --red: #b4304a; --red-soft: #fff0f3; --red-line: #f3ccd3;
  --neutral: #627187; --neutral-soft: #f4f6f9; --neutral-line: #d8e0e8;
  --radius: 14px; --shadow: 0 6px 28px rgba(16, 34, 66, .045);
  --display: "Manrope", system-ui, sans-serif; --text: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 14px/1.55 var(--text); color: var(--ink); background: var(--bg); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #8cc0ff; outline-offset: 2px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9;
        stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- estructura --- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: linear-gradient(165deg, #10234a 0%, var(--navy-deep) 100%);
           color: #d5deee; display: flex; flex-direction: column; padding: 26px 16px 22px;
           position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { display: block; padding: 0 12px 38px; }
.brand img { height: 34px; width: auto; display: block; }
.side-label, .kicker { font: 800 10px var(--display); letter-spacing: 1.6px; text-transform: uppercase; }
.side-label { color: #7f93b3; padding: 0 14px; margin-bottom: 12px; }
.sidenav { display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
            font-weight: 600; color: #bfcbe0; transition: background .15s, color .15s; }
.nav-link:hover { background: #ffffff14; color: #fff; }
.nav-link.active { background: #ffffff17; color: #fff; box-shadow: inset 3px 0 var(--brand-bright); }
.sidebar-bottom { margin-top: auto; }
.side-help { display: flex; gap: 11px; background: #ffffff0b; border: 1px solid #ffffff12;
             border-radius: 12px; padding: 14px; }
.side-help .icon { color: var(--brand-bright); }
.side-help strong { display: block; font-size: 12px; color: #fff; }
.side-help small { display: block; font-size: 11px; color: #a5b4cc; margin-top: 4px; }
.side-foot { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 1.3px;
             font-weight: 800; color: #7d90ad; padding: 22px 10px 0; }

.workspace { flex: 1; min-width: 0; }
.topbar { height: 64px; background: var(--white); display: flex; justify-content: space-between;
          align-items: center; gap: 12px; border-bottom: 1px solid var(--line);
          padding: 0 clamp(18px, 3.2vw, 52px); }
.topbar-left, .topbar-right, .breadcrumb { display: flex; align-items: center; gap: 10px; min-width: 0; }
.breadcrumb { color: #8793a5; font-size: 12px; flex-wrap: wrap; }
.breadcrumb strong { color: #243b56; }
.breadcrumb .icon { width: 14px; height: 14px; }
.secure { display: flex; gap: 7px; align-items: center; color: #6e8198; font-size: 12px; margin-right: 14px; }
.secure .icon { width: 14px; height: 14px; color: var(--brand); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff;
          display: grid; place-items: center; font: 800 12px var(--display); }
.who { font-size: 12px; font-weight: 700; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; background: transparent;
               border: none; border-radius: 8px; color: var(--ink); }
.icon-button:hover { background: #eef2f8; }
.mobile-menu { display: none; }
.main { max-width: 1400px; margin: 0 auto; padding: 30px clamp(18px, 3.2vw, 54px) 56px; }

/* --- cabecera de pagina --- */
.back { color: #667e9a; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.back:hover { color: var(--brand); }
.back .icon { width: 15px; height: 15px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 16px 0 26px; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: #597087; font: 800 10px var(--display);
           letter-spacing: 1.5px; text-transform: uppercase; }
.eyebrow::before { content: ""; height: 7px; width: 7px; border-radius: 50%; background: var(--brand); }
h1 { font-size: clamp(24px, 2.3vw, 34px); letter-spacing: -1px; line-height: 1.2; margin: 9px 0 10px; font-weight: 800; }
.lead { color: var(--secondary); max-width: 720px; }
.tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill, .tag { border-radius: 30px; display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px;
              font-weight: 700; font-size: 11px; }
.pill { background: #e9eff8; color: #40556f; }
.pill .icon { width: 14px; height: 14px; }
.tag.violet { background: #f1eaff; color: #7a4fb0; }
.tag.blue { background: var(--brand-soft); color: var(--brand-deep); }
.hero-meta { font-size: 11px; color: #8292a8; margin-top: 12px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- botones --- */
.btn { border-radius: 9px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line);
       display: inline-flex; gap: 8px; align-items: center; justify-content: center; font-weight: 700;
       font-size: 13px; background: var(--white); color: #30445e; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px #001b3612; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-danger { color: var(--red); }
.btn-small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.text-button { display: inline-flex; align-items: center; gap: 4px; border: none; background: transparent;
               padding: 3px 0; color: var(--brand-deep); font-weight: 700; font-size: 11px; }
.text-button .icon { width: 13px; height: 13px; }
.text-button:hover { text-decoration: underline; }

/* --- paneles y estados --- */
.panel, .source-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
                       box-shadow: var(--shadow); }
.panel { padding: 22px 24px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; letter-spacing: -.4px; margin-top: 4px; }
.panel-head h3 { font-size: 15px; letter-spacing: -.3px; }
.panel-head p { color: #8a97a7; font-size: 12px; margin-top: 2px; }
.kicker { color: #8095b0; }
.status { border: 1px solid; border-radius: 50px; padding: 3px 9px; display: inline-flex; align-items: center;
          gap: 5px; white-space: nowrap; font-size: 11px; font-weight: 800; }
.status .icon { width: 13px; height: 13px; }
.status-success { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }
.status-progress { color: var(--brand); border-color: #c9ddff; background: var(--brand-soft); }
.status-warning { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.status-neutral { color: var(--neutral); border-color: var(--neutral-line); background: var(--neutral-soft); }
.status-error { color: var(--red); border-color: var(--red-line); background: var(--red-soft); }
.status-progress .icon.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { border: 1px solid; display: flex; align-items: flex-start; gap: 10px; border-radius: 9px;
          padding: 11px 13px; font-size: 12px; line-height: 1.55; }
.notice .icon { width: 16px; height: 16px; margin-top: 1px; }
.notice.amber { background: #fffaef; color: #8a5714; border-color: #ffe6ba; }
.notice.blue { background: #f1f6ff; color: #2c5aa0; border-color: #d9e7ff; }
.notice.red { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.notice.green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.flash { margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* --- panorama --- */
.overview-inner { display: flex; align-items: center; gap: 26px; margin: 22px 0 18px; }
.progress-block { display: flex; align-items: center; gap: 18px; min-width: 300px;
                  border-right: 1px solid var(--line); padding-right: 26px; }
.donut { --progress: 0%; width: 98px; height: 98px; flex: none; border-radius: 50%;
         background: conic-gradient(var(--brand) var(--progress), #e7eefa 0); display: grid; place-items: center; }
.donut-core { width: 78px; height: 78px; background: #fff; border-radius: 50%; display: flex;
              flex-direction: column; align-items: center; justify-content: center; }
.donut-core strong { font: 800 24px var(--display); letter-spacing: -1px; }
.donut-core small { font-size: 8px; text-align: center; color: var(--secondary); width: 58px; line-height: 1.35; }
.progress-title { font: 800 14px var(--display); }
.progress-block p { margin-top: 4px; max-width: 170px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(75px, 1fr)); width: 100%; }
.stat { border-right: 1px solid var(--line); text-align: center; padding: 4px 9px; }
.stat:last-child { border-right: 0; }
.stat-icon { height: 26px; width: 26px; border-radius: 8px; display: grid; place-items: center;
             margin: 0 auto 6px; background: #edf2fa; color: #6e7f98; }
.stat-icon .icon { height: 14px; width: 14px; }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.blue { background: var(--brand-soft); color: var(--brand); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat strong { display: block; font: 800 18px var(--display); }
.stat small { font-size: 11px; color: var(--secondary); white-space: nowrap; }

/* --- secciones y tarjetas de fuente --- */
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin: 30px 0 13px; }
.section-heading h2 { font-size: 19px; letter-spacing: -.6px; margin-top: 5px; }
.section-aside { font-size: 12px; color: #8997aa; }
.source-icon { height: 36px; width: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.source-icon.indigo { background: #e9effa; color: #23498a; }
.source-icon.green { background: var(--green-soft); color: #087b5e; }
.source-icon.blue { background: var(--brand-soft); color: var(--brand); }
.source-icon.amber { background: var(--amber-soft); color: var(--amber); }
.source-head { display: flex; align-items: center; gap: 11px; }
.source-head strong { display: block; font: 800 13px var(--display); }
.source-head small { color: #8391a5; font-size: 11px; }
.source-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.source-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.source-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.source-card { padding: 18px 18px 14px; min-width: 0; display: flex; flex-direction: column; }
.source-card.flagged { border-color: var(--red-line); box-shadow: 0 0 0 1px var(--red-line), var(--shadow); }
.red-flag { display: flex; align-items: center; gap: 6px; margin: -18px -18px 14px; padding: 8px 18px;
            border-radius: var(--radius) var(--radius) 0 0; background: var(--red-soft); color: var(--red);
            font: 800 11px var(--display); letter-spacing: .4px; text-transform: uppercase; }
.red-flag .icon { width: 14px; height: 14px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font: 800 13px var(--display); margin-top: 14px; }
.card-sub { color: #8391a5; font-size: 11px; }
.card-detail { font-size: 11px; color: var(--secondary); margin-top: 8px; overflow-wrap: anywhere; }
.data-list { margin: 12px 0 10px; display: grid; gap: 10px; }
.data-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
            padding-bottom: 9px; border-bottom: 1px solid var(--line-soft); }
.data-row:last-child { border-bottom: 0; padding-bottom: 0; }
.data-row span { color: #65758b; font-size: 12px; }
.data-row strong { font-size: 12px; overflow-wrap: anywhere; text-align: right; }
.data-row.long { display: block; }
.data-row.long strong { display: block; text-align: left; font-weight: 600; margin-top: 3px;
                        font-size: 12px; line-height: 1.5; }
.data-row.long strong.tone-info { color: var(--secondary); }
.tone-ok { color: var(--green); } .tone-warn { color: var(--amber); }
.tone-bad { color: var(--red); } .tone-info { color: var(--ink); }
.tone-muted { color: var(--muted); font-weight: 500; }
.data-row.muted-row span { color: var(--muted); }
.data-divider { border-top: 1px dashed var(--line); margin: 2px 0; }
.judicial-scope { margin: -4px 0 12px; }
.party.is-subject { font-weight: 800; color: var(--ink); }
.case-group { border: 1px solid var(--line); border-radius: 10px; margin-top: 12px; background: #fbfcfe; }
.case-group > summary { cursor: pointer; padding: 11px 14px; font: 700 13px var(--display); display: flex;
                        align-items: center; gap: 8px; list-style: none; }
.case-group > summary::-webkit-details-marker { display: none; }
.case-group > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.case-group[open] > summary::before { transform: rotate(90deg); }
.case-group > summary .count { font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 20px;
                               background: #e9eff8; color: #40556f; }
.case-group > p, .case-group > .table-scroll { padding: 0 14px 12px; }
.card-actions { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); display: flex;
                align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.card-actions form { display: inline; }
.updated { font-size: 10px; color: #93a0ae; }

/* --- identidad --- */
.identity-card { display: grid; grid-template-columns: minmax(210px, 1.4fr) minmax(150px, .7fr) minmax(180px, .8fr);
                 gap: 26px; align-items: stretch; }
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.fact-grid small, .identity-side small { display: flex; gap: 7px; align-items: center; color: #8996aa; font-size: 11px; }
.fact-grid strong, .identity-side strong { font-size: 14px; display: block; margin-top: 4px; }
.identity-side small .icon { width: 13px; height: 13px; }
.photo-box { min-height: 130px; border-radius: 10px; background: #f6f8fb; display: flex; flex-direction: column;
             align-items: center; justify-content: center; color: #a0acbb; gap: 8px; font-size: 11px;
             text-align: center; overflow: hidden; }
.photo-box .icon { height: 32px; width: 32px; }
.photo-box img { width: 100%; height: 100%; max-height: 190px; object-fit: contain; }
.identity-side { display: flex; flex-direction: column; justify-content: center; gap: 20px;
                 border-left: 1px solid var(--line); padding-left: 24px; }

/* --- judicial e insolvencia --- */
.judicial-summary { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 16px 0; }
.judicial-summary > div:first-child { display: flex; align-items: center; gap: 11px; }
.big-number { font: 800 30px var(--display); }
.judicial-summary span { font-size: 12px; color: #6f7e92; }
.notice.compact { max-width: 560px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; background: #f4f6fa; color: #6d7e95; font-size: 11px; font-weight: 800; padding: 11px 13px; }
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
td { padding: 13px; border-bottom: 1px solid #edf1f6; vertical-align: top; font-size: 12px; color: #4d607b; line-height: 1.6; }
tr:last-child td { border-bottom: 0; }
.cases td:first-child { font: 800 11px var(--display); color: var(--brand-deep); white-space: nowrap; }
.cases td:nth-child(3), .cases td:nth-child(4) { white-space: nowrap; }
.cases table { min-width: 820px; }
.party { display: block; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px;
                padding-top: 14px; margin-top: 6px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel-footer > span { display: flex; align-items: center; gap: 7px; color: #8996a9; font-size: 11px; }
.panel-footer .icon { height: 14px; width: 14px; }
.callout { display: flex; align-items: center; gap: 12px; border-radius: 9px; padding: 14px; margin-top: 16px; border: 1px solid; }
.callout strong { display: block; font-size: 13px; }
.callout p { font-size: 12px; }
.callout.blue { background: #f1f6ff; border-color: #d9e7ff; color: #2c5aa0; }
.callout.green { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.callout.amber { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.callout.neutral { background: var(--neutral-soft); border-color: var(--neutral-line); color: var(--neutral); }

/* --- listados --- */
.list-table td, .list-table th { font-size: 13px; }
.list-table td { color: var(--ink); vertical-align: middle; }
.list-table a.row-link { font-weight: 700; color: var(--brand-deep); }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; color: #a9b6c8; margin-bottom: 8px; }

/* --- formularios --- */
.form-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 9px; border: 1px solid #d9e0ea;
         background: #fbfcfe; color: var(--ink); }
.input:focus { border-color: var(--brand); outline: 3px solid #d4e5ff; }
.capture { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.dropzone { border: 1.5px dashed #c5d2e4; border-radius: 12px; padding: 22px; text-align: center; background: #fafcff;
            display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone > .icon { width: 30px; height: 30px; color: var(--brand); }
.dropzone-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.preview { border-radius: 12px; background: #f6f8fb; min-height: 180px; display: grid; place-items: center;
           overflow: hidden; color: #a0acbb; font-size: 12px; text-align: center; }
.preview img, .preview video { width: 100%; height: 100%; max-height: 300px; object-fit: contain; background: #000; }
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 10px;
           background: #f7f9fc; border: 1px solid var(--line); cursor: pointer; }
.consent input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.cost { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.cost > span { display: inline-flex; align-items: center; gap: 6px; }
.cost > span .icon { width: 15px; height: 15px; }
.source-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: #eef2f8; color: #4a5d78; }

/* --- llaves --- */
.key-card + .key-card { margin-top: 14px; }
.key-form { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.key-form .input { flex: 1 1 280px; width: auto; }
.key-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.key-actions form { display: inline; }

/* --- dialogo de evidencia --- */
.evidence-dialog { border: 1px solid #e1e7ef; border-radius: 16px; box-shadow: 0 25px 90px #0c1c3440;
                   width: min(760px, calc(100% - 24px)); max-height: 88vh; padding: 22px; color: var(--ink); }
.evidence-dialog::backdrop { background: #071427aa; backdrop-filter: blur(2px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-header h2 { font-size: 20px; margin: 4px 0 10px; }
.evidence-dialog pre { white-space: pre-wrap; word-break: break-word; background: #0d1a2e; color: #e2edf9;
                       border-radius: 10px; padding: 18px; font-size: 12px; line-height: 1.65; overflow: auto;
                       max-height: 52vh; margin: 12px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }

.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid #e0e6ee;
          margin-top: 38px; padding-top: 18px; color: #98a4b3; font-size: 11px; }
.footer span:first-child { display: flex; align-items: center; gap: 7px; }
.footer .icon { width: 13px; height: 13px; }

/* --- responsive --- */
@media (max-width: 1200px) {
  .sidebar { width: 220px; }
  .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-block { min-width: 265px; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px #0006; }
  .mobile-menu { display: grid; }
  .secure, .who { display: none; }
  .hero { align-items: flex-start; flex-direction: column; }
  .overview-inner { flex-direction: column; align-items: stretch; }
  .progress-block { border-right: 0; padding-right: 0; }
  .identity-card { grid-template-columns: 1fr 160px; }
  .identity-side { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; grid-column: 1 / -1; flex-direction: row; gap: 32px; }
  .source-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .panel { padding: 17px 16px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .stat { border: 0; }
  .progress-block { min-width: 0; }
  .identity-card { grid-template-columns: 1fr; }
  .source-grid, .source-grid.cols-2, .source-grid.cols-3, .form-grid, .capture { grid-template-columns: 1fr; }
  .section-aside { display: none; }
  .judicial-summary { flex-direction: column; align-items: flex-start; }
  .footer { flex-direction: column; align-items: flex-start; }
  .breadcrumb { font-size: 11px; }
  .list-table .hide-sm { display: none; }
}
@media print {
  .case-group > :not(summary) { display: block !important; }
  .sidebar, .topbar, .hero-actions, .back, .card-actions, .panel-footer button, .footer, .no-print { display: none !important; }
  .main { max-width: none; padding: 0; }
  .panel, .source-card { box-shadow: none; break-inside: avoid; }
  .source-grid, .source-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .cases table { min-width: 0; }
  td, th { font-size: 9px; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Documentos subidos (validación en forma) */
.doc-row { border-top: 1px solid var(--line, #e3e7ef); padding: 14px 0; }
.doc-row:first-child { border-top: 0; padding-top: 0; }
.doc-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.doc-checks { margin: 8px 0 0; padding-left: 18px; }
.doc-checks li.ok { color: #1f6f43; }
.doc-checks li.bad { color: #a23b3b; }
.doc-form { margin-top: 16px; }

/* Captura de la cedula desde el celular (QR) */
.phone-body { margin: 0; min-height: 100vh; display: grid; place-items: start center; padding: 8px; background: var(--bg, #f5f7fa); }
.phone-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 14px; display: grid; gap: 14px; }
.phone-card form { display: grid; gap: 12px; }
.phone-card progress { width: 100%; height: 10px; }
.phone-qr { display: grid; justify-items: center; gap: 10px; margin-top: 12px; }
.phone-qr svg { width: min(260px, 80vw); height: auto; }
.phone-qr-link { word-break: break-all; font-size: 12px; }
.cam-stage { position: relative; aspect-ratio: 4 / 7; overflow: hidden; border-radius: 12px; background: #000; }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-guide { position: absolute; top: 50%; left: 50%; width: 94%; aspect-ratio: 54 / 85.6; transform: translate(-50%, -50%);
  border: 2px solid #fff; border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.5); pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center; }
.cam-guide span { color: #fff; font-size: 12px; margin-bottom: 6px; text-shadow: 0 1px 2px #000; }
.cam-preview { width: 100%; border-radius: 12px; display: block; }
.phone-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.phone-card .btn-block { width: 100%; }

/* En el celular el marco usa casi todo el ancho disponible. */
.phone-card .cam-stage { margin: 0 -4px; }

/* Estado de revisión de un documento: ícono girando mientras el servidor valida. */
.doc-status { display: flex; align-items: center; gap: 8px; }
.doc-status .icon.spin { animation: doc-spin 1s linear infinite; }
@keyframes doc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .doc-status .icon.spin { animation: none; } }


/* Propiedades de la SNR: una tarjeta por inmueble, sin tablas (no hay scroll lateral). */
.property-lead { margin: 2px 0 14px; max-width: 72ch; }
.property-list { display: grid; gap: 14px; }
.property-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); overflow: hidden; }
.property-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
                 padding: 14px 16px; background: #fbfcfe; border-bottom: 1px solid var(--line-soft); }
.property-title { display: grid; gap: 2px; min-width: 0; }
.property-title strong { font: 700 14px/1.35 var(--display); overflow-wrap: anywhere; }
.property-head .count { flex: none; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 20px;
                        background: var(--brand-soft); color: var(--brand-deep); }
.property-units { list-style: none; margin: 0; padding: 2px 16px; }
.property-units li { display: grid; grid-template-columns: 124px minmax(0, 1fr) minmax(150px, 190px); gap: 12px;
                     align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.property-units li:last-child { border-bottom: 0; }
.matricula { font: 700 12.5px var(--display); color: var(--brand-deep); background: none; padding: 0; }
.unit { color: var(--secondary); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.property-units select.input { min-height: 36px; padding: 6px 10px; }
.property-value { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 270px); align-items: center;
                  gap: 4px 16px; padding: 12px 16px 14px; background: #fbfcfe; border-top: 1px solid var(--line-soft); }
.property-value label { font: 700 13px var(--text); }
.property-value .hint { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin: 0; }
.property-total { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
                  margin: 16px 0 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
                  background: var(--neutral-soft); }
@media (max-width: 640px) {
  .property-units li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .property-value { grid-template-columns: minmax(0, 1fr); }
  .property-total { flex-direction: column; align-items: stretch; }
  .property-total .btn { width: 100%; justify-content: center; }
}

/* Tablas que en celular se apilan: cada celda lleva su etiqueta (data-label), sin scroll lateral. */
@media (max-width: 640px) {
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody, .stack-table tr { display: block; width: 100%; }
  .stack-table tr { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .stack-table tr.total-row { background: var(--neutral-soft); padding: 10px 8px; border-radius: 8px; margin-top: 6px; }
  .stack-table td { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border: 0; text-align: right; }
  .stack-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  .stack-table td[colspan] { display: none; }
}

/* El precio es lo primero que se ve de cada inmueble. */
.property-head .count { background: var(--neutral-soft); color: var(--secondary); }
.property-amount { flex: none; text-align: right; display: grid; gap: 1px; }
.property-amount small { font-size: 11px; color: var(--muted); font-weight: 600; }
.property-amount strong { font: 800 22px/1.15 var(--display); color: var(--green); letter-spacing: -.01em; }
.property-amount.is-empty strong { font-size: 14px; font-weight: 700; color: var(--amber); }
.property-value { background: var(--green-soft); border-top-color: var(--green-line); }
.property-value label { color: var(--navy); }
.property-value .input { font: 800 18px var(--display); color: var(--green); border-color: var(--green-line);
                         background: var(--white); text-align: right; }
.property-value .input::placeholder { font: 500 14px var(--text); color: var(--muted); }
.property-value .input:focus { border-color: var(--green); outline: 3px solid #cdeedd; }
.property-total { background: var(--green-soft); border-color: var(--green-line); }
.property-sum { display: grid; gap: 1px; }
.property-sum small { font-size: 11px; color: var(--muted); font-weight: 600; }
.property-sum strong { font: 800 26px/1.1 var(--display); color: var(--green); letter-spacing: -.01em; }
@media (max-width: 640px) {
  .property-head { flex-direction: column; gap: 8px; }
  .property-amount { text-align: left; }
  .property-value .input { text-align: left; }
}

/* Cada matrícula es un elemento propio: etiqueta, línea marcada y aire entre una y otra. */
.property-list { gap: 20px; }
.property-units { padding: 0 16px; }
.property-units li { padding: 14px 0; border-bottom: 0; border-top: 1px solid var(--neutral-line); }
.property-units li:first-child { border-top: 0; }
.matricula { display: inline-block; justify-self: start; padding: 3px 10px; border-radius: 20px;
             background: var(--brand-soft); border: 1px solid #d3e3fb; }
.unit { font-weight: 600; color: var(--ink); }
@media (max-width: 640px) {
  /* anula el «no partir texto» de las tablas de procesos (.cases) para que la celda apilada se ajuste */
  .stack-table.stack-table td, .stack-table.stack-table td:nth-child(n) {
    white-space: normal; overflow-wrap: anywhere; min-width: 0; font: inherit; color: inherit;
  }
  .stack-table.stack-table td:first-child { font-weight: 800; color: var(--brand-deep); }
}
@media (max-width: 640px) {
  .stack-table.stack-table { min-width: 0; width: 100%; }
}
.tag.red { background: var(--red-soft); color: var(--red); }

/* Autoguardado: estado junto al total. */
.property-save { display: flex; align-items: center; gap: 12px; }
.autosave-status.ok { color: var(--green); font-weight: 700; }
.autosave-status.bad { color: var(--red); font-weight: 700; }
@media (max-width: 640px) { .property-save { justify-content: space-between; } }

/* Alertas de coherencia */
#alerts-panel { display: grid; gap: 12px; }
.alert-card { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 14px 16px;
              background: var(--white); display: grid; gap: 6px; }
.alert-card.yellow { border-left-color: #e0a030; background: #fffaef; }
.alert-card.red { border-left-color: var(--red); background: var(--red-soft); }
.alert-card.info { border-left-color: var(--brand); }
.alert-card.cleared { border-left-color: var(--green, #2e9e5b); }
.alert-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-head strong { font: 700 14px/1.35 var(--display); flex: 1 1 260px; }
.alert-card p { max-width: 80ch; }

/* Score y perfil */
#score-panel h3 { margin: 22px 0 10px; font: 700 14px var(--display); }
.score-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score-number { display: grid; justify-items: center; min-width: 108px; padding: 14px 18px; border-radius: var(--radius);
                border: 2px solid var(--line); background: var(--white); }
.score-number strong { font: 800 54px/1 var(--display); letter-spacing: -.03em; }
.score-number span { font-size: 12px; color: var(--muted); font-weight: 700; }
.score-number.green { border-color: var(--green-line); background: var(--green-soft); }
.score-number.green strong { color: var(--green); }
.score-number.yellow { border-color: var(--amber-line); background: var(--amber-soft); }
.score-number.yellow strong { color: var(--amber); }
.score-number.red { border-color: var(--red-line); background: var(--red-soft); }
.score-number.red strong { color: var(--red); }
.score-meta { display: grid; gap: 8px; min-width: 0; flex: 1 1 280px; }
.score-meta p { margin: 0; max-width: 70ch; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.gray { background: var(--neutral-soft); color: var(--neutral); }
.score-list, .claim-list, .missing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.missing-list { list-style: disc; padding-left: 20px; gap: 6px; }
.score-list li { display: grid; grid-template-columns: 170px minmax(80px, 1fr) 76px; gap: 6px 14px; align-items: center; }
.score-bar { height: 8px; border-radius: 8px; background: var(--line-soft); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--brand); border-radius: 8px; }
.score-points { font: 800 15px var(--display); text-align: right; }
.score-points small { font-weight: 600; color: var(--muted); }
.score-note { grid-column: 1 / -1; margin: -4px 0 2px; }
.claim-list li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: start; }
.claim-list li > div { display: grid; gap: 1px; min-width: 0; }
.claim-list .tag { justify-self: start; }
@media (max-width: 640px) {
  .score-list li { grid-template-columns: minmax(0, 1fr) 70px; }
  .score-bar { grid-column: 1 / -1; order: 3; }
  .claim-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
.missing-list + p { margin-top: 16px; }

/* Adjuntar un documento desde la propia alerta */
.alert-upload { display: grid; gap: 8px; margin-top: 6px; padding: 12px 14px; border: 1px dashed var(--neutral-line);
                border-radius: 10px; background: var(--white); max-width: 560px; }
.alert-upload label { font: 700 13px var(--text); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.alert-upload .icon { width: 15px; height: 15px; }
.alert-upload label .muted { font-weight: 400; }

/* Lo que cada inmueble suma al score (solo suma). */
.property-credit { display: grid; gap: 3px; justify-items: start; flex: 1 1 140px; }
.property-credit small { color: var(--muted); font-size: 12px; }

/* Certificado de tradición (CTL) por matrícula: carga, arrastre y resultado del estudio. */
.ctl-row { display: grid; gap: 8px; }
.ctl-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ctl-drop { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border: 1.5px dashed #c5d2e4;
  border-radius: 10px; background: #fafcff; cursor: pointer; font-size: 13px; color: var(--secondary); }
.ctl-drop:hover, .ctl-drop.is-over { border-color: var(--brand); background: #f1f6ff; }
.ctl-drop .icon { width: 16px; height: 16px; flex: none; color: var(--brand); }
.ctl-result { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  border-left-width: 4px; background: var(--neutral-soft); }
.ctl-result.green { border-left-color: var(--green); }
.ctl-result.red { border-left-color: var(--red); }
.ctl-steps-done { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.ctl-steps-done li { display: flex; gap: 6px; align-items: flex-start; }
.ctl-steps-done .icon { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.ctl-explainer { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--neutral-soft); display: grid; gap: 8px; }
.ctl-explainer h4 { margin: 0; font-size: 15px; }
.ctl-explainer h4 small { font-weight: 400; color: var(--muted); }
.ctl-explainer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ctl-explainer li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.property-units li.ctl-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ctl-line { display: grid; grid-template-columns: 124px minmax(0, 1fr) minmax(150px, 190px); gap: 12px; align-items: center; }
@media (max-width: 720px) { .ctl-line { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* Espacio del usuario y correos (panel del administrador). */
.portal-admin-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; }
.portal-admin-row > .label, .portal-admin-row > label { font-weight: 700; min-width: 150px; }
.portal-admin-row .input { max-width: 320px; }
.portal-link { background: var(--neutral-soft); padding: 4px 8px; border-radius: 8px; word-break: break-all; font-size: 12px; }
.portal-send { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.logout-form { display: inline; margin: 0 0 0 10px; }
