/* ==========================================================================
   DosjaMed - sistemi vizual
   Ngjyrat: boja (tekst), letra (sfond), eukalipti (kryesore), statuset e vizitave
   ========================================================================== */

:root {
  --ink: #17262E;
  --ink-2: #44555D;
  --muted: #5C6C73;   /* 5:1 mbi letren, WCAG AA per tekst te vogel */
  --paper: #F4F6F5;
  --surface: #FFFFFF;
  --line: #DFE5E3;
  --line-strong: #C5D0CD;

  --brand: #2F6F5E;
  --brand-ink: #1F4D41;
  --brand-soft: #E4F0EB;

  --wait: #8A5A00;
  --wait-bg: #FBEFD2;
  --prog: #2A5DB0;
  --prog-bg: #E5EDF9;
  --done: #2F6F5E;
  --done-bg: #E4F0EB;
  --cancel: #5A666C;
  --cancel-bg: #ECEFF0;
  --danger: #B42318;
  --danger-bg: #FCEBE9;

  /* ngjyra e rolit; ndryshon per kompani / recepsion / doktor */
  --role: var(--brand);
  --role-ink: var(--brand-ink);
  --role-soft: var(--brand-soft);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --fs-xs: 0.8125rem;   /* 13 */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-base: 0.9375rem; /* 15 */
  --fs-md: 1.0625rem;   /* 17 */
  --fs-lg: 1.3125rem;   /* 21 */
  --fs-xl: 1.6875rem;   /* 27 */
  --fs-2xl: 2.125rem;   /* 34 */

  --bs-body-font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: var(--fs-base);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-link-color: var(--role-ink);
  --bs-link-color-rgb: 31, 77, 65;
  --bs-link-hover-color: var(--ink);
  --bs-secondary-color: var(--muted);

  /* tonet e erreta per tekst mbi sfondet e statuseve */
  --danger-ink: #7A1A12;
  --danger-line: #E8B4AE;
  --wait-ink: #5E3E00;
  --wait-ink-2: #3F2A00;
  --prog-ink: #1E4787;
  --brand-line: #A9CBBF;

  /* sfonde shume te lehta (rreshti nen mi, skeda aktive) */
  --tint: #F9FBFA;
  --tint-2: #FAFCFB;
  --row-hover: #F7F9F8;

  /* teksti mbi sfond te erret (hyrja, SuperAdmin, keshillat) */
  --on-dark: #DCE7E3;
  --on-dark-2: #B7C7CC;
  --on-dark-3: #A9BCC2;
  --on-dark-4: #8FA3AA;
  --mint: #7FC8B0;
  --mint-soft: #CDEBE0;
  --mint-bright: #B5F0DC;
  --mint-dim: #4E8A79;

  /* ngjyrat kategorike te dokumenteve */
  --cat-1: #2563eb; --cat-2: #d97706; --cat-3: #059669;
  --cat-4: #db2777; --cat-5: #7c3aed; --cat-6: #0891b2;

  /* gjendjet e dhembeve (stomatologjia) */
  --tooth-red: #C0392B; --tooth-red-bg: #FCE3E0; --tooth-red-ink: #8E2318;
  --tooth-violet: #6B3FA0; --tooth-violet-bg: #EFE5F8; --tooth-violet-ink: #4E2D76;
  --tooth-orange: #B4541A; --tooth-orange-bg: #FDF0E6; --tooth-orange-ink: #8A3E10;
  --tooth-gray-ink: #3C474C; --tooth-gold-ink: #6B4600;

  /* hapesirat dhe hijet */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --shadow-sm: 0 8px 20px -8px rgba(23, 38, 46, .4);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .12);
  --shadow-md: 0 12px 32px -12px rgba(23, 38, 46, .25);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .3);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--role) 18%, transparent);
}

.role-doctor {
  --role: var(--prog);
  --role-ink: var(--prog-ink);
  --role-soft: var(--prog-bg);
  --bs-link-color-rgb: 30, 71, 135;
}

html { font-size: 16px; }

body {
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4 { color: var(--ink); letter-spacing: -0.012em; }

a { text-underline-offset: 2px; }

.num, time, .table td.when { font-variant-numeric: tabular-nums; }
td.num, th.num { white-space: nowrap; }

:focus-visible {
  outline: 2px solid var(--role);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: .5rem 1rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prewrap { white-space: pre-wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Bootstrap: butonat dhe formularet ---------- */

.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-padding-y: .5rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-font-size: var(--fs-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}
.btn-lg { --bs-btn-padding-y: .75rem; --bs-btn-font-size: var(--fs-base); --bs-btn-border-radius: var(--radius-sm); }
.btn-sm { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: var(--fs-xs); }

.btn-primary {
  --bs-btn-bg: var(--role);
  --bs-btn-border-color: var(--role);
  --bs-btn-hover-bg: var(--role-ink);
  --bs-btn-hover-border-color: var(--role-ink);
  --bs-btn-active-bg: var(--role-ink);
  --bs-btn-active-border-color: var(--role-ink);
  --bs-btn-disabled-bg: var(--role);
  --bs-btn-disabled-border-color: var(--role);
}
.btn-success {
  --bs-btn-bg: var(--done);
  --bs-btn-border-color: var(--done);
  --bs-btn-hover-bg: var(--brand-ink);
  --bs-btn-hover-border-color: var(--brand-ink);
  --bs-btn-active-bg: var(--brand-ink);
}
.btn-quiet, .btn-outline-primary, .btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--paper);
  --bs-btn-hover-border-color: var(--ink-2);
  --bs-btn-active-bg: var(--paper);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-border-color: var(--ink-2);
}
.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--danger-line);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--danger);
  --bs-btn-hover-border-color: var(--danger);
}
.btn-outline-success {
  --bs-btn-color: var(--done);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--brand-line);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--done);
  --bs-btn-hover-border-color: var(--done);
}
.btn-link { --bs-btn-color: var(--ink-2); --bs-btn-hover-color: var(--ink); font-weight: 500; }
.btn .ico { width: 16px; height: 16px; }

.form-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .35rem;
}
.form-control, .form-select {
  background-color: var(--surface);
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  padding: .55rem .75rem;
  color: var(--ink);
}
.form-control-lg { font-size: var(--fs-md); padding: .7rem .9rem; border-radius: var(--radius-sm); }
.form-control-sm { font-size: var(--fs-sm); padding: .35rem .55rem; }
.form-control:focus, .form-select:focus {
  background-color: var(--surface);
  border-color: var(--role);
  box-shadow: var(--focus-ring);
}
.form-control::placeholder { color: var(--muted); }
.form-check-input:checked { background-color: var(--role); border-color: var(--role); }
.form-text { color: var(--muted); font-size: var(--fs-xs); }

.field { margin-bottom: 1.1rem; }
.field-error, .text-danger { color: var(--danger) !important; font-size: var(--fs-xs); }
.input-validation-error { border-color: var(--danger) !important; }

.dropdown-menu {
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-border-radius: var(--radius);
  --bs-dropdown-link-active-bg: var(--role-soft);
  --bs-dropdown-link-active-color: var(--ink);
  --bs-dropdown-font-size: var(--fs-sm);
  box-shadow: var(--shadow-md);
  padding: .35rem;
}
.dropdown-item { display: flex; align-items: center; gap: .55rem; border-radius: var(--radius-sm); padding: .5rem .65rem; }

/* ---------- Njoftimet ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  font-size: var(--fs-sm);
  margin-bottom: 1.25rem;
}
.notice:empty, .notice.validation-summary-valid { display: none; }
.notice ul { margin: 0; padding-left: 1rem; }
.notice .btn-close { font-size: .65rem; margin-top: .2rem; min-width: 24px; min-height: 24px; }
.notice-success { background: var(--done-bg); border-color: var(--done); color: var(--brand-ink); }
.notice-error { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-ink); }
.notice-warn { background: var(--wait-bg); border-color: var(--wait); color: var(--wait-ink); }

/* ---------- Statuset ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .15rem .55rem .15rem .45rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-waiting { color: var(--wait); background: var(--wait-bg); }
.status-urgent { color: var(--danger); background: var(--danger-bg); }
.status-inprogress { color: var(--prog); background: var(--prog-bg); }
.status-completed { color: var(--done); background: var(--done-bg); }
.status-cancelled { color: var(--cancel); background: var(--cancel-bg); }
.status-inactive { color: var(--cancel); background: var(--cancel-bg); }
.status-active { color: var(--done); background: var(--done-bg); }

/* ---------- Faqet: koka, paneli, tabelat ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-head h1 {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.page-head .sub { color: var(--muted); margin: .25rem 0 0; font-size: var(--fs-sm); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.back-link {
  display: inline-block;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-decoration: none;
  margin-bottom: .5rem;
}
.back-link:hover { color: var(--ink); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel + .panel, .panel + .section-title { margin-top: 1.5rem; }
.panel-body { padding: 1.25rem 1.5rem; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: var(--fs-md); font-weight: 650; margin: 0; }

.section-title {
  font-size: var(--fs-lg);
  font-weight: 650;
  margin: 2rem 0 .85rem;
}

.form-panel { max-width: 860px; }
.form-panel .panel-body { padding: 1.5rem; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section h2 { font-size: var(--fs-md); font-weight: 650; margin: 0 0 .25rem; }
.form-section .hint { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1.5rem; }

.table-clean {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--row-hover);
  margin: 0;
  font-size: var(--fs-sm);
}
.table-clean > thead th {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: .7rem 1rem;
  white-space: nowrap;
}
.table-clean > tbody td {
  padding: .8rem 1rem;
  border-color: var(--line);
  vertical-align: middle;
}
.table-clean > tbody tr:last-child td { border-bottom: 0; }
.table-clean .primary-cell { font-weight: 600; color: var(--ink); }
.table-clean .primary-cell a { color: var(--ink); text-decoration: none; }
.table-clean .primary-cell a:hover { color: var(--role-ink); text-decoration: underline; }
.table-clean .secondary { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.table-clean tr.is-inactive td { color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: .35rem; flex-wrap: wrap; }

.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ink-2);
}
.empty h2 { font-size: var(--fs-md); font-weight: 650; margin-bottom: .35rem; }
.empty p { color: var(--muted); margin-bottom: 1rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.5rem; margin: 0; font-size: var(--fs-sm); }
.facts dt { color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; color: var(--ink); }

.search-inline {
  position: relative;
  max-width: 440px;
  flex: 1 1 340px;
}
.search-inline svg { position: absolute; left: .75rem; top: 50%; translate: 0 -50%; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-inline .form-control { padding-left: 2.4rem; }
.toolbar .search-inline .form-control { width: 100%; }

/* ---------- Hyrja (login) ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 46%) 1fr;
  background: var(--surface);
}
.auth-aside {
  background: var(--ink);
  color: var(--on-dark);
  padding: 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-wordmark {
  display: flex;
  align-items: center;
  gap: .3em;
  --logo-tab: var(--mint);
  --logo-body: var(--mint-bright);
  --logo-cross: var(--ink);
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
}
.auth-ecg {
  width: calc(100% + 7rem);
  margin-left: -3.5rem;
  height: 120px;
}
.auth-ecg path {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
/* vija gjithmone e dukshme; nje puls i ndritshem kalon nje here mbi te */
.auth-ecg .ecg-line { stroke: var(--mint-dim); }
.auth-ecg .ecg-pulse {
  stroke: var(--mint-bright);
  stroke-width: 3;
  stroke-dasharray: 110 1000;
  stroke-dashoffset: 110;
  animation: ecg-pulse 2.6s cubic-bezier(.45, 0, .25, 1) .3s both;
}
@keyframes ecg-pulse { from { stroke-dashoffset: 110; } to { stroke-dashoffset: -830; } }
.auth-logo { width: 1.05em; height: 1.05em; flex: none; }
.auth-tagline { font-size: var(--fs-lg); line-height: 1.4; max-width: 24ch; margin: 0; color: var(--on-dark); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 3rem 1.5rem; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: var(--fs-xl); font-weight: 700; margin-bottom: .35rem; }
.auth-lead { color: var(--muted); margin-bottom: 2rem; }
.auth-help { margin-top: 1.5rem; font-size: var(--fs-xs); color: var(--muted); }
.auth-mobile-brand { display: none; align-items: center; gap: .5rem; font-weight: 700; font-size: var(--fs-lg); color: var(--brand); margin-bottom: 2rem; letter-spacing: -0.02em; }

@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-main { align-items: flex-start; padding-top: 4rem; }
}

/* ---------- Korniza me shirit anesor (kompania, recepsioni) ---------- */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: 1.25rem .85rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 0 .5rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
}
.brand-mark { width: 30px; height: 30px; flex: none; }
.logo-mark { display: inline-block; vertical-align: middle; }
.sidebar-context {
  margin: .9rem .5rem 1rem;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.3;
}
/* menyja e gjate (administrator + doktor) rrotullohet brenda shiritit; profili dhe "Dil" mbeten gjithmone poshte */
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; margin: 0 -.35rem; padding: 2px .35rem; scrollbar-width: thin; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--fs-sm);
}
.side-nav a:hover { background: var(--paper); color: var(--ink); }
.side-nav a.active { background: var(--role-soft); color: var(--role-ink); font-weight: 600; }
.side-nav a.side-cta {
  background: var(--role);
  color: #fff;
  font-weight: 600;
  margin-bottom: .75rem;
  justify-content: center;
  padding: .65rem .7rem;
}
.side-nav a.side-cta:hover { background: var(--role-ink); color: #fff; }
.side-group { margin: 1.25rem .7rem .35rem; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
/* administrimi i palosur (administrator qe eshte edhe doktor) */
.side-fold { margin-top: 1rem; display: flex; flex-direction: column; gap: 2px; }
.side-fold > summary { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; font-size: var(--fs-sm); cursor: pointer; list-style: none; }
.side-fold > summary::-webkit-details-marker { display: none; }
.side-fold > summary::after { content: "▸"; margin-left: auto; color: var(--muted); }
.side-fold[open] > summary::after { content: "▾"; }
.side-fold > summary:hover { background: var(--paper); color: var(--ink); }
.side-fold .side-group:first-of-type { margin-top: .35rem; }

.sidebar-user { border-top: 1px solid var(--line); padding-top: .75rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: .45rem .5rem;
  border-radius: var(--radius-sm);
  text-align: left;
  color: inherit;
}
.user-chip:hover { background: var(--paper); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--role-soft);
  color: var(--role-ink);
  font-weight: 700;
  font-size: var(--fs-xs);
}
.user-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-chip-name { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shell-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .85rem 2.5rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-date { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.content { padding: 2rem 2.5rem 4rem; max-width: 1280px; width: 100%; }

.search-field { position: relative; flex: 1; max-width: 560px; }
.search-field svg {
  position: absolute; left: .8rem; top: 50%; translate: 0 -50%;
  width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round;
}
.search-field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: .55rem 1rem .55rem 2.5rem;
  font-size: var(--fs-sm);
  color: var(--ink);
}
.search-field input:focus { outline: none; border-color: var(--role); box-shadow: var(--focus-ring); }
.search-field-lg input { padding-top: .65rem; padding-bottom: .65rem; font-size: var(--fs-base); }

/* Kompania: shirit anesor i erret, panel kontrolli */
.role-superadmin .sidebar { background: var(--ink); border-right-color: var(--ink); }
.role-superadmin .brand { color: #fff; }
.role-superadmin .brand-mark { --logo-tab: var(--mint); --logo-body: var(--mint-bright); --logo-cross: var(--ink); }
.role-superadmin .sidebar-context { background: rgba(255, 255, 255, .06); color: var(--on-dark-3); }
.role-superadmin .side-nav a { color: var(--on-dark-2); }
.role-superadmin .side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.role-superadmin .side-nav a.active { background: rgba(127, 200, 176, .16); color: var(--mint-soft); }
.role-superadmin .sidebar-user { border-top-color: rgba(255, 255, 255, .1); }
.role-superadmin .user-chip { color: #fff; }
.role-superadmin .user-chip:hover { background: rgba(255, 255, 255, .06); }
.role-superadmin .user-chip-sub { color: var(--on-dark-4); }
.role-superadmin .avatar { background: var(--mint); color: var(--ink); }
.role-superadmin .content { padding-top: 2.5rem; }

@media (max-width: 991.98px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    min-width: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-context { display: none; }
  /* te gjitha lidhjet duken, ne disa rreshta (jo shirit qe rrotullohet me scrollbar te fshehur) */
  .side-nav { flex-direction: row; flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0; order: 3; flex-basis: 100%; gap: .25rem; min-width: 0; }
  .side-nav a { white-space: nowrap; }
  .side-nav a.side-cta { margin-bottom: 0; }
  .side-group { display: none; }
  .side-fold { margin-top: 0; flex-direction: row; flex-wrap: wrap; gap: .25rem; }
  .side-fold > summary { white-space: nowrap; }
  .side-fold[open] { flex-basis: 100%; }
  .sidebar-user { border-top: 0; padding-top: 0; margin-left: auto; }
  .sidebar-user .user-chip-text { display: none; }
  .topbar { padding: .75rem 1rem; position: static; }
  .topbar-date { display: none; }
  .content { padding: 1.5rem 1rem 3rem; }
}

/* ---------- Doktori: shirit i holle lart, hapesire per shkrim ---------- */

.docbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: .6rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.docbar-nav { display: flex; gap: .25rem; }
.docbar-nav a {
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 500;
  font-size: var(--fs-sm);
}
.docbar-nav a:hover { background: var(--paper); color: var(--ink); }
.docbar-nav a.active { color: var(--role-ink); background: var(--role-soft); font-weight: 600; }
.docbar .search-field { max-width: 300px; margin-left: auto; }
.docbar .user-chip { width: auto; }
.doc-main { padding: 2rem 2rem 6rem; max-width: 1240px; margin: 0 auto; }

@media (max-width: 860px) {
  .docbar { flex-wrap: wrap; gap: .5rem 1rem; padding: .6rem 1rem; }
  .docbar-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .docbar .search-field { display: none; }
  .docbar .dropdown { margin-left: auto; }
  .docbar .user-chip-text { display: none; }
  .doc-main { padding: 1.25rem 1rem 6rem; }
}

/* Radha e doktorit */
.next-up {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.75rem 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--role);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}
.next-up-label { font-size: var(--fs-sm); color: var(--role-ink); font-weight: 600; margin-bottom: .35rem; }
.next-up-name { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; margin: 0; }
.next-up-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: .6rem; color: var(--ink-2); font-size: var(--fs-sm); }
.next-up-reason { margin: .9rem 0 0; font-size: var(--fs-md); color: var(--ink); max-width: 60ch; }
.next-up .btn { min-width: 180px; }
@media (max-width: 640px) {
  .next-up { grid-template-columns: minmax(0, 1fr); padding: 1.25rem; }
  .next-up-name { font-size: var(--fs-xl); }
}

.wait-time { font-variant-numeric: tabular-nums; color: var(--wait); font-weight: 600; }
.wait-time.is-long { color: var(--danger); }

/* Kartela e vizites (Exam) */
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.exam-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 1rem; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
@media (max-width: 1080px) {
  .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .exam-aside { position: static; order: 1; max-height: none; overflow: visible; }
}

.chart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.chart-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
}
.chart-row + .chart-row { border-top: 1px solid var(--line); }
.chart-label { font-weight: 650; font-size: var(--fs-base); padding-top: .55rem; }
.chart-label small { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-xs); margin-top: .15rem; }
.chart textarea.form-control {
  border-color: transparent;
  background: var(--paper);
  font-size: var(--fs-md);
  line-height: 1.6;
  padding: .75rem .9rem;
  resize: vertical;
  min-height: 7rem;
}
.chart textarea.form-control:hover { border-color: var(--line-strong); }
.chart textarea.form-control:focus { background: var(--surface); border-color: var(--role); }
.chart-row.is-key .chart-label { color: var(--role-ink); }
/* "Kërko analiza": e palosur; titulli mbi kutite (details s'behet rrjet ne te gjithe shfletuesit) */
details.chart-row.lab-request, details.chart-row.spec-section { display: block; }
.lab-request > summary, .spec-section > summary { cursor: pointer; list-style: none; padding-top: 0; }
.lab-request > summary::-webkit-details-marker, .spec-section > summary::-webkit-details-marker { display: none; }
.lab-request > summary::before, .spec-section > summary::before { content: "▸ "; color: var(--muted); }
.lab-request[open] > summary::before, .spec-section[open] > summary::before { content: "▾ "; }
.lab-request[open] > summary, .spec-section[open] > summary { margin-bottom: .75rem; }
@media (max-width: 720px) {
  .chart-row { grid-template-columns: minmax(0, 1fr); gap: .5rem; padding: 1.25rem; }
  .chart-label { padding-top: 0; }
}

.labs-table { width: 100%; font-size: var(--fs-sm); margin-bottom: .9rem; }
.labs-table th { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: 0 .5rem .4rem 0; }
.labs-table td { padding: .35rem .5rem .35rem 0; border-top: 1px solid var(--line); vertical-align: middle; }
.labs-table td:first-child { font-weight: 600; }
.lab-add { display: grid; grid-template-columns: 1.2fr 1fr auto auto; align-items: center; gap: .5rem; }
@media (max-width: 720px) { .lab-add { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 721px) { .lab-add.lab-add-brought { grid-template-columns: 1.2fr 1fr auto; } }

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.action-bar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: .75rem 2rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.action-bar-note { margin-right: auto; color: var(--muted); font-size: var(--fs-sm); }
/* me shirit anesor: shiriti fillon pas tij dhe rreshtohet me permbajtjen */
@media (min-width: 992px) {
  .shell .action-bar { left: 248px; }
  .shell .action-bar-inner { max-width: 1280px; margin: 0; padding: .75rem 2.5rem; }
}
@media (max-width: 860px) { .action-bar-inner { padding: .65rem 1rem; } .action-bar-note { display: none; } }

.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.side-card h2 { font-size: var(--fs-sm); font-weight: 650; margin: 0 0 .75rem; color: var(--ink-2); }
.side-card .patient-name { font-size: var(--fs-lg); font-weight: 700; margin: 0 0 .75rem; letter-spacing: -0.015em; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.timeline li { padding: .55rem 0 .55rem .9rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .95rem; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline a { font-weight: 600; text-decoration: none; }
.timeline .dx { color: var(--ink-2); display: block; }
.timeline .by { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- Recepsioni: filtrat e dites ---------- */

.day-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.day-tab {
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--ink-2);
  border-right: 1px solid var(--line);
  border-bottom: 3px solid transparent;
}
.day-tab:last-child { border-right: 0; }
.day-tab:hover { background: var(--tint); color: var(--ink); }
.day-tab .count { display: block; font-size: var(--fs-xl); font-weight: 700; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.day-tab .label { font-size: var(--fs-sm); font-weight: 500; }
.day-tab.active { border-bottom-color: var(--role); background: var(--tint-2); }
.day-tab.t-waiting .count { color: var(--wait); }
.day-tab.t-inprogress .count { color: var(--prog); }
.day-tab.t-completed .count { color: var(--done); }
@media (max-width: 640px) {
  .day-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-tab:nth-child(2) { border-right: 0; }
  .day-tab:nth-child(-n+2) { border-bottom-color: var(--line); }
}

.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control { width: auto; }
.toolbar-links { display: flex; gap: .25rem; margin-left: auto; }

/* ---------- Kompania: permbledhja ---------- */

.overview {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  padding: 0 0 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.overview div { display: flex; flex-direction: column; }
.overview strong { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.overview span { color: var(--muted); font-size: var(--fs-sm); margin-top: .35rem; }

.clinic-title { display: flex; align-items: center; gap: .85rem; }
.clinic-initial {
  width: 36px; height: 36px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 700;
}
.is-inactive .clinic-initial { background: var(--cancel-bg); color: var(--cancel); }

/* ---------- Raporti (Details dhe Print) ---------- */

.report-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.75rem; font-size: var(--fs-sm); }
.report-parties h2 { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; margin: 0 0 .3rem; }
.report-parties .who { font-size: var(--fs-md); font-weight: 650; }
.report-parties .right { text-align: right; }
.report-block { margin-bottom: 1.4rem; }
.report-block h3 { font-size: var(--fs-sm); font-weight: 700; color: var(--ink); margin: 0 0 .35rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.report-block p { margin: 0; line-height: 1.6; }
.report-labs { width: 100%; font-size: var(--fs-sm); border-collapse: collapse; }
.report-labs th, .report-labs td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; }
.report-labs th { background: var(--paper); font-weight: 600; }
@media (max-width: 640px) {
  .report-parties { grid-template-columns: minmax(0, 1fr); }
  .report-parties .right { text-align: left; }
}

/* ---------- Zgjedhja e rolit ---------- */

.role-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; margin-top: .75rem; }
.role-option {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .9rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.role-option input { margin-top: .3rem; accent-color: var(--role); }
.role-option strong { display: block; font-size: var(--fs-sm); }
.role-option small { color: var(--muted); font-size: var(--fs-xs); }
.role-option:has(input:checked) { border-color: var(--role); background: var(--role-soft); }
.role-option:has(input:focus-visible) { outline: 2px solid var(--role); outline-offset: 2px; }

.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; height: 100%; align-content: center; }
.mini-stats.is-top { height: auto; align-content: start; gap: 1.5rem 1rem; }
.mini-stats div { display: flex; flex-direction: column; }
.mini-stats strong { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.mini-stats span { color: var(--muted); font-size: var(--fs-sm); margin-top: .35rem; }

/* ---------- Paneli (dashboard) ---------- */

.text-warn { color: var(--wait) !important; }

.doctor-load { list-style: none; margin: 0; padding: 0; }
.doctor-load li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.5rem;
  border-top: 1px solid var(--line);
}
.doctor-load li:first-child { border-top: 0; }
.doctor-load-name { min-width: 0; }
.doctor-load-name strong { display: block; font-size: var(--fs-sm); }
.doctor-load-name span { font-size: var(--fs-xs); color: var(--muted); }
.doctor-load-counts { display: flex; gap: 1.1rem; margin: 0; text-align: right; }
.doctor-load-counts div { display: flex; flex-direction: column-reverse; }
.doctor-load-counts dt { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); white-space: nowrap; }
.doctor-load-counts dd { margin: 0; font-size: var(--fs-lg); font-weight: 700; line-height: 1.1; }
.doctor-load-counts .t-waiting dd { color: var(--wait); }
.doctor-load-counts .t-inprogress dd { color: var(--prog); }
.doctor-load-counts .t-completed dd { color: var(--done); }

/* Grafiku i diteve: nje seri, shtylla te holla me maje te rrumbullakosura */
.day-chart { margin: 0; }
.day-chart-plot {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 2px;
  height: 200px;
  padding-top: 1.5rem;
  border-bottom: 1px solid var(--line-strong);
}
.day-col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  outline: none;
  cursor: default;
}
.day-bar-wrap { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.day-bar {
  width: min(70%, 28px);
  min-height: 2px;
  background: color-mix(in srgb, var(--role) 55%, var(--surface));
  border-radius: 4px 4px 0 0;
}
.day-col.is-today .day-bar { background: var(--role); }
.day-col:hover .day-bar, .day-col:focus-visible .day-bar { background: var(--role-ink); }
.day-value {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-2);
}
.day-label {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-top: .35rem;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}
.day-col.is-today .day-label { color: var(--ink); font-weight: 600; }
.day-chart { padding-bottom: 1.5rem; }
.day-tip {
  position: absolute;
  bottom: calc(100% - 1rem);
  left: 50%;
  translate: -50% 0;
  z-index: 2;
  display: none;
  padding: .4rem .6rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-xs);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}
.day-tip small { display: block; color: var(--on-dark-2); }
.day-col:hover .day-tip, .day-col:focus-visible .day-tip { display: block; }
.day-col:first-child .day-tip { left: 0; translate: 0 0; }
.day-col:last-child .day-tip { left: auto; right: 0; translate: 0 0; }
@media (max-width: 640px) {
  .day-label { font-size: 0.625rem; }
  .day-col:nth-child(odd):not(.is-today) .day-label { visibility: hidden; }
}

.mini-stats + .mini-stats { margin-top: 1rem; }

/* ---------- Kartela mjekesore ---------- */

.allergy-alert {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .6rem .8rem;
  margin-bottom: .9rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger-ink);
  font-size: var(--fs-sm);
}
.allergy-alert strong { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.facts-stacked { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
.facts-stacked dd + dt { margin-top: .6rem; }
.side-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.side-card-head h2 { margin: 0; }
.side-card-head .btn { padding: 0; }
.side-card.has-allergy { border-color: var(--danger-line); }
.timeline .rx {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

details.panel-collapse > summary { list-style: none; cursor: pointer; }
details.panel-collapse > summary::-webkit-details-marker { display: none; }
details.panel-collapse > summary h2::before {
  content: "";
  display: inline-block;
  width: .45rem;
  height: .45rem;
  margin: 0 .6rem .15rem 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  rotate: -45deg;
  transition: rotate .15s;
}
details.panel-collapse[open] > summary h2::before { rotate: 45deg; }
details.panel-collapse:not([open]) > summary { border-bottom: 0; }

.report-medical { padding: .6rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.report-medical p + p { margin-top: .2rem; }

/* ---------- Terminet ---------- */

.appt-scheduled { color: var(--prog); background: var(--prog-bg); }
.appt-arrived { color: var(--done); background: var(--done-bg); }
.appt-noshow { color: var(--danger); background: var(--danger-bg); }
.appt-cancelled { color: var(--cancel); background: var(--cancel-bg); }

.day-nav { display: flex; align-items: center; gap: .35rem; }
.day-nav .btn { min-width: 2.1rem; font-size: var(--fs-md); line-height: 1; }
.toolbar .form-select { width: auto; }

.appt-list { list-style: none; margin: 0; padding: 0; }
.appt-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem 1.5rem;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.appt-list li:first-child { border-top: 0; }
.appt-when { min-width: 4.5rem; color: var(--ink-2); }
.appt-when strong { display: block; color: var(--ink); }
.appt-what { flex: 1; min-width: 0; }
.appt-what a { font-weight: 600; color: var(--ink); text-decoration: none; }
.appt-what a:hover { text-decoration: underline; }
.appt-what .secondary { display: block; color: var(--muted); font-size: var(--fs-xs); }

.busy-slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-top: 1rem;
  font-size: var(--fs-sm);
}
.busy-slots strong { font-weight: 600; color: var(--ink-2); margin-right: .25rem; }
.busy-chip {
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--prog-bg);
  color: var(--prog-ink);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.empty-sm { padding: 1.25rem 1.5rem; }
.empty-sm p { margin: 0; }
.panel-foot { padding: .65rem 1.5rem; border-top: 1px solid var(--line); font-size: var(--fs-sm); }

/* ---------- Pagesat ---------- */

.pay { display: inline-block; font-size: var(--fs-xs); font-weight: 600; }
.pay-paid { color: var(--done); }
.pay-due { color: var(--wait); }

.visit-layout { display: grid; grid-template-columns: minmax(0, 860px); gap: 1.5rem; align-items: start; }
.visit-layout.has-billing { grid-template-columns: minmax(0, 1fr) 360px; max-width: 1240px; }
.visit-layout .panel + .panel { margin-top: 0; }
.visit-report .panel-body { padding: 2rem; }
.billing { position: sticky; top: 76px; }
/* fatura me kontrollen poshte: kolona rrjedh bashke me faqen */
.visit-side { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.visit-side > .panel { margin: 0; }
.visit-side .billing { position: static; }
.follow-quick { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.follow-quick .btn.active { background: var(--role-soft); color: var(--role-ink); border-color: var(--role); }
.follow-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: .4rem; margin-top: .75rem; }
.follow-slots .form-text { grid-column: 1 / -1; }
.slot {
  display: flex;
  justify-content: center;
  padding: .35rem 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot:hover { background: var(--paper); }
.slot.active { border-color: var(--role); background: var(--role-soft); color: var(--role-ink); font-weight: 600; }
.slot:has(input:checked) { border-color: var(--role); background: var(--role-soft); color: var(--role-ink); font-weight: 600; }
.slot:has(input:focus-visible) { outline: 2px solid var(--role); outline-offset: 2px; }
@media (max-width: 1080px) {
  .visit-layout.has-billing { grid-template-columns: minmax(0, 1fr); }
  .billing { position: static; }
}
@media (max-width: 640px) { .visit-report .panel-body { padding: 1.25rem; } }

.bill-table { width: 100%; font-size: var(--fs-sm); border-collapse: collapse; margin-bottom: 1rem; }
.bill-table td, .bill-table th { padding: .45rem 0; border-top: 1px solid var(--line); vertical-align: middle; }
.bill-table td + td, .bill-table th + th { padding-left: .5rem; }
.bill-table thead th { border-top: 0; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.bill-table tbody tr:first-child td { border-top: 0; }
.bill-table thead + tbody tr:first-child td { border-top: 1px solid var(--line); }
.bill-table tfoot th { font-weight: 650; border-top: 1px solid var(--line-strong); }
.bill-table .bill-payment td { color: var(--ink-2); }
.bill-table .secondary { display: block; color: var(--muted); font-size: var(--fs-xs); }
.bill-table .bill-balance th { font-size: var(--fs-base); border-top: 2px solid var(--ink); }
.bill-table .bill-balance.is-due th { color: var(--wait); }
.bill-table .bill-balance.is-paid th { color: var(--done); }
.bill-table .btn-link { padding: 0 .25rem; }
.bill-done { margin-bottom: 1.25rem; padding: 1rem; border-radius: var(--radius); background: color-mix(in srgb, var(--done) 10%, transparent); }
.bill-done p { margin: 0 0 .75rem; color: var(--done); }
.bill-done-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.bill-add { display: flex; gap: .5rem; }
.bill-add .form-select, .bill-add .form-control { flex: 1; min-width: 0; }
.bill-add .bill-amount { flex: 0 0 6rem; }
.bill-pay { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.bill-pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.price-add .notice { margin-bottom: 1rem; }
.price-add-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: .75rem; align-items: end; }
.price-add-row .field-error:empty { display: none; }
@media (max-width: 640px) { .price-add-row { grid-template-columns: minmax(0, 1fr); } }

@media print {
  .sidebar, .topbar, .toolbar, .page-actions, .page-head .btn, .skip-link, .visit-revisions { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .panel { border-color: var(--line-strong); break-inside: avoid; }
}
.day-tabs-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .day-tabs-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-tabs-5 .day-tab { border-bottom: 1px solid var(--line); }
  .day-tabs-5 .day-tab:nth-child(2n) { border-right: 0; }
}

/* ---------- Katalogu i analizave, historiku ---------- */

.price-add-row-2 { grid-template-columns: minmax(0, 1fr) auto; }
.lab-mode .panel-body { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.lab-mode h2 { font-size: var(--fs-sm); margin: 0 0 .2rem; }
.lab-price-form { display: flex; gap: .5rem; max-width: 240px; }
.lab-add .lab-other[hidden] { display: none; }
.bill-labs { margin-top: 1rem; }
.bill-labs h3 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .4rem; }
.bill-labs .bill-amount { max-width: 90px; }
.bill-labs form { display: flex; gap: .4rem; justify-content: flex-end; align-items: center; }
.lab-catalog { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lab-catalog li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem 1.5rem;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.lab-catalog li.is-inactive span { color: var(--muted); text-decoration: line-through; }

.audit-action { font-weight: 600; margin-right: .3rem; }
.audit-created { color: var(--done); }
.audit-updated { color: var(--prog); }
.audit-deleted { color: var(--danger); }
.audit-viewed, .audit-exported { color: var(--muted); }
.audit-changes { font-size: var(--fs-xs); color: var(--ink-2); max-width: 520px; overflow-wrap: anywhere; }
.table-clean .secondary { display: block; }

/* seksioni qe po ruhet me fetch (site.js) */
[data-region][aria-busy="true"] { opacity: .6; pointer-events: none; transition: opacity .15s; }

/* ---------- Laboratori ---------- */

.role-lab .content { padding-top: 2.5rem; }

.seg-tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.seg-tabs a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .8rem;
  border-radius: 4px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
}
.seg-tabs a:hover { color: var(--ink); background: var(--paper); }
.seg-tabs a.active { background: var(--role-soft); color: var(--role-ink); font-weight: 600; }
.seg-count { font-size: var(--fs-xs); font-weight: 700; padding: 0 .4rem; border-radius: 999px; background: var(--wait-bg); color: var(--wait); }

.lab-visit + .lab-visit { margin-top: 1rem; }
.lab-visit-head { align-items: flex-start; flex-wrap: wrap; }
.lab-visit-head h2 a { color: var(--ink); text-decoration: none; }
.lab-visit-head h2 a:hover { text-decoration: underline; }
.lab-visit-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.lab-tests { list-style: none; margin: 0 0 1rem; padding: 0; }
.lab-tests li { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lab-tests li:first-child { border-top: 0; padding-top: 0; }
.lab-tests .form-check-input { margin: 0; flex: none; }
.lab-test-name { font-weight: 600; cursor: pointer; }
.lab-tests li.is-done .lab-test-name { color: var(--done); cursor: default; }
.lab-tests .secondary { font-weight: 400; }
.lab-check { flex: none; width: 1rem; height: 1rem; border-radius: 50%; background: var(--done); position: relative; }
.lab-check::after { content: ""; position: absolute; left: .33rem; top: .18rem; width: .3rem; height: .55rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.lab-upload-foot { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; margin-top: .85rem; }
.lab-files { margin: 1rem 0 0; padding-top: .85rem; border-top: 1px solid var(--line); }
.lab-meta { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.lab-range-input { min-width: 160px; }
.lab-price-input { max-width: 120px; }
.chart textarea.form-control.lab-result-input {
  min-height: 0;
  font-size: var(--fs-sm);
  line-height: 1.45;
  padding: .35rem .55rem;
  background: var(--surface);
  border-color: var(--line-strong);
  resize: none;
}

/* ---------- Raportet ---------- */

.report-row { margin-top: 0; }
.panel + .report-row, .report-row + .report-row { margin-top: 1.5rem; }
.report-row + .section-title { margin-top: 2rem; }
.report-chart .day-chart-plot { height: 180px; }
.toolbar-links .btn-link.active { color: var(--role-ink); font-weight: 650; text-decoration: underline; text-underline-offset: 4px; }

.hbars { list-style: none; margin: 0; padding: .6rem 1.5rem 1.1rem; }
.hbars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .3rem 1rem;
  padding: .45rem 0;
  font-size: var(--fs-sm);
}
.hbar-name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.hbar-name .secondary { display: inline; color: var(--muted); font-size: var(--fs-xs); font-weight: 400; margin-left: .35rem; }
.hbar-value { font-weight: 650; text-align: right; }
.hbar-track { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--paper); overflow: hidden; }
.hbar-fill { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: color-mix(in srgb, var(--role) 60%, var(--surface)); }

.report-split { display: grid; grid-template-columns: 1fr 1fr; }
.report-split h3 { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin: 1rem 1.5rem 0; }
.report-split > div + div { border-left: 1px solid var(--line); }
@media (max-width: 640px) {
  .report-split { grid-template-columns: minmax(0, 1fr); }
  .report-split > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
.report-total th { font-size: var(--fs-sm); border-top: 1px solid var(--line-strong); padding: .8rem 1rem; }
.report-methods { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .report-methods { grid-template-columns: minmax(0, 1fr); } }

@media print {
  .report-row > [class*="col-"] { width: 50%; }
  .day-tip { display: none !important; }
}

/* Paneli: detyrat e hapura (analiza, kujtesa) */
.todo-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.25rem 0 1.25rem; }
.todo-links a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: var(--wait-bg);
  color: var(--wait-ink);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
}
.todo-links a:hover { background: color-mix(in srgb, var(--wait-bg) 70%, var(--wait)); color: var(--wait-ink-2); }
.todo-links .ico { width: 16px; height: 16px; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.pager-links { display: flex; align-items: center; gap: .75rem; }

.visit-certificates { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding-left: 2rem; padding-right: 2rem; }
.visit-certificates strong { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }

/* Vizita: diagnozat dhe terapite e shpeshta te doktorit */
.quick-texts { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .5rem; }
.quick-texts-label { font-size: var(--fs-xs); color: var(--muted); margin-right: .15rem; }
.quick-text {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: .15rem .65rem;
  font-size: var(--fs-xs);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-text:hover { border-color: var(--role); color: var(--role-ink); background: var(--role-soft); }

/* ---------- Koka e fletes per printim: logoja dhe te dhenat e ordinances ---------- */

.sheet-brand { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.sheet-logo { max-height: 64px; max-width: 160px; object-fit: contain; flex: none; }
.sheet-foot {
  margin-top: 1.5rem;
  padding-top: .6rem;
  border-top: 1px solid var(--line-strong);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  text-align: center;
  white-space: pre-line;
}

.settings-layout { display: grid; grid-template-columns: minmax(0, 860px) 320px; gap: 1.5rem; align-items: start; }
.settings-layout .form-panel { max-width: none; }
@media (max-width: 1080px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
.logo-preview {
  display: grid;
  place-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.logo-preview img { max-width: 100%; max-height: 120px; object-fit: contain; }
.logo-upload { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.logo-upload .btn { align-self: flex-start; }

/* ---------- Matjet: tensioni, pulsi, pesha... ---------- */

.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem 1rem; }
.vital label, .vital-label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); margin-bottom: .2rem; }
.vital-input { display: flex; align-items: center; gap: .35rem; }
.vital-input .form-control { min-width: 0; width: 100%; max-width: 6.5rem; }
.vital-bp { grid-column: span 2; }
.vital-bp .form-control { max-width: 4.75rem; }
.vital-sep { color: var(--muted); }
.vital-unit { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.vital-bmi output { display: block; padding-top: .3rem; font-weight: 650; }
.vitals-previous { margin: .6rem 0 0; font-size: var(--fs-xs); color: var(--muted); }
@media (max-width: 480px) { .vital-bp { grid-column: span 1; } .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vital-bp { grid-column: 1 / -1; } }

.vitals-summary { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: 0; font-size: var(--fs-sm); }
.vitals-summary dt { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.vitals-summary dd { margin: 0; font-weight: 600; }
.visit-main { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.visit-main > .panel { margin: 0; }

.vitals-tabs { flex-wrap: wrap; margin-bottom: 1rem; }
.vitals-tabs button {
  border: 0;
  background: transparent;
  padding: .35rem .8rem;
  border-radius: 4px;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.vitals-tabs button:hover { color: var(--ink); background: var(--paper); }
.vitals-tabs button.active { background: var(--role-soft); color: var(--role-ink); font-weight: 600; }
.vitals-figure { margin: 0; }
.vitals-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .5rem; }
.vitals-latest { font-size: var(--fs-sm); color: var(--ink-2); }
.vitals-latest strong { font-size: var(--fs-xl); color: var(--ink); letter-spacing: -0.02em; margin-right: .15rem; }
.vitals-legend { display: inline-flex; gap: 1rem; margin-left: auto; font-size: var(--fs-xs); color: var(--ink-2); }
.vitals-legend i { display: inline-block; width: 14px; height: 2px; margin-right: .35rem; vertical-align: middle; border-radius: 2px; }
.vitals-svg { width: 100%; height: auto; display: block; overflow: visible; }
.vg-grid { stroke: var(--line); stroke-width: 1; }
.vg-axis { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.vg-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.vg-dot { stroke: var(--surface); stroke-width: 2; }
.vg-hit { fill: transparent; }
.vg-point:hover .vg-dot { r: 6; }
.vg-label { font-size: 12px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.vitals-table { margin-top: .75rem; font-size: var(--fs-sm); }
.vitals-table summary { color: var(--role-ink); font-weight: 500; cursor: pointer; }
.vitals-table .table { margin: .5rem 0 0; }

/* ---------- Dokumentet e pacientit ---------- */

.doc-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.doc-list li { display: flex; align-items: center; gap: .85rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.doc-list li:first-child { border-top: 0; padding-top: 0; }
.doc-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  display: grid;
  place-items: center;
  overflow: hidden;
  text-decoration: none;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-kind { font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); }
.doc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-title { font-weight: 600; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.doc-text .secondary { font-size: var(--fs-xs); color: var(--muted); }
.doc-list.is-compact li { gap: .6rem; padding: .45rem 0; }
.doc-list.is-compact .doc-thumb { width: 34px; height: 34px; }
.doc-list.is-compact .doc-kind { font-size: 9px; }
.doc-upload > summary { list-style: none; display: inline-flex; align-items: center; gap: .4rem; }
.doc-upload > summary::-webkit-details-marker { display: none; }
.doc-upload[open] > summary { margin-bottom: .75rem; }
.doc-upload-form { display: grid; gap: .85rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.doc-drop { position: relative; display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; margin: 0; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.doc-drop:hover, .doc-drop.is-dragover, .doc-drop:focus-within { border-color: var(--role); background: var(--role-soft); }
.doc-drop.has-file { border-style: solid; border-color: var(--role); }
.doc-drop input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.doc-drop > .ico { flex: none; width: 2.25rem; height: 2.25rem; padding: .55rem; border-radius: 50%; background: var(--role-soft); color: var(--role-ink); }
.doc-drop-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.doc-drop-text strong { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-upload-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: .75rem; align-items: end; }
.doc-upload-fields .form-label { margin-bottom: .3rem; }
@media (max-width: 640px) { .doc-upload-fields { grid-template-columns: minmax(0, 1fr); } .doc-upload-fields .btn { justify-self: start; } }
.doc-empty { margin-bottom: .75rem; }
@media (max-width: 640px) { .doc-list li { flex-wrap: wrap; } .doc-list .row-actions { width: 100%; justify-content: flex-start; padding-left: calc(48px + .85rem); } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 .85rem; }
.section-head .section-title { margin: 0; }

/* ---------- Kalendari javor ---------- */

.week-panel { overflow: hidden; }
.week-scroll { overflow-x: auto; }
.week {
  display: grid;
  grid-template-columns: 56px repeat(var(--days), minmax(110px, 1fr));
  min-width: calc(56px + var(--days) * 110px);
  position: relative;
}
.week[aria-busy="true"] { opacity: .6; pointer-events: none; }
.week-corner, .week-dayhead { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.week-dayhead { border-left: 1px solid var(--line); text-align: center; }
.week-dayhead a { display: flex; flex-direction: column; align-items: center; padding: .55rem .25rem; color: var(--ink-2); text-decoration: none; line-height: 1.15; }
.week-dayhead a:hover { background: var(--paper); color: var(--ink); }
.week-dayhead span { font-size: var(--fs-xs); text-transform: capitalize; }
.week-dayhead strong { font-size: var(--fs-lg); color: var(--ink); }
.week-dayhead.is-today strong { color: #fff; background: var(--role); border-radius: 999px; min-width: 2rem; padding: 0 .4rem; }
.week-hours { position: relative; }
.week-hours span { position: absolute; right: .5rem; translate: 0 -50%; font-size: 11px; color: var(--muted); }
.week-hours span:first-child { translate: 0 2px; }
.week-day {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour));
}
.week-day.is-today { background-color: color-mix(in srgb, var(--role-soft) 45%, transparent); }
.week-day.is-past { background-color: color-mix(in srgb, var(--paper) 70%, transparent); }
[data-can-manage="true"] .week-day:not(.is-past) { cursor: copy; }
.week-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 70%, transparent) 6px 7px); background-color: color-mix(in srgb, var(--paper) 60%, transparent); pointer-events: none; }
.week-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.week-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.week-appt {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: .2rem .4rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid currentColor;
  font-size: var(--fs-xs);
  line-height: 1.25;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 0 0 1px var(--surface);
  cursor: pointer;
}
.week-appt:hover { filter: brightness(.97); z-index: 2; }
.week-appt.is-movable { cursor: grab; }
.week-appt.is-dragging { opacity: .35; }
.week-appt-time { font-weight: 600; }
.week-appt-name { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-appt-doc { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week-appt.appt-cancelled, .week-appt.appt-noshow { opacity: .6; }
.week-appt.appt-cancelled .week-appt-name { text-decoration: line-through; }
.week-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 2;
  border: 2px dashed var(--role);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--role-soft) 70%, transparent);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--role-ink);
  padding: .1rem .35rem;
  pointer-events: none;
}
.week-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; padding: .65rem 1rem; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-2); }
.week-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; border: 1px solid currentColor; }
.week-appt.is-short { flex-direction: row; align-items: center; gap: .35rem; padding-top: 0; padding-bottom: 0; }

/* ngjyra e doktorit: vija majtas e terminit (statusi mbetet ne sfond) */
.doc-c0 { --doc: var(--cat-1); } .doc-c1 { --doc: var(--cat-2); } .doc-c2 { --doc: var(--cat-3); }
.doc-c3 { --doc: var(--cat-4); } .doc-c4 { --doc: var(--cat-5); } .doc-c5 { --doc: var(--cat-6); }
.week-appt[class*="doc-c"] { border-left: 5px solid var(--doc); }
.week-legend-doctors i { background: var(--doc); border-color: var(--doc); }

/* tekstet visually-hidden (position: absolute) brenda tabelave s'duhet ta zgjerojne faqen ne telefon */
.table-responsive { position: relative; }

/* Telefoni: menyja e doktorit ne nje rresht; ne ekzaminim formulari para kartes anesore */
.docbar-nav { scrollbar-width: none; }
.docbar-nav a { white-space: nowrap; }
@media (max-width: 720px) {
  .exam-aside { order: 0; }
  .action-bar .btn { padding-left: .8rem; padding-right: .8rem; }
  .page-head h1 { font-size: var(--fs-lg); }
  .panel-body { padding: 1rem 1.1rem; }
  .panel-head { padding: .8rem 1.1rem; }
}

/* ---------- Lejet e punetoreve ---------- */

.perm-check { display: flex; gap: .65rem; align-items: flex-start; padding: .55rem 0; margin: 0; }
.perm-check .form-check-input { flex: none; margin: .2rem 0 0; float: none; }
.perm-check label { cursor: pointer; }
.perm-check strong { display: block; font-size: var(--fs-sm); font-weight: 600; }
.perm-check small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.perm-check + .perm-check { border-top: 1px solid var(--line); }

/* vetem lejet e rolit te zgjedhur */
.role-perms [data-for-role] { display: none; }
form:has(input[name="Role"][value="Receptionist"]:checked) .role-perms [data-for-role="Receptionist"],
form:has(input[name="Role"][value="Laboratory"]:checked) .role-perms [data-for-role="Laboratory"],
form:has(input[name="Role"][value="ClinicAdmin"]:checked) .role-perms [data-for-role="ClinicAdmin"],
form:has(input[name="Role"][value="Doctor"]:checked) .role-perms [data-for-role="Doctor"] { display: block; }
.also-doctor-fields { display: none; margin-top: .25rem; }
.role-perms:has(#AlsoDoctor:checked) .also-doctor-fields { display: flex; }

.perm-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.perm-tag { font-size: var(--fs-xs); color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; }
.presence { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-xs); color: var(--muted); }
.presence::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--line-strong); }
.presence.is-online { color: var(--done); }
.presence.is-online::before { background: currentColor; }

/* ---------- Shkurtoret dhe dalja automatike ---------- */

.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; margin: 0; font-size: var(--fs-sm); }
.shortcuts dt { font-weight: 400; white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--ink-2); }
kbd { display: inline-block; min-width: 1.5em; padding: .05rem .4rem; font: 600 var(--fs-xs)/1.4 inherit; color: var(--ink); text-align: center; background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; }

.idle-warning {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 1080; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem; max-width: calc(100% - 2rem);
  padding: .75rem 1rem; background: var(--ink); color: #fff; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.2);
  font-size: var(--fs-sm);
}
.idle-warning button { flex: none; }

/* rezultati jashte vlerave normale */
.range-mark { color: var(--danger); }

/* pacient i ri ne radhe: seksioni ndriçohet per pak sekonda */
@keyframes just-updated { from { box-shadow: 0 0 0 4px var(--role-soft); } to { box-shadow: 0 0 0 0 transparent; } }
.just-updated .next-up, .just-updated > .page-head { animation: just-updated 4s ease-out; border-radius: var(--radius); }
.awaiting-payment { margin-bottom: 1.5rem; border-color: var(--wait); }

/* ---------- Dritarja e dokumenteve ---------- */

.doc-viewer { width: min(1100px, calc(100vw - 2rem)); height: calc(100vh - 2rem); max-height: none; padding: 0; border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.doc-viewer[open] { display: flex; flex-direction: column; }
.doc-viewer::backdrop { background: rgba(23, 38, 46, .55); }
.doc-viewer-head { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.doc-viewer-head h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-viewer-nav, .doc-viewer-actions { display: flex; align-items: center; gap: .35rem; flex: none; }
.doc-viewer-nav[hidden] { display: none; }
.doc-viewer-frame { flex: 1; width: 100%; border: 0; background: var(--paper); }
@media (max-width: 640px) { .doc-viewer-actions .btn { display: none; } }

/* Kartela e pacientit: veprimet e rralla te palosura, terapia ne historik */
.problem-manager, .consent-actions, .rights-actions { margin-top: .5rem; }
.problem-manager > summary, .consent-actions > summary, .rights-actions > summary { list-style: none; }
.problem-manager > summary::-webkit-details-marker, .consent-actions > summary::-webkit-details-marker, .rights-actions > summary::-webkit-details-marker { display: none; }
.consent-actions[open], .rights-actions[open] { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.problem-manager > summary, .consent-actions > summary, .rights-actions > summary { text-align: left; }
.primary-cell .visit-therapy { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Fshirjet dhe heqjet: lidhje e kuqe, e qarte edhe pa ngjyre (nenvize ne hover/fokus) */
.btn-danger-link { --bs-btn-color: var(--danger); --bs-btn-hover-color: var(--danger-ink); --bs-btn-active-color: var(--danger-ink); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-bg: transparent; --bs-btn-hover-bg: var(--danger-bg); text-decoration: none; }
.btn-danger-link:hover, .btn-danger-link:focus-visible { text-decoration: underline; }

/* Cilesimet ne skeda */
.settings-tabs { flex-wrap: wrap; margin-bottom: 1rem; }
.settings-pane + .settings-pane { margin-top: 1.5rem; }
.tabs-ready .settings-pane + .settings-pane { margin-top: 0; }
.settings-pane[hidden] { display: none; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.settings-grid .panel { margin: 0; }
.link-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .4rem; }
.sheet-preview { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); padding: .9rem; font-size: var(--fs-xs); aspect-ratio: 1 / 1.1; display: flex; flex-direction: column; gap: .75rem; }
.sheet-preview-head { display: flex; gap: .6rem; align-items: center; padding-bottom: .6rem; border-bottom: 2px solid var(--role); }
.sheet-preview-head img { max-height: 40px; max-width: 80px; object-fit: contain; }
.sheet-preview-head div { display: flex; flex-direction: column; min-width: 0; }
.sheet-preview-head strong { font-size: var(--fs-sm); }
.sheet-preview-body { flex: 1; display: grid; gap: .5rem; align-content: start; }
.sheet-preview-body i { display: block; height: .45rem; border-radius: 3px; background: var(--line); }
.sheet-preview-body i:nth-child(2) { width: 80%; }
.sheet-preview-body i:nth-child(4) { width: 60%; }
.sheet-preview-foot { border-top: 1px solid var(--line); padding-top: .4rem; color: var(--muted); min-height: 1.2rem; white-space: pre-line; }

/* Dialog me formular (kartela mjekesore brenda vizites) */
.form-dialog { width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); background: var(--paper); }
.form-dialog::backdrop { background: rgba(23, 38, 46, .55); }
.form-dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.form-dialog-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.form-dialog-body { padding: 1rem; }
.form-dialog-body .form-panel { max-width: none; }
.form-dialog-body .form-actions { position: sticky; bottom: -1rem; margin-bottom: -1rem; padding: .75rem 0; background: var(--paper); }

/* ---------- Vetem analiza ---------- */

.lab-order-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.lab-order-head h2 { margin: 0; }
.lab-order-head input { max-width: 260px; }
.lab-order-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.lab-order-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; margin: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; }
.lab-order-item[hidden] { display: none; }
.lab-order-item .form-check-input { margin: 0; flex: none; }
.lab-order-name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 500; }
.lab-order-item:has(input:checked) { border-color: var(--role); background: var(--role-soft); }

/* ---------- Konfigurimi i pare ---------- */

.setup { min-height: 100vh; background: var(--paper); color: var(--ink); }
.setup-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.setup-bar .brand { padding: 0; }
.setup-bar-clinic { color: var(--muted); font-size: var(--fs-sm); margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-main { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.setup-kicker { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin: 0 0 .75rem; }
.setup-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; list-style: none; padding: 0; margin: 0 0 2rem; }
.setup-steps li {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-top: .6rem;
  border-top: 3px solid var(--line-strong);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.setup-steps li.is-done { border-color: var(--role); color: var(--ink-2); }
.setup-steps li.is-current { border-color: var(--role); color: var(--ink); font-weight: 600; }
.setup-step-num {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--line);
  font-size: var(--fs-xs);
  flex: none;
}
.setup-steps .is-done .setup-step-num, .setup-steps .is-current .setup-step-num { background: var(--role); color: #fff; }
.setup-title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 .4rem; }
.setup-lead { color: var(--ink-2); margin: 0 0 1.5rem; max-width: 60ch; }
.setup-body { padding: 1.5rem; }
.setup-subtitle { font-size: var(--fs-md); font-weight: 600; margin-bottom: 0; }
.setup-staff { display: grid; gap: .75rem; }
.setup-staff-row { margin: 0; padding: .75rem .5rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.setup .panel + .panel { margin-top: 1rem; }
.setup-actions { justify-content: flex-end; }
.setup-skip { text-align: center; margin-top: 2rem; }
.setup-skip .btn { color: var(--muted); }
.setup-logo { display: flex; gap: 1rem; align-items: flex-start; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.setup-logo > div:last-child { flex: 1; }
.setup-logo .logo-preview { width: 140px; flex: none; margin: 0; }
.setup-prices { list-style: none; margin: 0; padding: 0; }
.setup-prices li {
  display: grid;
  grid-template-columns: 1fr 9rem;
  gap: .25rem 1rem;
  align-items: center;
  padding: .65rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.setup-prices li:last-child { border-bottom: 0; }
.setup-prices .field-error { grid-column: 1 / -1; }
.setup-price-name { display: flex; gap: .65rem; align-items: center; margin: 0; cursor: pointer; font-weight: 500; }
.setup-price-name .form-check-input { margin: 0; flex: none; }
.setup-prices li.is-off .setup-price-name span { color: var(--muted); text-decoration: line-through; }
.setup-prices li.is-off .setup-price-input { opacity: .4; }
.setup-price-new { background: var(--paper); }

@media (max-width: 575.98px) {
  .setup-bar { padding: .65rem 1rem; }
  .setup-main { padding-top: 1.25rem; }
  .setup-steps li > span:last-child { display: none; }
  .setup-steps li { justify-content: center; }
  .setup-title { font-size: var(--fs-lg); }
  .setup-body { padding: 1rem; }
  .setup-logo { flex-direction: column; }
  .setup-prices li { grid-template-columns: 1fr 7rem; padding: .6rem 1rem; }
  .setup-actions .btn { flex: 1; }
}

/* ---------- Importimi i pacienteve ---------- */

.import-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; max-width: 1100px; }
.import-layout > .panel { margin: 0; }
.import-help { font-size: var(--fs-sm); }
.import-help ul { padding-left: 1.1rem; }
.import-columns { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: var(--fs-sm); }
@media (max-width: 900px) { .import-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Orari ---------- */

.hours-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: .4rem .5rem; align-items: center; }
.hours-day { display: flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); cursor: pointer; }
.hours-day input { accent-color: var(--role); }
.hours-grid input[readonly] { opacity: .4; pointer-events: none; }

/* ---------- Sugjerimet dhe shabllonet e vizites ---------- */

.suggest-box {
  position: absolute;
  z-index: 1060;
  margin: 0;
  padding: .25rem;
  list-style: none;
  max-height: 18rem;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm);
}
.suggest-box li { padding: .4rem .6rem; border-radius: calc(var(--radius-sm) - 2px); cursor: pointer; }
.suggest-box li.active, .suggest-box li:hover { background: var(--role-soft); color: var(--role-ink); }

.patient-suggest { top: calc(100% + 4px); left: 0; right: 0; max-height: 24rem; }
.patient-suggest li { display: flex; flex-direction: column; gap: .1rem; }
.patient-suggest li .secondary { font-size: var(--fs-xs); }
.patient-suggest li.empty { cursor: default; color: var(--muted); }
.patient-suggest li.empty:hover { background: none; color: inherit; }

.exam-templates { display: flex; gap: .5rem; align-items: flex-start; }
.exam-templates .form-select { width: auto; min-width: 11rem; }
.template-save { position: relative; }
.template-save > summary { list-style: none; }
.template-save > summary::-webkit-details-marker { display: none; }
.template-save-pop {
  position: absolute;
  right: 0;
  top: calc(100% + .4rem);
  z-index: 20;
  width: 18rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}

.template-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: .75rem; max-width: 860px; }
.template-list .panel, .template-item { margin: 0; max-width: 860px; }
.template-item > summary { display: flex; flex-direction: column; gap: .15rem; cursor: pointer; list-style: none; }
.template-item > summary::-webkit-details-marker { display: none; }
.template-form { display: grid; gap: .75rem; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .exam-templates { flex-wrap: wrap; }
  .template-save-pop { right: auto; left: 0; width: min(18rem, calc(100vw - 2rem)); }
}
.consent-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Ndihma ---------- */

.help-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; max-width: 1100px; }
.help-layout > .panel, .help-list > .panel { margin: 0; }
.help-list { display: flex; flex-direction: column; gap: 1.5rem; }
.help-list details { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.help-list details:last-child { border-bottom: 0; }
.help-list summary { font-weight: 600; cursor: pointer; }
.help-list details p { margin: .5rem 0 0; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.6; }
@media (max-width: 900px) { .help-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Analizat e sjella nga laborator tjeter ---------- */

.exam-last { max-width: 70ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-history { display: contents; }
.lab-meta.lab-external { color: var(--done); font-weight: 600; }
.lab-origin { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.lab-sheet-link { margin-left: .5rem; font-size: var(--fs-xs); }
.lab-filter { max-width: 260px; margin-bottom: .5rem; }
.lab-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .35rem; margin-bottom: .6rem; }
.lab-check-item { display: flex; align-items: center; gap: .45rem; padding: .35rem .55rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: var(--fs-sm); cursor: pointer; }
.lab-check-item[hidden] { display: none; }
.lab-check-item .form-check-input { margin: 0; flex: none; }
.lab-check-item small { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); }
.lab-check-item.is-checked { border-color: var(--done); background: color-mix(in srgb, var(--done) 8%, transparent); font-weight: 600; }
.lab-pending { color: var(--muted); font-size: var(--fs-sm); }
.lab-bring { margin-top: .15rem; }
.lab-bring[open] > summary { margin-bottom: .35rem; }
.lab-bring-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-top: .35rem; }
.lab-add-title { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin: .5rem 0 .35rem; }
.lab-brought-toggle { margin-top: .4rem; }
.lab-brought-toggle[open] > summary { margin-bottom: .35rem; }

/* Lista e pacienteve: nje buton kryesor ne faqe; "Fillo viziten" i rreshtit mbushet kur rreshti eshte nen kursor ose ne fokus */
.table-clean tr:hover .row-go, .table-clean tr:focus-within .row-go {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--done);
  --bs-btn-border-color: var(--done);
}

.kbd-hint { margin-left: .75rem; white-space: nowrap; }

/* fusha ne fokus nuk fshihet nen shiritin lart ose shiritin e veprimeve poshte */
html { scroll-padding-top: 5rem; }
html:has(.action-bar) { scroll-padding-bottom: 5.5rem; }

/* butoni gjate dergimit te formes */
.btn.is-busy { cursor: progress; opacity: .7; }
.btn.is-busy::after {
  content: "";
  width: .85em;
  height: .85em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { rotate: 360deg; } }

/* ---------- Korrigjimet e vizites ---------- */

.visit-revisions { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.visit-revisions summary { cursor: pointer; font-size: var(--fs-sm); color: var(--muted); }
.visit-revisions .report-block { margin-top: .75rem; }

/* ---------- Verifikimi me dy hapa ---------- */

.twofa-page { max-width: 560px; }
.twofa-steps { padding-left: 1.2rem; margin: 0; }
.twofa-steps li { margin-bottom: 1rem; }
.twofa-qr { width: 200px; height: 200px; margin: .75rem 0; background: #fff; padding: 4px; }
.twofa-qr svg { width: 100%; height: 100%; }
.twofa-code { max-width: 12rem; }
.recovery-codes { columns: 2; list-style: none; padding: 0; font-size: 1.05rem; letter-spacing: .05em; }

.fiscal-note { font-size: var(--fs-xs); color: var(--muted); text-align: center; margin: .25rem 0 0; }

/* ---------- Lista e problemeve ---------- */

.problem-list { margin-bottom: .75rem; }
.problem-list ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.problem-manage { list-style: none; padding: 0; margin: 0 0 .75rem; }
.problem-manage li { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.problem-manage li.is-resolved > span { color: var(--muted); text-decoration: line-through; }
.problem-add { display: flex; gap: .5rem; }
.problem-check { margin-top: .4rem; font-size: var(--fs-sm); }

.anonymize { display: inline; }
.anonymize[open] { display: block; }
.anonymize-form { margin-top: .5rem; padding: .75rem; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- Fushat e specialiteteve ---------- */

.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .5rem .75rem; }
.spec-field.is-wide { grid-column: 1 / -1; }
.spec-field .form-label { font-size: var(--fs-xs); margin-bottom: .15rem; }
.spec-calc { font-size: var(--fs-sm); margin: .5rem 0 0; }
.spec-pct { display: inline-block; margin-right: .75rem; }
.spec-pct.is-out strong { color: var(--danger); }

.vacc-add { display: grid; grid-template-columns: 2fr 1fr 1.3fr 1fr auto; gap: .4rem; }
@media (max-width: 640px) { .vacc-add { grid-template-columns: 1fr 1fr; } }

/* ---------- Grafiku i rritjes (OBSH) ---------- */

.growth-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.growth-chart { margin: 0; }
.growth-chart figcaption { font-size: var(--fs-sm); margin-bottom: .25rem; }
.growth-chart svg { width: 100%; height: auto; display: block; }
.growth-chart polyline { fill: none; stroke-width: 1.2; }
.growth-chart .g-p3, .growth-chart .g-p97 { stroke: var(--muted); stroke-dasharray: 3 3; }
.growth-chart .g-p50 { stroke: var(--muted); }
.growth-chart .g-child { stroke: var(--brand); stroke-width: 2; }
.growth-chart .g-dot { fill: var(--brand); }
.growth-chart .g-axis { font-size: 9px; fill: var(--muted); }

/* ---------- Trendi i analizave ---------- */

.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 1rem; }
.trend-line { width: 100%; height: auto; display: block; margin-bottom: .5rem; }
.trend-line polyline { fill: none; stroke: var(--brand); stroke-width: 2; }
.trend-line circle { fill: var(--brand); }
.trend-line circle.is-out { fill: var(--danger); }

/* ---------- Lidhja per pacientin ---------- */

.share-panel { border-color: var(--brand); }
.share-row { display: flex; gap: .5rem; margin: .5rem 0; }
.share-qr { width: 140px; height: 140px; }

.lab-upload-summary { margin: .5rem 0 0; }

/* Paneli i adminit: hapat e konfigurimit qe mbeten */
.next-steps-list { list-style: none; margin: 0; padding: .5rem 1.25rem 1rem; display: grid; gap: .45rem; }
.next-steps-list li { display: flex; align-items: center; gap: .6rem; }
.next-steps-list li.is-done { color: var(--muted); }
.next-step-mark { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border: 1.5px solid var(--line-strong); border-radius: 50%; font-size: .75rem; flex: none; }
.next-steps-list li.is-done .next-step-mark { background: var(--done-bg); border-color: var(--done); color: var(--done); }

/* Laboratori: shenimi i doktorit nen emrin e analizes */
.lab-test-note { flex-basis: 100%; font-size: var(--fs-xs); color: var(--ink-2); padding-left: 1.75rem; }

/* Shiriti klinik: alergjite dhe problemet aktive ne krye te vizites dhe te kartela */
.clinical-banner { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; padding: .6rem .9rem; margin: .5rem 0 1rem; border-radius: var(--radius-sm); border-left: 4px solid var(--danger); background: var(--danger-bg); color: var(--danger-ink); font-size: var(--fs-sm); }
.clinical-banner-problems { color: var(--ink); }
.page-head .clinical-banner { margin-bottom: 0; }
.allergy-match { margin: .35rem 0 0; padding: .35rem .6rem; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger-ink); font-size: var(--fs-sm); }
textarea.is-allergy-match { border-color: var(--danger); box-shadow: 0 0 0 .15rem rgba(180, 35, 24, .15); }
.allergy-match ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* Vizita: rezultatet jashte normes dhe kontrolla */
.labs-table tr.is-out td { background: var(--danger-bg); }
.out-count { display: block; margin-top: .2rem; font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }
.follow-select { max-width: 16rem; }

/* Tableti dhe telefoni: butona me te medhenj per gisht (WCAG 2.5.8) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding-left: .75rem; padding-right: .75rem; }
  .form-control, .form-select { min-height: 44px; }
  .form-check-input { width: 1.25rem; height: 1.25rem; }
}

/* Permbledhja e gabimeve te formularit (krijohet nga site.js) */
.error-summary { margin-bottom: 1.25rem; }
.error-summary h2 { font-size: var(--fs-base); font-weight: 700; margin: 0 0 .35rem; }
.error-summary ul { margin: 0; padding-left: 1.1rem; }
.error-summary a { color: inherit; text-decoration: underline; }

/* Stomatologjia: tabela e dhembeve (FDI), paneli i dhembit dhe plani */
.dental { margin-top: .75rem; }
.dental[aria-busy="true"] { opacity: .6; pointer-events: none; }
.dental-jaw { display: grid; gap: .35rem; overflow-x: auto; padding-bottom: .25rem; }
/* 16 dhembe ne rresht: ngushtohen sipas hapesires; vetem ne ekran shume te ngushte rreshti leviz anash */
.dental-row { display: flex; gap: 3px; justify-content: center; min-width: min-content; }
.dental-row.is-lower { flex-direction: row; }
.dental-row.is-upper + .dental-row.is-lower:not(.is-deciduous), .dental-row.is-deciduous.is-lower { margin-bottom: .2rem; }
.dental-row.is-upper:not(.is-deciduous) { padding-bottom: .35rem; border-bottom: 1px dashed var(--line-strong); }
.dental-row.is-deciduous .tooth { max-width: 2.2rem; }
.tooth { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1 1 0; min-width: 1.6rem; max-width: 2.5rem; padding: 2px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--ink); cursor: pointer; }
.tooth.is-mid { margin-left: .6rem; }
.tooth:hover, .tooth.is-selected { border-color: var(--role); background: var(--role-soft); }
.tooth:focus-visible { outline: 2px solid var(--role); outline-offset: 1px; }
.tooth:disabled { cursor: default; opacity: 1; }
.dental-row.is-lower .tooth { flex-direction: column-reverse; }
.tooth-num { font-size: .7rem; color: var(--muted); line-height: 1; }
.tooth-box { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 2rem; aspect-ratio: 1; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: var(--fs-xs); font-weight: 700; line-height: 1; }
.tooth-box small { font-size: .55rem; font-weight: 600; margin-top: 1px; }
.c-caries .tooth-box, .tooth-box.c-caries { background: var(--tooth-red-bg); border-color: var(--tooth-red); color: var(--tooth-red-ink); }
.c-filled .tooth-box, .tooth-box.c-filled { background: var(--prog-bg); border-color: var(--prog); color: var(--prog-ink); }
.c-rootcanal .tooth-box, .tooth-box.c-rootcanal { background: var(--tooth-violet-bg); border-color: var(--tooth-violet); color: var(--tooth-violet-ink); }
.c-crown .tooth-box, .tooth-box.c-crown { background: var(--wait-bg); border-color: var(--wait); color: var(--tooth-gold-ink); }
.c-bridge .tooth-box, .tooth-box.c-bridge { background: var(--wait-bg); border-color: var(--wait); border-style: dashed; color: var(--tooth-gold-ink); }
.c-implant .tooth-box, .tooth-box.c-implant { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.c-missing .tooth-box, .tooth-box.c-missing { background: var(--paper); border-style: dashed; color: var(--muted); }
.c-toextract .tooth-box, .tooth-box.c-toextract { background: var(--surface); border-color: var(--tooth-red); border-width: 2px; color: var(--tooth-red-ink); }
.c-fractured .tooth-box, .tooth-box.c-fractured { background: var(--tooth-orange-bg); border-color: var(--tooth-orange); color: var(--tooth-orange-ink); }
.c-impacted .tooth-box, .tooth-box.c-impacted { background: var(--cancel-bg); border-color: var(--cancel); color: var(--tooth-gray-ink); }
.tooth.has-plan .tooth-box::after, .has-plan-dot::after { content: ""; position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--prog); border: 2px solid var(--surface); }
.has-plan-dot { width: 1.1rem !important; height: 1.1rem !important; }
.dental-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; list-style: none; padding: 0; margin: .6rem 0 .4rem; font-size: var(--fs-xs); color: var(--ink-2); }
.dental-legend li { display: inline-flex; align-items: center; gap: .3rem; }
.dental-legend .tooth-box { width: 1.4rem; height: 1.4rem; font-size: .65rem; }
.dental-panel { margin: .5rem 0; padding: .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.dental-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.dental-panel-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1rem; }
.dental-state, .dental-add { display: flex; flex-direction: column; gap: .4rem; }
.dental-state .form-label, .dental-add .form-label { margin: 0; font-size: var(--fs-xs); font-weight: 600; }
.dental-surfaces { display: flex; flex-wrap: wrap; gap: .5rem; font-size: var(--fs-sm); }
.dental-surface { display: inline-flex; align-items: center; gap: .25rem; }
.dental-add-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.dental-add-row .form-control:first-child { max-width: 7rem; }
.dental-add-row .form-control { flex: 1; min-width: 6rem; }
.dental-history h4, .dental-list-title { font-size: var(--fs-sm); font-weight: 700; margin: .8rem 0 .3rem; }
.dental-list-title small { font-weight: 400; color: var(--muted); margin-left: .35rem; }
.dental-history ul { margin: 0; padding-left: 1.1rem; font-size: var(--fs-sm); }
.dental-list { list-style: none; margin: 0; padding: 0; }
.dental-list li { display: grid; grid-template-columns: 5.5rem 1fr auto auto auto; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.dental-tooth-tag { font-weight: 600; }
.dental-status { min-height: 1.2rem; margin: .3rem 0 0; font-size: var(--fs-xs); color: var(--muted); }
.dental-status.is-error { color: var(--danger); font-weight: 600; }
@media (max-width: 640px) {
  .dental-panel-grid { grid-template-columns: 1fr; }
  .dental-row { justify-content: flex-start; }
  .dental-list li { grid-template-columns: 4.5rem 1fr auto; }
}
.spec-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .15rem 1.25rem; }
