/* ============ Tokens ============ */
:root {
  --paper: #ffffff;
  --paper-raised: #ffffff;
  --paper-sunken: #f0f0f0;
  --ink: #202020;
  --ink-soft: #4d4d4d;
  --ink-faint: #828282;
  --line: rgba(32, 32, 32, 0.15);
  --line-strong: rgba(32, 32, 32, 0.28);
  --accent: #816729;
  --accent-ink: #5e4b1c;
  --accent-tint: #efe9da;
  --accent-hover: #5e4b1c;
  --phase: #96547a;
  --phase-tint: #f3e6ec;
  --success: #3f6b3c;
  --success-tint: #e5ede1;
  --warning: #9c6b1f;
  --warning-tint: #f3e8d3;
  --critical: #a13a2e;
  --critical-tint: #f5e3df;
  --info: #3e5a82;
  --info-tint: #e3e9f0;
  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;
  --shadow-sm: 0 1px 2px rgba(32, 32, 32, 0.06);
  --shadow: 0 1px 2px rgba(32, 32, 32, 0.05), 0 12px 28px -16px rgba(32, 32, 32, 0.3);
  --font-display: "Geist", "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

/* Modo oscuro deshabilitado a propósito: la marca Sandra Wainberg Studio
   siempre se ve en blanco, sin importar el tema del sistema del visitante.
   El interruptor manual [data-theme="dark"] queda listo por si se reactiva. */
:root[data-theme="dark"] {
  --paper: #161616;
  --paper-raised: #1d1d1d;
  --paper-sunken: #0f0f0f;
  --ink: #ededed;
  --ink-soft: #ababab;
  --ink-faint: #767676;
  --line: rgba(237, 237, 237, 0.14);
  --line-strong: rgba(237, 237, 237, 0.26);
  --accent: #c9a24d;
  --accent-ink: #e0bc72;
  --accent-tint: #332a18;
  --accent-hover: #e0bc72;
  --phase: #d998b3;
  --phase-tint: #3a2430;
  --success: #7fae79;
  --success-tint: #1e2a1c;
  --warning: #d6a64c;
  --warning-tint: #332711;
  --critical: #de8776;
  --critical-tint: #3a211c;
  --info: #8faad1;
  --info-tint: #1f2733;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 28px -16px rgba(0, 0, 0, 0.6);
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; margin: 0; text-wrap: balance; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--accent-tint); color: var(--accent-ink); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

#app { min-height: 100vh; }

/* ============ Gate (role select) ============ */
.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: var(--paper);
  position: relative;
  overflow: hidden;
}
.gate::before {
  content: "";
  position: absolute;
  top: 50%; right: -12%;
  width: 900px; height: 900px;
  max-width: 90vw;
  background: url('/brand-mark.png') no-repeat center / contain;
  opacity: .04;
  transform: translateY(-48%) rotate(-8deg);
  pointer-events: none;
}
.gate > * { position: relative; z-index: 1; animation: gate-rise .5s ease both; }
.gate-mark { animation-delay: 0s; }
.gate-title { animation-delay: .06s; }
.gate-sub { animation-delay: .12s; }
.gate-cards { animation-delay: .18s; }
.gate-foot { animation-delay: .24s; }
@keyframes gate-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.gate-mark {
  display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 48px;
}
.gate-mark .brand-logo-big { width: 260px; max-width: 70vw; height: auto; display: block; }
.gate-mark small { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 600; letter-spacing: 0.14em; display: block; text-align: center; }
.gate-title { font-size: clamp(32px, 5.2vw, 52px); font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; text-align: center; max-width: 680px; margin-bottom: 18px; }
.gate-sub { color: var(--ink-soft); font-size: 16px; line-height: 1.6; text-align: center; max-width: 500px; margin-bottom: 52px; }
.gate-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 720px; }
@media (max-width: 640px) { .gate-cards { grid-template-columns: 1fr; } }
.gate-card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px 28px; text-align: left; cursor: pointer; transition: border-color .15s, background .15s;
}
.gate-card:hover { border-color: var(--accent); background: var(--accent-tint); }
.gate-card .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; font-weight: 600; }
.gate-card h3 { font-size: 23px; margin: 14px 0 10px; }
.gate-card p { color: var(--ink-soft); font-size: 14px; line-height: 1.55; flex: 1; margin-bottom: 18px; }
.gate-card .arrow { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.gate-card:hover .arrow { color: var(--accent-ink); }
.gate-foot { margin-top: 48px; font-size: 12px; color: var(--ink-faint); text-align: center; }

/* ============ Login ============ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--paper); }
.login-card { width: 100%; max-width: 380px; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; }
.login-back { font-size: 13px; color: var(--ink-faint); cursor: pointer; margin-bottom: 18px; display: inline-block; }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }
.login-hint { margin-top: 18px; padding: 12px 14px; background: var(--accent-tint); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--accent-ink); font-family: var(--font-mono); line-height: 1.6; }

/* ============ Form fields ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.field .hint { font-size: 11.5px; color: var(--ink-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
.input, .select, .textarea {
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 14.5px; width: 100%; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.textarea { resize: vertical; min-height: 70px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.file-drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 18px; text-align: center;
  font-size: 13px; color: var(--ink-soft); cursor: pointer; background: var(--paper);
}
.file-drop:hover { border-color: var(--accent); }
.file-preview-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.file-preview-row img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.form-error { background: var(--critical-tint); color: var(--critical); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); border: 1px solid transparent; padding: 10px 16px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover:not(:disabled) { opacity: .82; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--paper-sunken); }
.btn-danger { background: transparent; border-color: var(--critical); color: var(--critical); }
.btn-danger:hover:not(:disabled) { background: var(--critical-tint); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.icon-btn { background: transparent; border: none; color: var(--ink-faint); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--paper-sunken); color: var(--ink); }

/* ============ App shell (despacho) ============ */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } }
.sidebar {
  background: var(--paper-raised); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
@media (max-width: 900px) { .sidebar { display: none; } }
.sidebar-mark { padding: 6px 8px 22px; }
.sidebar-mark .brand-logo-sidebar { width: 168px; max-width: 100%; height: auto; display: block; }
.nav-section { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--paper-sunken); color: var(--ink); }
.nav-item.active { background: transparent; color: var(--ink); font-weight: 600; border-left: 2px solid var(--accent); padding-left: 8px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; }
.user-chip:hover { background: var(--paper-sunken); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12.5px; flex: none; font-family: var(--font-display); }
.user-chip .who { display: flex; flex-direction: column; overflow: hidden; }
.user-chip .who b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { font-size: 11px; color: var(--ink-faint); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; gap: 14px;
}
.topbar h1 { font-size: 21px; }
.topbar .crumb { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .mobile-nav { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px 10px; border-bottom: 1px solid var(--line); background: var(--paper-raised); }
  .mobile-nav a { font-size: 12.5px; padding: 7px 12px; border-radius: 999px; white-space: nowrap; color: var(--ink-soft); text-decoration: none; }
  .mobile-nav a.active { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
}
.content { padding: 24px; max-width: 1280px; }
@media (max-width: 640px) { .content { padding: 16px; } }

/* ============ Cards / KPIs ============ */
.card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 20px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.kpi .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); font-weight: 600; }
.kpi .value { font-family: var(--font-display); font-size: 27px; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .value.critical { color: var(--critical); }
.kpi .foot { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { font-size: 17px; }
.section-title .see-all { font-size: 12.5px; color: var(--accent); cursor: pointer; }

/* ============ Alerts ============ */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper-raised); cursor: pointer; text-decoration: none; color: inherit; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.alert-dot.critical { background: var(--critical); }
.alert-dot.warning { background: var(--warning); }
.alert-dot.info { background: var(--info); }
.alert-row .msg { font-size: 13.5px; }
.alert-row .type { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; color: var(--ink-faint); letter-spacing: 0.05em; margin-top: 2px; }

/* ============ Project cards ============ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { display: block; text-decoration: none; color: inherit; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: border-color .12s; }
.project-card:hover { border-color: var(--line-strong); }
.project-cover { height: 110px; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background-size: cover; background-position: center; }
.project-cover.blueprint {
  background-color: var(--cover-c1, var(--accent));
}
.project-cover .code { position: absolute; top: 10px; left: 12px; font-family: var(--font-mono); font-size: 10.5px; color: rgba(255,255,255,.92); letter-spacing: 0.06em; background: rgba(15,17,20,.4); padding: 2px 7px; border-radius: 4px; }
.project-body { padding: 16px; }
.project-body h3 { font-size: 16px; margin-bottom: 3px; }
.project-body .client { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-sm); letter-spacing: 0.02em; }
.pill-Diseño, .pill-diseno { background: var(--info-tint); color: var(--info); }
.pill-Permisos { background: var(--warning-tint); color: var(--warning); }
.pill-Construcción, .pill-construccion { background: var(--accent-tint); color: var(--accent-ink); }
.pill-Acabados { background: var(--phase-tint); color: var(--phase); }
.pill-Entregado { background: var(--success-tint); color: var(--success); }
.progress-track { height: 3px; background: var(--paper-sunken); border-radius: var(--radius-sm); overflow: hidden; margin: 10px 0 8px; }
.progress-fill { height: 100%; background: var(--ink); border-radius: var(--radius-sm); }
.progress-fill.over { background: var(--critical); }
.project-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); }
.project-meta b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-faint); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-color: var(--accent); }

/* ============ Timeline / Bitácora ============ */
.timeline { position: relative; }
.tl-item { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding-bottom: 24px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 96px; top: 22px; bottom: -2px; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); padding-top: 3px; text-align: right; }
.tl-dot { position: absolute; left: 91px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--paper-raised); box-shadow: 0 0 0 1px var(--line); }
.tl-body { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tl-body .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.tl-body .pct { font-family: var(--font-mono); font-weight: 700; color: var(--accent); font-size: 13px; }
.tl-body p { font-size: 13.5px; color: var(--ink-soft); }
.tl-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 10px; }
.tl-photos img { width: 100%; height: 84px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: zoom-in; }
.tl-author { font-size: 11px; color: var(--ink-faint); margin-top: 8px; }
.tl-internal-tag { font-family: var(--font-mono); font-size: 10px; color: var(--warning); border: 1px solid var(--warning); padding: 1px 6px; border-radius: 4px; }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper-raised); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

/* ============ Gallery ============ */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery-grid figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; position: relative; background: var(--paper-sunken); }
.gallery-grid img { width: 100%; height: 130px; object-fit: cover; display: block; }
.gallery-grid figcaption { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px; font-size: 10.5px; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; }

/* ============ Folder grid (Documentos) ============ */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 20px; }
.folder-grid .provider-card { margin-bottom: 0; flex-direction: column; align-items: flex-start; gap: 6px; }
.folder-grid .provider-card:hover { border-color: var(--line-strong); }

/* ============ Provider list ============ */
.provider-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.provider-card h4 { font-size: 14.5px; margin-bottom: 3px; }
.provider-card .meta { font-size: 12.5px; color: var(--ink-soft); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.provider-card .cat { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; color: var(--accent); letter-spacing: 0.04em; }

/* ============ Drawer ============ */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 14, 0.4); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .15s; }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw; background: var(--paper-raised);
  z-index: 91; transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.18);
}
.drawer.open { transform: translateX(0); }
@media (max-width: 640px) {
  .drawer { width: 100%; top: auto; height: 90vh; border-radius: 6px 6px 0 0; transform: translateY(105%); }
  .drawer.open { transform: translateY(0); }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 17px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }

/* ============ Toast ============ */
#toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); font-size: 13px; box-shadow: var(--shadow); animation: toast-in .18s ease; }
.toast.error { background: var(--critical); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ============ Install banner (PWA) ============ */
.install-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 150; max-width: 420px; margin: 0 auto;
  background: var(--ink); color: var(--paper); border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; justify-content: space-between; box-shadow: var(--shadow);
}
.install-banner span { font-size: 13px; line-height: 1.4; }
.install-banner .icon-btn { color: var(--paper); }
.install-banner .icon-btn:hover { background: rgba(255,255,255,.12); }

/* ============ FAB ============ */
.fab { position: fixed; right: 18px; bottom: 22px; z-index: 40; width: 54px; height: 54px; border-radius: 50%; background: var(--ink); color: var(--paper); border: none; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.fab svg { width: 24px; height: 24px; }
@media (min-width: 901px) { .fab { display: none; } }

/* ============ Empty state ============ */
.empty { text-align: center; padding: 50px 20px; color: var(--ink-faint); }
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .5; }
.empty p { font-size: 13.5px; }

/* ============ Calendar ============ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; color: var(--ink-faint); text-align: center; padding-bottom: 6px; }
.cal-cell { min-height: 84px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; background: var(--paper-raised); }
.cal-cell.out { opacity: 0.35; }
.cal-cell .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.cal-event { font-size: 10.5px; background: var(--accent-tint); color: var(--accent-ink); padding: 2px 5px; border-radius: 4px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-event.done { background: var(--success-tint); color: var(--success); text-decoration: line-through; }
.agenda-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.agenda-item .d { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); width: 84px; flex: none; }
.agenda-item .chk { width: 18px; height: 18px; accent-color: var(--success); }

/* ============ Chat ============ */
.chat-wrap { display: flex; flex-direction: column; height: 560px; max-height: 70vh; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 78%; }
.chat-msg .bubble { padding: 9px 13px; border-radius: var(--radius-lg); font-size: 13.5px; background: var(--paper-sunken); }
.chat-msg.me { align-self: flex-end; }
.chat-msg.me .bubble { background: var(--ink); color: var(--paper); }
.chat-msg .meta { font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; }
.chat-msg.me .meta { text-align: right; }
.chat-msg img.att { max-width: 220px; border-radius: var(--radius); margin-top: 4px; display: block; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input[type=text] { flex: 1; background: var(--paper); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; }

/* ============ Portal (client) ============ */
.portal-shell { max-width: 880px; margin: 0 auto; padding: 0 20px 80px; }
.portal-top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.portal-hero { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: var(--paper-raised); margin-bottom: 24px; }
.portal-hero .img { height: 260px; background-size: cover; background-position: center; position: relative; }
@media (max-width: 640px) { .portal-hero .img { height: 180px; } }
.portal-hero .img .fade { position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(10,12,14,.75)); }
.portal-hero .img .label { position: absolute; bottom: 16px; left: 20px; color: #fff; }
.portal-hero .img .label .code { font-family: var(--font-mono); font-size: 11px; opacity: .85; letter-spacing: .06em; }
.portal-hero .img .label h2 { font-size: 24px; color: #fff; }
.portal-progress { padding: 22px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.ring-wrap { position: relative; width: 108px; height: 108px; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label b { font-family: var(--font-display); font-size: 24px; }
.ring-label span { font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.portal-progress .info h3 { font-size: 15px; margin-bottom: 4px; }
.portal-progress .info p { color: var(--ink-soft); font-size: 13px; }

.portal-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 780px) { .portal-grid { grid-template-columns: 1fr; } }
.portal-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; }
.portal-card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.budget-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.budget-row b { font-family: var(--font-mono); }
.milestone-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.milestone-row:last-child { border-bottom: none; }
.milestone-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line-strong); }
.milestone-row.done .dot { background: var(--success); }
.milestone-row .date { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); }
.update-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.update-item:last-child { border-bottom: none; }
.update-item h4 { font-size: 13.5px; margin-bottom: 3px; }
.update-item p { font-size: 13px; color: var(--ink-soft); }
.update-item .date { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); margin-top: 4px; }

/* ============ Lightbox ============ */
.lightbox { position: fixed; inset: 0; background: rgba(8,9,11,.92); z-index: 250; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 6px; }
.lightbox .close { position: absolute; top: 18px; right: 20px; color: #fff; background: rgba(255,255,255,.12); border: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 18px; }

/* ============ Reporte imprimible ============ */
.report-toolbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; background: var(--paper-raised); border-bottom: 1px solid var(--line);
}
.report-page {
  max-width: 760px; margin: 0 auto; padding: 40px 32px 80px; background: var(--paper-raised);
  min-height: 100vh; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.report-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.report-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; margin: 8px 0 28px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.report-kpis .label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.report-kpis b { font-family: var(--font-mono); font-size: 14px; }
.report-page h2 { font-size: 15px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.report-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-entry { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.report-entry p { margin-top: 4px; color: var(--ink-soft); }
.report-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.report-photos img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; }
@media print {
  .no-print, .sidebar, .topbar, .mobile-nav, #toast-host { display: none !important; }
  body, .report-page { background: #fff !important; color: #000 !important; }
  .report-page { box-shadow: none; max-width: none; padding: 0; }
  .report-toolbar { display: none !important; }
  a { color: inherit !important; text-decoration: none !important; }
  @page { margin: 16mm; }
}

/* ============ Misc utility ============ */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.center-y { align-items: center; }
.spacer { flex: 1; }
.text-soft { color: var(--ink-soft); }
.text-faint { color: var(--ink-faint); }
.mt-0 { margin-top: 0; }
