@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --ink: #0E0E0F;
  --ink-2: #1A1A1C;
  --ink-3: #2A2A2D;
  --paper: #F4F3EF;
  --card: #FFFFFF;
  --line: #E4E2DC;
  --line-2: #D6D3CB;
  --text: #18181A;
  --muted: #6E6C67;
  --faint: #9C9A94;
  --accent: #FF4D2E;
  --accent-ink: #FFFFFF;
  --accent-soft: #FFE9E4;
  --good: #1E8E5A;
  --bad: #C93A2B;
  --warn: #B7791F;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(0,0,0,.03), 0 6px 24px -12px rgba(0,0,0,.18);
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --side-w: 236px;
  --st-borrador: #6E6C67; --st-borrador-bg: #EEEDE9;
  --st-enviada: #2459C9;  --st-enviada-bg: #E6EEFC;
  --st-aceptada: #1E8E5A; --st-aceptada-bg: #E3F4EB;
  --st-facturado: #6D3FC6; --st-facturado-bg: #EFE8FB;
  --st-pagado: #0E7C86;   --st-pagado-bg: #E0F3F4;
  --st-rechazada: #C93A2B; --st-rechazada-bg: #FBE7E4;
  --st-vencida: #B7791F;  --st-vencida-bg: #FBF0DC;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 14px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-head); letter-spacing: -.015em; margin: 0; line-height: 1.15; }
code { font-family: var(--f-mono); font-size: .9em; background: var(--paper); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: var(--f-mono); font-weight: 500; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Marca ---------- */
.brand-mark { display: inline-flex; align-items: center; gap: 10px; font: 700 17px/1 var(--f-head); letter-spacing: .02em; text-decoration: none; color: inherit; }
.brand-mark em { font-style: normal; font-weight: 500; opacity: .55; letter-spacing: 0; }
.rec { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255,77,46,.18); flex: none; }

/* ---------- Estructura ---------- */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--ink); color: #EDECE8; display: flex; flex-direction: column; padding: 22px 14px 16px; z-index: 20; }
.side .brand-mark { padding: 4px 10px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: #B9B7B1; font-weight: 500; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav a.on svg { color: var(--accent); opacity: 1; }
.side-foot { margin-top: auto; border-top: 1px solid var(--ink-3); padding: 14px 10px 0; display: grid; gap: 10px; font-size: 13px; }
.me { display: flex; align-items: center; gap: 10px; color: #fff; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink-3); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.link-quiet { color: #8F8D87; text-decoration: none; font-size: 12.5px; }
.link-quiet:hover { color: #fff; }
.main { margin-left: var(--side-w); padding: 28px 36px 60px; max-width: 1240px; outline: none; }
.tabbar { display: none; }

@media (max-width: 900px) {
  .side { display: none; }
  .main { margin-left: 0; padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; background: var(--ink); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; justify-content: space-around; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 10.5px; color: #9C9A94; text-decoration: none; border-radius: 8px; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.on { color: #fff; }
  .tabbar a.on svg { color: var(--accent); }
}

/* ---------- Encabezados de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }
@media (max-width: 900px) { .page-head h1 { font-size: 24px; } .mob-brand { display: flex !important; } }
.mob-brand { display: none; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.mob-brand a.lo { font-size: 12.5px; color: var(--muted); text-decoration: none; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--card); font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #BDB9AF; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #262628; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { background: #F0401F; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Tarjetas y estadísticas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; text-decoration: none; display: block; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font: 600 26px/1.1 var(--f-head); margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--faint); margin-top: 4px; }
.stat.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat.dark .k, .stat.dark .s { color: #A8A6A0; }
a.stat:hover { border-color: var(--line-2); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stat .v { font-size: 21px; } }

/* ---------- Herramientas de lista ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); }
.search input[type=text] { padding-left: 36px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chipbtn { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--muted); }
.chipbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chipbtn .n { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); }
table.list th.sortable { cursor: pointer; user-select: none; }
table.list th.num { text-align: right; }
table.list th.sortable:hover { color: var(--text); }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr.click { cursor: pointer; }
table.list tbody tr.click:hover td { background: #FAF9F6; }
table.list tfoot td { font-weight: 600; border-top: 2px solid var(--text); padding: 12px 14px; }
.folio { font: 500 12.5px var(--f-mono); color: var(--text); white-space: nowrap; }
.qt-title { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who strong { font-weight: 600; display: block; }
.who span { font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

/* Lista en tarjetas para móvil */
.mlist { display: none; }
@media (max-width: 760px) {
  .table-wrap.collapse { display: none; }
  .mlist { display: grid; gap: 10px; }
  .card.listcard { background: none; border: 0; box-shadow: none; }
  .card.listcard > .mlist { padding: 0 !important; }
  .card.listcard > .card-head { padding: 0 0 12px; border: 0; }
}
.mitem { padding: 14px 16px; display: grid; gap: 6px; text-decoration: none; cursor: pointer; }
.mitem .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.mitem .amt { font: 600 16px var(--f-head); font-variant-numeric: tabular-nums; }

/* ---------- Estado ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 0; cursor: default; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
button.status { cursor: pointer; }
button.status::after { content: '▾'; font-size: 9px; opacity: .6; margin-left: 1px; }
.s-borrador { color: var(--st-borrador); background: var(--st-borrador-bg); }
.s-enviada { color: var(--st-enviada); background: var(--st-enviada-bg); }
.s-aceptada { color: var(--st-aceptada); background: var(--st-aceptada-bg); }
.s-facturado { color: var(--st-facturado); background: var(--st-facturado-bg); }
.s-pagado { color: var(--st-pagado); background: var(--st-pagado-bg); }
.s-rechazada { color: var(--st-rechazada); background: var(--st-rechazada-bg); }
.s-vencida { color: var(--st-vencida); background: var(--st-vencida-bg); }

/* ---------- Menús ---------- */
.menu { position: fixed; z-index: 80; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px -12px rgba(0,0,0,.3); padding: 6px; min-width: 190px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13.5px; }
.menu button:hover { background: var(--paper); }
.menu button svg { width: 16px; height: 16px; color: var(--muted); }
.menu button.danger { color: var(--bad); }
.menu button.danger svg { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- Formularios ---------- */
label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: #3A3936; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input:not([type]), select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--card); font-size: 14px; font-weight: 400; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .rte .ed:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.07); }
input[readonly] { background: var(--paper); color: var(--muted); }
input.mono { font-family: var(--f-mono); }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
fieldset.box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
fieldset.box legend { font-size: 12px; font-weight: 600; padding: 0 6px; color: var(--muted); }

/* Interruptor */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--text); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .tr { width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .tr::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .tr { background: var(--ink); }
.switch input:checked + .tr::after { transform: translateX(16px); }
.switch input:focus-visible + .tr { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Editor de texto con formato */
.rte { border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
.rte .tb { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: #FBFAF8; }
.rte .tb button { width: 30px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-weight: 600; color: #55534E; }
.rte .tb button:hover { background: var(--line); }
.rte .ed { min-height: 90px; padding: 10px 12px; font-size: 14px; font-weight: 400; color: var(--text); border: 1px solid transparent; }
.rte .ed:empty::before { content: attr(data-ph); color: var(--faint); }
.rte .ed p { margin: 0 0 4px; } .rte .ed ul, .rte .ed ol { margin: 0 0 4px; padding-left: 22px; }

/* ---------- Editor de cotización ---------- */
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .q-layout { grid-template-columns: 1fr; } }
.q-side { position: sticky; top: 18px; display: grid; gap: 14px; }
@media (max-width: 1100px) { .q-side { position: static; } }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title h2 { font-size: 15px; }
.items { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 10px; background: #FCFBF9; }
.item .r1 { display: grid; grid-template-columns: 1fr 220px auto; gap: 8px; }
.item .r2 { display: grid; grid-template-columns: 90px 140px 90px 1fr; gap: 8px; align-items: end; }
.item .line-total { font: 600 15px var(--f-head); font-variant-numeric: tabular-nums; text-align: right; padding-bottom: 9px; }
.item textarea { min-height: 40px; height: 40px; }
.item label { font-size: 11.5px; color: var(--muted); }
@media (max-width: 700px) { .item .r1 { grid-template-columns: 1fr auto; } .item .r1 .cat { grid-column: 1 / -1; grid-row: 2; } .item .r2 { grid-template-columns: 1fr 1fr; } }
.empty-items { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 26px; text-align: center; color: var(--muted); }
.sumrow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-variant-numeric: tabular-nums; gap: 10px; }
.sumrow.total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 12px; font: 600 22px var(--f-head); }
.sumrow .lbl { color: var(--muted); }
.tax-inline { display: flex; align-items: center; gap: 8px; }
.tax-inline input { width: 64px; height: 32px; text-align: right; }
.costs { background: #FFF8F0; border: 1px dashed #E8C9A0; border-radius: var(--radius); padding: 16px 18px; }
.costs h2 { color: #8A5A12; }
.costs .hint { color: #9A7440; }
.cost-row { display: grid; grid-template-columns: 1fr 120px 120px auto; gap: 8px; margin-bottom: 8px; }
.cost-row input { height: 36px; }
.cost-head { display: grid; grid-template-columns: 1fr 120px 120px 34px; gap: 8px; font-size: 11px; color: #9A7440; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 6px; }
@media (max-width: 600px) { .cost-row, .cost-head { grid-template-columns: 1fr 1fr auto; } .cost-row input:first-child { grid-column: 1 / -1; } .cost-head span:first-child { display: none; } }
.profit { font-weight: 700; color: var(--good); }
.profit.neg { color: var(--bad); }

/* ---------- Vista de cotización ---------- */
.qv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.qv-meta { display: grid; grid-template-columns: repeat(3, auto); gap: 6px 28px; margin-top: 14px; }
.qv-meta .k { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.desc-block { white-space: pre-line; }
.notes-view p { margin: 0 0 4px; }

/* ---------- Proyectos ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.proj { padding: 16px 18px; display: grid; gap: 10px; cursor: pointer; transition: border-color .15s, transform .15s; }
.proj:hover { border-color: var(--line-2); transform: translateY(-1px); }
.proj .desc { font-size: 13px; color: #3A3936; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.bar { height: 6px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 999px; transition: width .3s; }
.bar i.full { background: var(--good); }
.tasks { display: grid; gap: 4px; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.task:hover { background: var(--paper); }
.task input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.task span { flex: 1; }
.task.done span { text-decoration: line-through; color: var(--faint); }

/* ---------- Reportes ---------- */
.rep-filters { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; padding: 16px 18px; margin-bottom: 16px; }
@media (max-width: 900px) { .rep-filters { grid-template-columns: 1fr 1fr; } .rep-filters .wide { grid-column: 1 / -1; } }
.st-cards { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 16px; }
.st-card { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; }
.st-card.on { outline: 2px solid var(--text); }
.st-card .n { font: 600 20px var(--f-head); margin: 6px 0 2px; }
.st-card .t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .st-cards { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 600px) { .st-cards { grid-template-columns: repeat(2, 1fr); } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr; } }

/* ---------- Ajustes ---------- */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .settings { grid-template-columns: 1fr; } }
.logo-drop { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 22px; display: grid; place-items: center; gap: 10px; text-align: center; cursor: pointer; background: #FCFBF9; }
.logo-drop img { max-height: 70px; max-width: 260px; }
.logo-drop.dark { background: var(--ink); }
.user-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.user-row:last-child { border-bottom: 0; }

/* ---------- Clientes ---------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.client { padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.client:hover { border-color: var(--line-2); }
.client .ini { width: 38px; height: 38px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; font: 600 15px var(--f-head); flex: none; }
.client .meta { min-width: 0; flex: 1; }
.client .meta strong { display: block; }
.client .meta .em { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client .meta .st { font-size: 12px; color: var(--faint); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Servicios ---------- */
.cat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.price { font: 600 15px var(--f-head); font-variant-numeric: tabular-nums; }
.price small { font: 400 12px var(--f-body); color: var(--muted); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(14,14,15,.45); backdrop-filter: blur(2px); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); animation: pop .18s ease; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 12px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 4px 20px 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
@media (max-width: 600px) { .overlay { place-items: end center; padding: 0; } .modal { border-radius: 16px 16px 0 0; max-height: 92vh; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Avisos ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); }
@media (max-width: 900px) { #toast { bottom: calc(86px + env(safe-area-inset-bottom)); } }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.loading { padding: 60px; text-align: center; color: var(--faint); }
.error, .warn { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.error { background: var(--st-rechazada-bg); color: var(--bad); }
.warn { background: var(--st-vencida-bg); color: #7A5214; }

/* ---------- Login / instalación ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 18px; padding: 30px 28px; display: grid; gap: 14px; box-shadow: 0 40px 90px -30px rgba(0,0,0,.8); }
.auth-card h1 { font-size: 26px; margin-top: 10px; }
.auth-card .muted { margin: 0; }
.checklist { margin: 0; padding-left: 20px; }
