@import url("tokens.css?v=2");
@import url("base.css?v=1"); /* B1-DIZ: fonti, elementet bazë, fokusi, gjendjet */
/* ============================================================
   DENTAL CRM — Modern UI (2026)
   Paleta: Soft mint/teal për dental + neutralë profesionalë
   ============================================================ */

:root {
  /* 23-11: ngjyrat vijnë nga tokenat e markës THEA (assets/tokens.css) */
  --primary:        var(--thea-teal);
  --primary-dark:   var(--thea-teal-dark);
  --primary-light:  var(--thea-teal-light);
  --accent:         var(--thea-teal-dark);
  --cta:            var(--thea-amber);
  --on-cta:         var(--thea-on-amber);
  --warning:        var(--thea-warning);
  --danger:         var(--thea-danger);
  --success:        var(--thea-success);
  --info:           #0ea5e9;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #6b7280;  /* B1-DIZ: ishte #9ca3af (2,5:1) — tani AA mbi të bardhë */
  --gray-500: #5f6b7a;  /* B1-DIZ: ishte #6b7280 — AA edhe mbi --gray-100 */
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --sidebar-w: 240px;
  --header-h: 60px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --radius: var(--thea-radius);
}
/* B1-DIZ RD-03: tema e errët — shkalla gri përmbyset, sipërfaqet vijnë nga tokenat */
:root[data-theme="dark"] {
  --primary-light:  var(--thea-teal-light);
  --gray-50:  #122127;
  --gray-100: #1b2f36;
  --gray-200: #2a3b41;
  --gray-300: #3e535a;
  --gray-400: #9fb1b7;
  --gray-500: #a8b8bd;
  --gray-600: #b8c6cb;
  --gray-700: #cbd6da;
  --gray-800: #dce5e8;
  --gray-900: #eef3f5;
}

/* ── Typography ────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { font-size: 14.5px; }
body {
  font-family: var(--thea-font);
  background: var(--thea-bg);
  color: var(--thea-ink);
  margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--gray-900); letter-spacing: -0.01em; }
a { color: var(--thea-link); text-decoration: none; }
a:hover { color: var(--thea-link-hover); }

/* ── Layout: sidebar + main ──────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--thea-sidebar-bg);
  color: var(--thea-sidebar-fg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 22px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-right: 10px;
  font-size: 1.2rem;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--thea-sidebar-fg);
  font-weight: 500;
  font-size: .94rem;
  margin-bottom: 2px;
  transition: all .15s;
}
.sidebar-nav a i {
  width: 20px; margin-right: 10px;
  font-size: 1.05rem; color: var(--thea-sidebar-muted);
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.sidebar-nav a:hover i { color: #e5f2f1; }
.sidebar-nav a.active {
  background: var(--thea-teal);
  color: #fff;
}
.sidebar-nav a.active i { color: #fff; }
.sidebar-nav .nav-section {
  font-size: .7rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--thea-sidebar-muted);  /* B1-DIZ RD-04: ishte --gray-500 mbi të errët (3,7:1) */
  padding: 14px 14px 6px;
  letter-spacing: .08em;
}
.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem;
}
.avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}
.sidebar-foot .meta { flex: 1; line-height: 1.2; }
.sidebar-foot .meta .name { color: #fff; font-weight: 600; }
.sidebar-foot .meta .role { color: var(--thea-sidebar-muted); font-size: .75rem; }
.sidebar-foot .logout {
  color: var(--thea-sidebar-muted);
  font-size: 1.1rem;
}
.sidebar-foot .logout:hover { color: var(--danger); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
}
.topbar {
  height: var(--header-h);
  background: var(--thea-card);
  border-bottom: 1px solid var(--thea-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.content {
  padding: 24px;
  max-width: 1400px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--thea-card);
  color: var(--thea-ink);
  border-radius: var(--radius);
  border: 1px solid var(--thea-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  font-size: .95rem;
  /* B1-DIZ RD-07: titulli mbetet bashkë me ikonën në të majtë; veprimi i fundit (buton/lidhje/formular) shkon djathtas */
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap;
}
.card-header > :last-child:not(:first-child):is(a, button, form, select, .btn, .pill, .badge, div, span.r, small, .muted) { margin-left: auto; }
.card-header i { color: var(--thea-link); margin-right: 2px; }
.card-body { padding: 18px; }

/* ── Stats Cards (dashboard) ─────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--thea-card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--thea-border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all .2s;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat .ico {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat .ico.warn   { background: var(--thea-warning-bg); color: var(--thea-warning-fg); }
.stat .ico.info   { background: var(--thea-info-bg); color: var(--thea-info-fg); }
.stat .ico.primary{ background: var(--primary-light); color: var(--primary-dark); }
.stat .ico.ok     { background: var(--thea-success-bg); color: var(--thea-success-fg); }
.stat .label {
  font-size: .82rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.stat .num {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}
.stat .sub {
  font-size: .75rem;
  color: var(--thea-muted);
  margin-top: 4px;
}
.stat a { font-size: .8rem; }

/* ── Lists / table-like ─────────────────────────────────────── */
.list-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center;
  transition: background .1s;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--gray-50); }
.list-item .info { flex: 1; min-width: 0; }
.list-item .info .name { font-weight: 600; color: var(--gray-900); }
.list-item .info .meta { font-size: .82rem; color: var(--gray-500); margin-top: 2px; }
.list-item .right { text-align: right; font-size: .82rem; color: var(--gray-600); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--thea-text2);
}
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: 8px; color: var(--thea-muted); }
.empty-state h3 { font-size: 1rem; margin: 8px 0 4px; color: var(--thea-ink); }
.empty-state p { margin: 0 auto; max-width: 46ch; font-size: .9rem; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-modern {
  width: 100%;
  background: var(--thea-card);
  border-collapse: separate;
  border-spacing: 0;
}
.table-modern thead th {
  background: var(--thea-surface-2);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--thea-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
}
.table-modern tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: .9rem;
  vertical-align: middle;
}
.table-modern tbody tr:hover { background: var(--gray-50); }
.table-modern tbody tr:last-child td { border-bottom: 0; }

/* ── Badges / pills ─────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 600;
  line-height: 1.4;
}
.pill i { font-size: .8rem; }
.pill.gray    { background: var(--gray-100); color: var(--gray-700); }
.pill.info    { background: var(--thea-info-bg); color: var(--thea-info-fg); }
.pill.primary { background: var(--primary-light); color: var(--primary-dark); }
.pill.success { background: var(--thea-success-bg); color: var(--thea-success-fg); }
.pill.warn    { background: var(--thea-warning-bg); color: var(--thea-warning-fg); }
.pill.danger  { background: var(--thea-danger-bg); color: var(--thea-danger-fg); }
.pill.dark    { background: var(--gray-800); color: var(--thea-card); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: .87rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  border-radius: var(--thea-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .1s;
  background: var(--thea-card);
  color: var(--thea-ink);
  border-color: var(--thea-border-strong);
  text-decoration: none;
}
.btn:hover { background: var(--thea-surface-2); color: var(--thea-ink); }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--thea-teal-dark); border-color: var(--thea-teal-dark); color: #fff; }
.btn-danger { background: var(--thea-danger); color: #fff; border-color: var(--thea-danger); }
.btn-danger:hover { background: #861e23; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--thea-link); }
.btn:disabled, .btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; }
/* 23-11: jeshilja e suksesit s'është ngjyrë butoni — butoni «sukses» merr teal-in e markës */
.btn-success { background: var(--primary); color: #fff; border: 0; }
.btn-success:hover { background: var(--thea-teal-dark); color: #fff; }
/* 23-11: paralajmërimi #b7791f me tekst ink (i bardhi do jepte vetëm 3,7:1) */
.btn-warn { background: var(--warning); color: var(--thea-ink); border: 0; }
.btn-warn:hover { background: #9c6619; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-icon { padding: 6px 8px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--thea-text2);
  margin-bottom: 4px;
}
.form-control, .form-select {
  width: 100%;
  padding: 7px 11px;
  font-size: .9rem;
  font-family: inherit;
  border: 1px solid var(--thea-border-strong);
  border-radius: var(--thea-radius-sm);
  background: var(--thea-input-bg);
  color: var(--thea-ink);
  transition: border-color .1s, box-shadow .1s;
}
.form-control:focus, .form-select:focus {
  outline: 2px solid var(--thea-focus-color);
  outline-offset: 0;
  border-color: var(--thea-focus-color);
  box-shadow: var(--thea-focus-ring);
}
.form-control[aria-invalid="true"], .form-control.is-invalid { border-color: var(--thea-danger); }
.form-help { font-size: .8rem; color: var(--thea-muted); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--thea-danger-fg); margin-top: 4px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

/* ── Patient header ─────────────────────────────────────────── */
.patient-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--thea-teal-dark) 100%);
  color: #fff;
  padding: 28px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.patient-hero .avatar-lg {
  width: 70px; height: 70px;
  background: rgba(255,255,255,.2);
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1.6rem;
  color: #fff;
}
.patient-hero h2 { color: #fff; margin: 0; font-size: 1.5rem; }
.patient-hero .phone {
  font-size: 1.2rem;
  font-weight: 500;
  color: #fff;
  display: inline-flex; align-items: center; gap: 8px;
}
.patient-hero .phone:hover { color: #e5f2f1; }
.patient-hero .meta { opacity: .85; font-size: .85rem; }

/* ── Status big pill ────────────────────────────────────────── */
.status-pill-lg {
  padding: 8px 16px;
  font-size: .92rem;
  font-weight: 600;
  border-radius: 999px;
  color: var(--thea-ink);
  background: rgba(255,255,255,.95);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ── Activity timeline ───────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.timeline-item {
  position: relative;
  padding-bottom: 14px;
  font-size: .85rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--thea-card);
}
.timeline-item .ts { color: var(--gray-500); font-size: .75rem; }
.timeline-item .who { font-weight: 600; color: var(--gray-800); }

/* ── Toast (click-to-dial feedback) ─────────────────────────── */
#crm-toast {
  position: fixed;
  top: 80px; right: 24px;
  background: var(--thea-ink);
  color: var(--thea-card);
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  font-size: .9rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  transform: translateY(-10px);
  pointer-events: none;
}
#crm-toast.show { opacity: 1; transform: translateY(0); }

/* ── Login page ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--thea-teal-dark) 100%);
  padding: 20px;
}
.login-card {
  background: var(--thea-card);
  color: var(--thea-ink);
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 {
  text-align: center;
  font-size: 1.4rem;
  margin: 0 0 6px;
}
.login-card .sub {
  text-align: center;
  color: var(--gray-500);
  font-size: .9rem;
  margin-bottom: 24px;
}
.login-card .tooth-icon {
  width: 56px; height: 56px;
  background: var(--primary-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 1.8rem;
  color: var(--primary-dark);
}
.alert {
  padding: 10px 14px;
  border-radius: 7px;
  font-size: .87rem;
  margin-bottom: 14px;
}
.alert-danger { background: var(--thea-danger-bg); color: var(--thea-danger-fg); }
.alert-info { background: var(--thea-info-bg); color: var(--thea-info-fg); }
.alert-warning { background: var(--thea-warning-bg); color: var(--thea-warning-fg); }
.alert-success { background: var(--thea-success-bg); color: var(--thea-success-fg); }

/* ── Utility ────────────────────────────────────────────────── */
.row-flex { display: flex; flex-wrap: wrap; gap: 16px; }
.col-7 { flex: 0 0 calc(58.33% - 8px); min-width: 0; }
.col-5 { flex: 0 0 calc(41.67% - 8px); min-width: 0; }
.col-6 { flex: 0 0 calc(50% - 8px); min-width: 0; }
.col-4 { flex: 0 0 calc(33.33% - 11px); min-width: 0; }
.col-3 { flex: 0 0 calc(25% - 12px); min-width: 0; }
@media (max-width: 900px) {
  .col-7, .col-5, .col-6, .col-4, .col-3 { flex: 0 0 100%; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-toggle { display: inline-flex !important; }
  .content { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat .num { font-size: 1.3rem; }
  .stat .ico { width: 40px; height: 40px; font-size: 1.1rem; }
  .topbar { padding: 0 14px; }
  .topbar form input { width: 150px !important; font-size: .8rem !important; }
  .patient-hero { padding: 18px; }
  .patient-hero h2 { font-size: 1.15rem; }
  .patient-hero .avatar-lg { width: 50px; height: 50px; font-size: 1.2rem; }
  /* mobile: drop the right-side action column below, full width, wrapping */
  .patient-hero > .d-flex { flex-wrap: wrap; }
  .patient-hero > .d-flex > .text-end { width: 100%; flex-direction: row !important; flex-wrap: wrap; align-items: center !important; justify-content: flex-start !important; margin-top: 12px; }
  .patient-hero > .d-flex > .text-end .btn { flex: 0 0 auto; }
  .table-modern thead { display: none; }
  .table-modern tbody td { display: block; padding: 6px 14px; border: 0; }
  .table-modern tbody tr { border-bottom: 1px solid var(--gray-200); padding: 8px 0; display: block; }
  .table-modern tbody tr:hover { background: var(--gray-50); }
  /* labelled cells: show column name when header is hidden (e.g. performance table) */
  .table-modern tbody td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .table-modern tbody td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--gray-500); font-size: .78rem; }
  .table-modern tbody td.cell-agent { background: var(--gray-50); padding: 10px 14px; font-weight: 600; }
  /* ── overflow fixes (full CRM mobile audit 2026-05-30) ── */
  .form-select { max-width: 100%; }                                  /* safety net: no select wider than its box */
  .statusbar form { flex-wrap: wrap; min-width: 0 !important; }      /* patient dual-status: stack within form */
  .statusbar .form-select { width: 100% !important; }
  .cal-bar { flex-wrap: wrap; }                                      /* calendar toolbar groups wrap */
  .cal-bar .form-select { max-width: 44vw; font-size: .8rem; }
  .heatmap-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }  /* performance heatmap scrolls */
  .heatmap-wrap table { min-width: 560px; }
  .btn { padding: 8px 14px; }  /* finger-friendly */
  .form-row { grid-template-columns: 1fr; }
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .card-body { padding: 14px; }
  .kanban { display: block !important; height: auto !important; }
  .kcol { margin-bottom: 12px; max-height: 380px; }
  audio { height: 32px; }
}
@media (max-width: 500px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { gap: 6px; padding: 0 10px; }
  .topbar .page-title { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  /* declutter topbar: drop secondary buttons, collapse Support to icon-only */
  .topbar .tb-extra { display: none !important; }
  .topbar .tb-support .tb-label { display: none; }
  .topbar .tb-support { padding: 7px 9px !important; }
  .topbar form input { width: 110px !important; }
}
.mobile-toggle { display: none; margin-right: 12px; }
.muted { color: var(--thea-muted); font-size: .85rem; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-3 { margin-bottom: 18px; }
.text-end { text-align: right; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-1 { flex: 1; min-width: 0; }
.hidden { display: none; }
.input-group { display: flex; }
.input-group .form-control { border-radius: 7px 0 0 7px; }
.input-group .btn { border-radius: 0 7px 7px 0; border: 1px solid var(--thea-border-strong); border-left: 0; }

/* Audio player slim */
audio { width: 100%; height: 36px; }

/* Phone link special */
.phone-link {
  color: var(--thea-link);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.phone-link:hover {
  color: var(--thea-link-hover);
  text-decoration: none;
}
.phone-link i { color: var(--success); }

/* ─────────────────────────────────────────────────────────────
   INTERNAL CHAT WIDGET (unified with ViciDial agent chat)
   ───────────────────────────────────────────────────────────── */
.chat-fab{
  position:fixed; right:22px; bottom:22px; z-index:1200;
  width:56px; height:56px; border-radius:50%; border:0; cursor:pointer;
  background:linear-gradient(135deg,var(--primary) 0%,var(--thea-teal-dark) 100%);
  color:#fff; font-size:1.5rem; box-shadow:var(--shadow-lg);
  display:flex; align-items:center; justify-content:center;
  transition:transform .15s ease, box-shadow .15s ease;
}
.chat-fab:hover{ transform:translateY(-2px) scale(1.04); }
.chat-fab .badge{
  position:absolute; top:-3px; right:-3px; min-width:20px; height:20px; padding:0 5px;
  background:var(--danger); color:#fff; border-radius:10px; border:2px solid #fff;
  font-size:.7rem; font-weight:700; line-height:16px; text-align:center;
}
.chat-panel{
  position:fixed; right:22px; bottom:88px; z-index:1201;
  width:340px; max-width:calc(100vw - 44px); height:480px; max-height:calc(100vh - 130px);
  background:var(--thea-card); border:1px solid var(--thea-border); border-radius:var(--radius);
  box-shadow:var(--shadow-lg); display:none; flex-direction:column; overflow:hidden;
}
.chat-panel.open{ display:flex; animation:chatpop .16s ease; }
@keyframes chatpop{ from{ opacity:0; transform:translateY(12px) scale(.98);} to{ opacity:1; transform:none; } }
.chat-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:12px 14px; color:#fff; font-weight:600; font-size:.95rem;
  background:linear-gradient(135deg,var(--primary) 0%,var(--thea-teal-dark) 100%);
}
.chat-head .close{ background:transparent; border:0; color:#fff; cursor:pointer; font-size:1rem; opacity:.85; }
.chat-head .close:hover{ opacity:1; }
.chat-back-btn:hover{ opacity:.8; }
.chat-users{ overflow-y:auto; flex:1; }
.chat-users .user-row{
  display:flex; align-items:center; gap:10px; padding:10px 14px; cursor:pointer;
  border-bottom:1px solid var(--gray-100);
}
.chat-users .user-row:hover{ background:var(--gray-50); }
.chat-users .unread{
  background:var(--danger); color:#fff; border-radius:10px; min-width:20px; height:20px;
  padding:0 6px; font-size:.7rem; font-weight:700; line-height:20px; text-align:center;
}
.chat-msgs{ flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:6px; background:var(--gray-50); }
.chat-msg{
  max-width:78%; padding:7px 11px; border-radius:12px; font-size:.88rem; line-height:1.35;
  word-wrap:break-word; position:relative;
}
.chat-msg.me{ align-self:flex-end; background:var(--primary); color:#fff; border-bottom-right-radius:3px; }
.chat-msg.them{ align-self:flex-start; background:var(--thea-card); color:var(--gray-800); border:1px solid var(--gray-200); border-bottom-left-radius:3px; }
.chat-msg .meta{ font-size:.65rem; opacity:.7; margin-top:3px; text-align:right; }
.chat-input{ display:flex; gap:6px; padding:10px; border-top:1px solid var(--thea-border); background:var(--thea-card); }
.chat-input input{
  flex:1; border:1px solid var(--gray-300); border-radius:20px; padding:8px 14px;
  font-size:.88rem; outline:none; background:var(--thea-input-bg); color:var(--thea-ink);
}
.chat-input input:focus{ border-color:var(--primary); }
.chat-input button{
  border:0; background:var(--primary); color:#fff; width:38px; height:38px; border-radius:50%;
  cursor:pointer; flex-shrink:0; display:flex; align-items:center; justify-content:center;
}
.chat-input button:hover{ background:var(--thea-teal-dark); }
.spinner{
  display:inline-block; width:22px; height:22px; border:3px solid var(--gray-200);
  border-top-color:var(--primary); border-radius:50%; animation:spin .7s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ── Faza A / KLI (K10, G9): kolonat që mungonin + celulari (agjenda, kartela, odontograma) ── */
.col-2 { flex: 0 0 calc(16.66% - 13px); min-width: 0; }
.col-8 { flex: 0 0 calc(66.66% - 6px); min-width: 0; }
.col-9 { flex: 0 0 calc(75% - 4px); min-width: 0; }
.col-12 { flex: 0 0 100%; min-width: 0; }
.dv-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.odo-prim { width: 38px !important; height: 46px !important; border-radius: 14px !important; }
/* D-16 (vala demo 20-11): në 1366 px (kolona 2/3) 16 dhëmbë × 44 px s'hynin dhe 18/48, 28/38 priteshin — më të ngushtë deri në 1500 px + scroll rezervë */
@media (min-width: 601px) and (max-width: 1500px) {
  .odo-t { width: 36px !important; height: 50px !important; font-size: .72rem !important; }
  .odo-prim { width: 32px !important; height: 44px !important; }
  .odo-half { gap: 3px !important; }
  .odo-row { gap: 10px !important; }
}
.card:has(> .odo-row) { overflow-x: auto; }
@media (max-width: 900px) {
  .col-2, .col-8, .col-9, .col-12 { flex: 0 0 100%; }
  .card { max-width: 100%; }
  .card > table.table, .card > form > table.table { display: block; overflow-x: auto; }
  .row-flex > [class^="col-"] { max-width: 100%; }
}
@media (max-width: 600px) {
  .odo-row { flex-direction: column; align-items: center; gap: 8px !important; }
  .odo-t { width: 36px !important; height: 46px !important; font-size: .72rem !important; }
  .odo-prim { width: 34px !important; height: 42px !important; }
  .content h3 { flex-wrap: wrap; }
}

/* C1: «Të hapur së fundi» te shiriti anësor (më parë pa stil: tekst i errët mbi sfond të errët, emrat ngjitur) */
.recent-widget{padding:8px 14px 10px;border-top:1px solid rgba(255,255,255,.08)}
.recent-widget .title{font-size:.7rem;text-transform:uppercase;font-weight:600;letter-spacing:.08em;color:var(--thea-sidebar-muted);margin-bottom:4px}
.recent-widget a{display:block;color:rgba(255,255,255,.82);font-size:.8rem;padding:3px 6px;border-radius:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none}
.recent-widget a:hover{background:rgba(255,255,255,.08);color:#fff}
/* C1: celular — butoni lundrues i chat-it s’mbulon më fundin e përmbajtjes (hapësirë poshtë + buton më i vogël) */
@media (max-width: 600px) {
  .content { padding-bottom: 88px; }
  .chat-fab { width: 48px; height: 48px; right: 14px; bottom: 14px; font-size: 1.3rem; }
}


/* ════════════════════════════════════════════════════════════════
   B1-DIZ (29-11-2026) — sistemi i dizajnit: përbërësit e përbashkët,
   celulari (RD-05), aksesueshmëria (RD-04) dhe tema e errët (RD-03).
   Dokumentimi: docs/dizajni.md. Ngjyrat vetëm nga tokenat.
   ════════════════════════════════════════════════════════════════ */

/* ── kartat me përmbajtje të drejtpërdrejtë (pa .card-header/.card-body) marrin hapësirë të brendshme (RD-07: «Demografia» prekte kufirin) ── */
.card:not(:has(> .card-header)):not(:has(> .card-body)):not(:has(> table)):not(:has(> .table-modern)):not(:has(> .list-item)):not(:has(> .table-wrap)):not(:has(> .dv-scroll)):not(:has(> .odo-row)) { padding: 16px 18px; }
.card > h3:first-child, .card > h4:first-child { font-size: 1rem; }

/* ── tabelat: edhe <table> e zhveshur brenda kartës merr stilin e përbashkët ── */
.card table:not([class]), .card table.table { width: 100%; border-collapse: collapse; }
.card table:not([class]) th, .card table.table th { text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--thea-muted); background: var(--thea-surface-2); padding: 10px 12px; border-bottom: 1px solid var(--thea-border); }
.card table:not([class]) td, .card table.table td { padding: 10px 12px; border-bottom: 1px solid var(--thea-border); vertical-align: middle; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ── fushat pa klasë (formularët e vjetër) marrin të njëjtën pamje ── */
.content input:not([type]), .content input[type=text], .content input[type=email], .content input[type=tel],
.content input[type=number], .content input[type=date], .content input[type=time], .content input[type=datetime-local],
.content input[type=search], .content input[type=password], .content input[type=url], .content select, .content textarea {
  border: 1px solid var(--thea-border-strong); border-radius: var(--thea-radius-sm);
  background-color: var(--thea-input-bg); color: var(--thea-ink);
}
.content textarea { padding: 7px 11px; }

/* ── shiriti i sipërm: butonat dhe kërkimi me tokenat ── */
.topbar form input[name=q] { background: var(--thea-surface-2) !important; color: var(--thea-ink); border-color: var(--thea-border-strong) !important; }
.topbar .tb-extra { color: var(--thea-text2) !important; border-color: var(--thea-border-strong) !important; }
.lang-switch option { color: #0f1e25; }
.platform-credit { color: var(--thea-muted) !important; }

/* ── RD-05: celulari — tekst ≥ 12 px, butona/fusha ≥ 40 px ── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .btn, .content button:not(.chat-back-btn), .content select, .content input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]),
  .form-control, .form-select { min-height: var(--thea-tap-min); }
  .btn-sm { min-height: 36px; padding: 6px 12px; }
  .topbar .btn, .topbar button, .topbar .tb-quick { min-height: 40px; min-width: 40px; justify-content: center; }
  .pill, .badge, small, .small, .muted, .table-modern thead th, .sidebar-nav .nav-section, .stat .sub, .stat .label { font-size: max(12px, .75rem); }
  /* tekstet e ngulitura shumë të vogla (style="font-size:.6–.72rem / 9–11px") ngrihen në 12 px */
  [style*="font-size:.6rem"], [style*="font-size:.62rem"], [style*="font-size:.65rem"], [style*="font-size:.66rem"], [style*="font-size:.68rem"],
  [style*="font-size:.7rem"], [style*="font-size:.7em"], [style*="font-size:.72rem"], [style*="font-size:.72em"], [style*="font-size:.73rem"], [style*="font-size:.74rem"],
  [style*="font-size:.75rem"], [style*="font-size:.75em"], [style*="font-size:.76rem"], [style*="font-size:.78em"], [style*="font-size:.8em"], [style*="font-size:9px"], [style*="font-size:10px"], [style*="font-size:11px"],
  [style*="font-size: .7rem"], [style*="font-size: .72rem"], [style*="font-size: .75rem"], [style*="font-size: 11px"], [style*="font-size: 10px"] { font-size: 12px !important; }
  /* shiriti i sipërm: kërkimi bëhet ikonë që zgjerohet kur preket — titulli i faqes s'pritet më në 3 shkronja */
  .topbar form input[name=q] { width: 40px !important; padding-right: 4px !important; transition: width .15s; }
  .topbar form input[name=q]:focus { width: 58vw !important; }
  .topbar .page-title { max-width: none; flex: 1; min-width: 0; }
  /* tabelat e zhveshura brenda kartave rrëshqasin brenda kartës, jo faqja */
  .card > table:not(.table-modern), .card-body > table:not(.table-modern) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── RD-04: lidhja «Kalo te përmbajtja» + fokusi brenda shiritit të errët ── */
.sidebar :focus-visible { outline-color: #8fd6d0; }
.content:focus { outline: none; }

/* ════════════════════════════════════════════════════════════════
   RD-03: TEMA E ERRËT — shtresa për stilet e ngulitura (style="…")
   Faqet e vjetra kanë ~160 atribute style për faqe me ngjyra hex. Kjo shtresë
   i përkthen ngjyrat më të shpeshta te tokenat e temës së errët. Kodi i ri
   s'duhet të shkruajë hex: përdorni var(--thea-…) dhe kjo shtresë s'nevojitet.
   ════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] body { background: var(--thea-bg); color: var(--thea-ink); }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2, :root[data-theme="dark"] h3,
:root[data-theme="dark"] h4, :root[data-theme="dark"] h5, :root[data-theme="dark"] h6 { color: var(--thea-ink); }
:root[data-theme="dark"] .stat .num { color: var(--thea-ink); }
:root[data-theme="dark"] .btn-warn:hover { color: var(--thea-ink); }
:root[data-theme="dark"] .status-pill-lg { background: var(--thea-card); }
:root[data-theme="dark"] img[src$=".svg"][alt="logo"], :root[data-theme="dark"] .logo-dark-invert { filter: invert(1) hue-rotate(180deg); }
:root[data-theme="dark"] hr { border-color: var(--thea-border); }
:root[data-theme="dark"] kbd { background: var(--thea-surface-2); color: var(--thea-ink); border-color: var(--thea-border); }
:root[data-theme="dark"] table { color: var(--thea-ink); }
:root[data-theme="dark"] .table-modern tbody td { border-bottom-color: var(--thea-border); }
:root[data-theme="dark"] .list-item { border-bottom-color: var(--thea-border); }
:root[data-theme="dark"] .list-item .info .name { color: var(--thea-ink); }
:root[data-theme="dark"] input[type=checkbox], :root[data-theme="dark"] input[type=radio] { accent-color: var(--thea-teal-dm); }
:root[data-theme="dark"] iframe { color-scheme: normal; }
:root[data-theme="dark"] .pill.primary, :root[data-theme="dark"] .stat .ico.primary, :root[data-theme="dark"] .login-card .tooth-icon { color: var(--thea-link-hover); }
:root[data-theme="dark"] [style*=";color:var(--primary-dark)"], :root[data-theme="dark"] [style^="color:var(--primary-dark)"], :root[data-theme="dark"] [style*="; color:var(--primary-dark)"] { color: var(--thea-link-hover) !important; }
:root[data-theme="dark"] .topbar .tb-quick { color: var(--thea-link); border-color: var(--thea-link); }
:root[data-theme="dark"] .khelp-box, :root[data-theme="dark"] .cmm-box { background: var(--thea-card) !important; color: var(--thea-ink) !important; }

/* sfonde të bardha / të çelëta të ngulitura → sipërfaqet e errëta */
:root[data-theme="dark"] [style*="background:#fff;"], :root[data-theme="dark"] [style$="background:#fff"],
:root[data-theme="dark"] [style*="background: #fff;"], :root[data-theme="dark"] [style$="background: #fff"],
:root[data-theme="dark"] [style*="background:#ffffff"], :root[data-theme="dark"] [style*="background: #ffffff"], :root[data-theme="dark"] [style*="background:white"],
:root[data-theme="dark"] [style*="background-color:#fff"], :root[data-theme="dark"] [style*="background-color: #fff"],
:root[data-theme="dark"] [style*="background:var(--gray-50)"], :root[data-theme="dark"] [style*="background: var(--gray-50)"] { background: var(--thea-card) !important; }
:root[data-theme="dark"] [style*="background:#f8fafc"], :root[data-theme="dark"] [style*="background:#f1f5f9"], :root[data-theme="dark"] [style*="background:#f4f6f9"],
:root[data-theme="dark"] [style*="background:#f7fafc"], :root[data-theme="dark"] [style*="background:#f4f6fa"], :root[data-theme="dark"] [style*="background:#f8f9fa"],
:root[data-theme="dark"] [style*="background:#f9fafb"], :root[data-theme="dark"] [style*="background:#f6f7f9"], :root[data-theme="dark"] [style*="background:#f0f4f8"],
:root[data-theme="dark"] [style*="background:#eef2f7"], :root[data-theme="dark"] [style*="background:#f3f4f6"], :root[data-theme="dark"] [style*="background:#e5e7eb"],
:root[data-theme="dark"] [style*="background:#fafafa"], :root[data-theme="dark"] [style*="background:#f5f5f5"], :root[data-theme="dark"] [style*="background:#f6f9fa"],
:root[data-theme="dark"] [style*="background: #f8fafc"], :root[data-theme="dark"] [style*="background: #f1f5f9"] { background: var(--thea-surface-2) !important; }
/* sfonde të buta statusi */
:root[data-theme="dark"] [style*="background:#fee2e2"], :root[data-theme="dark"] [style*="background:#fef2f2"], :root[data-theme="dark"] [style*="background:#fff1f2"],
:root[data-theme="dark"] [style*="background:#fecaca"], :root[data-theme="dark"] [style*="background:#fbeaea"] { background: var(--thea-danger-bg) !important; color: var(--thea-danger-fg); }
:root[data-theme="dark"] [style*="background:#fef3c7"], :root[data-theme="dark"] [style*="background:#fffbeb"], :root[data-theme="dark"] [style*="background:#fff7ed"],
:root[data-theme="dark"] [style*="background:#fef9c3"], :root[data-theme="dark"] [style*="background:#ffedd5"], :root[data-theme="dark"] [style*="background:#fdf3e1"],
:root[data-theme="dark"] [style*="background:#fde68a"], :root[data-theme="dark"] [style*="background:#fffde7"] { background: var(--thea-warning-bg) !important; color: var(--thea-warning-fg); }
:root[data-theme="dark"] [style*="background:#dcfce7"], :root[data-theme="dark"] [style*="background:#d1fae5"], :root[data-theme="dark"] [style*="background:#f0fdf4"],
:root[data-theme="dark"] [style*="background:#ecfdf5"], :root[data-theme="dark"] [style*="background:#f0fff4"], :root[data-theme="dark"] [style*="background:#e7f5ec"],
:root[data-theme="dark"] [style*="background:#bbf7d0"] { background: var(--thea-success-bg) !important; color: var(--thea-success-fg); }
:root[data-theme="dark"] [style*="background:#dbeafe"], :root[data-theme="dark"] [style*="background:#eff6ff"], :root[data-theme="dark"] [style*="background:#f0f9ff"],
:root[data-theme="dark"] [style*="background:#e0f2fe"], :root[data-theme="dark"] [style*="background:#e8f4fd"] { background: var(--thea-info-bg) !important; color: var(--thea-info-fg); }
:root[data-theme="dark"] [style*="background:#f0fdfa"], :root[data-theme="dark"] [style*="background:#ccfbf1"], :root[data-theme="dark"] [style*="background:#e5f2f1"],
:root[data-theme="dark"] [style*="background:var(--primary-light)"] { background: var(--thea-teal-light) !important; }
/* tekst i errët i ngulitur → tekst i çelët */
:root[data-theme="dark"] [style*="color:#111"], :root[data-theme="dark"] [style*="color:#222"], :root[data-theme="dark"] [style*="color:#333"],
:root[data-theme="dark"] [style*="color:#0f172a"], :root[data-theme="dark"] [style*="color:#1e293b"], :root[data-theme="dark"] [style*="color:#1f2937"],
:root[data-theme="dark"] [style*="color:#111827"], :root[data-theme="dark"] [style*="color:#374151"], :root[data-theme="dark"] [style*="color:#334155"],
:root[data-theme="dark"] [style*="color:#0f1e25"], :root[data-theme="dark"] [style*="color:#000"], :root[data-theme="dark"] [style*="color: #1e293b"] { color: var(--thea-ink) !important; }
:root[data-theme="dark"] [style*="color:#475569"], :root[data-theme="dark"] [style*="color:#64748b"], :root[data-theme="dark"] [style*="color:#555"],
:root[data-theme="dark"] [style*="color:#666"], :root[data-theme="dark"] [style*="color:#6b7280"], :root[data-theme="dark"] [style*="color:#4b5563"],
:root[data-theme="dark"] [style*="color:#94a3b8"], :root[data-theme="dark"] [style*="color:#9ca3af"], :root[data-theme="dark"] [style*="color:#4a5a62"],
:root[data-theme="dark"] [style*="color:#888"], :root[data-theme="dark"] [style*="color:#777"], :root[data-theme="dark"] [style*="color:#999"] { color: var(--thea-muted) !important; }
:root[data-theme="dark"] [style*="color:#991b1b"], :root[data-theme="dark"] [style*="color:#b91c1c"], :root[data-theme="dark"] [style*="color:#dc2626"],
:root[data-theme="dark"] [style*="color:#a4262c"], :root[data-theme="dark"] [style*="color:#7f1d1d"], :root[data-theme="dark"] [style*="color:var(--danger)"] { color: var(--thea-danger-fg) !important; }
:root[data-theme="dark"] [style*="color:#92400e"], :root[data-theme="dark"] [style*="color:#b45309"], :root[data-theme="dark"] [style*="color:#9a3412"],
:root[data-theme="dark"] [style*="color:#d97706"], :root[data-theme="dark"] [style*="color:#78350f"], :root[data-theme="dark"] [style*="color:#854d0e"],
:root[data-theme="dark"] [style*="color:#b7791f"], :root[data-theme="dark"] [style*="color:var(--warning)"] { color: var(--thea-warning-fg) !important; }
:root[data-theme="dark"] [style*="color:#166534"], :root[data-theme="dark"] [style*="color:#065f46"], :root[data-theme="dark"] [style*="color:#15803d"],
:root[data-theme="dark"] [style*="color:#047857"], :root[data-theme="dark"] [style*="color:#059669"], :root[data-theme="dark"] [style*="color:#16a34a"],
:root[data-theme="dark"] [style*="color:#1f7a4d"], :root[data-theme="dark"] [style*="color:var(--success)"] { color: var(--thea-success-fg) !important; }
:root[data-theme="dark"] [style*="color:#1e40af"], :root[data-theme="dark"] [style*="color:#2563eb"], :root[data-theme="dark"] [style*="color:#075985"],
:root[data-theme="dark"] [style*="color:#1d4ed8"], :root[data-theme="dark"] [style*="color:#0369a1"], :root[data-theme="dark"] [style*="color:#2c7be5"] { color: var(--thea-info-fg) !important; }
:root[data-theme="dark"] [style*="color:#0d9488"], :root[data-theme="dark"] [style*="color:#0f766e"], :root[data-theme="dark"] [style*="color:#0e6b6b"],
:root[data-theme="dark"] [style*="color:#0b6b69"], :root[data-theme="dark"] [style*="color:#115e59"],
:root[data-theme="dark"] [style^="color:var(--primary)"], :root[data-theme="dark"] [style*=";color:var(--primary)"], :root[data-theme="dark"] [style*="; color:var(--primary)"],
:root[data-theme="dark"] [style*=" color: var(--primary)"] { color: var(--thea-link) !important; }
/* kufij të çelët të ngulitur */
:root[data-theme="dark"] [style*="border:1px solid #e5e7eb"], :root[data-theme="dark"] [style*="border:1px solid #e2e8f0"], :root[data-theme="dark"] [style*="border:1px solid #eee"],
:root[data-theme="dark"] [style*="border:1px solid #ddd"], :root[data-theme="dark"] [style*="border:1px solid #f1f5f9"], :root[data-theme="dark"] [style*="border-bottom:1px solid #f1f5f9"],
:root[data-theme="dark"] [style*="border-bottom:1px solid #e5e7eb"], :root[data-theme="dark"] [style*="border-top:1px solid #e5e7eb"], :root[data-theme="dark"] [style*="border-bottom:1px solid #eee"] { border-color: var(--thea-border) !important; }
/* tekst i bardhë mbi sfond që tani u errësua (p.sh. karta e bardhë me tekst #fff mbi një shirit) mbetet i bardhë: s'preket */

/* ── RD-04: kontrasti në temën e çelët për ngjyrat e ngulitura më të zbehta (< 4,5:1) ── */
:root:not([data-theme="dark"]) .content [style*="color:#94a3b8"], :root:not([data-theme="dark"]) .content [style*="color:#9ca3af"],
:root:not([data-theme="dark"]) [style*="color:#aaa"], :root:not([data-theme="dark"]) [style*="color:#999"],
:root:not([data-theme="dark"]) [style*="color:#a0aec0"] { color: var(--thea-muted) !important; }
:root:not([data-theme="dark"]) [style*="color:#b45309"], :root:not([data-theme="dark"]) [style*="color:#d97706"], :root:not([data-theme="dark"]) [style*="color:#f59e0b"] { color: var(--thea-warning-fg) !important; }
:root:not([data-theme="dark"]) [style*="color:#10b981"], :root:not([data-theme="dark"]) [style*="color:#22c55e"] { color: var(--thea-success-fg) !important; }
:root:not([data-theme="dark"]) [style*="color:#ef4444"], :root:not([data-theme="dark"]) [style*="color:#f87171"] { color: var(--thea-danger-fg) !important; }
