/* =====================================================================
   GinecoCare · Sistema de diseño
   Paleta: blanco, negro y azul. Tema claro / oscuro con variables CSS.
   ===================================================================== */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --border: #e3e8f0;
  --border-strong: #cfd7e3;
  --text: #0b1220;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-500: #2563eb;
  --primary-soft: #eaf0ff;
  --primary-soft-2: #d9e4ff;
  --on-primary: #ffffff;
  --ring: rgba(37, 99, 235, .28);

  --sidebar-bg: #0a0f1c;
  --sidebar-bg-2: #111827;
  --sidebar-text: #c7d0e0;
  --sidebar-muted: #7d8aa3;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #1d4ed8;
  --sidebar-hover: rgba(255, 255, 255, .06);

  --green: #16a34a;  --green-soft: #e8f7ee;
  --amber: #d97706;  --amber-soft: #fdf3e2;
  --red: #dc2626;    --red-soft: #fdecec;
  --rose: #e11d48;   --rose-soft: #fde9ef;
  --violet: #7c3aed; --violet-soft: #f1eafe;
  --cyan: #0891b2;   --cyan-soft: #e3f6fa;
  --slate: #475569;  --slate-soft: #eef1f5;
  --blue: #2563eb;   --blue-soft: #e8efff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #060a13;
  --surface: #0d1320;
  --surface-2: #111a2b;
  --surface-3: #172136;
  --border: #1d2940;
  --border-strong: #2a3a57;
  --text: #e8edf6;
  --text-2: #c3cce0;
  --muted: #8a97b0;
  --faint: #5f6d88;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-500: #3b82f6;
  --primary-soft: rgba(59, 130, 246, .14);
  --primary-soft-2: rgba(59, 130, 246, .24);
  --on-primary: #ffffff;
  --ring: rgba(59, 130, 246, .4);

  --sidebar-bg: #03060c;
  --sidebar-bg-2: #0a101c;
  --sidebar-hover: rgba(255, 255, 255, .05);
  --sidebar-active-bg: #2563eb;

  --green: #34d399;  --green-soft: rgba(52, 211, 153, .13);
  --amber: #fbbf24;  --amber-soft: rgba(251, 191, 36, .13);
  --red: #f87171;    --red-soft: rgba(248, 113, 113, .13);
  --rose: #fb7185;   --rose-soft: rgba(251, 113, 133, .13);
  --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .14);
  --cyan: #22d3ee;   --cyan-soft: rgba(34, 211, 238, .12);
  --slate: #a3b1c9;  --slate-soft: rgba(148, 163, 184, .12);
  --blue: #60a5fa;   --blue-soft: rgba(96, 165, 250, .14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
small, .small { font-size: 12px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
::selection { background: var(--primary-soft-2); }
:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.ti { font-size: 1.15em; line-height: 1; vertical-align: -.12em; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  transition: width .25s var(--ease), transform .25s var(--ease);
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.sidebar-brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .06); flex-shrink: 0;
  overflow: hidden;
}
.sidebar-brand .brand-logo {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; background: #fff;
  display: grid; place-items: center; overflow: hidden;
}
.sidebar-brand .brand-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.sidebar-brand .brand-text { min-width: 0; white-space: nowrap; }
/* Logo propio (ya trae el nombre): se muestra solo, sin recuadro; colapsado se ve sólo su extremo izquierdo */
.sidebar-brand.brand-custom { padding: 8px 18px; }
.sidebar-brand.brand-custom .brand-img { display: block; width: 100%; height: 100%; overflow: hidden; transition: width .2s; }
.sidebar-brand.brand-custom img { height: 100%; max-width: 100%; object-fit: contain; object-position: left center; display: block; }
.sidebar-collapsed .sidebar-brand.brand-custom { padding: 12px 25px; }
.sidebar-collapsed .sidebar-brand.brand-custom .brand-img { width: 26px; }
.sidebar-collapsed .sidebar-brand.brand-custom img { max-width: none; width: auto; }
.sidebar-brand .brand-name { color: #fff; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .brand-sub { color: var(--sidebar-muted); font-size: 11.5px; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 12px; scrollbar-width: thin; scrollbar-color: #243049 transparent; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--sidebar-muted); padding: 14px 12px 6px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; position: relative;
  padding: 9px 12px; margin-bottom: 2px; border-radius: 10px;
  color: var(--sidebar-text); font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item .ti { font-size: 20px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }
.nav-item .nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.nav-item.active .nav-count { background: #fff; color: var(--sidebar-active-bg); }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); flex-shrink: 0; }
.collapse-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  background: transparent; border: 0; color: var(--sidebar-muted); cursor: pointer; font: inherit; white-space: nowrap;
}
.collapse-btn:hover { background: var(--sidebar-hover); color: #fff; }
.collapse-btn .ti { font-size: 20px; width: 22px; transition: transform .25s var(--ease); }

/* colapsado horizontal */
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .sidebar .brand-text,
.sidebar-collapsed .sidebar .nav-text,
.sidebar-collapsed .sidebar .nav-label { opacity: 0; pointer-events: none; }
.sidebar-collapsed .sidebar .nav-label { height: 10px; padding: 0; margin: 8px 0; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-collapsed .sidebar .nav-item .nav-count { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.sidebar-collapsed .sidebar .collapse-btn .ti { transform: rotate(180deg); }
.sidebar-collapsed .sidebar-brand { padding: 0 19px; }
.sidebar .brand-text, .sidebar .nav-text, .sidebar .nav-label { transition: opacity .18s; }
.sidebar-collapsed .nav-item[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
  background: #0b1220; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); white-space: nowrap; z-index: 60;
}

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left .25s var(--ease); display: flex; flex-direction: column; }
.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-toggle { display: grid; flex-shrink: 0; }
.topbar-search { position: relative; flex: 1; max-width: 460px; }
.topbar-search .ti-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit;
}
.topbar-search input:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 4px var(--ring); }
.topbar-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface-2);
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 420px; overflow-y: auto; display: none; padding: 6px;
}
.search-results.open { display: block; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; color: var(--text); }
.search-results a:hover, .search-results a.hl { background: var(--primary-soft); }
.search-results .sr-meta { color: var(--muted); font-size: 12px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px;
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; font-size: 19px;
}
.icon-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; background: none; color: inherit; font: inherit; }
.user-chip:hover { background: var(--surface); border-color: var(--border); }
.user-chip .u-name { font-weight: 600; font-size: 13px; line-height: 1.2; text-align: left; }
.user-chip .u-role { font-size: 11.5px; color: var(--muted); text-align: left; }

.content { padding: 24px 28px; flex: 1; width: 100%; min-width: 0; }
.footer { padding: 16px 24px; color: var(--muted); font-size: 12px; text-align: center; }

.sidebar-backdrop { display: none; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-collapsed .sidebar .brand-text, .sidebar-collapsed .sidebar .nav-text, .sidebar-collapsed .sidebar .nav-label { opacity: 1; }
  .main, .sidebar-collapsed .main { margin-left: 0; }
  .topbar .menu-toggle { display: grid; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .sidebar .collapse-btn { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px; }
  .user-chip .u-text { display: none; }
}
@media (max-width: 640px) {
  .topbar-search kbd { display: none; }
}

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.page-head .crumbs a { color: var(--muted); }
.page-head .crumbs a:hover { color: var(--primary); }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .ti, .card-head h3 .ti { color: var(--primary-500); }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 20px; }
.card-body.p0, .p0 { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary-500); }
.stat .stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .stat-foot { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.hero { background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%); border-color: transparent; color: #fff; }
.stat.hero .stat-label, .stat.hero .stat-foot { color: rgba(255,255,255,.75); }
.stat.hero .stat-value { color: #fff; }
.stat.hero .stat-icon { background: rgba(255,255,255,.14); color: #fff; }
a.stat:hover { border-color: var(--primary-500); }

.tone-green .stat-icon { background: var(--green-soft); color: var(--green); }
.tone-amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.tone-red .stat-icon { background: var(--red-soft); color: var(--red); }
.tone-violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.tone-cyan .stat-icon { background: var(--cyan-soft); color: var(--cyan); }
.tone-rose .stat-icon { background: var(--rose-soft); color: var(--rose); }
.tone-slate .stat-icon { background: var(--slate-soft); color: var(--slate); }

/* ---------------------------------------------------------------- grid utils */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.grid-side { grid-template-columns: 320px minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main, .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }
.text-muted { color: var(--muted); } .text-faint { color: var(--faint); }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-primary { color: var(--primary-500); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .hide-sm { display: none !important; } }

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none;
}
.btn:hover { color: var(--btn-fg); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn .ti { font-size: 18px; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: var(--primary); box-shadow: 0 4px 14px rgba(29, 78, 216, .25); }
.btn-primary:hover { --btn-bg: var(--primary-hover); border-color: var(--primary-hover); }
.btn-dark { --btn-bg: #0b1220; --btn-fg: #fff; --btn-bd: #0b1220; }
:root[data-theme="dark"] .btn-dark { --btn-bg: #e8edf6; --btn-fg: #0b1220; --btn-bd: #e8edf6; }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-500); --btn-bd: transparent; }
.btn-soft:hover { --btn-bg: var(--primary-soft-2); border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { --btn-bg: var(--surface-3); border-color: transparent; }
.btn-danger { --btn-bg: var(--red-soft); --btn-fg: var(--red); --btn-bd: transparent; }
.btn-danger:hover { --btn-bg: var(--red); --btn-fg: #fff; border-color: var(--red); }
.btn-success { --btn-bg: var(--green); --btn-fg: #fff; --btn-bd: var(--green); }
:root[data-theme="dark"] .btn-success { --btn-fg: #052e16; }
.btn-wa { --btn-bg: #25d366; --btn-fg: #fff; --btn-bd: #25d366; }
.btn-wa:hover { --btn-bg: #1ebe5b; border-color: #1ebe5b; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn-sm .ti { font-size: 16px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 11px 0 0 11px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 11px 11px 0; }

/* segmented control (Hoy / Mañana / Semana ...) */
.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-3); border-radius: 12px; flex-wrap: wrap; }
.segmented a, .segmented button {
  padding: 7px 14px; border-radius: 9px; font: 600 13px var(--font); color: var(--text-2); background: transparent; border: 0; cursor: pointer; white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .active { background: var(--surface); color: var(--primary-500); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-3 { grid-column: span 3; } .form-grid .span-4, .form-grid .span-full { grid-column: 1 / -1; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-3, .form-grid .span-4 { grid-column: 1 / -1; } }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2, .form-grid .span-3 { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--red); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 4px var(--ring); }
.input[readonly], .input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select[multiple] { background-image: none; padding-right: 12px; min-height: 120px; }
.input-sm, .select.input-sm { min-height: 34px; padding: 5px 10px; font-size: 13px; border-radius: 9px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon {
  display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.input-icon { position: relative; }
.input-icon .ti { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary-500); margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 23px; border-radius: 12px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--primary-500); }
.switch input:checked::after { transform: translateX(17px); }
.form-section { padding: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 14px; }
.form-section-title .ti { color: var(--primary-500); font-size: 18px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* filtros */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table-compact td { padding: 8px 12px; }
.table-compact th { padding: 8px 12px; }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius-lg); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--radius-lg); }
.cell-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-person .name { font-weight: 600; color: var(--text); }
.cell-person .meta { font-size: 12px; color: var(--muted); }
.cell-time { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive td { padding: 3px 0; border: 0; }
  .table.responsive td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
  .table.responsive .actions { text-align: left; padding-top: 8px; }
}

/* ---------------------------------------------------------------- badges / avatars */
.badge {
  --b-bg: var(--slate-soft); --b-fg: var(--slate);
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px;
  font-size: 12px; font-weight: 600; background: var(--b-bg); color: var(--b-fg); white-space: nowrap;
}
.badge .ti { font-size: 14px; }
.badge-blue { --b-bg: var(--blue-soft); --b-fg: var(--blue); }
.badge-green { --b-bg: var(--green-soft); --b-fg: var(--green); }
.badge-amber { --b-bg: var(--amber-soft); --b-fg: var(--amber); }
.badge-red { --b-bg: var(--red-soft); --b-fg: var(--red); }
.badge-rose { --b-bg: var(--rose-soft); --b-fg: var(--rose); }
.badge-violet { --b-bg: var(--violet-soft); --b-fg: var(--violet); }
.badge-cyan { --b-bg: var(--cyan-soft); --b-fg: var(--cyan); }
.badge-slate { --b-bg: var(--slate-soft); --b-fg: var(--slate); }
.badge-solid { --b-bg: var(--primary); --b-fg: #fff; }
.dot-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.avatar {
  --av: 36px; width: var(--av); height: var(--av); border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: calc(var(--av) * .36);
  background: var(--primary-soft); color: var(--primary-500); overflow: hidden; letter-spacing: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --av: 30px; } .avatar-lg { --av: 56px; } .avatar-xl { --av: 84px; }
.avatar.dark { background: #0b1220; color: #fff; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; padding: 0 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 7px; padding: 13px 14px; font: 600 13.5px var(--font); color: var(--muted);
  border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .active { color: var(--primary-500); border-bottom-color: var(--primary-500); }
.tabs .count { background: var(--surface-3); color: var(--muted); border-radius: 7px; padding: 0 7px; font-size: 11.5px; }
.tabs .active .count { background: var(--primary-soft); color: var(--primary-500); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------------------------------------------------------------- alerts / empty */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-weight: 500; margin-bottom: 16px; border: 1px solid transparent; }
.alert .ti { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warning { background: var(--amber-soft); color: var(--amber); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ti { font-size: 44px; color: var(--faint); display: block; margin: 0 auto 10px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }

/* ---------------------------------------------------------------- lists / timeline */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary-500); }
.tl-item .tl-date { font-size: 12px; color: var(--muted); font-weight: 600; }
.tl-item .tl-title { font-weight: 700; margin: 2px 0; }

/* ---------------------------------------------------------------- dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
  display: none; animation: pop .14s var(--ease);
}
.dropdown-menu.left { right: auto; left: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--text-2); font: 500 13.5px var(--font); text-align: left; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); color: var(--text); }
.dropdown-menu .danger { color: var(--red); }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-menu .menu-head { padding: 8px 10px; font-size: 12px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- modal */
.modal { border: 0; padding: 0; border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.modal.modal-lg { width: min(860px, calc(100vw - 32px)); }
.modal.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px); }
.modal[open] { animation: pop .18s var(--ease); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 13px; background: #0b1220; color: #fff;
  box-shadow: var(--shadow-lg); font-weight: 500; animation: slidein .25s var(--ease);
}
.toast .ti { font-size: 20px; }
.toast.success .ti { color: #34d399; } .toast.error .ti { color: #f87171; } .toast.info .ti { color: #60a5fa; }
:root[data-theme="dark"] .toast { background: #e8edf6; color: #0b1220; }
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- pagination */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur {
  min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--text-2); padding: 0 8px;
}
.pagination a:hover { background: var(--surface-3); }
.pagination span.cur { background: var(--primary); color: #fff; }
.pagination .info { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: 320px; }
.chart-sm { height: 240px; } .chart-lg { height: 420px; }

/* ---------------------------------------------------------------- appointment cards / slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.slot {
  height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 13px var(--font); cursor: pointer; transition: all .12s;
}
.slot:hover { border-color: var(--primary-500); color: var(--primary-500); }
.slot.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.slot:disabled { opacity: .4; text-decoration: line-through; cursor: not-allowed; }

.appt { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: center; }
.appt:last-child { border-bottom: 0; }
.appt .appt-time { width: 64px; flex-shrink: 0; text-align: center; }
.appt .appt-time .t { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.appt .appt-time .d { font-size: 11px; color: var(--muted); }
.appt .appt-bar { width: 4px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.appt .appt-body { flex: 1; min-width: 0; }
.appt .appt-title { font-weight: 700; }
.appt .appt-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- patient header */
.patient-hero { display: flex; gap: 18px; align-items: center; padding: 22px; flex-wrap: wrap; }
.patient-hero .info { flex: 1; min-width: 240px; }
.patient-hero .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.meta-line { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 4px; }
.meta-line span { display: inline-flex; align-items: center; gap: 5px; }
.alert-strip { display: flex; gap: 8px; align-items: center; padding: 10px 22px; background: var(--red-soft); color: var(--red); font-weight: 600; font-size: 13px; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- repeater rows */
.repeater-row { display: grid; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin-bottom: 10px; position: relative; }
.repeater-row .remove-row { position: absolute; top: 8px; right: 8px; }

/* ---------------------------------------------------------------- autocomplete */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 70; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; padding: 5px; display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.ac-item:hover, .ac-item.hl { background: var(--primary-soft); }
.ac-item .sub { font-size: 12px; color: var(--muted); }
.ac-selected { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--primary-500); background: var(--primary-soft); border-radius: 10px; }

/* ---------------------------------------------------------------- FullCalendar theme */
.fc { --fc-border-color: var(--border); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: var(--primary-soft); --fc-now-indicator-color: #ef4444; --fc-event-text-color: #fff; font-size: 13px; }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; text-transform: capitalize; }
.fc .fc-button { background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong); font-weight: 600; text-transform: capitalize; box-shadow: none !important; border-radius: 9px; padding: 6px 12px; }
.fc .fc-button:hover { background: var(--surface-3); color: var(--text); }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 9px 0 0 9px; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 9px 9px 0; }
.fc .fc-col-header-cell-cushion { color: var(--text-2); font-weight: 700; padding: 8px 4px; text-transform: capitalize; }
.fc .fc-daygrid-day-number, .fc .fc-timegrid-slot-label-cushion { color: var(--muted); }
.fc .fc-event { border-radius: 7px; padding: 1px 3px; font-weight: 600; cursor: pointer; }
.fc .fc-timegrid-event .fc-event-main { padding: 2px 4px; }
.fc .ev-cancelada, .fc .ev-no_asistio { opacity: .45; text-decoration: line-through; }
.fc .ev-solicitada { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px) !important; }
.fc .ev-atendida { opacity: .75; }
.fc .fc-non-business { background: var(--surface-3); opacity: .6; }
.fc-theme-standard .fc-scrollgrid { border-radius: 12px; overflow: hidden; }
.fc .fc-list-event:hover td { background: var(--surface-2); }
.fc .fc-list-day-cushion { background: var(--surface-2); }

/* ---------------------------------------------------------------- auth pages */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface);
}
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 10% 10%, #2563eb 0%, transparent 55%), radial-gradient(900px 500px at 90% 90%, #1e3a8a 0%, transparent 60%), #050913;
}
.auth-art::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h1 { color: #fff; font-size: 38px; line-height: 1.12; max-width: 520px; letter-spacing: -.03em; }
.auth-art p { color: rgba(255,255,255,.72); font-size: 16px; max-width: 460px; }
.auth-feats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 520px; }
.auth-feat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 14px; font-size: 13px; color: rgba(255,255,255,.85); display: flex; gap: 10px; align-items: center; }
.auth-feat .ti { font-size: 22px; color: #93c5fd; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.auth-card .brand img { width: 48px; height: 48px; object-fit: contain; border-radius: 12px; background: #fff; padding: 4px; border: 1px solid var(--border); }
/* Logo propio: se muestra solo y sobre fondo oscuro para que un logo blanco se vea en tema claro */
.auth-logo { display: block; max-width: 280px; max-height: 120px; width: auto; height: auto; object-fit: contain; object-position: left center; }
.auth-card .brand.brand-custom { justify-content: center; padding: 18px 22px; border-radius: 18px; background: linear-gradient(135deg, var(--sidebar-bg), #13285c); }
.auth-card .brand.brand-custom img { width: auto; height: auto; max-width: 100%; max-height: 92px; background: none; border: 0; padding: 0; border-radius: 0; }
@media (min-width: 901px) { .auth-card .brand.brand-custom { display: none; } }
.auth-card h2 { font-size: 26px; letter-spacing: -.02em; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---------------------------------------------------------------- misc */
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--surface-3); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.progress { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary-500); border-radius: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); position: relative; }
.thumb img { width: 100%; height: 120px; object-fit: cover; }
.thumb .thumb-icon { height: 120px; display: grid; place-items: center; font-size: 40px; color: var(--muted); }
.thumb .thumb-cap { padding: 8px 10px; font-size: 12px; font-weight: 600; }
.thumb .thumb-cap .sub { color: var(--muted); font-weight: 500; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--border-strong); border-radius: 14px; padding: 28px 22px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--primary-500); color: var(--primary-500); background: var(--primary-soft); }
.thumb-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--danger, #ef4444); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); font-size: 14px; opacity: .85; transition: opacity .15s; padding: 0; }
.thumb-del:hover { opacity: 1; }
.upload-progress { display: none; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; background: var(--primary-soft, #eff6ff); color: var(--primary-600, #2563eb); font-size: 13px; font-weight: 600; }
.upload-progress.show { display: flex; }
.upload-progress i { animation: spin .7s linear infinite; }
.signature-pad { width: 100%; height: 180px; border: 1px dashed var(--border-strong); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.theme-switch { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 10px; gap: 2px; }
.theme-switch button { border: 0; background: none; width: 30px; height: 28px; border-radius: 7px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.theme-switch button.active { background: var(--surface); color: var(--primary-500); box-shadow: var(--shadow-sm); }
.sticky-actions { position: sticky; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); padding: 12px 0; margin-top: 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

@media print {
  .sidebar, .topbar, .page-actions, .no-print, .footer, .sticky-actions { display: none !important; }
  .main { margin: 0 !important; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.d-block { display: block; }
