/* Portal Clientes ARSO */
:root {
  color-scheme: light;
  --bg: #f2f1ec;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #dfe4eb;
  --line-2: #eef1f5;
  --text: #17212e;
  --text-2: #4b5768;
  --muted: #6b7686;
  /* Paleta ARSO (Instagram @arso.cl): verde bosque, verde salvia, crema */
  --primary: #234a36;
  --primary-2: #2f6047;
  --primary-soft: #e3ece4;
  --accent: #8fb394;
  --amber: #e8a317;
  --ok: #1d7a46; --ok-soft: #e4f4ea;
  --warn: #9a6300; --warn-soft: #fff4dc;
  --err: #b42318; --err-soft: #fdecea;
  --info: #1d5f9c; --info-soft: #e7f0fa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 6px rgba(16, 24, 40, .04);
  --nav-w: 216px;
  --top-h: 58px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; }
a { color: var(--primary-2); }
h1 { font-size: 24px; line-height: 1.2; margin: 2px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--text-2); }
h4 { font-size: 14px; margin: 12px 0 6px; }
p { margin: 0 0 8px; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 14px; }
.danger-text { color: var(--err); }
.no-scroll { overflow: hidden; }
.boot { padding: 48px; text-align: center; color: var(--muted); }

/* ---------- Layout */
#topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; padding-top: env(safe-area-inset-top); background: var(--primary); color: #fff; }
#topbar:empty { display: none; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand .ic { width: 34px; height: 34px; color: #1b3a2a; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.brand-logo img { width: 36px; height: 36px; object-fit: contain; }
.brand-logo.wide { width: auto; padding: 0 10px; }
.brand-logo.wide img { width: auto; height: 26px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-size: 12px; opacity: .8; }
.top-actions { display: flex; align-items: center; gap: 8px; }
#topbar .icon-btn { color: #fff; }
#topbar .icon-btn:hover { background: rgba(255, 255, 255, .12); }

#nav:empty { display: none; }
#nav { position: fixed; z-index: 15; background: var(--surface); }
#nav a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-2); font-weight: 500; }
#nav a.on { color: var(--primary); }

@media (min-width: 900px) {
  #nav { top: var(--top-h); left: 0; bottom: 0; width: var(--nav-w); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
  #nav a { padding: 10px 12px; border-radius: 8px; }
  #nav a:hover { background: var(--surface-2); }
  #nav a.on { background: var(--primary-soft); }
  body:has(#nav:not(:empty)) #view { margin-left: var(--nav-w); }
}
@media (max-width: 899px) {
  #nav { left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.04); }
  #nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 8px 2px 7px; justify-content: center; }
  #nav a .ic { width: 22px; height: 22px; }
  body:has(#nav:not(:empty)) #view { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; }
.page.narrow { max-width: 860px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; text-decoration: none; color: var(--muted); }
.back .ic { width: 16px; height: 16px; }
.section-title { font-size: 15px; color: var(--text-2); margin: 20px 0 10px; }

.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .grid-2 { grid-template-columns: 1.15fr 1fr; } }
.grid-2 > * { min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child { margin-top: 0; }

/* ---------- Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger.ghost, .btn.ghost { background: transparent; }
.btn.danger.ghost { color: var(--err); border-color: transparent; }
.btn.ghost { border-color: transparent; color: var(--text-2); }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.wa { color: #128c4b; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn.mini { width: 30px; height: 30px; }
.link { background: none; border: 0; padding: 0; color: var(--primary-2); font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.link .ic { width: 15px; height: 15px; }
:focus-visible { outline: 3px solid #9cc2a3; outline-offset: 1px; }

/* ---------- Formularios */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
.req { color: var(--err); }
input, select, textarea { font: 15px var(--font); color: var(--text); background: var(--surface); border: 1px solid #cbd3de; border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 42px; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); outline: 2px solid #cfe0d2; outline-offset: 0; }
input[type=color] { padding: 3px; height: 42px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); flex: none; margin: 2px 0 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--surface-2); color: var(--text-2); }
.grid-form { display: grid; grid-template-columns: 1fr; column-gap: 14px; }
@media (min-width: 640px) { .grid-form { grid-template-columns: 1fr 1fr; } .span2 { grid-column: span 2; } }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; font-size: 14px; }
label.check.card { padding: 14px 18px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; }
.seg { display: flex; gap: 16px; flex-wrap: wrap; }
.seg label { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 8px; z-index: 5; }
@media (max-width: 899px) { .form-actions.sticky { bottom: calc(62px + env(safe-area-inset-bottom)); } }
.contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; padding: 10px 0; border-top: 1px dashed var(--line); position: relative; }
.contact-row .icon-btn { position: absolute; top: 4px; right: 0; }
@media (min-width: 760px) { .contact-row { grid-template-columns: 1.2fr 1fr 1.3fr 1fr 40px; align-items: end; } .contact-row .icon-btn { position: static; margin-bottom: 14px; } }
.att { margin-bottom: 6px; }
.att-name { font-size: 13px; color: var(--text-2); }

/* ---------- Toolbar / búsqueda */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; flex: 0 1 220px; }
.search { position: relative; flex: 1 1 260px; }
.search .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search input { padding-left: 38px; }

/* ---------- Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list li > a, .list li > .li-main { text-decoration: none; color: inherit; }
.list li > a { display: flex; justify-content: space-between; gap: 12px; padding: 11px 4px; align-items: flex-start; }
.list li > a:hover { background: var(--surface-2); }
.list.compact li > a { padding: 8px 4px; }
.list.docs li, .list.compact li:not(:has(> a)) { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; flex-wrap: wrap; }
.list.cards li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; box-shadow: var(--shadow); }
.list.cards li > a { padding: 13px 14px; }
.li-main { min-width: 0; flex: 1; }
.li-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; max-width: 45%; }
.li-side small { font-size: 12px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--line-2); color: var(--text-2); vertical-align: 1px; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--line-2); color: var(--text-2); white-space: nowrap; line-height: 1.3; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary); color: #fff; }
.badge.done { background: #e9ecef; color: #495057; }
.badge.muted { background: #f1f3f5; color: #6c757d; }
h1 .badge { font-size: 13px; }

.alert { padding: 11px 14px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 14px; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.alert .ic { width: 18px; height: 18px; margin-top: 1px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert a { color: inherit; font-weight: 600; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .btn { margin-top: 6px; }

/* ---------- Tablas */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--surface-2); }
.table.compact td { padding: 6px 8px; }
.table tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.table.items td, .table.meds td { padding: 5px 4px; vertical-align: middle; }
.table.items input, .table.items select, .table.meds input { min-height: 38px; padding: 7px 8px; font-size: 14px; }
.table.items input.num { text-align: right; }
.table.items .sub { font-weight: 600; white-space: nowrap; }
@media (max-width: 700px) {
  .table.items thead { display: none; }
  .table.items tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table.items td { border: 0; padding: 0; }
  .table.items td[data-l="Descripción"] { grid-column: span 2; }
  .table.items td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  .table.items td.sub { align-self: end; text-align: left; }
}
.totals { margin: 14px 0 0 auto; max-width: 300px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 2px; }
.totals .grand { border-top: 2px solid var(--primary); margin-top: 4px; padding-top: 8px; font-size: 18px; color: var(--primary); }

/* ---------- Pantalla principal */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.stat strong { font-size: 28px; line-height: 1; }
.stat span { font-size: 13px; color: var(--text-2); }
.stat:hover { background: var(--surface-2); }
.stat.primary { border-left-color: var(--primary); }
.stat.info { border-left-color: var(--info); }
.stat.warn { border-left-color: var(--amber); }
.stat.err { border-left-color: var(--err); }
.stat.ok { border-left-color: var(--ok); }
.stat.alert { border-left-color: #c2410c; display: flex; }
.stat.alert strong { color: #c2410c; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpis.wide { margin-bottom: 16px; }
.kpis.inline { display: flex; flex-wrap: wrap; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.kpi strong { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { color: var(--muted); font-size: 12.5px; }
.kpi.pos strong { color: var(--ok); }
.kpi.neg strong { color: var(--err); }

/* ---------- OT */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 10px 12px; text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--accent); }
.tabs .count { background: var(--line-2); border-radius: 99px; padding: 0 7px; font-size: 12px; }
.next-step { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff8e8; border: 1px solid #f3d590; color: #6b4600; padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; }
.next-step span { flex: 1; min-width: 200px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 8px; align-items: center; padding: 6px 0; color: var(--muted); }
.checklist li.ok { color: var(--ok); }
.checklist.big li { font-size: 15px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.entry header { margin-bottom: 8px; }
.entry p { font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; margin-top: 4px; z-index: 1; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--amber); } .dot.err { background: var(--err); } .dot.info { background: var(--info); } .dot.primary { background: var(--primary); } .dot.done { background: #495057; }
.bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--primary-2); border-radius: 99px; }

/* ---------- Fotos */
.photo-block h3 { margin-top: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.thumb { position: relative; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #e9edf2; }
.thumb figcaption { font-size: 12.5px; padding: 6px 8px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .icon-btn { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); }
.thumb.missing img { opacity: .3; }
.thumb.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 4 / 3.6; border: 2px dashed #c3ccd8; color: var(--primary-2); font: 600 13px var(--font); }
.thumb.add .ic { width: 28px; height: 28px; }
.thumb.add small { color: var(--muted); font-weight: 400; }
.photo-desc { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.photo-desc img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.photo-desc .field { flex: 1; margin: 0; }
.photo-full { width: 100%; height: auto; border-radius: 8px; display: block; }
.logo-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.logo-prev { width: 80px; height: 80px; border-radius: 12px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--primary); overflow: hidden; flex: none; }
.logo-prev .ic { width: 60px; height: 60px; }
.logo-prev img { max-width: 100%; max-height: 100%; }

/* ---------- Sincronización */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 99px; padding: 6px 11px; font: 600 12.5px var(--font); cursor: pointer; background: rgba(255,255,255,.14); color: #fff; }
.sync-pill .ic { width: 16px; height: 16px; }
.sync-pill.off { background: #ffd8a8; color: #6b3d00; }
.sync-pill.err { background: #ffc9c9; color: #8a1c1c; }
.sync-pill.busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 420px) { .sync-pill span { display: none; } }

/* ---------- Ventanas y avisos */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 34, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 760px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 18px; }
.modal header h3 { margin: 0; font-size: 17px; color: var(--text); }
.modal-body { padding: 8px 18px 12px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 16px 16px; border-top: 1px solid var(--line-2); }
@media (max-width: 600px) {
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .modal footer .btn { flex: 1 1 auto; }
}
.menu-list { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.menu-list a { display: flex; gap: 10px; align-items: center; padding: 10px 8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.menu-list a:hover { background: var(--surface-2); }
.menu-list .check { border-bottom: 1px solid var(--line-2); padding: 9px 2px; }
ul.plain { padding-left: 18px; font-size: 14px; }
#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { background: #1f2a37; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); transition: opacity .3s, transform .3s; text-align: center; }
.toast.ok { background: #17603a; } .toast.error { background: #a4161a; } .toast.warn { background: #8a5a00; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Ingreso y portal */
body[data-layout="login"] { background: linear-gradient(160deg, #1b3a2a 0%, #2f6047 55%, #f2f1ec 55.1%); }
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 12px; }
.login-card { background: var(--surface); width: 100%; max-width: 400px; border-radius: 16px; padding: 26px 24px; box-shadow: 0 16px 40px rgba(27, 58, 42, .20); }
.login-card h1 { font-size: 20px; margin: 18px 0 14px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--primary); }
.login-brand img { height: 46px; width: auto; }
.login-brand span { font-size: 15px; font-weight: 600; color: var(--text-2); padding-left: 14px; border-left: 1px solid var(--line); }
.login-brand .ic { width: 46px; height: 46px; }
.login-brand div { display: flex; flex-direction: column; line-height: 1.15; }
.login-brand b { font-size: 18px; color: var(--text); }
.login-brand small { color: var(--muted); letter-spacing: .12em; font-weight: 600; }
.app-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.app-tile { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.app-tile:hover { border-color: var(--primary-2); }
.app-tile b { display: block; font-size: 16px; margin-bottom: 3px; }
.app-tile small { color: var(--muted); font-size: 13.5px; }
.app-ic { width: 48px; height: 48px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.app-ic .ic { width: 26px; height: 26px; }
.install-hint { margin-top: 26px; }

@media print { #topbar, #nav, .form-actions, .tabs { display: none !important; } #view { margin: 0 !important; } }

/* ---------- OT por etapas (OT madre + sub-OT) */
.btn.on { background: var(--primary-soft); border-color: var(--primary-2); color: var(--primary); }
.stepper { display: flex; gap: 10px; overflow-x: auto; margin: 4px 0 16px; padding-bottom: 4px; }
.st-group { flex: 1 1 auto; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; }
.st-group:nth-child(1) { flex-grow: 2; } .st-group:nth-child(2) { flex-grow: 2; } .st-group:nth-child(3) { flex-grow: 1; }
.st-group.off { background: transparent; border-style: dashed; }
.st-glabel { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; white-space: nowrap; }
.st-glabel em { font-weight: 400; color: var(--muted); font-style: normal; }
.st-steps { display: flex; gap: 6px; }
.st { flex: 1; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); padding: 7px 8px; border-radius: 8px; min-width: 0; position: relative; }
.st:hover { background: var(--surface-2); }
.st-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font: 700 12px var(--font); border: 2px solid var(--line); background: var(--surface); color: var(--muted); }
.st-dot .ic { width: 15px; height: 15px; }
.st-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.st.done .st-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.st.done { color: var(--text-2); }
.st.current .st-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.st.current { color: var(--primary); }
.st.sel { background: var(--primary-soft); }
.st.sel .st-name { color: var(--primary); }
@media (max-width: 760px) {
  .stepper { gap: 6px; overflow: visible; }
  .st-group { flex-basis: 0; padding: 8px 4px 6px; }
  .st-glabel { font-size: 10.5px; text-align: center; margin-bottom: 4px; }
  .st-gname, .st-glabel em { display: none; }
  .st-steps { gap: 2px; }
  .st { flex-direction: column; gap: 4px; padding: 6px 2px; text-align: center; }
  .st-dot { width: 24px; height: 24px; }
  .st-name { font-size: 10.5px; }
}
.ot-kpis { margin-bottom: 14px; }
.sub-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; font-size: 15px; }
.sub-head small { width: 100%; }
.blk-n { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13px; align-items: center; justify-content: center; flex: none; }
h4.blk { margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--line-2); color: var(--primary); }
form > h4.blk:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
@media (min-width: 760px) { .grid-form.three { grid-template-columns: 1fr 1fr 1fr; } }
.seg-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.seg-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 14px; }
.seg-tabs a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg-tabs a.on .count { background: rgba(255,255,255,.2); color: #fff; }
.seg-tabs .count { background: var(--line-2); border-radius: 99px; padding: 0 7px; font-size: 12px; }
.entry-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.entry-grid { display: grid; gap: 4px 20px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .entry-grid { grid-template-columns: 1fr 220px; } }
.entry-side { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; align-self: start; }
.entry p.lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin: 8px 0 2px; }
.entry p.lbl:first-child { margin-top: 0; }
.entry .photo-block { margin-top: 10px; }

/* ---------- OT v3: tabla densa, línea de estados, AST */
.page.wide { max-width: 1400px; }
.table.dense { font-size: 13px; }
.table.dense th { padding: 6px 8px; font-size: 11px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table.dense td { padding: 6px 8px; vertical-align: middle; }
.table.dense tbody tr:nth-child(even) td { background: var(--surface-2); }
.table.dense tr[data-href] { cursor: pointer; }
.table.dense tr[data-href]:hover td { background: var(--primary-soft); }
.table.dense .badge { font-size: 11px; padding: 2px 7px; }
.dense-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 230px); overflow: auto; }
.table .trunc { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .trunc.wide-col { max-width: 320px; }
.table .trunc small { white-space: nowrap; }
.estado-bar { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 14px; overflow-x: auto; }
.estado-bar li { flex: 1; min-width: 96px; display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.estado-bar li:first-child { border-radius: 10px 0 0 10px; } .estado-bar li:last-child { border-radius: 0 10px 10px 0; }
.estado-bar li span { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; border: 2px solid var(--line); flex: none; }
.estado-bar li span .ic { width: 12px; height: 12px; }
.estado-bar li.done { color: var(--text-2); } .estado-bar li.done span { background: var(--primary); border-color: var(--primary); color: #fff; }
.estado-bar li.current { background: var(--primary); border-color: var(--primary); color: #fff; } .estado-bar li.current span { border-color: #fff; color: #fff; }
.card.ast { border-left: 4px solid var(--amber); }
.card.ast.done { border-left-color: var(--ok); }
.table.tec input { min-height: 38px; }
.table.tec input.num { text-align: right; }
.count { background: var(--line-2); border-radius: 99px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.table.dense th, .table.dense td:not(.trunc) { white-space: nowrap; }
