/* =====================================================================
   MEDINOVA DASHBOARD — consolidated stylesheet
   Structure:
     1. Tokens (light + dark)
     2. Reset & base
     3. Layout shell
     4. Sidebar
     5. Page header
     6. Common components
     7. Tables
     8. Dropdowns & menus
     9. Modals
    10. Overview
    11. Diagnostics
    12. Reports
    13. Patients
    14. Complaints
    15. Doctors
    16. Notices
    17. SMS
    18. FAQ
    19. Settings
    20. User admin
    21. Notification bell
    22. Login
    23. Print
    24. Responsive
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------- */

:root {
  /* Light */
  --bg: #fff;
  --surface: #fff;
  --surface-alt: #fff;
  --text: #101828;
  --text-strong: #111827;
  --text-soft: #374151;
  --muted: #667085;
  --line: #e5e7eb;
  --line-soft: #edf0f5;
  --line-input: #dfe4ec;
  --primary: #2e3192;
  --primary-strong: #24266f;
  --primary-on: #fff;
  --soft: #eef2ff;
  --soft-border: #dfe4ff;
  --soft-hover: #e5ebff;
  --danger: #b42318;
  --danger-strong: #991b1b;
  --danger-bg: #fff1f0;
  --danger-border: #fecaca;
  --success: #15803d;
  --success-bg: #ecfdf5;
  --success-border: #bbf7d0;
  --warning: #9a3412;
  --warning-bg: #fff7ed;
  --warning-border: #fed7aa;
  --shadow: 0 12px 32px rgba(16, 24, 40, .07);
  --shadow-soft: 0 14px 38px rgba(16, 24, 40, .06);
  --radius: 8px;
  --radius-lg: 10px;
  --sidebar-width: 272px;
  --sidebar-collapsed-width: 86px;
  --content-x: 36px;
  --tbl-border: #e6eaf2;
  --tbl-head-bg: #f8fafc;
  --tbl-head-color: #475467;
  --tbl-row-hover: #fbfcff;
  --overlay: rgba(15, 23, 42, .42);
}

:root[data-theme="dark"] {
  /* Pure black — no shadows, flat surfaces */
  --bg: #000;
  --surface: #0a0a0a;
  --surface-alt: #0a0a0a;
  --text: #f4f4f5;
  --text-strong: #f4f4f5;
  --text-soft: #c8c8c8;
  --muted: #8b8b8b;
  --line: #1c1c1c;
  --line-soft: #141414;
  --line-input: #1c1c1c;
  --primary: #8b8bff;
  --primary-strong: #6b6bff;
  --primary-on: #000;
  --soft: #141414;
  --soft-border: #242424;
  --soft-hover: #1c1c1c;
  --danger: #ff7b7b;
  --danger-strong: #ff9090;
  --danger-bg: #190a0a;
  --danger-border: #3a1818;
  --success: #4ade80;
  --success-bg: #0a2616;
  --success-border: #1a4028;
  --warning: #ffb84d;
  --warning-bg: #1a1200;
  --warning-border: #3a2a00;
  --shadow: none;
  --shadow-soft: none;
  --tbl-border: #1c1c1c;
  --tbl-head-bg: #000;
  --tbl-head-color: #9a9a9a;
  --tbl-row-hover: #141414;
  --overlay: rgba(0, 0, 0, .78);
}

/* Zero shadows in dark mode (belt + suspenders) */

:root[data-theme="dark"] *,
:root[data-theme="dark"] *::before,
:root[data-theme="dark"] *::after {
  box-shadow: none !important;
  text-shadow: none !important;
}

/* ---------------------------------------------------------------------
   2. RESET & BASE
   --------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: none;
}

.btn:focus-visible,
.nav-button:focus-visible,
.nav-child:focus-visible,
.sidebar-toggle:focus-visible,
.sidebar-theme-toggle:focus-visible,
.icon-btn:focus-visible,
.actions-trigger:focus-visible,
.table-icon-btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

a {
  color: var(--primary);
  text-decoration: none;
}


/* =====================================================================
   25. GLOBAL HEADER
   ===================================================================== */

/* Make .content a flex column so the header sits above the scrollable body */
.content {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.content-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 28px var(--content-x) 36px;
}

.global-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 var(--content-x);
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}

.gh-left,
.gh-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Icon buttons (collapse, theme) */
.gh-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.gh-icon-btn:hover {
  background: var(--soft);
  border-color: var(--soft-border);
  color: var(--primary);
}
.gh-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gh-sidebar-toggle svg { transition: transform .2s ease; }
.sidebar-collapsed .gh-sidebar-toggle svg { transform: rotate(180deg); }

/* Theme icon swap (reuse existing dark-mode class hooks) */
.gh-icon-btn .icon-sun  { display: none; }
:root[data-theme="dark"] .gh-icon-btn .icon-sun  { display: block; }
:root[data-theme="dark"] .gh-icon-btn .icon-moon { display: none; }

/* Breadcrumb */
.gh-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gh-breadcrumb .gh-parent  { color: var(--muted); }
.gh-breadcrumb .gh-sep     { color: var(--line); }
.gh-breadcrumb .gh-current { color: var(--text-strong); font-weight: 700; }

/* Bell inside the header */
.gh-bell { display: inline-flex; margin: 0; }
.gh-bell .bell-icon { width: 40px; height: 40px; }

/* User avatar + dropdown */
.gh-user { position: relative; display: inline-flex; align-items: center; }

.gh-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-on);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  border: 2px solid var(--surface);
  outline: 1px solid var(--line-soft);
}
.gh-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.gh-avatar.is-online::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--surface);
}

.gh-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 999;
}
.gh-user-menu.open { display: block; }

.gh-user-menu .gh-user-info {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
  min-width: 0;
}
.gh-user-menu .gh-user-info strong {
  display: block;
  font-size: 13.5px;
  color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gh-user-menu .gh-user-info span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.gh-user-menu a,
.gh-user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.gh-user-menu a:hover,
.gh-user-menu button:hover {
  background: var(--soft);
  color: var(--primary);
}
.gh-user-menu a svg { width: 16px; height: 16px; flex: 0 0 16px; }
.gh-user-menu .gh-logout { color: var(--danger); }
.gh-user-menu .gh-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* The header bell replaces all in-page bells */
.page-header .header-notification { display: none !important; }

/* Retire the sidebar-bottom toggles on desktop — the header owns them now */
@media (min-width: 981px) {
  .sidebar .sidebar-toggle,
  .sidebar .sidebar-theme-toggle { display: none !important; }
  .sidebar, .sidebar-collapsed .sidebar { padding-bottom: 24px; }
}

/* Responsive padding moved from .content to .content-body */
@media (max-width: 980px) {
  .content-body { padding: 22px var(--content-x) 28px; }
  .global-header { display: none; }   /* brand bar already carries bell + theme + hamburger */
}
@media (max-width: 820px) {
  .content-body { padding: 16px var(--content-x) 28px; }
}
@media (max-width: 700px) {
  .content-body { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 560px) {
  .content-body { padding: 14px 10px 24px; }
}


/* ---------------------------------------------------------------------
   3. LAYOUT SHELL
   --------------------------------------------------------------------- */

.dashboard-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
  transition: grid-template-columns .2s ease;
}

.dashboard-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

.content {
  min-width: 0;
  padding: 28px var(--content-x) 36px;
  background: var(--bg);
}

.tab-panel {
  display: none;
  width: 100%;
}

.tab-panel.active {
  display: block;
  min-height: calc(100vh - 64px);
}

.page {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  min-width: 0;
}

/* ---------------------------------------------------------------------
   4. SIDEBAR
   --------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 22px 16px 76px;
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
}

/* Brand */

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 0 4px 16px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
  min-width: 0;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
  width: 100%;
}

.brand-copy h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 190px;
}

.sidebar .header-notification {
  display: none;
}

/* Sidebar toggles — collapse (right) + theme (left), same row */

.sidebar-toggle,
.sidebar-theme-toggle {
  position: absolute;
  bottom: 20px;
  z-index: 30;
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.sidebar-toggle {
  right: 5%;
  transform: translateX(-50%);
}

.sidebar-theme-toggle {
  left: 5%;
  transform: translateX(50%);
}

.sidebar-toggle:hover,
.sidebar-theme-toggle:hover {
  background: var(--soft);
  border-color: var(--soft-border);
  color: var(--primary);
}

.sidebar-toggle svg,
.sidebar-theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-toggle svg {
  transition: transform .2s ease;
}

/* Theme icon swap */

.sidebar-theme-toggle .icon-sun {
  display: none;
}

.sidebar-theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="dark"] .sidebar-theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .sidebar-theme-toggle .icon-moon {
  display: none;
}

/* Nav scroll region */

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 4px 0 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  overscroll-behavior: contain;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 6px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

/* Nav buttons */

.nav-button,
.nav-child {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
  transition: background .14s ease, color .14s ease;
}

.nav-button:hover,
.nav-child:hover {
  background: var(--soft);
  color: var(--text-strong);
}

.nav-button.active {
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
}

.nav-button.active:hover {
  background: var(--soft-hover);
}

.nav-button>span:not(.nav-icon):not(.nav-menu-toggle),
.nav-child>span:not(.nav-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chevron */

.nav-button:has(.nav-menu-toggle) {
  padding-right: 38px;
}

.nav-menu-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  transform: translateY(-50%);
  opacity: .55;
  transition: transform .16s ease, opacity .16s ease;
}

.nav-button:hover .nav-menu-toggle,
.nav-button.active .nav-menu-toggle {
  opacity: 1;
}

.nav-menu-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .16s ease;
}

.nav-group.open .nav-menu-toggle svg {
  transform: rotate(180deg);
}

/* Nav icons */

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Submenu */

.nav-group {
  display: grid;
  gap: 2px;
  flex: 0 0 auto;
}

.nav-sub {
  position: relative;
  display: none;
  margin: 2px 0 4px 20px;
  padding: 2px 0 2px 12px;
}

.nav-sub::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line-soft);
}

.nav-group.open .nav-sub {
  display: grid;
}

.nav-child {
  height: 40px;
  min-height: 40px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 12px;
}

.nav-child:hover {
  background: var(--soft);
  color: var(--text-strong);
}

.nav-child.active {
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
}

/* Collapsed */

.sidebar-collapsed .sidebar {
  padding: 22px 12px 130px;
}

.sidebar-collapsed .brand {
  align-items: center;
  gap: 0;
  padding: 0 0 16px;
}

.sidebar-collapsed .brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
}

.sidebar-collapsed .brand-copy {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  left: 50%;
  right: auto;
  bottom: 20px;
  transform: translateX(-50%);
}

.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-theme-toggle {
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
}

.sidebar-collapsed .nav-button {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .nav-button>span:not(.nav-icon),
.sidebar-collapsed .nav-menu-toggle {
  display: none;
}

.sidebar-collapsed .nav-icon {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
}

.sidebar-collapsed .nav-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-collapsed .nav-sub {
  margin-left: 0;
  padding-left: 0;
}

.sidebar-collapsed .nav-sub::before {
  display: none;
}

.sidebar-collapsed .nav-child {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .nav-child>span:not(.nav-icon) {
  display: none;
}

/* Mobile hamburger */

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}

.mobile-menu-toggle:hover {
  background: var(--soft);
  border-color: var(--soft-border);
}

.mobile-menu-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------------
   5. PAGE HEADER
   --------------------------------------------------------------------- */

.page-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.page-title {
  min-width: 0;
}

.page-title h2,
.page-title h3 {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--text-strong);
}

.page-title p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.page-header .pill {
  margin-left: auto;
  flex: 0 0 auto;
}

/* ---------------------------------------------------------------------
   6. COMMON COMPONENTS
   --------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-title {
  margin: 0 0 18px;
  font-size: 18px;
  color: var(--text-strong);
}

.card-head .card-title {
  margin: 0;
}

/* Forms */

.field {
  margin-bottom: 16px;
  min-width: 0;
}

.field label,
label {
  display: block;
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 46px;
  min-width: 0;
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 12px;
  outline: none;
}

.textarea {
  height: auto;
  min-height: 96px;
  padding-top: 12px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  min-width: 0;
  border: 1px solid var(--line-input);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.btn:hover {
  background: var(--soft);
  border-color: var(--soft-border);
  color: var(--text-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn.full {
  width: 100%;
}

.btn-sm {
  height: 42px;
  min-width: 68px;
  padding: 0 10px;
  font-size: 12.5px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-on);
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: var(--primary-on);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-dark {
  background: var(--text-strong);
  border-color: var(--text-strong);
  color: var(--bg);
}

.btn-dark:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* Pills */

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 0 12px;
  white-space: nowrap;
}

/* Status badges */

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-open {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-in-progress {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-resolved {
  background: var(--success-bg);
  color: var(--success);
}

.status-closed {
  background: var(--soft);
  color: var(--primary);
}

/* Text utilities */

.serial-badge {
  display: inline;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.token-text {
  color: var(--primary);
  font-weight: 800;
}

.good {
  color: var(--success);
}

.bad {
  color: var(--danger);
}

.muted-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.muted-small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.small-strong {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* Toolbar */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .btn {
  min-width: 88px;
}

/* Notes / warnings / alerts */

.note {
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  padding: 12px;
}

.warning {
  display: none;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.alert {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}

.doctor-info {
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  color: var(--success);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}

/* Empty state */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--muted);
  text-align: center;
  padding: 28px;
  font-size: 14px;
}

/* Stat summary */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.stat {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 18px;
  min-width: 0;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 24px;
  color: var(--text-strong);
}

/* Grid helpers */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* ---------------------------------------------------------------------
   7. TABLES
   --------------------------------------------------------------------- */

.table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 70vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--tbl-border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.table-wrap table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 14px;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--tbl-head-bg);
  color: var(--tbl-head-color);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  padding: 12px 14px;
  border-bottom: 1px solid var(--tbl-border);
}

.table-wrap tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--tbl-border);
  color: var(--text);
  vertical-align: middle;
  background: var(--surface);
}

.table-wrap tbody tr:last-child td {
  border-bottom: none;
}

.table-wrap tbody tr:hover td {
  background: var(--tbl-row-hover);
}

.cell-truncate {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-name {
  max-width: 240px;
}

.col-message {
  max-width: 320px;
}

.col-address {
  max-width: 260px;
}

.col-email {
  max-width: 220px;
}

.col-modules {
  max-width: 260px;
}

.actions-cell {
  width: 56px;
  text-align: right;
  white-space: nowrap;
  position: relative;
}

.actions-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.actions-trigger:hover,
.actions-trigger[aria-expanded="true"] {
  background: var(--soft);
  border-color: var(--soft-border);
  color: var(--primary);
}

.actions-trigger svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.table-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-icon-btn:hover {
  background: var(--soft);
  border-color: var(--soft-border);
  color: var(--primary);
}

.table-icon-btn.danger {
  color: var(--danger);
}

.table-icon-btn.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.icon-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pager{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px; flex-wrap:wrap;
  margin-top:14px; padding-top:12px;
  border-top:1px solid var(--line-soft);
}
.pager-info{
  color:var(--muted); font-size:12.5px; font-weight:600;
}
.pager-info strong{ color:var(--text-strong); }
.pager-size{
  display:inline-flex; align-items:center; gap:8px;
  color:var(--muted); font-size:12.5px; font-weight:600;
}
.pager-size select{
  height:32px; padding:0 8px;
  border:1px solid var(--line-input);
  border-radius:6px;
  background:var(--surface); color:var(--text);
  font:inherit; font-size:12.5px;
}
.pager-nav{ display:inline-flex; align-items:center; gap:6px; }
.pager-btn{
  min-width:34px; height:34px; padding:0 10px;
  display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--line-input);
  border-radius:6px;
  background:var(--surface); color:var(--text-soft);
  font:inherit; font-size:13px; font-weight:800;
  cursor:pointer;
}
.pager-btn:hover:not(:disabled){
  background:var(--soft); border-color:var(--soft-border); color:var(--primary);
}
.pager-btn:disabled{ opacity:.45; cursor:not-allowed; }
.pager-btn.is-active{
  background:var(--primary); border-color:var(--primary); color:var(--primary-on);
}
.pager-ellipsis{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:24px; height:34px;
  color:var(--muted); font-weight:800;
}
@media (max-width:720px){
  .pager{ justify-content:center; }
  .pager-info{ order:3; width:100%; text-align:center; }
  .pager-nav{ order:1; }
  .pager-size{ order:2; }
}

/* Pagination — shared by Test List & SMS Logs */

.test-list-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.test-list-pagination .icon-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.test-page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.test-page-numbers .page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

.test-page-numbers .page-number.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-on);
}

.page-ellipsis {
  height: 34px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
  padding: 0 2px;
}

/* ---------------------------------------------------------------------
   8. DROPDOWNS & MENUS
   --------------------------------------------------------------------- */

.search-wrap {
  position: relative;
}

.dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  max-height: 340px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dropdown.open {
  display: block;
}

.result-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item:hover {
  background: var(--tbl-row-hover);
}

.result-item.disabled {
  opacity: .55;
  cursor: not-allowed;
}

.result-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.result-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.result-price {
  font-weight: 800;
  white-space: nowrap;
}

.actions-menu {
  position: fixed;
  z-index: 9000;
  min-width: 180px;
  max-width: min(260px, calc(100vw - 16px));
  max-height: min(60vh, 480px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-4px) scale(.98);
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}

.actions-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.actions-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.actions-menu button:hover {
  background: var(--soft);
  color: var(--primary);
}

.actions-menu button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.actions-menu button.danger {
  color: var(--danger);
}

.actions-menu button.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.actions-menu .menu-sep {
  height: 1px;
  background: var(--line);
  margin: 5px 4px;
}

.toolbar-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 108px;
}

/* ============================================================
   MOBILE / SEARCH SUGGESTION DROPDOWNS
   ~4–5 visible rows, then vertical scroll.
   Works for every .search-wrap > .dropdown on the page.
   ============================================================ */

.search-wrap .dropdown {
  max-height: 290px;
  /* ≈ 5 compact rows */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  overscroll-behavior: contain;
}

.search-wrap .dropdown::-webkit-scrollbar {
  width: 8px;
}

.search-wrap .dropdown::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

.search-wrap .dropdown::-webkit-scrollbar-track {
  background: transparent;
}

/* Compact rows so ~5 fit in the height above */

.search-wrap .dropdown .result-item {
  padding: 9px 12px;
}

.search-wrap .dropdown .result-name {
  font-size: 13.5px;
  line-height: 1.25;
}

.search-wrap .dropdown .result-meta {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-wrap .dropdown .result-price {
  font-size: 13px;
}

/* ---------------------------------------------------------------------
   9. MODALS
   --------------------------------------------------------------------- */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  padding: 22px;
}

.modal-layer.open {
  display: flex;
}

.modal-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-wide {
  width: min(900px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: var(--text-strong);
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-card .textarea {
  min-height: 82px;
}

/* ---------------------------------------------------------------------
   10. OVERVIEW
   --------------------------------------------------------------------- */

.overview-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.overview-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 22px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: background .12s ease, border-color .12s ease;
}

.overview-row:hover {
  background: var(--tbl-row-hover);
  border-color: var(--line);
}

.overview-row--linked {
  cursor: pointer;
}

.overview-row-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent, var(--primary));
}

.overview-row-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.overview-row-label {
  min-width: 0;
}

.overview-row-label strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.overview-row-label span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.overview-row-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.overview-row-arrow {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: color .12s ease, transform .12s ease;
}

.overview-row-arrow svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.overview-row:hover .overview-row-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

.overview-grid .empty {
  grid-column: 1 / -1;
  border: 0;
  background: transparent;
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------------------------------------------------------------------
   11. DIAGNOSTICS
   --------------------------------------------------------------------- */

#tests .grid-two {
  grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

#tests .search-card {
  padding: 24px;
}

#tests .search-card .field {
  margin-bottom: 16px;
}

#tests .note {
  margin-top: 16px;
  padding: 14px 15px;
  line-height: 1.55;
}

#tests .toolbar {
  justify-content: space-between;
  margin-bottom: 20px;
}

#tests .toolbar .pill {
  height: 34px;
  margin-right: auto;
}

#tests .selected-list {
  display: grid;
  gap: 14px;
}

#tests .test-row {
  display: grid;
  grid-template-columns: 34px minmax(220px, 1fr) 110px 180px 38px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

#tests .check {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

#tests .test-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-strong);
}

#tests .test-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

#tests .money {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#tests .discount-control {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#tests .discount-control select,
#tests .discount-control input {
  height: 38px;
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
}

#tests .summary-grid {
  margin-top: 20px;
  gap: 16px;
}

#tests .stat {
  padding: 18px;
}

#tests .small-field {
  max-width: 280px;
  margin-top: 20px;
  margin-bottom: 0;
}

#tests .empty {
  padding: 34px;
}

/* Test list */

.test-list-card {
  margin-top: 18px;
}

.test-list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.test-list-toolbar .field {
  margin-bottom: 0;
}

.test-list-toolbar .btn {
  height: 44px;
  white-space: nowrap;
}

.test-list-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.test-list-form .field {
  margin-bottom: 0;
}

.test-list-form .wide {
  grid-column: span 2;
}

.test-list-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.test-list-wrap table {
  min-width: 900px;
}

.test-list-wrap th:nth-child(2),
.test-list-wrap td:nth-child(2) {
  min-width: 280px;
  max-width: 360px;
}

.test-list-wrap th:nth-child(3),
.test-list-wrap td:nth-child(3) {
  width: 110px;
}

.test-list-name {
  display: block;
  max-width: 34ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------
   12. REPORTS
   --------------------------------------------------------------------- */

#reportApp .report-panel {
  padding: 24px;
}

#reportApp .report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}

#reportApp .report-head .card-title {
  margin: 0;
  line-height: 1.2;
}

#reportApp .report-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

#reportApp .report-head-actions .btn {
  min-width: 116px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

#reportApp .report-date-pill {
  height: 36px;
  min-height: 36px;
  border-radius: var(--radius);
  align-self: center;
}

#reportApp .report-total {
  height: 36px;
  min-width: 230px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  align-self: center;
}

#reportApp .report-total span {
  display: inline;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
}

#reportApp .report-total strong {
  display: inline;
  color: var(--primary);
  font-size: 20px;
  line-height: 1;
}

#reportApp .report-controls {
  display: grid;
  grid-template-columns: 180px minmax(280px, 1fr) 260px;
  gap: 14px;
  align-items: end;
  margin: 0 0 18px;
}

#reportApp .report-controls .field {
  margin: 0;
}

#reportApp .table-wrap {
  border-radius: var(--radius);
}

#reportApp th:nth-child(3),
#reportApp td:nth-child(3) {
  text-align: center;
  width: 150px;
}

#reportApp .serial-badge {
  min-width: 36px;
  height: 28px;
}

#reportApp .load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

#reportApp .load-more-row .btn {
  min-width: 180px;
}

/* ---------------------------------------------------------------------
   13. PATIENTS
   --------------------------------------------------------------------- */

.patients-card {
  padding: 24px;
}

.patients-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  width: 100%;
  margin-bottom: 18px;
}

.patients-toolbar .field {
  margin: 0;
}

.patients-toolbar .field:first-child {
  flex: 1 1 320px;
  min-width: 220px;
}

.patients-toolbar .field:nth-child(2) {
  flex: 0 0 180px;
  min-width: 160px;
}

.patients-toolbar .btn {
  flex: 0 0 auto;
  min-width: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#patientsApp .table-wrap th:nth-child(4),
#patientsApp .table-wrap td:nth-child(4) {
  text-align: center;
  white-space: nowrap;
}

#patientsApp .table-wrap th:nth-child(6),
#patientsApp .table-wrap td:nth-child(6) {
  text-align: center;
  white-space: nowrap;
  width: 110px;
}

#patientsApp .table-wrap th:nth-child(7),
#patientsApp .table-wrap td:nth-child(7) {
  text-align: right;
  white-space: nowrap;
  width: 60px;
}

#patientsApp .actions-cell {
  text-align: right;
  padding-right: 14px;
}

#patientsApp .actions-cell .actions-trigger {
  margin-left: auto;
}

#patientsApp .cell-doctor {
  display: block;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------
   14. COMPLAINTS
   --------------------------------------------------------------------- */

.complaint-history-card {
  margin-top: 24px;
}

.complaint-history-card .card-head {
  align-items: flex-start;
}

/* ---------------------------------------------------------------------
   15. DOCTORS
   --------------------------------------------------------------------- */

.doctor-directory-card {
  padding: 24px;
}

.doctor-info-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 140px max-content;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.doctor-info-toolbar .field {
  margin: 0;
}

.doctor-info-toolbar .btn-sm {
  align-self: end;
  width: auto;
}

.doctor-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.doctor-profile-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  min-width: 0;
  transition: border-color .18s ease;
}

.doctor-profile-card:hover {
  border-color: var(--soft-border);
}

.doctor-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.doctor-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  font-size: 34px;
  font-weight: 900;
}

.doctor-profile-body {
  min-width: 0;
  display: grid;
  align-content: start;
}

.doctor-department {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--soft-border);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  padding: 0 9px;
  margin-bottom: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doctor-profile-body h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doctor-degree {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doctor-meta-line {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  margin-top: 10px;
}

.doctor-meta-line span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.doctor-meta-line strong {
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.35;
}

.doctor-upload-btn {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
}

.doctor-upload-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.doctor-upload-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-on);
}

/* Schedule editor */

.schedule-editor {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface-alt);
  padding: 14px;
  margin: 0 0 16px;
}

.schedule-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.schedule-editor-head .section-heading {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--text-strong);
}

.schedule-group-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 12px;
}

.schedule-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.schedule-group-head strong {
  font-size: 13px;
  color: var(--text-soft);
}

.schedule-group-days {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.schedule-group-days label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.schedule-group-days input {
  accent-color: var(--primary);
}

.schedule-group-time {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.schedule-group-time label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.schedule-group-time input[type="time"] {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
}

.schedule-remove-group {
  width: 32px;
  height: 32px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.schedule-remove-group:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* Doctor day checks */

.doctor-day-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.doctor-day-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
}

.doctor-day-checks input {
  accent-color: var(--primary);
}

.doctor-schedule-list {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.doctor-schedule-chamber {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.doctor-schedule-chamber b {
  font-size: 12px;
  color: var(--text-strong);
  line-height: 1.35;
}

.doctor-schedule-chamber span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  line-height: 1.35;
  text-transform: uppercase;
}

.doctor-schedule-chamber em {
  display: inline-block;
  margin-left: 4px;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}

.doctor-notice-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 800;
  margin-left: 8px;
  white-space: nowrap;
}

.doctor-notice-badge svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

/* Doctor preview modal */

.doctor-preview-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
}

.doctor-preview-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
}

.doctor-preview-info {
  display: grid;
  gap: 12px;
}

.preview-field {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  font-size: 14px;
}

.preview-field label {
  font-weight: 700;
  color: var(--text-soft);
  margin: 0;
}

.preview-field span {
  color: var(--text-strong);
}

/* ---------------------------------------------------------------------
   16. NOTICES
   --------------------------------------------------------------------- */

.notices-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.notices-toolbar .field {
  margin: 0;
}

.notices-form {
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.notices-list-wrap table {
  min-width: 700px;
}

.notice-status-active {
  color: var(--success);
  font-weight: 800;
}

.notice-status-expired {
  color: var(--muted);
}

.notice-status-upcoming {
  color: var(--primary);
  font-weight: 800;
}

/* ---------------------------------------------------------------------
   17. SMS
   --------------------------------------------------------------------- */

.sms-logs-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.sms-logs-toolbar-dates {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  min-width: 0;
}

.sms-logs-toolbar-dates .field {
  margin: 0;
  min-width: 0;
}

.sms-logs-toolbar-dates .input {
  height: 40px;
  width: 100%;
}

.sms-logs-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.sms-logs-toolbar-export {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.recent-sms-card {
  padding: 22px;
}

.recent-sms-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-sms-card .table-wrap {
  max-height: 420px;
}

.recent-sms-card table {
  table-layout: fixed;
  width: 100%;
  font-size: 13px;
}

.recent-sms-card thead th {
  padding: 9px 10px;
  font-size: 11px;
}

.recent-sms-card tbody td {
  padding: 9px 10px;
  vertical-align: middle;
}

.recent-sms-card .col-sms-date {
  width: 96px;
}

.recent-sms-card .col-sms-recipient {
  width: 120px;
}

.recent-sms-card .col-sms-message {
  width: auto;
}

.recent-sms-card .col-sms-status {
  width: 86px;
  text-align: center;
}

.recent-sms-card .cell-truncate {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------
   18. FAQ
   --------------------------------------------------------------------- */

#faqApp .faq-card {
  padding: 24px;
}

#faqApp .faq-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

#faqApp .faq-list .empty {
  grid-column: 1/-1;
}

#faqApp .faq-item {
  display: block;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

#faqApp .faq-item summary {
  list-style: none;
  cursor: pointer;
  min-height: 62px;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-strong);
  font-weight: 800;
  line-height: 1.35;
}

#faqApp .faq-item summary::-webkit-details-marker {
  display: none;
}

#faqApp .faq-item summary::after {
  content: "+";
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}

#faqApp .faq-item[open] summary {
  border-bottom: 1px solid var(--line-soft);
}

#faqApp .faq-item[open] summary::after {
  content: "-";
  background: var(--primary);
  color: var(--primary-on);
}

#faqApp .faq-message {
  padding: 15px 18px 17px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.faq-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.faq-toolbar .field {
  margin-bottom: 0;
}

.faq-admin-panel {
  border: 1px solid var(--line-soft);
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.faq-admin-panel .textarea {
  min-height: 112px;
}

.faq-active-line {
  margin-bottom: 14px;
}

.faq-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.faq-actions .btn {
  height: 34px;
  min-width: 82px;
}

/* ---------------------------------------------------------------------
   19. SETTINGS
   --------------------------------------------------------------------- */

#settingsApp .page-header {
  margin-bottom: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 5fr 5fr;
  gap: 18px;
  align-items: start;
}

.settings-col {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

#settingsApp .card-head {
  margin-bottom: 14px;
}

#settingsApp .card-title {
  font-size: 17px;
}

#settingsApp .field {
  margin-bottom: 12px;
}

#settingsApp .input {
  height: 42px;
}

/* User information card */

#settingsApp .profile-card {
  padding: 22px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0;
}

#settingsApp .profile-summary {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
}

#settingsApp .account-avatar {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 20px;
  background: var(--primary);
  color: var(--primary-on);
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
}

#settingsApp .account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

#settingsApp .profile-summary h3 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#settingsApp .profile-summary p {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  height: 26px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
  padding: 0 10px;
}

.role-pill.role-admin {
  background: var(--soft);
  border-color: var(--soft-border);
  color: var(--primary);
}

#settingsApp .profile-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line-soft);
}

#settingsApp .profile-controls .field {
  margin: 0;
}

#settingsApp .profile-controls label {
  font-size: 12px;
  color: var(--text-soft);
}

#settingsApp .profile-controls .input {
  height: 40px;
}

#settingsApp .profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#settingsApp .profile-actions .btn {
  height: 40px;
  width: 100%;
  padding: 0 10px;
}

#settingsApp .profile-password {
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}

#settingsApp .profile-password-head {
  margin-bottom: 14px;
}

#settingsApp .profile-password-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: var(--text-strong);
  line-height: 1.25;
}

#settingsApp .profile-password-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

#settingsApp .profile-password .field {
  margin-bottom: 12px;
}

#settingsApp .profile-password .input {
  height: 40px;
}

#settingsApp .profile-password .btn {
  width: 100%;
  height: 40px;
  margin-top: 4px;
}

#settingsApp .profile-password .settings-message {
  margin-top: 12px;
}

/* Logout — red in both themes */

#settingsApp .profile-logout {
  padding-top: 18px;
}

#settingsApp .profile-logout .btn,
#settingsApp .profile-logout .btn:link,
#settingsApp .profile-logout .btn:visited {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  border-color: #dc2626;
  color: #fff !important;
  text-decoration: none !important;
}

#settingsApp .profile-logout .btn:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

#settingsApp .profile-logout .btn:active {
  background: #991b1b;
  border-color: #991b1b;
}

/* Brand settings */

#settingsApp .brand-settings-card {
  padding: 22px;
}

#settingsApp .brand-settings-preview {
  margin-bottom: 12px;
}

.brand-settings-preview {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 12px;
  margin-bottom: 16px;
}

.brand-settings-logo {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.brand-settings-preview strong {
  display: block;
  color: var(--text-strong);
  font-size: 16px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-settings-preview span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SMS templates */

#settingsApp .sms-templates-card {
  padding: 22px;
}

.sms-templates-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.sms-templates-form {
  display: grid;
  gap: 0;
}

.sms-templates-list .table-wrap {
  max-height: 340px;
}

.sms-templates-list table {
  font-size: 13.5px;
}

.sms-templates-list thead th {
  padding: 10px 12px;
}

.sms-templates-list tbody td {
  padding: 10px 12px;
}

.sms-templates-sep {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
}

.appointment-template-section .card-head {
  margin-bottom: 10px;
}

/* Settings messages */

.settings-message {
  display: none;
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
}

.settings-message.success {
  display: block;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.settings-message.error {
  display: block;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

/* Password toggle */

.password-wrap {
  position: relative;
}

.password-wrap .input {
  padding-right: 66px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 0 4px;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------
   20. USER ADMIN
   --------------------------------------------------------------------- */

.user-admin-card {
  padding: 22px;
}

.user-admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.user-admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 18px;
  align-items: start;
}

.section-heading {
  margin: 0 0 14px;
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.module-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.module-checks label,
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
}

.check-line {
  width: max-content;
  margin: 0 0 10px;
}

.module-checks input,
.check-line input {
  accent-color: var(--primary);
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.user-table-wrap table {
  min-width: 760px;
}

.user-table-wrap th:nth-child(1),
.user-table-wrap td:nth-child(1) {
  min-width: 260px;
  width: 32%;
}

.user-table-wrap th:nth-child(2),
.user-table-wrap td:nth-child(2) {
  width: 110px;
}

.user-table-wrap th:nth-child(3),
.user-table-wrap td:nth-child(3) {
  width: 110px;
}

.user-table-wrap th:nth-child(4),
.user-table-wrap td:nth-child(4) {
  min-width: 200px;
}

.user-table-wrap th:nth-child(5),
.user-table-wrap td:nth-child(5) {
  width: 70px;
  text-align: right;
}

.module-perm-wrap {
  overflow-x: auto;
}

.module-perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.module-perm-table thead th {
  background: var(--tbl-head-bg);
  color: var(--tbl-head-color);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--tbl-border);
  text-align: left;
}

.module-perm-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--tbl-border);
  vertical-align: middle;
  color: var(--text);
}

.module-perm-table tbody tr:last-child td {
  border-bottom: none;
}

.module-perm-table .perm-col {
  width: 76px;
  text-align: center;
}

.module-perm-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.module-perm-table input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: .45;
}

/* User cell */

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2e3192, #4f52c9);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .02em;
  flex: 0 0 42px;
  /* overflow: hidden; — REMOVED so the online dot can hang outside */
  border: 2px solid var(--surface);
  outline: 1px solid var(--line-soft);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;   /* image stays circular even without overflow:hidden */
  display: block;
}

.user-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-info strong {
  font-size: 14px;
  color: var(--text-strong);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-info span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-avatar.is-online::after,
.user-avatar.is-online::after {
  content:"";
  position:absolute; right:-3px; bottom:-3px;
  width:12px; height:12px; border-radius:50%;
  background:#22c55e;
  border:2px solid var(--surface);
  box-shadow:0 0 0 1px rgba(34,197,94,.35);
}
.account-avatar,
.user-avatar { position:relative; }


/* Online status dot */
.user-avatar,
.account-avatar { position:relative; }

@media (max-width: 700px) {
  .user-avatar.is-online::after { width: 10px; height: 10px; right: -3px; bottom: -3px; }
}

/* ---------------------------------------------------------------------
   21. NOTIFICATION BELL
   --------------------------------------------------------------------- */

/* Mobile bell inside the brand bar — hidden on desktop */

.header-notification {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  flex-shrink: 0;
  position: relative;
}

.bell-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.bell-icon:hover {
  background: var(--soft);
  border-color: var(--soft-border);
}

.bell-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
  pointer-events: none;
  display: none;
}

.bell-badge.has-notice {
  display: inline-block;
}

.notification-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  min-height: 220px;
  max-height: min(72vh, 440px);
  overflow-y: auto;
  padding: 6px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 999;
}

.notification-dropdown.open {
  display: block;
}

.notification-dropdown::before {
  content: "Notifications";
  display: block;
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.notification-item {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.5;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item .notice-doctor {
  font-weight: 700;
  color: var(--text-strong);
}

.notification-item .notice-date {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
  font-weight: 600;
}

.notification-item .notice-message {
  color: var(--muted);
  margin-top: 3px;
}

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.notification-empty svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.notification-loading {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.notification-view-all {
  padding: 4px 12px 8px;
  margin-top: 2px;
  text-align: right;
}

.notification-view-all .notification-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
}

.notification-view-all .notification-link:hover {
  text-decoration: underline;
}

.notification-view-all .notification-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* ---------------------------------------------------------------------
   22. LOGIN
   --------------------------------------------------------------------- */
.login-body{
  margin:0;
  min-height:100vh;
  background:var(--bg);
  font-family:Arial,"Segoe UI",sans-serif;
}

.login-shell{
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);
  min-height:100vh;
}

/* ---------- LEFT: marketing panel ---------- */
.login-visual{
  position:relative;
  overflow:hidden;
  display:flex;
  align-items:center;
  padding:64px;
  background:linear-gradient(135deg,#0b0f3a 0%,#2e3192 52%,#0f766e 100%);
  color:#fff;
  isolation:isolate;
}
.login-visual-glow{
  position:absolute; inset:auto -20% -30% auto;
  width:70vw; height:70vw;
  background:radial-gradient(circle at 30% 30%,
    rgba(142,230,176,.35), transparent 60%);
  filter:blur(60px);
  z-index:0;
}
.login-art{
  position:absolute; inset:0; z-index:0; pointer-events:none;
}
.glass-panel{
  position:absolute;
  border:1px solid rgba(255,255,255,.22);
  background:rgba(255,255,255,.09);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border-radius:18px;
  padding:22px;
  box-shadow:0 24px 60px rgba(0,0,0,.25);
}
.panel-main{ width:340px; height:210px; right:10%; top:14%; }
.panel-small{ width:220px; height:130px; left:8%; top:56%; }
.panel-chip{ width:160px; height:76px; right:18%; bottom:12%; }
.glass-panel span,
.glass-panel strong,
.glass-panel i{
  display:block; border-radius:999px;
  background:rgba(255,255,255,.55);
  margin-bottom:12px;
}
.glass-panel span{ width:46%; height:10px; }
.glass-panel strong{ width:72%; height:14px; }
.glass-panel i{
  width:38%; height:10px;
  background:rgba(142,230,176,.85);
}
.panel-chip{ display:flex; align-items:center; gap:10px; }
.panel-chip i{ width:36px; height:36px; border-radius:12px; margin:0;
  background:rgba(255,255,255,.55); }
.panel-chip span{ width:60px; height:10px; margin:0;
  background:rgba(142,230,176,.85); }

.login-visual-copy{
  position:relative; z-index:1;
  max-width:520px;
}
.login-hero-logo{
  width:60px; height:60px;
  margin-bottom:22px;
  border-radius:16px;
  filter:drop-shadow(0 10px 22px rgba(0,0,0,.35));
}
.login-visual-copy h1{
  margin:0;
  font-size:44px; line-height:1.05; font-weight:900;
  letter-spacing:-.01em;
}
.login-visual-copy p{
  margin:16px 0 0;
  font-size:16px; line-height:1.6;
  color:rgba(255,255,255,.82);
}
.login-features{
  list-style:none; padding:0; margin:26px 0 0;
  display:grid; gap:10px;
}
.login-features li{
  display:flex; align-items:center; gap:10px;
  font-size:14.5px; color:rgba(255,255,255,.9);
}
.login-features svg{
  width:18px; height:18px; flex:0 0 18px;
  stroke:#8ee6b0; stroke-width:2.6;
  fill:none; stroke-linecap:round; stroke-linejoin:round;
}

/* ---------- RIGHT: form panel ---------- */
.login-panel{
  display:grid; place-items:center;
  padding:clamp(28px,5vw,64px);
  background:var(--surface);
  border-left:1px solid var(--line-soft);
}
.login-card{
  width:100%; max-width:420px;
  background:transparent;
  padding:0;
}
.login-heading{
  display:flex; align-items:center; gap:14px;
  margin-bottom:26px;
}
.login-card-logo{
  width:48px; height:48px;
  border-radius:12px;
  background:var(--surface-alt);
  border:1px solid var(--line-soft);
  object-fit:contain;
  padding:6px;
}
.login-heading h2{
  margin:0; font-size:26px; line-height:1.15;
  color:var(--text-strong); font-weight:900;
}
.login-heading p{
  margin:4px 0 0; color:var(--muted); font-size:13.5px;
}

.login-form{ display:grid; gap:4px; }
.login-form .field{ margin-bottom:16px; }
.login-form label{
  font-size:12.5px; font-weight:800;
  color:var(--text-soft); margin-bottom:8px;
  text-transform:uppercase; letter-spacing:.03em;
}

/* Input with leading icon */
.input-icon{ position:relative; }
.input-icon > svg{
  position:absolute; left:12px; top:50%;
  transform:translateY(-50%);
  width:17px; height:17px;
  stroke:var(--muted); fill:none; stroke-width:1.9;
  stroke-linecap:round; stroke-linejoin:round;
  pointer-events:none;
}
.input-icon .input{
  height:48px; padding-left:38px;
  background:var(--surface-alt);
  border-radius:10px;
}
.input-icon .input:focus{ background:var(--surface); }
.input-icon .password-toggle{
  position:absolute; right:10px; top:50%;
  transform:translateY(-50%);
  height:28px; padding:0 8px;
  border:0; background:transparent;
  color:var(--primary);
  font:inherit; font-size:11.5px; font-weight:900;
  letter-spacing:.04em; text-transform:uppercase;
  cursor:pointer;
}
.input-icon .password-toggle:hover{ text-decoration:underline; }

.login-submit{
  height:50px; margin-top:6px;
  font-size:15px; font-weight:800;
  border-radius:10px;
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  box-shadow:0 10px 22px rgba(46,49,146,.28);
}
.login-submit svg{
  width:18px; height:18px;
  stroke:currentColor; stroke-width:2.4; fill:none;
  stroke-linecap:round; stroke-linejoin:round;
  transition:transform .16s ease;
}
.login-submit:hover svg{ transform:translateX(3px); }

.login-card .alert{
  background:var(--danger-bg);
  border:1px solid var(--danger-border);
  color:var(--danger);
  border-radius:10px;
  padding:11px 14px;
  font-size:13.5px;
  margin:0 0 16px;
}

.help-link{
  display:block; width:100%; margin:18px 0 0;
  padding:8px;
  background:transparent; border:0;
  color:var(--primary);
  font:inherit; font-size:13px; font-weight:800;
  text-align:center; cursor:pointer;
}
.help-link:hover{ text-decoration:underline; }

.help-message{
  display:none; margin-top:10px;
  border:1px solid var(--soft-border);
  background:var(--soft);
  color:var(--text-soft);
  border-radius:10px;
  padding:12px 14px;
  font-size:13px; line-height:1.5;
  text-align:center;
}
.help-message.show{ display:block; }

.login-footer{
  margin-top:32px;
  padding-top:16px;
  border-top:1px solid var(--line-soft);
  text-align:center;
  color:var(--muted); font-size:12px;
}

/* ---------- Responsive ---------- */
@media (max-width:1024px){
  .login-shell{ grid-template-columns:1fr; }
  .login-visual{ min-height:auto; padding:44px 28px; align-items:flex-start; }
  .login-visual-copy h1{ font-size:32px; }
  .login-visual-copy p{ font-size:14px; }
  .login-features{ display:none; }
  .panel-main{ width:220px; height:auto; aspect-ratio:16/9; right:6%; top:14%; }
  .panel-small{ width:150px; height:auto; aspect-ratio:16/9; left:6%; bottom:10%; top:auto; }
  .panel-chip{ display:none; }
  .login-panel{ border-left:0; padding:32px 22px 40px; }
}
@media (max-width:560px){
  .login-visual{ padding:32px 20px; }
  .login-visual-copy h1{ font-size:26px; }
  .login-heading h2{ font-size:22px; }
  .login-card-logo{ width:42px; height:42px; }
  .login-panel{ padding:24px 18px 32px; }
}

:root[data-theme="dark"] .login-panel{ background:#0a0a0a; }
:root[data-theme="dark"] .login-submit{ box-shadow:none; }


/* ---------------------------------------------------------------------
   23. PRINT
   --------------------------------------------------------------------- */

.print-only {
  display: none;
}

.print-serial,
.print-discount,
.print-net {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 16mm;
  }

  html,
  body {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
    color: #111 !important;
  }

  .sidebar,
  .page-header,
  .no-print,
  .form-card,
  .search-card {
    display: none !important;
  }

  .dashboard-shell {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .content {
    display: block !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
  }

  .page {
    max-width: none !important;
    margin: 0 !important;
  }

  .grid-two {
    display: block !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: #111 !important;
  }

  .tab-panel {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tab-panel.active {
    display: block !important;
  }

  .table-wrap {
    border: none !important;
    overflow: visible !important;
    max-height: none !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  .table-wrap thead th {
    position: static !important;
  }

  table {
    font-size: 9.5px !important;
    line-height: 1.15 !important;
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  th,
  td {
    padding: 3px 5px !important;
    background: #fff !important;
    color: #111 !important;
    border-color: #e5e7eb !important;
  }

  th {
    font-size: 9.5px !important;
    background: #f3f4f6 !important;
  }

  .summary-grid {
    margin: 0 0 6px !important;
    gap: 5px !important;
  }

  .stat {
    padding: 5px !important;
    background: #fff !important;
    border-color: #e5e7eb !important;
  }

  .stat span {
    margin-bottom: 2px !important;
    color: #555 !important;
  }

  .stat strong {
    font-size: 13px !important;
    color: #111 !important;
  }

  .serial-badge {
    display: inline !important;
    min-width: 0 !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #111 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    padding: 0 !important;
  }

  .actions-cell,
  .actions-menu,
  .actions-trigger,
  .table-icon-btn {
    display: none !important;
  }

  .cell-truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
  }

  /* Reports print layout */

  #reports.active #reportApp {
    color: #111;
  }

  #reports.active #reportApp .report-panel {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border: 0 !important;
  }

  #reports.active #reportApp .report-head {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: start !important;
    gap: 12px !important;
    margin: 0 0 18px !important;
    padding: 0 0 12px !important;
    border-bottom: 1px solid #d0d5dd !important;
  }

  #reports.active #reportApp .report-head .card-title {
    grid-column: 1/3;
    font-size: 18px !important;
    line-height: 1.25 !important;
    margin: 0 0 6px !important;
    text-align: center !important;
    color: #111 !important;
  }

  #reports.active #reportApp .report-head-actions {
    display: contents !important;
  }

  #reports.active #reportApp .report-date-pill {
    grid-column: 1 !important;
    justify-self: start !important;
    min-height: 0 !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    color: #111 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
  }

  #reports.active #reportApp .report-date-pill::before {
    content: "Date: ";
    font-weight: 800;
  }

  #reports.active #reportApp .report-total {
    grid-column: 2 !important;
    justify-self: end !important;
    min-width: 0 !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    display: inline-flex !important;
    gap: 8px !important;
    align-items: baseline !important;
    color: #111 !important;
  }

  #reports.active #reportApp .report-total span {
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #111 !important;
  }

  #reports.active #reportApp .report-total strong {
    font-size: 14px !important;
    font-weight: 900 !important;
    color: #111 !important;
  }

  #reports.active #reportApp table {
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  #reports.active #reportApp th,
  #reports.active #reportApp td {
    padding: 7px 9px !important;
  }

  /* Diagnostics print layout */

  #tests.active #testApp {
    color: #111;
  }

  #tests.active .print-only {
    display: flex !important;
  }

  #tests.active .diagnostic-print-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 14px;
    padding: 0 0 12px;
    border-bottom: 2px solid #111;
  }

  #tests.active .diagnostic-print-head h3 {
    margin: 0;
    color: #111;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 900;
  }

  #tests.active .diagnostic-print-head p {
    margin: 4px 0 0;
    color: #444;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 700;
  }

  #tests.active #diagnosticPrintDate {
    color: #111;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  #tests.active .diagnostic-print-columns {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) 78px 78px 88px;
    align-items: center;
    margin: 0;
    padding: 7px 0;
    border-bottom: 1px solid #111;
    color: #111;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  #tests.active .diagnostic-print-columns span:nth-child(3),
  #tests.active .diagnostic-print-columns span:nth-child(4),
  #tests.active .diagnostic-print-columns span:nth-child(5) {
    text-align: right;
  }

  #tests.active .selected-list {
    display: block !important;
    margin: 0 !important;
    gap: 0 !important;
  }

  #tests.active .test-row {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) 78px 78px 88px !important;
    gap: 0 !important;
    align-items: start !important;
    border: 0 !important;
    border-bottom: 1px solid #d7dce5 !important;
    border-radius: 0 !important;
    background: #fff !important;
    padding: 7px 0 !important;
    page-break-inside: avoid;
  }

  #tests.active .test-row-muted {
    display: none !important;
  }

  #tests.active .test-row .check,
  #tests.active .test-row .discount-control,
  #tests.active .test-row .icon-btn {
    display: none !important;
  }

  #tests.active .print-serial {
    grid-column: 1 !important;
    color: #111;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.35;
  }

  #tests.active .test-row>div:not(.discount-control):not(.money):not(.print-serial) {
    grid-column: 2 !important;
    min-width: 0;
    padding-right: 10px;
  }

  #tests.active .test-name {
    color: #111;
    font-size: 11.5px !important;
    line-height: 1.35 !important;
    font-weight: 800;
  }

  #tests.active .test-sub {
    margin-top: 2px !important;
    color: #555 !important;
    font-size: 9.5px !important;
    line-height: 1.3 !important;
  }

  #tests.active .money,
  #tests.active .print-discount,
  #tests.active .print-net {
    display: block !important;
    color: #111;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.35;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  #tests.active .money {
    grid-column: 3 !important;
  }

  #tests.active .print-discount {
    grid-column: 4 !important;
  }

  #tests.active .print-net {
    grid-column: 5 !important;
    font-weight: 900;
  }

  #tests.active #emptyBill,
  #tests.active .small-field {
    display: none !important;
  }

  #tests.active .summary-grid {
    display: block !important;
    max-width: 330px !important;
    margin: 16px 0 0 auto !important;
    border-top: 1px solid #111 !important;
    border-bottom: 1px solid #111 !important;
  }

  #tests.active .stat {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: center !important;
    gap: 18px !important;
    border: 0 !important;
    border-bottom: 1px solid #d7dce5 !important;
    border-radius: 0 !important;
    background: #fff !important;
    padding: 7px 0 !important;
    text-align: right !important;
  }

  #tests.active .stat:last-child {
    border-bottom: 0 !important;
  }

  #tests.active .stat span {
    margin: 0 !important;
    color: #444 !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    text-align: left !important;
    text-transform: uppercase;
  }

  #tests.active .stat strong {
    color: #111 !important;
    font-size: 13px !important;
    font-weight: 900 !important;
  }

  #tests.active .stat .bad,
  #tests.active .stat .good {
    color: #111 !important;
  }

  /* Patients print */

  #patientsApp .table-wrap table th,
  #patientsApp .table-wrap table td {
    border: 0 !important;
    padding: 5px 7px !important;
  }

  #patientsApp .table-wrap th:nth-child(4),
  #patientsApp .table-wrap td:nth-child(4),
  #patientsApp .table-wrap th:nth-child(6),
  #patientsApp .table-wrap td:nth-child(6) {
    text-align: center !important;
  }

  #patientsApp .table-wrap th:nth-child(7),
  #patientsApp .table-wrap td:nth-child(7) {
    display: none !important;
  }

  #patientsApp .cell-doctor {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  /* Overview print */

  .overview-row {
    border: 1px solid #d0d5dd !important;
    background: #fff !important;
  }

  .overview-row-icon {
    background: #eee !important;
    color: #333 !important;
  }
}

/* ---------------------------------------------------------------------
   24. RESPONSIVE
   --------------------------------------------------------------------- */

@media (max-width: 1180px) {
  :root {
    --content-x: 24px;
  }

  .grid-two,
  #tests .grid-two {
    grid-template-columns: 1fr;
  }

  #tests .test-row {
    grid-template-columns: 30px minmax(0, 1fr) 96px 160px 38px;
  }

  #reportApp .report-controls,
  .report-controls {
    grid-template-columns: 1fr 1fr;
  }

  .doctor-info-toolbar {
    grid-template-columns: minmax(260px, 1fr) 210px 170px;
  }

  .doctor-info-toolbar .btn-sm {
    grid-column: 1/-1;
    width: max-content;
  }

  .doctor-profile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-admin-grid,
  .user-admin-form {
    grid-template-columns: 1fr;
  }

  #settingsApp .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  :root {
    --content-x: 22px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: auto;
    padding: 40px 28px;
    align-items: flex-start;
  }

  .login-visual h1 {
    font-size: 32px;
  }

  .login-visual p {
    font-size: 14px;
    margin-top: 12px;
  }

  .login-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
  }

  .panel-main {
    width: 240px;
    height: auto;
    aspect-ratio: 16/9;
    right: 6%;
    top: 14%;
  }

  .panel-small {
    width: 170px;
    height: auto;
    aspect-ratio: 16/9;
    left: 6%;
    top: 52%;
  }

  .login-panel {
    min-height: auto;
    padding: 32px 24px 40px;
  }

  .login-card {
    max-width: 520px;
  }

  .dashboard-shell,
  .dashboard-shell.sidebar-collapsed {
    display: block;
    min-height: 0;
  }

  .content {
    padding: 22px var(--content-x) 28px;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    z-index: 99;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 14px 16px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    background: var(--surface);
  }

  /* Hide the collapse chevron on mobile; keep the theme toggle */

  .sidebar-toggle,
  .sidebar-collapsed .sidebar-toggle {
    display: none !important;
  }

  /* 5-column brand bar: logo | spacer | theme | bell | menu */

  .brand,
  .sidebar-collapsed .brand {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 40px 40px 40px;
    grid-template-areas: "logo . theme bell menu";
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--line-soft);
    position: relative;
  }

  .brand-logo,
  .sidebar-collapsed .brand-logo {
    grid-area: logo;
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }

  /* Hide the title / subtitle on mobile */

  .brand-copy,
  .sidebar-collapsed .brand-copy {
    display: none !important;
  }

  /* Theme toggle: visible in the top bar */

  .sidebar-theme-toggle,
  .sidebar-collapsed .sidebar-theme-toggle {
    display: inline-grid !important;
    grid-area: theme;
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    margin: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .sidebar-theme-toggle:active {
    transform: none;
  }

  /* Hide the in-page header bell — the brand-bar bell replaces it on mobile */

  .page-header .header-notification,
  .header-notification:not(.brand-notification) {
    display: none !important;
  }

  /* Show the brand-bar bell */

  .brand-notification {
    display: inline-flex !important;
    grid-area: bell;
    margin-left: 0;
    position: relative;
    align-self: center;
  }

  .brand-notification .bell-icon {
    width: 40px;
    height: 40px;
  }

  .brand-notification .bell-badge {
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    font-size: 9.5px;
    padding: 0 4px;
  }

  /* Hamburger: stays on the right */

  .mobile-menu-toggle,
  .sidebar-collapsed .mobile-menu-toggle {
    grid-area: menu;
    display: inline-grid !important;
    position: static;
    margin-left: 0;
  }

  .sidebar .nav,
  .sidebar-collapsed .nav {
    display: none;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    padding: 8px 0 4px;
  }

  .sidebar.mobile-nav-open .nav {
    display: flex;
  }

  .sidebar .nav-group {
    display: grid;
    width: 100%;
    gap: 4px;
  }

  .sidebar .nav-button,
  .sidebar-collapsed .nav-button {
    width: 100%;
    height: 42px;
    padding: 0 44px 0 11px;
    justify-content: flex-start;
  }

  .sidebar .nav-button>span:not(.nav-icon),
  .sidebar-collapsed .nav-button>span:not(.nav-icon) {
    display: inline-flex;
  }

  .sidebar .nav-menu-toggle,
  .sidebar-collapsed .nav-menu-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    display: inline-flex;
    transform: translateY(-50%);
    margin: 0;
  }

  .sidebar .nav-icon,
  .sidebar-collapsed .nav-icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .sidebar .nav-sub,
  .sidebar-collapsed .nav-sub {
    display: none;
    margin: 2px 0 6px 20px;
    padding: 3px 0 3px 14px;
    background: transparent;
    border: 0;
  }

  .sidebar .nav-group.open .nav-sub,
  .sidebar-collapsed .nav-group.open .nav-sub {
    display: grid;
  }

  .sidebar .nav-sub::before,
  .sidebar-collapsed .nav-sub::before {
    display: block;
  }

  .sidebar .nav-child,
  .sidebar-collapsed .nav-child {
    justify-content: flex-start;
    padding-left: 8px;
    padding-right: 8px;
  }

  .sidebar .nav-child>span:not(.nav-icon),
  .sidebar-collapsed .nav-child>span:not(.nav-icon) {
    display: inline-flex;
  }

  .page-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "title title title" "pill . bell";
    align-items: center;
    column-gap: 10px;
    row-gap: 10px;
    padding: 0 0 14px;
    margin: 0 0 18px;
  }

  .page-header .page-title {
    grid-area: title;
    min-width: 0;
  }

  .page-header .pill {
    grid-area: pill;
    justify-self: start;
    margin-left: 0;
  }

  .page-header .header-notification {
    grid-area: bell;
    justify-self: end;
    margin-left: 0;
  }

  .summary-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .doctor-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-dropdown {
    width: 300px;
    right: -10px;
  }

  .doctor-preview-grid {
    grid-template-columns: 1fr;
  }

  .doctor-preview-image {
    max-width: 200px;
    margin: 0 auto;
  }

  .sms-logs-toolbar {
    grid-template-columns: 1fr;
  }

  .sms-logs-toolbar-export {
    justify-content: stretch;
  }

  .sms-logs-toolbar-export .btn {
    width: 100%;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .patients-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .patients-toolbar .field:first-child {
    grid-column: 1/-1;
  }

  .patients-toolbar .btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 820px) {
  :root {
    --content-x: 18px;
  }

  .content {
    padding: 16px var(--content-x) 28px;
    margin-left: 0;
  }

  .tab-panel.active {
    min-height: auto;
  }

  .card,
  #tests .card,
  #tests .search-card,
  .patients-card,
  #reportApp .report-panel,
  #faqApp .faq-card {
    padding: 18px;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .toolbar .btn,
  .toolbar .pill {
    flex: 1 1 auto;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table {
    min-width: 720px;
  }

  .modal-card,
  .modal-wide {
    width: 100%;
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 720px) {
  .page-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "title title title" "pill . bell";
    align-items: center;
    column-gap: 10px;
    row-gap: 10px;
  }

  .page-header .page-title {
    grid-area: title;
    min-width: 0;
  }

  .page-header .pill {
    grid-area: pill;
    justify-self: start;
    margin-left: 0;
  }

  .page-header .header-notification {
    grid-area: bell;
    justify-self: end;
    margin-left: 0;
  }

  .bell-icon {
    width: 38px;
    height: 38px;
  }

  .bell-icon svg {
    width: 20px;
    height: 20px;
  }

  .bell-badge {
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    font-size: 9.5px;
    padding: 0 4px;
  }

  .notification-dropdown {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: 70vh;
  }

  .test-list-toolbar,
  .test-list-form {
    grid-template-columns: 1fr;
  }

  .test-list-card {
    padding: 14px;
  }

  .test-list-form .wide {
    grid-column: auto;
  }

  .test-list-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .test-list-actions .btn {
    width: 100%;
  }

  .notices-form .two-col {
    grid-template-columns: 1fr;
  }

  .notices-toolbar {
    grid-template-columns: 1fr;
  }

  .faq-toolbar {
    grid-template-columns: 1fr;
  }

  .faq-toolbar .btn {
    width: 100%;
  }

  .faq-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #settingsApp .settings-grid,
  #settingsApp .profile-card,
  #settingsApp .profile-controls {
    grid-template-columns: 1fr;
  }

  .schedule-editor {
    padding: 12px;
  }

  .schedule-editor-head {
    display: grid;
  }

  .schedule-remove-btn,
  .schedule-add-slot,
  #addChamberBtn {
    width: 100%;
  }

  .doctor-info-toolbar {
    grid-template-columns: 1fr;
  }

  .doctor-info-toolbar .btn-sm {
    width: 100%;
  }

  .doctor-profile-grid {
    grid-template-columns: 1fr;
  }

  .doctor-profile-card {
    grid-template-columns: 1fr;
  }

  .doctor-day-checks {
    grid-template-columns: 1fr;
  }

  .module-checks {
    grid-template-columns: 1fr;
  }

  .check-line {
    width: 100%;
  }

  .test-list-name {
    max-width: 28ch;
  }

  .sms-templates-grid {
    grid-template-columns: 1fr;
  }

  #settingsApp .profile-summary {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  #settingsApp .account-avatar {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    font-size: 24px;
  }

  #settingsApp .profile-actions {
    grid-template-columns: 1fr;
  }

  .appearance-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .theme-switch {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .dashboard-shell,
  .content,
  .tab-panel,
  .tab-panel.active,
  .page,
  #appointmentApp,
  #complaints .page,
  .grid-two,
  .form-card,
  #appointmentApp .form-card,
  #complaints .form-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .content {
    padding-left: 10px;
    padding-right: 10px;
    overflow-x: hidden;
  }

  .page {
    overflow-x: hidden;
  }

  .grid-two,
  #tests .grid-two {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
  }

  .card,
  .form-card,
  #appointmentApp .form-card,
  #complaints .form-card {
    padding: 14px;
    min-width: 0;
    overflow: visible;
  }

  #appointmentApp .form-card,
  #complaints .form-card {
    display: block;
  }

  .field,
  .search-wrap,
  .doctor-info,
  .warning,
  .two-col,
  .summary-grid,
  .toolbar,
  .card-head {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .two-col {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px;
  }

  .input,
  .select,
  .textarea,
  .btn,
  input,
  select,
  textarea,
  button {
    max-width: 100%;
  }

  .input,
  .select,
  .textarea {
    width: 100%;
    min-width: 0;
  }

  .btn.full,
  #addAppointmentBtn,
  #generateTokenBtn {
    width: 100%;
  }

  .dropdown {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .result-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .doctor-info,
  .warning {
    overflow-wrap: anywhere;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  #tests .test-row {
    grid-template-columns: 30px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    align-items: start;
  }

  #tests .test-row .money {
    grid-column: 2 !important;
    text-align: left !important;
  }

  #tests .test-row .discount-control {
    grid-column: 2 !important;
    display: flex !important;
    justify-content: flex-start !important;
    min-width: 0;
  }

  #tests .test-row .discount-control select {
    min-width: 120px;
    max-width: 160px;
  }

  #tests .test-row .icon-btn {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: start !important;
  }

  .user-admin-card .card-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 10px;
  }

  .user-admin-card .card-head .card-title {
    grid-column: 1/3;
    margin: 0;
  }

  .user-admin-card .card-head #addUserBtn {
    grid-column: 2;
    justify-self: end;
  }

  .user-cell {
    flex-direction: row;
  }

  .user-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 14px;
  }

  .sms-logs-toolbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sms-logs-toolbar-dates {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "from to" "actions actions";
    gap: 10px;
  }

  .sms-logs-toolbar-dates .field:nth-child(1) {
    grid-area: from;
  }

  .sms-logs-toolbar-dates .field:nth-child(2) {
    grid-area: to;
  }

  .sms-logs-toolbar-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .sms-logs-toolbar-actions .btn {
    width: 100%;
  }

  .sms-logs-toolbar-dates .input {
    height: 42px;
    font-size: 14px;
  }

  .sms-logs-toolbar-export .btn {
    height: 42px;
  }

  .faq-list,
  #faqApp .faq-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-visual {
    padding: 28px 20px;
  }

  .login-visual h1 {
    font-size: 26px;
  }

  .login-heading {
    flex-wrap: wrap;
    gap: 12px;
  }

  .login-heading h2 {
    font-size: 24px;
  }

  .login-card-logo {
    width: 44px;
    height: 44px;
  }

  .login-panel {
    padding: 24px 18px 32px;
  }

  .content {
    padding: 14px 10px 24px;
  }

  .card,
  #tests .card,
  #tests .search-card,
  .patients-card,
  #reportApp .report-panel,
  #faqApp .faq-card {
    padding: 14px;
  }

  .input,
  .select,
  .btn {
    height: 42px;
  }

  .page-title h2,
  .page-title h3 {
    font-size: 22px;
  }

  .pill {
    white-space: normal;
  }

  #tests .test-row {
    grid-template-columns: 28px minmax(0, 1fr) 34px;
    gap: 10px;
    padding: 12px;
  }

  #tests .test-row .money,
  #tests .test-row .discount-control {
    grid-column: 2/4;
    justify-content: flex-start;
    text-align: left;
  }

  .discount-control {
    flex-wrap: wrap;
  }

  .patients-toolbar {
    grid-template-columns: 1fr;
  }

  .patients-toolbar .field:nth-child(2) {
    grid-column: auto;
  }

  #settingsApp .profile-card {
    padding: 18px !important;
  }

  #settingsApp .profile-summary {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
  }

  #settingsApp .account-avatar {
    width: 72px !important;
    height: 72px !important;
    border-radius: 18px !important;
    font-size: 28px !important;
  }

  #settingsApp .profile-actions {
    grid-template-columns: 1fr;
  }

  #settingsApp .profile-actions .btn {
    width: 100%;
  }

  .modal-layer {
    padding: 12px;
  }

  .modal-card {
    padding: 18px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .overview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .overview-row {
    grid-template-columns: 36px minmax(0, 1fr) auto 20px;
    gap: 10px;
    padding: 18px 14px;
    min-height: 68px;
  }

  .overview-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }

  .overview-row-icon svg {
    width: 16px;
    height: 16px;
  }

  .overview-row-value {
    font-size: 20px;
  }
}

@media (max-width: 420px) {
  .bell-icon {
    width: 34px;
    height: 34px;
  }

  .bell-icon svg {
    width: 18px;
    height: 18px;
  }

  .notification-dropdown {
    top: 58px;
    left: 8px;
    right: 8px;
  }

  .notification-item {
    padding: 10px 12px;
    font-size: 12.5px;
  }

  #settingsApp .profile-summary {
    grid-template-columns: 1fr !important;
    text-align: center !important;
    justify-items: center !important;
  }

  #settingsApp .profile-summary h3,
  #settingsApp .profile-summary p {
    text-align: center !important;
  }

  #settingsApp .profile-actions {
    grid-template-columns: 1fr !important;
  }

  .user-admin-card .card-head {
    grid-template-columns: 1fr !important;
  }

  .user-admin-card .card-head .pill {
    justify-self: start !important;
  }
}

/* =====================================================================
   GLOBAL PRINT HEADER / FOOTER
   ===================================================================== */

.print-header-global,
.print-footer-global,
.appointment-print-head,
.appointment-print-summary {
  display: none;
}

@media print {
  /* --- Global header (every printed page) --- */

  .print-header-global {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0 0 8px;
    border-bottom: 1px solid #111;
    background: #fff;
    z-index: 1000;
  }

  .print-header-global h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
    color: #111;
    text-align: center;
    letter-spacing: .01em;
  }

  .print-header-global p {
    margin: 2px 0 0;
    font-size: 10.5px;
    color: #333;
    text-align: center;
    line-height: 1.35;
  }

  .print-header-global p:empty {
    display: none;
  }

  /* --- Global footer (every printed page) --- */

  .print-footer-global {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 0 0;
    background: #fff;
    z-index: 1000;
  }

  .print-footer-global .print-footer-rule {
    border-top: 1px solid #111;
    margin-bottom: 5px;
  }

  .print-footer-global .print-footer-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 10.5px;
    color: #111;
  }

  .print-footer-global .print-footer-meta strong {
    font-weight: 900;
  }

  /* Reserve space so content never collides with header/footer */

  .content {
    padding-top: 26mm !important;
    padding-bottom: 16mm !important;
  }

  /* --- Appointment-specific header --- */

  #appointments.active .appointment-print-head,
  #appointments.active .appointment-print-summary {
    display: block !important;
  }

  .appointment-print-head {
    text-align: center;
    margin: 0 0 10px;
    padding: 0 0 8px;
    border-bottom: 1px solid #111;
  }

  .appointment-print-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    color: #111;
    text-align: center;
  }

  .appointment-print-head p {
    margin: 4px 0 0;
    font-size: 11px;
    color: #444;
    text-align: center;
  }

  .appointment-print-summary {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    margin: 10px 0 12px;
    border: 1px solid #111;
  }

  .appointment-print-summary .aps-cell {
    padding: 7px 12px;
    font-size: 11px;
    color: #111;
    border-right: 1px solid #111;
  }

  .appointment-print-summary .aps-cell:last-child {
    border-right: 0;
  }

  .appointment-print-summary .aps-cell span {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
    margin-right: 6px;
  }

  .appointment-print-summary .aps-cell strong {
    font-weight: 900;
  }

  /* Hide screen-only title/summary in the appointment module */

  #appointments.active #appointmentTitle,
  #appointments.active .summary-grid.no-print {
    display: none !important;
  }
}

/* ============================================================
   GENERIC LIST TOOLBAR (mirrors .sms-logs-toolbar)
   ============================================================ */
.list-toolbar{
  display:grid;
  grid-template-columns:1fr auto;
  gap:14px;
  align-items:end;
  margin-bottom:16px;
}
.list-toolbar-fields{
  display:grid;
  gap:12px;
  align-items:end;
  min-width:0;
}
.list-toolbar-fields .field{ margin:0; min-width:0; }
.list-toolbar-fields .input,
.list-toolbar-fields .select{ height:40px; width:100%; }
.list-toolbar-actions{
  display:flex;
  gap:8px;
  align-items:center;
  white-space:nowrap;
}
.list-toolbar-export{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
}

.patients-toolbar-grid{
  grid-template-columns:minmax(220px,1fr) 160px 170px auto;
}
.complaint-history-toolbar-grid{
  grid-template-columns:minmax(220px,1fr) 140px 140px 160px auto;
}

@media (max-width:1180px){
  .patients-toolbar-grid{ grid-template-columns:1fr 1fr; }
  .patients-toolbar-grid .list-toolbar-actions{
    grid-column:1 / -1;
    display:grid; grid-template-columns:1fr 1fr; gap:8px;
  }
  .complaint-history-toolbar-grid{ grid-template-columns:1fr 1fr 1fr; }
  .complaint-history-toolbar-grid .list-toolbar-actions{
    grid-column:1 / -1;
    display:grid; grid-template-columns:1fr 1fr; gap:8px;
  }
}
@media (max-width:720px){
  .list-toolbar{ grid-template-columns:1fr; }
  .patients-toolbar-grid,
  .complaint-history-toolbar-grid{ grid-template-columns:1fr; }
  .patients-toolbar-grid .list-toolbar-actions,
  .complaint-history-toolbar-grid .list-toolbar-actions{
    grid-column:auto;
    display:grid; grid-template-columns:1fr 1fr;
  }
  .list-toolbar-export{ justify-content:stretch; }
  .list-toolbar-export .btn{ width:100%; }
}