/* Tabata Mora Mera Dental Studio — estilo compartido de las páginas de administración y de acceso
   (se carga después del <style> propio de cada página y lo sobrescribe). */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Cormorant+Garamond:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --brand-navy: #493e34; --brand-sky: #afa393; --brand-sky-ink: #7a6a5b; --brand-sky-soft: #f2eee9; --brand-yellow: #d0cac0;
  --primary: #493e34; --accent: #857464; --accent-hover: #6f6053; --danger: #d63c2f; --success: #1e8c4c;
  --bg: #ece9e5; --surface: #fff; --surface2: #f7f5f2; --border: #d0cac0; --text: #2e2721; --text-muted: #7a6a5b;
  --shadow: 0 1px 3px rgba(73, 62, 52,0.06), 0 4px 14px rgba(73, 62, 52,0.06);
  --shadow-lg: 0 10px 30px rgba(73, 62, 52,0.14);
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background:
    radial-gradient(1000px 360px at 100% -10%, rgba(175, 163, 147,0.16), transparent 60%),
    radial-gradient(700px 280px at -10% 0%, rgba(208, 202, 192,0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Barra superior con el logo */
.adm-top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255,0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top));
}
.adm-top-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.adm-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand-navy); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.3px; min-height: 44px; }
.adm-brand img { width: 42px; height: 42px; object-fit: contain; }
.adm-brand b { color: var(--brand-sky-ink); font-weight: 800; }
.adm-app-link { font-size: 0.88rem; font-weight: 600; color: var(--accent); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

.wrap { padding: 28px 16px 48px; }
h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
h2 { color: var(--text); font-weight: 700; }
p.subtitle, .subtitle { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }
a.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  color: var(--accent); font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
a.back:hover { text-decoration: underline; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
a.card:hover { border-color: var(--brand-sky); box-shadow: var(--shadow-lg); transform: none; }
.grid .card { display: flex; flex-direction: column; gap: 6px; padding: 20px; }
.card h2 { font-size: 1.02rem; color: var(--text); display: flex; align-items: center; gap: 10px; }
.card p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.45; }
.adm-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-sky-soft); color: var(--brand-sky-ink);
}
.adm-ico svg { width: 20px; height: 20px; }
.adm-ico.y { background: #fff7c2; color: #8a6d00; }
.adm-ico.n { background: #ebe5de; color: var(--brand-navy); }
.adm-ico.r { background: #ffe9e6; color: #c0392b; }
.adm-ico.g { background: #e3f6ec; color: #1e7e4a; }

/* Formularios */
input, select, textarea {
  font-family: inherit; font-size: 1rem; color: var(--text);
  min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(175, 163, 147,0.25); }
label, .form-group label { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* Botones */
button, .btn {
  font-family: inherit; font-weight: 600; font-size: 0.9rem;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.btn-primary, .wrap .btn, form.card > button[type="submit"], .card > form > button[type="submit"] { background: var(--accent); color: #fff; }
.btn-primary:hover, .wrap .btn:hover { background: var(--accent-hover); }
.btn-danger, .btn-purge { background: transparent; color: var(--danger); border: 1px solid #f2c5c0; }
.btn-danger:hover, .btn-purge:hover { background: #fdecea; }
.btn-restore { background: var(--success); color: #fff; }
.btn-restore:hover { background: #18733e; }
.actions button { min-height: 40px; border-radius: 10px; }
button:focus-visible, a:focus-visible, .btn:focus-visible { outline: 3px solid var(--brand-sky); outline-offset: 2px; }

/* Mensajes */
.error { background: #fdecea; color: #b42318; border: 1px solid #f5c6c0; border-radius: 12px; }
.success { background: #e3f6ec; color: #1e6b3d; border: 1px solid #b9e4c9; border-radius: 12px; }

/* Tablas */
table { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th { color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
th, td { border-bottom-color: #efebe6; }
.card table { width: 100%; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Papelera y auditoría */
.item { border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; }
.item .name { color: var(--text); overflow-wrap: anywhere; }
.tag { border-radius: 999px; }
.empty { border-radius: 16px; border: 1px dashed var(--border); background: var(--surface); }
.pager a { min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; box-shadow: none; color: var(--accent); font-weight: 600; }
code { font-family: 'JetBrains Mono', monospace; }

/* Diálogo de confirmación propio (reemplaza confirm() del navegador) */
.adm-dialog-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(40, 32, 25,0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.adm-dialog-overlay[hidden] { display: none; }
.adm-dialog {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 24px; text-align: center;
}
.adm-dialog .adm-ico { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 12px; }
.adm-dialog h3 { font-size: 1.15rem; margin-bottom: 8px; color: var(--text); }
.adm-dialog p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; margin-bottom: 18px; text-align: left; }
.adm-dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.adm-dialog-actions button { flex: 1 1 130px; }
.adm-dialog .adm-cancel { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.adm-dialog .adm-ok { background: var(--danger); color: #fff; }

@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .form-row { flex-direction: column; align-items: stretch !important; }
  .form-row .form-group input, .form-row .form-group select { width: 100%; }
  .adm-app-link span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.card { overflow-x: auto; }


/* ===== Modo oscuro (automático o elegido en el menú de usuario de la app) ===== */
:root[data-theme="dark"] { color-scheme: dark;
  --brand-navy: #dcc7b0; --brand-sky-ink: #cdbba6; --brand-sky-soft: #3a3027; --primary: #b59e86;
  --bg: #1a1612; --surface: #241f1a; --surface2: #2b251f; --border: #3d352d; --text: #efe9e2; --text-muted: #b5a796;
  --shadow: 0 1px 2px rgba(0, 0, 0,0.4), 0 4px 14px rgba(0, 0, 0,0.25); --shadow-lg: 0 10px 30px rgba(0, 0, 0,0.45); }
:root[data-theme="dark"] .adm-top { background: rgba(36, 31, 26,0.94); }
:root[data-theme="dark"] body { background: radial-gradient(1000px 360px at 100% -10%, rgba(175, 163, 147,0.07), transparent 60%), var(--bg); }
:root[data-theme="dark"] table, :root[data-theme="dark"] th, :root[data-theme="dark"] code, :root[data-theme="dark"] .pager a, :root[data-theme="dark"] .audit-filter a { background: var(--surface); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] th { background: var(--surface2); color: var(--text-muted); }
:root[data-theme="dark"] .audit-filter a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .error { background: #3d1d1d; color: #ffb4ab; border-color: #6b2b2b; }
:root[data-theme="dark"] .success { background: #153626; color: #7ddba3; border-color: #275c3b; }
:root[data-theme="dark"] .tag { filter: saturate(0.9) brightness(0.9); }
:root[data-theme="dark"] .adm-ico.y { background: #3a3410; color: #ffe27a; }
:root[data-theme="dark"] .adm-ico.n { background: #3a3027; color: #dcc7b0; }
:root[data-theme="dark"] .adm-ico.r { background: #3d1d1d; color: #ff9b8f; }
:root[data-theme="dark"] .adm-ico.g { background: #153626; color: #7ddba3; }
:root[data-theme="dark"] .btn-danger, :root[data-theme="dark"] .btn-purge { border-color: #6b2b2b; color: #ff9b8f; }
:root[data-theme="dark"] .btn-danger:hover, :root[data-theme="dark"] .btn-purge:hover { background: #3d1d1d; }
:root[data-theme="dark"] .adm-dialog .adm-cancel { background: var(--surface2); }
:root[data-theme="dark"] ul, :root[data-theme="dark"] .file-list { color: var(--text) !important; }
@media not all {
  :root:not([data-theme="light"]) { color-scheme: dark;
  --brand-navy: #dcc7b0; --brand-sky-ink: #cdbba6; --brand-sky-soft: #3a3027; --primary: #b59e86;
  --bg: #1a1612; --surface: #241f1a; --surface2: #2b251f; --border: #3d352d; --text: #efe9e2; --text-muted: #b5a796;
  --shadow: 0 1px 2px rgba(0, 0, 0,0.4), 0 4px 14px rgba(0, 0, 0,0.25); --shadow-lg: 0 10px 30px rgba(0, 0, 0,0.45); }
:root:not([data-theme="light"]) .adm-top { background: rgba(36, 31, 26,0.94); }
:root:not([data-theme="light"]) body { background: radial-gradient(1000px 360px at 100% -10%, rgba(175, 163, 147,0.07), transparent 60%), var(--bg); }
:root:not([data-theme="light"]) table, :root:not([data-theme="light"]) th, :root:not([data-theme="light"]) code, :root:not([data-theme="light"]) .pager a, :root:not([data-theme="light"]) .audit-filter a { background: var(--surface); color: var(--text); border-color: var(--border); }
:root:not([data-theme="light"]) th { background: var(--surface2); color: var(--text-muted); }
:root:not([data-theme="light"]) .audit-filter a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
:root:not([data-theme="light"]) .error { background: #3d1d1d; color: #ffb4ab; border-color: #6b2b2b; }
:root:not([data-theme="light"]) .success { background: #153626; color: #7ddba3; border-color: #275c3b; }
:root:not([data-theme="light"]) .tag { filter: saturate(0.9) brightness(0.9); }
:root:not([data-theme="light"]) .adm-ico.y { background: #3a3410; color: #ffe27a; }
:root:not([data-theme="light"]) .adm-ico.n { background: #3a3027; color: #dcc7b0; }
:root:not([data-theme="light"]) .adm-ico.r { background: #3d1d1d; color: #ff9b8f; }
:root:not([data-theme="light"]) .adm-ico.g { background: #153626; color: #7ddba3; }
:root:not([data-theme="light"]) .btn-danger, :root:not([data-theme="light"]) .btn-purge { border-color: #6b2b2b; color: #ff9b8f; }
:root:not([data-theme="light"]) .btn-danger:hover, :root:not([data-theme="light"]) .btn-purge:hover { background: #3d1d1d; }
:root:not([data-theme="light"]) .adm-dialog .adm-cancel { background: var(--surface2); }
:root:not([data-theme="light"]) ul, :root:not([data-theme="light"]) .file-list { color: var(--text) !important; }
}

/* ======================================================================
   MARCA TABATA MORA MERA DENTAL STUDIO · Dra. Tabata Mora Mera
   Tipografía Cormorant Garamond en el nombre y logo claro en modo oscuro.
   ====================================================================== */
.dash-logo-text, .adm-brand span { font-family: 'Cormorant Garamond', 'Montserrat', serif; font-weight: 700; letter-spacing: 0.2px; }
:root[data-theme="dark"] img[src^="assets/logo-tm.png"] { content: url("../logo-tm-light.png"); }
:root[data-theme="dark"] img[src^="assets/logo.png"] { content: url("../logo-light.png"); }
@media not all {
  :root:not([data-theme="light"]) img[src^="assets/logo-tm.png"] { content: url("../logo-tm-light.png"); }
  :root:not([data-theme="light"]) img[src^="assets/logo.png"] { content: url("../logo-light.png"); }
}

/* Siempre tema claro */
:root { color-scheme: light; }
