/* Expediente digital — diseño clínico minimalista */
:root {
  --enamel: #f7f7f5;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e8e8e6;
  --text: #171717;
  --muted: #737373;
  --subtle: #a3a3a3;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.1);
  --slate-50: #fafafa;
  --slate-200: #e5e5e5;
  --slate-500: #737373;
  --slate-700: #404040;
  --slate-900: #171717;
  --mint-50: #f0fdfa;
  --mint-100: #ccfbf1;
  --mint-500: #14b8a6;
  --mint-600: #0d9488;
  --mint-700: #0f766e;
  --mint-900: #134e4a;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
  letter-spacing: -0.011em;
  min-height: 100vh;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  color: var(--text);
  padding: 1.5rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-right: 1px solid var(--border);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  margin-bottom: 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.sidebar .brand svg {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 1;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.sidebar a:hover {
  background: var(--slate-50);
  text-decoration: none;
  color: var(--text);
}

.sidebar .nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--subtle);
  margin: 1rem 0 0.35rem 0.75rem;
}

.sidebar .user-box {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 0.8rem;
  line-height: 1.35;
}
.sidebar .user-box span {
  color: var(--muted);
}

.sidebar .foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--subtle);
}
.sidebar .foot a {
  color: var(--muted);
  padding: 0.35rem 0.75rem;
}
.sidebar .foot a:hover {
  color: var(--text);
}

main {
  flex: 1;
  padding: 2rem 2.25rem 3rem;
  max-width: 1120px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
  letter-spacing: -0.03em;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.badge-exp {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--card);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stat:hover {
  border-color: #d4d4d4;
  box-shadow: var(--shadow-md);
}
.stat .n {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.stat .l {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.05s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--text);
  color: #fff;
  box-shadow: none;
}
.btn-primary:hover {
  filter: brightness(1.08);
  text-decoration: none;
  color: #fff;
}
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: #d4d4d4;
  background: var(--slate-50);
  text-decoration: none;
}
.btn-google {
  background: #fff;
  color: #444;
  border: 1px solid #dadce0;
  font-weight: 500;
}
.btn-google:hover {
  background: #f8f9fa;
  text-decoration: none;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}
.search-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.alert-info {
  background: var(--slate-50);
  color: var(--text);
  border: 1px solid var(--border);
}

.list-rows {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}
.list-rows a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.list-rows a:last-child {
  border-bottom: none;
}
.list-rows a:hover {
  background: var(--slate-50);
}

table.simple {
  width: 100%;
  font-size: 0.9rem;
  border-collapse: collapse;
}
table.simple th,
table.simple td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.odontogram {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
}

.arch-label {
  text-align: center;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate-500);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.teeth-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tooth-btn {
  width: 2.1rem;
  height: 2.35rem;
  font-size: 0.62rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  color: var(--muted);
  transition: all 0.12s;
}
.tooth-btn:hover {
  border-color: #d4d4d4;
  background: var(--slate-50);
  color: var(--text);
}
.tooth-btn.has-note {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #92400e;
}
.tooth-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--accent);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2rem 2.25rem;
  box-shadow: var(--shadow-md);
}
.login-card .logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.login-card h1 {
  font-size: 1.35rem;
  margin: 0;
}

.nav-mobile {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.nav-mobile a {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
.nav-mobile a:hover {
  background: var(--slate-50);
  color: var(--text);
  text-decoration: none;
}

.hint {
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-top: 0.35rem;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .nav-mobile {
    display: flex;
  }
  main {
    padding: 1rem 1rem 2rem;
  }
}

/* Odontograma — ilustraciones anatómicas (SVG en /static/teeth/) */
.odo-pro {
  margin-top: 0.35rem;
}
.odo-mode-form {
  margin: 0;
}
.odo-mode-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 3px;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.odo-mode-opt {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  margin: 0;
}
.odo-mode-opt.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.odo-mode-opt input {
  accent-color: var(--accent);
  margin: 0;
}
.odo-mode-opt:focus-within {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}
.odo-chart-section {
  margin-bottom: 1.25rem;
}
.odo-chart-section--second {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.odo-chart-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.65rem;
}
.odo-grid-wrap--primary {
  background: linear-gradient(180deg, #fafafa 0%, #f5f9ff 100%);
  border-color: #e0e7ef;
}
.odo-pro-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.odo-pro-title {
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.odo-mixed-form {
  margin: 0;
}
.odo-mixed-label {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 500;
}
.odo-rl-bar {
  display: flex;
  justify-content: space-between;
  padding: 0 0.25rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--subtle);
  letter-spacing: 0.2em;
}
.odo-rl-spacer {
  flex: 1;
  border-bottom: 1px solid var(--border);
  margin: 0 0.85rem 0.4rem;
}
.odo-grid-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.6rem 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.odo-arch-label {
  text-align: center;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--subtle);
  font-weight: 600;
  margin: 0.25rem 0 0.65rem;
}
.odo-teeth-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.2rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
  margin-bottom: 0.35rem;
  scrollbar-width: thin;
}
.odo-tooth {
  flex: 0 0 auto;
  width: 52px;
  padding: 0.25rem 0.15rem 0.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  position: relative;
  transition: background 0.12s, box-shadow 0.12s;
}
.odo-tooth:hover {
  background: var(--slate-50);
}
.odo-tooth.selected {
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.odo-tooth.has-note .odo-tooth-img {
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.65));
  opacity: 0.97;
}
.odo-tooth-img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 32px;
  min-height: 48px;
  max-height: 78px;
  object-fit: contain;
  object-position: center top;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
}
.odo-mandible .odo-tooth-img {
  transform: rotate(180deg);
}
.odo-num-main {
  display: block;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.15;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.odo-num-main--primary {
  color: #1d4ed8;
  font-weight: 600;
}
.odo-num-equiv {
  display: block;
  text-align: center;
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--subtle);
  line-height: 1.1;
  margin-top: 0.05rem;
  font-variant-numeric: tabular-nums;
}
.odo-notes-hint {
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  background: var(--slate-50);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Modal: diente 3D + boceto */
.tooth-treat-dialog {
  max-width: min(920px, calc(100vw - 2.5rem));
  width: 100%;
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
  color: var(--text);
}
.tooth-treat-dialog::backdrop {
  background: rgba(23, 23, 23, 0.4);
  backdrop-filter: blur(2px);
}
.tooth-treat-form {
  padding: 0;
}
.tooth-treat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}
.tooth-treat-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.tooth-treat-close {
  border: none;
  background: var(--slate-50);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.tooth-treat-close:hover {
  background: var(--slate-200);
}
.tooth-2d-toolbar,
.tooth-3d-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.tooth-mode-label {
  margin: 0;
}
.tooth-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
}
.tooth-treat-legend {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
}
.tooth-treat-hint {
  margin: 0 1.1rem 0.4rem;
  font-size: 0.8rem;
}
.tooth-2d-block,
.tooth-3d-block {
  padding: 0.35rem 1.1rem 0.75rem;
}
#tooth-2d-wrap {
  width: 100%;
  min-width: 280px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #eef4f8;
  border: 1px solid var(--border);
  padding: 0.5rem;
  touch-action: none;
}
#tooth-2d-wrap.tool-draw {
  outline: 1px solid rgba(13, 148, 136, 0.35);
}
#tooth-2d-wrap.tool-caries {
  outline: 1px solid rgba(180, 83, 9, 0.35);
  cursor: crosshair;
}
#tooth-2d-wrap.tooth-wrap--atlas {
  background: #e8eef4;
}
.tooth-atlas-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}
.tooth-atlas-toggle input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.tooth-atlas-toggle span {
  line-height: 1.35;
}
.tooth-2d-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: start;
}
@media (max-width: 720px) {
  .tooth-2d-grid {
    grid-template-columns: 1fr;
  }
}
.tooth-face-col {
  border-radius: 8px;
  padding: 0.35rem;
  background: #fff;
  border: 2px solid transparent;
  cursor: pointer;
}
.tooth-face-col.is-active-face {
  border-color: rgba(13, 148, 136, 0.65);
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.2);
}
.tooth-face-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.tooth-face-stack {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}
.tooth-face-stack .tooth-base-canvas,
.tooth-face-stack .tooth-draw-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
.tooth-face-stack .tooth-draw-canvas {
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
}
/* Legacy 3D modal (si reaparece en otra plantilla) */
#tooth-3d-wrap {
  position: relative;
  width: 100%;
  min-width: 280px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #f0eeea;
  border: 1px solid var(--border);
  aspect-ratio: 100 / 68;
  max-height: 440px;
  min-height: 220px;
  touch-action: none;
}
#tooth-3d-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  vertical-align: middle;
}
.tooth-treat-dialog .btn-mode {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  background: var(--slate-50);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}
.tooth-treat-dialog .btn-mode:hover {
  background: var(--slate-200);
}
.tooth-treat-dialog .btn-mode.is-active {
  background: var(--accent-soft);
  border-color: var(--mint-500);
  color: var(--mint-900);
  font-weight: 500;
}
.tooth-stroke-pick {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  border: 1px solid var(--slate-200);
  background: #fff;
  border-radius: 7px;
  padding: 0.2rem 0.4rem 0.2rem 0.5rem;
}
.tooth-stroke-label {
  font-size: 0.72rem;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tooth-treat-dialog .btn-stroke {
  font-size: 0.78rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid transparent;
  background: var(--slate-50);
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
}
.tooth-treat-dialog .btn-stroke.is-active {
  background: #fff;
  border-color: var(--mint-500);
  color: var(--mint-900);
  font-weight: 600;
}
#stroke-black.is-active {
  border-color: #334155;
  color: #0f172a;
}
#stroke-blue.is-active {
  border-color: #1d4ed8;
  color: #0d47a1;
}
.odo-sketch-overlay {
  position: absolute;
  left: 0;
  top: 0.15rem;
  right: 0;
  width: 100%;
  max-height: 78px;
  object-fit: contain;
  object-position: center top;
  pointer-events: none;
  z-index: 1;
  opacity: 0.9;
  mix-blend-mode: multiply;
  filter: contrast(1.05) saturate(1.15);
}
.odo-sketch-overlay--flip {
  top: 0.2rem;
  transform: rotate(180deg);
}
.tooth-treat-fields {
  padding: 0.4rem 1.1rem 0.75rem;
  border-top: 1px solid var(--border);
}
.tooth-treat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--slate-50);
  border-radius: 0 0 10px 10px;
}
/* Historial: detalle indentado y texto largo sin desbordar */
.patient-history-list {
  margin: 0;
  padding-left: 1rem;
  list-style: disc;
}
.patient-history-item {
  margin-bottom: 0.85rem;
}
.patient-history-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.patient-history-body {
  min-width: 0;
  flex: 1 1 14rem;
  max-width: 100%;
}
.patient-history-date {
  font-size: 0.8rem;
  color: var(--slate-500);
}
.patient-history-detail {
  margin-top: 0.35rem;
  padding: 0.4rem 0 0.4rem 0.85rem;
  border-left: 3px solid var(--slate-200);
  font-size: 0.9rem;
  color: var(--slate-700);
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.patient-history-kind {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--slate-500);
}
.patient-history-thumb {
  flex: 0 0 auto;
  max-width: min(168px, 42vw);
}
.patient-history-sketch-img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 140px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}
.patient-history-confirm-hint {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  color: var(--mint-900);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}
.btn-visit-delete {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--danger);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
.btn-visit-delete:hover {
  background: #fef2f2;
  border-color: #fecaca;
}
.visit-delete-dialog {
  max-width: 22rem;
  width: calc(100vw - 2rem);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.visit-delete-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}
.visit-delete-dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}
.visit-delete-dialog-text,
.visit-delete-dialog-prompt {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}
.visit-delete-confirm-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}
.visit-delete-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}
.visit-delete-submit {
  background: var(--danger) !important;
  color: #fff !important;
  border: 1px solid #b91c1c;
}
.visit-delete-submit:hover {
  filter: brightness(0.95);
}

.tooth-treat-dialog input[type="text"],
.tooth-treat-dialog textarea,
.tooth-treat-dialog select {
  width: 100%;
  max-width: 100%;
}

/* ── Odontograma de dibujo (vistas vestibular / oclusal / palatina) ── */
.odo-editor {
  margin-top: 0.35rem;
}
.odo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
}
.odo-head-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.odo-tabs {
  display: inline-flex;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.odo-tab {
  margin: 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.odo-tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.odo-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.odo-tab:focus-within {
  outline: 2px solid var(--accent-soft);
}
.odo-version {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0 auto;
  font-size: 0.8125rem;
  color: var(--muted);
}
.odo-version select {
  width: auto;
  font-size: 0.8125rem;
  padding: 0.3rem 0.5rem;
}
.odo-error {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 0.875rem;
}
.odo-body {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.odo-toolbar {
  position: sticky;
  top: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.4rem;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex: none;
}
.odo-tool {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--slate-700);
  cursor: pointer;
}
.odo-tool svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.odo-tool:hover:not(:disabled) {
  border-color: var(--slate-500);
}
.odo-tool.is-active {
  background: var(--slate-700);
  border-color: var(--slate-700);
  color: #fff;
}
.odo-tool:disabled {
  opacity: 0.35;
  cursor: default;
}
.odo-tool-sep {
  width: 22px;
  height: 1px;
  background: var(--border);
  margin: 0.15rem 0;
}
.odo-color {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}
.odo-color.is-active {
  box-shadow: 0 0 0 2px var(--swatch);
}
.odo-tool-caption {
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  color: var(--muted);
}
.odo-width {
  display: grid;
  place-items: center;
  width: 32px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.odo-width span {
  display: block;
  width: 22px;
  border-radius: 99px;
  background: var(--subtle);
}
.odo-width.is-active span {
  background: var(--danger);
}
.odo-sheet {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.odo-canvas {
  min-width: 720px;
  padding: 0.5rem;
}
.odo-svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.odo-editor[data-tool="pen"] .odo-svg {
  cursor: crosshair;
}
.odo-editor[data-tool="eraser"] .odo-svg {
  cursor: cell;
}
.odo-tooth {
  fill: #fff;
  stroke: #1f2937;
  stroke-width: 1.1;
  stroke-linejoin: round;
}
.odo-detail {
  fill: none;
  stroke: #6b7280;
  stroke-width: 0.7;
  stroke-linecap: round;
}
.odo-num {
  font-size: 11px;
  fill: var(--subtle);
  text-anchor: middle;
}
.odo-side-label {
  font-size: 12px;
  font-weight: 600;
  fill: var(--subtle);
  text-anchor: middle;
  dominant-baseline: middle;
}
.odo-section-label {
  font-size: 13px;
  font-weight: 600;
  fill: var(--muted);
  text-anchor: middle;
}
.odo-guide {
  stroke: var(--border);
  stroke-width: 1;
}
.odo-hit {
  fill: transparent;
}
.odo-hit:hover {
  fill: rgba(13, 148, 136, 0.05);
}
.odo-ink path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.odo-save {
  margin-top: 1rem;
}
.odo-save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}
.odo-save-row select {
  width: auto;
  max-width: 100%;
}
.odo-save-row .btn {
  margin-left: auto;
}
.odo-dirty-hint {
  display: none;
  font-size: 0.8125rem;
  color: #b45309;
}
.odo-editor.is-dirty .odo-dirty-hint {
  display: inline;
}
@media (max-width: 720px) {
  .odo-body {
    flex-direction: column;
  }
  .odo-toolbar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 14px;
    width: 100%;
  }
  .odo-tool-sep {
    width: 1px;
    height: 22px;
  }
  .odo-version {
    margin-left: 0;
  }
}
.odo-print {
  padding: 1.5rem;
  background: #fff;
}
.odo-print h2,
.odo-print h3 {
  margin: 0 0 0.4rem;
}
.odo-print .odo-svg {
  max-width: 100%;
}
.odo-print .odo-guides line {
  stroke: #ddd;
}
.odo-print-notes {
  white-space: pre-wrap;
}

/* Colores de identificación, formularios en dos columnas y listas de casillas */
.color-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin-right: 0.45rem;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.color-input {
  width: 3.2rem;
  height: 2.3rem;
  padding: 0.15rem;
  cursor: pointer;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
.check-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}
.check-list legend {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.3rem;
}
.check-list label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  margin: 0;
}
.check-list input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--slate-200);
  color: var(--slate-700);
  vertical-align: middle;
}
.badge-ok { background: var(--mint-100); color: var(--mint-900); }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-off { background: #fee2e2; color: #991b1b; }
.temp-password {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: var(--enamel);
  border: 1px dashed var(--border);
  display: inline-block;
  user-select: all;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 1rem;
}
.filters > div { min-width: 150px; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.6rem;
}
.module-grid label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  font-weight: 400;
  margin: 0;
}
.module-grid input[type="checkbox"] { width: auto; margin-top: 0.2rem; }
.module-grid small { display: block; color: var(--muted); }

/* Registro por QR: página pública (teléfono del paciente) */
.intake {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 16px 3rem;
}
.intake-head h1 { margin: 0.1rem 0 0.3rem; }
.intake-clinic {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}
.intake-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.15rem;
  margin-top: 1rem;
}
.intake-card h2 { margin-top: 0; font-size: 1.05rem; }
.intake-card label { margin-top: 0.6rem; }
.intake-q {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
  padding: 0.85rem 0 0.6rem;
}
.intake-q legend { font-weight: 600; padding: 0; margin-bottom: 0.45rem; float: left; width: 100%; }
.intake-q > *:not(legend) { clear: both; }
.intake-q.has-error legend { color: var(--danger); }
.intake-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem 0;
}
.yn { display: inline-flex; gap: 0.5rem; }
.yn label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
}
.yn input { width: auto; margin: 0; }
.yn label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.field-error { color: var(--danger); font-size: 0.82rem; margin: 0.25rem 0 0; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
#guardian-box.is-required .hint { color: var(--danger); font-weight: 600; }
.sig-pad {
  width: 100%;
  height: 180px;
  border: 1px dashed var(--slate-500);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
  display: block;
}
.sig-img {
  max-width: 320px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.intake-privacy {
  display: flex !important;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 400;
  margin-top: 1rem !important;
}
.intake-privacy input { width: auto; margin-top: 0.25rem; }
.intake-submit { width: 100%; margin-top: 1.25rem; min-height: 52px; font-size: 1.05rem; }

/* QR en recepción */
.qr-card { max-width: 520px; text-align: center; }
.qr-box { width: min(360px, 100%); margin: 0.5rem auto; }
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-status { font-size: 1.05rem; }
.qr-done { color: var(--mint-700); font-weight: 600; }

/* Configuración del cuestionario */
.question-list { padding-left: 1.2rem; margin: 0; }
.question-list > li { padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.question-list > li.is-off { opacity: 0.6; }
.question-head { display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.question-actions { display: flex; gap: 0.35rem; }
.question-actions .btn { padding: 0.2rem 0.55rem; font-size: 0.8rem; }

/* Alertas de salud en la ficha */
.health-alert {
  border-left: 4px solid var(--danger);
  background: #fef2f2;
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.health-alert strong { color: #991b1b; }

/* Agenda: vista semanal */
.agenda-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.agenda-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg a { padding: 0.45rem 0.9rem; color: var(--text); font-size: 0.88rem; }
.seg a.on { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
.week-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.week {
  --slot: 22px;
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(118px, 1fr));
  grid-template-rows: auto calc(var(--rows) * var(--slot));
  min-width: 880px;
}
.week-corner, .week-dayhead { position: sticky; top: 0; background: var(--card); z-index: 2; border-bottom: 1px solid var(--border); }
.week-dayhead { padding: 0.5rem 0.4rem; font-size: 0.8rem; font-weight: 600; text-align: center; border-left: 1px solid var(--border); }
.week-dayhead.is-today { color: var(--accent); }
.week-hours { display: grid; grid-template-rows: repeat(calc(var(--rows) / 2), calc(var(--slot) * 2)); }
.week-hour { font-size: 0.68rem; color: var(--subtle); text-align: right; padding-right: 0.35rem; border-top: 1px solid var(--border); }
.week-hour span { position: relative; top: -0.55em; background: var(--card); }
.week-col { position: relative; border-left: 1px solid var(--border); display: grid; grid-template-rows: repeat(var(--rows), var(--slot)); }
.week-col.is-today { background: var(--accent-soft); }
.week-slot { border-top: 1px dotted var(--slate-200); }
.week-slot:nth-child(odd) { border-top-style: solid; border-top-color: var(--border); }
.week-slot:hover { background: rgba(13, 148, 136, 0.12); }
.appt {
  position: absolute;
  margin-left: 2px;
  border-radius: 6px;
  border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 16%, white);
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 0.15rem 0.3rem;
  overflow: hidden;
  z-index: 1;
}
.appt:hover { text-decoration: none; box-shadow: var(--shadow-md); z-index: 3; }
.appt strong, .appt span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt span { color: var(--muted); }
.status-cancelled, .status-no_show { opacity: 0.55; }
.status-cancelled strong { text-decoration: line-through; }
.status-done { background: color-mix(in srgb, var(--c) 6%, white); }
.list-day { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 1rem 0 0.35rem; }
.list-day:first-child { margin-top: 0; }
.appt-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-left: 4px solid var(--c);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
}
.appt-row:hover { background: var(--slate-50); text-decoration: none; }
.appt-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.appt-dialog { border: none; border-radius: var(--radius); box-shadow: var(--shadow-md); max-width: 560px; width: calc(100% - 32px); padding: 1.25rem; }
.appt-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.ends-at { margin: 0; padding: 0.55rem 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Recordatorios */
.record-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .record-grid { grid-template-columns: 1fr; } }
.reminder-list { list-style: none; margin: 0; padding: 0; }
.reminder-list li { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.reminder-list li form { margin: 0; }
.reminder-list input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin-top: 0.2rem; }
.reminder-list li.is-done strong { text-decoration: line-through; color: var(--muted); }
.reminder-list li.is-overdue strong { color: #991b1b; }
.date-quick { display: flex; flex-direction: column; gap: 0.4rem; }
.date-quick .quick { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.date-quick .quick .btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

/* Estadísticas */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 1rem; margin-top: 1rem; }
.chart-card { margin: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.chart-head h2 { margin: 0 0 0.5rem; }
.chart-total { font-size: 0.8rem; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--slate-200); stroke-width: 1; }
.chart .grid.base { stroke: var(--slate-500); }
.chart .tick { font-size: 10px; fill: var(--muted); }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .bar-g:hover .hit { fill: var(--accent-soft); }
.chart .bar-g:hover .bar { fill: var(--accent-hover); }
.chart-table summary { font-size: 0.8rem; color: var(--muted); cursor: pointer; margin-top: 0.4rem; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 2.5rem; gap: 0.6rem; align-items: center; font-size: 0.85rem; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 14px; background: var(--slate-50); border-radius: 4px; overflow: hidden; }
.hb-bar { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbars li:hover .hb-bar { background: var(--accent-hover); }
.hb-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* Foto del paciente */
.photo-stage {
  position: relative;
  width: min(280px, 100%);
  aspect-ratio: 3 / 4;
  margin: 0.25rem auto 0.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--slate-50);
  border: 1px dashed var(--slate-500);
}
.photo-stage video, .photo-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-stage video { transform: scaleX(-1); }
.photo-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.9rem; }
.photo-count {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 5rem; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.photo-actions { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.photo-actions .btn { min-height: 44px; }
.patient-photo { width: 160px; border-radius: var(--radius); border: 1px solid var(--border); display: block; margin-bottom: 0.75rem; }
.patient-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); box-shadow: var(--shadow-md); }

/* El atributo hidden siempre gana (las clases como .btn fijan display) */
[hidden] { display: none !important; }

/* Imágenes clínicas */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-top: 1rem; }
.photo-grid figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--slate-50); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-grid figcaption { padding: 0.5rem; font-size: 0.78rem; display: grid; gap: 0.2rem; }
.photo-del { padding: 0.15rem 0.4rem; font-size: 0.7rem; color: var(--danger); border: none; justify-self: start; }

/* Ficha: acciones y perfil */
.patient-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.patient-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.profile-seg { margin-left: 0.25rem; }
.profile-seg button { border: none; background: transparent; padding: 0.35rem 0.85rem; font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--text); }
.profile-seg button.on { background: var(--accent); color: #fff; }

.avatar-btn { border: none; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-empty { display: grid; place-items: center; font-size: 0.72rem; color: var(--muted); background: var(--slate-50); border: 1px dashed var(--slate-500) !important; box-shadow: none !important; }

.photo-pick { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.photo-pick .btn { min-height: 44px; display: inline-flex; align-items: center; margin: 0; }

.link-btn { border: none; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

.check-inline { display: flex !important; gap: 0.5rem; align-items: center; font-weight: 400; margin-top: 0.6rem; }
.check-inline input { width: auto; margin: 0; }

/* Área de administración */
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.admin-tile { margin: 0; display: flex; flex-direction: column; gap: 0.3rem; color: var(--text); }
.admin-tile:hover { text-decoration: none; box-shadow: var(--shadow-md); }
.admin-tile span { font-size: 0.82rem; color: var(--muted); }
.module-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.3rem 1rem; font-size: 0.88rem; }
.module-list li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.module-list li.off { color: var(--muted); }
.module-list li.off::before { content: "– "; color: var(--subtle); }

/* Zoom del odontograma */
.odo-zoom-level { font-size: 0.75rem; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 2.8rem; text-align: center; }
.odo-editor:not(.is-zoomed) .odo-fit { opacity: 0.45; }
.odo-editor.is-zoomed .odo-canvas { outline: 2px solid var(--accent-soft); outline-offset: -2px; }

/* Conectar calendario (Google / Outlook) */
.cal-steps ol { margin: 0 0 0.75rem; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.cal-connect { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 0.75rem; }
.cal-option { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 1rem; display: grid; gap: 0.75rem; }
.cal-option.is-on { border-color: var(--accent); background: var(--accent-soft); }
.cal-option-head { display: flex; gap: 0.75rem; align-items: center; }
.cal-mark { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; }
.cal-google .cal-mark { background: #1a73e8; }
.cal-microsoft .cal-mark { background: #0f6cbd; }
.cal-state { display: block; font-size: 0.82rem; color: var(--mint-700); font-weight: 600; }
.cal-big { width: 100%; min-height: 52px; font-size: 1.05rem; }
.cal-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cal-actions form { margin: 0; }
.cal-error { margin: 0; font-size: 0.85rem; color: var(--danger); }
.cal-banner { border-left: 4px solid var(--accent); }

/* Aviso «Procesando…» */
.busy-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(250, 250, 250, 0.65); backdrop-filter: blur(1.5px); cursor: progress; }
.busy-box { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1.3rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); font-weight: 600; }
.busy-spinner { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: busy-spin 0.8s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy-spinner { animation-duration: 2.4s; } }

/* Acciones peligrosas */
.danger-btn { background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important; }
.danger-btn:hover { background: #b91c1c !important; }
.danger-zone { border-color: #fecaca; }
.reset-card { border-left: 4px solid #f5b000; }

/* Entrar con Google / Outlook */
.sso { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: 0.6rem; min-height: 48px; background: var(--card);
  border: 1px solid var(--border); color: var(--text); font-weight: 600; }
.sso-btn:hover { text-decoration: none; background: var(--slate-50); }
.sso-btn .cal-mark { width: 1.6rem; height: 1.6rem; font-size: 0.85rem; }
.sso-google .cal-mark { background: #1a73e8; }
.sso-microsoft .cal-mark { background: #0f6cbd; }
.sso-sep { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.8rem; margin: 0.5rem 0 0.75rem; }
.sso-sep::before, .sso-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
