/* ==========  DocTippan · Branding: negro, dorado y azul marino  ========== */
:root {
  color-scheme: light;
  --ink: #111112;
  --ink-2: #1b1b1d;
  --ink-3: #2a2a2d;
  --gold: #c9a24a;
  --gold-2: #e9cf86;
  --gold-3: #a8822f;
  --gold-soft: #f7efd9;
  --navy: #1f3c6e;
  --navy-soft: #e8eef8;
  --bg: #f5f3ee;
  --card: #ffffff;
  --line: #e7e2d6;
  --line-2: #efebe2;
  --text: #1c1b19;
  --muted: #74716a;
  --muted-2: #a19d93;
  --pink: #d63384;
  --pink-soft: #fdeaf3;
  --blue: #2563eb;
  --blue-soft: #e7efff;
  --ok: #15803d;
  --ok-soft: #e6f6ec;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 12, .05), 0 6px 24px -12px rgba(20, 18, 12, .18);
  --shadow-lg: 0 24px 64px -24px rgba(20, 18, 12, .45);
  --sidebar: 248px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(201, 162, 74, .16), transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, #0a0a0b 100%);
  color: #e9e6df; display: flex; flex-direction: column; padding: 18px 14px;
  border-right: 1px solid rgba(201, 162, 74, .18);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 20px; border-bottom: 1px solid rgba(255, 255, 255, .07); margin-bottom: 14px; }
.brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: #fff; padding: 4px; box-shadow: 0 0 0 1px rgba(201, 162, 74, .5); }
.brand strong { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; color: #fff; line-height: 1.05; letter-spacing: .2px; }
.brand span { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold-2); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: #77736a; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #c9c5bc; font-weight: 600; font-size: 13.5px; transition: background .15s, color .15s; position: relative;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(201, 162, 74, .22), rgba(201, 162, 74, .04)); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav a.active svg { color: var(--gold-2); }
.nav .badge { margin-left: auto; background: var(--gold); color: var(--ink); font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { font-size: 11px; color: #77736a; padding: 12px 8px 2px; display: flex; align-items: center; gap: 8px; }
.sidebar-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }

.sidebar-foot .logout { margin-left: auto; background: transparent; border: 1px solid #3a3833; color: #c9c5bc; border-radius: 8px; padding: 4px 10px; font-size: 11.5px; font-weight: 700; }
.sidebar-foot .logout:hover { border-color: var(--gold); color: #fff; }
.login { position: fixed; inset: 0; z-index: 300; display: grid; grid-template-columns: 1.2fr 1fr; background: #0b0b0c; }
.login-art { background: url(/assets/portadaApp.png) 82% center / cover no-repeat; }
.login-card { align-self: center; justify-self: center; width: min(380px, calc(100% - 32px)); display: grid; gap: 16px; padding: 34px 30px; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); }
.login-card img { width: 64px; height: 64px; object-fit: contain; }
.login-card h1 { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.login-card p { margin: -8px 0 4px; color: var(--muted); font-size: 13px; }
.login-err { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 18px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; overflow-x: clip; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(245, 243, 238, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs b { color: var(--text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--muted-2); }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.menu-btn { display: none; }
.view { padding: 26px 28px 120px; max-width: 1360px; width: 100%; }

/* ---------- Primitivos ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.4px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.1px; }
.card-h .count { font-size: 11px; font-weight: 800; background: var(--line-2); color: var(--muted); padding: 2px 8px; border-radius: 99px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.empty { text-align: center; color: var(--muted-2); padding: 28px 12px; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 700; font-size: 13.5px; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #d6cfbf; background: #fbfaf7; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--ink-3); }
.btn.gold {
  background: linear-gradient(135deg, #e7c76f 0%, #c9a24a 45%, #a8822f 100%); border: 1px solid #a8822f; color: #1d1608;
  box-shadow: 0 6px 18px -8px rgba(168, 130, 47, .8), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.btn.gold:hover { filter: brightness(1.05); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #f3c4c4; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { background: rgba(0, 0, 0, .05); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.field .hint { font-size: 11.5px; color: var(--muted-2); }
.field .hint.bad { color: var(--warn); }
.field .hint.good { color: var(--ok); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s; font-size: 14px;
}
.textarea { height: auto; min-height: 70px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 162, 74, .16); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2374716a' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

/* Segmented / toggles */
.seg { display: inline-flex; background: #f1eee6; border-radius: 11px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 16px; border-radius: 8px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--ink); color: #fff; box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .35); }
.seg button.on.f { background: var(--pink); }
.seg button.on.m { background: var(--blue); }
.seg.wide { display: flex; } .seg.wide button { flex: 1; justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line);
  background: #fff; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .12s;
}
.chip:hover { border-color: #d6cfbf; color: var(--text); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.gold.on { background: var(--gold-soft); border-color: var(--gold); color: #6d5317; }
.chip .x { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .2); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.tag.gold { background: var(--gold-soft); color: #7a5c17; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.pink { background: var(--pink-soft); color: var(--pink); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

/* Avatar */
.avatar { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; letter-spacing: .3px; }
.avatar.f { background: var(--pink-soft); color: var(--pink); }
.avatar.m { background: var(--blue-soft); color: var(--blue); }
.avatar.n { background: var(--line-2); color: var(--muted); }
.avatar.xl { width: 72px; height: 72px; border-radius: 20px; font-size: 24px; }
.name-f { color: var(--pink); } .name-m { color: var(--blue); }

/* ---------- Lista de pacientes ---------- */
.search {
  position: relative; flex: 1; min-width: 240px; max-width: 520px;
}
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.search .input { padding-left: 42px; height: 46px; border-radius: 12px; font-size: 14.5px; box-shadow: var(--shadow); }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--muted-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: #faf9f6; }
.plist { display: flex; flex-direction: column; gap: 10px; }
.prow {
  display: grid; grid-template-columns: auto minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: all .15s;
}
.prow:hover { border-color: #dccfae; box-shadow: var(--shadow); transform: translateY(-1px); }
.prow .nm b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .nm span { color: var(--muted); font-size: 13px; }
.prow .meta { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.prow .meta b { color: var(--text); font-weight: 700; }
.prow .acts { display: flex; gap: 4px; align-items: center; }
.prow .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }

/* ---------- Detalle paciente ---------- */
.hero {
  position: relative; overflow: hidden; padding: 24px; border-radius: 18px; color: #fff;
  background: radial-gradient(90% 140% at 100% 0%, rgba(201, 162, 74, .35), transparent 55%), linear-gradient(135deg, #151517, #0b0b0c);
  box-shadow: var(--shadow-lg); display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center;
}
.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; background: url(/assets/logoDocMejorado.png) center/contain no-repeat; opacity: .07; filter: grayscale(1) brightness(3); }
.hero h2 { margin: 0; font-size: 26px; letter-spacing: -.4px; font-weight: 800; }
.hero .sub { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; color: #cfcac0; font-size: 13px; }
.hero .sub span { display: inline-flex; align-items: center; gap: 6px; }
.hero .avatar.f { background: rgba(214, 51, 132, .18); color: #ff8cc3; }
.hero .avatar.m { background: rgba(37, 99, 235, .2); color: #8fb3ff; }
.hero .cta { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.qa {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border-radius: var(--radius); background: #fff;
  border: 1px solid var(--line); text-align: left; transition: all .15s; font-weight: 700; color: var(--text);
}
.qa:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #dccfae; }
.qa .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.qa small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: -6px; }
.qa.primary { background: linear-gradient(135deg, #1a1a1c, #0e0e0f); color: #fff; border-color: #000; }
.qa.primary small { color: #bdb7aa; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.dl div > span { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.dl div > p { margin: 0; font-weight: 600; white-space: pre-wrap; display: flex; gap: 6px; align-items: center; }
.dl .full { grid-column: 1 / -1; }
.lastc { display: flex; flex-direction: column; gap: 14px; }
.lastc .vit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.vt { background: #faf8f3; border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; }
.vt span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.vt b { font-size: 17px; font-weight: 800; }
.vt b small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.rx-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rx-list li { padding: 9px 12px; background: #faf8f3; border-radius: 10px; font-size: 13px; border-left: 3px solid var(--gold); }
.rx-list li b { display: block; }
.rx-list li span { color: var(--muted); font-size: 12.5px; }
.reps { width: 100%; border-collapse: collapse; }
.reps td, .reps th { padding: 11px 20px; text-align: left; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.reps th { font-size: 11.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.reps tr:last-child td { border-bottom: 0; }
.wa-link { display: inline-flex; align-items: center; gap: 6px; color: #128c4a; font-weight: 700; }
.wa-link:hover { text-decoration: underline; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.charts .card + .card { margin-top: 0; }
@media (max-width: 860px) { .fin-grid { grid-template-columns: 1fr !important; } }
.chart-card { padding: 16px 18px 10px; }
.chart-card h4 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; }
.chart-card .big { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin: 2px 0 6px; }
.chart-card .big small { font-size: 13px; color: var(--muted); font-weight: 600; }
.chart svg { width: 100%; height: 130px; display: block; overflow: visible; }
.chart text { font: 600 10px var(--font); fill: var(--muted-2); }

/* ---------- Formularios con secciones ---------- */
.form-wrap { max-width: 980px; }
.form-card .card-b { display: grid; gap: 18px; }
.sticky-bar {
  position: fixed; left: var(--sidebar); right: 0; bottom: 0; z-index: 35; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.sticky-bar .grow { flex: 1; }
.rep-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto auto; gap: 10px; align-items: start; padding: 12px; background: #faf8f3; border: 1px solid var(--line-2); border-radius: 12px; }
.star-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--muted-2); }
.star-btn.on { color: #d4a514; border-color: #ecd68f; background: #fff9e6; }
.star-btn.on svg { fill: #f2c53d; }

/* ---------- Consulta ---------- */
.consulta { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.c-aside { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 100px); overflow-y: auto; padding-bottom: 8px; }
.c-aside .card-b { padding: 16px; }
.c-pt { display: flex; gap: 12px; align-items: center; }
.c-pt b { font-size: 15.5px; font-weight: 800; display: block; line-height: 1.25; }
.c-pt span { font-size: 12.5px; color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.mini-dl { display: grid; gap: 9px; font-size: 12.5px; }
.mini-dl span { color: var(--muted-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; display: block; }
.mini-dl p { margin: 1px 0 0; white-space: pre-wrap; }
.sec { scroll-margin-top: 80px; }
.sec .card-h .num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: var(--gold-2); font-size: 12px; font-weight: 800; }
.c-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; position: sticky; top: 60px; z-index: 20; padding: 10px 0; background: var(--bg); }
.c-nav a { font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 11px; border-radius: 99px; background: #fff; border: 1px solid var(--line); }
.c-nav a:hover { color: var(--text); border-color: #d6cfbf; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; height: 42px; overflow: hidden; }
.stepper:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 162, 74, .16); }
.stepper input { border: 0; outline: none; flex: 1; min-width: 0; height: 100%; padding: 0 12px; font-weight: 700; font-size: 15px; background: transparent; }
.stepper button { width: 34px; height: 100%; border: 0; background: transparent; color: var(--muted); font-size: 18px; font-weight: 600; }
.stepper button:hover { background: #f5f2ea; color: var(--text); }
.stepper .u { font-size: 12px; color: var(--muted-2); font-weight: 700; padding-right: 4px; }
.imc-box { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: 10px; background: linear-gradient(135deg, var(--gold-soft), #fffaf0); border: 1px solid #ecdcb1; font-weight: 800; font-size: 17px; }
.imc-box small { font-size: 11px; color: #8a6d24; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.ex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ex-item { background: #faf8f3; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; }
.ex-item .h { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 800; letter-spacing: .5px; color: #6d5317; margin-bottom: 6px; }
.ex-item textarea { min-height: 44px; background: #fff; }
.combo { position: relative; }
.combo .input { padding-left: 40px; }
.combo > svg { position: absolute; left: 13px; top: 12px; color: var(--muted-2); }
.dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); max-height: 340px; overflow-y: auto; padding: 6px;
}
.dd-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; }
.dd-item.act, .dd-item:hover { background: var(--gold-soft); }
.dd-item code { font: 800 12px var(--font); color: #7a5c17; background: #fff; border: 1px solid #ecdcb1; padding: 1px 6px; border-radius: 6px; flex: none; }
.dd-item small { color: var(--muted); display: block; font-size: 12px; }
.dd-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.dx-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 10px; background: var(--navy-soft); color: var(--navy); font-weight: 700; font-size: 13px; }
.dx-chip code { font: 800 11.5px var(--font); background: var(--navy); color: #fff; padding: 3px 7px; border-radius: 6px; }
.dx-chip button { border: 0; background: transparent; color: inherit; opacity: .6; display: grid; place-items: center; padding: 0; }
.dx-chip button:hover { opacity: 1; }
.med {
  border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; transition: box-shadow .15s;
}
.med:focus-within { box-shadow: 0 0 0 4px rgba(201, 162, 74, .14); border-color: #dcc58c; }
.med-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(90deg, #faf6ea, #fff); border-bottom: 1px solid var(--line-2); }
.med-h .n { width: 26px; height: 26px; border-radius: 8px; background: var(--gold); color: #1d1608; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.med-h .line { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.med-b { padding: 12px; display: grid; grid-template-columns: 1.2fr 1.5fr 1fr 1fr 70px; gap: 10px; }
.med-b .field > label { font-size: 11px; }
.med-b .input { height: 38px; font-size: 13.5px; }
.med-b .wide { grid-column: 1 / -1; }
.med-b .textarea { min-height: 52px; font-size: 13.5px; }
.meds { display: flex; flex-direction: column; gap: 12px; }
.qdates { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.save-state { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.save-state .d { width: 8px; height: 8px; border-radius: 50%; background: #34d399; }
.save-state.saving .d { background: var(--gold); animation: pulse 1s infinite; }
.save-state.error .d { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Historial ---------- */
.hist { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.hlist { display: flex; flex-direction: column; }
.hitem { padding: 13px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; display: grid; gap: 4px; }
.hitem:hover { background: #fbfaf6; }
.hitem.on { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.hitem .t { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 13.5px; }
.hitem p { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Agenda ---------- */
.cal { overflow: hidden; }
.cal-head { display: grid; grid-template-columns: 64px repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #fbfaf6; }
.cal-head div { padding: 10px 8px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.cal-head div b { display: block; font-size: 20px; color: var(--text); font-weight: 800; }
.cal-head div.today b { color: #fff; background: var(--ink); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin: 2px auto 0; font-size: 16px; }
.cal-body { display: grid; grid-template-columns: 64px repeat(7, minmax(0, 1fr)); position: relative; max-height: calc(100vh - 240px); overflow-y: auto; }
.cal-hours div { height: 52px; font-size: 11px; color: var(--muted-2); text-align: right; padding: 0 8px; transform: translateY(-7px); font-weight: 600; }
.cal-col { position: relative; border-left: 1px solid var(--line-2); background-image: linear-gradient(var(--line-2) 1px, transparent 1px); background-size: 100% 52px; cursor: copy; }
.cal-col.today { background-color: #fffcf3; }
.ev {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 5px 8px; font-size: 11.5px; font-weight: 700; overflow: hidden; cursor: pointer;
  background: linear-gradient(135deg, #e7c76f, #c9a24a); color: #1d1608; box-shadow: 0 4px 10px -6px rgba(168, 130, 47, .9); border: 1px solid #b8913c;
}
.ev.f { background: linear-gradient(135deg, #f7b6d4, #e86fa7); border-color: #d6538f; color: #4a0b29; }
.ev.m { background: linear-gradient(135deg, #a9c4ff, #6e97f5); border-color: #4f7ce6; color: #0b2160; }
.ev span { display: block; font-weight: 600; opacity: .8; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* ---------- Estadísticas ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi span { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 6px; }
.kpi small { color: var(--muted-2); font-size: 11.5px; font-weight: 600; }
.kpi.gold { background: linear-gradient(135deg, #1a1a1c, #0c0c0d); color: #fff; border-color: #000; }
.kpi.gold span { color: var(--gold-2); }
.kpi.gold small { color: #a39d90; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lab { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bar-row .lab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bar-row .track { height: 8px; background: #f1eee6; border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), #e7c76f); }
.bar-row.navy .fill { background: linear-gradient(90deg, var(--navy), #4f74b3); }
.bar-row b { text-align: right; font-weight: 800; }
.range { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.range .input { width: auto; height: 36px; }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 11px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted-2); font-weight: 800; border-bottom: 1px solid var(--line); background: #fbfaf6; position: sticky; top: 0; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:hover td { background: #fcfbf8; cursor: pointer; }
.tbl td.clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

/* ---------- Modal / Toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(12, 11, 9, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal.wide { width: min(1100px, 100%); height: calc(100vh - 40px); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-h .icon-btn { margin-left: auto; }
.modal-b { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal iframe { width: 100%; height: 100%; border: 0; border-radius: 10px; background: #525659; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 90px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: pop .2s; max-width: 380px; }
.toast.error { background: var(--danger); }
.toast.ok svg { color: #6ee7a8; }
.success-hero { text-align: center; padding: 8px 0 16px; }
.success-hero .ring { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #e7c76f, #a8822f); color: #fff; box-shadow: 0 10px 30px -10px rgba(168, 130, 47, .9); }
.success-hero .ring svg { width: 30px; height: 30px; stroke-width: 2.6; }
.success-hero h2 { margin: 0; font-size: 22px; }
.success-hero p { margin: 6px 0 0; color: var(--muted); }
.serie { font: 800 13px var(--font); letter-spacing: 1px; background: var(--ink); color: var(--gold-2); padding: 4px 10px; border-radius: 8px; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bday { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.bday:last-child { border-bottom: 0; }
.bday .when { text-align: center; min-width: 64px; }
.bday .when b { display: block; font-size: 22px; font-weight: 800; }
.bday .when span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.bday.today { background: linear-gradient(90deg, var(--gold-soft), #fff); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .consulta { grid-template-columns: minmax(0, 1fr); }
  .c-aside { position: static; max-height: none; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .med-b { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  :root { --sidebar: 0px; }
  .sidebar { transform: translateX(-100%); width: 260px; transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-grid; }
  .two-col, .hist { grid-template-columns: minmax(0, 1fr); }
  .prow { grid-template-columns: auto minmax(0, 1fr) auto; }
  .prow .meta { display: none; }
  .hero { grid-template-columns: auto 1fr; }
  .hero .cta { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .view { padding: 18px 16px 120px; }
  .topbar { padding: 0 16px; }
  .g2, .g3, .g4, .dl, .ex-grid, .kpis { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .med-b { grid-template-columns: 1fr 1fr; }
  .rep-row { grid-template-columns: 1fr 1fr; }
  .lastc .vit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky-bar { padding: 12px 16px; }
  .cal-body, .cal-head { min-width: 760px; }
  .cal { overflow-x: auto; }
}
