/* Cedar — estilos base. Los colores de marca vienen de /brand.css (--brand, --brand-accent). */
:root {
  --brand: #1d4ed8;
  --brand-accent: #0ea5e9;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --sidebar-w: 240px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 2px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.strong { font-weight: 600; }
.pre { white-space: pre-line; }
.d-block { display: block; }
.right { margin-left: auto; }
.pad { padding: 16px; }
.text-brand { color: var(--brand); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning); }
.w-sm { width: 80px !important; }
.w-md { width: 130px !important; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 800; font-size: 18px; color: var(--brand); }
.brand:hover { text-decoration: none; }
.brand img { max-height: 52px; max-width: 100%; object-fit: contain; object-position: left center; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; }
.brand-mark.lg { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark.lg .icon { width: 30px; height: 30px; }
.sidebar nav { display: flex; flex-direction: column; padding: 6px 12px; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #334155; font-weight: 500; }
.sidebar nav a:hover { background: #f1f5f9; text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 16px 20px; font-size: 11px; color: var(--muted); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.search { flex: 1; max-width: 520px; }
.search input { width: 100%; background: #f1f5f9; border-color: transparent; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-right form { margin: 0; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: #334155; cursor: pointer; }
.icon-btn:hover { background: #f1f5f9; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text); padding: 4px 8px; border-radius: 12px; }
.user-chip:hover { background: #f1f5f9; text-decoration: none; }
.user-chip small { display: block; color: var(--muted); font-size: 11px; line-height: 1.1; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.bottom-nav { display: none; }
.only-mobile { display: none; }

/* Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .card-title { margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2 > .card, .stack > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; font-family: inherit; white-space: nowrap; line-height: 1.2;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--border); }
.btn-outline:hover { border-color: var(--brand); filter: none; }
.btn-ghost { background: transparent; color: #334155; border-color: transparent; }
.btn-ghost:hover { background: #f1f5f9; filter: none; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 40px; }
input[type=file] { padding: 7px; background: #f8fafc; }
textarea { resize: vertical; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; color: #334155; margin-bottom: 12px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: 1 / -1; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.section-title:first-of-type { border-top: 0; padding-top: 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
fieldset.checks { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
fieldset.checks legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
fieldset.checks label { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.inline-form > select, .inline-form > input { flex: 1; min-width: 180px; }
.inline-form textarea { flex: 1 1 100%; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; flex: 1; min-width: 150px; }
.filters.card { padding: 12px; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-item { display: block; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; background: #f8fafc; border-left: 3px solid var(--border); color: var(--text); }
.alert-item:hover { text-decoration: none; filter: brightness(.98); }
.alert-item.warning { background: #fffbeb; border-left-color: var(--warning); }
.alert-item.info { background: #eff6ff; border-left-color: var(--info); }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; background: #e2e8f0; }
.badge-danger { background: var(--danger); color: #fff; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; white-space: nowrap; vertical-align: middle; }
.ps-activo, .tr-completado, .st-completada { background: #dcfce7; color: #166534; }
.ps-prospecto, .st-pendiente, .tr-planificado { background: #fef3c7; color: #92400e; }
.ps-inactivo, .tr-cancelado, .st-cancelada { background: #f1f5f9; color: #64748b; }
.st-confirmada, .tr-en_proceso { background: #dbeafe; color: #1e40af; }
.st-no_asistio { background: #fee2e2; color: #991b1b; }
.doc-receta { background: #ede9fe; color: #5b21b6; }
.doc-cotizacion { background: #e0f2fe; color: #075985; }
.doc-indicaciones { background: #dcfce7; color: #166534; }
.st-text-pendiente { color: var(--warning); } .st-text-confirmada { color: var(--brand); } .st-text-completada { color: var(--success); }
.st-text-cancelada { color: var(--muted); } .st-text-no_asistio { color: var(--danger); }
.pill-select { width: auto; padding: 3px 26px 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 0; }
.status-form { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat.mini .stat-value { font-size: 20px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .empty { text-align: center; color: var(--muted); padding: 24px; }
.row-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list li form { margin: 0; }
.list .time { font-weight: 700; color: var(--brand); min-width: 48px; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0 0 16px; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.timeline li { padding: 10px 12px; border-left: 3px solid var(--brand); background: #f8fafc; border-radius: 0 10px 10px 0; margin-bottom: 8px; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { padding: 6px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.pager a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 6px 12px; border-radius: 8px; color: #334155; font-weight: 500; font-size: 13px; }
.seg a.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; }
details.collapsible > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
details.collapsible[open] > summary { margin-bottom: 14px; }
details > summary::-webkit-details-marker { display: none; }
.field-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.field-item > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; list-style: none; }
.field-item[open] > summary { margin-bottom: 12px; }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown-panel { position: absolute; right: 0; top: 100%; z-index: 10; width: 300px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .15); }

/* Patient */
.patient-header { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.patient-info { flex: 1; min-width: 220px; }
.patient-info h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.patient-info p { margin: 2px 0; }
.allergy { color: var(--danger); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.patient-money { display: flex; gap: 20px; }
.patient-money div { display: flex; flex-direction: column; }
.patient-money small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.patient-money strong { font-size: 17px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Odontogram */
.odonto-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.odonto-layout > .card { margin-bottom: 18px; }
.odonto-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.odonto-head .card-title { margin: 0; }
.odontogram { overflow-x: auto; padding: 8px 0; }
.arch-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; margin: 10px 0 4px; font-weight: 700; }
.arch { display: flex; justify-content: center; gap: 12px; min-width: max-content; }
.quadrant { display: flex; gap: 4px; }
.quadrant:first-child { padding-right: 12px; border-right: 2px dashed var(--border); }
.tooth { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tooth-num { border: 0; background: none; font-size: 11px; font-weight: 700; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; font-family: inherit; }
.tooth-num:hover, .tooth.selected .tooth-num { background: var(--brand); color: #fff; }
.tooth-svg { width: clamp(26px, calc((100vw - 760px) / 17), 42px); height: auto; aspect-ratio: 1; overflow: visible; }
.surf { fill: #fff; stroke: #94a3b8; stroke-width: 1.2; cursor: pointer; transition: fill .1s; }
.surf:hover { fill: #e0e7ff; }
.surf.picked { stroke: var(--brand); stroke-width: 2.5; }
.c-caries { fill: #ef4444 !important; }
.c-obturado { fill: #3b82f6 !important; }
.c-sellante { fill: #22c55e !important; }
.c-endodoncia { fill: #a855f7 !important; }
.c-corona { fill: #f59e0b !important; }
.c-implante { fill: #64748b !important; }
.c-extraccion { fill: #fecaca !important; }
.c-ausente { fill: #cbd5e1 !important; }
.c-fractura { fill: #f97316 !important; }
.c-sano { fill: #fff !important; }
.mark-x { stroke-width: 3; pointer-events: none; }
.mk-ausente { stroke: #475569; } .mk-extraccion { stroke: #dc2626; }
.mark-implante, .mark-corona { fill: none; stroke: #334155; stroke-width: 2; pointer-events: none; }
.mark-corona { stroke: #d97706; stroke-width: 3; }
.mark-endo { stroke: #a855f7; stroke-width: 3; pointer-events: none; }
.mark-text { font-size: 14px; font-weight: 800; text-anchor: middle; fill: #334155; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid #94a3b8; background: #fff; vertical-align: -2px; }
.sw.c-caries { background: #ef4444; } .sw.c-obturado { background: #3b82f6; } .sw.c-sellante { background: #22c55e; }
.sw.c-endodoncia { background: #a855f7; } .sw.c-corona { background: #f59e0b; } .sw.c-implante { background: #64748b; }
.sw.c-extraccion { background: #fecaca; } .sw.c-ausente { background: #cbd5e1; } .sw.c-fractura { background: #f97316; }
.odonto-switches { display: flex; gap: 8px; flex-wrap: wrap; }
.arcade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; overflow: visible; }
.arcade figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: #fffdfb; }
.arcade figcaption { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.arch-svg { width: 100%; max-width: 440px; height: auto; }
.a-palate { fill: #fbe1e4; stroke: none; }
.a-tongue { fill: #f9d3d8; }
.a-gum { fill: none; stroke: #eea0ad; stroke-linecap: round; stroke-linejoin: round; }
.a-gum-edge { fill: none; stroke: #f7c2c9; stroke-linecap: round; stroke-linejoin: round; }
.a-body { stroke: #bfae8a; stroke-width: .9; cursor: pointer; transition: filter .1s; }
.a-body:hover { filter: brightness(.95); }
.atooth.selected .a-body { stroke: var(--brand); stroke-width: 2.6; }
.a-body.a-missing { fill: #fff; fill-opacity: .35; stroke: #94a3b8; stroke-dasharray: 4 3; }
.a-body.a-crown { stroke: #b7862a; stroke-width: 1.2; }
.a-body.a-implant { stroke: #64748b; }
.a-anat, .a-overlay { pointer-events: none; }
.a-fis { fill: none; stroke: #9c8a66; stroke-width: 1.1; stroke-linecap: round; opacity: .85; }
.a-fis.a-soft { opacity: .35; }
.a-ridge { fill: none; stroke: #ffffff; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; opacity: .5; }
.a-pit { fill: #8a7652; opacity: .7; }
.a-tint { opacity: .62; }
.asurf[class*="c-"] { opacity: .82; }
.asurf { fill: transparent; stroke: none; cursor: pointer; }
.asurf:hover { fill: rgba(29, 78, 216, .18); }
.asurf.picked { stroke: var(--brand); stroke-width: 2; fill: rgba(29, 78, 216, .15); }
.a-screw { fill: none; stroke: #475569; stroke-width: 1.4; pointer-events: none; }
.a-endo { fill: #a855f7; stroke: #fff; stroke-width: 1.2; pointer-events: none; }
.a-x { stroke: #dc2626; stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.a-num { font: 700 11px system-ui, -apple-system, "Segoe UI", sans-serif; fill: #64748b; text-anchor: middle; dominant-baseline: central; cursor: pointer; }
.a-num:hover, .tooth.selected .a-num { fill: var(--brand); }
.arcade-mini .arch-svg { max-width: 380px; }
.arcade-mini .asurf, .arcade-mini .a-body, .arcade-mini .a-num { cursor: default; pointer-events: none; }
.picker select { min-width: 280px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.chip { display: inline-flex; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--text); font-size: 13px; }
.chip:hover { border-color: var(--brand); text-decoration: none; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.odo-patient { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.odo-patient > div { display: flex; flex-direction: column; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Búsqueda en vivo */
.typeahead { position: relative; width: 100%; }
.typeahead .ta-input { width: 100%; }
.typeahead.ta-picked .ta-input { border-color: var(--success); background: #f0fdf4; }
.typeahead.ta-error .ta-input { border-color: var(--danger); }
.ta-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); max-height: 340px; overflow-y: auto; }
.ta-list li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ta-list li span { font-size: 12px; color: var(--muted); }
.ta-list li.on, .ta-list li[data-i]:hover { background: #eff6ff; }
.ta-list li.ta-empty { color: var(--muted); cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-label { font-weight: 500; font-size: 13px; color: #334155; }
.search .typeahead .ta-input { background: #f1f5f9; border-color: transparent; }
.picker { width: min(420px, 100%); }
/* Relaciones */
.rel-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px !important; color: var(--muted); }
.rel-chip { display: inline-flex; gap: 4px; padding: 2px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 600; }
.rel-chip span { font-weight: 500; color: #6366f1; }
.rel-chip:hover { text-decoration: none; background: #e0e7ff; }
.rel-list { list-style: none; margin: 0 0 8px; padding: 0; }
.rel-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.rel-list li:last-child { border-bottom: 0; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; background: #6366f1; }
.rel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rel-type { display: inline-block; align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #4f46e5; }
.rel-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.group-due { margin: 4px 0 10px; padding: 8px 12px; border-radius: 10px; background: #fef2f2; color: #991b1b; font-size: 13px; }
.rel-add > summary { cursor: pointer; color: var(--brand); font-weight: 600; display: flex; align-items: center; gap: 6px; list-style: none; margin-top: 6px; }
.rel-add[open] > summary { margin-bottom: 12px; }
.relate-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.relate-box label { flex-direction: row !important; align-items: center; gap: 8px !important; margin: 0 !important; }
.relate-box select { width: auto; }
/* WhatsApp */
.btn-wa { background: #16a34a; border-color: #16a34a; color: #fff; }
.wa-mini { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #16a34a; vertical-align: middle; }
.wa-mini:hover { background: #dcfce7; }
.nowrap { white-space: nowrap; }
.web-pill { background: #e0f2fe; color: #0369a1; }
.sidebar-foot a { color: var(--brand); font-weight: 600; }
.assign-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; position: sticky; top: 70px; z-index: 15; border-color: var(--brand); background: #eff6ff; }
.assign-bar[hidden] { display: none; }
.assign-bar label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.assign-bar select { width: auto; }
.table .chk { width: 32px; }
.owner-line { display: flex; align-items: center; gap: 6px; }
.team-list { list-style: none; margin: 0; padding: 0; }
.team-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.team-list li:last-child { border-bottom: 0; }
.team-list li.inactive { opacity: .55; }
.team-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.team-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.avatar.photo { object-fit: cover; padding: 0; }
.staff-photo { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.staff-photo img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.staff-photo label { margin-bottom: 6px; }
.schedule-box[hidden] { display: none; }
.help-box { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--border); font-size: 13px; }
.help-box ul { margin: 6px 0 0; padding-left: 18px; }
.help-box li { margin-bottom: 4px; }
.form details { margin-bottom: 12px; }
.form details summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-bottom: 8px; }

/* Files */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.file { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.file-thumb { display: grid; place-items: center; height: 140px; background: #f1f5f9; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-ext { font-size: 22px; font-weight: 800; color: var(--brand); }
.file-meta { padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-preview { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.logo-preview img { max-height: 70px; max-width: 220px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: #fff; }

/* Documents */
.items-table td { padding: 6px; }
.items-table input { padding: 7px 9px; }
.totals { margin-left: auto; max-width: 320px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.totals div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals .grand { font-size: 18px; border-top: 1px solid var(--border); padding-top: 8px; }
.catalog-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.catalog-row input[type=text] { flex: 1; min-width: 160px; }

/* Agenda */
.agenda-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .9fr); gap: 18px; align-items: start; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-dow.weekend, .cal-day.weekend { color: var(--danger); }
.cal-day { position: relative; padding: 10px 0; border-radius: 10px; color: var(--text); font-weight: 500; }
.cal-day:hover { background: #f1f5f9; text-decoration: none; }
.cal-day.today { outline: 2px solid var(--brand); }
.cal-day.selected { background: var(--brand); color: #fff; }
.cal-count { position: absolute; top: 2px; right: 4px; font-size: 10px; background: var(--brand-accent); color: #fff; border-radius: 8px; padding: 0 5px; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.conv-list { padding: 6px; max-height: 75vh; overflow-y: auto; }
.conv { display: flex; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text); align-items: center; }
.conv:hover { background: #f8fafc; text-decoration: none; }
.conv.active { background: #eff6ff; }
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-body span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ch { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; }
.ch-whatsapp { background: #22c55e; } .ch-messenger { background: #3b82f6; } .ch-instagram { background: #db2777; }
.thread { padding: 0; display: flex; flex-direction: column; }
.thread-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 10px; }
.thread-head span { display: block; }
.link-box { padding: 12px 18px; background: #fffbeb; border-bottom: 1px solid var(--border); }
.chat { display: flex; flex-direction: column; gap: 8px; padding: 18px; max-height: 60vh; overflow-y: auto; background: #f8fafc; }
.bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--border); }
.bubble small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.bubble.out { align-self: flex-end; background: #dcfce7; border-color: #bbf7d0; }
.composer { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); align-items: flex-end; }

/* Guest */
.guest { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(circle at 70% 20%, #6b15a6 0%, #3b0a5c 55%, #24083f 100%); }
.guest .guest-brand h1 { color: #fff; letter-spacing: .08em; }
.guest .card { border-color: rgba(255, 255, 255, .12); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.guest-back { text-align: center; margin-top: 16px; }
.guest-back a { color: #dbbaff; font-size: 13px; }
.guest-box { width: 100%; max-width: 400px; }
.guest-brand { text-align: center; margin-bottom: 18px; }
.guest-brand img { max-height: 84px; max-width: 240px; height: auto; width: auto; }
.guest-brand h1 { margin-top: 8px; color: var(--brand); }
.error-card { text-align: center; padding: 40px 20px; }
.error-icon { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* Agenda: calendario por profesional (día / semana / mes) */
.dc-0 { --dc: #2563eb; --dc-bg: #dbeafe; --dc-ink: #1e3a8a; }
.dc-1 { --dc: #0d9488; --dc-bg: #ccfbf1; --dc-ink: #134e4a; }
.dc-2 { --dc: #7c3aed; --dc-bg: #ede9fe; --dc-ink: #4c1d95; }
.dc-3 { --dc: #d97706; --dc-bg: #fef3c7; --dc-ink: #78350f; }
.dc-4 { --dc: #e11d48; --dc-bg: #ffe4e6; --dc-ink: #881337; }
.dc-5 { --dc: #16a34a; --dc-bg: #dcfce7; --dc-ink: #14532d; }
.dc-6 { --dc: #0891b2; --dc-bg: #cffafe; --dc-ink: #164e63; }
.dc-7 { --dc: #ea580c; --dc-bg: #ffedd5; --dc-ink: #7c2d12; }
.dc-none { --dc: #64748b; --dc-bg: #f1f5f9; --dc-ink: #334155; }
.cdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--dc, #94a3b8); flex-shrink: 0; }

.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .btn-ghost { font-size: 18px; line-height: 1; padding: 6px 12px; }
.cal-title { font-size: 16px; margin-left: 6px; }
.cal-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff; }
.legend-item:hover { text-decoration: none; border-color: var(--brand); }
.legend-item.active { border-color: var(--brand); background: #eff6ff; font-weight: 600; }

.agenda-cal { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.agenda-cal.wide { grid-template-columns: 1fr; }
.agenda-cal.wide .cal-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
.cal-main { padding: 0; overflow: hidden; }
.cal-hint { padding: 8px 14px 12px; margin: 0; }
.cal-scroll { overflow: auto; max-height: calc(100vh - 230px); min-height: 440px; position: relative; }
.cal-grid { display: grid; grid-template-rows: auto auto; grid-template-columns: 58px; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); min-width: 100%; }
.cal-grid.v-week { grid-auto-columns: minmax(118px, 1fr); }
.cg-corner, .cg-head { position: sticky; top: 0; z-index: 4; background: #fff; border-bottom: 1px solid var(--border); }
.cg-corner { left: 0; z-index: 6; }
.cg-head { padding: 10px 8px; text-align: center; border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; }
.cg-head small { color: var(--muted); font-size: 11px; }
.cg-head.off small { color: var(--danger); }
.cg-head.today { background: #eff6ff; }
.cg-head.today .cg-doc { color: var(--brand); }
.cg-doc { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); font-size: 13px; text-align: left; }
.cg-times { position: sticky; left: 0; z-index: 3; background: #fff; border-right: 1px solid var(--border); }
.cg-hour { height: 64px; position: relative; }
.cg-hour span { position: absolute; top: -8px; right: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; background: #fff; padding: 0 2px; }
.cg-hour:first-child span { top: 2px; }
.cg-body { position: relative; border-left: 1px solid var(--border); }
.slot { display: block; height: 32px; border-top: 1px dashed #eef2f7; }
.slot.hour { border-top: 1px solid #e2e8f0; }
.slot.s-free:hover { background: #eff6ff; box-shadow: inset 0 0 0 2px #bfdbfe; }
.slot.s-free:hover::after { content: "+ Agendar"; display: block; font-size: 11px; color: var(--brand); padding: 8px 8px 0; font-weight: 600; }
.slot.s-off, .slot.s-break { background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #eef2f7 6px 12px); }
.slot.s-break { background: repeating-linear-gradient(135deg, #fffbeb 0 6px, #fef3c7 6px 12px); }
.slot.past.s-free { background: #fafbfc; }
.appt {
  position: absolute; left: 3px; right: 3px; top: 0; height: 30px; z-index: 2; overflow: hidden; border-radius: 8px;
  background: var(--dc-bg); color: var(--dc-ink); border-left: 4px solid var(--dc); padding: 4px 8px; font-size: 12px; line-height: 1.3;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08); display: flex; flex-direction: column; text-decoration: none;
}
.appt:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(15, 23, 42, .18); z-index: 3; }
.appt strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.appt-time { font-size: 11px; opacity: .85; font-variant-numeric: tabular-nums; white-space: nowrap; }
.appt-time em { font-style: normal; font-weight: 700; }
.appt-reason { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; font-size: 11px; }
.appt.short { flex-direction: row; gap: 6px; align-items: center; padding-top: 2px; padding-bottom: 2px; }
.appt.short .appt-reason, .appt.mid .appt-reason { display: none; }
.appt.sb-pendiente { background: repeating-linear-gradient(135deg, var(--dc-bg) 0 8px, #fff 8px 11px); border: 1px dashed var(--dc); border-left: 4px solid var(--dc); }
.appt.sb-completada { opacity: .6; }
.appt.sb-completada strong::before { content: "✓ "; }
.appt.sb-no_asistio { background: #fee2e2; color: #7f1d1d; border-left-color: var(--danger); }
.appt.sb-no_asistio strong { text-decoration: line-through; }
.appt.busy { background: repeating-linear-gradient(135deg, #e2e8f0 0 6px, #f1f5f9 6px 12px); color: #475569; border-left-color: #94a3b8; cursor: default; }
.lanes-2 { right: auto; width: calc(50% - 4px); } .lanes-2.lane-1 { left: 50%; }
.lanes-3 { right: auto; width: calc(33.33% - 4px); } .lanes-3.lane-1 { left: 33.33%; } .lanes-3.lane-2 { left: 66.66%; }
.lanes-4 { right: auto; width: calc(25% - 4px); } .lanes-4.lane-1 { left: 25%; } .lanes-4.lane-2 { left: 50%; } .lanes-4.lane-3 { left: 75%; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; display: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mg-dow { padding: 10px 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.mg-dow.weekend { color: var(--danger); }
.mg-cell { min-height: 112px; border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mg-cell.empty { background: #fafbfc; }
.mg-cell.weekend { background: #fcfcfd; }
.mg-day { font-weight: 700; color: var(--text); font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.mg-day:hover { background: #f1f5f9; text-decoration: none; }
.mg-cell.today .mg-day { background: var(--brand); color: #fff; }
.mg-chip { display: block; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--dc-bg, #f1f5f9); color: var(--dc-ink, #334155); border-left: 3px solid var(--dc, #94a3b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-chip:hover { text-decoration: none; filter: brightness(.96); }
.mg-chip.sb-completada { opacity: .6; }
.mg-chip.sb-no_asistio { text-decoration: line-through; }
.mg-chip.busy { background: #f1f5f9; color: #64748b; }
.mg-more { font-size: 11px; font-weight: 600; }

.cal-side { display: flex; flex-direction: column; gap: 18px; }
.cal-side .card { margin: 0; }
.list.compact li { padding: 7px 0; gap: 8px; flex-wrap: nowrap; }
.list.compact .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.list.compact .pill { font-size: 11px; padding: 1px 8px; }
.list .list-sep { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 10px 0 4px; border-bottom: 0; }
#nueva-cita.flash { box-shadow: 0 0 0 3px #bfdbfe; transition: box-shadow .3s; }

.appt-pop { display: none; position: fixed; inset: 0; z-index: 60; padding: 16px; place-items: center; }
.appt-pop:target { display: grid; }
.pop-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); }
.pop-card { position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 18px; background: var(--dc-bg); border-bottom: 3px solid var(--dc); border-radius: 16px 16px 0 0; }
.pop-head small { color: var(--dc-ink); font-weight: 600; }
.pop-head h3 { margin: 2px 0 0; font-size: 19px; }
.pop-head h3 a { color: var(--dc-ink); }
.pop-close { font-size: 26px; line-height: 1; color: var(--dc-ink); padding: 0 4px; }
.pop-close:hover { text-decoration: none; }
.pop-meta { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; margin: 0; padding: 16px 18px 6px; font-size: 14px; }
.pop-meta dt { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 2px; }
.pop-meta dd { margin: 0; }
.pop-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 18px 12px; }
.pop-edit { margin: 0 18px 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.pop-edit summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.pop-edit form { margin-top: 10px; }
.pop-delete { padding: 0 18px 16px; }

/* Responsive */
@media (max-width: 1100px) {
  .agenda-layout { grid-template-columns: 1fr 1fr; }
  .agenda-cal { grid-template-columns: 1fr; }
  .cal-side { display: grid; grid-template-columns: 1fr 1fr; }
  .agenda-layout > .card:last-child { grid-column: 1 / -1; }
  .odonto-layout { grid-template-columns: 1fr; }
  .tooth-svg { width: clamp(30px, calc((100vw - 120px) / 17), 42px); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid; }
  .hide-mobile { display: none; }
  .content { padding: 16px 16px 90px; }
  .topbar { padding: 10px 16px; }
  .grid-2, .agenda-layout, .inbox, .arcade { grid-template-columns: 1fr; }
  .stats, .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .dl { grid-template-columns: 1fr; gap: 0; }
  .dl dd { margin-bottom: 8px; }
  .patient-money { width: 100%; justify-content: space-between; gap: 10px; }
  .patient-money strong { font-size: 15px; white-space: nowrap; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: #fff; border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted);
    background: none; border: 0; font-family: inherit; cursor: pointer; padding: 4px 0;
  }
  .bottom-nav .active { color: var(--brand); }
  .bottom-nav a:hover { text-decoration: none; }
  .picker, .picker select { width: 100%; min-width: 0; }
  .table .hide-sm { display: none; }
  .patient-header > .avatar.xl { display: none; }
  .cal-side, .agenda-cal.wide .cal-side { grid-template-columns: 1fr; }
  .stats-compact { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .stats-compact .stat { padding: 8px 4px; text-align: center; }
  .stats-compact .stat-value { font-size: 18px; }
  .stats-compact .stat-label { font-size: 9px; letter-spacing: 0; }
  .cal-toolbar { padding: 10px 12px; }
  .cal-legend { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
  .legend-item { flex-shrink: 0; }
  .cal-scroll { max-height: 70vh; min-height: 360px; }
  .cal-grid { grid-template-columns: 46px; grid-auto-columns: minmax(150px, 1fr); }
  .cal-grid.v-week { grid-auto-columns: minmax(104px, 1fr); }
  .mg-cell { min-height: 72px; padding: 3px; }
  .mg-chip { font-size: 10px; padding: 1px 3px; }
  .mg-chip b { display: none; }
  .pop-meta { grid-template-columns: 1fr; gap: 2px; }
  .pop-meta dd { margin-bottom: 8px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chip { flex-shrink: 0; }
  .dropdown-panel { position: fixed; left: 16px; right: 16px; top: 80px; width: auto; }
}

/* Roles y permisos */
.roles-card { padding: 0; overflow: hidden; }
.roles-card .form-actions { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.roles-card .form-actions p { margin: 0; max-width: 640px; }
.roles-wrap { max-height: calc(100vh - 240px); overflow: auto; }
.roles-table { min-width: 720px; }
.roles-table thead th { position: sticky; top: 0; z-index: 2; background: #fff; vertical-align: top; border-bottom: 2px solid var(--border); }
.roles-table .rt-perm { position: sticky; left: 0; z-index: 1; background: #fff; min-width: 230px; text-align: left; }
.roles-table thead .rt-perm { z-index: 3; }
.rt-role { min-width: 160px; text-align: center; }
.rt-role > * { display: block; margin: 0 auto 4px; }
.rt-role .rt-name { font-weight: 700; text-align: center; width: 100%; padding: 6px 8px; }
.rt-role .rt-desc { font-size: 11px; width: 100%; padding: 4px 8px; font-weight: 400; }
.roles-table thead th { text-transform: none; letter-spacing: 0; }
.rt-count { font-size: 11px; color: var(--muted); font-weight: 500; }
.rt-module th { background: #f8fafc; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); padding-top: 12px; }
.rt-module th small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.rt-cell { text-align: center; }
.rt-cell input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.rt-cell input:disabled { cursor: not-allowed; opacity: .6; }
.rt-role.focus, .rt-cell.focus { background: #eff6ff; }

/* ================= Analítica ================= */
.viz-filters { display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; }
.viz-filters label.inline { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); font-weight: 600; margin: 0; }
.viz-filters input, .viz-filters select { padding: 7px 10px; font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { font-size: 13px; color: #52514e; font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: #0b0b0b; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.good { color: #006300; } .kpi-delta.bad { color: #b42323; } .kpi-delta.flat { color: var(--muted); }
.kpi-delta .muted { font-weight: 500; }
.kpi-sub { font-size: 12px; color: #898781; margin-top: 2px; }
.viz-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.viz-grid .span-2 { grid-column: span 2; }
.viz-card { margin: 0 0 18px; min-width: 0; }
.viz-grid .viz-card { margin: 0; }
.viz-title { margin: 0; font-size: 15px; }
.viz-sub { margin: 2px 0 12px; font-size: 12px; color: #898781; }
.viz-empty { padding: 30px 0; text-align: center; }
.viz-table { margin-top: 10px; font-size: 12px; }
.viz-table summary { cursor: pointer; color: var(--muted); }
.viz-table .table { font-size: 12px; margin-top: 6px; }

/* Columnas */
.vchart { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 220px; }
.vchart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: #898781; text-align: right; padding-bottom: 22px; font-variant-numeric: tabular-nums; }
.vchart-y span { line-height: 1; transform: translateY(-50%); }
.vchart-y span:last-child { transform: translateY(0); }
.vchart-plot { position: relative; min-width: 0; }
.vgrid { position: absolute; left: 0; right: 0; height: 1px; background: #e1e0d9; pointer-events: none; }
.vgrid.g-25 { bottom: calc(22px + (100% - 22px) * .25); } .vgrid.g-50 { bottom: calc(22px + (100% - 22px) * .5); }
.vgrid.g-75 { bottom: calc(22px + (100% - 22px) * .75); } .vgrid.g-100 { bottom: calc(22px + (100% - 22px)); }
.vchart-cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; border-bottom: 0; }
.vcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; outline: none; cursor: default; }
.vbar-wrap { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid #c3c2b7; position: relative; }
.vbar { display: block; width: 70%; max-width: 24px; background: #2a78d6; border-radius: 4px 4px 0 0; transition: filter .15s; }
.vbar.min { height: 2px; }
.vcol:hover .vbar, .vcol:focus .vbar { filter: brightness(1.15); }
.vcol:hover .vbar-wrap, .vcol:focus .vbar-wrap { background: rgba(42, 120, 214, .06); }
.vval { font-size: 11px; font-weight: 700; color: #0b0b0b; white-space: nowrap; margin-bottom: 3px; }
.vlabel { height: 22px; line-height: 22px; font-size: 11px; color: #898781; white-space: nowrap; }
.vlabel.hide { visibility: hidden; }

/* Barras horizontales */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; outline: none; border-radius: 6px; }
.hbars li:hover, .hbars li:focus { background: #f8fafc; }
.hb-label { font-size: 13px; color: #0b0b0b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-label small { display: block; font-size: 11px; color: #898781; }
.hb-track { height: 14px; display: block; }
.hb-bar { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hb-bar.w-0 { min-width: 0; }
.hb-value { font-size: 13px; font-weight: 600; color: #0b0b0b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.s1 { background: #2a78d6; } .st-good { background: #0ca30c; } .st-warn { background: #fab219; }
.st-crit { background: #d03b3b; } .st-neutral { background: #c3c2b7; }

/* Medidor de ocupación */
.meter { display: inline-block; width: 140px; height: 8px; border-radius: 4px; background: #cde2fb; vertical-align: middle; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: #2a78d6; border-radius: 4px; }
.meter-fill.hi { background: #0ca30c; } .meter-fill.lo { background: #86b6ef; }
.meter-val { font-size: 12px; font-weight: 600; margin-left: 8px; font-variant-numeric: tabular-nums; }

/* Mapa de calor */
.heat { display: grid; gap: 3px; align-items: center; }
.heat-h, .heat-d { font-size: 11px; color: #898781; text-align: center; }
.heat-d { text-align: left; }
.heat-c { display: block; height: 22px; border-radius: 4px; background: #f1f5f9; outline: none; }
.heat-c:hover, .heat-c:focus { box-shadow: 0 0 0 2px #0b0b0b; }
.q1 { background: #cde2fb; } .q2 { background: #9ec5f4; } .q3 { background: #6da7ec; }
.q4 { background: #3987e5; } .q5 { background: #256abf; } .q6 { background: #184f95; }
.heat-legend { display: flex; align-items: center; gap: 3px; font-size: 11px; color: #898781; margin-top: 8px; justify-content: flex-end; }
.heat-legend .heat-c { width: 14px; height: 10px; }
.heat-legend span { margin: 0 4px; }

/* Tooltip de gráficos */
.viz-tip { position: fixed; z-index: 80; pointer-events: none; background: #0b0b0b; color: #fff; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 6px; max-width: 260px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .1s; }
.viz-tip.show { opacity: 1; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .viz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .viz-grid { grid-template-columns: 1fr; }
  .viz-grid .span-2 { grid-column: auto; }
  .kpi-value { font-size: 21px; }
  .kpi { padding: 12px; }
  .vchart { height: 180px; }
  .viz-filters .seg { width: 100%; }
  .heat-h { font-size: 9px; }
  .heat.hc-1, .heat { gap: 2px; }
}

/* Utilidades de ancho/alto proporcional (gráficos sin estilos en línea) */
.w-0{width:0%}
.w-1{width:1%}
.w-2{width:2%}
.w-3{width:3%}
.w-4{width:4%}
.w-5{width:5%}
.w-6{width:6%}
.w-7{width:7%}
.w-8{width:8%}
.w-9{width:9%}
.w-10{width:10%}
.w-11{width:11%}
.w-12{width:12%}
.w-13{width:13%}
.w-14{width:14%}
.w-15{width:15%}
.w-16{width:16%}
.w-17{width:17%}
.w-18{width:18%}
.w-19{width:19%}
.w-20{width:20%}
.w-21{width:21%}
.w-22{width:22%}
.w-23{width:23%}
.w-24{width:24%}
.w-25{width:25%}
.w-26{width:26%}
.w-27{width:27%}
.w-28{width:28%}
.w-29{width:29%}
.w-30{width:30%}
.w-31{width:31%}
.w-32{width:32%}
.w-33{width:33%}
.w-34{width:34%}
.w-35{width:35%}
.w-36{width:36%}
.w-37{width:37%}
.w-38{width:38%}
.w-39{width:39%}
.w-40{width:40%}
.w-41{width:41%}
.w-42{width:42%}
.w-43{width:43%}
.w-44{width:44%}
.w-45{width:45%}
.w-46{width:46%}
.w-47{width:47%}
.w-48{width:48%}
.w-49{width:49%}
.w-50{width:50%}
.w-51{width:51%}
.w-52{width:52%}
.w-53{width:53%}
.w-54{width:54%}
.w-55{width:55%}
.w-56{width:56%}
.w-57{width:57%}
.w-58{width:58%}
.w-59{width:59%}
.w-60{width:60%}
.w-61{width:61%}
.w-62{width:62%}
.w-63{width:63%}
.w-64{width:64%}
.w-65{width:65%}
.w-66{width:66%}
.w-67{width:67%}
.w-68{width:68%}
.w-69{width:69%}
.w-70{width:70%}
.w-71{width:71%}
.w-72{width:72%}
.w-73{width:73%}
.w-74{width:74%}
.w-75{width:75%}
.w-76{width:76%}
.w-77{width:77%}
.w-78{width:78%}
.w-79{width:79%}
.w-80{width:80%}
.w-81{width:81%}
.w-82{width:82%}
.w-83{width:83%}
.w-84{width:84%}
.w-85{width:85%}
.w-86{width:86%}
.w-87{width:87%}
.w-88{width:88%}
.w-89{width:89%}
.w-90{width:90%}
.w-91{width:91%}
.w-92{width:92%}
.w-93{width:93%}
.w-94{width:94%}
.w-95{width:95%}
.w-96{width:96%}
.w-97{width:97%}
.w-98{width:98%}
.w-99{width:99%}
.w-100{width:100%}
.h-0{height:0%}
.h-1{height:1%}
.h-2{height:2%}
.h-3{height:3%}
.h-4{height:4%}
.h-5{height:5%}
.h-6{height:6%}
.h-7{height:7%}
.h-8{height:8%}
.h-9{height:9%}
.h-10{height:10%}
.h-11{height:11%}
.h-12{height:12%}
.h-13{height:13%}
.h-14{height:14%}
.h-15{height:15%}
.h-16{height:16%}
.h-17{height:17%}
.h-18{height:18%}
.h-19{height:19%}
.h-20{height:20%}
.h-21{height:21%}
.h-22{height:22%}
.h-23{height:23%}
.h-24{height:24%}
.h-25{height:25%}
.h-26{height:26%}
.h-27{height:27%}
.h-28{height:28%}
.h-29{height:29%}
.h-30{height:30%}
.h-31{height:31%}
.h-32{height:32%}
.h-33{height:33%}
.h-34{height:34%}
.h-35{height:35%}
.h-36{height:36%}
.h-37{height:37%}
.h-38{height:38%}
.h-39{height:39%}
.h-40{height:40%}
.h-41{height:41%}
.h-42{height:42%}
.h-43{height:43%}
.h-44{height:44%}
.h-45{height:45%}
.h-46{height:46%}
.h-47{height:47%}
.h-48{height:48%}
.h-49{height:49%}
.h-50{height:50%}
.h-51{height:51%}
.h-52{height:52%}
.h-53{height:53%}
.h-54{height:54%}
.h-55{height:55%}
.h-56{height:56%}
.h-57{height:57%}
.h-58{height:58%}
.h-59{height:59%}
.h-60{height:60%}
.h-61{height:61%}
.h-62{height:62%}
.h-63{height:63%}
.h-64{height:64%}
.h-65{height:65%}
.h-66{height:66%}
.h-67{height:67%}
.h-68{height:68%}
.h-69{height:69%}
.h-70{height:70%}
.h-71{height:71%}
.h-72{height:72%}
.h-73{height:73%}
.h-74{height:74%}
.h-75{height:75%}
.h-76{height:76%}
.h-77{height:77%}
.h-78{height:78%}
.h-79{height:79%}
.h-80{height:80%}
.h-81{height:81%}
.h-82{height:82%}
.h-83{height:83%}
.h-84{height:84%}
.h-85{height:85%}
.h-86{height:86%}
.h-87{height:87%}
.h-88{height:88%}
.h-89{height:89%}
.h-90{height:90%}
.h-91{height:91%}
.h-92{height:92%}
.h-93{height:93%}
.h-94{height:94%}
.h-95{height:95%}
.h-96{height:96%}
.h-97{height:97%}
.h-98{height:98%}
.h-99{height:99%}
.h-100{height:100%}
.heat.hc-1{grid-template-columns:34px repeat(1,minmax(14px,1fr))}
.heat.hc-2{grid-template-columns:34px repeat(2,minmax(14px,1fr))}
.heat.hc-3{grid-template-columns:34px repeat(3,minmax(14px,1fr))}
.heat.hc-4{grid-template-columns:34px repeat(4,minmax(14px,1fr))}
.heat.hc-5{grid-template-columns:34px repeat(5,minmax(14px,1fr))}
.heat.hc-6{grid-template-columns:34px repeat(6,minmax(14px,1fr))}
.heat.hc-7{grid-template-columns:34px repeat(7,minmax(14px,1fr))}
.heat.hc-8{grid-template-columns:34px repeat(8,minmax(14px,1fr))}
.heat.hc-9{grid-template-columns:34px repeat(9,minmax(14px,1fr))}
.heat.hc-10{grid-template-columns:34px repeat(10,minmax(14px,1fr))}
.heat.hc-11{grid-template-columns:34px repeat(11,minmax(14px,1fr))}
.heat.hc-12{grid-template-columns:34px repeat(12,minmax(14px,1fr))}
.heat.hc-13{grid-template-columns:34px repeat(13,minmax(14px,1fr))}
.heat.hc-14{grid-template-columns:34px repeat(14,minmax(14px,1fr))}
.heat.hc-15{grid-template-columns:34px repeat(15,minmax(14px,1fr))}
.heat.hc-16{grid-template-columns:34px repeat(16,minmax(14px,1fr))}
.heat.hc-17{grid-template-columns:34px repeat(17,minmax(14px,1fr))}
.heat.hc-18{grid-template-columns:34px repeat(18,minmax(14px,1fr))}
.heat.hc-19{grid-template-columns:34px repeat(19,minmax(14px,1fr))}
.heat.hc-20{grid-template-columns:34px repeat(20,minmax(14px,1fr))}
.heat.hc-21{grid-template-columns:34px repeat(21,minmax(14px,1fr))}
.heat.hc-22{grid-template-columns:34px repeat(22,minmax(14px,1fr))}
.heat.hc-23{grid-template-columns:34px repeat(23,minmax(14px,1fr))}
.heat.hc-24{grid-template-columns:34px repeat(24,minmax(14px,1fr))}

/* Atajos del inicio para roles sin agenda */
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.shortcut { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-weight: 600; background: #fff; }
.shortcut:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.shortcut .icon { color: var(--brand); }

/* Estado del sistema */
.health summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.health-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.health-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.health-list li > span { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.health-list li.ok > span { background: #dcfce7; color: #166534; }
.health-list li.warn { border-color: #fcd34d; background: #fffbeb; }
.health-list li.warn > span { background: #f59e0b; color: #fff; }
.health-list small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

tr.is-void td { color: var(--muted); }

.pager-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.pager-bar p { margin: 0; }
.pager-bar .pager { margin: 0; }
.pager-gap { padding: 6px 4px; color: var(--muted); }

/* Ventana de confirmación */
.confirm-dialog { border: 0; border-radius: 16px; padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.confirm-dialog::backdrop { background: rgba(15, 23, 42, .5); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.confirm-dialog p { margin: 0 0 18px; color: #334155; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Registro de actividad */
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-list > li { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.audit-what span { color: var(--muted); }
.audit-changes { list-style: none; margin: 6px 0 0; padding: 8px 10px; background: #f8fafc; border-radius: 8px; font-size: 13px; }
.audit-changes li { padding: 2px 0; }
.audit-changes span { font-weight: 600; color: var(--text); }
.audit-changes del { color: #b42323; text-decoration: line-through; }
.audit-changes ins { color: #166534; text-decoration: none; font-weight: 600; }
.inline-date { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0; }
@media (max-width: 860px) { .audit-list > li { grid-template-columns: 1fr; gap: 2px; } }

/* Validación de formularios */
.req { color: var(--danger); font-weight: 700; }
.form-hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.field-error { display: block; font-size: 12.5px; color: #b42323; font-weight: 600; margin-top: 4px; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important; background-color: #fffafa; }
:focus-visible { outline: 3px solid rgba(29, 78, 216, .45); outline-offset: 2px; }

/* Envíos en curso y datos recuperados */
button.is-busy { opacity: .7; cursor: progress; }
.draft-note { margin-bottom: 12px; }
.session-lost { margin-bottom: 12px; }

/* Seguridad de la cuenta (Usuarios → editar) */
.btn-row{display:flex;flex-wrap:wrap;gap:10px;margin:8px 0;}
.btn-row form{margin:0;}
input[data-select-all]{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.85rem;}

/* Analítica: visitas del sitio web */
.web-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:12px 0 18px;}
.web-stats>div{border:1px solid var(--border,#e2e8f0);border-radius:10px;padding:12px 14px;}
.web-num{display:block;font-size:1.5rem;font-weight:700;}
.web-lbl{display:block;font-size:.8rem;color:var(--muted,#64748b);}
.viz-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:18px;}
form.form + .card{margin-top:18px;}

/* Configuración: fotos de los servicios del sitio */
.svc-photos{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px;margin-bottom:8px;}
.svc-photo{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--border);border-radius:10px;padding:10px;}
.svc-photo img{width:64px;height:80px;object-fit:cover;border-radius:8px;flex:none;background:#0f2a4d;}
.svc-photo div{display:flex;flex-direction:column;gap:4px;min-width:0;}
.svc-photo input[type=file]{font-size:12px;max-width:100%;}

/* Logo de CEDAR en el inicio de sesión (fondo oscuro) */
.guest-brand .guest-logo{max-height:150px;max-width:220px;width:auto;height:auto;}

/* Eliminar definitivamente (usuarios y contactos) */
.danger-zone { border-color: #fecaca; }
.danger-zone .card-title { color: var(--danger); }
.danger-zone form { display: grid; gap: 12px; max-width: 600px; justify-items: start; }
.danger-zone label { width: 100%; }
.purge { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.purge summary { cursor: pointer; color: var(--danger); font-weight: 600; font-size: 13px; }
.purge form { display: grid; gap: 10px; margin-top: 10px; justify-items: start; }
.purge ul { margin: 0; padding-left: 18px; }
.purge label { width: 100%; }

/* ===== Sitio web: colores y fotos de la portada ===== */
.theme-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin:6px 0 14px;}
.form label.theme-opt,.theme-opt{display:flex;flex-direction:column;gap:8px;padding:10px;border:1px solid var(--border);border-radius:12px;cursor:pointer;font-weight:600;position:relative;transition:border-color .2s,box-shadow .2s;}
.theme-opt:hover{border-color:var(--brand);}
.theme-opt:has(input[type=radio]:checked){border-color:var(--brand);box-shadow:0 0 0 2px color-mix(in srgb,var(--brand) 30%,transparent);}
.theme-opt input[type=radio]{position:absolute;top:10px;right:10px;width:auto;}
.theme-opt img{width:100%;height:26px;border-radius:6px;display:block;}
.theme-opt input[type=color]{width:100%;height:26px;padding:0;border-radius:6px;cursor:pointer;}
.theme-opt small{font-weight:400;}
.theme-preview{margin:0 0 12px;max-width:640px;}
.theme-preview img{width:100%;height:auto;display:block;border:1px solid var(--border);border-radius:12px;}
.theme-preview figcaption{margin-top:6px;}
.hero-list{list-style:none;margin:0 0 16px;padding:0;display:grid;gap:12px;counter-reset:hero;}
.hero-row{display:grid;grid-template-columns:200px 1fr;gap:16px;align-items:start;padding:12px;border:1px solid var(--border);border-radius:12px;counter-increment:hero;}
.hero-thumb{position:relative;cursor:crosshair;border-radius:10px;overflow:hidden;background:#f1f5f9;}
.hero-thumb::before{content:counter(hero);position:absolute;top:8px;left:8px;z-index:1;min-width:24px;height:24px;padding:0 6px;border-radius:999px;background:rgba(15,23,42,.7);color:#fff;font-size:12px;font-weight:700;display:grid;place-items:center;}
.hero-thumb img{display:block;width:100%;height:auto;user-select:none;-webkit-user-drag:none;}
.hero-thumb:focus-visible{outline:3px solid var(--brand);outline-offset:2px;}
.hero-dot{position:absolute;left:50%;top:50%;width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;border:3px solid #fff;background:var(--brand);box-shadow:0 0 0 2px rgba(15,23,42,.35),0 2px 8px rgba(0,0,0,.35);pointer-events:none;display:none;}
.hero-thumb.has-dot .hero-dot{display:block;}
.hero-fields{display:grid;gap:4px;min-width:0;}
.hero-opts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 12px;}
.hero-remove{color:var(--danger);}
.hero-restore{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;}
.hero-restore p{margin:4px 0 0;}
@media(max-width:720px){.hero-row{grid-template-columns:1fr;}.hero-thumb{max-width:280px;}.hero-opts{grid-template-columns:1fr;}}
