/* ===== App Jose · estilos base ===== */
:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e2da;
  --primary: #c2410c;
  --primary-dark: #9a3412;
  --primary-soft: #ffedd5;
  --ok: #15803d;   --ok-soft: #dcfce7;
  --warn: #a16207; --warn-soft: #fef3c7;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --danger: #b91c1c; --danger-soft: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
  --sidebar-w: 230px;
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171412; --surface: #221e1b; --text: #f5f5f4; --muted: #a8a29e;
    --border: #3a332e; --primary: #f97316; --primary-dark: #ea580c; --primary-soft: #431407;
    --ok-soft: #14532d; --ok: #86efac; --warn-soft: #422006; --warn: #fcd34d;
    --info-soft: #1e3a8a; --info: #bfdbfe; --danger-soft: #450a0a; --danger: #fca5a5;
  }
}
:root[data-theme="dark"] {
    --bg: #171412; --surface: #221e1b; --text: #f5f5f4; --muted: #a8a29e;
    --border: #3a332e; --primary: #f97316; --primary-dark: #ea580c; --primary-soft: #431407;
    --ok-soft: #14532d; --ok: #86efac; --warn-soft: #422006; --warn: #fcd34d;
    --info-soft: #1e3a8a; --info: #bfdbfe; --danger-soft: #450a0a; --danger: #fca5a5;
  }


* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 12px 0; }

/* ---------- Estructura ---------- */
.main { padding: 20px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

.sidebar { display: none; }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .72rem; text-decoration: none;
}
.tabbar a.active { color: var(--primary); }
.tabbar svg, .sidebar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--surface); border-right: 1px solid var(--border); padding: 20px 12px;
  }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; margin-top: 24px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
  .sidebar nav a:hover { background: var(--bg); }
  .sidebar nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; font-size: .9rem; padding: 0 8px; color: var(--muted); }
  .main { margin-left: var(--sidebar-w); padding: 32px 40px; }
  body:has(.login-wrap) .main { margin-left: auto; }
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand-lg { font-size: 1.35rem; justify-content: center; }

/* ---------- Cabecera de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.back { display: inline-block; margin-bottom: 8px; font-size: .9rem; }

/* ---------- Tarjetas y rejillas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .card { margin-bottom: 0; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-lbl { color: var(--muted); font-size: .85rem; }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list-time { font-weight: 700; color: var(--primary); min-width: 48px; }
.list-body { flex: 1; min-width: 0; }
.list-link { display: flex; justify-content: space-between; gap: 12px; width: 100%; color: inherit; }
.list-link:hover { text-decoration: none; }
.list-link:hover strong { color: var(--primary); }
.actions-inline { display: flex; gap: 16px; margin-top: 4px; font-size: .9rem; }

/* ---------- Tabla (PC) / tarjetas (móvil) ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tr:hover td { background: var(--bg); }
@media (max-width: 699px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .table td { border: 0; padding: 2px 0; }
  .table td[data-hide-mobile] { display: none; }
}

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; font-weight: 400;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 400; }

.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { margin: 0; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .9rem; }

/* ---------- Avisos y etiquetas ---------- */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--border); color: var(--muted); }

/* ---------- Ficha ---------- */
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.quick-actions .btn { flex-direction: column; font-size: .85rem; padding: 12px 6px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card label { text-align: left; }

.placeholder { text-align: center; padding: 48px 16px; }

/* =====================================================
   v0.2 · Visitas y Ajustes
   ===================================================== */
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.eyebrow { margin: 0 0 4px; font-size: .9rem; color: var(--muted); font-weight: 600; }
a.plain { color: inherit; }
h3 { font-size: 1rem; margin: 20px 0 10px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { display: block; background: var(--warn-soft); color: var(--warn); padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.empty-state { text-align: center; padding: 32px 16px; }
.empty-state p { color: var(--muted); }
.inline-form { display: inline-block; margin-top: 12px; }
.btn-xl { padding: 16px 22px; font-size: 1.05rem; width: 100%; }
@media (min-width: 700px) { .btn-xl { width: auto; } }
.section-title { font-size: 1.05rem; margin: 24px 0 10px; }

/* Pasos numerados */
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; margin-right: 6px; vertical-align: 2px; }
.phase-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.phase-head h2 { margin: 0; }
.phase-next { border: 2px solid var(--primary); }
.note { background: var(--bg); border-radius: 10px; padding: 12px 14px; margin-top: 14px; white-space: normal; }

/* Selector de cliente */
.picked { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--primary-soft); }
.results { list-style: none; margin: 8px 0 12px; padding: 0; }
.results li button { display: block; width: 100%; text-align: left; padding: 12px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; color: var(--text); cursor: pointer; }
.results li button:hover { background: var(--bg); }
.radio-list { display: grid; gap: 8px; margin-bottom: 12px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 400; margin: 0; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio input { width: auto; margin: 3px 0 0; accent-color: var(--primary); }
.form-grid-3 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.form-grid-3 label:first-child { grid-column: 1 / -1; }
@media (min-width: 700px) { .form-grid-3 { grid-template-columns: 2fr 1fr 1fr; } .form-grid-3 label:first-child { grid-column: auto; } }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 12px 0; margin: 0; z-index: 5; }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: .9rem; cursor: pointer; }
.chip:hover, .chip:active { border-color: var(--primary); color: var(--primary); }
.chip-sm { padding: 4px 10px; font-size: .8rem; }

/* Agenda */
.segmented { display: inline-flex; background: var(--border); border-radius: 10px; padding: 3px; margin-top: 6px; }
.segmented a { padding: 5px 14px; border-radius: 8px; color: var(--muted); font-size: .9rem; font-weight: 600; text-decoration: none; }
.segmented a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn); color: #fff; font-size: .75rem; }
.day-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }
.day-title.today { color: var(--primary); }
.visit-list { padding: 0 18px; }
.visit { display: flex; gap: 14px; width: 100%; color: inherit; }
.visit:hover { text-decoration: none; }
.visit:hover strong { color: var(--primary); }
.visit-time { font-weight: 700; color: var(--primary); min-width: 52px; display: flex; flex-direction: column; }
.visit-time small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.week-nav strong { min-width: 130px; text-align: center; }
.week { display: grid; gap: 8px; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, 1fr); } }
.week-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 64px; }
@media (min-width: 900px) { .week-day { min-height: 300px; } }
.week-day.today { border-color: var(--primary); }
.week-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted); font-size: .85rem; }
.week-day.today .week-head { color: var(--primary); }
.week-head strong { color: var(--text); font-size: 1.1rem; }
.week-add { margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); font-size: 1.2rem; text-decoration: none; }
.week-add:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.week-item { display: block; padding: 6px 8px; margin-bottom: 6px; border-radius: 8px; background: var(--primary-soft); color: var(--text); font-size: .85rem; border-left: 3px solid var(--primary); text-decoration: none; }
.week-item span { display: block; color: var(--muted); font-size: .75rem; }
.week-item.est-realizada { background: var(--ok-soft); border-color: var(--ok); }
.week-item:hover { text-decoration: none; filter: brightness(.97); }

/* Ficha de visita */
.quick-actions.qa-4 { grid-template-columns: repeat(4, 1fr); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--border); }
.gallery figure { margin: 0; position: relative; }
.gallery figcaption { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-edit { margin-top: 16px; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.table tfoot th { color: var(--text); text-transform: none; font-size: .9rem; }
@media (max-width: 699px) { .table tfoot { display: block; } .table tfoot tr { display: flex; gap: 12px; } .table tfoot th { padding: 8px 0; border: 0; } }

/* Pantalla en obra */
.onsite-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; margin: -20px -16px 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.onsite-bar .back { margin: 0; white-space: nowrap; }
.onsite-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.onsite-title > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) { .onsite-bar { margin: -32px -40px 16px; padding: 12px 40px; } }
.note-card summary { cursor: pointer; font-weight: 600; }
details.est { padding: 0; }
details.est > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
details.est > summary::-webkit-details-marker { display: none; }
details.est[open] > summary { border-bottom: 1px solid var(--border); }
details.est .chev { font-size: 1.5rem; color: var(--muted); transition: transform .15s; }
details.est[open] .chev { transform: rotate(90deg); }
.est-form { padding: 16px 18px; }
.est-jobs { margin-top: 4px; }
.est-new { border-style: dashed; }
.est-new > summary strong { color: var(--primary); }
.measures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.measures label { margin-bottom: 6px; }
.m2-out { min-height: 1.2em; margin: 0 0 12px; font-weight: 600; color: var(--primary); }
.btn-file { position: relative; overflow: hidden; margin: 4px 0 0; }
.btn-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }

/* Ajustes */
.theme-picker { display: grid; gap: 10px; }
@media (min-width: 700px) { .theme-picker { grid-template-columns: repeat(3, 1fr); } }
.theme-opt { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin: 0; font-weight: 400; cursor: pointer; }
.theme-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); flex: none; }
.theme-sistema .theme-swatch { background: linear-gradient(135deg, #f6f4f0 50%, #171412 50%); }
.theme-claro .theme-swatch { background: #fff; }
.theme-oscuro .theme-swatch { background: #171412; }
.stats-sm .stat-num { font-size: 1.3rem; }
.form-actions .inline-form { margin: 0; }
.photo-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-file.disabled { opacity: .5; pointer-events: none; }

/* =====================================================
   v0.3 · Medición por huecos
   ===================================================== */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-head .section-title { margin: 24px 0 10px; }
details.hueco > summary { justify-content: flex-start; }
.hueco-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--border); }
.hueco-thumb-empty { display: grid; place-items: center; font-size: 1.4rem; opacity: .6; }
.hueco-sum { flex: 1; min-width: 0; }
details.hueco .chev { margin-left: auto; }
.hueco-body { padding: 14px 18px 18px; }
.hueco-fotos { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px dashed var(--border); }
.hueco-fotos .gallery-edit { margin: 0 0 10px; }
.hueco-form { padding: 0; }
.measures-2 { grid-template-columns: 1fr 1fr; }
.seg-radio { display: flex; width: 100%; margin: 0 0 14px; }
.seg-radio label { flex: 1; margin: 0; font-weight: 600; font-size: .9rem; text-align: center; cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: block; padding: 8px 6px; border-radius: 8px; color: var(--muted); }
.seg-radio input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.hint { font-size: .8rem; color: var(--muted); margin: -8px 0 14px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.confirm-box { background: var(--warn-soft); border-radius: 10px; padding: 12px; margin: 4px 0 14px; }
.confirm-box .check { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--warn); }
.confirm-box .check input { width: 20px; height: 20px; margin: 0; accent-color: var(--warn); }
.confirm-box input[name=dudas] { margin: 0; }
.huecos-head { margin-top: 18px; }
.huecos-head h3 { margin: 0; }

/* Ajustes separado del resto de opciones */
.sidebar .sidebar-bottom { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-bottom a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.sidebar-bottom a:hover { background: var(--bg); }
.sidebar-bottom a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar-bottom + .sidebar-foot { margin-top: 12px; }
.tabbar-sep { width: 1px; margin: 14px 0; background: var(--border); flex: none; }
.tabbar a.tab-ajustes { flex: 0 0 64px; }

/* Agenda · vista mensual */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-dow { text-align: center; font-size: .75rem; font-weight: 600; color: var(--muted); padding: 4px 0; }
.month-day { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 52px; padding: 6px 2px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; overflow: hidden; }
.month-day:hover { text-decoration: none; border-color: var(--primary); }
.month-day.out { opacity: .45; }
.month-day.today .month-num { background: var(--primary); color: #fff; }
.month-day.sel { border: 2px solid var(--primary); }
.month-num { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-weight: 600; font-size: .9rem; }
.month-dots { display: flex; gap: 3px; }
.month-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.month-dots i.est-realizada { background: var(--ok); }
.month-items { display: none; }
.month-sel { margin-top: 18px; }
.month-sel h3 { margin: 0; }
@media (min-width: 900px) {
  .month-day { align-items: stretch; min-height: 110px; padding: 6px; }
  .month-num { align-self: flex-end; }
  .month-dots { display: none; }
  .month-items { display: flex; flex-direction: column; gap: 3px; }
  .month-item { font-size: .75rem; padding: 2px 5px; border-radius: 5px; background: var(--primary-soft); border-left: 3px solid var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .month-item.est-realizada { background: var(--ok-soft); border-color: var(--ok); }
  .month-more { font-size: .72rem; color: var(--muted); padding-left: 4px; }
}

/* =====================================================
   v0.4 · Presupuestos
   ===================================================== */
.inline-form { display: inline-block; }
.head-actions .inline-form { margin: 0; }
.linea { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--surface); }
.linea.sin-precio { border-color: var(--warn); background: var(--warn-soft); }
.linea textarea { min-height: 54px; margin: 0 0 8px; }
.linea-nums { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; align-items: end; }
.linea-nums label { margin: 0; font-size: .8rem; }
.linea-nums input, .linea-nums select { margin-top: 3px; padding: 9px; }
.linea-importe { display: flex; flex-direction: column; align-items: flex-end; grid-column: 1 / 3; }
.linea-del { justify-self: end; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--danger); font-size: 1.2rem; cursor: pointer; }
@media (min-width: 700px) {
  .linea { display: grid; grid-template-columns: 1fr 380px; gap: 10px; align-items: start; }
  .linea textarea { margin: 0; }
  .linea-nums { grid-template-columns: 70px 80px 90px 1fr 36px; }
  .linea-importe { grid-column: auto; }
}
.add-linea { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.add-linea select { width: auto; flex: 1; min-width: 200px; margin: 0; }
.totales { margin: 16px 0 0 auto; max-width: 360px; border-top: 1px solid var(--border); padding-top: 8px; }
.totales > div { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; gap: 12px; }
.totales .pct { display: inline-block; width: 62px; margin: 0 2px; padding: 5px 7px; text-align: right; }
.totales .total { border-top: 2px solid var(--text); margin-top: 4px; padding-top: 10px; font-size: 1.2rem; }
.cat-head, .cat-row { display: grid; grid-template-columns: 2fr 1.2fr 80px 100px 50px; gap: 8px; align-items: center; }
.cat-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 0 0 6px; }
.cat-row { padding: 6px 0; border-top: 1px solid var(--border); }
.cat-row input, .cat-row select { margin: 0; padding: 9px; }
.cat-row .check { margin: 0; display: flex; justify-content: center; }
.cat-row .check input { width: 20px; height: 20px; accent-color: var(--primary); }
.cat-row.inactiva { opacity: .5; }
.cat-row.sin-precio input[name$="[precio]"] { border-color: var(--warn); background: var(--warn-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 699px) {
  .cat-head { display: none; }
  .cat-row { grid-template-columns: 1fr 1fr; padding: 10px 0; }
  .cat-row input:first-child { grid-column: 1 / -1; font-weight: 600; }
}
