/* ============================================================
   main.css — Variables, Reset y Estilos Base del OS
   HealTechOS · Light Mode Clínico · v2.0
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;400;500;600&family=DM+Mono:wght@400;500;600&display=swap');

/* ════════════════════════════════
   DESIGN TOKENS — Light Mode Clínico
════════════════════════════════ */
:root {
  /* Fondos */
  --bg:       #EFF4F9;
  --bg2:      #F7FAFE;

  /* Superficies */
  --surface:  #FFFFFF;
  --surface2: #F0F5FB;

  /* Bordes */
  --border:   #D4E2EF;
  --border2:  #B0C8E0;

  /* Paleta principal */
  --navy:     #0F2A4A;
  --blue:     #1A6FC4;
  --cyan:     #0D9488;
  --emerald:  #059669;
  --amber:    #C07010;
  --rose:     #C0392B;
  --violet:   #7C3AED;

  /* Texto */
  --text:     #1A2B3C;
  --muted:    #7A9BB5;
  --muted2:   #4A6A85;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  48px;
}

/* ════════════════════════════════
   RESET
════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Helpers de fuente ── */
.f-syne  { font-family: 'Instrument Serif', serif; }
.f-mono  { font-family: 'DM Mono', monospace; }

/* ── Helpers de espaciado ── */
.mb14 { margin-bottom: 14px; }
.mb20 { margin-bottom: 20px; }
.mt14 { margin-top: 14px; }

/* ════════════════════════════════
   TOP BAR
════════════════════════════════ */
#topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 0;
  z-index: 200;
  position: relative;
}

.tb-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Instrument Serif', serif;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: white;
  padding-right: 20px;
  border-right: 1px solid rgba(255,255,255,0.12);
  margin-right: 16px;
}

.tb-logo-icon {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-tabs { display: flex; gap: 2px; flex: 1; }

.role-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: rgba(255,255,255,0.45);
  transition: all 0.2s;
  border: 1px solid transparent;
  font-family: 'DM Sans', sans-serif;
}

.role-tab:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.07); }
.role-tab.active { color: white; background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.15); }
.role-tab .role-dot { width: 7px; height: 7px; border-radius: 50%; }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-time { font-family: 'DM Mono', monospace; font-size: 11px; color: rgba(255,255,255,0.35); }

.tb-notif {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.tb-notif:hover { background: rgba(255,255,255,0.12); }

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: var(--rose);
  border-radius: 50%;
  border: 1.5px solid var(--navy);
}

.tb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: white;
  cursor: pointer;
}

.tb-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--emerald);
  font-family: 'DM Mono', monospace;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse-g 2s infinite;
}

@keyframes pulse-g {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(5,150,105,0.4); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 4px rgba(5,150,105,0); }
}

/* ════════════════════════════════
   LAYOUT SHELL
════════════════════════════════ */
#shell { display: flex; flex: 1; overflow: hidden; }

/* ════════════════════════════════
   SIDEBAR
════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section { padding: 12px 8px 4px; }

.sidebar-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted2);
  transition: all 0.15s;
  position: relative;
  user-select: none;
  margin-bottom: 1px;
}

.nav-item:hover { color: var(--text); background: var(--surface2); }

.nav-item.active { color: var(--navy); background: #E8F0FA; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 2px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
}

.nav-icon { width: 16px; height: 16px; min-width: 16px; opacity: 0.65; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  background: rgba(26,111,196,0.1);
  color: var(--blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.nav-badge.red    { background: rgba(192,57,43,0.1); color: var(--rose); }
.nav-badge.green  { background: rgba(5,150,105,0.1); color: var(--emerald); }
.nav-badge.amber  { background: rgba(192,112,16,0.1); color: var(--amber); }

/* Submenu */
.nav-arrow {
  margin-left: auto;
  width: 12px;
  height: 12px;
  min-width: 12px;
  transition: transform 0.2s;
  color: var(--muted);
}

.nav-item.open .nav-arrow { transform: rotate(90deg); }
.submenu { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.submenu.open { max-height: 300px; }

.sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11.5px;
  color: var(--muted);
  transition: all 0.15s;
  margin-bottom: 1px;
}

.sub-item:hover  { color: var(--text); background: var(--surface2); }
.sub-item.active { color: var(--blue); }
.sub-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; min-width: 4px; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-card:hover { background: var(--surface2); }

.user-av {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

.user-name { font-size: 12px; font-weight: 600; color: var(--text); }
.user-role { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* ════════════════════════════════
   MAIN WORKSPACE
════════════════════════════════ */
#workspace { flex: 1; overflow: hidden; position: relative; background: var(--bg); }

/* ════════════════════════════════
   ROLE VIEWS
════════════════════════════════ */
.role-view { display: none; width: 100%; height: 100%; overflow: hidden; }
.role-view.active { display: flex; flex-direction: column; }

/* ════════════════════════════════
   MODULE PANELS
════════════════════════════════ */
.module-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  animation: panelIn 0.2s ease;
}

.module-panel::-webkit-scrollbar { width: 4px; }
.module-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.module-panel.active { display: block; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════
   BREADCRUMB
════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.bc-item    { font-size: 11px; color: var(--muted); font-family: 'DM Mono', monospace; }
.bc-sep     { color: var(--muted); font-size: 10px; }
.bc-current { color: var(--text); font-weight: 600; font-size: 11px; }
.bc-actions { margin-left: auto; display: flex; gap: 6px; }

.bc-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid transparent;
}

.bc-btn-primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.bc-btn-primary:hover { filter: brightness(1.1); }

.bc-btn-ghost {
  background: white;
  color: var(--muted2);
  border-color: var(--border);
}

.bc-btn-ghost:hover { color: var(--text); border-color: var(--border2); }

/* ════════════════════════════════
   GRID LAYOUTS
════════════════════════════════ */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4    { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-main-rev { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }

/* ════════════════════════════════
   CARDS
════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover { border-color: var(--border2); box-shadow: 0 2px 12px rgba(15,42,74,0.05); }
.card-sm { padding: 12px; }

.card-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-title-icon { width: 16px; height: 16px; opacity: 0.7; }

/* KPI Cards */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.kpi:hover { box-shadow: 0 4px 16px rgba(15,42,74,0.07); }

.kpi-label {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.kpi-value {
  font-family: 'Instrument Serif', serif;
  font-size: 28px;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-value span { font-size: 14px; color: var(--muted); font-weight: 400; font-family: 'DM Sans', sans-serif; }

.kpi-delta { display: flex; align-items: center; gap: 4px; font-size: 11px; margin-top: 6px; }
.kpi-delta.up      { color: var(--emerald); }
.kpi-delta.down    { color: var(--rose); }
.kpi-delta.neutral { color: var(--amber); }

.kpi-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.kpi-bar-fill { height: 100%; border-radius: 2px; transition: width 1s ease; }

/* Section headers */
.sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sec-title { font-family: 'Instrument Serif', serif; font-size: 15px; color: var(--navy); letter-spacing: -0.01em; }
.sec-link { font-size: 11px; color: var(--blue); cursor: pointer; font-family: 'DM Mono', monospace; }

/* ════════════════════════════════
   TABLES
════════════════════════════════ */
.htable { width: 100%; border-collapse: collapse; }

.htable th {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: #F5F9FD;
}

.htable td {
  padding: 9px 10px;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.htable tr:last-child td { border-bottom: none; }
.htable tr:hover td { background: #F7FAFE; }

/* ════════════════════════════════
   STATUS PILLS
════════════════════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
}

.pill-green  { background: rgba(5,150,105,0.1);   color: var(--emerald); border: 1px solid rgba(5,150,105,0.2); }
.pill-red    { background: rgba(192,57,43,0.1);   color: var(--rose);    border: 1px solid rgba(192,57,43,0.2); }
.pill-amber  { background: rgba(192,112,16,0.1);  color: var(--amber);   border: 1px solid rgba(192,112,16,0.2); }
.pill-blue   { background: rgba(26,111,196,0.1);  color: var(--blue);    border: 1px solid rgba(26,111,196,0.2); }
.pill-violet { background: rgba(124,58,237,0.1);  color: var(--violet);  border: 1px solid rgba(124,58,237,0.2); }

/* ════════════════════════════════
   AVATARES
════════════════════════════════ */
.av {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ════════════════════════════════
   MINI CHARTS
════════════════════════════════ */
.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 40px; }

.mc-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: rgba(26,111,196,0.2);
  transition: background 0.2s;
  position: relative;
}

.mc-bar:hover { background: var(--blue); }
.mc-bar.active { background: var(--blue); }

/* ════════════════════════════════
   PROGRESS RING
════════════════════════════════ */
.prog-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.prog-ring svg { transform: rotate(-90deg); }
.prog-ring-label { position: absolute; text-align: center; font-family: 'Instrument Serif', serif; font-weight: 400; font-size: 18px; color: var(--navy); }
.prog-ring-sub { font-size: 9px; color: var(--muted); font-family: 'DM Mono', monospace; }

/* ════════════════════════════════
   TIMELINE
════════════════════════════════ */
.timeline { display: flex; flex-direction: column; gap: 0; }

.tl-item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.tl-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tl-dot-inner { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tl-content   { flex: 1; }
.tl-time  { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); }
.tl-text  { font-size: 12px; color: var(--text); margin-top: 1px; }
.tl-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ════════════════════════════════
   ACTIVITY FEED
════════════════════════════════ */
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.feed-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.feed-text { font-size: 12px; color: var(--text); line-height: 1.5; }
.feed-time { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ════════════════════════════════
   ALERTS
════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid;
}

.alert-critical { background: rgba(192,57,43,0.05);   border-color: rgba(192,57,43,0.2); }
.alert-warning  { background: rgba(192,112,16,0.05);  border-color: rgba(192,112,16,0.2); }
.alert-info     { background: rgba(26,111,196,0.05);  border-color: rgba(26,111,196,0.15); }
.alert-icon     { flex-shrink: 0; margin-top: 1px; }
.alert-title    { font-size: 12px; font-weight: 600; color: var(--text); font-family: 'DM Sans', sans-serif; }
.alert-desc     { font-size: 11px; color: var(--muted2); margin-top: 2px; line-height: 1.5; }

/* ════════════════════════════════
   CHAT BUBBLES
════════════════════════════════ */
.chat-wrap { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.chat-msg  { display: flex; gap: 8px; align-items: flex-end; }
.chat-msg.bot  { flex-direction: row; }
.chat-msg.user { flex-direction: row-reverse; }

.chat-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.chat-msg.bot  .chat-bubble { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 12px 12px 12px 3px; }
.chat-msg.user .chat-bubble { background: var(--blue); color: white; border-radius: 12px 12px 3px 12px; }
.chat-av { width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0; }

/* ════════════════════════════════
   VITALES
════════════════════════════════ */
.vital-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.vital-row:last-child { border-bottom: none; }
.vital-name { font-size: 11px; color: var(--muted2); width: 100px; flex-shrink: 0; font-family: 'DM Mono', monospace; }
.vital-val  { font-family: 'Instrument Serif', serif; font-size: 18px; color: var(--navy); flex: 1; }
.vital-unit { font-size: 10px; color: var(--muted); margin-top: 2px; }
.vital-sparkline { display: flex; align-items: flex-end; gap: 2px; height: 20px; margin-left: auto; }
.vs-bar     { width: 3px; background: rgba(26,111,196,0.3); border-radius: 1px; }
.vs-bar.hi  { background: var(--rose); }
.vs-bar.ok  { background: var(--emerald); }

/* ════════════════════════════════
   WAVEFORM
════════════════════════════════ */
.waveform-mini { display: flex; align-items: center; gap: 2px; height: 20px; }
.wm-bar { width: 2px; background: var(--blue); border-radius: 1px; animation: wm 1s ease-in-out infinite; }
@keyframes wm { 0%,100%{ height: 3px; opacity: 0.3; } 50%{ height: 16px; opacity: 1; } }

/* ════════════════════════════════
   SPLASH
════════════════════════════════ */
#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: splashOut 0.5s ease 2.5s both;
}

@keyframes splashOut { to { opacity: 0; pointer-events: none; visibility: hidden; } }

.splash-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 32px;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  animation: fadeUp 0.6s ease 0.2s both;
}

.splash-logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 40px;
  animation: fadeUp 0.6s ease 0.4s both;
}

.splash-loader {
  width: 160px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 1px;
  animation: fadeUp 0.6s ease 0.6s both;
  overflow: hidden;
}

.splash-loader-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 1px;
  animation: load 2s ease 0.6s both;
}

@keyframes load    { from { width: 0; } to { width: 100%; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ════════════════════════════════
   BG ORBS (decoración — ahora sutiles en light)
════════════════════════════════ */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(100px);
  animation: float-orb 10s ease-in-out infinite;
}

@keyframes float-orb { 0%,100%{ transform: translate(0,0); } 50%{ transform: translate(20px,-20px); } }

/* ════════════════════════════════
   TYPING CURSOR
════════════════════════════════ */
.typing-cursor-mini {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--blue);
  margin-left: 1px;
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

@keyframes blink { 0%,100%{ opacity: 1; } 50%{ opacity: 0; } }

/* ════════════════════════════════════════════════════════════
   CLASES UTILITARIAS — Reemplazo de estilos inline
   HealTechOS · añadidas por setup_healtechos_frontend.sh
   ════════════════════════════════════════════════════════════ */

/* Tipografía */
.f-serif  { font-family: 'Instrument Serif', serif; }
.f-sans   { font-family: 'DM Sans', sans-serif; }
.f-mono   { font-family: 'DM Mono', monospace; }

/* Colores de texto con peso */
.text-success-bold  { color: var(--emerald); font-weight: 700; }
.text-warn-bold     { color: var(--amber);   font-weight: 700; }
.text-primary-bold  { color: var(--blue);    font-weight: 700; }
.text-error-bold    { color: var(--rose);    font-weight: 700; }
.text-muted-bold    { color: var(--muted);   font-weight: 700; }
.text-navy-bold     { color: var(--navy);    font-weight: 700; }
.text-violet-bold   { color: var(--violet);  font-weight: 700; }

/* Colores de texto simples */
.text-success  { color: var(--emerald); }
.text-warn     { color: var(--amber); }
.text-primary  { color: var(--blue); }
.text-error    { color: var(--rose); }
.text-muted    { color: var(--muted); }
.text-navy     { color: var(--navy); }
.text-violet   { color: var(--violet); }
.text-cyan     { color: var(--cyan); }

/* Pesos de fuente */
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Estado vacío genérico */
.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
}

/* Alineación de texto */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }


/* ════════════════════════════════════════════════════════════
   CLASES UTILITARIAS — Fase 2 · cleanup_inline_styles.sh
   ════════════════════════════════════════════════════════════ */

/* Empty state genérico (versiones muted y muted2) */
.empty-state,
.empty-state-sm {
  text-align: center;
  color: var(--muted2);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
}
.empty-state    { padding: 20px; }
.empty-state-sm { padding: 16px; }

/* Inputs de búsqueda RUT / paciente */
.input-search {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.input-search:focus { border-color: var(--blue); }
.input-search-sm    { width: 180px; }
.input-search-md    { width: 200px; }
.input-search-lg    { width: 100%; }

/* Selects inline */
.select-inline {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.select-inline:focus { border-color: var(--blue); }

/* Avatares de paciente con gradientes de rol */
/* Uso: <div class="av av-cyan">JP</div>  */
.av-cyan   { background: linear-gradient(135deg, #388bfd, #39d4d4); }
.av-violet { background: linear-gradient(135deg, #bc8cff, #9333ea); }
.av-rose   { background: linear-gradient(135deg, #f85149, #dc2626); }
.av-green  { background: linear-gradient(135deg, #23d18b, #059669); }
/* Estilos fijos que van junto con .av (ya definida en main.css) */
.av {
  font-size: 9px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
}

/* KPI hero — número grande de impacto */
.kpi-hero-success { font-family: 'DM Sans', sans-serif; font-size: 20px; font-weight: 800; color: var(--emerald); }
.kpi-hero-primary { font-family: 'DM Sans', sans-serif; font-size: 20px; font-weight: 800; color: var(--blue); }

/* Títulos de panel sobre fondo oscuro (navy/gradient) */
.panel-title-white    { font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700; color: white; }
.panel-subtitle-white { font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 700; color: white; }
.panel-subtitle-white-mb { font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 700; color: white; margin-bottom: 4px; display: flex; }

/* Monospace semánticos */
.mono-muted  { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted2); }
.mono-ok     { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--emerald); }
.mono-error  { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--rose); font-weight: 600; }

/* Text warn bold (amber) */
.text-warn-bold { color: var(--amber); font-weight: 700; }


/* ════════════════════════════════════════════════════════════
   DARK MODE — Design system invertido
   Activado con: <html data-theme="dark">
   Toggle JS: toggleTheme() en ui-controller.js
   ════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
  /* Fondos — azul medianoche profundo, no negro puro */
  --bg:       #0D1117;
  --bg2:      #111820;

  /* Superficies — capas elevadas sobre el fondo */
  --surface:  #161D27;
  --surface2: #1C2533;

  /* Bordes — visibles pero no agresivos */
  --border:   #243044;
  --border2:  #2E3F58;

  /* Texto — frío, legible, no blanco puro */
  --text:     #E2EAF4;
  --muted:    #5A7A96;
  --muted2:   #7A9BB5;

  /* Paleta accent — aclarada ~10% para contraste sobre oscuro */
  --navy:     #0F2A4A;   /* topbar: se mantiene igual, ya es oscuro */
  --blue:     #3B8FE8;   /* acción primaria — más brillante */
  --cyan:     #14B8A6;   /* acción secundaria */
  --emerald:  #10B981;   /* éxito */
  --amber:    #D97706;   /* advertencia */
  --rose:     #EF4444;   /* error */
  --violet:   #8B5CF6;   /* IA */
}

/* Transición suave al cambiar tema */
body,
#sidebar,
#workspace,
.card,
.module-panel,
.nav-item,
.sub-item,
.appt-card,
.med-card,
.billing-verify-row,
.insight-card {
  transition:
    background-color 0.25s ease,
    border-color     0.25s ease,
    color            0.2s  ease;
}

/* Scrollbar dark */
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg2); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border2); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Splash screen en dark */
[data-theme="dark"] #splash { background: #080D14; }

/* Input/select en dark */
[data-theme="dark"] .input-search,
[data-theme="dark"] .select-inline {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .input-search::placeholder { color: var(--muted); }

/* Quick suggest buttons en dark */
[data-theme="dark"] .quick-suggest-btn {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--muted2);
}
[data-theme="dark"] .quick-suggest-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* Chat bubbles en dark */
[data-theme="dark"] .chat-bubble {
  background: var(--surface2);
  color: var(--text);
}
[data-theme="dark"] .chat-msg.user .chat-bubble {
  background: rgba(59,143,232,0.15);
}

/* Scribe transcript en dark */
[data-theme="dark"] .scribe-transcript {
  background: var(--bg2);
  color: var(--muted2);
}

/* Bed cells en dark — mantener colores semánticos */
[data-theme="dark"] .bed-cell          { background: var(--surface2); }
[data-theme="dark"] .bed-cell.occupied { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.25); }
[data-theme="dark"] .bed-cell.free     { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.25); }
[data-theme="dark"] .bed-cell.cleaning { background: rgba(217,119,6,0.1);  border-color: rgba(217,119,6,0.25); }
[data-theme="dark"] .bed-cell.reserved { background: rgba(59,143,232,0.1); border-color: rgba(59,143,232,0.25); }

/* Toggle button — estado visual */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--muted2);
  font-size: 15px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#theme-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

/* av-amber — gradiente para avatares (añadido por apply_audit_fixes.sh) */
.av-amber { background: linear-gradient(135deg, #e5a000, #f85149); }


/* public/assets/js/attendance.js */

/* Attendance UI Classes */
.ht-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ht-modal-card {
    background: var(--surface); border-radius: 12px; width: 100%;
    max-width: 320px; box-shadow: 0 8px 32px rgba(0,0,0,.2); overflow: hidden;
}
.ht-modal-header {
    padding: 16px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.ht-modal-title { margin: 0; font-weight: 700; color: var(--text); }
.ht-modal-close { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; }
.ht-modal-body { padding: 24px; }

.ht-pin-input {
    width: 100%; text-align: center; font-size: 32px; letter-spacing: 12px;
    border: 2px solid var(--border); border-radius: 8px; padding: 8px;
    background: var(--surface2); color: var(--text); outline: none; box-sizing: border-box;
}

.ht-btn-submit {
    width: 100%; padding: 12px; border-radius: 8px; font-weight: 700;
    color: white; border: none; cursor: pointer; margin-top: 10px;
}
.btn-entry { background: var(--emerald); }
.btn-exit { background: var(--rose); }

.ht-map-container { height: 140px; border-radius: 8px; overflow: hidden; margin-bottom: 12px; display: none; border: 1px solid var(--border); }
.ht-map-container.is-visible { display: block; }

/* Dots Status */
.ht-attendance-indicator { cursor: pointer; transition: all 0.2s; }
.ht-attendance-indicator.is-active { background-color: var(--emerald) !important; box-shadow: 0 0 8px var(--emerald); }
.ht-attendance-indicator.is-closed { background-color: var(--rose) !important; box-shadow: none; }


