/* ==========================================================================
   Panel del despacho (/admin y /admin/login)
   ========================================================================== */
:root {
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --bg: #f6f2ec;
  --surface: #fff;
  --surface-2: #f1ebe2;
  --ink: #231d18;
  --ink-2: #4a4037;
  --muted: #7a6d62;
  --line: #e7ddd0;
  --navy: #2b2420;
  --navy-2: #3a302a;
  --emerald: #b4532f;
  --emerald-2: #c4643f;
  --emerald-ink: #8f3d1f;
  --emerald-soft: #f6e3d8;
  --mint: #f2c48d;
  --gold: #3f6b52;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --info: #2563eb;
  --info-soft: #e8efff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 36, 32, 0.05), 0 8px 24px -10px rgba(43, 36, 32, 0.16);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --top-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #14110e;
  --surface: #1d1914;
  --surface-2: #18140f;
  --ink: #f2ebe1;
  --ink-2: #cfc3b5;
  --muted: #a09283;
  --line: #322a22;
  --navy: #110e0b;
  --navy-2: #1b1612;
  --emerald: #df7a51;
  --emerald-2: #e88f6a;
  --emerald-ink: #f2c48d;
  --emerald-soft: rgba(242, 196, 141, 0.14);
  --danger-soft: rgba(192, 57, 43, 0.16);
  --warn-soft: rgba(183, 121, 31, 0.18);
  --info-soft: rgba(37, 99, 235, 0.16);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink-2); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.4em; font-weight: 750; }
h1 em, h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--emerald-ink); }
a { color: var(--emerald-ink); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--emerald-2); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.icon { flex: none; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
@media (min-width: 641px) { .show-sm { display: none !important; } }

/* ---------- Botones ---------- */
.pbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.pbtn:hover { border-color: var(--emerald); transform: translateY(-1px); }
.pbtn:active { transform: none; }
.pbtn .icon { width: 16px; height: 16px; }
.pbtn--primary { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.pbtn--primary:hover { background: var(--emerald-2); border-color: var(--emerald-2); box-shadow: 0 10px 22px -12px rgba(52, 67, 232, 0.8); }
.pbtn--ghost { background: transparent; }
.pbtn--danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.pbtn--danger-ghost:hover { border-color: var(--danger); }
.pbtn--sm { min-height: 36px; padding: 6px 12px; font-size: 0.86rem; }
.pbtn--lg { min-height: 50px; font-size: 1rem; }
.pbtn--block { width: 100%; }
.pbtn[aria-busy="true"] { opacity: 0.65; pointer-events: none; }
.picon { width: 40px; height: 40px; flex: none; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; font-size: 1rem; transition: border-color 0.2s, color 0.2s; }
.picon:hover { border-color: var(--emerald); color: var(--emerald-ink); }
.picon--danger:hover { border-color: var(--danger); color: var(--danger); }
.picon:disabled { opacity: 0.35; cursor: default; }
.picon .icon { width: 18px; height: 18px; }

/* ---------- Barra superior ---------- */
.app-top {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.app-brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); text-decoration: none; }
.app-logo { width: 38px; height: 38px; flex: none; }
.app-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.app-brand-text strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-brand-text small { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.app-top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.app-user { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-2), var(--emerald)); color: #fff; font-weight: 800; font-size: 0.82rem; }
@media (max-width: 640px) {
  .app-top { padding: 0 12px; --top-h: 60px; height: 60px; }
  .app-logo { width: 34px; height: 34px; }
  .app-brand-text small { display: none; }
  .app-user { display: none; }
}

/* ---------- Estructura ---------- */
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.app-nav {
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  background: var(--navy);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
}
.app-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.app-nav a[data-nav] {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #d8cbbd;
  font-weight: 650;
  font-size: 0.93rem;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.app-nav a[data-nav]:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.app-nav a[data-nav].is-active { background: rgba(242, 196, 141, 0.14); color: #fff; }
.app-nav a[data-nav].is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--mint); }
.app-nav a[data-nav].is-active .icon { color: var(--mint); }
.app-nav .badge-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--mint); color: #2b2420; font-size: 0.74rem; font-weight: 800; display: grid; place-items: center; }
.app-nav-wp { margin-top: auto; padding: 12px; color: #b3a393; font-size: 0.85rem; text-decoration: none; }
.app-nav-wp:hover { color: #fff; }
.app-main { padding: 28px clamp(16px, 3vw, 40px) 80px; min-width: 0; outline: none; }
.app-main.is-entering > * { animation: rise 0.45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .app-nav { position: sticky; top: var(--top-h); z-index: 40; height: auto; padding: 8px 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav ul { display: flex; gap: 6px; width: max-content; }
  .app-nav a[data-nav] { padding: 8px 12px; font-size: 0.86rem; white-space: nowrap; gap: 8px; }
  .app-nav a[data-nav].is-active::before { display: none; }
  .app-nav a[data-nav].is-active { background: var(--emerald); }
  .app-nav a[data-nav].is-active .icon { color: #fff; }
  .app-main { padding: 20px 16px 80px; }
}
@media (max-width: 640px) { .app-nav { top: 60px; } }

/* ---------- Encabezado de sección ---------- */
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.view-head p { margin: 4px 0 0; color: var(--muted); }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tarjetas y listas ---------- */
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.pcard + .pcard { margin-top: 16px; }
.pcard h2 { font-size: 1.08rem; }
.pcard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.pcard-head h2 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi strong { display: block; font-size: 1.9rem; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-weight: 600; font-size: 0.86rem; }
.kpi.is-accent { background: var(--navy); border-color: var(--navy); }
.kpi.is-accent strong { color: #fff; }
.kpi.is-accent span { color: #c9b8a6; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cols-2 { grid-template-columns: 1fr; } }

.plist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.prow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.prow:hover { border-color: color-mix(in srgb, var(--emerald) 40%, var(--line)); }
.prow-main { flex: 1; min-width: 0; }
.prow-title { display: block; font-weight: 750; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-sub { display: block; color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.thumb { width: 56px; height: 56px; border-radius: 10px; flex: none; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.prow.is-moving { animation: moved 0.6s var(--ease); }
@keyframes moved { from { background: var(--emerald-soft); } }
.empty { text-align: center; padding: 40px 20px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
@media (max-width: 640px) {
  .prow { flex-wrap: wrap; }
  .prow-actions { width: 100%; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
  .thumb { width: 46px; height: 46px; }
}

/* Citas */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 0.84rem; cursor: pointer; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--emerald); border-color: var(--emerald); }
.apt-date { width: 58px; flex: none; text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); line-height: 1; }
.apt-date small { display: block; padding: 4px 0; background: var(--navy); color: #fff; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.apt-date strong { display: block; padding: 6px 0 2px; font-size: 1.35rem; color: var(--ink); }
.apt-date span { display: block; padding-bottom: 6px; font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--confirmada { background: var(--emerald-soft); color: var(--emerald-ink); }
.status--pendiente { background: var(--warn-soft); color: var(--warn); }
.status--reprogramada { background: var(--info-soft); color: var(--info); }
.status--concluida { background: var(--surface-2); color: var(--muted); }
.status--cancelada { background: var(--danger-soft); color: var(--danger); }
.status-select { min-height: 36px; padding: 4px 30px 4px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 0.85rem; }

/* ---------- Formularios ---------- */
.pform { display: grid; gap: 16px; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.pgrid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .pgrid { grid-template-columns: 1fr; } }
.pfield { display: grid; gap: 6px; }
.pfield > span:first-child { font-weight: 700; font-size: 0.86rem; color: var(--ink); }
.pfield small { color: var(--muted); font-size: 0.8rem; }
.pfield input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .pfield select, .pfield textarea, .search {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.97rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pfield textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.pfield input:focus, .pfield select:focus, .pfield textarea:focus, .search:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 4px color-mix(in srgb, var(--emerald) 16%, transparent); }
.section-title { grid-column: 1 / -1; margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 650; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; flex: none; border-radius: 999px; background: var(--line); position: relative; transition: background-color 0.25s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.3s var(--ease); }
.switch input:checked + .track { background: var(--emerald); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2.5px solid var(--emerald-2); outline-offset: 2px; }

.photo-field { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px; border: 1.5px dashed var(--line); border-radius: 12px; }
.photo-field .preview { width: 120px; height: 90px; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; text-align: center; flex: none; }
.photo-field .preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-field .photo-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.photo-field input[type="file"], .gallery-field input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sticky-save { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0; margin-top: 8px; background: linear-gradient(transparent, var(--bg) 35%); }

/* ---------- Ventana (modal) ---------- */
.modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink-2); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.45); }
.modal::backdrop { background: rgba(8, 17, 31, 0.55); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in 0.4s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 640px) {
  .modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .modal-inner { height: 100dvh; max-height: 100dvh; }
  .modal-body { flex: 1; }
  .modal-foot { flex-wrap: wrap; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 300;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.45s var(--ease);
}
.toast.is-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- Acceso (/admin/login) ---------- */
.login-body { min-height: 100vh; background: var(--bg); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { position: relative; overflow: hidden; background: linear-gradient(140deg, #1a1511, #2b2420 55%, #3a2418); color: #c9b8a6; display: flex; align-items: center; padding: 48px; }
.login-side::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 36px 36px; mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 70%); }
.login-side::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(208, 242, 90, 0.3), transparent 65%); }
.login-side-inner { position: relative; z-index: 1; max-width: 440px; }
.login-mark { width: 56px; height: 56px; margin-bottom: 28px; }
.login-side h2 { color: #fff; font-size: clamp(2rem, 3.5vw, 3rem); letter-spacing: -0.03em; }
.login-side h2 em { color: var(--mint); }
.login-side p { font-size: 1.05rem; }
.login-side ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.login-side li { display: flex; gap: 10px; align-items: center; color: #f1e6d8; font-weight: 600; }
.login-side li::before { content: "✓"; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(208, 242, 90, 0.2); color: var(--mint); font-size: 0.75rem; font-weight: 900; }
.login-card { display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 440px; margin: 0 auto; padding: 48px 24px; }
.login-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 36px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: 0.02em; }
.login-logo { width: 40px; height: 40px; }
.login-card h1 { font-size: 2rem; }
.login-card form { display: grid; gap: 16px; margin-top: 24px; }
.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-right: 76px !important; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--surface-2); color: var(--ink-2); border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 0.82rem; cursor: pointer; }
.login-alert { padding: 12px 14px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 650; font-size: 0.92rem; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; font-size: 0.9rem; }
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   v1.6 — Aspecto más formal: tablas con bordes en cada celda, menú por
   grupos, esquinas más rectas y títulos de tarjeta en versalitas.
   ========================================================================== */
:root {
  --radius: 10px;
  --grid: #e7ddd0;
  --th-bg: #f6f0e8;
  --th-ink: #2b2420;
  --zebra: #fcfaf6;
  --row-hover: #f8ece4;
}
:root[data-theme="dark"] {
  --grid: #322a22;
  --th-bg: #18140f;
  --th-ink: #c9b8a6;
  --zebra: rgba(255, 255, 255, 0.015);
  --row-hover: rgba(223, 122, 81, 0.08);
}

/* Botones y filtros: menos redondos */
.pbtn, .picon, .status-select, .pfield input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .pfield select, .pfield textarea, .search { border-radius: 8px; }
.chip { border-radius: 8px; }

/* Menú lateral por grupos */
.app-nav-group { padding: 18px 12px 6px; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: #a08a76; }
.app-nav-group:first-child { padding-top: 4px; }
@media (max-width: 900px) { .app-nav-group { display: none; } }

/* Encabezado de cada sección con línea inferior */
.view-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.view-head h1 { font-weight: 750; letter-spacing: -0.025em; }

/* Indicadores */
.kpi { border-radius: var(--radius); box-shadow: none; }
.kpi span { display: block; margin-top: 4px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }

/* Tarjetas: título en versalitas con línea */
.pcard { border-radius: var(--radius); box-shadow: none; }
.pcard-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.pcard-head h2 { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.pcard-head a { font-size: 0.82rem; font-weight: 700; }
.pcard .ptable-wrap { box-shadow: none; }
.prow { border-radius: 8px; }

/* Tablas */
.table-count { margin: 0 0 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ptable-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--grid); border-radius: var(--radius); box-shadow: var(--shadow); }
.ptable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ptable th {
  padding: 11px 14px;
  border: 1px solid var(--grid);
  border-top: 0;
  background: var(--th-bg);
  color: var(--th-ink);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.ptable td { padding: 12px 14px; border: 1px solid var(--grid); vertical-align: middle; color: var(--ink-2); background: var(--surface); transition: background-color 0.15s; }
.ptable tr > :first-child { border-left: 0; }
.ptable tr > :last-child { border-right: 0; }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable tbody tr:nth-child(even) td { background: var(--zebra); }
.ptable tbody tr:hover td { background: var(--row-hover); }
.ptable tr.is-moving td { animation: moved 0.6s var(--ease); }
.ptable .c-num { width: 1%; text-align: center; }
.ptable .c-thumb { width: 1%; }
.ptable .c-fit, .ptable .c-nowrap, .ptable .c-date, .ptable .c-folio { white-space: nowrap; }
.ptable .c-fit, .ptable .c-actions { width: 1%; }
.ptable .c-actions { text-align: right; white-space: nowrap; }
.ptable .thumb { width: 52px; height: 40px; border-radius: 6px; }
.ptable .thumb .icon { width: 18px; height: 18px; }
.row-n { font-weight: 800; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell-strong { display: block; color: var(--ink); font-weight: 750; line-height: 1.35; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.cell-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 52ch; color: var(--muted); font-size: 0.86rem; }
.cell-actions { display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center; }
.cell-actions .picon { width: 34px; height: 34px; }
.cell-actions .picon .icon { width: 16px; height: 16px; }
.folio { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.8rem; font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.tag { display: inline-block; padding: 3px 9px; border: 1px solid var(--grid); border-radius: 6px; background: var(--surface); color: var(--ink-2); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.status { border-radius: 6px; }

/* Estado de la cita con su color */
.status-select { min-height: 34px; font-size: 0.82rem; }
.status-select--confirmada { background: var(--emerald-soft); border-color: color-mix(in srgb, var(--emerald) 35%, var(--line)); color: var(--emerald-ink); }
.status-select--pendiente { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); color: var(--warn); }
.status-select--reprogramada { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, var(--line)); color: var(--info); }
.status-select--cancelada { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.status-select--concluida { background: var(--surface-2); color: var(--muted); }

/* En celular cada fila es una ficha con el título de cada dato */
@media (max-width: 760px) {
  .ptable-wrap { overflow: visible; background: none; border: 0; border-radius: 0; box-shadow: none; }
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100% !important; }
  .ptable tr { margin-bottom: 12px; overflow: hidden; border: 1px solid var(--grid); border-radius: var(--radius); background: var(--surface); }
  .ptable td, .ptable tbody tr:nth-child(even) td, .ptable tbody tr:hover td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--grid); background: none; text-align: left; white-space: normal; }
  .ptable td:last-child { border-bottom: 0; }
  .ptable td::before { content: attr(data-label); font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .ptable td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  .ptable td[data-label=""]::before { display: none; }
  .ptable td.c-num, .ptable tbody tr:nth-child(even) td.c-num { display: none; }
  .ptable td.c-actions { text-align: left; }
  .ptable .c-actions .cell-actions { justify-content: flex-start; }
  .cell-clamp { max-width: none; }
}
/* MORADA: estados de visita y galería de propiedades */
.status--realizada, .status-select--realizada { background: var(--surface-2); color: var(--ink-2); }
.status--no_asistio, .status-select--no_asistio { background: var(--warn-soft); color: var(--warn); }
.status--preventa { background: var(--info-soft); color: var(--info); }
.gallery-field { display: grid; gap: 10px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.gallery-empty { margin: 0; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; }
.gthumb { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.gthumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gthumb-main { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--emerald); color: #fff; font-size: 0.68rem; font-weight: 800; }
.gthumb-actions { display: flex; justify-content: space-between; gap: 4px; padding: 4px; }
.gthumb-actions .picon { width: 30px; height: 30px; }
