:root {
  --color-primary: #ffffff;
  --color-primary-dark: #e5e5e5;
  --color-accent: #ffffff;
  --color-bg: #050505;
  --color-surface: #121212;
  --color-border: #2e2e2e;
  --color-text: #f5f5f5;
  --color-muted: #a3a3a3;
  --color-soft: #1a1a1a;
  --color-soft-2: #222222;
  --dash-accent-1: #3b82f6;
  --dash-accent-2: #06b6d4;
  --dash-accent-3: #8b5cf6;
  --dash-accent-4: #10b981;
  --dash-accent-5: #f59e0b;
  --dash-accent-6: #f43f5e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.45);
  --font: "Inter", "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  font-size: 15px;
}

a {
  color: #e5e5e5;
  text-decoration: none;
}

a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.app-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: #000000;
  border-bottom: 1px solid #333;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header::before {
  content: "";
  display: block;
  height: 2px;
  background: #fff;
  opacity: 0.15;
}

.app-header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
}

.brand:hover {
  text-decoration: none;
  color: #fff;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.brand-logo {
  height: 42px;
  width: auto;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.brand-tagline {
  font-size: 0.72rem;
  color: #9ca3af;
  font-weight: 500;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: #d1d5db;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  min-height: 40px;
  border: 1px solid transparent;
}

.app-nav a:hover {
  background: #222;
  color: #fff;
  text-decoration: none;
}

.app-main {
  flex: 1;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

.app-footer {
  border-top: 1px solid #333;
  background: #000;
  text-align: center;
  padding: 1rem;
  color: #737373;
  font-size: 0.82rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.page-head h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.page-head .muted {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
}

.muted {
  color: var(--color-muted);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem 1.35rem;
}

.section-card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.65rem;
  border-left: 3px solid #fff;
}

.section-card {
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-chunky {
  min-height: 42px;
  padding: 0.6rem 1.1rem;
  font-size: 0.92rem;
}

.btn-primary {
  background: #ffffff;
  color: #000;
  border-color: #fff;
}

.btn-primary:hover {
  background: #d4d4d4;
  color: #000;
}

.btn-secondary {
  background: #1a1a1a;
  color: #f5f5f5;
  border-color: #444;
}

.btn-secondary:hover {
  background: #262626;
  color: #fff;
}

.btn-sm {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.grid-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  padding: 1rem 1.1rem;
}

.tile:hover {
  border-color: #bbb;
  background: var(--color-soft);
  text-decoration: none;
}

.tile i {
  font-size: 1.35rem;
  color: #fff;
  flex-shrink: 0;
}

.form-card label {
  display: block;
  margin-bottom: 0.85rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: #e5e5e5;
}

.form-card input,
.form-card select,
.form-card textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: #0a0a0a;
  color: #f5f5f5;
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  outline: 2px solid rgba(255, 255, 255, 0.2);
  border-color: #666;
  background: #111;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  background: #0a0a0a;
}

legend {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  padding: 0 0.35rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.file-drop input {
  display: none;
}

.file-drop span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.1rem;
  border: 1px dashed #555;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  color: #e5e5e5;
  background: #0a0a0a;
}

.image-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.image-manager-item {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 1 / 1;
}

.image-manager-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-manager-item form {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  margin: 0;
}

.image-manager-delete {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 15, 15, 0.85);
  color: #f87171;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.image-manager-delete:hover {
  background: #dc2626;
  color: #fff;
}

.ocr-status {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.ocr-status-loading {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.ocr-status-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.ocr-status-warn {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.ocr-status-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.study-patient-link {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--color-muted);
}

.study-link-expediente {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.study-link-expediente input {
  margin-top: 0.2rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.hint.center {
  text-align: center;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert i {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.5rem;
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #333;
}

.data-table td {
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  color: #e5e5e5;
}

.app-nav a.is-active {
  background: #262626;
  color: #fff;
}

.machote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.85rem;
}

@media (min-width: 1400px) {
  .machote-grid,
  .machotes-hub-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1800px) {
  .machote-grid,
  .machotes-hub-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.machote-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #0a0a0a;
}

.machote-card-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.machote-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.machote-card-titles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.machote-actions {
  margin-top: 0.25rem;
}

.machote-hint {
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
}

.machote-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #141414;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--color-muted);
}

.machote-tip i {
  color: #fff;
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

/* —— Machotes hub (/machotes) —— */
.machotes-hub {
  width: 100%;
  max-width: none;
}

.machotes-hub-head {
  margin-bottom: 0.75rem;
}

.machotes-hub-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.machotes-stat-card {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 1rem;
  border-top: 3px solid var(--machote-accent, #3b82f6);
}

.machotes-stat-card:nth-child(1) {
  --machote-accent: #8b5cf6;
}

.machotes-stat-card:nth-child(2) {
  --machote-accent: #06b6d4;
}

.machotes-stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--machote-accent, #93c5fd);
}

.machotes-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #737373;
  font-weight: 600;
}

.machotes-hub-toolbar {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-top: 3px solid #6366f1;
  background: linear-gradient(165deg, rgba(99, 102, 241, 0.08) 0%, transparent 55%);
}

.machotes-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  background: #0a0a0a;
}

.machotes-search-wrap > i {
  color: #60a5fa;
  font-size: 1.15rem;
}

.machotes-search {
  flex: 1;
  border: none;
  background: transparent;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 1rem;
  min-width: 0;
}

.machotes-search:focus {
  outline: none;
}

.machotes-search-clear {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #a3a3a3;
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}

.machotes-filter-block {
  margin-bottom: 0.55rem;
}

.machotes-filter-block:last-of-type {
  margin-bottom: 0.35rem;
}

.machotes-filter-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #737373;
  margin-bottom: 0.35rem;
}

.machotes-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.machotes-filter-chip {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #121212;
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.machotes-filter-chip:hover {
  color: #e2e8f0;
  border-color: rgba(99, 102, 241, 0.45);
}

.machotes-filter-chip.is-active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.machotes-result-meta {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}

.machotes-empty-filter {
  margin: 0 0 1rem;
  text-align: center;
}

.machotes-hub-grid .machote-card {
  border-top: 3px solid var(--machote-accent, #64748b);
  border-color: color-mix(in srgb, var(--machote-accent, #64748b) 35%, #2e2e2e);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--machote-accent, #64748b) 12%, #0a0a0a) 0%,
    #0a0a0a 100%
  );
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.1s;
}

.machotes-hub-grid .machote-card:hover {
  border-color: var(--machote-accent, #64748b);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--machote-accent, #64748b) 22%, transparent);
  transform: translateY(-1px);
}

.machotes-hub-grid .machote-icon {
  background: color-mix(in srgb, var(--machote-accent, #64748b) 18%, #1a1a1a);
  border-color: color-mix(in srgb, var(--machote-accent, #64748b) 40%, #333);
  color: var(--machote-accent, #93c5fd);
}

.machote-category {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--machote-accent, #94a3b8);
}

.badge-modality-rx,
.badge-modality-cr,
.badge-modality-dx { background: rgba(6, 182, 212, 0.2); color: #67e8f9; border-color: rgba(6, 182, 212, 0.35); }
.badge-modality-us { background: rgba(34, 197, 94, 0.2); color: #86efac; border-color: rgba(34, 197, 94, 0.35); }
.badge-modality-ct { background: rgba(249, 115, 22, 0.2); color: #fdba74; border-color: rgba(249, 115, 22, 0.35); }
.badge-modality-mr { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; border-color: rgba(236, 72, 153, 0.35); }
.badge-modality-other { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.35); }

.machotes-admin-help {
  margin-bottom: 1rem;
  border-top: 3px solid #f59e0b;
}

.machotes-admin-help summary {
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #fcd34d;
}

.machotes-admin-help summary i {
  color: #fbbf24;
}

.machotes-admin-help-body {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #d4d4d4;
}

.machotes-admin-help-body ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.machotes-steps {
  border-top: 3px solid #22c55e;
}

.machotes-steps h2 {
  color: #86efac;
}

.machotes-steps h2 i {
  color: #4ade80;
}

.machotes-use-studies {
  border-top: 3px solid #8b5cf6;
}

.machotes-use-search {
  margin: 0 0 0.75rem;
}

/* —— Admin machotes —— */
.machotes-admin {
  width: 100%;
  max-width: none;
}

.machotes-admin-search {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-top: 3px solid #6366f1;
}

.machotes-admin-table {
  border-top: 3px solid #8b5cf6;
}

.machotes-admin-row-off {
  opacity: 0.55;
}

.machotes-slug {
  font-size: 0.78rem;
  color: #93c5fd;
}

.machotes-form {
  border-top: 3px solid #06b6d4;
  padding: 1.15rem 1.25rem;
}

.machotes-form fieldset {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
}

.machotes-form legend {
  font-weight: 700;
  color: #e2e8f0;
  padding: 0 0.35rem;
}

.machotes-code-area {
  width: 100%;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  color: #e5e5e5;
  min-height: 8rem;
  resize: vertical;
}

.machotes-active-check {
  align-self: end;
  margin-bottom: 0.85rem;
}

.machotes-duplicate-form {
  margin-top: 0.75rem;
}

/* —— Editor de plantillas (admin) —— */
.template-editor-page {
  max-width: min(1180px, 100%);
  margin: 0 auto;
}

.template-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.45rem;
  margin-bottom: 1rem;
}

.template-mode-tab {
  flex: 1 1 160px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.template-mode-tab:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.template-mode-tab.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(6, 182, 212, 0.18));
  border-color: rgba(59, 130, 246, 0.55);
  color: #fff;
}

.template-editor-page[data-editor-mode="sencillo"] .template-editor-advanced-only {
  display: none !important;
}

.template-editor-page[data-editor-mode="tecnico"] .template-defaults-intro-simple,
.template-editor-page[data-editor-mode="tecnico"] .template-editor-simple-only {
  display: none;
}

.template-editor-page[data-editor-mode="sencillo"] .template-defaults-intro-tecnico {
  display: none;
}

.template-editor-page[data-editor-mode="sencillo"] .template-simple-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(260px, 0.88fr);
  gap: 1rem;
  align-items: start;
}

.template-editor-page[data-editor-mode="sencillo"] .template-design-grid {
  display: block;
  margin-bottom: 0;
}

.template-editor-page[data-editor-mode="tecnico"] .template-simple-workspace {
  display: block;
}

.template-editor-page[data-editor-mode="tecnico"] .template-simple-workspace > .template-editor-fieldset-defaults {
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .template-editor-page[data-editor-mode="sencillo"] .template-simple-workspace {
    grid-template-columns: 1fr;
  }
}

.template-editor-head {
  margin-bottom: 0.75rem;
}

.template-editor-form {
  margin-bottom: 0.75rem;
}

.template-editor-fieldset {
  margin-bottom: 1.25rem;
}

.template-editor-fieldset-code {
  border-top: 1px solid rgba(6, 182, 212, 0.2);
  padding-top: 1rem;
}

.template-code-area {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 220px;
  margin-top: 0.5rem;
  border: 2px solid rgba(59, 130, 246, 0.35);
  background: #050505;
}

.template-code-area:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.template-editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 0.85rem 0;
  margin: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 5, 5, 0.92) 35%);
}

.template-editor-duplicate {
  margin: 0 0 1.5rem;
}

.app-main:has(.template-editor-page) {
  padding-bottom: 2rem;
}

.template-editor-fieldset-meta {
  border-left: 3px solid rgba(59, 130, 246, 0.55);
}

.template-editor-fieldset-fields {
  border-left: 3px solid rgba(16, 185, 129, 0.55);
}

.template-editor-fieldset-defaults {
  border-left: 3px solid rgba(245, 158, 11, 0.65);
}

.template-defaults-intro {
  margin-bottom: 1rem;
}

.template-defaults-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.template-default-block {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.22);
}

.template-default-block h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fcd34d;
}

.template-default-hint {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
}

.template-default-text {
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
}

.template-default-block .report-quill-wrap .ql-editor {
  min-height: 140px;
}

.template-defaults-header-group {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.template-defaults-header-group summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.template-defaults-header-inner {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.template-editor-page[data-editor-mode="sencillo"] .template-default-block:first-of-type {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.08);
}

.template-editor-page[data-editor-mode="sencillo"] .template-default-block:first-of-type h3 {
  color: #86efac;
}

.template-editor-fieldset-body {
  border-left: 3px solid rgba(6, 182, 212, 0.55);
}

.template-fields-intro {
  margin-bottom: 0.75rem;
}

.template-fields-builder {
  margin-bottom: 0.75rem;
}

.template-fields-empty {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.template-fields-table {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.template-fields-row {
  display: grid;
  grid-template-columns: 4.5rem 1.4fr 1fr 7.5rem 2.5rem;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(59, 130, 246, 0.18);
}

.template-fields-row-head {
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  padding-bottom: 0;
}

.template-fields-row-head .tf-col-order {
  display: flex;
  gap: 0.15rem;
}

.tf-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0a0a0a;
  color: var(--color-text);
  font-size: 0.88rem;
}

.tf-col-order {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: #e5e5e5;
  cursor: pointer;
}

.btn-icon:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.45);
}

.template-field-add-btn {
  margin-top: 0.25rem;
}

.template-design-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .template-design-grid {
    grid-template-columns: 1fr;
  }

  .template-fields-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "label label"
      "key type"
      "default default"
      "order actions";
  }

  .template-fields-row-head {
    display: none;
  }

  .tf-col-label { grid-area: label; }
  .tf-col-key { grid-area: key; }
  .tf-col-type { grid-area: type; }
  .tf-col-default { grid-area: default; }
  .tf-col-order { grid-area: order; flex-direction: row; }
  .tf-col-actions { grid-area: actions; justify-self: end; }
}

.template-body-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.template-insert-label {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.template-insert-select {
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.35);
  background: #0a0a0a;
  color: var(--color-text);
}

.template-body-quill-wrap .ql-editor {
  min-height: 280px;
}

.template-design-preview {
  position: sticky;
  top: 0.75rem;
}

.template-preview-head {
  margin-bottom: 0.65rem;
}

.template-preview-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.template-preview-paper {
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.share-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.share-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.share-url-input {
  flex: 1 1 280px;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #0a0a0a;
  color: var(--color-text);
  font-size: 0.85rem;
}

.share-send-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.share-hint {
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.inline-form {
  display: inline;
}


.badge-modality {
  background: #262626;
  color: #f5f5f5;
  border-color: #444;
}

.badge-ok {
  background: #14532d;
  color: #bbf7d0;
  border-color: #166534;
  min-width: 1.5rem;
  text-align: center;
}

.studies-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.studies-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.studies-stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.studies-stat-label {
  font-size: 0.78rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.studies-toolbar {
  margin-bottom: 0.85rem;
}

.studies-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 420px;
  padding: 0.45rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.studies-search i {
  color: var(--color-muted);
  font-size: 1.1rem;
}

.studies-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.92rem;
  min-width: 0;
}

.studies-search input:focus {
  outline: none;
}

.study-patient {
  display: block;
  font-weight: 600;
}

.study-accession {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.action-group .btn {
  white-space: nowrap;
}

.data-table .actions {
  min-width: 11rem;
}

.studies-empty-filter {
  margin: 0.75rem 0 0;
  text-align: center;
}

@media (max-width: 720px) {
  .studies-table th:nth-child(4),
  .studies-table td:nth-child(4),
  .studies-table th:nth-child(5),
  .studies-table td:nth-child(5) {
    display: none;
  }
}

.btn-block {
  width: 100%;
}

.steps-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--color-text);
}

.steps-list li {
  margin-bottom: 0.5rem;
}

.empty-state code {
  background: #1a1a1a;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.actions .btn-primary {
  margin-right: 0.5rem;
}

.study-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.study-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.template-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.template-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--color-border);
}

.badge {
  display: inline-block;
  background: #fff;
  color: #000;
  border: 1px solid #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 0.35rem;
  text-transform: uppercase;
}

.template-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.template-pick {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.85rem 1rem;
}

.template-pick:hover {
  border-color: #aaa;
  background: var(--color-soft);
}

.template-pick i {
  font-size: 1.25rem;
  color: #fff;
}

.logo-preview {
  max-height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.center {
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

/* —— Landing clínica —— */
.landing-body {
  background: var(--color-bg);
}

.landing-topbar {
  background: #000000;
  border-bottom: 1px solid #333;
}

.landing-topbar::before {
  content: "";
  display: block;
  height: 2px;
  background: #fff;
  opacity: 0.12;
}

.landing-topbar .brand {
  color: #fff;
}

.landing-topbar .brand-tagline {
  color: #9ca3af;
}

.landing-topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.landing-hero {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 860px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }
}

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #0a0a0a;
  color: #fff;
  border: 1px solid #333;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.landing-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  margin: 0.85rem 0 0.5rem;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.2;
}

.landing-lead {
  font-size: 1rem;
  max-width: 46ch;
  color: var(--color-muted);
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.landing-visual {
  background: #0a0a0a;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: #e5e5e5;
  border: 1px solid #222;
}

.landing-visual h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.landing-flow {
  list-style: none;
  padding: 0;
  margin: 0;
}

.landing-flow li {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
}

.landing-flow li:last-child {
  border-bottom: none;
}

.landing-flow i {
  color: #fff;
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.landing-cards {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.feature-card h3 {
  margin: 0.5rem 0 0.35rem;
  font-size: 0.95rem;
  color: #fff;
}

.feature-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-muted);
}

.feature-card i {
  font-size: 1.5rem;
  color: #fff;
}

.landing-info {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.landing-info h2 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.landing-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.landing-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}

.landing-list i {
  color: #fff;
}

/* —— Agenda —— */
.agenda-day-header {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.agenda-day-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.agenda-day-arrow {
  flex-shrink: 0;
  min-width: 2.5rem;
}

.agenda-day-title {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.agenda-day-label {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.agenda-day-badge {
  margin-top: 0.35rem;
  display: inline-block;
}

.agenda-day-summary {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.agenda-day-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.agenda-date-form {
  margin: 0;
}

.agenda-date-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.agenda-date-picker i {
  color: var(--color-muted);
}

.agenda-date-picker input {
  border: none;
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0;
  cursor: pointer;
}

.agenda-date-picker input:focus {
  outline: none;
}

.agenda-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  padding: 0.4rem 0.75rem;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.agenda-search i {
  color: var(--color-muted);
}

.agenda-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 0;
}

.agenda-search input:focus {
  outline: none;
}

.agenda-status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.agenda-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.agenda-chip:hover {
  text-decoration: none;
  background: var(--color-soft);
  color: #fff;
}

.agenda-chip.is-active {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 600;
}

.agenda-chip.is-active .agenda-chip-count {
  background: rgba(0, 0, 0, 0.12);
  color: #000;
}

.agenda-chip-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--color-soft);
  color: var(--color-muted);
}

.agenda-day-card {
  padding: 0;
  overflow: visible;
}

.agenda-day-hours-hint {
  margin: 0;
  padding: 0.65rem 1.15rem 0;
  font-size: 0.82rem;
}

.agenda-timeline {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.5rem;
  padding: 0.75rem 1.15rem 0;
  align-items: stretch;
  pointer-events: none;
  user-select: none;
}

.agenda-timeline-hours {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 4.5rem;
}

.agenda-timeline-hour {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.agenda-timeline-track {
  position: relative;
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 4.5rem;
}

.agenda-timeline-line {
  display: block;
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
  margin-left: 0.35rem;
}

.agenda-slot-gap {
  list-style: none;
  margin: 0;
  padding: 0 1.15rem;
  min-height: calc(var(--agenda-gap-min, 30) * 0.08rem);
  max-height: 3rem;
  display: flex;
  align-items: center;
  font-size: 0.78rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.agenda-list-hint {
  padding: 1rem 1.15rem 0;
  margin: 0;
  font-size: 0.9rem;
}

.agenda-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.agenda-slot {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid transparent;
}

.agenda-slot:last-child {
  border-bottom: none;
}

.agenda-slot-scheduled {
  border-left-color: #52525b;
}

.agenda-slot-confirmed {
  border-left-color: #3b82f6;
}

.agenda-slot-in_progress {
  border-left-color: #f59e0b;
}

.agenda-slot-completed {
  border-left-color: #22c55e;
}

.agenda-slot-cancelled,
.agenda-slot-no_show {
  border-left-color: #ef4444;
  opacity: 0.85;
}

.agenda-slot-time {
  text-align: center;
  padding-top: 0.1rem;
}

.agenda-slot-hour {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.agenda-slot-duration {
  display: block;
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-top: 0.2rem;
}

.agenda-slot-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.agenda-slot-patient {
  font-size: 1.02rem;
}

.agenda-slot-detail {
  margin: 0 0 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
}

.agenda-slot-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.agenda-slot-meta i {
  margin-right: 0.15rem;
  vertical-align: -0.1em;
}

.agenda-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: flex-start;
  max-width: 14rem;
}

.agenda-slot-actions form {
  margin: 0;
}

.agenda-btn-receive {
  font-weight: 600;
}

.agenda-more {
  position: relative;
}

.agenda-more-trigger {
  list-style: none;
  cursor: pointer;
}

.agenda-more-trigger::-webkit-details-marker {
  display: none;
}

.agenda-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 15;
  min-width: 11rem;
  padding: 0.5rem;
  background: #0a0a0a;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.agenda-more-title {
  margin: 0 0 0.35rem;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.agenda-more-panel form {
  margin: 0;
}

.agenda-more-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.agenda-more-option:hover {
  background: var(--color-soft);
}

.agenda-empty-icon {
  font-size: 2.5rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.agenda-empty-icon i {
  display: block;
}

.agenda-wa-hint {
  margin: 1rem 0 0;
  font-size: 0.88rem;
}

.agenda-wa-hint i {
  color: #25d366;
  vertical-align: -0.1em;
}

.agenda-view-tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.agenda-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.agenda-view-tab:hover {
  color: #fff;
  text-decoration: none;
  background: var(--color-soft);
}

.agenda-view-tab.is-active {
  background: #fff;
  color: #000;
}

/* —— Agenda profesional (vista día tipo calendario) —— */
.agenda-pro-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.agenda-pro-title {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
}

.agenda-pro-btn-new {
  font-weight: 700;
}

.agenda-pro-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

.agenda-pro-toolbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agenda-pro-toolbar-date-main {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.agenda-pro-toolbar-date-sub {
  font-size: 0.82rem;
}

.agenda-pro-toolbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.agenda-pro-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.15rem;
}

.agenda-pro-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.agenda-pro-legend-item:hover {
  color: #fff;
  background: var(--color-soft);
  text-decoration: none;
}

.agenda-pro-legend-item.is-active {
  color: #fff;
  border-color: var(--color-border);
  background: var(--color-soft);
}

.agenda-pro-legend-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--dot, #888);
  flex-shrink: 0;
}

.agenda-pro-legend-clear {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-left: 0.25rem;
}

.agenda-pro-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #a7f3d0;
}

.agenda-pro-hint i {
  font-size: 1.1rem;
  margin-top: 0.05rem;
  color: #2dd4bf;
}

.agenda-pro-board {
  padding: 0.75rem;
  overflow: hidden;
}

.agenda-pro-cal-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 0.25rem;
}

.agenda-pro-cal {
  min-width: 52rem;
}

.agenda-pro-cal-head {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.agenda-pro-cal-corner {
  border-right: 1px solid var(--color-border);
}

.agenda-pro-cal-hours {
  display: grid;
  grid-template-columns: repeat(var(--agenda-slots), minmax(0, 1fr));
}

.agenda-pro-cal-hour-block {
  border-right: 1px solid var(--color-border);
  padding: 0.35rem 0.25rem 0.25rem;
  min-width: 0;
}

.agenda-pro-cal-hour-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.agenda-pro-cal-hour-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.15rem;
  padding-right: 0.15rem;
}

.agenda-pro-cal-tick {
  font-size: 0.62rem;
  color: var(--color-muted);
}

.agenda-pro-cal-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  border-bottom: 1px solid var(--color-border);
}

.agenda-pro-cal-resource {
  padding: 0.5rem 0.65rem;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  background: rgba(0, 0, 0, 0.2);
}

.agenda-pro-cal-resource-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.agenda-pro-cal-resource-count {
  font-size: 0.68rem;
}

.agenda-pro-cal-track {
  position: relative;
  min-height: 3.5rem;
}

.agenda-pro-cal-gridlines {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--agenda-slots), minmax(0, 1fr));
}

.agenda-pro-cal-slot {
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  min-height: 100%;
  display: block;
  text-decoration: none;
  transition: background 0.12s ease;
}

.agenda-pro-cal-slot:hover {
  background: rgba(20, 184, 166, 0.15);
}

.agenda-pro-cal-event {
  position: absolute;
  z-index: 2;
  margin: 0;
  padding: 0.2rem 0.35rem;
  border: none;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  font-family: inherit;
  line-height: 1.2;
  min-width: 3rem;
}

.agenda-pro-cal-event.is-filtered-out,
.agenda-pro-cal-event[hidden] {
  opacity: 0;
  pointer-events: none;
}

.agenda-pro-cal-event-time {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.95;
}

.agenda-pro-cal-event-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-pro-cal-event-sub {
  display: block;
  font-size: 0.62rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-pro-cal-event-scheduled {
  background: #475569;
  color: #fff;
}

.agenda-pro-cal-event-confirmed {
  background: #2563eb;
  color: #fff;
}

.agenda-pro-cal-event-in_progress {
  background: #d97706;
  color: #fff;
}

.agenda-pro-cal-event-completed {
  background: #15803d;
  color: #fff;
}

.agenda-pro-cal-event-cancelled,
.agenda-pro-cal-event-no_show {
  background: #b91c1c;
  color: #fff;
  opacity: 0.85;
}

.agenda-pro-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}

.agenda-pro-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  cursor: pointer;
}

.agenda-pro-drawer-panel {
  position: relative;
  width: min(22rem, 92vw);
  height: 100%;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
  animation: agenda-drawer-in 0.2s ease;
}

@keyframes agenda-drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.agenda-pro-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.agenda-pro-drawer-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.agenda-pro-drawer-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.agenda-pro-drawer-patient {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.agenda-pro-drawer-meta {
  margin-bottom: 0.75rem;
}

.agenda-pro-drawer-dl {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.agenda-pro-drawer-dl div {
  margin-bottom: 0.5rem;
}

.agenda-pro-drawer-dl dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  margin-bottom: 0.1rem;
}

.agenda-pro-drawer-dl dd {
  margin: 0;
  color: #fff;
}

.agenda-pro-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agenda-pro-drawer-actions form {
  margin: 0;
}

body.agenda-drawer-open {
  overflow: hidden;
}

.agenda-pro-empty-filter {
  padding: 1rem;
  margin-bottom: 0.5rem;
}

/* Calendario horizontal (vista día) */
.agenda-cal-board {
  padding: 1rem;
  overflow: hidden;
}

.agenda-cal-board-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.agenda-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin-bottom: 0.65rem;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.agenda-cal-legend-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.2rem;
  vertical-align: 0.05em;
}

.agenda-cal-help {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  padding: 0.5rem 0.65rem;
  background: rgba(20, 184, 166, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(20, 184, 166, 0.25);
}

.agenda-cal-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #0a0a0a;
}

.agenda-cal-h-head,
.agenda-cal-h-row {
  display: flex;
  align-items: stretch;
}

.agenda-cal-h-corner,
.agenda-cal-h-resource {
  flex: 0 0 8.75rem;
  padding: 0.45rem 0.55rem;
  border-right: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
}

.agenda-cal-h-resource-name {
  line-height: 1.25;
}

.agenda-cal-h-resource-n {
  font-size: 0.65rem;
  font-weight: 500;
}

.agenda-cal-h-hours {
  display: flex;
  flex-shrink: 0;
}

.agenda-cal-h-hour {
  flex-shrink: 0;
  padding: 0.35rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  border-right: 1px solid var(--color-border);
  text-align: center;
  box-sizing: border-box;
}

.agenda-cal-h-track {
  position: relative;
  flex-shrink: 0;
}

.agenda-cal-h-slots {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}

.agenda-cal-h-slot {
  flex-shrink: 0;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: auto;
  box-sizing: border-box;
}

.agenda-cal-h-slot:hover {
  background: rgba(45, 212, 191, 0.2);
}

.agenda-cal-h-event {
  position: absolute;
  z-index: 2;
  margin: 0;
  padding: 0.15rem 0.3rem;
  border: none;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  font-family: inherit;
  color: #fff;
  line-height: 1.15;
}

.agenda-cal-h-event-time {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
}

.agenda-cal-h-event-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-cal-h-event-mod {
  font-size: 0.6rem;
  opacity: 0.9;
}

.agenda-cal-h-event.status-scheduled {
  background: #475569;
}

.agenda-cal-h-event.status-confirmed {
  background: #2563eb;
}

.agenda-cal-h-event.status-in_progress {
  background: #d97706;
}

.agenda-cal-h-event.status-completed {
  background: #15803d;
}

.agenda-cal-h-event.status-cancelled,
.agenda-cal-h-event.status-no_show {
  background: #b91c1c;
}

.agenda-slot.is-highlight {
  outline: 2px solid #2dd4bf;
  outline-offset: 2px;
  background: rgba(45, 212, 191, 0.08);
}

.agenda-search-block {
  display: flex;
  margin: 0 1rem 0.75rem;
  max-width: 22rem;
}

.btn.agenda-wa,
a.agenda-wa {
  background: #128c41;
  border-color: #0f7a38;
  color: #fff;
  font-weight: 600;
}

.btn.agenda-wa:hover,
a.agenda-wa:hover {
  background: #25d366;
  color: #fff;
  text-decoration: none;
}

.agenda-wa-card-actions .agenda-wa {
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
}

.agenda-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.agenda-week-day {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 12rem;
}

.agenda-week-day.is-today {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.agenda-week-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-soft);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.agenda-week-day-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  line-height: 1.15;
}

.agenda-week-day-link:hover {
  text-decoration: none;
  color: #fff;
}

.agenda-week-dow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.agenda-week-dom {
  font-size: 1.25rem;
  font-weight: 700;
}

.agenda-week-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: #262626;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.agenda-week-empty {
  margin: auto;
  padding: 1rem 0.5rem;
  font-size: 0.82rem;
  text-align: center;
}

.agenda-week-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agenda-week-appt {
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  border: 1px solid var(--color-border);
  border-left-width: 3px;
}

.agenda-week-appt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.agenda-week-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

.badge-sm {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
}

.agenda-week-patient {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: #fff;
  text-decoration: none;
  margin-bottom: 0.2rem;
}

.agenda-week-patient:hover {
  text-decoration: underline;
  color: #fff;
}

.agenda-week-meta {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  line-height: 1.35;
}

.agenda-week-appt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.agenda-week-appt-actions .btn-sm {
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
}

.agenda-week-day-foot {
  padding: 0.45rem;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 1100px) {
  .agenda-week-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .agenda-week-grid {
    grid-template-columns: 1fr;
  }

  .agenda-week-day {
    min-height: auto;
  }
}

.agenda-month-card {
  padding: 0.75rem;
  overflow-x: auto;
}

.agenda-month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  min-width: 42rem;
}

.agenda-month-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  padding: 0.25rem 0;
}

.agenda-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  min-width: 42rem;
}

.agenda-month-cell {
  min-height: 6.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
}

.agenda-month-cell.has-events {
  min-height: auto;
  border-left: 3px solid #fff;
}

.agenda-month-cell.is-outside {
  opacity: 0.45;
  background: #0a0a0a;
}

.agenda-month-cell.is-today {
  border-color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.agenda-month-cell-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.agenda-month-daynum {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-decoration: none;
  line-height: 1;
  min-width: 1.5rem;
}

.agenda-month-daynum:hover {
  text-decoration: underline;
  color: #fff;
}

.agenda-month-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: #262626;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  margin-right: auto;
}

.agenda-month-add {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  text-decoration: none;
}

.agenda-month-add:hover {
  background: var(--color-soft);
  color: #fff;
  text-decoration: none;
}

.agenda-month-events {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: visible;
  min-height: 0;
}

.agenda-month-event {
  border-radius: 3px;
  border-left: 2px solid var(--color-border);
  font-size: 0.68rem;
  line-height: 1.25;
  background: #0a0a0a;
}

.agenda-month-event a {
  display: block;
  padding: 0.15rem 0.25rem;
  color: inherit;
  text-decoration: none;
}

.agenda-month-event a:hover {
  background: var(--color-soft);
  text-decoration: none;
}

.agenda-month-event-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-right: 0.25rem;
}

.agenda-month-event-name {
  font-weight: 600;
}

.agenda-month-event-mod {
  margin-left: 0.2rem;
  font-size: 0.6rem;
  padding: 0.05rem 0.25rem;
  vertical-align: 0.05em;
}

.agenda-month-more {
  font-size: 0.68rem;
  padding: 0.1rem 0.25rem;
}

.agenda-month-more a {
  color: var(--color-muted);
  font-weight: 600;
}

.agenda-month-more a:hover {
  color: #fff;
}

@media (max-width: 900px) {
  .agenda-month-cell {
    min-height: 5rem;
  }

  .agenda-month-event-name,
  .agenda-month-event-mod {
    display: none;
  }
}

.agenda-toolbar {
  padding: 0.85rem 1rem;
}

.agenda-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.agenda-date-form,
.agenda-status-filter {
  margin: 0;
}

.agenda-date-form input,
.agenda-status-filter select,
.agenda-status-form select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 0.85rem;
}

.agenda-status-form {
  margin: 0;
  display: inline-block;
}

.agenda-form-steps {
  display: grid;
  gap: 1rem;
}

.agenda-form-step {
  padding: 0;
}

.agenda-form-step legend {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  padding: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agenda-form-step-num {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 0.85rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.agenda-patient-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0 0.75rem;
  background: #14532d;
  border: 1px solid #166534;
  border-radius: var(--radius-md);
  color: #bbf7d0;
  font-size: 0.92rem;
}

.agenda-patient-selected i {
  font-size: 1.15rem;
}

.agenda-toggle-new {
  margin: 0.35rem 0 0.75rem;
}

@media (max-width: 768px) {
  .agenda-slot {
    grid-template-columns: 3.75rem 1fr;
  }

  .agenda-slot-actions {
    grid-column: 1 / -1;
    max-width: none;
    justify-content: flex-start;
    padding-top: 0.25rem;
    border-top: 1px dashed var(--color-border);
    margin-top: 0.25rem;
    padding-top: 0.65rem;
  }

  .agenda-status-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }
}

.agenda-suggestions {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: -0.5rem 0 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.agenda-suggestion-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: #f5f5f5;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.agenda-suggestion-item:last-child {
  border-bottom: none;
}

.agenda-suggestion-item:hover {
  background: var(--color-soft);
}

.badge-status-scheduled {
  background: #262626;
  color: #f5f5f5;
  border-color: #444;
}

.badge-status-confirmed {
  background: #1e3a5f;
  color: #93c5fd;
  border-color: #1e40af;
}

.badge-status-in_progress {
  background: #78350f;
  color: #fde68a;
  border-color: #92400e;
}

.badge-status-completed {
  background: #14532d;
  color: #bbf7d0;
  border-color: #166534;
}

.badge-status-cancelled {
  background: #7f1d1d;
  color: #fecaca;
  border-color: #991b1b;
}

.badge-status-no_show {
  background: #3f3f46;
  color: #f87171;
  border-color: #52525b;
}

/* Auth login — pantalla completa */
.auth-body {
  min-height: 100dvh;
  margin: 0;
  font-family: "Nunito", var(--font);
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(91, 95, 239, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(255, 107, 157, 0.1), transparent 50%),
    var(--color-bg);
}

.auth-topbar {
  border-bottom: 1px solid #2a2a2a;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.auth-topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.auth-topbar .brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1f1f1f, #0a0a0a);
  font-size: 1.35rem;
}

.auth-topbar-link {
  border-radius: 14px;
  min-height: 44px;
}

.auth-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  min-height: calc(100dvh - 72px);
  display: flex;
  align-items: center;
}

.auth-shell {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 420px);
  gap: 2rem;
  align-items: stretch;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    order: 2;
  }

  .auth-panel {
    order: 1;
  }
}

.auth-aside {
  padding: 1.5rem 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-aside-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #141414;
  border: 1px solid #333;
  color: #fff;
  width: fit-content;
}

.auth-aside-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
}

.auth-aside-lead {
  margin: 0 0 1.5rem;
  color: var(--color-muted);
  font-size: 1.02rem;
  max-width: 42ch;
  line-height: 1.6;
}

.auth-role-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-role-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #2a2a2a;
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-role-list li i {
  font-size: 1.35rem;
  color: #fff;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.auth-panel {
  padding: 2rem 1.75rem 1.75rem;
  border-radius: 22px;
  border: 1px solid #333;
  background: linear-gradient(180deg, #161616 0%, #101010 100%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-panel-head {
  margin-bottom: 1.35rem;
}

.auth-panel-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
}

.auth-panel .alert {
  border-radius: 14px;
  margin-bottom: 1.15rem;
}

.auth-body .alert-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.auth-body .alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.auth-body .alert-info {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.auth-field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #d4d4d4;
  letter-spacing: 0.02em;
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid #3a3a3a;
  background: #0a0a0a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input-wrap:focus-within {
  border-color: #737373;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.auth-input-wrap i {
  color: #737373;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.auth-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.65rem 0;
  outline: none;
}

.auth-input-wrap input::placeholder {
  color: #525252;
  font-weight: 500;
}

.auth-submit {
  margin-top: 0.35rem;
  min-height: 52px;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.auth-demo {
  margin-top: 1.35rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: #0c0c0c;
  border: 1px dashed #404040;
}

.auth-demo-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #e5e5e5;
}

.auth-demo-creds {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.auth-demo-creds code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.85rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fafafa;
}

.auth-demo-note {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
}

.card-soft {
  box-shadow: none;
}

.btn-block { width: 100%; justify-content: center; }
.form-stack label { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-inline-stack { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.form-inline-mini { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.app-header-inner { flex-wrap: wrap; gap: 0.75rem; }
.app-user-bar { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.app-user-meta { font-size: 0.88rem; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.app-user-role { font-size: 0.75rem; opacity: 0.75; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--color-soft); }
.app-logout { white-space: nowrap; }

.caja-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.caja-totals { list-style: none; padding: 0; margin: 1rem 0; }
.caja-totals li { padding: 0.35rem 0; border-bottom: 1px solid var(--color-border); }
.corte-details { margin-top: 1rem; }
.corte-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }

.catalog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.catalog-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.catalog-tab.is-active {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.catalog-tab-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--color-soft);
  color: var(--color-muted);
}

.catalog-tab.is-active .catalog-tab-count {
  background: rgba(0, 0, 0, 0.12);
  color: #000;
}

.catalog-tabs-compact .catalog-tab {
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}

.study-catalog-picker {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.study-catalog-picker-label {
  margin: 0 0 0.65rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.study-catalog-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.65rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.study-catalog-select-wrap select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  color: #f5f5f5;
  font-family: inherit;
}

.study-catalog-select-wrap .searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #0a0a0a;
}

.searchable-select-control:focus-within {
  border-color: #888;
  outline: 2px solid rgba(255, 255, 255, 0.12);
}

.searchable-select-icon {
  color: var(--color-muted);
  font-size: 1.15rem;
}

.searchable-select-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.searchable-select-input:focus {
  outline: none;
}

.searchable-select-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  max-height: min(280px, 50vh);
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #0f0f0f;
  border: 1px solid #444;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.searchable-select-option {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.searchable-select-option:hover,
.searchable-select-option.is-highlighted {
  background: #fff;
  color: #000;
}

.searchable-select-empty {
  padding: 0.75rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.searchable-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.catalog-add-card { margin-bottom: 1rem; }
.catalog-row-inactive td { opacity: 0.55; }
.catalog-price-table td strong { color: #fff; }

.catalog-group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.catalog-group-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: inherit;
  border-radius: 18px;
  transition: border-color 0.15s, transform 0.1s;
}

.catalog-group-card:hover {
  text-decoration: none;
  border-color: #888;
  transform: translateY(-2px);
}

.catalog-group-card-label {
  font-weight: 800;
  font-size: 0.92rem;
  color: #fff;
}

.catalog-group-card-count {
  font-size: 0.78rem;
  color: #a3a3a3;
  font-weight: 700;
}

.catalog-group-card-price {
  font-size: 0.85rem;
  font-weight: 800;
  color: #e5e5e5;
  font-variant-numeric: tabular-nums;
}

.catalog-add-card-editing {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.catalog-editing-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid var(--color-border);
}

.catalog-seed-card {
  margin-bottom: 1.25rem;
}

.catalog-seed-card-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.catalog-seed-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.catalog-seed-desc {
  margin: 0;
  max-width: 42rem;
  line-height: 1.45;
}

.catalog-seed-form {
  flex-shrink: 0;
}

.role-help { margin: 0; padding-left: 1.25rem; line-height: 1.6; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem; }

@media (max-width: 900px) {
  .app-user-bar { width: 100%; justify-content: space-between; }
  .app-nav { order: 3; width: 100%; }
}

/* —— UI clínica profesional (v10) —— */
body {
  background:
    radial-gradient(1200px 600px at 50% -20%, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-header {
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.app-header::before {
  opacity: 0.35;
  height: 1px;
}

.app-header-inner {
  max-width: 1280px;
  padding: 0.65rem 1.5rem;
}

.app-main {
  max-width: 1280px;
  padding: 1.75rem 1.5rem 2.5rem;
}

.brand-text {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-weight: 500;
  letter-spacing: 0.01em;
}

.app-nav {
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav a {
  font-weight: 500;
  font-size: 0.84rem;
  color: #a3a3a3;
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  white-space: nowrap;
}

.app-nav a i {
  font-size: 1.05rem;
  opacity: 0.85;
}

.app-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fafafa;
}

.app-nav a.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.app-user-bar {
  gap: 0.65rem;
}

.app-user-meta {
  gap: 0.55rem;
  align-items: center;
}

.app-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.app-user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #fafafa;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #262626, #171717);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  flex-shrink: 0;
}

.app-user-role {
  font-size: 0.7rem;
  font-weight: 500;
  color: #737373;
  padding: 0;
  border-radius: 0;
  background: transparent;
  opacity: 1;
}

.btn-ghost {
  background: transparent;
  color: #a3a3a3;
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.page-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #737373;
}

.page-head-compact {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
}

.page-head h1 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.card {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.95) 0%, rgba(18, 18, 18, 0.98) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
}

.section-card h2 {
  border-left: none;
  padding-left: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-card-pro {
  padding: 0;
  overflow: hidden;
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}

.section-card-header h2 {
  margin: 0;
}

.section-card-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #a3a3a3;
  text-decoration: none;
}

.section-card-link:hover {
  color: #fff;
  text-decoration: none;
}

.badge {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e5e5;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-left: 0;
}

.btn {
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  font-weight: 600;
}

.btn-primary:active {
  transform: translateY(1px);
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.data-table th {
  background: rgba(0, 0, 0, 0.35);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.dash-accesos {
  margin-bottom: 1.25rem;
}

.dash-accesos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}

.dash-acceso-tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, background 0.12s, transform 0.12s;
}

.dash-acceso-tile:nth-child(6n + 1) { --tile-accent: var(--dash-accent-1); }
.dash-acceso-tile:nth-child(6n + 2) { --tile-accent: var(--dash-accent-2); }
.dash-acceso-tile:nth-child(6n + 3) { --tile-accent: var(--dash-accent-5); }
.dash-acceso-tile:nth-child(6n + 4) { --tile-accent: var(--dash-accent-3); }
.dash-acceso-tile:nth-child(6n + 5) { --tile-accent: var(--dash-accent-4); }
.dash-acceso-tile:nth-child(6n + 6) { --tile-accent: var(--dash-accent-2); }

.dash-acceso-tile:hover {
  border-color: color-mix(in srgb, var(--tile-accent, #3b82f6) 45%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--tile-accent, #3b82f6) 12%, transparent) 0%, rgba(255, 255, 255, 0.02) 100%);
  transform: translateY(-1px);
}

.dash-acceso-tile i {
  font-size: 1.35rem;
  color: var(--tile-accent, #93c5fd);
}

.dash-acceso-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
}

.dash-acceso-hint {
  font-size: 0.78rem;
  color: #737373;
}

.dash-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.dash-kpi-card {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 18, 18, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  border-top: 3px solid var(--kpi-accent, #525252);
}

.dash-kpi-card:nth-child(5n + 1) { --kpi-accent: var(--dash-accent-1); }
.dash-kpi-card:nth-child(5n + 2) { --kpi-accent: var(--dash-accent-4); }
.dash-kpi-card:nth-child(5n + 3) { --kpi-accent: var(--dash-accent-2); }
.dash-kpi-card:nth-child(5n + 4) { --kpi-accent: var(--dash-accent-3); }
.dash-kpi-card:nth-child(5n + 5) { --kpi-accent: var(--dash-accent-5); }

.dash-kpi-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #737373;
  margin-bottom: 0.35rem;
}

.dash-kpi-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--kpi-accent, #fff);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dash-kpi-meta {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #737373;
}

.dash-section {
  margin-bottom: 1.75rem;
}

.dash-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #737373;
}

.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.65rem;
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.quick-card:hover {
  text-decoration: none;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.quick-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--quick-accent, #3b82f6) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--quick-accent, #3b82f6) 35%, transparent);
  flex-shrink: 0;
}

.quick-card:nth-child(6n + 1) { --quick-accent: var(--dash-accent-1); }
.quick-card:nth-child(6n + 2) { --quick-accent: var(--dash-accent-2); }
.quick-card:nth-child(6n + 3) { --quick-accent: var(--dash-accent-3); }
.quick-card:nth-child(6n + 4) { --quick-accent: var(--dash-accent-4); }
.quick-card:nth-child(6n + 5) { --quick-accent: var(--dash-accent-5); }
.quick-card:nth-child(6n + 6) { --quick-accent: var(--dash-accent-6); }

.quick-card-icon i {
  font-size: 1.2rem;
  color: var(--quick-accent, #93c5fd);
}

.quick-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.quick-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #fafafa;
}

.quick-card-desc {
  font-size: 0.78rem;
  color: #737373;
  line-height: 1.35;
}

.quick-card-arrow {
  color: #525252;
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.quick-card:hover .quick-card-arrow {
  color: #a3a3a3;
  transform: translateX(2px);
}

.dash-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

@media (max-width: 960px) {
  .dash-columns {
    grid-template-columns: 1fr;
  }
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-time,
.activity-date {
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #a3a3a3;
}

.activity-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.activity-main strong {
  font-weight: 600;
  font-size: 0.9rem;
}

.activity-main .muted {
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .activity-item {
    grid-template-columns: 3rem 1fr;
  }

  .activity-item .badge,
  .activity-item .btn {
    grid-column: 2;
    justify-self: start;
  }

  .activity-item .btn {
    margin-top: 0.25rem;
  }
}

.empty-state-pro {
  padding: 2rem 1.25rem;
  text-align: center;
  color: #737373;
}

.empty-state-pro i {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #525252;
}

.empty-state-pro p {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
}

.studies-stat {
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.95) 0%, rgba(18, 18, 18, 0.98) 100%);
}

.auth-body {
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(255, 255, 255, 0.05), transparent 50%),
    radial-gradient(700px 400px at 100% 100%, rgba(255, 255, 255, 0.03), transparent 45%),
    var(--color-bg);
}

.auth-aside-title {
  font-weight: 700;
}

.auth-aside-badge {
  font-weight: 600;
}

.auth-panel-head h1 {
  font-weight: 700;
}

.auth-submit {
  font-weight: 600;
}

.auth-role-list li i {
  font-size: 1.15rem;
}

.app-footer {
  color: #525252;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

/* —— Shell lateral (v11) —— */
:root {
  --sidebar-width: 252px;
  --shell-bg: #080808;
}

.app-shell-body {
  overflow-x: hidden;
}

.app-shell {
  display: flex;
  min-height: 100dvh;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
  transition: width 0.22s ease, opacity 0.2s ease, border-color 0.22s ease;
}

.app-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.1rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-sidebar {
  min-width: 0;
}

.brand-icon-sm {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  border-radius: 10px;
}

.brand-sidebar .brand-text {
  font-size: 0.92rem;
  line-height: 1.25;
}

.brand-sidebar .brand-tagline {
  font-size: 0.68rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.app-sidebar-collapse,
.app-sidebar-close {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #d4d4d4;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  transition: background 0.12s ease, color 0.12s ease;
}

.app-sidebar-collapse:hover,
.app-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.app-sidebar-collapse {
  display: grid;
}

.app-sidebar-close {
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.65rem 1rem;
}

.sidebar-nav-group {
  margin-bottom: 1.1rem;
}

.sidebar-nav-label {
  display: block;
  padding: 0 0.55rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #525252;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.15rem;
  border-radius: 10px;
  color: #a3a3a3;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.sidebar-link i {
  font-size: 1.15rem;
  width: 1.25rem;
  text-align: center;
  opacity: 0.9;
}

.sidebar-link:hover {
  color: #fafafa;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.sidebar-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 3px 0 0 #fff;
}

.app-sidebar-foot {
  padding: 0.85rem 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.35);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  min-width: 0;
}

.sidebar-user .app-user-name {
  max-width: 100%;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #a3a3a3;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.app-shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--shell-bg);
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1.75rem 0;
  border-bottom: none;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-topbar-hint {
  font-size: 0.78rem;
  font-weight: 500;
  user-select: none;
}

.app-topbar-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e5e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-home {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a3a3a3;
  text-decoration: none;
  font-size: 1.1rem;
}

.app-topbar-home:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.operacion-nav {
  padding: 0 1.75rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(8, 8, 8, 0.6);
  position: sticky;
  top: 52px;
  z-index: 25;
}

.operacion-nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.operacion-nav-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.operacion-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #a3a3a3;
  text-decoration: none;
  border: 1px solid transparent;
}

.operacion-nav-link i {
  font-size: 1rem;
  opacity: 0.85;
}

.operacion-nav-link:hover {
  color: #e5e5e5;
  background: rgba(255, 255, 255, 0.04);
}

.operacion-nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.operacion-nav-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.operacion-nav-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #d4d4d4;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.operacion-nav-quick-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

@media (max-width: 960px) {
  .operacion-nav {
    padding: 0 1rem 0.65rem;
    top: 56px;
    overflow-x: auto;
  }

  .operacion-nav-row {
    flex-wrap: nowrap;
    min-width: min-content;
  }

  .operacion-nav-main {
    flex-wrap: nowrap;
  }

  .operacion-nav-quick {
    flex-wrap: nowrap;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
  }
}

@media (min-width: 961px) {
  body.sidebar-collapsed .app-sidebar {
    width: 0;
    opacity: 0;
    border-right-width: 0;
    pointer-events: none;
    overflow: hidden;
  }

  body.sidebar-collapsed .app-topbar {
    padding-top: 0.65rem;
  }
}

.app-menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.app-shell-main .app-main {
  max-width: none;
  width: 100%;
  padding: 1.5rem 1.75rem 2rem;
  margin: 0;
  box-sizing: border-box;
}

.app-shell-main .app-main:has(.machotes-hub),
.app-shell-main .app-main:has(.machotes-admin:not(.template-editor-page)),
.app-shell-main .app-main:has(.catalog-admin),
.app-shell-main .app-main:has(.reportes-page) {
  max-width: none;
  width: 100%;
}

.app-shell-main .app-footer-inner {
  max-width: none;
  width: 100%;
}

.app-shell-main .app-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  padding: 1.25rem 1.75rem 1.5rem;
}

.app-footer-inner {
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.app-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-footer-brand strong {
  font-size: 0.95rem;
  color: #e5e5e5;
}

.app-footer-slogan {
  font-size: 0.82rem;
  color: #737373;
}

.app-footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  line-height: 1.45;
}

.app-footer-contact span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.app-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.25rem;
}

.app-footer-nav a {
  color: #a3a3a3;
  text-decoration: none;
  font-weight: 600;
}

.app-footer-nav a:hover {
  color: #fff;
}

.app-footer-meta {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}

.dash-kpi-card-warn {
  --kpi-accent: var(--dash-accent-6);
  border-top-color: var(--dash-accent-6);
  border-color: rgba(244, 63, 94, 0.28);
  background: linear-gradient(160deg, rgba(244, 63, 94, 0.08) 0%, rgba(18, 18, 18, 0.9) 100%);
}

.recepcion-hoy {
  margin-bottom: 1.25rem;
}

.recepcion-hoy-date {
  font-size: 0.85rem;
}

.recepcion-hoy-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.recepcion-hoy-stat {
  display: flex;
  flex-direction: column;
  min-width: 100px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.12) 0%, rgba(255, 255, 255, 0.02) 100%);
  text-decoration: none;
  color: inherit;
}

.recepcion-hoy-stat:hover {
  border-color: rgba(59, 130, 246, 0.45);
}

.recepcion-hoy-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
}

.recepcion-hoy-stat-alert {
  border-color: rgba(244, 63, 94, 0.35);
  background: linear-gradient(160deg, rgba(244, 63, 94, 0.14) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.recepcion-hoy-stat-alert .recepcion-hoy-stat-value {
  color: #fda4af;
}

.recepcion-hoy-stat-label {
  font-size: 0.78rem;
  color: #737373;
  font-weight: 600;
}

.recepcion-hoy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.recepcion-hoy-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
}

.recepcion-hoy-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
}

.recepcion-hoy-patient {
  font-weight: 600;
}

.recepcion-hoy-study {
  font-size: 0.82rem;
}

.recepcion-hoy-empty {
  margin: 0 0 0.65rem;
}

.recepcion-hoy-more {
  display: inline-block;
  margin-top: 0.65rem;
}

@media (max-width: 560px) {
  .recepcion-hoy-item {
    grid-template-columns: auto 1fr;
  }

  .recepcion-hoy-study,
  .recepcion-hoy-item .btn {
    grid-column: 2;
  }
}

.modulos-sistema {
  margin-top: 1.5rem;
}

.modulos-sistema-lead {
  margin: 0;
  font-size: 0.88rem;
}

.modulos-sistema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.modulo-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.01) 100%);
  transition: border-color 0.12s, transform 0.12s;
}

.modulo-card:nth-child(8n + 1) { --mod-accent: var(--dash-accent-1); }
.modulo-card:nth-child(8n + 2) { --mod-accent: var(--dash-accent-4); }
.modulo-card:nth-child(8n + 3) { --mod-accent: var(--dash-accent-2); }
.modulo-card:nth-child(8n + 4) { --mod-accent: var(--dash-accent-5); }
.modulo-card:nth-child(8n + 5) { --mod-accent: var(--dash-accent-3); }
.modulo-card:nth-child(8n + 6) { --mod-accent: var(--dash-accent-2); }
.modulo-card:nth-child(8n + 7) { --mod-accent: var(--dash-accent-1); }
.modulo-card:nth-child(8n + 8) { --mod-accent: var(--dash-accent-6); }

.modulo-card:hover {
  border-color: color-mix(in srgb, var(--mod-accent, #3b82f6) 40%, transparent);
  transform: translateY(-1px);
}

.modulo-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modulo-card h3 i {
  color: var(--mod-accent, #93c5fd);
}

.modulo-card p {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  color: #a3a3a3;
  line-height: 1.45;
}

.modulo-card a {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--mod-accent, #93c5fd);
}

.caja-pos-shell .recepcion-hoy {
  margin-bottom: 1rem;
}

.caja-pos-hint-kbd {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--caja-muted, #737373);
}

.caja-pos-hint-kbd kbd {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid #444;
  font-size: 0.72rem;
  font-family: inherit;
}

.app-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  backdrop-filter: blur(2px);
}

@media (max-width: 960px) {
  .app-topbar {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 10, 10, 0.95);
  }

  .app-sidebar-collapse {
    display: none;
  }

  .app-sidebar-close {
    display: grid;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width);
  }

  .app-sidebar-close {
    display: grid;
    place-items: center;
  }

  .app-shell-main .app-main {
    padding: 1rem 1rem 1.75rem;
  }
}

.page-head {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.page-head h1 {
  font-size: 1.45rem;
}

.studies-stats {
  gap: 0.65rem;
}

.studies-stat {
  padding: 0.95rem 1.1rem;
}

.studies-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.studies-search,
.agenda-search {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(18, 18, 18, 0.8);
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.28);
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.28);
}

.alert-info {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.28);
}

.agenda-chip.is-active,
.agenda-view-tab.is-active,
.catalog-tab.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  font-weight: 600;
}

.agenda-chip.is-active .agenda-chip-count,
.catalog-tab.is-active .catalog-tab-count {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.agenda-view-tabs {
  background: rgba(0, 0, 0, 0.25);
}

.searchable-select-option:hover,
.searchable-select-option.is-highlighted {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.catalog-group-card {
  border-radius: var(--radius-lg);
}

.catalog-group-card-label {
  font-weight: 600;
}

.empty-state {
  padding: 2.5rem 1.5rem;
}

.empty-state.center p {
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card .table-wrap {
  padding: 0 0.25rem;
}

.table-card .data-table th:first-child,
.table-card .data-table td:first-child {
  padding-left: 1.15rem;
}

.table-card .data-table th:last-child,
.table-card .data-table td:last-child {
  padding-right: 1.15rem;
}

.ocr-status-loading {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.28);
}

.ocr-status-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.28);
}

.ocr-status-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.28);
}

.ocr-status-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.28);
}

.landing-topbar {
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.92);
}

.landing-hero h1 {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.feature-card {
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.feature-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.catalog-help-card {
  margin-bottom: 1.25rem;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

.catalog-help-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.catalog-help-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.catalog-help-list li {
  margin-bottom: 0.35rem;
}

.catalog-help-list a {
  color: #e5e5e5;
  font-weight: 600;
}

.catalog-form-hint {
  margin: -0.35rem 0 1rem;
  font-size: 0.88rem;
}

.catalog-add-card {
  scroll-margin-top: 1rem;
}

.catalog-panel {
  scroll-margin-top: 1rem;
}

/* Modal catálogo / genérico */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.app-modal[hidden] {
  display: none !important;
}

body.category-modal-open {
  overflow: hidden;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.app-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(92dvh, 720px);
  overflow: auto;
  padding: 0;
  margin: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.app-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.app-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.app-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.app-modal-body {
  padding: 1rem 1.15rem 1.15rem;
}

.app-modal-footer {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.catalog-edit-form .form-row label {
  display: block;
  margin-bottom: 0.75rem;
}

.catalog-edit-form select,
.catalog-edit-form input[type="text"],
.catalog-edit-form input[type="number"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #0a0a0a;
  color: #f5f5f5;
  font-family: inherit;
}

.catalog-panel .section-card-header h2 {
  margin: 0;
  font-size: 0.95rem;
}

/* —— Formularios unificados (edición en todo el sitio) —— */
.form-editor {
  max-width: 560px;
  padding: 1.25rem 1.35rem;
}

.form-field-hint {
  margin: -0.5rem 0 0.85rem;
  font-size: 0.82rem;
}

.form-stack label,
.form-card label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: #d4d4d4;
}

.form-stack label:last-child,
.form-card label.checkbox-label {
  margin-bottom: 0;
}

.form-stack input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.form-stack select,
.form-stack textarea,
.form-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.form-card select,
.form-card textarea,
.app-modal-body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.app-modal-body select,
.app-modal-body textarea,
.section-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.section-card select,
.section-card textarea {
  width: 100%;
  margin-top: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
  background: #141414;
  color-scheme: dark;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-stack select,
.form-card select,
.app-modal-body select,
.section-card select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  cursor: pointer;
}

.form-stack input::placeholder,
.form-card input::placeholder,
.app-modal-body input::placeholder {
  color: #737373;
}

.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus,
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus,
.app-modal-body input:focus,
.app-modal-body select:focus,
.app-modal-body textarea:focus {
  outline: none;
  border-color: #666;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
  background: #181818;
}

.form-stack input:-webkit-autofill,
.form-card input:-webkit-autofill,
.app-modal-body input:-webkit-autofill {
  -webkit-text-fill-color: var(--color-text);
  box-shadow: 0 0 0 1000px #141414 inset;
  transition: background-color 99999s ease-out;
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem !important;
  cursor: pointer;
  font-weight: 500 !important;
  color: #e5e5e5 !important;
}

.checkbox-label input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #e5e5e5;
  cursor: pointer;
  flex-shrink: 0;
}

.form-card .form-actions,
.form-stack .form-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.form-card fieldset,
.form-stack fieldset {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin: 0;
  padding: 1rem 1.1rem 0.35rem;
  background: rgba(0, 0, 0, 0.25);
}

.form-card legend,
.form-stack legend {
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a3a3a3;
  padding: 0 0.35rem;
}
