/* ============================================================
   DentLocal · Sistema visual moderno (themable por administracion)
   Las variables --primary, --accent, --sidebar-1, --radius, --font
   se inyectan en runtime desde Configuracion > Tema visual.
   ============================================================ */
:root {
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #2563eb;
  --sidebar-1: #0b302f;
  --sidebar-2: #07211f;
  --radius: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --bg: #f1f5f9;
  --bg-2: #e9eef6;
  --panel: #ffffff;
  --line: #e3e9f2;
  --line-soft: #eef2f8;
  --text: #16212e;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --danger: #dc2626;
  --ok: #0e9f6e;
  --warn: #b45309;

  --primary-soft: color-mix(in srgb, var(--primary) 12%, #ffffff);
  --primary-softer: color-mix(in srgb, var(--primary) 7%, #ffffff);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, #ffffff);
  --ring: color-mix(in srgb, var(--primary) 30%, transparent);

  --shadow-sm: 0 1px 2px rgba(16, 33, 54, .06), 0 1px 3px rgba(16, 33, 54, .04);
  --shadow-md: 0 6px 20px rgba(16, 33, 54, .07), 0 2px 6px rgba(16, 33, 54, .05);
  --shadow-lg: 0 18px 48px rgba(16, 33, 54, .14);

  font-family: var(--font);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { width: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px;
  font-family: var(--font);
  background:
    radial-gradient(1200px 480px at 100% -10%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, var(--accent-soft), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img, canvas, iframe { max-width: 100%; }
h1, h2, h3 { color: #0f1d2b; letter-spacing: -.01em; }

/* ---------- Controls ---------- */
button, input, select, textarea { font: inherit; }
button, .button-link {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  min-height: 40px; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; text-align: center; white-space: normal; line-height: 1.2; font-weight: 600;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease, color .16s ease;
}
button:hover, .button-link:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
button:active, .button-link:active { transform: translateY(0); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

button.primary, .primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #fff), var(--primary));
  color: #fff; border-color: var(--primary-dark);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, var(--shadow-sm);
}
button.primary:hover, .primary:hover { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); border-color: var(--primary-dark); color: #fff; }
button.danger { background: #fff5f5; color: var(--danger); border-color: #f3c0bb; }
button.danger:hover { background: #fee2e2; border-color: #f0a8a0; }
button.ghost { background: transparent; border-color: color-mix(in srgb, var(--line) 80%, transparent); color: var(--muted); }
button.ghost:hover { color: var(--text); background: #fff; }

input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; min-height: 42px;
  padding: 10px 12px; background: #fff; color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input[type="color"] { padding: 4px; min-height: 42px; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); vertical-align: -3px; }
label { display: grid; gap: 6px; font-weight: 650; color: #334155; font-size: 14px; }
label span { font-weight: 600; color: #334155; display: inline-flex; gap: 8px; align-items: center; }
small { color: var(--muted); font-size: 12.5px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 12px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #5b6b7e; background: color-mix(in srgb, var(--primary) 5%, #f8fafc); font-weight: 800; }
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--primary-softer); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { white-space: nowrap; }
td:last-child, th:last-child { white-space: nowrap; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { display: grid; gap: 2px; min-width: 0; }
.brand strong, .brand small { display: block; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.brand strong { font-size: 15px; font-weight: 800; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(140deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 800; box-shadow: var(--shadow-sm); }
.brand.large .brand-mark { width: 50px; height: 50px; border-radius: 13px; font-size: 18px; }
.logo-img { width: 50px; height: 50px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 4px; }
.public-hero .brand { align-items: flex-start; }
.public-hero .brand strong { font-size: 19px; margin-top: 2px; }
.public-hero .brand small { margin-top: 4px; color: var(--muted); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; width: 100%; }
.sidebar {
  background: linear-gradient(185deg, var(--sidebar-1), var(--sidebar-2));
  color: #d7e6e4; padding: 18px 14px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh; min-width: 0;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.05);
}
.sidebar .brand { padding: 6px 6px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand strong { color: #fff; }
.sidebar .brand small { color: rgba(255,255,255,.6); }
.nav { display: grid; gap: 3px; overflow: auto; padding-right: 4px; margin: 2px 0; }
.nav::-webkit-scrollbar { width: 7px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 99px; }
.nav-item {
  width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 11px;
  color: rgba(255,255,255,.82); background: transparent; border-color: transparent;
  text-align: left; min-height: 42px; padding: 9px 12px; border-radius: 10px; font-weight: 600;
}
.nav-item .nav-ico { width: 19px; height: 19px; flex: 0 0 auto; opacity: .85; }
.nav-item b { white-space: normal; font-size: 13.5px; line-height: 1.2; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; transform: none; box-shadow: none; border-color: transparent; }
.nav-item.active {
  background: color-mix(in srgb, var(--primary) 42%, rgba(255,255,255,.06));
  color: #fff; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 60%, #6ee7d8);
}
.nav-item.active .nav-ico { opacity: 1; }
.nav-item:disabled { opacity: .38; cursor: not-allowed; }
.sidebar-logout { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #eaf3f1; margin-top: auto; }
.sidebar-logout:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.2); }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 68px; background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 26px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { display: grid; gap: 1px; min-width: 0; }
.topbar-title strong { font-size: 19px; font-weight: 800; color: #0f1d2b; }
.topbar-title small { color: var(--muted); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); }
.user-chip > div { display: grid; gap: 0; line-height: 1.15; }
.user-chip b { font-size: 13px; }
.user-chip small { font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(140deg, var(--primary), var(--accent)); }

.main { padding: 26px; display: grid; gap: 18px; min-width: 0; max-width: 1480px; width: 100%; }

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { padding: 16px 18px; min-width: 0; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .16s ease, transform .14s ease; }
.metric:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.metric span { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; padding-left: 4px; }
.metric strong { display: block; font-size: 27px; margin-top: 7px; color: #0f1d2b; font-weight: 800; letter-spacing: -.02em; padding-left: 4px; }

/* ---------- Panels ---------- */
.panel { padding: 20px; min-width: 0; box-shadow: var(--shadow-sm); }
.panel h2, .panel h3 { margin: 0 0 14px; }
.panel h2 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.panel h2::before { content: ""; width: 7px; height: 18px; border-radius: 99px; background: linear-gradient(180deg, var(--primary), var(--accent)); flex: 0 0 auto; }
.panel table { table-layout: auto; }
.panel table td:last-child { white-space: nowrap; min-width: 170px; }
.panel table td:last-child button { margin: 0; min-width: 0; max-width: 100%; padding: 7px 11px; min-height: 34px; }

.panel-head, .toolbar { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; min-width: 0; }
.toolbar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.toolbar input, .toolbar select { width: auto; min-width: 230px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 3px 11px; background: color-mix(in srgb, var(--ok) 14%, #fff); color: var(--ok); font-weight: 700; font-size: 12px; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--ok) 22%, #fff); }
.badge.warn { background: #fff7ed; color: var(--warn); border-color: #fde2c0; }
.badge.danger { background: #fef2f2; color: var(--danger); border-color: #fad3d0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { min-width: 92px; }
.table-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.table-actions button { min-height: 34px; font-size: 13.5px; }

/* ---------- Notice ---------- */
.notice { border-left: 4px solid var(--primary); background: var(--primary-soft); padding: 12px 14px; border-radius: 10px; color: #0f3b37; }

/* ---------- Users / roles editors ---------- */
.users-editor { display: grid; gap: 14px; }
.user-edit-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; box-shadow: var(--shadow-sm); }
.user-edit-card h3 { margin: 0 0 14px; font-size: 16px; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.role-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; box-shadow: var(--shadow-sm); display: grid; gap: 6px; align-content: start; }
.role-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.role-card-head h3 { margin: 0; font-size: 15px; }
.role-card-head button { min-height: 30px; padding: 5px 10px; font-size: 12.5px; min-width: 0; }
.perm-line { font-weight: 500; font-size: 13.5px; }
.perm-line span { font-weight: 500; color: #475569; }
.perm-modules { display: grid; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ---------- Theme preview ---------- */
.theme-preview { display: grid; grid-template-columns: 60px 1fr; height: 96px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.theme-preview-side { background: var(--ps, #0b302f); }
.theme-preview-body { background: #f6f9fc; padding: 14px; display: flex; gap: 10px; align-items: center; }
.theme-preview-body span { height: 30px; border-radius: 8px; }
.theme-chip-1 { width: 84px; background: var(--pv, #0f766e); }
.theme-chip-2 { width: 60px; background: var(--pa, #2563eb); }
.theme-chip-3 { width: 44px; background: #e2e8f0; }

/* ---------- Requests ---------- */
.request-list { display: grid; gap: 12px; }
.request-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; min-width: 0; box-shadow: var(--shadow-sm); }
.request-card .actions { display: flex; justify-content: flex-start; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line-soft); margin-top: 14px; padding-top: 14px; }
.request-card .actions button { min-width: 108px; width: auto; flex: 0 0 auto; }
.request-main { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; min-width: 0; align-items: start; width: 100%; }
.request-main span { display: block; min-width: 0; overflow-wrap: break-word; line-height: 1.4; font-size: 14px; }
.request-main b { display: block; margin-bottom: 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }

/* ---------- Agenda ---------- */
.agenda-board { display: grid; gap: 12px; }
.appointment { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: var(--radius); padding: 15px 16px; display: grid; grid-template-columns: 130px 1fr auto; gap: 14px; min-width: 0; box-shadow: var(--shadow-sm); transition: box-shadow .16s ease; }
.appointment:hover { box-shadow: var(--shadow-md); }
.appointment > div:first-child b { font-size: 14px; }

/* ---------- Patient ---------- */
.patient-layout { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; }
.patient-list { display: grid; gap: 8px; }
.patient-link { text-align: left; background: #fff; }
.details { display: grid; grid-template-columns: 190px 1fr; gap: 10px 16px; }
.details dt { color: var(--muted); font-weight: 700; font-size: 13.5px; }
.details dd { margin: 0; min-width: 0; overflow-wrap: break-word; font-size: 14px; }

/* ---------- Odontograma ---------- */
.odontogram { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 8px; }
.tooth { min-height: 66px; display: grid; gap: 3px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px; transition: border-color .14s ease, box-shadow .14s ease, transform .1s ease; }
.tooth:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.tooth b { font-size: 13px; }
.tooth span { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.1; }
.tooth.caries { background: #fff1f0; border-color: #f3b4ad; }
.tooth.restauracion { background: #eef5ff; border-color: #aecbff; }
.tooth.corona { background: #fef8d8; border-color: #ecd270; }
.tooth.endodoncia { background: #f5ecff; border-color: #cda6f0; }
.tooth.ausente, .tooth.extraccion { background: #f1f5f9; color: #64748b; }
.tooth.implante { background: #ecfdf5; border-color: #8fdcc0; }
.tooth.selected { box-shadow: inset 0 0 0 2px var(--primary); border-color: var(--primary); }
.tooth-detail { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.legend span { border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; background: #fff; font-size: 12px; color: #475569; }

/* ---------- Print / signature ---------- */
.print-area { background: #fff; border: 1px solid var(--line); padding: 24px; border-radius: var(--radius); }
.pdf-frame { width: 100%; min-height: 72vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
canvas.signature { width: 100%; height: 180px; border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--line)); border-radius: var(--radius); background: #fff; touch-action: none; }

/* ---------- WhatsApp ---------- */
.whatsapp-list { display: grid; gap: 10px; }
.whatsapp-card { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, 1.45fr); gap: 14px; align-items: start; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.whatsapp-card-main { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.whatsapp-card small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11.5px; line-height: 1.2; text-transform: uppercase; letter-spacing: .03em; }
.whatsapp-card strong, .whatsapp-card span { display: block; line-height: 1.3; overflow-wrap: anywhere; font-size: 13.5px; }
.whatsapp-card-message { min-width: 0; }
.whatsapp-card-message p { margin: 0 0 4px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.whatsapp-message { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 22px;
  background:
    radial-gradient(900px 480px at 15% 10%, var(--primary-soft), transparent 55%),
    radial-gradient(800px 420px at 90% 80%, var(--accent-soft), transparent 55%),
    linear-gradient(135deg, #eef4f3, #eef3fb); }
.login-panel { width: min(460px, 100%); background: #fff; padding: 30px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.login-panel .brand { margin-bottom: 4px; }
.initial-users { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.initial-users b { color: #334155; }
.success { padding: 18px; border: 1px solid color-mix(in srgb, var(--ok) 30%, #fff); background: color-mix(in srgb, var(--ok) 10%, #fff); color: #14532d; border-radius: 12px; }

/* ---------- Public booking ---------- */
.public-shell { min-height: 100vh; padding: 26px;
  background:
    radial-gradient(1000px 520px at 12% -5%, var(--primary-soft), transparent 55%),
    radial-gradient(900px 460px at 95% 10%, var(--accent-soft), transparent 50%),
    linear-gradient(135deg, #eaf4f2, #f3f8ff); }
.public-card { width: 100%; max-width: 1040px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); }
.public-hero { padding: 34px; display: grid; gap: 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #ffffff, #fbfdff); }
.public-admin-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.public-hero h1 { margin: 8px 0 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.1; color: #0e2b29; overflow-wrap: break-word; }
.public-hero p { margin: 0; color: var(--muted); font-size: 16px; }
.public-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.public-steps > div { background: #f8fbfd; padding: 22px 20px; min-height: 92px; }
.step-title { display: flex; gap: 14px; align-items: flex-start; }
.step-title span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(140deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 800; flex: 0 0 auto; }
.step-title div { display: grid; gap: 3px; }
.step-title b { font-size: 15px; }
.booking-form { padding: 30px; display: grid; gap: 26px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full { grid-column: 1 / -1; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-day { display: grid; gap: 4px; min-height: 74px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; transition: border-color .14s ease, box-shadow .14s ease; }
.calendar-day:not(.disabled):hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.calendar-day span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.calendar-day b { font-size: 14px; }
.calendar-day small { font-size: 11px; }
.calendar-day.selected { border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); background: var(--primary-softer); }
.calendar-day.disabled { opacity: .45; cursor: not-allowed; }
.time-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.time-grid button { min-width: 78px; border-radius: 10px; }
.time-grid button.selected { background: var(--primary); color: #fff; border-color: var(--primary-dark); }
.time-grid button:disabled { opacity: .5; background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
.time-grid button small { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.1; color: inherit; }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 1200px) { .public-steps { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment { grid-template-columns: 1fr; }
  .patient-layout { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px; gap: 12px; }
  .sidebar .brand { border-bottom: 0; }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; gap: 8px; padding: 0; }
  .nav-item { min-width: 0; justify-content: center; text-align: center; flex-direction: column; gap: 5px; min-height: 56px; padding: 9px 6px; }
  .nav-item.active { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--primary) 60%, #6ee7d8); }
  .nav-item b { font-size: 11.5px; }
  .sidebar-logout { margin-top: 0; align-self: stretch; }
  .topbar { position: static; }
  .content { width: 100%; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .odontogram { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .public-shell { padding: 12px; }
  .public-card { border-radius: 16px; }
  .public-hero { padding: 22px; }
  .public-hero h1 { font-size: 29px; }
  .public-steps > div { padding: 16px; min-height: auto; }
  .booking-form { padding: 18px; gap: 18px; }
  .topbar { padding: 14px; flex-wrap: wrap; }
  .topbar-user { width: 100%; justify-content: space-between; }
  .main { padding: 16px; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics, .grid-2, .grid-3, .form-grid, .public-steps, .request-main { grid-template-columns: 1fr; }
  .metric strong { font-size: 23px; }
  .calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .odontogram { grid-template-columns: repeat(4, 1fr); }
  .request-card .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-card .actions button { width: 100%; min-width: 0; }
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .actions button, .actions .button-link { width: 100%; }
  .toolbar input, .toolbar select, .toolbar button { width: 100%; min-width: 0; }
  .details { grid-template-columns: 1fr; }
  .whatsapp-card { grid-template-columns: 1fr; }
  .whatsapp-card-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  th, td { padding: 10px 8px; font-size: 12.5px; }
  .panel > div[style*="overflow"] { margin-left: -6px; margin-right: -6px; padding: 0 6px 4px; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }
  .panel { padding: 16px; }
}
@media (max-width: 430px) {
  .public-hero h1 { font-size: 26px; }
  .calendar { grid-template-columns: 1fr; }
  .actions, .request-main { grid-template-columns: 1fr; }
  .request-card .actions { grid-template-columns: 1fr; }
  .time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .time-grid button { width: 100%; }
  .odontogram { grid-template-columns: repeat(4, 1fr); }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { min-width: 520px; }
}
@media print {
  .sidebar, .topbar, .toolbar, button { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .panel, .print-area { border: 0; box-shadow: none; }
  body { background: #fff; }
}
