@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

/* ------------------------------------------------------------------
   Sonrison · Manual de usuario
   Misma identidad de la app: teal profundo, sage y crema clínica.
------------------------------------------------------------------- */
:root {
  --bg: #f7f2ea;
  --surface: #ffffff;
  --surface-2: #fbf8f3;
  --ink: #17313b;
  --text: #2b3f47;
  --muted: #60767d;
  --line: #e4ddd2;
  --brand: #2d5f67;
  --brand-2: #7b9b92;
  --brand-soft: rgba(45, 95, 103, 0.09);
  --tip: #0f766e;   --tip-bg: #e6f4f1;
  --warn: #92400e;  --warn-bg: #fdf3e2;
  --info: #1d4f91;  --info-bg: #eaf1fb;
  --shadow: 0 18px 40px -24px rgba(23, 49, 59, 0.35);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1b20; --surface: #142730; --surface-2: #10222a; --ink: #eef4f2; --text: #c9d6d3;
    --muted: #8ea4a6; --line: #24404a; --brand: #8fc0b5; --brand-2: #7b9b92; --brand-soft: rgba(143, 192, 181, 0.12);
    --tip: #7fd6c6; --tip-bg: rgba(127, 214, 198, 0.1); --warn: #f3c27a; --warn-bg: rgba(243, 194, 122, 0.1);
    --info: #9cc2f5; --info-bg: rgba(156, 194, 245, 0.1); --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1b20; --surface: #142730; --surface-2: #10222a; --ink: #eef4f2; --text: #c9d6d3;
  --muted: #8ea4a6; --line: #24404a; --brand: #8fc0b5; --brand-2: #7b9b92; --brand-soft: rgba(143, 192, 181, 0.12);
  --tip: #7fd6c6; --tip-bg: rgba(127, 214, 198, 0.1); --warn: #f3c27a; --warn-bg: rgba(243, 194, 122, 0.1);
  --info: #9cc2f5; --info-bg: rgba(156, 194, 245, 0.1); --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img, svg { display: block; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; letter-spacing: -0.02em; }
code, kbd { font: 600 0.88em/1 ui-monospace, "Cascadia Code", Consolas, monospace; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--ink); }
.ui { padding: 1px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--ink); font-weight: 600; white-space: nowrap; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1240px) / 2)); background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #17313b, #2d5f67); display: grid; place-items: center; }
.brand small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.topnav a:hover { color: var(--ink); background: var(--brand-soft); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--brand-2); }
.menu-btn { display: none; }

/* ---------- Portada ---------- */
.hero { padding: 72px 16px 40px; text-align: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--brand); font-weight: 700; font-size: 13px; }
.hero h1 { margin: 18px auto 12px; max-width: 820px; font-size: clamp(34px, 5.4vw, 58px); font-weight: 800; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 auto; max-width: 640px; font-size: 18px; color: var(--muted); }
.search { position: relative; max-width: 560px; margin: 30px auto 0; }
.search input { width: 100%; padding: 16px 18px 16px 50px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; box-shadow: var(--shadow); }
.search input:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20; max-height: 360px; overflow: auto; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.search-results a { display: block; padding: 10px 16px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a:focus { background: var(--brand-soft); outline: none; }
.search-results b { color: var(--ink); }
.search-results span { display: block; font-size: 13px; color: var(--muted); }
.search-results .empty { padding: 14px 16px; color: var(--muted); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.section-head { margin: 64px 0 22px; }
.section-head h2 { margin: 0 0 6px; font-size: 28px; }
.section-head p { margin: 0; color: var(--muted); }

.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.role-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease;
}
.role-card:hover { transform: translateY(-3px); border-color: var(--brand-2); }
.role-card h3 { margin: 4px 0 0; font-size: 20px; }
.role-card p { margin: 0; font-size: 14.5px; color: var(--muted); }
.role-card .go { margin-top: auto; padding-top: 8px; font-weight: 700; font-size: 14px; color: var(--brand); }
.role-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.c-admin { background: linear-gradient(135deg, #17313b, #2d5f67); }
.c-dentist { background: linear-gradient(135deg, #2d5f67, #7b9b92); }
.c-recep { background: linear-gradient(135deg, #8a6a3b, #c9a46a); }
.c-patient { background: linear-gradient(135deg, #3b6b8a, #7fa9c4); }
.c-platform { background: linear-gradient(135deg, #4b3b6b, #8b7bb0); }

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.mini { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.mini .n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.mini h3 { margin: 12px 0 6px; font-size: 17px; }
.mini p { margin: 0; font-size: 14.5px; color: var(--muted); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
td.c { text-align: center; }
.yes { color: var(--tip); font-weight: 800; }
.no { color: var(--muted); opacity: .55; }
.part { color: var(--warn); font-weight: 700; font-size: 12.5px; }

/* ---------- Páginas de perfil ---------- */
.page-hero { padding: 48px 16px 8px; }
.page-hero .wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.page-hero .role-icon { width: 64px; height: 64px; border-radius: 18px; }
.page-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 44px); font-weight: 800; }
.page-hero p { margin: 4px 0 0; color: var(--muted); max-width: 720px; }
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 40px; max-width: 1240px; margin: 0 auto; padding: 28px 16px 80px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; padding-right: 6px; }
.toc p { margin: 0 0 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toc a { display: block; padding: 7px 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); border-radius: 0 8px 8px 0; }
.toc .filter { width: 100%; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }

article section { padding: 28px 30px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
article section[hidden] { display: none; }
article h2 { margin: 0 0 6px; font-size: 24px; display: flex; align-items: center; gap: 10px; }
article h2 .tag { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
article h3 { margin: 26px 0 8px; font-size: 18px; }
article .lead { margin-top: 0; color: var(--muted); }
article ul, article ol { padding-left: 22px; }
article li { margin: 6px 0; }

ol.steps { list-style: none; padding: 0; counter-reset: s; }
ol.steps > li { position: relative; padding: 2px 0 14px 46px; counter-increment: s; }
ol.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 14px;
}
ol.steps > li::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 2px; width: 2px; background: var(--line); }
ol.steps > li:last-child::after { display: none; }

.callout { display: flex; gap: 12px; margin: 16px 0; padding: 14px 16px; border-radius: 14px; font-size: 15px; }
.callout svg { flex: none; margin-top: 3px; }
.callout p { margin: 0; }
.callout.tip { background: var(--tip-bg); color: var(--tip); }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.info { background: var(--info-bg); color: var(--info); }
.callout strong { color: inherit; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; font-weight: 600; color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 14px 0; }
.box { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.box h4 { margin: 0 0 4px; font-size: 15.5px; }
.box p { margin: 0; font-size: 14.5px; color: var(--muted); }

details { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin: 10px 0; }
details summary { cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--brand); font-weight: 800; }
details[open] summary::after { content: "−"; }
details > div { padding: 0 18px 16px; color: var(--text); }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.pager a { flex: 1; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 700; }
.pager a span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pager a.next { text-align: right; }

footer.site { padding: 32px 16px 48px; text-align: center; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.back-top { position: fixed; right: 18px; bottom: 18px; z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
.back-top.show { opacity: 1; pointer-events: auto; }
mark { background: color-mix(in srgb, var(--brand-2) 35%, transparent); color: inherit; border-radius: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .toc { position: fixed; inset: 64px 0 0 0; z-index: 25; max-height: none; height: calc(100vh - 64px); overflow: auto; padding: 18px 16px; background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; }
  body.toc-open .toc { transform: none; }
  .menu-btn { display: grid; }
  .topnav { display: none; }
  [data-theme-toggle] { margin-left: auto; }
  article section { padding: 22px 18px; }
}
@media (max-width: 560px) {
  .hero { padding-top: 44px; }
  .brand small { display: none; }
  .pager { flex-direction: column; }
}

@media print {
  .topbar, .toc, .back-top, .pager, .search { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .layout { display: block; padding: 0; }
  article section { break-inside: avoid; border: 0; padding: 0 0 12pt; }
  details { border: 0; } details > div { display: block !important; }
}
