/* =====================================================================
   RADIOLOGÍA ORAL DIGITAL — Sistema de diseño (TEMA CLARO)
   Logo oscuro → fondo claro. Negro #141C18 · Dorado #B8860B · Verde #1A6B4A
   Tipografías: DM Sans (cuerpo) + Syne (números y títulos)
   Easing: cubic-bezier(0.23, 1, 0.32, 1) · Mobile-first
   ===================================================================== */

:root {
  /* ---- Marca ---- */
  --negro:       #141C18;
  --dorado:      #B8860B;
  --dorado-ink:  #8A6608;   /* dorado oscurecido para texto (contraste AA) */
  --dorado-soft: #F4EAD0;   /* fondo de chips/acentos dorados */
  --verde:       #1A6B4A;
  --verde-600:   #14583D;
  --verde-soft:  #E6F1EB;   /* fondo de pills verdes */

  /* ---- Superficies (claro) ---- */
  --bg:        #F4F2EC;     /* fondo general (papel cálido) */
  --surface:   #FFFFFF;     /* tarjetas */
  --surface-2: #FAF9F5;     /* zonas suaves dentro de tarjetas */
  --header-bg: #FFFFFF;     /* header claro */

  /* ---- Tinta / texto ---- */
  --ink:    #141C18;        /* texto principal */
  --ink-2:  #46514A;        /* secundario (AA sobre blanco) */
  --ink-3:  #6B766E;        /* terciario / etiquetas (AA sobre blanco) */
  --line:   rgba(20, 28, 24, 0.10);
  --line-2: rgba(20, 28, 24, 0.06);

  /* ---- Estados ---- */
  --ok:        #1A6B4A;
  --ok-soft:   #E6F1EB;
  --warn:      #8A6608;
  --warn-soft: #F7EDD6;
  --danger:    #B23A3A;
  --danger-soft:#F7E3E3;
  --info:      #2B6CB0;
  --info-soft: #E6EFF8;

  /* ---- Tipografía ---- */
  --font-cuerpo: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-titulo: "Syne", var(--font-cuerpo);
  /* Números: DM Sans con cifras tabulares → línea base consistente y legible */
  --font-num:    "DM Sans", var(--font-cuerpo);

  /* ---- Movimiento ---- */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --dur:  .45s;
  --dur-fast: .2s;

  /* ---- Forma ---- */
  --r-lg: 20px;
  --r:    14px;
  --r-sm: 10px;
  --r-pill: 999px;

  /* ---- Sombras (suaves, tema claro) ---- */
  --sh-1: 0 1px 2px rgba(20,28,24,.05), 0 1px 1px rgba(20,28,24,.04);
  --sh-2: 0 1px 2px rgba(20,28,24,.05), 0 12px 28px -18px rgba(20,28,24,.30);
  --sh-3: 0 18px 48px -24px rgba(20,28,24,.40);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-cuerpo);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-titulo); letter-spacing: -0.015em; margin: 0; line-height: 1.2; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1; letter-spacing: -0.005em; }

a { color: var(--verde-600); text-decoration: none; }
a:hover { color: var(--verde); }

::selection { background: var(--dorado-soft); }

/* =====================================================================
   HEADER (claro)
   ===================================================================== */
.app-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.1);
}
.app-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: .8rem 1.1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand-logo { height: 38px; width: auto; max-width: 240px; object-fit: contain; display: block; }
.brand-logo--placeholder {
  height: 38px; min-width: 150px;
  border: 1px dashed var(--line); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase;
}
.header-right { display: flex; align-items: center; gap: .9rem; }
.header-date { color: var(--ink-3); font-size: .9rem; white-space: nowrap; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--verde); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-titulo); font-weight: 700; font-size: .9rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}

/* ---- Navegación por pestañas ---- */
.nav {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: .25rem;
  padding: 0 .7rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .8rem .8rem;
  color: var(--ink-3);
  font-weight: 500; font-size: .92rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--dorado); }
.nav a .ico { color: currentColor; }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1.1rem 3rem; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.1rem;
  align-items: start;
}
.stack { display: grid; gap: 1.1rem; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

/* =====================================================================
   TARJETAS / PANELES
   ===================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 1.15rem 1.2rem;
}
.panel { padding: 0; overflow: hidden; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 1.2rem;
  border-bottom: 1px solid var(--line-2);
}
.panel__title { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.panel__title .dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--green { background: var(--verde); }
.dot--gold  { background: var(--dorado); }
.dot--blue  { background: var(--info); }
.panel__body { padding: 1.1rem 1.2rem; }

/* =====================================================================
   KPI
   ===================================================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 1.1rem; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.kpi__label { color: var(--ink-3); font-size: .76rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; }
.kpi__value { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1; font-weight: 700; font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.01em; margin: .35rem 0 .25rem; }
.kpi__value.is-gold { color: var(--dorado-ink); }
.kpi__foot { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--ink-2); }
.trend { display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; }
.trend--up { color: var(--verde); }
.trend--warn { color: var(--warn); }

/* =====================================================================
   BOTONES
   ===================================================================== */
.btn {
  font-family: var(--font-cuerpo); font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: .65rem 1.05rem; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--dorado); color: #fff; box-shadow: 0 6px 16px -10px rgba(184,134,11,.9); }
.btn-primary:hover { background: #a9790a; }
.btn-green { background: var(--verde); color: #fff; }
.btn-green:hover { background: var(--verde-600); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--dorado); color: var(--dorado-ink); }
.btn-subtle { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-2); }
.btn-subtle:hover { color: var(--ink); border-color: var(--line); }
.btn-icon { padding: .55rem; width: 40px; height: 40px; }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }

/* =====================================================================
   FORMULARIOS
   ===================================================================== */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; color: var(--ink-2); font-weight: 600; margin-bottom: .35rem; }
.field .hint { color: var(--ink-3); font-size: .78rem; margin-top: .3rem; }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: .7rem .85rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--font-cuerpo); font-size: 1rem;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--dorado);
  box-shadow: 0 0 0 3px rgba(184,134,11,.16);
}
::placeholder { color: var(--ink-3); }

/* Buscador con icono */
.search { position: relative; }
.search .ico { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 2.6rem; }

/* Toggle Sí/No (botón visual, no select) */
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; background: var(--surface-2); }
.toggle button { border: 0; background: transparent; padding: .4rem .95rem; border-radius: var(--r-pill); font-weight: 600; color: var(--ink-3); cursor: pointer; transition: all var(--dur-fast) var(--ease); }
.toggle button.on-yes[aria-pressed="true"] { background: var(--verde); color: #fff; }
.toggle button.on-no[aria-pressed="true"]  { background: var(--danger); color: #fff; }

/* =====================================================================
   CHIPS DE FILTRO
   ===================================================================== */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: var(--r-pill);
  padding: .5rem .95rem; font-size: .88rem; font-weight: 500; cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--dorado); color: var(--ink); }
.chip.active { background: var(--negro); color: #fff; border-color: var(--negro); }

/* =====================================================================
   PILLS / BADGES DE ESTADO
   ===================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 600;
  padding: .3rem .7rem; border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--green { background: var(--ok-soft);   color: var(--ok); }
.pill--gold  { background: var(--dorado-soft); color: var(--warn); }
.pill--amber { background: var(--warn-soft); color: var(--warn); }
.pill--red   { background: var(--danger-soft); color: var(--danger); }
.pill--blue  { background: var(--info-soft); color: var(--info); }
.pill--muted { background: var(--surface-2); color: var(--ink-3); border-color: var(--line-2); }

/* =====================================================================
   LISTA DE REGISTRO DEL DÍA
   ===================================================================== */
.list { display: flex; flex-direction: column; }
.list__head, .list__row {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 110px 130px;
  align-items: center; gap: .75rem;
}
.list__head {
  padding: .6rem 1.2rem; border-bottom: 1px solid var(--line-2);
  color: var(--ink-3); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
}
.list__row {
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--line-2);
  transition: background var(--dur-fast) var(--ease);
}
.list__row:last-child { border-bottom: 0; }
.list__row:hover { background: var(--surface-2); }
.list__idx { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 700; }
.pac__name { font-weight: 600; line-height: 1.2; }
.pac__doc { color: var(--ink-3); font-size: .8rem; margin-top: .15rem; }
.tag-estudio {
  display: inline-block; margin-top: .35rem;
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: .25rem .6rem; font-size: .82rem; color: var(--ink-2);
}
.valor { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1; font-weight: 700; font-size: 1.05rem; }
@media (max-width: 560px) {
  .list__head { display: none; }
  .list__row { grid-template-columns: 28px 1fr auto; grid-template-areas: "idx pac val" "idx tag img"; row-gap: .4rem; }
  .list__idx { grid-area: idx; }
  .list__pac { grid-area: pac; }
  .valor { grid-area: val; text-align: right; }
  .list__img { grid-area: img; justify-self: end; }
}

/* =====================================================================
   AGENDA (sidebar)
   ===================================================================== */
.agenda-item { display: flex; align-items: center; gap: .85rem; padding: .75rem 0; border-bottom: 1px solid var(--line-2); }
.agenda-item:last-child { border-bottom: 0; }
.agenda-time { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--verde-600); min-width: 48px; }
.agenda-body { flex: 1; min-width: 0; }
.agenda-name { font-weight: 600; line-height: 1.2; }
.agenda-sub { color: var(--ink-3); font-size: .82rem; }

/* =====================================================================
   HEATMAP / FLUJO SEMANAL
   ===================================================================== */
.heat { }
.heat__label { color: var(--ink-3); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; margin-bottom: .6rem; }
.heat__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; text-align: center; }
.heat__dow { color: var(--ink-3); font-size: .72rem; font-weight: 600; margin-bottom: .35rem; }
.heat__cell { height: 38px; border-radius: var(--r-sm); background: var(--verde-soft); transition: transform var(--dur) var(--ease); }
.heat__cell:hover { transform: translateY(-2px); }
.heat__cell.l1 { background: #DCEDE3; }
.heat__cell.l2 { background: #B6DCC6; }
.heat__cell.l3 { background: #69B492; }
.heat__cell.l4 { background: #1A6B4A; }
.heat__cell.is-today { box-shadow: 0 0 0 2px var(--dorado); }
.heat__foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .8rem; font-size: .85rem; color: var(--ink-2); }

/* =====================================================================
   LOGIN
   ===================================================================== */
.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem;
  background:
    radial-gradient(1100px 500px at 50% -15%, rgba(26,107,74,.10), transparent 60%),
    var(--bg);
}
.login-card { width: 100%; max-width: 400px; text-align: center; animation: rise var(--dur) var(--ease) both; }
.login-card .card { padding: 2rem 1.75rem; }
.login-logo { height: 56px; width: auto; max-width: 260px; object-fit: contain; margin: 0 auto 1.5rem; display: block; }
.login-logo--placeholder { height: 56px; width: 220px; margin: 0 auto 1.5rem; border: 1px dashed var(--line); border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.login-card h1 { font-size: 1.3rem; }
.login-card .sub { color: var(--ink-3); font-size: .9rem; margin: .25rem 0 1.5rem; }
.login-card .field { text-align: left; }
.login-card .btn { width: 100%; margin-top: .4rem; }

/* =====================================================================
   ALERTAS
   ===================================================================== */
.alert { border-radius: var(--r-sm); padding: .7rem .9rem; font-size: .9rem; margin-bottom: 1rem; border: 1px solid; text-align: left; }
.alert-error { background: var(--danger-soft); border-color: rgba(178,58,58,.3); color: #8f2b2b; }
.alert-info  { background: var(--info-soft); border-color: rgba(43,108,176,.3); color: #1f5286; }
.alert-ok    { background: var(--ok-soft); border-color: rgba(26,107,74,.3); color: var(--verde-600); }

/* =====================================================================
   UTILIDADES
   ===================================================================== */
.muted { color: var(--ink-3); }

/* Estado vacío */
.empty { text-align: center; padding: 2.5rem 1.2rem; color: var(--ink-3); }
.empty .empty__ico { display: inline-flex; padding: .9rem; border-radius: 50%; background: var(--surface-2); color: var(--ink-3); margin-bottom: .8rem; }
.empty h3 { font-size: 1rem; color: var(--ink-2); margin-bottom: .3rem; }
.empty p { font-size: .9rem; margin: 0 0 1rem; }
.flex { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-sm { gap: .5rem; } .gap { gap: .85rem; }
.mt { margin-top: 1rem; } .mt-lg { margin-top: 1.5rem; }
.ico { display: inline-flex; vertical-align: middle; }
.footer-note { text-align: center; color: var(--ink-3); font-size: .78rem; padding: 2rem 1rem 1.5rem; }

/* Animación de entrada para tarjetas */
.rise { animation: rise var(--dur) var(--ease) both; }
.rise-2 { animation: rise var(--dur) var(--ease) .06s both; }
.rise-3 { animation: rise var(--dur) var(--ease) .12s both; }
.rise-4 { animation: rise var(--dur) var(--ease) .18s both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

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