/**
 * Safe Health Clinic ? Dashboard Styles
 * Primary: #0F766E | Fonts: Inter (en), Rabar_038 (ku), Tajawal (ar)
 */

@font-face {
    font-family: "Rabar_038";
    src: url("../fonts/Rabar_038.ttf") format("truetype");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #0F766E;
    --primary-dark: #0D5F58;
    --primary-light: #14B8A6;
    --primary-soft: rgba(15, 118, 110, 0.12);
    --primary-glow: rgba(15, 118, 110, 0.25);

    --slate-50: #F8FAFC;
    --slate-100: #F1F5F9;
    --slate-200: #E2E8F0;
    --slate-300: #CBD5E1;
    --slate-400: #94A3B8;
    --slate-500: #64748B;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1E293B;
    --slate-900: #0F172A;

    --bg-body: linear-gradient(135deg, #EEF2F7 0%, #E8EEF4 50%, #E2EBF2 100%);
    --bg-card: #FFFFFF;
    --bg-sidebar: #0F172A;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg-sidebar-active: rgba(15, 118, 110, 0.22);
    --text-primary: var(--slate-800);
    --text-secondary: var(--slate-500);
    --text-muted: var(--slate-400);
    --border-color: var(--slate-200);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --sidebar-width: 270px;
    --topbar-height: 76px;
    /* Language fonts: Kurdish (Rabar / Ubuntu Arabic), Arabic (Tajawal), English (Inter) */
    --font-en: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-ku: "Rabar_038", "Ubuntu Arabic", "Noto Sans Arabic", sans-serif;
    --font-ar: "Tajawal", "Noto Sans Arabic", "Segoe UI", sans-serif;
    --font-sans: var(--font-en);
    --font-display: var(--font-sans);
    --font-ui: var(--font-en);
    --transition: 0.2s ease;
}

html[lang="en"],
body.lang-en {
    --font-ui: var(--font-en);
    --font-sans: var(--font-en);
    --font-display: var(--font-en);
}

html[lang="ku"],
body.lang-ku {
    --font-ui: var(--font-ku);
    --font-sans: var(--font-ku);
    --font-display: var(--font-ku);
}

html[lang="ar"],
body.lang-ar {
    --font-ui: var(--font-ar);
    --font-sans: var(--font-ar);
    --font-display: var(--font-ar);
}

.theme-dark {
    --bg-body: linear-gradient(135deg, #0B1220 0%, #111827 50%, #0F172A 100%);
    --bg-card: #1E293B;
    --bg-sidebar: #0B1220;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
    --bg-sidebar-active: rgba(20, 184, 166, 0.18);
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ?????? Base ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.app-body {
    font-family: var(--font-ui);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.page-title,
.card-title,
.auth-brand__title,
.auth-card__title {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

::selection {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* ?????? Bootstrap overrides ???????????????????????????????????????????????????????????????????????????????????????????????? */

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-focus-shadow-rgb: 15, 118, 110;
}

.btn-danger {
    --bs-btn-bg: #dc2626;
    --bs-btn-border-color: #dc2626;
    --bs-btn-hover-bg: #b91c1c;
    --bs-btn-hover-border-color: #b91c1c;
    --bs-btn-active-bg: #991b1b;
    --bs-btn-active-border-color: #991b1b;
    --bs-btn-focus-shadow-rgb: 220, 38, 38;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.22);
}

.btn-danger:hover,
.btn-danger:focus {
    box-shadow: 0 6px 18px rgba(185, 28, 28, 0.28);
}

.btn-lg {
    min-height: 3rem;
    padding: 0.65rem 1.35rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 0.7rem;
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-focus-shadow-rgb: 15, 118, 110;
}

.text-primary {
    color: var(--primary) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem var(--primary-soft);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.breadcrumb-item a {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
}

.theme-dark .form-control,
.theme-dark .form-select,
.theme-dark .input-group-text {
    background-color: var(--slate-800);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.theme-dark .dropdown-menu {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.theme-dark .dropdown-item {
    color: var(--text-primary);
}

.theme-dark .dropdown-item:hover {
    background-color: var(--slate-800);
}

.theme-dark .modal-content {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.theme-dark .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ?????? App shell ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

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

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

body.no-sidebar .app-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    margin-inline-end: 0.85rem;
    flex-shrink: 0;
}
.topbar-brand:hover { color: var(--primary); }
.topbar-brand__logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 0.75rem;
    overflow: hidden;
    flex-shrink: 0;
    background: #0f766e;
}
.topbar-brand__logo-wrap--custom {
    width: 76px;
    height: 76px;
    background: transparent;
    border: 0;
}
.topbar-brand__logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 32%;
    transform: scale(1.55);
    transform-origin: center;
}
.topbar-brand__logo-wrap--custom .topbar-brand__logo {
    object-fit: cover;
    object-position: center;
    transform: scale(1.35);
    padding: 0;
}
.topbar-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.topbar-brand__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 1.15rem;
}
.topbar-brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
    color: #0f766e;
}
.theme-dark .topbar-brand__name { color: #2dd4bf; }
.topbar-brand__tagline { font-size: 0.78rem; color: var(--text-secondary); }

.app-sidebar,
.sidebar-backdrop,
#sidebarToggle,
#sidebarClose {
    display: none !important;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

.app-footer {
    padding: 1rem 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
}

.theme-dark .app-footer {
    background: rgba(15, 23, 42, 0.5);
}

/* ?????? Sidebar ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: #CBD5E1;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #F8FAFC;
    text-decoration: none;
}

.sidebar-brand__link:hover {
    color: #FFFFFF;
}

.sidebar-brand__icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    color: #FFFFFF;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.sidebar-brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1.2;
}

.sidebar-brand__tagline {
    font-size: 0.6875rem;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 1.25rem;
    padding: 0.25rem;
    cursor: pointer;
    line-height: 1;
}

.sidebar-close:hover {
    color: #FFFFFF;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-section__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748B;
    padding: 0.75rem 0.75rem 0.375rem;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-sm);
    color: #CBD5E1;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.sidebar-menu__link:hover {
    background: var(--bg-sidebar-hover);
    color: #FFFFFF;
}

.sidebar-menu__link.is-active {
    background: var(--bg-sidebar-active);
    color: #FFFFFF;
    box-shadow: inset 3px 0 0 var(--primary-light);
}

.sidebar-menu__icon {
    width: 1.125rem;
    text-align: center;
    font-size: 0.9375rem;
    opacity: 0.85;
}

.sidebar-menu__link.is-active .sidebar-menu__icon {
    color: var(--primary-light);
    opacity: 1;
}

.sidebar-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    color: #64748B;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

body.sidebar-open .app-sidebar {
    transform: translateX(0);
}

/* ?????? Topbar ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 118px;
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.85rem 1.75rem 2.35rem;
    width: 100%;
    min-height: 96px;
    position: relative;
    z-index: 2;
}

.theme-dark .app-topbar {
    background: rgba(30, 41, 59, 0.92);
}

/* Animated ECG pulse strip (inspired by medical banner) */
/* ECG strip ??? always LTR so language/RTL never restarts or reverses the animation */
.topbar-pulse {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    pointer-events: none;
    overflow: hidden;
    opacity: 1;
    z-index: 1;
    direction: ltr !important;
    background: linear-gradient(180deg, transparent 0%, rgba(20, 184, 166, 0.06) 100%);
}

.topbar-pulse__track {
    width: 200%;
    height: 100%;
    display: flex;
    flex-direction: row;
    direction: ltr !important;
    /* Wave moves left ??? right (same for en / ku / ar) */
    animation: ecgScroll 18s linear infinite;
    will-change: transform;
}

.topbar-pulse__svg {
    width: 50%;
    height: 100%;
    flex-shrink: 0;
    display: block;
}

.topbar-pulse__path {
    fill: none;
    stroke: #14B8A6;
    stroke-width: 2.2;
    stroke-linecap: square;
    stroke-linejoin: miter;
    filter: drop-shadow(0 0 3px rgba(20, 184, 166, 0.35));
}

.theme-dark .topbar-pulse__path {
    stroke: #2DD4BF;
    filter: drop-shadow(0 0 4px rgba(45, 212, 191, 0.5));
}

@keyframes ecgScroll {
    from { transform: translate3d(-50%, 0, 0); }
    to { transform: translate3d(0, 0, 0); }
}

/* Keep identical direction in RTL pages */
html[dir="rtl"] .topbar-pulse,
html[dir="rtl"] .topbar-pulse__track {
    direction: ltr !important;
    animation-name: ecgScroll;
}

@media (prefers-reduced-motion: reduce) {
    .topbar-pulse__track { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
    .topbar-pulse__track { animation: none; }
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.topbar-search {
    position: relative;
    width: min(420px, 40vw);
    margin-inline-end: auto;
}

.topbar-search__icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

/* English: icon on the right, text on the left */
body.lang-en .topbar-search__icon {
    left: auto;
    right: 0.875rem;
}

.topbar-search__input {
    padding-left: 2.5rem;
    padding-right: 1rem;
    border-radius: 999px;
    border-color: var(--border-color);
    background: var(--slate-50);
    font-size: 0.875rem;
}

body.lang-en .topbar-search__input {
    padding-left: 1rem;
    padding-right: 2.5rem;
    direction: ltr;
    text-align: left;
}

/* Kurdish / Arabic: icon on the left, text + placeholder on the right */
body.lang-ku .topbar-search__icon,
body.lang-ar .topbar-search__icon {
    left: 0.875rem;
    right: auto;
}

body.lang-ku .topbar-search__input,
body.lang-ar .topbar-search__input {
    padding-left: 2.5rem;
    padding-right: 1rem;
    direction: rtl;
    text-align: right;
}

.theme-dark .topbar-search__input {
    background: var(--slate-800);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--slate-100);
    color: var(--text-primary);
}

.theme-dark .btn-ghost:hover {
    background: var(--slate-800);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notification-dropdown {
    width: min(360px, calc(100vw - 1.5rem));
    padding: 0;
    overflow: hidden;
}

.notification-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.notification-dropdown__header strong {
    font-size: 0.875rem;
}

.notification-dropdown__header .btn-link {
    font-size: 0.75rem;
    text-decoration: none;
    white-space: nowrap;
}

.notification-dropdown__list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-empty {
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.notification-item {
    display: flex !important;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem !important;
    white-space: normal;
    border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.is-unread {
    background: color-mix(in srgb, #F59E0B 8%, transparent);
}

.theme-dark .notification-item.is-unread {
    background: color-mix(in srgb, #F59E0B 14%, transparent);
}

.notification-item__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--slate-100);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-item__icon--warning {
    background: color-mix(in srgb, #F59E0B 18%, transparent);
    color: #B45309;
}

.notification-item__icon--danger {
    background: color-mix(in srgb, #EF4444 16%, transparent);
    color: #DC2626;
}

.notification-item__icon--info {
    background: color-mix(in srgb, #3B82F6 16%, transparent);
    color: #2563EB;
}

.theme-dark .notification-item__icon {
    background: var(--slate-800);
}

.theme-dark .notification-item__icon--warning {
    background: color-mix(in srgb, #F59E0B 22%, transparent);
    color: #FBBF24;
}

.theme-dark .notification-item__icon--danger {
    background: color-mix(in srgb, #EF4444 22%, transparent);
    color: #F87171;
}

.notification-item__body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.notification-item__body strong {
    font-size: 0.8125rem;
}

.notification-item__body span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.notification-item__body small {
    color: var(--text-muted);
    font-size: 0.6875rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.625rem 0.375rem 0.375rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-primary);
    pointer-events: none;
}

.topbar-logout {
    color: var(--text-secondary);
}

.topbar-logout:hover {
    color: #b91c1c;
    background: rgba(185, 28, 28, 0.08);
}

.topbar-user__avatar,
.topbar-user__initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.topbar-user__avatar {
    object-fit: cover;
}

.topbar-user__initials {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
}

.topbar-user__info {
    text-align: left;
    line-height: 1.25;
}

.topbar-user__name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
}

.topbar-user__role {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.topbar-user__chevron {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* ?? Page header & section bar ????????????????????????? */

.app-breadcrumb {
    margin-bottom: 1rem;
}

.app-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    font-size: 0.8125rem;
}

.section-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(15, 118, 110, 0.12);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.theme-dark .section-bar {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(30, 41, 59, 0.9));
    border-color: rgba(148, 163, 184, 0.16);
}
.section-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0f766e;
    background: rgba(15, 118, 110, 0.1);
    border: 1px solid rgba(15, 118, 110, 0.16);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    flex-shrink: 0;
}
.section-back:hover {
    background: rgba(15, 118, 110, 0.16);
    color: #0f766e;
    transform: translateX(-2px);
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.12);
}
.section-bar__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.section-bar__actions {
    margin-inline-start: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.section-bar__actions .dash-hero-btn {
    min-height: 2.55rem;
    padding: 0.35rem 1rem 0.35rem 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.35;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    white-space: nowrap;
}

.section-bar__actions .dash-hero-btn__icon {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.8rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.section-bar__actions .dash-hero-btn__icon i {
    margin: 0 !important;
    line-height: 1;
}

.section-bar__actions .dash-hero-btn__label {
    padding-inline: 0.1rem 0.2rem;
    line-height: 1.4;
    font-weight: 600;
}

.section-bar__actions .dash-hero-btn--danger {
    --hero-btn-bg: rgba(255, 255, 255, 0.85);
    --hero-btn-color: #b91c1c;
    --hero-btn-border: rgba(185, 28, 28, 0.28);
}

.section-bar__actions .dash-hero-btn--danger .dash-hero-btn__icon {
    background: rgba(185, 28, 28, 0.1);
}

.section-bar__actions .dash-hero-btn--danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.2);
}

.section-bar__actions .dash-hero-btn--danger:hover .dash-hero-btn__icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

body.lang-ku .section-bar__actions .dash-hero-btn,
body.lang-ar .section-bar__actions .dash-hero-btn {
    direction: rtl;
    flex-direction: row;
    padding: 0.4rem 0.4rem 0.4rem 1.05rem;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.55;
}

body.lang-ku .section-bar__actions .dash-hero-btn__label,
body.lang-ar .section-bar__actions .dash-hero-btn__label {
    line-height: 1.55;
    padding-inline: 0.15rem 0.05rem;
}

body.lang-ku .dash-hero-btn,
body.lang-ar .dash-hero-btn {
    direction: rtl;
    flex-direction: row;
    padding: 0.4rem 0.4rem 0.4rem 1.05rem;
    letter-spacing: 0;
    font-weight: 600;
    line-height: 1.55;
}

body.lang-ku .dash-hero-btn__label,
body.lang-ar .dash-hero-btn__label {
    line-height: 1.55;
    padding-inline: 0.15rem 0.05rem;
}
.section-bar__actions:empty {
    display: none;
}

body.lang-ku .section-bar,
body.lang-ar .section-bar {
    direction: rtl;
}

body.lang-ku .section-back,
body.lang-ar .section-back {
    flex-direction: row;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.5;
}

body.lang-ku .section-bar__title,
body.lang-ar .section-bar__title {
    letter-spacing: 0;
    line-height: 1.45;
    font-weight: 700;
}

body.lang-ku .section-back i,
body.lang-ar .section-back i {
    transform: scaleX(-1);
}

body.lang-ku .section-back:hover,
body.lang-ar .section-back:hover {
    transform: translateX(2px);
}

body.lang-en .section-bar {
    direction: ltr;
}

body.lang-en .section-back:hover {
    transform: translateX(-2px);
}

.page-header {
    margin-bottom: 1.5rem;
}
.app-content > .page-header {
    /* Actions are moved into .section-bar; hide leftover empty shells */
    display: none !important;
}

.page-title {
    font-size: 1.625rem;
    margin: 0;
    color: var(--text-primary);
}

/* ?????? Cards ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.app-card,
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.app-card .card-header,
.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.card-header--collapse {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: inherit;
    text-align: start;
    cursor: pointer;
}

.card-header--collapse.collapsed {
    border-bottom-color: transparent;
}

.card-header--collapse:hover {
    background: rgba(15, 23, 42, 0.03);
}

.card-header--collapse:focus-visible {
    outline: 2px solid var(--primary, #0d6efd);
    outline-offset: -2px;
}

.card-header__chevron {
    flex: 0 0 auto;
    font-size: 0.85rem;
    opacity: 0.55;
    transition: transform 0.2s ease;
}

.card-header--collapse:not(.collapsed) .card-header__chevron {
    transform: rotate(180deg);
}

/* EN: title on left, chevron on right */
body.lang-en .card-header--collapse {
    flex-direction: row;
}

.app-card .card-body,
.card .card-body {
    padding: 1.25rem;
}

.stat-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-card__value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card__label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ?????? Tables ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.table-responsive {
    border-radius: var(--radius-md);
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--slate-50);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom-width: 1px;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.theme-dark .table thead th {
    background: var(--slate-800);
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

/* Blank cells show an em dash so empty values are visible */
.table tbody td:empty::before {
    content: "—";
    color: var(--text-secondary, #64748b);
}

.report-totals-row {
    background: var(--slate-50, #f8fafc);
    border-top: 2px solid var(--border-color, #e2e8f0);
}

.report-totals-row > td {
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
    vertical-align: middle;
}

.report-totals-row__label {
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary, #64748b);
}

.report-totals-row__cap {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.report-totals-row__val {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
}

.report-totals-row__val--doctor {
    color: var(--bs-success, #198754);
}

.report-totals-row__muted {
    color: var(--text-secondary, #64748b);
    text-align: center;
}

.report-chart-card__hint {
    font-size: 0.8125rem;
    font-weight: 500;
}

.report-chart-card__body {
    padding-top: 0.75rem;
}

.report-chart-card__canvas-wrap {
    position: relative;
    height: min(360px, 55vh);
    width: 100%;
}

.invoice-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(15, 118, 110, 0.28);
    border-radius: 0.7rem;
    background: rgba(15, 118, 110, 0.08);
    color: #0F766E;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.invoice-add-btn i {
    font-size: 0.72rem;
    pointer-events: none;
}

.invoice-add-btn:hover {
    background: #0F766E;
    border-color: #0F766E;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.28);
}

.invoice-add-btn:active {
    transform: translateY(0);
}

.btn-receipt {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 0.7rem;
    background: rgba(37, 99, 235, 0.08);
    color: #1D4ED8;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-receipt i {
    font-size: 0.78rem;
    pointer-events: none;
}

.btn-receipt:hover {
    background: #2563EB;
    border-color: #2563EB;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
}

.btn-receipt:active {
    transform: translateY(0);
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(37, 211, 102, 0.35);
    background: rgba(37, 211, 102, 0.12);
    color: #128C7E;
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}

.theme-dark .btn-whatsapp {
    background: rgba(37, 211, 102, 0.16);
    border-color: rgba(37, 211, 102, 0.4);
    color: #6EE7B7;
}

.theme-dark .btn-whatsapp:hover,
.theme-dark .btn-whatsapp:focus {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}

.theme-dark .btn-receipt {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.35);
    color: #93C5FD;
}

.theme-dark .btn-receipt:hover {
    background: #3B82F6;
    border-color: #3B82F6;
    color: #fff;
}

body.lang-ku .btn-receipt,
body.lang-ar .btn-receipt {
    flex-direction: row;
}

.invoice-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border: 1px solid rgba(220, 38, 38, 0.28);
    border-radius: 0.7rem;
    background: #fee2e2;
    color: #dc2626;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.invoice-remove-btn i {
    font-size: 0.78rem;
    pointer-events: none;
}

.invoice-remove-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.28);
}

.invoice-remove-btn:active {
    transform: translateY(0);
}

.invoice-items-table__actions {
    width: 3.25rem;
    text-align: center;
    vertical-align: middle;
}

.theme-dark .invoice-add-btn {
    background: rgba(15, 118, 110, 0.18);
    border-color: rgba(45, 212, 191, 0.35);
    color: #5eead4;
}

.theme-dark .invoice-add-btn:hover {
    background: #0F766E;
    border-color: #0F766E;
    color: #fff;
}

.theme-dark .invoice-remove-btn {
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

.theme-dark .invoice-remove-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

/* KU/AR: invoice date sits under the visit field */
body.lang-ku .invoice-header-fields,
body.lang-ar .invoice-header-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    direction: ltr;
}

body.lang-ku .invoice-header-fields > [class*="col-"],
body.lang-ar .invoice-header-fields > [class*="col-"] {
    width: 100%;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    direction: rtl;
}

body.lang-ku .invoice-f-patient,
body.lang-ar .invoice-f-patient {
    grid-column: 1;
    grid-row: 1;
}

body.lang-ku .invoice-f-visit,
body.lang-ar .invoice-f-visit {
    grid-column: 2;
    grid-row: 1;
}

body.lang-ku .invoice-f-date,
body.lang-ar .invoice-f-date {
    grid-column: 2;
    grid-row: 2;
}

body.lang-ku .invoice-f-notes,
body.lang-ar .invoice-f-notes {
    grid-column: 1 / -1;
    grid-row: 3;
}

@media (max-width: 767.98px) {
    body.lang-ku .invoice-header-fields,
    body.lang-ar .invoice-header-fields {
        grid-template-columns: 1fr;
    }

    body.lang-ku .invoice-f-patient,
    body.lang-ar .invoice-f-patient,
    body.lang-ku .invoice-f-visit,
    body.lang-ar .invoice-f-visit,
    body.lang-ku .invoice-f-date,
    body.lang-ar .invoice-f-date,
    body.lang-ku .invoice-f-notes,
    body.lang-ar .invoice-f-notes {
        grid-column: 1;
        grid-row: auto;
    }
}

/* EN: invoice header/items on the left, totals on the right */
body.lang-en .invoice-form-layout > .invoice-form-main {
    order: 1;
}

body.lang-en .invoice-form-layout > .invoice-form-side {
    order: 2;
}

/* EN: backup history on the left, create backup on the right */
body.lang-en .backup-layout > .backup-history {
    order: 1;
}

body.lang-en .backup-layout > .backup-create {
    order: 2;
}

/* EN: settings main form on the left, logo/save on the right */
body.lang-en .settings-form-layout > .settings-form-main {
    order: 1;
}

body.lang-en .settings-form-layout > .settings-form-side {
    order: 2;
}

/* KU/AR: dollar rate on the right */
body.lang-ku .settings-billing-fields,
body.lang-ar .settings-billing-fields {
    display: flex;
    flex-wrap: wrap;
}

body.lang-ku .settings-billing-fields > .settings-f-rate,
body.lang-ar .settings-billing-fields > .settings-f-rate {
    margin-left: auto;
}

/* EN: profile info on the left, photo/meta on the right */
body.lang-en .profile-form-layout > .profile-form-main {
    order: 1;
}

body.lang-en .profile-form-layout > .profile-form-side {
    order: 2;
}

/* EN: First Name | Last Name, Phone under First Name */
body.lang-en .profile-info-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

body.lang-en .profile-info-fields > [class*="col-"] {
    width: 100%;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

body.lang-en .profile-info-fields > .profile-f-first {
    grid-column: 1;
    grid-row: 1;
    order: unset;
}

body.lang-en .profile-info-fields > .profile-f-last {
    grid-column: 2;
    grid-row: 1;
    order: unset;
}

body.lang-en .profile-info-fields > .profile-f-phone {
    grid-column: 1;
    grid-row: 2;
    order: unset;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media (max-width: 767.98px) {
    body.lang-en .profile-info-fields {
        grid-template-columns: 1fr;
    }

    body.lang-en .profile-info-fields > .profile-f-first,
    body.lang-en .profile-info-fields > .profile-f-last,
    body.lang-en .profile-info-fields > .profile-f-phone {
        grid-column: 1;
        grid-row: auto;
    }
}

/* KU/AR: user meta sidebar on the left, edit form on the right */
body.lang-ku .user-form-layout,
body.lang-ar .user-form-layout {
    direction: ltr;
    flex-direction: row-reverse;
}

body.lang-ku .user-form-layout > [class*="col-"],
body.lang-ar .user-form-layout > [class*="col-"] {
    direction: rtl;
}

/* KU/AR: swap each user form field pair within the row */
body.lang-ku .user-account-fields,
body.lang-ar .user-account-fields {
    display: flex;
    flex-wrap: wrap;
    direction: ltr;
}

body.lang-ku .user-account-fields > [class*="col-"],
body.lang-ar .user-account-fields > [class*="col-"] {
    direction: rtl;
}

body.lang-ku .user-account-fields > .user-f-last,
body.lang-ar .user-account-fields > .user-f-last { order: 1; }
body.lang-ku .user-account-fields > .user-f-first,
body.lang-ar .user-account-fields > .user-f-first { order: 2; }
body.lang-ku .user-account-fields > .user-f-phone,
body.lang-ar .user-account-fields > .user-f-phone { order: 3; }
body.lang-ku .user-account-fields > .user-f-username,
body.lang-ar .user-account-fields > .user-f-username { order: 4; }
body.lang-ku .user-account-fields > .user-f-status,
body.lang-ar .user-account-fields > .user-f-status { order: 5; }
body.lang-ku .user-account-fields > .user-f-role,
body.lang-ar .user-account-fields > .user-f-role { order: 6; }
body.lang-ku .user-account-fields > .user-f-doctors,
body.lang-ar .user-account-fields > .user-f-doctors { order: 7; }
body.lang-ku .user-account-fields > .user-f-pw-hint,
body.lang-ar .user-account-fields > .user-f-pw-hint { order: 8; }
body.lang-ku .user-account-fields > .user-f-confirm,
body.lang-ar .user-account-fields > .user-f-confirm { order: 9; }
body.lang-ku .user-account-fields > .user-f-password,
body.lang-ar .user-account-fields > .user-f-password { order: 10; }

/* KU/AR: avatar then name, centered as a fixed block so rows align */
body.lang-ku .col-user,
body.lang-ar .col-user {
    text-align: center;
}

body.lang-ku .user-table-person,
body.lang-ar .user-table-person {
    display: inline-flex;
    direction: ltr;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    width: 10.5rem;
    max-width: 100%;
    margin-inline: auto;
    text-align: left;
    vertical-align: middle;
    box-sizing: border-box;
}

body.lang-ku .user-table-person__avatar,
body.lang-ar .user-table-person__avatar {
    flex: 0 0 32px;
}

body.lang-ku .user-table-person__name,
body.lang-ar .user-table-person__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    direction: rtl;
    unicode-bidi: isolate;
}

.table tbody tr:hover {
    background: var(--slate-50);
}

.theme-dark .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.table-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.table-toolbar > .d-flex {
    display: flex;
    flex-wrap: nowrap !important;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: visible;
}

.table-toolbar > .form-select,
.table-toolbar > .btn,
.table-toolbar > .form-control,
.table-toolbar > .d-flex > .form-select,
.table-toolbar > .d-flex > .form-control,
.table-toolbar > .d-flex > .btn {
    flex-shrink: 0;
}

.table-toolbar .btn-outline-primary {
    white-space: nowrap;
}

.table-toolbar .toolbar-filter-btn,
.table-toolbar button.dash-hero-btn {
    flex-shrink: 0;
    cursor: pointer;
    white-space: nowrap;
    font: inherit;
}

.table-toolbar .toolbar-filter-btn:hover {
    color: var(--primary, #0f766e);
}

.table-search {
    max-width: 280px;
    flex: 0 1 280px;
    min-width: 140px;
}

.table-toolbar .toolbar-select {
    flex: 0 1 auto;
    width: auto;
    min-width: 10rem;
}

.table-toolbar .toolbar-select--role {
    min-width: 11.5rem;
    max-width: 16rem;
}

.table-toolbar .toolbar-select--status {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex: 0 0 180px;
}

.table-toolbar > .d-flex > .toolbar-select--status {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex: 0 0 180px;
}

.table-toolbar select.form-select[name="status"] {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex: 0 0 180px;
}

.table-toolbar select.form-select[name="doctor_id"] {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
    flex: 0 0 180px;
}

body.lang-ku .table-toolbar,
body.lang-ar .table-toolbar {
    direction: rtl;
}

body.lang-ku .table-toolbar > .d-flex,
body.lang-ar .table-toolbar > .d-flex {
    direction: rtl;
}

body.lang-ku .table-toolbar .table-search,
body.lang-ar .table-toolbar .table-search {
    direction: ltr;
    flex-direction: row;
}

body.lang-ku .table-toolbar .table-search .form-control,
body.lang-ar .table-toolbar .table-search .form-control {
    text-align: right;
    direction: rtl;
}

body.lang-ku .table-toolbar .table-search .input-group-text,
body.lang-ar .table-toolbar .table-search .input-group-text {
    order: 0;
}

body.lang-ku .table-toolbar .table-search .form-control,
body.lang-ar .table-toolbar .table-search .form-control {
    order: 1;
}

body.lang-ku .table-toolbar .form-select,
body.lang-ar .table-toolbar .form-select,
body.lang-ku .table-toolbar .form-control:not(.table-search .form-control),
body.lang-ar .table-toolbar .form-control:not(.table-search .form-control) {
    text-align: right;
    direction: rtl;
}

body.lang-ku .table-toolbar .toolbar-filter-btn,
body.lang-ar .table-toolbar .toolbar-filter-btn,
body.lang-ku .table-toolbar button.dash-hero-btn,
body.lang-ar .table-toolbar button.dash-hero-btn {
    flex-direction: row-reverse;
}

body.lang-ku .table-toolbar .text-muted,
body.lang-ar .table-toolbar .text-muted,
body.lang-ku .table-toolbar .btn-link,
body.lang-ar .table-toolbar .btn-link {
    text-align: right;
}

.pager-info {
    display: inline-block;
}

body.lang-ku .pager-info,
body.lang-ar .pager-info {
    direction: rtl;
    unicode-bidi: isolate;
    text-align: right;
}

body.lang-ku .d-flex.justify-content-between:has(> .pager-info),
body.lang-ar .d-flex.justify-content-between:has(> .pager-info) {
    flex-direction: row-reverse;
}

/* Inventory stock alerts */
.inventory-alert-row {
    --bs-gutter-x: 1rem;
}

body.lang-ku .inventory-alert-row,
body.lang-ar .inventory-alert-row {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.inventory-alert {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    height: 100%;
    min-height: 5.75rem;
    padding: 1rem 1.15rem;
    border-radius: 1rem;
    text-decoration: none;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.inventory-alert:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    text-decoration: none;
}

.inventory-alert--warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: rgba(217, 119, 6, 0.28);
    color: #92400e;
}

.inventory-alert--danger {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-color: rgba(220, 38, 38, 0.28);
    color: #991b1b;
}

.inventory-alert__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    flex-shrink: 0;
    font-size: 1.15rem;
    color: #fff;
}

.inventory-alert--warning .inventory-alert__icon {
    background: #d97706;
    box-shadow: 0 8px 16px rgba(217, 119, 6, 0.28);
}

.inventory-alert--danger .inventory-alert__icon {
    background: #dc2626;
    box-shadow: 0 8px 16px rgba(220, 38, 38, 0.28);
}

.inventory-alert__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.inventory-alert__title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.25;
    color: inherit;
}

.inventory-alert__text {
    font-size: 0.82rem;
    line-height: 1.4;
    opacity: 0.88;
}

.inventory-alert__action {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    font-weight: 650;
}

.inventory-alert--warning .inventory-alert__action {
    color: #b45309;
}

.inventory-alert--danger .inventory-alert__action {
    color: #b91c1c;
}

.inventory-alert__action::after {
    content: ' →';
}

.inventory-alert__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    height: 2.35rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
    font-weight: 750;
    font-size: 1.05rem;
    flex-shrink: 0;
}

body.lang-ku .inventory-alert,
body.lang-ar .inventory-alert {
    flex-direction: row-reverse;
}

body.lang-ku .inventory-alert__body,
body.lang-ar .inventory-alert__body,
body.lang-ku .inventory-alert__title,
body.lang-ar .inventory-alert__title,
body.lang-ku .inventory-alert__text,
body.lang-ar .inventory-alert__text,
body.lang-ku .inventory-alert__action,
body.lang-ar .inventory-alert__action {
    direction: rtl;
    unicode-bidi: isolate;
    text-align: right;
}

body.lang-ku .inventory-alert__action::after,
body.lang-ar .inventory-alert__action::after {
    content: ' ←';
}

.theme-dark .inventory-alert--warning {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.18), rgba(245, 158, 11, 0.1));
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

.theme-dark .inventory-alert--danger {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.18), rgba(239, 68, 68, 0.1));
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

.theme-dark .inventory-alert__count {
    background: rgba(15, 23, 42, 0.35);
    border-color: rgba(255, 255, 255, 0.08);
}

.rx-add-line-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.15rem;
    padding: 0.28rem 0.85rem 0.28rem 0.35rem;
    border: 1px solid rgba(15, 118, 110, 0.2);
    border-radius: 999px;
    background: linear-gradient(180deg, #f0fdfa 0%, #ccfbf1 100%);
    color: #0f766e;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.1;
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.08);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rx-add-line-btn__icon {
    position: relative;
    display: inline-block;
    width: 1.65rem;
    height: 1.65rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: #0f766e;
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.28);
}

.rx-add-line-btn__icon::before,
.rx-add-line-btn__icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: #fff;
    border-radius: 1px;
    transform: translate(-50%, -50%);
}

.rx-add-line-btn__icon::before {
    width: 0.55rem;
    height: 2px;
}

.rx-add-line-btn__icon::after {
    width: 2px;
    height: 0.55rem;
}

.rx-add-line-btn:hover .rx-add-line-btn__icon {
    background: #0d9488;
}

.rx-add-line-btn:hover .rx-add-line-btn__icon::before,
.rx-add-line-btn:hover .rx-add-line-btn__icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
    transition: transform 0.2s ease;
}

.rx-add-line-btn__label {
    padding-inline-end: 0.15rem;
}

.rx-add-line-btn:hover {
    color: #115e59;
    border-color: rgba(15, 118, 110, 0.35);
    background: linear-gradient(180deg, #ccfbf1 0%, #99f6e4 100%);
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.16);
    transform: translateY(-1px);
}

.rx-add-line-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.1);
}

.rx-prescribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.15rem;
    padding: 0.28rem 0.85rem 0.28rem 0.35rem;
    border: 1px solid rgba(2, 132, 199, 0.22);
    border-radius: 999px;
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rx-prescribe-btn__icon {
    position: relative;
    display: inline-block;
    width: 1.65rem;
    height: 1.65rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: #0284c7;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.28);
}

.rx-prescribe-btn__icon::before,
.rx-prescribe-btn__icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: #fff;
    border-radius: 1px;
    transform: translate(-50%, -50%);
}

.rx-prescribe-btn__icon::before {
    width: 0.55rem;
    height: 2px;
}

.rx-prescribe-btn__icon::after {
    width: 2px;
    height: 0.55rem;
}

.rx-prescribe-btn__label {
    padding-inline-end: 0.15rem;
}

.rx-prescribe-btn:hover {
    color: #075985;
    border-color: rgba(2, 132, 199, 0.4);
    background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.16);
    transform: translateY(-1px);
    text-decoration: none;
}

.rx-prescribe-btn:hover .rx-prescribe-btn__icon {
    background: #0ea5e9;
}

.rx-prescribe-btn:hover .rx-prescribe-btn__icon::before,
.rx-prescribe-btn:hover .rx-prescribe-btn__icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
    transition: transform 0.2s ease;
}

.rx-prescribe-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.1);
}

body.lang-ku .rx-prescribe-btn,
body.lang-ar .rx-prescribe-btn {
    flex-direction: row-reverse;
    padding: 0.28rem 0.35rem 0.28rem 0.85rem;
}

.theme-dark .rx-prescribe-btn {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
}

.theme-dark .rx-prescribe-btn__icon {
    background: #0284c7;
}

.theme-dark .rx-prescribe-btn:hover {
    background: rgba(14, 165, 233, 0.22);
    color: #bae6fd;
}

body.lang-ku .rx-add-line-btn,
body.lang-ar .rx-add-line-btn {
    flex-direction: row-reverse;
    padding: 0.28rem 0.35rem 0.28rem 0.85rem;
}

.theme-dark .rx-add-line-btn {
    background: rgba(20, 184, 166, 0.14);
    border-color: rgba(45, 212, 191, 0.28);
    color: #5eead4;
}

.theme-dark .rx-add-line-btn__icon {
    background: #0d9488;
    color: #fff;
}

.theme-dark .rx-add-line-btn:hover {
    background: rgba(20, 184, 166, 0.22);
    color: #99f6e4;
}

/* Prescription item remove */
#rxItemsTable .rx-item-actions {
    width: 3.25rem;
    text-align: center;
    vertical-align: middle;
}

.rx-items-wrap {
    overflow: visible;
}

.rx-items-wrap.table-responsive {
    overflow: visible;
}

#rxItemsTable td {
    overflow: visible;
    vertical-align: middle;
}

#rxItemsTable .rx-medicine-cell {
    min-width: 15rem;
    max-width: 18rem;
    width: 18rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

#rxItemsTable .rx-medicine-cell .combo-search {
    position: relative;
    z-index: 1;
    min-width: 0;
    width: 100%;
}

#rxItemsTable .rx-medicine-cell .combo-search:focus-within {
    z-index: 5;
}

#rxItemsTable .rx-medicine-cell .combo-search__input {
    font-size: 0.875rem;
    min-height: 2.15rem;
    height: 2.15rem;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    border-radius: 0.65rem;
}

body.lang-ku #rxItemsTable .rx-medicine-cell .combo-search__input,
body.lang-ar #rxItemsTable .rx-medicine-cell .combo-search__input {
    padding: 0.35rem 0.65rem 0.35rem 2rem;
}

#rxItemsTable .rx-medicine-cell .combo-search::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    inset-inline-end: 0.7rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    font-size: 0.7rem;
    line-height: 1;
}

.rx-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border: 1px solid rgba(220, 38, 38, 0.28);
    border-radius: 0.7rem;
    background: #fee2e2;
    color: #dc2626;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.rx-remove-btn i {
    font-size: 0.78rem;
    pointer-events: none;
}

.rx-remove-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.28);
}

.rx-remove-btn:active {
    transform: translateY(0);
}

.rx-remove-btn.is-locked,
.rx-remove-btn:disabled {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.08);
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.85;
}

.rx-remove-btn.is-locked:hover,
.rx-remove-btn:disabled:hover {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.08);
    color: #94a3b8;
    transform: none;
    box-shadow: none;
}

.theme-dark .rx-remove-btn {
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

.theme-dark .rx-remove-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.theme-dark .rx-remove-btn.is-locked,
.theme-dark .rx-remove-btn:disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #64748b;
}

.theme-dark .rx-remove-btn.is-locked:hover,
.theme-dark .rx-remove-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #64748b;
}

.table-toolbar .toolbar-select--gender {
    min-width: 12.5rem;
    max-width: 16rem;
}

.table-toolbar .toolbar-select--method {
    min-width: 14rem;
    max-width: 18rem;
}

.table-toolbar--center {
    justify-content: center;
    margin-bottom: 0;
}

.table-toolbar--center > .d-flex {
    flex: 0 1 auto;
    justify-content: center;
}

.table-toolbar--vcenter {
    margin-bottom: 0 !important;
    align-items: center;
}

.card-body:has(> .table-toolbar--vcenter) {
    display: flex;
    align-items: center;
}

.card-body > .table-toolbar--vcenter {
    width: 100%;
    margin: 0 !important;
}

.queue-filter-card > .card-body,
.calendar-filter-card > .card-body,
.app-card > .card-body:has(> .table-toolbar--vcenter) {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start;
    min-height: 5.1rem;
    padding-top: 1.35rem !important;
    padding-bottom: 1.25rem !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
}

.queue-filter-card .table-toolbar,
.calendar-filter-card .table-toolbar,
.app-card > .card-body:has(> .table-toolbar--vcenter) > .table-toolbar {
    width: 100%;
    margin: 0 !important;
}

.queue-toolbar-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
    height: 2.5rem;
    padding: 0 0.9rem 0 0.4rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.queue-toolbar-stat__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85rem;
    height: 1.85rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.queue-toolbar-stat__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate-600);
    white-space: nowrap;
    line-height: 1;
}

body.lang-ku .queue-toolbar-stat,
body.lang-ar .queue-toolbar-stat,
body.lang-en .queue-toolbar-stat {
    flex-direction: row-reverse;
    padding: 0 0.4rem 0 0.9rem;
}

.theme-dark .queue-toolbar-stat {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.theme-dark .queue-toolbar-stat__count {
    background: rgba(20, 184, 166, 0.18);
    color: #5eead4;
}

.theme-dark .queue-toolbar-stat__label {
    color: #94a3b8;
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    min-height: 36px;
    vertical-align: middle;
}

.person-cell__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 36px;
    align-self: center;
}

.person-cell__avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light, #14b8a6) 100%);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
}

.person-cell__meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1 1 auto;
    line-height: 1.25;
}

.person-cell__name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    margin: 0;
}

.person-cell__email {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* KU/AR: fixed-width LTR block, right-aligned under column title */
body.lang-ku .table th.col-patient,
body.lang-ar .table th.col-patient,
body.lang-ku .table td.col-patient,
body.lang-ar .table td.col-patient {
    text-align: right;
    vertical-align: middle;
    padding-inline-start: 0.5rem;
}

body.lang-ku .table th.col-patient,
body.lang-ar .table th.col-patient {
    text-align: center;
}

body.lang-ku .col-patient__label,
body.lang-ar .col-patient__label {
    display: inline-block;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    direction: rtl;
    vertical-align: middle;
    padding-inline-start: 0;
}

body.lang-ku .col-patient .person-cell,
body.lang-ar .col-patient .person-cell {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    width: 10.5rem;
    max-width: 100%;
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
    vertical-align: middle;
    box-sizing: border-box;
}

body.lang-ku .col-patient .person-cell__meta,
body.lang-ar .col-patient .person-cell__meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 36px;
    text-align: left;
    direction: ltr;
}

body.lang-ku .col-patient .person-cell__name,
body.lang-ar .col-patient .person-cell__name,
body.lang-ku .col-patient .person-cell__email,
body.lang-ar .col-patient .person-cell__email {
    text-align: left;
    direction: ltr;
}

body.lang-en .person-cell {
    flex-direction: row;
}

body.lang-en .person-cell__meta {
    text-align: left;
}

/* Keep avatar initials on one vertical line in patient list */
.table td .person-cell {
    align-items: center;
}

/* Calendar ? Today jump control */
.cal-today-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.3rem 0.85rem 0.3rem 0.35rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(15, 118, 110, 0.22);
    background: rgba(15, 118, 110, 0.08);
    color: var(--primary, #0f766e);
    text-decoration: none;
    font-weight: 650;
    font-size: 0.875rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cal-today-btn:hover {
    background: rgba(15, 118, 110, 0.14);
    border-color: rgba(15, 118, 110, 0.35);
    color: var(--primary-dark, #0d5f58);
}

.cal-today-btn.is-active {
    background: var(--primary, #0f766e);
    border-color: var(--primary, #0f766e);
    color: #fff;
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.25);
}

.cal-today-btn__day {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    background: #fff;
    color: var(--primary, #0f766e);
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cal-today-btn.is-active .cal-today-btn__day {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-dark, #0d5f58);
}

.cal-today-btn__label {
    padding-inline-end: 0.15rem;
}

/* Calendar month grid */
.calendar-month-card {
    overflow: visible;
}

.cal-month__head,
.cal-month__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-month__dow {
    padding: 0.7rem 0.4rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--slate-500);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.cal-month__grid {
    position: relative;
}

.cal-month__grid.is-expanding::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 15;
    background: rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(1px);
}

.cal-month__grid.is-expanding .cal-day:not(.cal-day--expanded) {
    pointer-events: none;
}

.cal-day-slot {
    min-height: 7.25rem;
    border-right: 1px solid rgba(15, 23, 42, 0.05);
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    background: #fff;
}

.cal-day-slot:nth-child(7n) {
    border-right: 0;
}

.cal-day-slot--empty {
    background: #f8fafc;
}

.cal-day {
    min-height: 7.25rem;
    height: 100%;
    padding: 0.55rem 0.45rem 0.5rem;
    background: transparent;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.18s ease;
    cursor: pointer;
}

.cal-day:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.45);
    outline-offset: -2px;
    z-index: 1;
}

.cal-day--empty {
    cursor: default;
    min-height: 7.25rem;
    pointer-events: none;
}

.cal-day--today {
    background: linear-gradient(160deg, rgba(15, 118, 110, 0.1), rgba(15, 118, 110, 0.03));
    box-shadow: inset 0 0 0 1.5px rgba(15, 118, 110, 0.28);
}

.cal-day-slot:has(.cal-day--busy):hover .cal-day:not(.cal-day--expanded) {
    background: #f8fafc;
}

.cal-day-slot:has(.cal-day--today.cal-day--busy):hover .cal-day:not(.cal-day--expanded) {
    background: linear-gradient(160deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.04));
}

.cal-day--selected:not(.cal-day--expanded) {
    background: linear-gradient(160deg, rgba(14, 165, 233, 0.12), rgba(2, 132, 199, 0.04));
    box-shadow: inset 0 0 0 2px rgba(2, 132, 199, 0.35);
}

.cal-day--today.cal-day--selected:not(.cal-day--expanded) {
    background: linear-gradient(160deg, rgba(15, 118, 110, 0.14), rgba(14, 165, 233, 0.06));
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.4);
}

.cal-day--expanded {
    position: absolute;
    z-index: 20;
    width: min(26rem, calc(100vw - 2.5rem));
    min-height: 18rem;
    max-height: min(70vh, 32rem);
    padding: 0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
    cursor: default;
    display: flex;
    flex-direction: column;
}

.cal-day--expanded.cal-day--today {
    box-shadow: 0 22px 48px rgba(15, 118, 110, 0.22), inset 0 0 0 2px rgba(15, 118, 110, 0.28);
}

.cal-day--expanded .cal-day__compact {
    display: none;
}

.cal-day__detail {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.cal-day--expanded .cal-day__detail {
    display: flex;
}

.cal-day__detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(15, 118, 110, 0.06));
    border-bottom: 1px solid rgba(2, 132, 199, 0.12);
}

.cal-day__detail-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.cal-day__detail-title strong {
    display: block;
    font-size: 0.95rem;
    color: var(--slate-800);
}

.cal-day__detail-count {
    display: block;
    font-size: 0.75rem;
    color: var(--slate-500);
    font-weight: 500;
}

.cal-day__detail-body {
    flex: 1;
    overflow: auto;
    max-height: min(52vh, 24rem);
}

.cal-day__detail-body .calendar-today-item {
    padding: 0.75rem 1rem;
}

.cal-day__detail-body .calendar-today-empty {
    padding: 1.5rem 1rem;
}

body.lang-ku .cal-day__detail-head,
body.lang-ar .cal-day__detail-head,
body.lang-ku .cal-day__detail-title,
body.lang-ar .cal-day__detail-title {
    flex-direction: row-reverse;
}

body.lang-ku .cal-day__detail-title strong,
body.lang-ar .cal-day__detail-title strong,
body.lang-ku .cal-day__detail-count,
body.lang-ar .cal-day__detail-count {
    text-align: right;
}

.cal-day__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
}

.cal-day__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--slate-700);
}

.cal-day--today .cal-day__num {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.28);
}

.cal-day__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary-dark);
    font-size: 0.68rem;
    font-weight: 700;
}

.cal-day__events {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.cal-event {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.22rem 0.4rem;
    border-radius: 0.45rem;
    background: rgba(15, 118, 110, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.1);
    color: var(--slate-700);
    text-decoration: none;
    font-size: 0.72rem;
    line-height: 1.2;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.cal-event:hover {
    background: rgba(15, 118, 110, 0.14);
    border-color: rgba(15, 118, 110, 0.22);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.cal-event__time {
    flex-shrink: 0;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.cal-event__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-day__more {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--slate-500);
    padding-inline-start: 0.15rem;
}

/* Today's appointments panel */
.calendar-today-card {
    overflow: hidden;
}

.calendar-today-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(20, 184, 166, 0.05));
    border-bottom: 1px solid rgba(15, 118, 110, 0.12);
}

.calendar-today-card__title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.calendar-today-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.75rem;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.25);
}

.calendar-today-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--slate-800);
}

.calendar-today-card__date {
    font-size: 0.8rem;
    color: var(--slate-500);
    margin-top: 0.1rem;
}

.calendar-today-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(15, 118, 110, 0.18);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.9rem;
}

.calendar-today-card__body {
    padding: 0;
}

.calendar-today-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 1.75rem 1.25rem;
    text-align: center;
    color: var(--slate-500);
}

.calendar-today-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-400);
    font-size: 1.15rem;
}

.calendar-today-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
}

.calendar-today-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.calendar-today-item:last-child {
    border-bottom: 0;
}

.calendar-today-item__time {
    flex-shrink: 0;
    min-width: 3.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.55rem;
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.calendar-today-item__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.calendar-today-item__name {
    font-weight: 650;
    color: var(--slate-800);
    text-decoration: none;
}

.calendar-today-item__name:hover {
    color: var(--primary);
}

.calendar-today-item__doctor {
    font-size: 0.78rem;
    color: var(--slate-500);
}

.calendar-today-item__no {
    font-size: 0.72rem;
    color: var(--slate-400);
    font-variant-numeric: tabular-nums;
}

/* Expanded day detail modal */
.cal-day-modal {
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.cal-day-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(15, 118, 110, 0.06));
    border-bottom: 1px solid rgba(2, 132, 199, 0.14);
}

.cal-day-modal__title-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.cal-day-modal__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 0.8rem;
    background: #0284c7;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.28);
}

.cal-day-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-800);
}

.cal-day-modal__date {
    font-size: 0.82rem;
    color: var(--slate-500);
    margin-top: 0.1rem;
}

.cal-day-modal__head-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.cal-day-modal__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(2, 132, 199, 0.2);
    color: #0369a1;
    font-weight: 700;
    font-size: 0.92rem;
}

.cal-day-modal__body {
    max-height: min(62vh, 28rem);
}

.cal-day-modal__body .calendar-today-item {
    padding: 1rem 1.25rem;
}

.cal-day-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    background: #f8fafc;
}

body.lang-ku .cal-day-modal__head,
body.lang-ar .cal-day-modal__head,
body.lang-ku .cal-day-modal__title-wrap,
body.lang-ar .cal-day-modal__title-wrap,
body.lang-ku .cal-day-modal__head-actions,
body.lang-ar .cal-day-modal__head-actions,
body.lang-ku .cal-day-modal__footer,
body.lang-ar .cal-day-modal__footer {
    flex-direction: row-reverse;
}

body.lang-ku .cal-day-modal__title,
body.lang-ar .cal-day-modal__title,
body.lang-ku .cal-day-modal__date,
body.lang-ar .cal-day-modal__date {
    text-align: right;
}

.theme-dark .cal-day--selected {
    background: rgba(14, 165, 233, 0.12);
    box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.theme-dark .cal-day-modal__head {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(15, 118, 110, 0.08));
}

.theme-dark .cal-day-modal__title {
    color: #f1f5f9;
}

.theme-dark .cal-day-modal__badge {
    background: rgba(255, 255, 255, 0.06);
    color: #7dd3fc;
}

.theme-dark .cal-day-modal__footer {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(255, 255, 255, 0.06);
}

body.lang-ku .cal-day__top,
body.lang-ar .cal-day__top,
body.lang-ku .calendar-today-card__head,
body.lang-ar .calendar-today-card__head,
body.lang-ku .calendar-today-item,
body.lang-ar .calendar-today-item,
body.lang-ku .cal-event,
body.lang-ar .cal-event,
body.lang-ku .calendar-today-card__title-wrap,
body.lang-ar .calendar-today-card__title-wrap {
    flex-direction: row-reverse;
}

body.lang-ku .cal-event__name,
body.lang-ar .cal-event__name,
body.lang-ku .calendar-today-item__meta,
body.lang-ar .calendar-today-item__meta,
body.lang-ku .calendar-today-card__title,
body.lang-ar .calendar-today-card__title,
body.lang-ku .calendar-today-card__date,
body.lang-ar .calendar-today-card__date {
    text-align: right;
}

@media (max-width: 991.98px) {
    .cal-day-slot,
    .cal-day {
        min-height: 5.5rem;
    }

    .cal-day {
        padding: 0.4rem 0.3rem;
    }

    .cal-day--expanded {
        width: min(22rem, calc(100vw - 1.5rem));
        min-height: 14rem;
    }

    .cal-event__name {
        display: none;
    }
}

.theme-dark .cal-month__dow {
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
}

.theme-dark .cal-day {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.06);
}

.theme-dark .cal-day--empty {
    background: rgba(255, 255, 255, 0.02);
}

.theme-dark .cal-day__num {
    color: #e2e8f0;
}

.theme-dark .cal-event {
    background: rgba(20, 184, 166, 0.12);
    border-color: rgba(20, 184, 166, 0.18);
    color: #e2e8f0;
}

.theme-dark .calendar-today-card__head {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(15, 118, 110, 0.06));
}

.theme-dark .calendar-today-card__title {
    color: #f1f5f9;
}

.theme-dark .calendar-today-item__name {
    color: #f1f5f9;
}

.theme-dark .calendar-today-card__badge {
    background: rgba(255, 255, 255, 0.06);
    color: #5eead4;
}

/* Searchable dropdown (patient / invoice pickers) */
.search-select {
    position: relative;
}

.search-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: 41px;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border-color, #dbe3ea);
    border-radius: var(--radius-sm, 0.5rem);
    background: var(--bg-card, #fff);
    color: var(--text-primary, #0f172a);
    text-align: start;
    cursor: pointer;
}

.search-select__trigger:hover,
.search-select__trigger[aria-expanded="true"] {
    border-color: var(--primary, #0f766e);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.12);
}

.search-select__value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.search-select__value.is-placeholder {
    color: var(--text-muted, #64748b);
}

.search-select__caret {
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    flex-shrink: 0;
}

.search-select__panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.3rem);
    left: 0;
    right: 0;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 0.5rem);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
    overflow: hidden;
}

.search-select__search-wrap {
    position: relative;
    padding: 0.55rem;
    border-bottom: 1px solid var(--border-color);
}

.search-select__search-wrap > i {
    position: absolute;
    top: 50%;
    inset-inline-start: 1.05rem;
    transform: translateY(-50%);
    color: var(--text-muted, #64748b);
    font-size: 0.8rem;
    pointer-events: none;
}

.search-select__search {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    padding: 0.45rem 0.7rem;
    padding-inline-start: 2rem;
    font-size: 0.875rem;
    background: #fff;
    color: var(--text-primary, #0f172a);
}

.search-select__search:focus {
    outline: none;
    border-color: var(--primary, #0f766e);
    box-shadow: 0 0 0 0.15rem rgba(15, 118, 110, 0.12);
}

.search-select__options {
    max-height: 240px;
    overflow: auto;
    padding: 0.35rem;
}

.search-select__item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: start;
    padding: 0.55rem 0.7rem;
    border-radius: 0.4rem;
    color: var(--text-primary, #0f172a);
    font-size: 0.875rem;
    cursor: pointer;
}

.search-select__item:hover,
.search-select__item:focus {
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary, #0f766e);
    outline: none;
}

.search-select__empty {
    padding: 0.75rem 0.7rem;
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
}

body.lang-ku .search-select__item,
body.lang-ar .search-select__item,
body.lang-ku .search-select__trigger,
body.lang-ar .search-select__trigger {
    text-align: right;
}

.amount-currency {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    /* Keep amount then currency left→right even inside RTL form grids */
    direction: ltr;
    width: 100%;
}

.amount-currency > .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* EN: currency on the left, amount on the right */
body.lang-en .amount-currency > .amount-currency__unit { order: 1; }
body.lang-en .amount-currency > .form-control { order: 2; }

.amount-currency--compact {
    gap: 0.35rem;
}

.amount-currency__unit {
    flex: 0 0 auto;
    width: auto;
    min-width: 5.75rem;
    max-width: 8.5rem;
}

.amount-currency--compact .amount-currency__unit {
    min-width: 4.75rem;
    max-width: 5.75rem;
    padding-inline: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Legacy searchable combo */
.search-combo {
    position: relative;
}

.search-combo__list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow: auto;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 0.5rem);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    padding: 0.35rem;
}

.search-combo__item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: start;
    padding: 0.55rem 0.7rem;
    border-radius: 0.4rem;
    color: var(--text-primary, #0f172a);
    font-size: 0.875rem;
    cursor: pointer;
}

.search-combo__item:hover,
.search-combo__item:focus {
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary, #0f766e);
    outline: none;
}

body.lang-ku .search-combo__item,
body.lang-ar .search-combo__item {
    text-align: right;
}

/* Soft action buttons in tables & queue cards */
.table-actions,
td.text-end {
    white-space: nowrap;
}

.table-actions,
td.text-end .btn-group {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    vertical-align: middle;
}

td.text-end .btn-group > .btn,
td.text-end > .btn,
.table-actions > .btn,
.table-actions .btn {
    margin: 0;
}

.table-actions > form,
td.text-end .btn-group > form,
td.text-end > form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.table-actions > form .btn,
td.text-end .btn-group > form .btn,
td.text-end > form .btn {
    border-radius: 0.7rem !important;
}

td.text-end .btn-group {
    border: 0;
}

td.text-end .btn-group > .btn,
td.text-end .btn-group > form .btn {
    border-radius: 0.7rem !important;
}

td.text-end .btn-sm,
.table-actions .btn-sm,
.table-actions > form .btn:not(.btn-outline-danger):not(.btn-outline-success):not(.btn-outline-info),
td.text-end .btn-group > form .btn:not(.btn-outline-danger):not(.btn-outline-success):not(.btn-outline-info),
td.text-end > form .btn-sm:not(.btn-outline-danger):not(.btn-outline-success):not(.btn-outline-info) {
    min-width: 2.15rem;
    height: 2.15rem;
    padding: 0 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 0.7rem;
    border-color: rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #475569;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.table-actions > form .btn-outline-danger,
td.text-end .btn-group > form .btn-outline-danger,
td.text-end > form .btn-outline-danger,
.table-actions > form .btn-outline-info,
td.text-end .btn-group > form .btn-outline-info,
td.text-end > form .btn-outline-info,
.table-actions > form .btn-outline-success,
td.text-end .btn-group > form .btn-outline-success {
    min-width: 2.15rem;
    height: 2.15rem;
    padding: 0 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

td.text-end .btn-sm:hover,
.table-actions .btn-sm:hover,
.table-actions > form .btn:hover,
td.text-end .btn-group > form .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

td.text-end .btn-sm i,
.table-actions .btn-sm i,
.table-actions > form .btn i,
td.text-end .btn-group > form .btn i {
    font-size: 0.82rem;
    line-height: 1;
}

td.text-end .btn-outline-primary,
.table-actions .btn-outline-primary {
    color: var(--primary);
    border-color: rgba(15, 118, 110, 0.22);
    background: rgba(15, 118, 110, 0.06);
}

td.text-end .btn-outline-primary:hover,
.table-actions .btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

td.text-end .btn-outline-secondary,
.table-actions .btn-outline-secondary {
    color: #475569;
    border-color: rgba(100, 116, 139, 0.22);
    background: #f8fafc;
}

td.text-end .btn-outline-secondary:hover,
.table-actions .btn-outline-secondary:hover {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

td.text-end .btn-outline-danger,
.table-actions .btn-outline-danger,
.table-actions > form .btn-outline-danger,
td.text-end .btn-group > form .btn-outline-danger,
td.text-end > form .btn-outline-danger {
    color: #dc2626 !important;
    border-color: rgba(220, 38, 38, 0.35) !important;
    background: #fee2e2 !important;
}

td.text-end .btn-outline-danger:hover,
.table-actions .btn-outline-danger:hover,
.table-actions > form .btn-outline-danger:hover,
td.text-end .btn-group > form .btn-outline-danger:hover,
td.text-end > form .btn-outline-danger:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
}

td.text-end .btn-outline-danger i,
.table-actions .btn-outline-danger i,
.table-actions > form .btn-outline-danger i,
td.text-end .btn-group > form .btn-outline-danger i {
    color: inherit !important;
}

td.text-end .btn-outline-success,
.table-actions .btn-outline-success {
    color: #15803d;
    border-color: rgba(21, 128, 61, 0.22);
    background: rgba(220, 252, 231, 0.7);
}

.table-actions .btn-outline-success:hover,
.table-actions > form .btn-outline-success:hover {
    color: #fff;
    background: #16a34a;
    border-color: #16a34a;
}

td.text-end .btn-outline-info,
.table-actions .btn-outline-info,
.table-actions > form .btn-outline-info {
    color: #0369a1;
    border-color: rgba(2, 132, 199, 0.28);
    background: rgba(224, 242, 254, 0.85);
}

td.text-end .btn-outline-info:hover,
.table-actions .btn-outline-info:hover,
.table-actions > form .btn-outline-info:hover {
    color: #fff;
    background: #0284c7;
    border-color: #0284c7;
}

/* Queue card action row */
.card.app-card .border.rounded.p-3 .btn-group {
    display: flex;
    gap: 0.4rem;
    border: 0;
}

.card.app-card .border.rounded.p-3 .btn-group > .btn,
.card.app-card .border.rounded.p-3 .btn-group form .btn {
    border-radius: 0.7rem !important;
    font-weight: 600;
    min-height: 2.15rem;
}

.card.app-card .border.rounded.p-3 .btn-group > .btn-outline-secondary {
    flex: 0 0 2.35rem;
    width: 2.35rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-color: rgba(100, 116, 139, 0.22);
}

.theme-dark td.text-end .btn-sm,
.theme-dark .table-actions .btn-sm {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    box-shadow: none;
}

/* ?????? Forms ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: flex-start;
}

.form-actions--bottom {
    justify-content: center;
    padding: 0.5rem 0 1rem;
}

.company-profile-card {
    min-height: 31rem;
}

.company-profile-row {
    justify-content: flex-start;
}

.company-profile-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.company-profile-card__status {
    flex-shrink: 0;
}

.company-profile-card__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.company-profile-card__item,
.company-profile-card__notes {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.05rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.98));
}

.company-profile-card__item--full,
.company-profile-card__notes {
    grid-column: 1 / -1;
}

.company-profile-card__label {
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 700;
}

.company-profile-card__value {
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.55;
    word-break: break-word;
}

.company-profile-card__item strong.company-profile-card__value {
    font-size: 1.1rem;
}

.company-profile-card__value a {
    color: inherit;
    text-decoration: none;
}

.company-profile-card__value a:hover {
    text-decoration: underline;
}

.company-profile-card__notes {
    margin-top: 1rem;
}

body.lang-ku .company-profile-card__header,
body.lang-ar .company-profile-card__header {
    direction: rtl;
}

body.lang-ku .company-profile-card__grid,
body.lang-ar .company-profile-card__grid {
    direction: rtl;
}

body.lang-ku .company-profile-card,
body.lang-ku .company-profile-card .card-body,
body.lang-ar .company-profile-card,
body.lang-ar .company-profile-card .card-body {
    direction: rtl;
}

body.lang-ku .company-profile-row,
body.lang-ar .company-profile-row {
    justify-content: flex-end;
}

.combo-search {
    position: relative;
}

.combo-search .combo-search__input,
.combo-select .combo-select__control {
    min-height: 2.55rem;
    border-radius: 0.75rem;
    border-color: rgba(148, 163, 184, 0.45);
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.combo-search .combo-search__input:focus,
.combo-select .combo-select__control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem var(--primary-soft);
}

.combo-select {
    position: relative;
}

.combo-select__control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-inline-end: 2.5rem;
    background-image: none !important;
    cursor: pointer;
}

.combo-select__chevron {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.9rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    font-size: 0.75rem;
    line-height: 1;
}

.combo-select:focus-within .combo-select__chevron {
    color: var(--primary);
}

.theme-dark .combo-search .combo-search__input,
.theme-dark .combo-select .combo-select__control {
    background-color: #1e293b;
    border-color: rgba(148, 163, 184, 0.28);
}

.combo-search__menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 1060;
    display: none !important;
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.combo-search__menu.is-open {
    display: block !important;
}

.combo-search__menu--portal {
    margin: 0;
}

.combo-search__option {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.6rem 0.8rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: #0f172a;
    text-align: inherit;
    font-size: 0.95rem;
}

.combo-search__option:hover,
.combo-search__option.is-active {
    background: #f1f5f9;
}

.combo-search__hint {
    padding: 0.55rem 0.8rem 0.35rem;
    color: #64748b;
    font-size: 0.82rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    margin-top: 0.2rem;
}

body.lang-ku .combo-search__menu,
body.lang-ar .combo-search__menu {
    direction: rtl;
    text-align: right;
}

body.lang-ku .company-profile-card__item,
body.lang-ku .company-profile-card__notes,
body.lang-ar .company-profile-card__item,
body.lang-ar .company-profile-card__notes {
    text-align: right;
}

@media (max-width: 767.98px) {
    .company-profile-card {
        min-height: auto;
    }

    .company-profile-card__grid {
        grid-template-columns: 1fr;
    }
}

/* RTL catalog forms: fields flow from the right */
body.lang-ku .form-grid,
body.lang-ar .form-grid {
    direction: rtl;
    justify-content: flex-start;
}

body.lang-ku .form-grid > [class*="col-"],
body.lang-ar .form-grid > [class*="col-"] {
    text-align: right;
}

body.lang-en .form-grid {
    direction: ltr;
}

/* English only: reverse field order within each medicine form row */
/* EN only: reverse patient personal-info fields (KU/AR keep DOM order) */
body.lang-en .patient-personal-fields > .patient-f-first { order: 1; }
body.lang-en .patient-personal-fields > .patient-f-last { order: 2; }
body.lang-en .patient-personal-fields > .patient-f-gender { order: 3; }
body.lang-en .patient-personal-fields > .patient-f-dob { order: 4; }
body.lang-en .patient-personal-fields > .patient-f-phone { order: 5; }
body.lang-en .patient-personal-fields > .patient-f-phone.ms-md-auto {
    margin-left: 0 !important;
}
body.lang-en .patient-additional-fields > .patient-f-blood { order: 1; }
body.lang-en .patient-additional-fields > .patient-f-marital { order: 2; }
body.lang-en .patient-additional-fields > .patient-f-occupation { order: 3; }
body.lang-en .patient-additional-fields > .patient-f-national { order: 4; }
body.lang-en .patient-address-fields > .patient-f-city { order: 1; }
body.lang-en .patient-address-fields > .patient-f-address { order: 2; }
body.lang-en .patient-medical-fields > .patient-f-chronic { order: 1; }
body.lang-en .patient-medical-fields > .patient-f-allergies { order: 2; }
body.lang-en .patient-medical-fields > .patient-f-notes { order: 3; }
body.lang-en .patient-emergency-fields > .patient-f-ec-phone { order: 1; }
body.lang-en .patient-emergency-fields > .patient-f-ec-rel { order: 2; }
body.lang-en .patient-emergency-fields > .patient-f-ec-name { order: 3; }
/* EN: main form left, photo/status right */
body.lang-en .patient-form-layout > .patient-form-main { order: 1 !important; }
body.lang-en .patient-form-layout > .patient-form-side { order: 2 !important; }

body.lang-en .medicine-form-fields > .medicine-f-name { order: 1; }
body.lang-en .medicine-form-fields > .medicine-f-sku { order: 2; }
body.lang-en .medicine-form-fields > .medicine-f-generic { order: 3; }
body.lang-en .medicine-form-fields > .medicine-f-category { order: 4; }
body.lang-en .medicine-form-fields > .medicine-f-reorder { order: 5; }
body.lang-en .medicine-form-fields > .medicine-f-unit { order: 6; }
body.lang-en .medicine-form-fields > .medicine-f-strength { order: 7; }
body.lang-en .medicine-form-fields > .medicine-f-form { order: 8; }
body.lang-en .medicine-form-fields > .medicine-f-currency { order: 9; }
body.lang-en .medicine-form-fields > .medicine-f-rate { order: 10; }
body.lang-en .medicine-form-fields > .medicine-f-buy { order: 11; }
body.lang-en .medicine-form-fields > .medicine-f-sell { order: 12; }
body.lang-en .medicine-form-fields > .medicine-f-discount { order: 13; }
body.lang-en .medicine-form-fields > .medicine-f-status { order: 14; }
body.lang-en .medicine-form-fields > .medicine-f-desc { order: 15; }

/* EN only: reverse doctor account fields */
body.lang-en .doctor-account-fields > .doctor-f-first { order: 1; }
body.lang-en .doctor-account-fields > .doctor-f-last { order: 2; }
body.lang-en .doctor-account-fields > .doctor-f-phone { order: 3; }
body.lang-en .doctor-account-fields > .doctor-f-username { order: 4; }
body.lang-en .doctor-account-fields > .doctor-f-password { order: 5; }
body.lang-en .doctor-account-fields > .doctor-f-password.ms-md-auto {
    margin-left: 0 !important;
}
body.lang-en .doctor-professional-fields > .doctor-f-department { order: 1; }
body.lang-en .doctor-professional-fields > .doctor-f-license { order: 2; }
body.lang-en .doctor-professional-fields > .doctor-f-qualification { order: 3; }
body.lang-en .doctor-professional-fields > .doctor-f-specialization { order: 4; }
body.lang-en .doctor-professional-fields > .doctor-f-fee { order: 5; }
body.lang-en .doctor-professional-fields > .doctor-f-experience { order: 6; }
body.lang-en .doctor-professional-fields > .doctor-f-commission { order: 7; }
body.lang-en .doctor-professional-fields > .doctor-f-status { order: 8; }
body.lang-en .doctor-professional-fields > .doctor-f-biography { order: 9; }

/* EN only: item name left, related-to right */
body.lang-en .po-item__identity > .po-item-f-name { order: 1; }
body.lang-en .po-item__identity > .po-item-f-type { order: 2; }
/* EN only: expiry left, batch right */
body.lang-en .po-item__batch-expiry > [data-po-expiry-wrap] { order: 1; }
body.lang-en .po-item__batch-expiry > [data-po-batch-wrap] { order: 2; }

.patient-danger-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.25rem;
    padding: 1rem 1.15rem;
    border-radius: 0.9rem;
    border: 1px dashed rgba(185, 28, 28, 0.35);
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(255, 255, 255, 0.9));
}

.patient-danger-zone__text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

body.lang-ku .patient-danger-zone,
body.lang-ar .patient-danger-zone {
    direction: ltr;
    flex-direction: row-reverse;
}

body.lang-ku .patient-danger-zone__text,
body.lang-ar .patient-danger-zone__text {
    text-align: right;
}

.patient-danger-zone__text strong {
    color: #991b1b;
    font-size: 0.95rem;
}

.patient-danger-zone__text span {
    color: #7f1d1d;
    font-size: 0.84rem;
    opacity: 0.85;
}

.patient-danger-zone__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.5rem;
    padding: 0.45rem 1rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(185, 28, 28, 0.28);
    background: #fff;
    color: #b91c1c;
    font-weight: 650;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.patient-danger-zone__btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.22);
}

.delete-modal {
    position: relative;
    border: none;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.delete-modal__close {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    z-index: 2;
}

.delete-modal__body {
    position: relative;
    padding: 2rem 1.75rem 1.6rem;
    text-align: center;
}

.delete-modal__icon {
    width: 4.25rem;
    height: 4.25rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fee2e2;
    color: #dc2626;
    font-size: 1.55rem;
}

.delete-modal__title {
    margin: 0 0 0.55rem;
    font-size: 1.25rem;
    font-weight: 750;
    color: #7f1d1d;
}

.delete-modal__text {
    margin: 0 auto 1.15rem;
    max-width: 26rem;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

.delete-modal__patient {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0 auto 1.4rem;
    padding: 0.85rem 1rem;
    max-width: 22rem;
    border-radius: 0.85rem;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.delete-modal__patient-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

.delete-modal__patient strong {
    color: #0f172a;
    font-size: 1.05rem;
}

.delete-modal__mrn {
    color: #64748b;
    font-size: 0.85rem;
}

.delete-modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
}

.delete-modal__actions .btn {
    min-width: 7.5rem;
}

body.lang-ku .delete-modal__body,
body.lang-ar .delete-modal__body,
body.lang-ku .delete-modal__patient,
body.lang-ar .delete-modal__patient {
    text-align: center;
}

/* Confirm dialog — same visual language as centered warning toast */
.confirm-modal-dialog {
    max-width: min(320px, calc(100vw - 2.5rem));
    margin-left: auto;
    margin-right: auto;
}

.confirm-modal {
    border: none;
    border-radius: 1.35rem;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.2);
}

.confirm-modal__card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    min-height: min(320px, calc(100vw - 2.5rem));
    padding: 1.75rem 1.5rem 1.35rem;
    text-align: center;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 48%);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.confirm-modal__close {
    position: absolute;
    top: 0.85rem;
    inset-inline-end: 0.85rem;
    z-index: 2;
    opacity: 0.4;
}

.confirm-modal__icon {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2rem;
    background: #fef3c7;
    color: #b45309;
}

.confirm-modal__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
}

.confirm-modal__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 750;
    line-height: 1.2;
    color: #92400e;
}

.confirm-modal__message {
    margin: 0;
    max-width: 16rem;
    font-size: 1.05rem;
    line-height: 1.45;
    color: #334155;
}

.confirm-modal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    margin-top: 0.35rem;
}

.confirm-modal__actions .btn,
.confirm-modal__cancel,
.confirm-modal__confirm {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 2.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.7rem;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.2;
}

.confirm-modal__confirm.btn-info {
    color: #fff;
    background: #0284c7;
    border-color: #0284c7;
}

.confirm-modal__confirm.btn-info:hover {
    color: #fff;
    background: #0369a1;
    border-color: #0369a1;
}

.confirm-modal__confirm.btn-secondary {
    color: #fff;
    background: #475569;
    border-color: #475569;
}

.confirm-modal__confirm.btn-secondary:hover {
    color: #fff;
    background: #334155;
    border-color: #334155;
}

.confirm-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 0.9rem;
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.confirm-modal__btn i {
    font-size: 0.95rem;
}

.confirm-modal__btn:active {
    transform: translateY(1px);
}

.confirm-modal__btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.confirm-modal__btn--ghost {
    color: #475569;
    background: rgba(248, 250, 252, 0.95);
    border-color: rgba(148, 163, 184, 0.45);
    box-shadow: none;
}

.confirm-modal__btn--ghost:hover {
    color: #0f172a;
    background: #f1f5f9;
    border-color: rgba(100, 116, 139, 0.55);
}

.confirm-modal__btn--danger {
    color: #fff;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    border-color: #dc2626;
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.28);
}

.confirm-modal__btn--danger:hover {
    color: #fff;
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    border-color: #b91c1c;
    box-shadow: 0 12px 26px rgba(185, 28, 28, 0.32);
}

.confirm-modal__btn--primary {
    color: #fff;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.confirm-modal__btn--primary:hover {
    color: #fff;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
}

.confirm-modal__btn--warning {
    color: #fff;
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    border-color: #d97706;
    box-shadow: 0 10px 22px rgba(217, 119, 6, 0.28);
}

.confirm-modal__btn--warning:hover {
    color: #fff;
    background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
    border-color: #b45309;
}

/* Soften the dim overlay behind confirm / app modals */
.modal-backdrop.show {
    background-color: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
}

body.lang-ku .confirm-modal__card,
body.lang-ar .confirm-modal__card,
body.lang-ku .confirm-modal__content,
body.lang-ar .confirm-modal__content {
    text-align: center;
}

.theme-dark .confirm-modal__card {
    background: linear-gradient(180deg, #422006 0%, #1e293b 48%);
    border-color: rgba(148, 163, 184, 0.15);
}

.theme-dark .confirm-modal__title {
    color: #fbbf24;
}

.theme-dark .confirm-modal__message {
    color: #e2e8f0;
}

.theme-dark .confirm-modal__icon {
    background: rgba(251, 191, 36, 0.16);
    color: #fbbf24;
}

.theme-dark .confirm-modal__btn--ghost {
    color: #e2e8f0;
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.35);
}

.theme-dark .confirm-modal__btn--ghost:hover {
    color: #fff;
    background: rgba(51, 65, 85, 0.95);
    border-color: rgba(148, 163, 184, 0.5);
}

.cancel-appt-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    border-top: none;
    padding-top: 0.25rem;
}

/* Modal headers — title right, close left for KU/AR */
body.lang-ku .modal-header,
body.lang-ar .modal-header,
body.lang-ku .cancel-appt-modal__header,
body.lang-ar .cancel-appt-modal__header {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
}

body.lang-ku .modal-header .modal-title,
body.lang-ar .modal-header .modal-title {
    text-align: right;
}

body.lang-ku .modal-header .btn-close,
body.lang-ar .modal-header .btn-close {
    margin: 0 !important;
    flex-shrink: 0;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
    padding: 0.5625rem 0.875rem;
    font-size: 0.875rem;
}

.input-group-text {
    background: var(--slate-50);
    border-color: var(--border-color);
    color: var(--text-muted);
}

.form-text {
    font-size: 0.8125rem;
}

.form-text--tip {
    color: #15803d;
    font-weight: 500;
}

.theme-dark .form-text--tip {
    color: #4ade80;
}

.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: var(--primary);
}

.was-validated .form-control:valid:focus,
.form-control.is-valid:focus {
    box-shadow: 0 0 0 0.2rem var(--primary-soft);
}

/* ?????? Toasts ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.toast-container {
    z-index: 1090;
}

.toast-container--center {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%);
    padding: 0;
    width: auto;
    max-width: calc(100vw - 2rem);
    pointer-events: none;
}

.toast-container--center .toast {
    pointer-events: none;
    width: auto;
    margin: 0 auto;
}

.toast-container--center .app-toast__close {
    pointer-events: auto;
}

.app-toast {
    --toast-size: min(320px, calc(100vw - 2.5rem));
    min-width: var(--toast-size);
    width: var(--toast-size);
    height: var(--toast-size);
    max-width: var(--toast-size);
    max-height: var(--toast-size);
    border: none;
    border-radius: 1.35rem;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.2);
    overflow: hidden;
    background: transparent;
    display: block;
    transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}

.app-toast.fade:not(.show) {
    opacity: 0;
    transform: scale(0.96);
}

.app-toast.fade.show {
    opacity: 1;
    transform: scale(1);
}

.app-toast .toast-body.app-toast__card,
.app-toast__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    height: 100%;
    padding: 1.75rem 1.5rem 1.5rem;
    position: relative;
    text-align: center;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.app-toast__close {
    position: absolute;
    top: 0.85rem;
    inset-inline-end: 0.85rem;
    opacity: 0.4;
}

.app-toast__icon {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2rem;
}

.app-toast__content {
    flex: 0 1 auto;
    min-width: 0;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
}

.app-toast__top {
    display: none;
}

.app-toast__title {
    font-size: 1.35rem;
    font-weight: 750;
    line-height: 1.2;
    margin: 0;
}

.app-toast__message {
    font-size: 1.05rem;
    line-height: 1.45;
    color: #334155;
    max-width: 16rem;
}

.app-toast__meta {
    display: none;
}

.app-toast.toast-success .app-toast__card {
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 48%);
}

.app-toast.toast-success .app-toast__icon {
    background: #d1fae5;
    color: #047857;
}

.app-toast.toast-success .app-toast__title {
    color: #065f46;
}

.app-toast.toast-error .app-toast__card {
    background: linear-gradient(180deg, #fef2f2 0%, #ffffff 48%);
}

.app-toast.toast-error .app-toast__icon {
    background: #fee2e2;
    color: #b91c1c;
}

.app-toast.toast-error .app-toast__title {
    color: #991b1b;
}

.app-toast.toast-info .app-toast__card {
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 48%);
}

.app-toast.toast-info .app-toast__icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.app-toast.toast-info .app-toast__title {
    color: #1e40af;
}

.app-toast.toast-warning .app-toast__card {
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 48%);
}

.app-toast.toast-warning .app-toast__icon {
    background: #fef3c7;
    color: #b45309;
}

.app-toast.toast-warning .app-toast__title {
    color: #92400e;
}

.theme-dark .app-toast__card {
    background: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.15);
}

.theme-dark .app-toast__message {
    color: #e2e8f0;
}

.theme-dark .app-toast.toast-success .app-toast__title {
    color: #6ee7b7;
}

.theme-dark .app-toast.toast-error .app-toast__title {
    color: #fca5a5;
}

/* ?????? Global loader ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.global-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.global-loader.is-active {
    display: flex;
}

.global-loader__spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.global-loader__text {
    color: #FFFFFF;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Auth pages */

.auth-body {
    min-height: 100vh;
    background: #0B3D3A;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4.5rem);
    color: #F0FDFA;
    background:
        linear-gradient(160deg, rgba(7, 40, 38, 0.55) 0%, rgba(15, 118, 110, 0.35) 45%, rgba(7, 40, 38, 0.7) 100%),
        radial-gradient(ellipse at 20% 15%, rgba(45, 212, 191, 0.28), transparent 45%),
        radial-gradient(ellipse at 85% 80%, rgba(15, 118, 110, 0.45), transparent 50%),
        linear-gradient(145deg, #0B3D3A 0%, #0F766E 48%, #115E59 100%);
}

.auth-hero__glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    animation: authGlow 10s ease-in-out infinite alternate;
}

.auth-hero__glow--a {
    width: 280px;
    height: 280px;
    top: -60px;
    inset-inline-end: -40px;
    background: rgba(45, 212, 191, 0.35);
}

.auth-hero__glow--b {
    width: 320px;
    height: 320px;
    bottom: -80px;
    inset-inline-start: -60px;
    background: rgba(13, 148, 136, 0.4);
    animation-delay: -4s;
}

.auth-hero__ecg {
    position: absolute;
    left: 0;
    bottom: 18%;
    width: 200%;
    height: 90px;
    color: rgba(240, 253, 250, 0.28);
    opacity: 1;
    animation: authEcg 14s linear infinite;
    will-change: transform;
}

.auth-hero__content {
    position: relative;
    z-index: 1;
    max-width: 28rem;
    animation: authRise 0.7s ease-out both;
}

.auth-hero__logo {
    display: block;
    width: min(168px, 42vw);
    height: auto;
    margin-bottom: 1.5rem;
    border-radius: 1.25rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    background: #fff;
}

.auth-hero__logo--custom {
    object-fit: contain;
    max-height: 168px;
    padding: 0.5rem;
}

.auth-hero__brand {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 4.5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 0.75rem;
    color: #fff;
}

.auth-hero__tagline {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
    color: rgba(240, 253, 250, 0.82);
    max-width: 22rem;
}

.auth-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background: linear-gradient(180deg, #F7FAFC 0%, #EEF4F3 100%);
    animation: authPanelIn 0.65s ease-out both;
}

.auth-panel__inner {
    width: 100%;
    max-width: 400px;
}

.auth-panel__inner .lang-switcher--auth {
    display: flex !important;
    width: 100%;
    justify-content: center !important;
    margin-bottom: 1rem;
}

.auth-panel__title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--slate-900);
    margin: 0 0 0.4rem;
    text-align: center !important;
}

.auth-panel__lead {
    margin: 0 0 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center !important;
}

.auth-panel__body {
    text-align: start;
}

/* Form labels: LTR left / RTL right */
body.lang-en .auth-panel__body .auth-field .form-label {
    text-align: left !important;
}

body.lang-ku .auth-panel__body .auth-field .form-label,
body.lang-ar .auth-panel__body .auth-field .form-label {
    display: block;
    width: 100%;
    text-align: right !important;
}

.auth-alert {
    border-radius: 0.75rem;
    border: 0;
    font-size: 0.875rem;
}

body.lang-ku .auth-alert,
body.lang-ar .auth-alert {
    direction: rtl;
    text-align: right;
}

.auth-form__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* English only: Forgot password on the left, Remember me on the right */
body.lang-en .auth-form__meta .auth-link {
    order: 1;
}
body.lang-en .auth-form__meta .form-check {
    order: 2;
}

.auth-input {
    position: relative;
}

.auth-input .form-control {
    min-height: 48px;
    padding-inline-start: 2.75rem;
    padding-inline-end: 2.75rem;
    border-radius: 0.8rem;
    border-color: #D7E2E0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.auth-input .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.14);
}

.auth-input__icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 0.95rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 2;
}

.auth-input__toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.35rem;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--text-muted);
    display: inline-grid;
    place-items: center;
    z-index: 2;
}

.auth-input__toggle:hover {
    color: var(--primary);
    background: rgba(15, 118, 110, 0.08);
}

/* Keep Bootstrap valid/invalid check away from field icons — show on the label instead */
.auth-form.was-validated .auth-input .form-control:valid,
.auth-form.was-validated .auth-input .form-control:invalid,
.auth-input .form-control.is-valid,
.auth-input .form-control.is-invalid {
    background-image: none !important;
}

.auth-form.was-validated .auth-field:has(.form-control:valid) > .form-label::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--primary, #0f766e);
    margin-inline-start: 0.4rem;
    vertical-align: middle;
}

body.lang-ku .auth-form.was-validated .auth-field:has(.form-control:valid) > .form-label::after,
body.lang-ar .auth-form.was-validated .auth-field:has(.form-control:valid) > .form-label::after {
    margin-inline-start: 0;
    margin-inline-end: 0.4rem;
}

.auth-form.was-validated .auth-field:has(.form-control:invalid) > .form-label::after {
    content: "\f00d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    color: #dc2626;
    margin-inline-start: 0.4rem;
    vertical-align: middle;
}

body.lang-ku .auth-form.was-validated .auth-field:has(.form-control:invalid) > .form-label::after,
body.lang-ar .auth-form.was-validated .auth-field:has(.form-control:invalid) > .form-label::after {
    margin-inline-start: 0;
    margin-inline-end: 0.4rem;
}

/* ku/ar: field icons on the right; password eye swaps to the left */
body.lang-ku .auth-input__icon,
body.lang-ar .auth-input__icon {
    inset-inline-start: auto;
    inset-inline-end: 0.95rem;
    left: auto;
    right: 0.95rem;
}

body.lang-ku .auth-input__toggle,
body.lang-ar .auth-input__toggle {
    inset-inline-end: auto;
    inset-inline-start: 0.35rem;
    right: auto;
    left: 0.35rem;
}

body.lang-ku .auth-input .form-control,
body.lang-ar .auth-input .form-control {
    padding-left: 2.75rem;
    padding-right: 2.75rem;
    text-align: right;
}

body.lang-ku .auth-input:not(:has(.auth-input__toggle)) .form-control,
body.lang-ar .auth-input:not(:has(.auth-input__toggle)) .form-control {
    padding-left: 0.95rem;
}

.auth-submit {
    min-height: 50px;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
}

.auth-submit i {
    transition: transform 0.2s ease;
}

.auth-submit:hover i {
    transform: translateX(3px);
}

body.lang-ku .auth-submit:hover i,
body.lang-ar .auth-submit:hover i {
    transform: translateX(-3px);
}

.auth-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.auth-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.lang-switcher--auth {
    display: inline-flex;
    background: rgba(15, 118, 110, 0.08);
}

/* Forgot-password modal */
body.auth-modal-open {
    overflow: hidden;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.auth-modal[hidden] {
    display: none !important;
}

.auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(160deg, rgba(7, 40, 38, 0.72), rgba(15, 118, 110, 0.55)),
        rgba(11, 61, 58, 0.55);
    backdrop-filter: blur(6px);
}

.auth-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: 1.1rem;
    background: linear-gradient(165deg, #0F766E 0%, #0B3D3A 100%);
    border: 1px solid rgba(240, 253, 250, 0.12);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
    text-align: center;
    color: #F0FDFA;
    animation: authRise 0.28s ease-out both;
}

.auth-modal__title {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0 0 0.85rem;
    color: #fff;
}

.auth-modal__text {
    margin: 0 0 1.35rem;
    font-size: 0.95rem;
    line-height: 1.65;
    color: rgba(240, 253, 250, 0.88);
}

.auth-modal__btn {
    min-height: 46px;
    width: 100%;
    border-radius: 0.8rem;
    font-weight: 650;
    background: #fff !important;
    border-color: #fff !important;
    color: #0B3D3A !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.auth-modal__btn:hover {
    background: #F0FDFA !important;
    border-color: #F0FDFA !important;
    color: #0B3D3A !important;
}

@keyframes authRise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

@keyframes authPanelIn {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes authGlow {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(12px, -10px, 0) scale(1.08); }
}

@keyframes authEcg {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-hero {
        min-height: 42vh;
        padding: 2rem 1.5rem 2.5rem;
        text-align: center;
        align-items: center;
    }

    .auth-hero__content {
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .auth-hero__tagline {
        max-width: 18rem;
    }

    .auth-hero__logo {
        width: min(120px, 36vw);
        margin-bottom: 1rem;
    }

    .auth-hero__brand {
        font-size: clamp(1.9rem, 7vw, 2.4rem);
    }

    .auth-panel {
        padding: 1.75rem 1.25rem 2.5rem;
        animation-name: authRise;
    }
}

@media (max-width: 575.98px) {
    .auth-hero {
        min-height: auto;
        padding: 1.5rem 1.15rem 1.75rem;
    }

    .auth-form__meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Error pages */
.error-body {
    min-height: 100vh;
}

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.error-page__content {
    text-align: center;
    max-width: 480px;
}

.error-page__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-page__code {
    font-family: var(--font-display);
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.error-page__title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.error-page__text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ?????? Utilities ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state__icon {
    font-size: 3rem;
    color: var(--slate-300);
    margin-bottom: 1rem;
}

/* ?????? Responsive ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-main {
        margin-left: 0;
    }

    .topbar-search {
        width: auto;
        flex: 1;
        max-width: none;
    }

    .app-content {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .app-topbar {
        padding: 0 1rem;
    }

    .page-title {
        font-size: 1.375rem;
    }

    .error-page__code {
        font-size: 4.5rem;
    }
}

/* ?????? Print styles ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

@media print {
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .sidebar-backdrop,
    .global-loader,
    .toast-container,
    .btn,
    .no-print {
        display: none !important;
    }

    body.app-body {
        background: #FFFFFF !important;
        color: #000000 !important;
    }

    .app-main {
        margin-left: 0 !important;
    }

    .app-content {
        padding: 0 !important;
    }

    .app-card,
    .card {
        border: 1px solid #CCCCCC !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .table thead th {
        background: #F5F5F5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a[href]::after {
        content: none !important;
    }
}

/* i18n fonts per interface language */
body.lang-ku {
  font-family: var(--font-ku);
}

body.lang-ar {
  font-family: var(--font-ar);
}

body.lang-en {
  font-family: var(--font-en);
}

/* Text + form fields: RTL for Kurdish/Arabic, LTR for English (layout unchanged) */
body.lang-ku .app-content,
body.lang-ar .app-content,
body.lang-ku .app-footer,
body.lang-ar .app-footer,
body.lang-ku .modal-content,
body.lang-ar .modal-content,
body.lang-ku .dropdown-menu,
body.lang-ar .dropdown-menu {
  text-align: right;
}

/*
 * Sentence punctuation (. ? !) must follow RTL reading order.
 * html stays dir=ltr for layout, so KU/AR prose needs an isolated RTL base —
 * otherwise the period can render on the wrong side (looks like the start).
 */
body.lang-ku .app-toast__title,
body.lang-ku .app-toast__message,
body.lang-ku .form-text,
body.lang-ku .alert,
body.lang-ku .auth-alert,
body.lang-ku .empty-state h5,
body.lang-ku .empty-state p,
body.lang-ku .card-body > p,
body.lang-ku .modal-body > p,
body.lang-ku .page-header p,
body.lang-ku .invalid-feedback,
body.lang-ku .valid-feedback,
body.lang-ar .app-toast__title,
body.lang-ar .app-toast__message,
body.lang-ar .form-text,
body.lang-ar .alert,
body.lang-ar .auth-alert,
body.lang-ar .empty-state h5,
body.lang-ar .empty-state p,
body.lang-ar .card-body > p,
body.lang-ar .modal-body > p,
body.lang-ar .page-header p,
body.lang-ar .invalid-feedback,
body.lang-ar .valid-feedback {
  direction: rtl;
  unicode-bidi: isolate;
}

body.lang-en .app-content,
body.lang-en .app-footer,
body.lang-en .modal-content,
body.lang-en .dropdown-menu {
  text-align: left;
}

body.lang-ku .form-label,
body.lang-ku .col-form-label,
body.lang-ku .form-text,
body.lang-ku .form-check-label,
body.lang-ku .input-group-text,
body.lang-ku .card-title,
body.lang-ku .card-header,
body.lang-ku .page-title,
body.lang-ku .section-bar__title,
body.lang-ku .nav-tabs .nav-link,
body.lang-ku .table th,
body.lang-ku .table td,
body.lang-ku dt,
body.lang-ku dd,
body.lang-ar .form-label,
body.lang-ar .col-form-label,
body.lang-ar .form-text,
body.lang-ar .form-check-label,
body.lang-ar .input-group-text,
body.lang-ar .card-title,
body.lang-ar .card-header,
body.lang-ar .page-title,
body.lang-ar .section-bar__title,
body.lang-ar .nav-tabs .nav-link,
body.lang-ar .table th,
body.lang-ar .table td,
body.lang-ar dt,
body.lang-ar dd {
  text-align: right;
}

body.lang-ku .table th.col-user,
body.lang-ar .table th.col-user {
  text-align: center;
}

/* Card headers with title + action button flip for RTL */
body.lang-ku .card-header.d-flex.justify-content-between,
body.lang-ar .card-header.d-flex.justify-content-between {
  flex-direction: row-reverse;
}

/* RTL table column order: name first on the right for Kurdish/Arabic */
body.lang-ku .table,
body.lang-ar .table {
  direction: rtl;
}

body.lang-ku .table th.text-end,
body.lang-ku .table td.text-end,
body.lang-ar .table th.text-end,
body.lang-ar .table td.text-end {
  text-align: left;
}

body.lang-ku .table td a[href^="tel:"],
body.lang-ar .table td a[href^="tel:"],
body.lang-ku .table td code,
body.lang-ar .table td code,
body.lang-ku .table .cell-ltr,
body.lang-ar .table .cell-ltr {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

body.lang-ku .table th.col-age-gender,
body.lang-ku .table td.col-age-gender,
body.lang-ku .table th.col-blood,
body.lang-ku .table td.col-blood,
body.lang-ku .table th.col-phone,
body.lang-ku .table td.col-phone,
body.lang-ar .table th.col-age-gender,
body.lang-ar .table td.col-age-gender,
body.lang-ar .table th.col-blood,
body.lang-ar .table td.col-blood,
body.lang-ar .table th.col-phone,
body.lang-ar .table td.col-phone {
  text-align: right;
}

body.lang-ku .table td.col-phone,
body.lang-ar .table td.col-phone {
  direction: ltr;
  unicode-bidi: isolate;
}

body.lang-ku .form-control,
body.lang-ku .form-select,
body.lang-ku textarea.form-control,
body.lang-ku input[type="search"],
body.lang-ku input[type="text"],
body.lang-ku input[type="email"],
body.lang-ku input[type="tel"],
body.lang-ku input[type="password"],
body.lang-ku input[type="number"],
body.lang-ku input[type="url"],
body.lang-ku input[type="date"],
body.lang-ku input[type="datetime-local"],
body.lang-ku input[type="time"],
body.lang-ar .form-control,
body.lang-ar .form-select,
body.lang-ar textarea.form-control,
body.lang-ar input[type="search"],
body.lang-ar input[type="text"],
body.lang-ar input[type="email"],
body.lang-ar input[type="tel"],
body.lang-ar input[type="password"],
body.lang-ar input[type="number"],
body.lang-ar input[type="url"],
body.lang-ar input[type="date"],
body.lang-ar input[type="datetime-local"],
body.lang-ar input[type="time"] {
  direction: rtl;
  text-align: right;
}

/* Select chevron: opposite side of RTL text so it does not overlap */
body.lang-ku .form-select,
body.lang-ar .form-select {
  background-position: left 0.75rem center !important;
  padding-left: 2.5rem !important;
  padding-right: 0.875rem !important;
}

body.lang-ku .form-select-sm,
body.lang-ar .form-select-sm {
  background-position: left 0.5rem center !important;
  padding-left: 2rem !important;
  padding-right: 0.5rem !important;
}

body.lang-ku .form-select.is-invalid,
body.lang-ku .was-validated .form-select:invalid,
body.lang-ar .form-select.is-invalid,
body.lang-ar .was-validated .form-select:invalid {
  background-position: left 0.75rem center, center left 2.25rem !important;
  padding-left: 4.125rem !important;
}

body.lang-ku .form-select.is-valid,
body.lang-ku .was-validated .form-select:valid,
body.lang-ar .form-select.is-valid,
body.lang-ar .was-validated .form-select:valid {
  background-position: left 0.75rem center, center left 2.25rem !important;
  padding-left: 4.125rem !important;
}

body.lang-en .form-select {
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  padding-left: 0.875rem;
}

body.lang-en .form-select-sm {
  background-position: right 0.5rem center;
  padding-right: 2rem;
  padding-left: 0.5rem;
}

body.lang-ku .form-control::placeholder,
body.lang-ku .form-select::placeholder,
body.lang-ku textarea::placeholder,
body.lang-ar .form-control::placeholder,
body.lang-ar .form-select::placeholder,
body.lang-ar textarea::placeholder {
  text-align: right;
  direction: rtl;
  opacity: 0.75;
}

body.lang-en .form-control,
body.lang-en .form-select,
body.lang-en textarea.form-control {
  direction: ltr;
  text-align: left;
}

body.lang-en .form-control::placeholder,
body.lang-en textarea::placeholder {
  text-align: left;
  direction: ltr;
}

/* Keep intentionally centered UI centered */
body.lang-ku .text-center,
body.lang-ar .text-center,
body.lang-ku .bento-tile__text,
body.lang-ku .bento-tile__label,
body.lang-ar .bento-tile__text,
body.lang-ar .bento-tile__label,
body.lang-ku .empty-state,
body.lang-ar .empty-state,
body.lang-ku .dash-kpi,
body.lang-ar .dash-kpi,
body.lang-ku .stat-card,
body.lang-ar .stat-card {
  text-align: center !important;
}

/* Date/time inputs stay LTR for usable calendars */
body.lang-ku input[type="date"],
body.lang-ku input[type="time"],
body.lang-ku input[type="datetime-local"],
body.lang-ar input[type="date"],
body.lang-ar input[type="time"],
body.lang-ar input[type="datetime-local"] {
  direction: ltr;
  text-align: left;
}

.lang-switcher {
  display: inline-flex;
  gap: 0.25rem;
  background: var(--slate-100);
  border-radius: 999px;
  padding: 0.2rem;
}
.theme-dark .lang-switcher { background: rgba(255,255,255,0.08); }
.lang-switcher__btn {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.lang-switcher__btn.is-active,
.lang-switcher__btn:hover {
  background: var(--primary);
  color: #fff;
}
.lang-switcher--auth { display: flex; }

/* --- Dashboard launcher (fills viewport) --- */
.app-content--launcher .page-header { display: none; }

body.is-dashboard {
  overflow: hidden;
}
body.is-dashboard .app-main {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.is-dashboard .app-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.35rem 1rem;
  /* Scroll instead of squeezing the module cards when the window is short */
  overflow-x: hidden;
  overflow-y: auto;
}
body.is-dashboard .app-footer { display: none; }

.dash-launcher {
  flex: 1 0 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.dash-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
  padding: 1.1rem 1.35rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(15,118,110,0.12), rgba(255,255,255,0.85));
  border: 1px solid rgba(15,118,110,0.15);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.theme-dark .dash-hero {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(30, 41, 59, 0.92));
  border-color: rgba(45, 212, 191, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.dash-hero__title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 0.15rem;
  color: var(--text-primary);
}
.theme-dark .dash-hero__title {
  color: #f8fafc;
}
.dash-hero__sub { color: var(--text-secondary); font-size: 0.92rem; }
.theme-dark .dash-hero__sub {
  color: #94a3b8;
}
.dash-hero__actions { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }

.dash-hero-btn {
  --hero-btn-bg: #fff;
  --hero-btn-color: var(--primary, #0f766e);
  --hero-btn-border: rgba(15, 118, 110, 0.22);
  --hero-btn-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.35rem 1rem 0.35rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--hero-btn-border);
  background: var(--hero-btn-bg);
  color: var(--hero-btn-color);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  box-shadow: var(--hero-btn-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.theme-dark .dash-hero-btn {
  --hero-btn-bg: rgba(15, 23, 42, 0.65);
  --hero-btn-color: #5eead4;
  --hero-btn-border: rgba(45, 212, 191, 0.28);
  --hero-btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dash-hero-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.1);
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.18s ease, background 0.18s ease;
}

.theme-dark .dash-hero-btn__icon {
  background: rgba(45, 212, 191, 0.16);
}

.dash-hero-btn__icon i {
  display: block;
  margin: 0 !important;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
}

.dash-hero-btn__label {
  line-height: 1.2;
  padding-inline-end: 0.15rem;
}

.dash-hero-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.14);
  color: var(--hero-btn-color);
  border-color: rgba(15, 118, 110, 0.35);
}

.theme-dark .dash-hero-btn:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  border-color: rgba(45, 212, 191, 0.45);
  color: #99f6e4;
}

.dash-hero-btn:hover .dash-hero-btn__icon {
  transform: scale(1.06);
}

.dash-hero-btn:active {
  transform: translateY(0);
}

.dash-hero-btn--solid {
  --hero-btn-bg: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  --hero-btn-color: #fff;
  --hero-btn-border: transparent;
  --hero-btn-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
  background: var(--hero-btn-bg);
}

.theme-dark .dash-hero-btn--solid {
  --hero-btn-bg: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  --hero-btn-color: #f0fdfa;
  --hero-btn-shadow: 0 6px 18px rgba(15, 118, 110, 0.4);
}

.dash-hero-btn--solid .dash-hero-btn__icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.dash-hero-btn--solid:hover {
  --hero-btn-color: #fff;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.34);
  filter: brightness(1.03);
}

.dash-hero-btn--ghost {
  --hero-btn-bg: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
}

.dash-hero-btn--ghost:hover {
  background: #fff;
}

.theme-dark .dash-hero-btn--ghost {
  --hero-btn-bg: rgba(15, 23, 42, 0.55);
  --hero-btn-color: #5eead4;
  --hero-btn-border: rgba(45, 212, 191, 0.32);
  color: #5eead4;
  background: rgba(15, 23, 42, 0.55);
}

.theme-dark .dash-hero-btn--ghost:hover {
  background: rgba(15, 23, 42, 0.85);
  color: #99f6e4;
  border-color: rgba(45, 212, 191, 0.5);
}

.theme-dark .dash-hero-btn--ghost .dash-hero-btn__icon {
  background: rgba(45, 212, 191, 0.18);
  color: #5eead4;
}

.dash-hero-btn--success {
  --hero-btn-bg: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  --hero-btn-color: #fff;
  --hero-btn-border: transparent;
  --hero-btn-shadow: 0 6px 16px rgba(21, 128, 61, 0.28);
  background: var(--hero-btn-bg);
}

.dash-hero-btn--success .dash-hero-btn__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.dash-hero-btn--success:hover {
  --hero-btn-color: #fff;
  box-shadow: 0 10px 22px rgba(21, 128, 61, 0.36);
  filter: brightness(1.04);
  border-color: transparent;
}

.section-bar__actions .dash-hero-btn--success {
  --hero-btn-bg: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  --hero-btn-color: #fff;
  --hero-btn-border: transparent;
}

.section-bar__actions .dash-hero-btn--success:hover {
  background: linear-gradient(135deg, #166534 0%, #16a34a 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(21, 128, 61, 0.28);
}

.section-bar__actions .dash-hero-btn--success:hover .dash-hero-btn__icon {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* Prescription receipt (in-app show) — matched to purchase sheet */
.rx-receipt {
  --rx-primary: #0F766E;
  --rx-primary-dark: #0D5F58;
  --rx-soft: rgba(15, 118, 110, 0.08);
  --rx-ink: #0F172A;
  --rx-muted: #64748B;
  --rx-line: #E2E8F0;
  --rx-success: #059669;
  --rx-danger: #DC2626;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  border-radius: 1.15rem;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 22px 48px rgba(15, 23, 42, 0.1);
  overflow: hidden;
}

.theme-dark .rx-receipt {
  background: rgba(30, 41, 59, 0.95);
  --rx-ink: #f1f5f9;
  --rx-muted: #94a3b8;
  --rx-line: rgba(148, 163, 184, 0.22);
}

.rx-receipt__accent {
  height: 7px;
  background: linear-gradient(90deg, var(--rx-primary-dark), var(--rx-primary), #14B8A6);
}

.rx-receipt__body { padding: 1.75rem 1.85rem 2rem; }

.rx-receipt__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  padding-bottom: 1.35rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--rx-line);
}

.rx-receipt__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.rx-receipt__mark {
  width: 52px;
  height: 52px;
  border-radius: 0.9rem;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--rx-primary);
}

.rx-receipt__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  transform: scale(1.55);
  transform-origin: center;
}

.rx-receipt__clinic {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--rx-primary-dark);
  line-height: 1.25;
}

.theme-dark .rx-receipt__clinic { color: #5eead4; }

.rx-receipt__meta { text-align: end; }

.rx-receipt__title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--rx-ink);
}

.rx-receipt__no {
  display: inline-block;
  margin-bottom: 0.55rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--rx-soft);
  color: var(--rx-primary-dark);
  font-weight: 650;
  font-size: 0.88rem;
}

.theme-dark .rx-receipt__no { color: #5eead4; }

.rx-receipt__row {
  margin: 0.2rem 0;
  color: var(--rx-muted);
  font-size: 0.9rem;
}

.rx-receipt__row strong {
  color: var(--rx-ink);
  font-weight: 600;
}

.rx-receipt__parties {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rx-receipt__panel {
  border: 1px solid var(--rx-line);
  border-radius: 0.9rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #F8FAFC, #FFFFFF);
}

.theme-dark .rx-receipt__panel { background: rgba(15, 23, 42, 0.45); }

.rx-receipt__label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rx-muted);
}

.rx-receipt__name {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--rx-ink);
}

.rx-receipt__name a {
  color: inherit;
  text-decoration: none;
}

.rx-receipt__name a:hover { color: var(--rx-primary); }

.rx-receipt__line a {
  color: inherit;
  text-decoration: none;
  font-weight: 650;
}

.rx-receipt__line a:hover { color: var(--rx-primary); }

.rx-receipt__line {
  margin: 0.15rem 0;
  color: var(--rx-muted);
  font-size: 0.9rem;
}

.rx-receipt__line--meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.45rem;
  color: var(--rx-ink);
  font-size: 0.92rem;
}

.rx-receipt__meta-label {
  color: var(--rx-muted);
}

.rx-receipt__meta-value {
  font-weight: 650;
  direction: ltr;
  unicode-bidi: isolate;
}

body.lang-ku .rx-receipt__line--meta,
body.lang-ar .rx-receipt__line--meta {
  flex-direction: row;
  justify-content: flex-start;
}

.rx-receipt__pill {
  display: inline-flex;
  align-items: center;
  margin-top: 0.55rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
  background: rgba(220, 38, 38, 0.1);
  color: var(--rx-danger);
}

.rx-receipt__pill.is-received {
  background: rgba(5, 150, 105, 0.12);
  color: var(--rx-success);
}

.rx-receipt__pill.is-draft,
.rx-receipt__pill.is-partial,
.rx-receipt__pill.is-ordered {
  background: rgba(15, 118, 110, 0.1);
  color: var(--rx-primary-dark);
}

.theme-dark .rx-receipt__pill.is-draft,
.theme-dark .rx-receipt__pill.is-partial,
.theme-dark .rx-receipt__pill.is-ordered {
  color: #5eead4;
}

.rx-receipt__items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}

.rx-receipt__items th {
  padding: 0.5rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--rx-muted);
  background: #F8FAFC;
  border-bottom: 1px solid var(--rx-line);
  text-align: start;
}

.theme-dark .rx-receipt__items th { background: rgba(15, 23, 42, 0.55); }

.rx-receipt__items td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--rx-line);
  vertical-align: top;
  font-size: 0.86rem;
  color: var(--rx-ink);
}

.rx-receipt__items tr:last-child td { border-bottom: 0; }
.rx-receipt__items .num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.rx-receipt__items .idx {
  width: 2.5rem;
  color: var(--rx-muted);
  font-variant-numeric: tabular-nums;
}

.rx-receipt__empty {
  text-align: center;
  color: var(--rx-muted);
  padding: 1.5rem !important;
}

.rx-receipt__med { font-weight: 650; display: block; }
.rx-receipt__med-sub {
  display: block;
  margin-top: 0.2rem;
  color: var(--rx-muted);
  font-size: 0.82rem;
}

.rx-receipt__chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--rx-soft);
  color: var(--rx-primary-dark);
  font-size: 0.78rem;
  font-weight: 600;
}

.theme-dark .rx-receipt__chip { color: #5eead4; }

.rx-receipt__foot {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}

.rx-receipt__notes {
  border: 1px solid var(--rx-line);
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: #fff;
  min-height: 4.5rem;
  width: 100%;
}

.theme-dark .rx-receipt__notes { background: rgba(15, 23, 42, 0.35); }

.rx-receipt__notes-text {
  color: var(--rx-ink);
  font-size: 0.82rem;
  line-height: 1.4;
}

.rx-receipt__lines span {
  display: block;
  height: 1.05rem;
  border-bottom: 1px solid var(--rx-line);
  margin-bottom: 0.25rem;
}

.rx-receipt__sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  width: 100%;
}

.rx-receipt__sign-box {
  border: 1px solid var(--rx-line);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem 0.75rem;
  background: linear-gradient(180deg, #F8FAFC, #FFFFFF);
  min-height: 3.75rem;
}

.theme-dark .rx-receipt__sign-box { background: rgba(15, 23, 42, 0.45); }

.rx-receipt__sign-box .rx-receipt__label { margin-bottom: 1.1rem; }

.rx-receipt__sign-line {
  border-top: 1px solid #94A3B8;
  padding-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--rx-muted);
}

.rx-receipt__thanks {
  margin: 0.75rem 0 0;
  text-align: center;
  color: var(--rx-muted);
  font-size: 0.8rem;
}

body.lang-ku .rx-receipt__thanks,
body.lang-ar .rx-receipt__thanks {
  direction: rtl;
}

body.lang-ku .rx-receipt__parties,
body.lang-ar .rx-receipt__parties,
body.lang-ku .rx-receipt__panel,
body.lang-ar .rx-receipt__panel,
body.lang-ku .rx-receipt__notes,
body.lang-ar .rx-receipt__notes,
body.lang-ku .rx-receipt__meta,
body.lang-ar .rx-receipt__meta {
  direction: rtl;
  text-align: right;
}

body.lang-ku .rx-receipt__meta,
body.lang-ar .rx-receipt__meta { text-align: right; }

body.lang-ku .rx-receipt__panel,
body.lang-ar .rx-receipt__panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

body.lang-ku .rx-receipt__panel > *,
body.lang-ar .rx-receipt__panel > * {
  width: 100%;
  text-align: right;
}

body.lang-ku .rx-receipt__pill,
body.lang-ar .rx-receipt__pill {
  align-self: flex-end;
  width: auto;
}

body.lang-ku .rx-receipt__items,
body.lang-ar .rx-receipt__items { direction: rtl; }

body.lang-ku .rx-receipt__items th,
body.lang-ku .rx-receipt__items td,
body.lang-ar .rx-receipt__items th,
body.lang-ar .rx-receipt__items td { text-align: right; }

body.lang-ku .rx-receipt__items th.num,
body.lang-ku .rx-receipt__items td.num,
body.lang-ar .rx-receipt__items th.num,
body.lang-ar .rx-receipt__items td.num {
  text-align: left;
  direction: ltr;
  unicode-bidi: isolate;
}

body.lang-ku .rx-receipt__label,
body.lang-ar .rx-receipt__label {
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 720px) {
  .rx-receipt__parties { grid-template-columns: 1fr; }

  .rx-receipt__sign { grid-template-columns: 1fr; }

  .rx-receipt__meta { text-align: start; }

  body.lang-ku .rx-receipt__meta,
  body.lang-ar .rx-receipt__meta { text-align: right; }

  .rx-receipt__body { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .dash-hero-btn,
  .dash-hero-btn__icon {
    transition: none;
  }
  .dash-hero-btn:hover {
    transform: none;
  }
}

body.lang-ku .dash-hero,
body.lang-ar .dash-hero {
  direction: rtl;
  flex-direction: row;
  text-align: right;
}

body.lang-ku .dash-hero__text,
body.lang-ar .dash-hero__text {
  text-align: right;
}

body.lang-ku .dash-hero__actions,
body.lang-ar .dash-hero__actions {
  flex-direction: row;
}

body.lang-en .dash-hero {
  direction: ltr;
  text-align: left;
}

body.lang-en .dash-hero__text {
  text-align: left;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  flex-shrink: 0;
}
@media (max-width: 991.98px) {
  .dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dash-kpi {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-radius: 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  min-height: 92px;
}
.dash-kpi__icon {
  width: 2.85rem; height: 2.85rem;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
  font-size: 1.15rem;
}
.dash-kpi__value { font-weight: 700; font-size: 1.45rem; line-height: 1.2; }
.dash-kpi__money {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.dash-kpi__money-usd {
  letter-spacing: -0.02em;
}
.dash-kpi__money-divider {
  width: 1px;
  height: 1.05em;
  background: currentColor;
  opacity: 0.22;
  flex-shrink: 0;
  border-radius: 1px;
}
.dash-kpi__money-iqd {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  padding: 0.18rem 0.5rem;
  border-radius: 0.45rem;
  background: rgba(15, 118, 110, 0.1);
  color: var(--primary-dark, #0d5f58);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}
.dash-kpi.tone-green .dash-kpi__money-iqd {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
}
.dash-kpi__money-unit {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}
.dash-kpi__label { font-size: 0.78rem; color: var(--text-secondary); }
.dash-kpi.tone-green {
  align-items: center;
  gap: 0.65rem;
}
.dash-kpi.tone-green .dash-kpi__icon {
  margin-top: 0;
}
.dash-kpi.tone-green .dash-kpi__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.dash-kpi.tone-green .dash-kpi__label {
  line-height: 1.25;
  margin: 0;
}

/* Uniform module cards: as many ~160px columns as fit; rows fill the screen
   when there is room but never shrink below a comfortable card height. */
.clinic-bento {
  flex: 1 0 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  grid-auto-rows: minmax(128px, 1fr);
  gap: 0.9rem;
  align-content: stretch;
  padding: 0.15rem 0.1rem 0.35rem;
}
@media (min-width: 1700px) {
  .clinic-bento {
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    grid-auto-rows: minmax(138px, 1fr);
  }
}
@media (max-width: 767.98px) {
  body.is-dashboard { overflow: auto; }
  body.is-dashboard .app-main,
  body.is-dashboard .app-content { height: auto; overflow: visible; }
  .clinic-bento {
    flex: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    min-height: auto;
    overflow-y: visible;
  }
  .bento-tile {
    aspect-ratio: 1;
    height: auto;
    min-height: 0;
  }
}

.bento-tile {
  --tile-color: #0f766e;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  height: 100%;
  min-height: 128px;
  padding: 1rem 0.85rem 0.9rem;
  text-decoration: none;
  color: var(--tile-color);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--tile-color) 9%, transparent) 0%, transparent 60%),
    rgba(255, 255, 255, 0.92);
  border: 2px solid color-mix(in srgb, var(--tile-color) 70%, transparent);
  border-radius: 1.15rem;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  animation: bentoIn 0.45s ease both;
  animation-delay: var(--delay, 0ms);
}
.theme-dark .bento-tile {
  background: rgba(30, 41, 59, 0.72);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}
.bento-tile:hover {
  transform: translateY(-3px);
  background: #fff;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--tile-color) 28%, transparent);
  color: var(--tile-color);
}
.theme-dark .bento-tile:hover {
  background: rgba(30, 41, 59, 0.9);
}

/* Icon sits in the flex flow above the label, sized to the row height so it never gets clipped */
.bento-tile__bg {
  position: relative;
  z-index: 0;
  flex: 0 0 auto;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bento-tile__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.95rem;
  color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tile-color) 88%, #000) 0%, var(--tile-color) 55%, color-mix(in srgb, var(--tile-color) 70%, #fff) 100%);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--tile-color) 35%, transparent);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  animation: bentoDrift 6s ease-in-out infinite;
  animation-delay: var(--drift, 0s);
}
.theme-dark .bento-tile__icon-wrap {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}
.bento-tile__icon-wrap i {
  font-size: 1.45rem;
  color: #fff;
  line-height: 1;
}
.bento-tile:hover .bento-tile__icon-wrap {
  animation-play-state: paused;
  transform: scale(1.08);
  box-shadow: 0 10px 20px color-mix(in srgb, var(--tile-color) 45%, transparent);
}

.bento-tile__text {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
}
.bento-tile__label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: center;
  word-break: break-word;
  color: #0f172a;
}
.theme-dark .bento-tile__label {
  color: #f1f5f9;
}

/* Border / accent colors only */
.bento-tile--patients,
.bento-tile--profile { --tile-color: #0f766e; }
.bento-tile--doctors { --tile-color: #0284c7; }
.bento-tile--appointments { --tile-color: #4f46e5; }
.bento-tile--calendar { --tile-color: #0891b2; }
.bento-tile--queue { --tile-color: #d97706; }
.bento-tile--medical_records { --tile-color: #16a34a; }
.bento-tile--medicines { --tile-color: #e11d48; }
.bento-tile--inventory { --tile-color: #ea580c; }
.bento-tile--purchasing { --tile-color: #0d9488; }
.bento-tile--purchase_receipts,
.bento-tile--bought_items { --tile-color: #059669; }
.bento-tile--companies { --tile-color: #2563eb; }
.bento-tile--representatives { --tile-color: #ca8a04; }
.bento-tile--clinic_services { --tile-color: #2563eb; }
.bento-tile--payments { --tile-color: #16a34a; }
.bento-tile--invoices { --tile-color: #65a30d; }
.bento-tile--expenses { --tile-color: #ea580c; }
.bento-tile--reports { --tile-color: #0891b2; }
.bento-tile--users,
.bento-tile--backup,
.bento-tile--settings { --tile-color: #64748b; }
.bento-tile--laboratory { --tile-color: #7c3aed; }
.bento-tile--prescriptions { --tile-color: #db2777; }
.bento-tile--departments { --tile-color: #0369a1; }
.bento-tile--staff { --tile-color: #9333ea; }
.bento-tile--audit { --tile-color: #475569; }
.bento-tile--help { --tile-color: #0d9488; }

/* ===================== User guide (/help) ===================== */
.help { --help-accent: #0f766e; --help-soft: rgba(15, 118, 110, 0.08); display: grid; gap: 1.25rem; }
.help-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem;
  padding: 1.5rem 1.6rem; border-radius: 1.1rem;
  background: linear-gradient(135deg, rgba(15,118,110,.12), rgba(20,184,166,.05) 60%, rgba(255,255,255,.6));
  border: 1px solid rgba(15,118,110,.18);
}
.help-hero__text { display: flex; gap: 1rem; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.help-hero__icon { width: 3.4rem; height: 3.4rem; border-radius: 1rem; flex: none; display: grid; place-items: center; color: #fff; font-size: 1.5rem;
  background: linear-gradient(160deg, #0d5f58, #0f766e 55%, #14b8a6); box-shadow: 0 8px 18px rgba(15,118,110,.3); }
.help-hero__title { margin: 0 0 .3rem; font-size: 1.45rem; font-weight: 800; color: #0f172a; }
.help-hero__sub { margin: 0 0 .55rem; color: #475569; max-width: 60ch; line-height: 1.6; }
.help-role { display: inline-flex; gap: .4rem; align-items: center; font-size: .85rem; color: var(--help-accent); background: #fff; border: 1px solid rgba(15,118,110,.2); border-radius: 999px; padding: .2rem .7rem; }
.help-search { position: relative; flex: 1 1 320px; max-width: 460px; margin: 0; }
.help-search i { position: absolute; top: 50%; inset-inline-start: 1rem; transform: translateY(-50%); color: #64748b; }
.help-search input { height: 3rem; border-radius: 999px; padding-inline: 2.6rem 1rem; border: 1px solid rgba(15,118,110,.25); box-shadow: 0 4px 14px rgba(15,23,42,.05); }

.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.help-toc { position: sticky; top: 1rem; display: grid; gap: .15rem; padding: .9rem; border-radius: 1rem; background: rgba(255,255,255,.85); border: 1px solid #e2e8f0; max-height: calc(100vh - 2rem); overflow: auto; }
.help-toc__title { font-size: .78rem; font-weight: 700; color: #64748b; padding: .2rem .5rem .5rem; }
.help-toc a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: .6rem; color: #334155; text-decoration: none; font-size: .92rem; font-weight: 500; }
.help-toc a i { width: 1.1rem; text-align: center; color: var(--help-accent); }
.help-toc a:hover { background: var(--help-soft); }
.help-toc a.is-active { background: var(--help-soft); color: var(--help-accent); font-weight: 700; }
.help-toc a.is-locked { opacity: .55; }
.help-main { display: grid; gap: 1rem; min-width: 0; }
.help-empty { margin: 0; padding: 1rem 1.2rem; border-radius: .9rem; background: #fff; border: 1px dashed #cbd5e1; color: #475569; }

.help-card { scroll-margin-top: 1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 1.1rem; padding: 1.3rem 1.4rem; box-shadow: 0 6px 18px rgba(15,23,42,.04); }
.help-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.help-card__title { display: flex; align-items: center; gap: .7rem; margin: 0; font-size: 1.2rem; font-weight: 800; color: #0f172a; }
.help-card__icon { width: 2.4rem; height: 2.4rem; border-radius: .75rem; display: grid; place-items: center; background: var(--help-soft); color: var(--help-accent); flex: none; }
.help-card__intro { margin: .7rem 0 0; color: #475569; line-height: 1.7; max-width: 75ch; }
.help-sub { margin: 1.1rem 0 .5rem; font-size: .9rem; font-weight: 700; color: var(--help-accent); }
.help-locked { font-size: .82rem; color: #64748b; background: #f1f5f9; border-radius: 999px; padding: .25rem .75rem; }
.help-open { border-radius: 999px; }

.help-steps { counter-reset: step; list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .55rem; }
.help-steps li { counter-increment: step; position: relative; padding-inline-start: 2.6rem; line-height: 1.7; color: #1e293b; }
.help-steps li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: .05rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .85rem; font-weight: 700; color: #fff; background: var(--help-accent); }

.help-example { margin-top: 1rem; padding: .9rem 1.1rem; border-radius: .9rem; background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 1px solid #fde68a; }
.help-example__title { font-weight: 700; color: #92400e; margin-bottom: .35rem; display: flex; gap: .45rem; align-items: center; }
.help-example p { margin: .3rem 0 0; color: #422006; line-height: 1.7; }

.help-tips { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .45rem; }
.help-tips li { display: flex; gap: .6rem; align-items: flex-start; color: #334155; line-height: 1.65; font-size: .95rem; }
.help-tips i { color: #0284c7; margin-top: .3rem; }

.help-card--walk { background: linear-gradient(180deg, #f0fdfa, #fff 40%); border-color: rgba(15,118,110,.25); }
.help-timeline { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .1rem; position: relative; }
.help-timeline li { display: grid; grid-template-columns: 2.4rem 1fr; gap: .9rem; position: relative; padding-bottom: .9rem; }
.help-timeline li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 1.15rem; top: 2.4rem; bottom: 0; width: 2px; background: rgba(15,118,110,.2); }
.help-timeline__n { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(160deg, #0d5f58, #14b8a6); box-shadow: 0 4px 10px rgba(15,118,110,.3); }
.help-who { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--help-accent); background: var(--help-soft); border-radius: 999px; padding: .15rem .65rem; margin-top: .45rem; }
.help-timeline p { margin: .35rem 0 0; line-height: 1.7; color: #1e293b; }

.help-faq { display: grid; gap: .6rem; margin-top: 1rem; }
.help-faq details { border: 1px solid #e2e8f0; border-radius: .85rem; padding: .8rem 1rem; background: #f8fafc; }
.help-faq summary { cursor: pointer; font-weight: 700; color: #0f172a; }
.help-faq details[open] { background: #fff; border-color: rgba(15,118,110,.3); }
.help-faq details p { margin: .55rem 0 0; color: #475569; line-height: 1.7; }

.help[dir="rtl"] { text-align: right; }
.help[dir="rtl"] .help-search input { text-align: right; }

[data-theme="dark"] .help-hero, .theme-dark .help-hero { background: linear-gradient(135deg, rgba(20,184,166,.14), rgba(30,41,59,.85)); border-color: rgba(94,234,212,.2); }
[data-theme="dark"] .help-card, .theme-dark .help-card,
[data-theme="dark"] .help-toc, .theme-dark .help-toc { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .help-hero__title, [data-theme="dark"] .help-card__title, [data-theme="dark"] .help-steps li, [data-theme="dark"] .help-timeline p, [data-theme="dark"] .help-faq summary,
.theme-dark .help-hero__title, .theme-dark .help-card__title, .theme-dark .help-steps li, .theme-dark .help-timeline p, .theme-dark .help-faq summary { color: #f1f5f9; }
[data-theme="dark"] .help-card__intro, [data-theme="dark"] .help-hero__sub, [data-theme="dark"] .help-tips li, [data-theme="dark"] .help-toc a,
.theme-dark .help-card__intro, .theme-dark .help-hero__sub, .theme-dark .help-tips li, .theme-dark .help-toc a { color: #cbd5e1; }
[data-theme="dark"] .help-faq details, .theme-dark .help-faq details { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .help-card--walk, .theme-dark .help-card--walk { background: linear-gradient(180deg, rgba(20,184,166,.1), #1e293b 40%); }

@media (max-width: 991.98px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .help-toc__title { grid-column: 1 / -1; }
}
@media print {
  .help-toc, .help-search, .help-open, .help-locked, .app-topbar, .section-bar { display: none !important; }
  .help-layout { grid-template-columns: 1fr; }
  .help-card { break-inside: avoid; box-shadow: none; }
  .help-faq details { display: block; }
}

@keyframes bentoIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes bentoDrift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .bento-tile { animation: none; }
  .bento-tile__icon-wrap { animation: none; }
}
.dash-secondary-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}
@media (max-width: 991.98px) {
  .dash-secondary-grid { grid-template-columns: 1fr; }
}
.activity-list__item + .activity-list__item {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}
.smaller { font-size: 0.75rem; }

/* Reports hub */
.reports-hub {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.reports-hub__intro {
  padding: 1rem 1.15rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(15, 118, 110, 0.12);
}
.theme-dark .reports-hub__intro {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(30, 41, 59, 0.9));
}
.reports-hub__title {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.reports-hub__sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
@media (max-width: 767.98px) {
  .reports-grid { grid-template-columns: 1fr; }
}
.report-card {
  --report-accent: #0f766e;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  min-height: 110px;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: 1.15rem;
  border: 1px solid color-mix(in srgb, var(--report-accent) 18%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--report-accent) 10%, #fff), #fff 55%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: reportCardIn 0.4s ease both;
  animation-delay: var(--delay, 0ms);
  overflow: hidden;
}
.theme-dark .report-card {
  background: linear-gradient(135deg, color-mix(in srgb, var(--report-accent) 18%, transparent), rgba(30, 41, 59, 0.92));
}
.report-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--report-accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--report-accent) 35%, transparent);
  color: var(--text-primary);
}
.report-card__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--report-accent);
  background: color-mix(in srgb, var(--report-accent) 14%, #fff);
  flex-shrink: 0;
}
.theme-dark .report-card__icon {
  background: color-mix(in srgb, var(--report-accent) 24%, transparent);
}
.report-card__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.report-card__title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}
.report-card__desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
.report-card__go {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--report-accent);
  white-space: nowrap;
}
.report-card--teal { --report-accent: #0f766e; }
.report-card--cyan { --report-accent: #0891b2; }
.report-card--green { --report-accent: #16a34a; }
.report-card--orange { --report-accent: #ea580c; }
.report-card--indigo { --report-accent: #4f46e5; }

@keyframes reportCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .report-card { animation: none; }
}

body.lang-ku .reports-hub,
body.lang-ar .reports-hub {
  direction: rtl;
  text-align: right;
}

body.lang-ku .report-card,
body.lang-ar .report-card {
  direction: rtl;
  text-align: right;
}

body.lang-ku .report-card__body,
body.lang-ar .report-card__body {
  text-align: right;
}

body.lang-ku .report-card__go,
body.lang-ar .report-card__go {
  flex-direction: row-reverse;
}

body.lang-ku .report-card__go .fa-arrow-right,
body.lang-ar .report-card__go .fa-arrow-right {
  transform: scaleX(-1);
}






/* -- Patient visit timeline -- */
.history-patient-card__identity {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.history-patient-card__avatar {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 6px 16px var(--primary-glow);
}

.history-patient-card__text {
    flex: 0 1 auto;
    min-width: 0;
}

.history-patient-card__name {
    margin: 0;
    line-height: 1.3;
    text-align: start;
}

.history-patient-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
}

.history-allergy-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    max-width: min(100%, 18rem);
    min-height: 2.35rem;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    border-radius: 999px;
    border: 1px solid rgba(217, 119, 6, 0.28);
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
    box-shadow: 0 1px 2px rgba(146, 64, 14, 0.08);
}

.history-allergy-pill__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: #d97706;
    color: #fff;
    font-size: 0.72rem;
    box-shadow: 0 3px 8px rgba(217, 119, 6, 0.28);
}

.history-allergy-pill__body {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    line-height: 1.2;
    padding-inline-end: 0.15rem;
}

.history-allergy-pill__label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #b45309;
    flex-shrink: 0;
}

.history-allergy-pill__sep {
    font-size: 0.78rem;
    font-weight: 700;
    color: #b45309;
    flex-shrink: 0;
}

.history-allergy-pill__value {
    font-size: 0.84rem;
    font-weight: 700;
    color: #78350f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.lang-ku .history-allergy-pill,
body.lang-ar .history-allergy-pill {
    flex-direction: row-reverse;
    padding: 0.3rem 0.3rem 0.3rem 0.75rem;
}

body.lang-ku .history-allergy-pill__body,
body.lang-ar .history-allergy-pill__body {
    flex-direction: row;
    direction: rtl;
}

.theme-dark .history-allergy-pill {
    background: rgba(217, 119, 6, 0.16);
    border-color: rgba(251, 191, 36, 0.28);
    color: #fbbf24;
}

.theme-dark .history-allergy-pill__label {
    color: #fcd34d;
}

.theme-dark .history-allergy-pill__value {
    color: #fde68a;
}

.visit-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-block: 0.25rem;
}

.visit-timeline__item {
    display: grid;
    grid-template-columns: 1.5rem 1fr;
    gap: 0.85rem 1rem;
    animation: visitTimelineIn 0.35s ease both;
    animation-delay: calc(var(--i, 0) * 0.05s);
}

.visit-timeline__rail {
    position: relative;
    display: flex;
    justify-content: center;
}

.visit-timeline__rail::before {
    content: "";
    position: absolute;
    top: 0.85rem;
    bottom: -0.15rem;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-light), var(--slate-200));
    border-radius: 999px;
}

.visit-timeline__item:last-child .visit-timeline__rail::before {
    display: none;
}

.visit-timeline__dot {
    position: relative;
    z-index: 1;
    width: 0.85rem;
    height: 0.85rem;
    margin-top: 1.15rem;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2.5px solid var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.visit-timeline__card {
    background: var(--slate-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-bottom: 0.85rem;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.visit-timeline__card:hover {
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.theme-dark .visit-timeline__card {
    background: rgba(255, 255, 255, 0.03);
}
.visit-timeline__top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    margin-bottom: 0.65rem;
    direction: ltr;
    text-align: left;
}
.visit-timeline__identity {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}
.visit-timeline__visit-no {
    display: inline-block;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.01em;
    text-align: left;
}
.visit-timeline__visit-no:hover {
    color: var(--primary);
}
.visit-timeline__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.95rem;
    margin-top: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.visit-timeline__meta i {
    color: var(--primary);
    margin-inline-end: 0.3rem;
    opacity: 0.85;
}
.visit-timeline__complaint {
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.45;
}
.visit-timeline__complaint-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}
.visit-timeline__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

@keyframes visitTimelineIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.timeline-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.1rem;
    padding: 0.28rem 0.85rem 0.28rem 0.3rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.timeline-action-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    flex-shrink: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 0.7rem;
}

.timeline-action-btn__label {
    padding-inline-end: 0.1rem;
}

.timeline-action-btn--view {
    background: linear-gradient(180deg, #f0fdfa 0%, #ccfbf1 100%);
    border-color: rgba(15, 118, 110, 0.22);
    color: #0f766e;
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.08);
}

.timeline-action-btn--view .timeline-action-btn__icon {
    background: #0f766e;
    box-shadow: 0 3px 8px rgba(15, 118, 110, 0.28);
}

.timeline-action-btn--view:hover {
    color: #0d5f58;
    border-color: rgba(15, 118, 110, 0.4);
    background: linear-gradient(180deg, #ccfbf1 0%, #99f6e4 100%);
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.16);
    transform: translateY(-1px);
    text-decoration: none;
}

.timeline-action-btn--create {
    background: linear-gradient(180deg, #f0fdfa 0%, #ccfbf1 100%);
    border-color: rgba(15, 118, 110, 0.22);
    color: #0f766e;
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.08);
}

.timeline-action-btn--create .timeline-action-btn__icon {
    background: #0f766e;
    box-shadow: 0 3px 8px rgba(15, 118, 110, 0.28);
}

.timeline-action-btn--create:hover {
    color: #0d5f58;
    border-color: rgba(15, 118, 110, 0.4);
    background: linear-gradient(180deg, #ccfbf1 0%, #99f6e4 100%);
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.16);
    transform: translateY(-1px);
    text-decoration: none;
}

.timeline-action-btn--rx {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: rgba(2, 132, 199, 0.22);
    color: #0369a1;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08);
}

.timeline-action-btn--rx .timeline-action-btn__icon {
    background: #0284c7;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.28);
}

.timeline-action-btn--rx:hover {
    color: #075985;
    border-color: rgba(2, 132, 199, 0.4);
    background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.16);
    transform: translateY(-1px);
    text-decoration: none;
}

.timeline-action-btn:active {
    transform: translateY(0);
}

body.lang-ku .timeline-action-btn,
body.lang-ar .timeline-action-btn {
    flex-direction: row-reverse;
    padding: 0.28rem 0.3rem 0.28rem 0.85rem;
}

.theme-dark .timeline-action-btn--view,
.theme-dark .timeline-action-btn--create {
    background: rgba(15, 118, 110, 0.16);
    border-color: rgba(45, 212, 191, 0.28);
    color: #5eead4;
}

.theme-dark .timeline-action-btn--rx {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
}

@media (prefers-reduced-motion: reduce) {
    .visit-timeline__item { animation: none; }
    .visit-timeline__card:hover { transform: none; }
    .timeline-action-btn:hover { transform: none; }
}
@media (max-width: 575.98px) {
    .visit-timeline__card { padding: 0.85rem; }
    .visit-timeline__actions .timeline-action-btn { flex: 1 1 auto; justify-content: center; }
}

/* -- Patient emergency contact cards -- */
.contact-card {
    height: 100%;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--slate-50);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.contact-card:hover {
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.contact-card--primary {
    border-color: rgba(15, 118, 110, 0.28);
    background: linear-gradient(160deg, rgba(15, 118, 110, 0.08) 0%, var(--slate-50) 55%);
    box-shadow: inset 3px 0 0 var(--primary);
}
.theme-dark .contact-card {
    background: rgba(255, 255, 255, 0.03);
}
.theme-dark .contact-card--primary {
    background: linear-gradient(160deg, rgba(15, 118, 110, 0.18) 0%, rgba(255, 255, 255, 0.03) 55%);
}
.contact-card__head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}
.contact-card__avatar {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 4px 12px var(--primary-glow);
}
.contact-card__titles {
    flex: 1 1 auto;
    min-width: 0;
}
.contact-card__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    direction: ltr;
}
.contact-card__name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-align: left;
    line-height: 1.3;
}
.contact-card__badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--primary-dark);
    background: var(--primary-soft);
    white-space: nowrap;
}
.contact-card__relation {
    margin-top: 0.3rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: start;
}
.contact-card__details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.contact-card__row {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.45rem;
    margin-inline: -0.45rem;
    transition: background var(--transition), color var(--transition);
}
.contact-card__row:hover {
    background: var(--bg-card);
    color: var(--primary);
}
.contact-card__icon {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.45rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--primary);
    background: var(--primary-soft);
}
@media (prefers-reduced-motion: reduce) {
    .contact-card:hover { transform: none; }
}

body.lang-ku .patient-contacts-grid,
body.lang-ar .patient-contacts-grid {
    direction: rtl;
}

body.lang-ku .contact-card,
body.lang-ar .contact-card {
    direction: ltr;
    text-align: left;
}

body.lang-ku .contact-card--primary,
body.lang-ar .contact-card--primary {
    box-shadow: inset 3px 0 0 var(--primary);
}

body.lang-ku .contact-card__head,
body.lang-ar .contact-card__head {
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 0.85rem;
}

body.lang-ku .contact-card__titles,
body.lang-ar .contact-card__titles {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    text-align: left;
    min-width: 0;
}

body.lang-ku .contact-card__title-row,
body.lang-ar .contact-card__title-row {
    direction: ltr;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
}

body.lang-ku .contact-card__name,
body.lang-ar .contact-card__name {
    text-align: left;
}

body.lang-ku .contact-card__badge,
body.lang-ar .contact-card__badge {
    margin-inline-start: auto;
}

body.lang-ku .contact-card__relation,
body.lang-ar .contact-card__relation {
    text-align: left;
    width: auto;
    max-width: 100%;
    align-self: flex-start;
}

body.lang-ku .contact-card__details,
body.lang-ar .contact-card__details {
    padding-inline-start: 0;
    align-items: flex-start;
}

body.lang-ku .contact-card__row,
body.lang-ar .contact-card__row {
    flex-direction: row;
    justify-content: flex-start;
    width: auto;
    max-width: 100%;
}

/* -- Patient profile overview -- */
.patient-profile-card__hero {
    text-align: center;
    padding-bottom: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.patient-profile-card__photo,
.patient-profile-card__avatar {
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 1.25rem;
    object-fit: cover;
    margin: 0 auto 0.9rem;
    display: grid;
    place-items: center;
}
.patient-profile-card__avatar {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 10px 24px var(--primary-glow);
}
.patient-profile-card__photo {
    display: block;
    border: 3px solid #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}
.patient-profile-card__name {
    margin: 0 0 0.25rem;
    font-weight: 700;
    font-size: 1.25rem;
}
.patient-profile-card__mrn {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.patient-profile-card__facts {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.patient-fact {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    text-align: left;
}
.patient-fact > div {
    flex: 1 1 auto;
    min-width: 0;
}
body.lang-ku .patient-fact,
body.lang-ar .patient-fact {
    flex-direction: row-reverse;
    text-align: right;
}
.patient-fact__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-soft);
}
.patient-fact__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.1rem;
}
.patient-fact__value {
    display: block;
    font-size: 0.92rem;
    color: var(--text-primary);
    text-decoration: none;
    word-break: break-word;
}
a.patient-fact__value:hover { color: var(--primary); }

.patient-fact__value--chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.patient-fact__chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    background: var(--slate-100);
    border: 1px solid var(--border-color);
    text-decoration: none;
    max-width: 100%;
    overflow-wrap: anywhere;
}

a.patient-fact__chip--link:hover {
    color: var(--primary);
    border-color: rgba(15, 118, 110, 0.35);
    background: var(--primary-soft);
}

body.lang-ku .patient-fact__value--chips,
body.lang-ar .patient-fact__value--chips {
    justify-content: flex-end;
}

.theme-dark .patient-fact__chip {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.patient-alert-card {
    border-color: rgba(217, 119, 6, 0.35) !important;
    overflow: hidden;
}
.patient-alert-card__header {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.28), rgba(245, 158, 11, 0.12));
    border-bottom: 1px solid rgba(217, 119, 6, 0.2);
}
.patient-alert-card__header .card-title {
    color: #92400e;
    font-size: 0.95rem;
    font-weight: 700;
}
.theme-dark .patient-alert-card__header .card-title { color: #fbbf24; }
.patient-alert-item + .patient-alert-item {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(217, 119, 6, 0.25);
}
.patient-alert-item__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b45309;
    margin-bottom: 0.2rem;
}
.patient-alert-item__value {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.45;
}

.info-panel {
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--slate-50);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.info-panel:hover {
    border-color: rgba(15, 118, 110, 0.3);
    box-shadow: var(--shadow-sm);
}
.theme-dark .info-panel {
    background: rgba(255, 255, 255, 0.03);
}
.info-panel__head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.9rem 1.05rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}
.info-panel__icon {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.55rem;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 0.85rem;
}
.info-panel__title {
    font-size: 0.95rem;
    font-weight: 700;
}
.info-panel__body {
    padding: 1rem 1.05rem;
}
.info-panel__lead {
    font-weight: 600;
    color: var(--text-primary);
}
.info-panel__row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.info-panel__row + .info-panel__row {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}
.info-panel__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.info-panel__value {
    font-size: 0.92rem;
    color: var(--text-primary);
}

/* -- Patient profile tabs -- */
.patient-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    border-bottom: none !important;
    padding: 0.35rem;
    border-radius: var(--radius-md);
    background: var(--slate-100);
}
.theme-dark .patient-tabs {
    background: rgba(255, 255, 255, 0.05);
}
.patient-tabs .nav-item {
    margin-bottom: 0;
}
.patient-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0 !important;
    border-radius: 0.65rem !important;
    padding: 0.55rem 0.9rem;
    color: var(--text-secondary);
    font-weight: 650;
    font-size: 0.9rem;
    background: transparent;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.patient-tabs .nav-link i {
    font-size: 0.8rem;
    opacity: 0.85;
}
.patient-tabs .nav-link:hover {
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.7);
}
.theme-dark .patient-tabs .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary-light);
}
.patient-tabs .nav-link.active {
    color: #fff !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%) !important;
    box-shadow: 0 6px 14px var(--primary-glow);
}
.patient-tabs .nav-link.active i {
    opacity: 1;
}
.patient-tabs__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.08);
    color: inherit;
}
.patient-tabs .nav-link.active .patient-tabs__count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

body.lang-ku .patient-tabs,
body.lang-ar .patient-tabs {
    justify-content: flex-start;
    direction: rtl;
    flex-direction: row;
    margin-inline-start: auto;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: 0;
}
body.lang-ku .patient-tabs .nav-link,
body.lang-ar .patient-tabs .nav-link {
    flex-direction: row;
}

/* Purchase order create modal */
#createPoModal .modal-dialog {
    max-height: calc(100vh - 1.5rem);
    margin: 0.75rem auto;
}
.po-modal {
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    max-height: calc(100vh - 1.5rem);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}
.po-modal > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    max-height: 100%;
}
.po-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--border-color, #e2e8f0) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    position: relative;
    z-index: 2;
}
.theme-dark .po-modal__header {
    background: var(--bg-card, #1e293b);
    border-bottom-color: var(--border-color, #334155) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.po-modal__title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.po-modal__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary, #0f766e);
    flex-shrink: 0;
}
.po-modal__subtitle {
    margin-top: 0.2rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.45;
    max-width: 28rem;
}
/* KU/AR: swap — close left, title right */
body.lang-ku .po-modal__header,
body.lang-ar .po-modal__header {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: flex-start;
}
body.lang-ku .po-modal__title-wrap,
body.lang-ar .po-modal__title-wrap {
    flex-direction: row-reverse;
    text-align: right;
    flex: 0 1 auto;
}
body.lang-ku .po-modal__header .btn-close,
body.lang-ar .po-modal__header .btn-close {
    flex-shrink: 0;
    margin: 0.15rem 0 0;
}
body.lang-ku .po-modal__subtitle,
body.lang-ar .po-modal__subtitle {
    max-width: 22rem;
}
.po-modal__body {
    padding: 0.75rem 1.5rem 1rem;
    overflow-y: auto !important;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
.po-modal__footer {
    justify-content: center;
    padding: 1rem 1.5rem 1.35rem;
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid var(--border-color, #e2e8f0) !important;
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.06);
    position: relative;
    z-index: 2;
}
.theme-dark .po-modal__footer {
    background: var(--bg-card, #1e293b);
    border-top-color: var(--border-color, #334155) !important;
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.25);
}
.po-section {
    margin-bottom: 1.15rem;
    padding: 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.85rem;
    background: var(--bg-card, #fff);
}
.po-section--medicine {
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.04), transparent);
}
.po-section__title {
    margin: 0 0 0.85rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-secondary, #64748b);
}
.po-source-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
body.lang-en .po-source-grid > .po-source-card--company { order: 1; }
body.lang-en .po-source-grid > .po-source-card--representative { order: 2; }

/* Expenses create/edit: Category left, Title right (match KU/AR visual) */
body.lang-en .expense-f-category { order: -1; }

/* EN only: date directly under payment method */
body.lang-en .expense-form.row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
body.lang-en .expense-form > input[type="hidden"] {
    display: none;
}
body.lang-en .expense-form > [class*="col-"] {
    width: auto;
    max-width: none;
    flex: unset;
    padding-left: 0;
    padding-right: 0;
}
body.lang-en .expense-form > .expense-f-category { grid-column: 1; grid-row: 1; order: 0; }
body.lang-en .expense-form > .expense-f-title { grid-column: 2 / 4; grid-row: 1; }
body.lang-en .expense-form > .expense-f-payment { grid-column: 1; grid-row: 2; }
body.lang-en .expense-form > .expense-f-currency { grid-column: 2; grid-row: 2; }
body.lang-en .expense-form > .expense-f-amount { grid-column: 3; grid-row: 2; }
body.lang-en .expense-form > .expense-f-date {
    grid-column: 1;
    grid-row: 3;
    margin-inline-start: 0 !important;
}
body.lang-en .expense-form > .expense-f-notes { grid-column: 1 / -1; grid-row: 4; }
body.lang-en .expense-form > .form-actions { grid-column: 1 / -1; grid-row: 5; }

/* KU/AR: Amount | Currency | Payment method */
body.lang-ku .expense-form > .expense-f-title { order: 1; }
body.lang-ku .expense-form > .expense-f-category { order: 2; }
body.lang-ku .expense-form > .expense-f-amount { order: 3; }
body.lang-ku .expense-form > .expense-f-currency { order: 4; }
body.lang-ku .expense-form > .expense-f-payment { order: 5; }
body.lang-ku .expense-form > .expense-f-date { order: 6; }
body.lang-ku .expense-form > .expense-f-notes { order: 7; }
body.lang-ku .expense-form > .form-actions { order: 8; }

body.lang-ar .expense-form > .expense-f-title { order: 1; }
body.lang-ar .expense-form > .expense-f-category { order: 2; }
body.lang-ar .expense-form > .expense-f-amount { order: 3; }
body.lang-ar .expense-form > .expense-f-currency { order: 4; }
body.lang-ar .expense-form > .expense-f-payment { order: 5; }
body.lang-ar .expense-form > .expense-f-date { order: 6; }
body.lang-ar .expense-form > .expense-f-notes { order: 7; }
body.lang-ar .expense-form > .form-actions { order: 8; }
@media (max-width: 576px) {
    .po-source-grid { grid-template-columns: 1fr; }
}
.po-source-card {
    margin: 0;
    cursor: pointer;
}
.po-source-card__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.po-source-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 100%;
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 0.75rem;
    background: var(--bg-body, #f8fafc);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.po-source-card__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary, #0f766e);
}
.po-source-card__label {
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}
.po-source-card__hint {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-secondary, #64748b);
}
.po-source-card__input:checked + .po-source-card__body {
    border-color: var(--primary, #0f766e);
    background: rgba(15, 118, 110, 0.06);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.po-section .combo-search {
    position: relative;
    z-index: 5;
}
.po-section .combo-search:focus-within,
.po-section .combo-search:has(.combo-search__menu.is-open) {
    z-index: 40;
}
.po-items,
.po-section--medicine {
    overflow: visible;
}
/* KU/AR: order date first (right), expected date second (left) */
body.lang-ku [data-po-company-date],
body.lang-ar [data-po-company-date] {
    order: 1;
}
body.lang-ku [data-po-order-date],
body.lang-ar [data-po-order-date] {
    order: 2;
}
body.lang-ku [data-po-order-date] .form-label,
body.lang-ar [data-po-order-date] .form-label,
body.lang-ku [data-po-company-date] .form-label,
body.lang-ar [data-po-company-date] .form-label {
    text-align: right;
}

/* Rep mode (order date alone): EN left, KU/AR right */
body.lang-en .po-order-date--alone,
html[lang="en"] .po-order-date--alone {
    margin-right: auto;
    margin-left: 0;
}
body.lang-ku .po-order-date--alone,
body.lang-ar .po-order-date--alone {
    margin-left: 50% !important;
    margin-right: 0 !important;
    text-align: right;
}
@media (max-width: 767.98px) {
    body.lang-ku .po-order-date--alone,
    body.lang-ar .po-order-date--alone {
        margin-left: 0 !important;
    }
}
.po-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
body.lang-ku .po-section__head,
body.lang-ar .po-section__head {
    flex-direction: row-reverse;
}
.po-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.po-item {
    padding: 0.85rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.75rem;
    background: var(--bg-card, #fff);
    overflow: visible;
    position: relative;
}
.po-item__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
body.lang-ku .po-item__top,
body.lang-ar .po-item__top {
    flex-direction: row-reverse;
}
.po-item__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary, #0f766e);
}
.po-item__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(220, 38, 38, 0.22);
    border-radius: 0.55rem;
    background: rgba(254, 226, 226, 0.7);
    color: #dc2626;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.po-item__remove i {
    font-size: 0.78rem;
    pointer-events: none;
}
.po-item__remove:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.po-item__remove:active {
    transform: translateY(0);
    box-shadow: none;
}
.po-item__remove:focus-visible {
    outline: 2px solid rgba(220, 38, 38, 0.45);
    outline-offset: 2px;
}
.po-item__remove:disabled {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.08);
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.85;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}
.theme-dark .po-item__remove {
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}
.theme-dark .po-item__remove:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
.theme-dark .po-item__remove:disabled {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.2);
    color: #64748b;
}
/* KU/AR RTL reading (right → left): currency → rate → buy → sell → discount; qty after currency */
body.lang-ku .po-item__prices [data-po-discount-wrap],
body.lang-ar .po-item__prices [data-po-discount-wrap] {
    order: 1;
}
body.lang-ku .po-item__prices [data-po-sell-wrap],
body.lang-ar .po-item__prices [data-po-sell-wrap] {
    order: 2;
}
body.lang-ku .po-item__prices [data-po-buy-wrap],
body.lang-ar .po-item__prices [data-po-buy-wrap] {
    order: 3;
}
body.lang-ku .po-item__prices [data-po-rate-wrap],
body.lang-ar .po-item__prices [data-po-rate-wrap] {
    order: 4;
}
body.lang-ku .po-item__prices [data-po-currency-wrap],
body.lang-ar .po-item__prices [data-po-currency-wrap] {
    order: 5;
}
body.lang-ku .po-item__prices [data-po-qty-wrap],
body.lang-ar .po-item__prices [data-po-qty-wrap] {
    order: 6;
}
body.lang-ku .po-item__prices .form-label,
body.lang-ar .po-item__prices .form-label {
    text-align: right;
}
.po-item__profit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.65rem;
    border-radius: 0.5rem;
    background: rgba(15, 118, 110, 0.06);
    font-size: 0.8125rem;
}
.po-item__profit .is-negative,
.po-totals__row--profit .is-negative {
    color: #b91c1c;
}
.po-add-line {
    margin-top: 0.75rem;
}
.po-totals {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border-color, #e2e8f0);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.po-totals__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
}
.po-totals__row strong {
    color: var(--text-primary, #0f172a);
    font-variant-numeric: tabular-nums;
}
.po-totals__row--profit {
    margin-top: 0.25rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}
.po-totals__row--discount,
.po-totals__row--rate {
    gap: 0.75rem;
}
.po-totals__discount {
    width: 7.5rem;
    max-width: 40%;
    text-align: end;
}
body.lang-ku .po-totals__discount,
body.lang-ar .po-totals__discount {
    text-align: start;
    direction: ltr;
}
.po-totals__row--profit strong {
    color: var(--primary, #0f766e);
    font-size: 1.05rem;
}
.po-totals__ku {
    font-weight: 500;
    color: var(--text-secondary, #64748b);
}
/* KU/AR: label on the right, amount on the left */
body.lang-ku .po-totals__row,
body.lang-ar .po-totals__row,
body.lang-ku .po-item__profit,
body.lang-ar .po-item__profit {
    flex-direction: row-reverse;
}
body.lang-ku .po-totals__row strong,
body.lang-ar .po-totals__row strong,
body.lang-ku .po-item__profit strong,
body.lang-ar .po-item__profit strong {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}
body.lang-ku .invoice-summary > .d-flex,
body.lang-ar .invoice-summary > .d-flex {
    flex-direction: row-reverse;
}
body.lang-ku .invoice-summary > .d-flex > span:last-child,
body.lang-ar .invoice-summary > .d-flex > span:last-child {
    direction: ltr;
    unicode-bidi: isolate;
}

/* Doctor show — upcoming appointments header RTL */
body.lang-ku .doctor-upcoming-card__head,
body.lang-ar .doctor-upcoming-card__head {
    direction: rtl;
    flex-direction: row;
}

body.lang-ku .doctor-upcoming-card__head .card-title,
body.lang-ar .doctor-upcoming-card__head .card-title {
    text-align: right;
}

/* Status badges — solid chips with icons for quick scanning */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    min-height: 2rem;
    padding: 0.35rem 0.85rem 0.35rem 0.55rem;
    border-radius: 0.65rem;
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.status-badge__icon {
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    flex: 0 0 auto;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.22);
}

.status-badge__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge--primary {
    color: #fff;
    background: #0f766e;
    border-color: #0d5f58;
}

.status-badge--info {
    color: #fff;
    background: #0284c7;
    border-color: #0369a1;
}

.status-badge--success {
    color: #fff;
    background: #16a34a;
    border-color: #15803d;
}

.status-badge--warning {
    color: #78350f;
    background: #fbbf24;
    border-color: #f59e0b;
}

.status-badge--warning .status-badge__icon {
    background: rgba(120, 53, 15, 0.12);
    color: #92400e;
}

.status-badge--danger {
    color: #fff;
    background: #dc2626;
    border-color: #b91c1c;
}

.status-badge--secondary {
    color: #fff;
    background: #64748b;
    border-color: #475569;
}

.status-badge--dark {
    color: #fff;
    background: #334155;
    border-color: #1e293b;
}

.theme-dark .status-badge {
    box-shadow: none;
}

.theme-dark .status-badge--primary {
    background: #0d9488;
    border-color: #0f766e;
}

.theme-dark .status-badge--info {
    background: #0ea5e9;
    border-color: #0284c7;
}

.theme-dark .status-badge--success {
    background: #22c55e;
    border-color: #16a34a;
}

.theme-dark .status-badge--warning {
    color: #78350f;
    background: #fbbf24;
    border-color: #f59e0b;
}

.theme-dark .status-badge--danger {
    background: #ef4444;
    border-color: #dc2626;
}

.theme-dark .status-badge--secondary,
.theme-dark .status-badge--dark {
    background: #475569;
    border-color: #334155;
}

body.lang-ku .status-badge,
body.lang-ar .status-badge {
    padding: 0.35rem 0.55rem 0.35rem 0.85rem;
}

body.lang-ku .visit-status-actions,
body.lang-ar .visit-status-actions {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.visit-status-line {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    direction: ltr;
}

.visit-status-line form {
    margin: 0;
    display: inline-flex;
}

.visit-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2rem;
    padding: 0.25rem 0.8rem 0.25rem 0.3rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.visit-status-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    flex-shrink: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 0.7rem;
}

.visit-status-btn__label {
    padding-inline-end: 0.1rem;
}

.visit-status-btn--reopen {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: rgba(2, 132, 199, 0.22);
    color: #0369a1;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08);
}

.visit-status-btn--reopen .visit-status-btn__icon {
    background: #0284c7;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.28);
}

.visit-status-btn--reopen:hover {
    color: #075985;
    border-color: rgba(2, 132, 199, 0.4);
    background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.16);
    transform: translateY(-1px);
}

.visit-status-btn--close {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: rgba(71, 85, 105, 0.2);
    color: #475569;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.visit-status-btn--close .visit-status-btn__icon {
    background: #64748b;
    box-shadow: 0 3px 8px rgba(71, 85, 105, 0.22);
}

.visit-status-btn--close:hover {
    color: #334155;
    border-color: rgba(71, 85, 105, 0.35);
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
}

.visit-status-btn:active {
    transform: translateY(0);
}

body.lang-ku .visit-status-line,
body.lang-ar .visit-status-line {
    justify-content: flex-start;
    direction: rtl;
}

body.lang-ku .visit-status-btn,
body.lang-ar .visit-status-btn {
    flex-direction: row-reverse;
    padding: 0.25rem 0.3rem 0.25rem 0.8rem;
}

.theme-dark .visit-status-btn--reopen {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
}

.theme-dark .visit-status-btn--close {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

/* Visit summary details */
.visit-details__row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-color);
}

.visit-details__row:first-child {
    padding-top: 0;
}

.visit-details__row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.visit-details__row dt {
    flex: 0 0 auto;
    min-width: 5.5rem;
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.visit-details__row dd {
    flex: 1 1 auto;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: end;
    word-break: break-word;
}

.visit-details__row dd a {
    color: var(--text-primary);
    text-decoration: none;
}

.visit-details__row dd a:hover {
    color: var(--primary);
}

.visit-details__row--status dd {
    display: flex;
    justify-content: flex-end;
}

body.lang-ku .visit-details__row--status dd,
body.lang-ar .visit-details__row--status dd {
    justify-content: flex-start;
}

.visit-details__note {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.visit-details__note-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.visit-details__note p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}

body.lang-ku .visit-details__row,
body.lang-ar .visit-details__row {
    flex-direction: row-reverse;
}

body.lang-ku .visit-details__row dd,
body.lang-ar .visit-details__row dd {
    text-align: start;
}

.clinical-section {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-color);
}

.clinical-section:first-child {
    padding-top: 0;
}

.clinical-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.clinical-section__title {
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clinical-section__body {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
}

body.lang-ku .clinical-section,
body.lang-ar .clinical-section {
    text-align: right;
}

/* Appointment status row:
   EN — under Department (left)
   KU/AR — under Time (right) via ms-md-auto */
body.lang-en .appointment-details-fields > .appointment-f-status.ms-md-auto {
    margin-left: 0 !important;
    margin-inline-start: 0 !important;
}

body.lang-ku .appointment-details-fields > .appointment-f-status.ms-md-auto,
body.lang-ar .appointment-details-fields > .appointment-f-status.ms-md-auto {
    margin-inline-start: auto !important;
    margin-left: auto !important;
}

/* Appointment — English field order:
   Doctor | Patient
   Time | Date | Department
   Status (left) */
body.lang-en .appointment-details-fields > .appointment-f-doctor { order: 1; }
body.lang-en .appointment-details-fields > .appointment-f-patient { order: 2; }
body.lang-en .appointment-details-fields > .appointment-f-new-patient { order: 3; }
body.lang-en .appointment-details-fields > .appointment-f-time { order: 4; }
body.lang-en .appointment-details-fields > .appointment-f-date { order: 5; }
body.lang-en .appointment-details-fields > .appointment-f-department { order: 6; }
body.lang-en .appointment-details-fields > .appointment-f-status { order: 7; }
body.lang-en .appointment-details-fields > .appointment-f-reason { order: 8; }
body.lang-en .appointment-details-fields > .appointment-f-notes { order: 9; }

/* Appointment edit — title + status badge RTL */
body.lang-ku .appointment-edit-card__head,
body.lang-ar .appointment-edit-card__head {
    direction: rtl;
    flex-direction: row;
}

body.lang-ku .appointment-edit-card__head .card-title,
body.lang-ar .appointment-edit-card__head .card-title {
    text-align: right;
}

/* Queue board columns + patient cards */
body.lang-en .queue-board-columns {
    flex-direction: row-reverse;
}

.queue-column {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.15rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    background: #fff;
}

.queue-column--warning {
    border-top: 3px solid #f59e0b;
}

.queue-column--info {
    border-top: 3px solid #0284c7;
}

.queue-column--primary {
    border-top: 3px solid var(--primary);
}

.queue-column--success {
    border-top: 3px solid #16a34a;
}

.queue-column__body {
    padding: 0.85rem;
    min-height: 11rem;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, #ffffff 100%);
}

.queue-column__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.queue-column__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 8.5rem;
    padding: 1.25rem 0.75rem;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.7);
    color: #94a3b8;
    text-align: center;
}

.queue-column__empty-icon {
    display: inline-grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.85rem;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 1.05rem;
}

.queue-column__empty p {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 550;
}

.queue-card {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-inline-start: 3px solid transparent;
    border-radius: 0.95rem;
    padding: 0.95rem 1rem;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.queue-card:hover {
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.queue-card--warning {
    border-inline-start-color: #f59e0b;
}

.queue-card--info {
    border-inline-start-color: #0284c7;
}

.queue-card--primary {
    border-inline-start-color: var(--primary);
}

.queue-card--success {
    border-inline-start-color: #16a34a;
}

.queue-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.queue-card__meta {
    min-width: 0;
}

.queue-card__name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.queue-card__name {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
}

.queue-card__detail {
    display: block;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.4;
}

.queue-card__num {
    margin-inline-end: 0;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 0.45rem;
    padding: 0.28rem 0.45rem;
}

.queue-card__num--warning {
    color: #78350f;
    background: #fbbf24;
}

.queue-card__num--info {
    color: #fff;
    background: #0284c7;
}

.queue-card__num--primary {
    color: #fff;
    background: var(--primary);
}

.queue-card__num--success {
    color: #fff;
    background: #16a34a;
}

.queue-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.queue-card-actions__row {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0;
}

.queue-card-actions__doctor {
    width: 100%;
}

.queue-card-actions__btns {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
}

.queue-card-actions__primary {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.queue-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.45rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.queue-card-btn:active {
    transform: translateY(1px);
}

.queue-card-btn i {
    font-size: 0.85rem;
}

.queue-card-btn--start,
.queue-card-btn--done {
    flex: 1 1 auto;
    width: 100%;
    color: #fff;
}

.queue-card-btn--start {
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    border-color: #0284c7;
    box-shadow: 0 8px 18px rgba(2, 132, 199, 0.24);
}

.queue-card-btn--start:hover {
    color: #fff;
    background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 10px 22px rgba(3, 105, 161, 0.3);
}

.queue-card-btn--done {
    background: linear-gradient(180deg, #34d399 0%, #059669 100%);
    border-color: #059669;
    box-shadow: 0 8px 18px rgba(5, 150, 105, 0.24);
}

.queue-card-btn--done:hover {
    color: #fff;
    background: linear-gradient(180deg, #059669 0%, #047857 100%);
    box-shadow: 0 10px 22px rgba(4, 120, 87, 0.3);
}

.queue-card-btn--rx {
    flex: 0 0 auto;
    width: 2.45rem;
    min-width: 2.45rem;
    padding: 0;
    color: #fff;
    background: linear-gradient(180deg, #64748b 0%, #475569 100%);
    border-color: #475569;
    box-shadow: 0 8px 18px rgba(71, 85, 105, 0.24);
}

.queue-card-btn--rx:hover {
    color: #fff;
    background: linear-gradient(180deg, #475569 0%, #334155 100%);
    box-shadow: 0 10px 22px rgba(51, 65, 85, 0.3);
}

.queue-card-btn--rx-wide {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    padding: 0.55rem 0.9rem;
}

.queue-card-btn--view {
    flex: 0 0 auto;
    width: 2.45rem;
    min-width: 2.45rem;
    padding: 0;
    color: #475569;
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.45);
}

.queue-card-btn--view:hover {
    color: #0f172a;
    background: #f1f5f9;
    border-color: rgba(100, 116, 139, 0.55);
}

.queue-card-btn--wide {
    width: 100%;
    min-width: 0;
    padding: 0.55rem 0.9rem;
}

.theme-dark .queue-card-btn--view {
    color: #e2e8f0;
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.35);
}

.theme-dark .queue-card-btn--view:hover {
    color: #fff;
    background: rgba(51, 65, 85, 0.95);
}

body.lang-ku .queue-card__head,
body.lang-ar .queue-card__head {
    direction: rtl;
    flex-direction: row;
}

body.lang-ku .queue-card__meta,
body.lang-ar .queue-card__meta {
    text-align: right;
}

body.lang-ku .queue-card__name-row,
body.lang-ar .queue-card__name-row {
    flex-direction: row;
}

/* Queue column headers */
.queue-column__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    padding: 1rem 1.15rem;
}

.queue-column__title {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.queue-column__icon {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    border-radius: 0.75rem;
    font-size: 0.95rem;
}

.queue-column__head .card-title {
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: 0.01em;
}

.queue-column__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
}

.queue-column__head--warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
}

.queue-column__head--warning .queue-column__icon {
    background: rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.queue-column__head--warning .queue-column__count {
    color: #78350f;
    background: #fbbf24;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
}

.queue-column__head--info {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #075985;
}

.queue-column__head--info .queue-column__icon {
    background: rgba(2, 132, 199, 0.16);
    color: #0284c7;
}

.queue-column__head--info .queue-column__count {
    color: #fff;
    background: #0284c7;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

.queue-column__head--primary {
    background: linear-gradient(135deg, #ecfdf8 0%, #ccfbf1 100%);
    color: #0f766e;
}

.queue-column__head--primary .queue-column__icon {
    background: rgba(15, 118, 110, 0.16);
    color: var(--primary);
}

.queue-column__head--primary .queue-column__count {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.28);
}

.queue-column__head--success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
}

.queue-column__head--success .queue-column__icon {
    background: rgba(22, 163, 74, 0.16);
    color: #16a34a;
}

.queue-column__head--success .queue-column__count {
    color: #fff;
    background: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

body.lang-ku .queue-column__head,
body.lang-ar .queue-column__head {
    direction: rtl;
    flex-direction: row;
}

body.lang-ku .queue-column__head .card-title,
body.lang-ar .queue-column__head .card-title {
    text-align: right;
}

body.lang-ku .queue-column__title,
body.lang-ar .queue-column__title {
    flex-direction: row;
}

.theme-dark .queue-column {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .queue-column__body {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.55) 0%, #1e293b 100%);
}

.theme-dark .queue-card {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .queue-card__name {
    color: #f8fafc;
}

.theme-dark .queue-column__empty {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.28);
}

body.lang-ku .doctor-upcoming-card .empty-state,
body.lang-ar .doctor-upcoming-card .empty-state {
    direction: rtl;
}

body.lang-ku .doctor-upcoming-card .table,
body.lang-ar .doctor-upcoming-card .table {
    direction: rtl;
}

body.lang-ku .doctor-upcoming-card .table th,
body.lang-ku .doctor-upcoming-card .table td,
body.lang-ar .doctor-upcoming-card .table th,
body.lang-ar .doctor-upcoming-card .table td {
    text-align: right;
}


/* ==========================================================================
   Phones and tablets (v2.9.3)
   Header: every control stays reachable. Filters wrap. On phones, data tables
   become cards (labels come from initResponsiveTables in app.js).
   ========================================================================== */

/* The ECG strip clips itself, so the header can let the notification menu show. */
.app-topbar { overflow: visible; }
html { -webkit-text-size-adjust: 100%; }
.app-content { min-width: 0; }
.app-content img, .app-content canvas { max-width: 100%; }

@media (max-width: 991.98px) {
    .app-topbar { min-height: 0; padding: 0; }
    .topbar-pulse { height: 28px; }
    .topbar-inner {
        flex-wrap: wrap;
        min-height: 0;
        gap: 0.5rem 0.6rem;
        padding: 0.6rem 1rem 1.9rem;
    }
    /* Header controls join the same wrapping row as the brand and search. */
    .topbar-right { display: contents; }
    .topbar-left { order: 1; flex: 1 1 0; min-width: 0; }
    .topbar-brand { margin: 0; gap: 0.55rem; min-width: 0; max-width: 100%; }
    .topbar-brand__logo-wrap,
    .topbar-brand__logo-wrap--custom { width: 44px; height: 44px; }
    .topbar-brand__text { min-width: 0; }
    .topbar-brand__name {
        display: block;
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-notifications { order: 2; }
    .topbar-user { order: 3; }
    .topbar-inner::before { content: ""; order: 5; flex: 0 0 100%; height: 0; }
    /* Second row: language, help, theme, logout. */
    .lang-switcher { order: 6; }
    .topbar-right > .btn-icon { order: 6; }
    .topbar-search { order: 7; flex: 1 1 220px; width: auto; max-width: none; margin: 0; }

    /* Filter bars wrap instead of running off the screen. */
    .table-toolbar { flex-wrap: wrap; }
    .table-toolbar > .d-flex { flex: 1 1 100%; flex-wrap: wrap !important; width: 100%; }
    .table-toolbar .table-search { flex: 1 1 100%; max-width: none; min-width: 0; }
    .app-content .table-toolbar select.form-select,
    .app-content .table-toolbar > input.form-control,
    .app-content .table-toolbar > .d-flex > input.form-control {
        flex: 1 1 140px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    .calendar-filter-card .card-body { min-height: 0 !important; }
}

@media (max-width: 767.98px) {
    /* Three header rows would cover too much of a phone, so the header scrolls away. */
    .app-topbar { position: relative; }
    .topbar-search { flex-basis: 100%; }
    .lang-switcher { margin-inline-end: auto; }
    .lang-switcher__btn { display: inline-flex; align-items: center; min-height: 36px; }

    /* Below 16px, iPhones zoom the whole page when a field is tapped. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea { font-size: 16px !important; }

    .btn-sm, .pagination .page-link { min-height: 36px; min-width: 36px; }
    .btn-sm { display: inline-flex; align-items: center; justify-content: center; }
    .pagination { flex-wrap: wrap; }
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
    .nav-tabs .nav-link { white-space: nowrap; }
    .section-bar__actions { flex-wrap: wrap; }

    /* Dashboard numbers */
    .dash-kpi { min-height: 0; padding: 0.75rem; gap: 0.55rem; }
    .dash-kpi__icon { width: 2.25rem; height: 2.25rem; font-size: 0.95rem; }
    .dash-kpi__value { font-size: 1.2rem; }
    .dash-kpi__body { min-width: 0; }
    .dash-kpi__money { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .dash-kpi__money-divider { display: none; }

    /* Calendar */
    .calendar-filter-card .cal-today-btn { order: -1; flex: 0 0 100%; justify-content: center; }
    .calendar-filter-card h5 {
        flex: 1 1 0;
        min-width: 0;
        font-size: 1rem;
        text-align: center;
        white-space: normal !important;
    }
    .cal-month__dow { font-size: 0.62rem; padding-inline: 0; overflow-wrap: normal; word-break: keep-all; }
    .cal-day-slot, .cal-day { min-height: 4.75rem; }
}

@media screen and (max-width: 767.98px) {
    /* Data tables become one card per row. */
    .table-responsive:has(> .table-stack) { overflow: visible; }
    .table-stack, .table-stack tbody, .table-stack tfoot { display: block; width: 100%; }
    .table-stack { padding: 0.75rem; }
    .table-stack thead { display: none; }

    .table-stack tr {
        display: block;
        margin-bottom: 0.75rem;
        padding: 0.25rem 0.85rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 0.75rem;
    }
    .table-stack tr:last-child { margin-bottom: 0; }
    .table-stack tbody td,
    .table-stack tbody th,
    .table-stack tfoot td,
    .table-stack tfoot th {
        display: block;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0.6rem 0;
        border: 0;
        border-bottom: 1px solid var(--border-color);
        text-align: end;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .table-stack tr > :last-child { border-bottom: 0; }
    .table-stack td[data-label]::before,
    .table-stack th[data-label]::before {
        content: attr(data-label);
        float: left;
        margin-inline-end: 0.75rem;
        font-size: 0.75rem;
        font-weight: 600;
        line-height: 1.6;
        color: var(--text-secondary);
        text-align: start;
    }
    html[dir="rtl"] .table-stack td[data-label]::before,
    html[dir="rtl"] .table-stack th[data-label]::before { float: right; }
    .table-stack td::after, .table-stack th::after { content: ""; display: block; clear: both; }
    .table-stack td[colspan] { text-align: center; }
    .table-stack td > .d-flex,
    .table-stack td > .btn-group,
    .table-stack td > .table-actions { flex-wrap: wrap; justify-content: flex-end; }
    .table-stack td .form-control,
    .table-stack td .form-select { width: 100%; max-width: none !important; }
}

@media (max-width: 767.98px) {
    /* Calendar: today, then previous / month / next, then one filter per row. */
    .app-content .calendar-filter-card .table-toolbar > .d-flex > input.form-control,
    .app-content .calendar-filter-card .table-toolbar select.form-select { flex-basis: 100% !important; }

    /* Sign-in: keep the button on the first screen. */
    .auth-hero { padding: 1rem 1.15rem 1.15rem; }
    .auth-hero__logo { width: 64px; margin-bottom: 0.5rem; }
    .auth-hero__brand { font-size: 1.5rem; }
    .auth-panel { padding-top: 1.15rem; }
}

@media (max-width: 991.98px) and (max-height: 500px) {
    .auth-hero { min-height: 0; padding: 0.6rem 1rem; }
    .auth-hero__logo { width: 40px; margin-bottom: 0.25rem; }
    .auth-hero__brand { font-size: 1.15rem; }
    .auth-hero__tagline { display: none; }
}

/* Very small phones */
@media (max-width: 359.98px) {
    .dash-kpi-grid { grid-template-columns: 1fr; }
    .topbar-inner { gap: 0.4rem; padding-inline: 0.65rem; }
    .topbar-right > .btn-icon { width: 34px; height: 34px; }
    .lang-switcher__btn { padding-inline: 0.45rem; }
}

/* Tablets: tighter cells so tables fit without cutting off a column. */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .table thead th,
    .table tbody td { padding: 0.65rem 0.5rem; }
    .table thead th { white-space: normal; }
}

/* ==========================================================================
   Ease of use (v2.10.0): today's panel, setup checklist, grouped tiles,
   header search and "What next?" buttons.
   ========================================================================== */

.dash-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Grouped tiles size to their content; the page scrolls. */
body.is-dashboard .app-content { overflow-y: auto; }
.dash-group { margin-top: 1.1rem; }
.dash-group .dash-section-title { margin-bottom: 0.6rem; }
.dash-group .clinic-bento {
    flex: none;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-auto-rows: 118px;
    align-content: start;
}

a.dash-kpi--link { color: inherit; text-decoration: none; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
a.dash-kpi--link:hover,
a.dash-kpi--link:focus-visible { border-color: var(--primary); box-shadow: var(--shadow-md, 0 4px 14px rgba(15, 23, 42, 0.1)); color: inherit; }

.dash-setup,
.dash-today {
    margin-bottom: 0.85rem;
    padding: 1rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.95rem;
    box-shadow: var(--shadow-sm);
}
.dash-setup { flex-shrink: 0; border-color: var(--primary); }
.dash-today { flex-shrink: 0; }
.dash-setup__head,
.dash-today__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.dash-today__meta { display: flex; align-items: center; gap: 0.5rem; }
.dash-setup__bar {
    height: 6px;
    margin: 0.7rem 0;
    overflow: hidden;
    background: var(--border-color);
    border-radius: 999px;
}
.dash-setup__bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.dash-setup__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.dash-setup__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
}
a.dash-setup__item:hover { border-color: var(--primary); color: var(--primary); }
.dash-setup__item i { color: var(--primary); }
.dash-setup__list .is-done .dash-setup__item { color: var(--text-muted); font-weight: 500; border-style: dashed; }

.dash-today__empty { margin: 0.75rem 0 0.25rem; color: var(--text-secondary); font-size: 0.875rem; }
.dash-today__list { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.dash-today__row {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--border-color);
}
.dash-today__time { font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-today__who { display: flex; flex-direction: column; min-width: 0; }
.dash-today__name {
    overflow: hidden;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    text-overflow: ellipsis;
}
a.dash-today__name:hover { color: var(--primary); }

/* "What next?" after saving something */
.next-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    border-radius: 0.85rem;
}
.next-steps__title i { color: var(--primary); }
.next-steps__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.next-steps__actions form { margin: 0; }

/* Header search results */
.topbar-search { z-index: 30; }
.global-search {
    position: absolute;
    top: calc(100% + 0.35rem);
    inset-inline: 0;
    min-width: min(340px, calc(100vw - 2rem));
    max-height: min(60vh, 440px);
    overflow-y: auto;
    padding: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.global-search[hidden] { display: none; }
.global-search__group {
    padding: 0.5rem 0.6rem 0.2rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
}
.global-search__item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
    padding: 0.4rem 0.6rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 0.5rem;
}
.global-search__item i { width: 1.15rem; color: var(--primary); text-align: center; }
.global-search__item:hover,
.global-search__item.is-active { background: var(--primary-soft); color: var(--text-primary); }
.global-search__text { display: flex; flex-direction: column; min-width: 0; }
.global-search__text strong {
    overflow: hidden;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.global-search__text small { color: var(--text-secondary); font-size: 0.75rem; }
.global-search__empty { padding: 1rem; color: var(--text-secondary); font-size: 0.875rem; text-align: center; }

@media (max-width: 767.98px) {
    .dash-group .clinic-bento {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: auto;
        gap: 0.55rem;
    }
    .dash-group .bento-tile { aspect-ratio: auto; min-height: 96px; }
    .dash-group .bento-tile__label { font-size: 0.75rem; line-height: 1.25; }
    .dash-today__row { grid-template-columns: 3rem minmax(0, 1fr) auto; }
    .dash-today__status { display: none; }
    .next-steps__actions, .next-steps__actions form, .next-steps__actions .btn { width: 100%; }
    .next-steps__actions .btn { justify-content: center; min-height: 44px; }
}
@media (max-width: 359.98px) {
    .dash-group .clinic-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Success and info messages: a small bar at the top instead of a large centred card. */
.toast-container--center:has(.app-toast--compact) {
    top: 0.75rem !important;
    transform: translateX(-50%);
}
.app-toast.app-toast--compact {
    --toast-size: auto;
    width: max-content;
    min-width: 0;
    max-width: min(480px, calc(100vw - 2rem));
    height: auto;
    max-height: none;
    border-radius: 0.85rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}
.app-toast--compact .toast-body.app-toast__card,
.app-toast--compact .app-toast__card {
    flex-direction: row;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    text-align: start;
}
.app-toast--compact .app-toast__close,
.app-toast--compact .app-toast__title { display: none; }
.app-toast--compact .app-toast__icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
    font-size: 0.9rem;
}
.app-toast--compact .app-toast__message { font-size: 0.875rem; font-weight: 600; }

@media (max-width: 767.98px) {
    .dash-group .bento-tile { gap: 0.4rem; padding: 0.6rem 0.2rem 0.55rem; }
    .dash-group .bento-tile__label {
        display: block;
        overflow: visible;
        font-size: 0.68rem;
        white-space: normal;
        word-break: normal;
        overflow-wrap: normal;
        hyphens: none;
        -webkit-line-clamp: unset;
    }
    .dash-today__row { grid-template-columns: 3rem minmax(0, 1fr); }
    .dash-today__name { white-space: normal; overflow-wrap: anywhere; }
    .dash-today__action { grid-column: 2; }
    .dash-today__action:empty { display: none; }
    .dash-today__action .btn { width: 100%; min-height: 40px; }
    .dash-kpi__money-iqd { max-width: 100%; padding: 0.1rem 0.35rem; font-size: 0.72rem; }
}
/* ==========================================================================
   Backup status, duplicate warning, reminders and cash closing (v2.11.0)
   ========================================================================== */
.backup-status {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-inline-start: 4px solid var(--status-color, var(--primary));
    border-radius: 0.85rem;
}
.backup-status--ok { --status-color: #15803d; }
.backup-status--warning { --status-color: #b45309; }
.backup-status--danger { --status-color: #b91c1c; }
.backup-status__icon { color: var(--status-color); font-size: 1.5rem; line-height: 1.2; }
.backup-status__label { color: var(--text-secondary); font-weight: 600; }
.backup-status__title { margin: 0.1rem 0 0.3rem; color: var(--status-color); font-size: 1.1rem; font-weight: 700; }

.duplicate-panel {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(180, 83, 9, 0.08);
    border: 1px solid rgba(180, 83, 9, 0.35);
    border-radius: 0.7rem;
}
.duplicate-panel[hidden] { display: none; }
.duplicate-panel__title { color: #92400e; }
.theme-dark .duplicate-panel__title { color: #fbbf24; }
.duplicate-panel__hint { margin: 0.25rem 0 0.6rem; color: var(--text-secondary); font-size: 0.82rem; }
.duplicate-panel__list { margin: 0; padding: 0; list-style: none; }
.duplicate-panel__list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(180, 83, 9, 0.2);
}
.duplicate-panel__list span { display: flex; flex-direction: column; min-width: 0; }
.duplicate-panel__list small { color: var(--text-secondary); }
.duplicate-panel__confirm { margin: 0.6rem 0 0; font-weight: 600; }

.reminder-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.reminder-bar .form-control { width: auto; flex: 0 1 11rem; }
.reminder-bar__count { margin-inline-start: auto; color: var(--text-secondary); font-size: 0.875rem; font-weight: 600; }
.reminder-list { margin: 0; padding: 0; list-style: none; }
.reminder-row {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--border-color);
}
.reminder-row__time { font-weight: 700; font-variant-numeric: tabular-nums; }
.reminder-row__who { display: flex; flex-direction: column; min-width: 0; }
.reminder-row__who a { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.reminder-row__who a:hover { color: var(--primary); }
.reminder-row__send { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 40px; }
.reminder-row__label-sent { display: none; }
.reminder-row.is-sent .reminder-row__label-send { display: none; }
.reminder-row.is-sent .reminder-row__label-sent { display: inline; }
.reminder-row.is-sent .btn-whatsapp {
    color: var(--text-secondary);
    background: transparent;
    border-color: var(--border-color);
}

.cash-date { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.cash-date .form-control { width: auto; }
.cash-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.25rem; align-items: start; }
.cash-lines { margin: 0; }
.cash-lines > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-color);
}
.cash-lines dt { font-weight: 500; color: var(--text-secondary); }
.cash-lines dd { margin: 0; font-weight: 700; text-align: end; }
.cash-lines dd small { display: block; color: var(--text-secondary); font-size: 0.75rem; font-weight: 500; }
.cash-subtitle { margin: 1.1rem 0 0.4rem; font-size: 0.82rem; font-weight: 700; color: var(--text-secondary); }
.cash-list { margin: 0; padding: 0; list-style: none; }
.cash-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; font-size: 0.875rem; }
.cash-result { margin-bottom: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.7rem; }
.cash-result strong { display: block; font-size: 1.15rem; }
.cash-result small { color: var(--text-secondary); }
.cash-result--ok { background: rgba(21, 128, 61, 0.1); color: #166534; }
.cash-result--off { background: rgba(185, 28, 28, 0.09); color: #991b1b; }
.theme-dark .cash-result--ok { color: #4ade80; }
.theme-dark .cash-result--off { color: #fca5a5; }
.cash-notes { margin: 0.75rem 0 0; color: var(--text-secondary); font-size: 0.875rem; }
.cash-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; align-items: end; }
.cash-form__wide, .cash-live { grid-column: 1 / -1; }
.cash-live {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.25rem;
    padding: 0.7rem 0.9rem;
    background: var(--slate-50);
    border-radius: 0.65rem;
    font-size: 0.875rem;
}
.theme-dark .cash-live { background: var(--slate-800); }
.cash-live__result { margin-inline-start: auto; font-size: 1rem; }
.cash-live__result.is-ok { color: #15803d; }
.cash-live__result.is-off { color: #b91c1c; }
.theme-dark .cash-live__result.is-ok { color: #4ade80; }
.theme-dark .cash-live__result.is-off { color: #fca5a5; }
.cash-tag { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 0.45rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.cash-tag--ok { background: rgba(21, 128, 61, 0.12); color: #166534; }
.cash-tag--off { background: rgba(185, 28, 28, 0.1); color: #991b1b; }
.theme-dark .cash-tag--ok { color: #4ade80; }
.theme-dark .cash-tag--off { color: #fca5a5; }

@media (max-width: 991.98px) {
    .cash-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
    .cash-form { grid-template-columns: minmax(0, 1fr); }
    .reminder-row { grid-template-columns: 3rem minmax(0, 1fr); }
    .reminder-row__send { grid-column: 2; width: 100%; }
    .reminder-bar__count { flex-basis: 100%; margin-inline-start: 0; }
}

/* ==========================================================================
   Visual refresh (v2.11.0): calmer surfaces, one accent colour, more room for work.
   ========================================================================== */
:root { --bg-body: #f3f6f8; }
body { background-attachment: scroll; }

:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }

/* Header: shorter, so more of each screen is the actual work */
.topbar-pulse { opacity: 0.55; background: none; }
.topbar-pulse__path { stroke-width: 1.5; filter: none; }
.theme-dark .topbar-pulse__path { filter: none; }
@media (min-width: 992px) {
    .app-topbar { min-height: 84px; }
    .topbar-inner { min-height: 0; padding: 0.6rem 1.75rem 1.35rem; }
    .topbar-pulse { height: 32px; }
    .topbar-brand__logo-wrap, .topbar-brand__logo-wrap--custom { width: 48px; height: 48px; }
    .topbar-brand__name { font-size: 1.2rem; }
}

/* Page title bar */
.section-bar { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 0.85rem; box-shadow: none; }
.theme-dark .section-bar { background: var(--bg-card); border-color: var(--border-color); }
.section-back { background: transparent; border-color: var(--border-color); color: var(--text-secondary); font-weight: 600; }
.section-back:hover { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.section-bar__title { font-size: 1.2rem; }

/* Buttons */
.btn { border-radius: 0.6rem; }
.dash-hero-btn { min-height: 42px; border-radius: 0.65rem; box-shadow: none; }
.dash-hero-btn:hover { box-shadow: none; transform: none; }
.dash-hero-btn--solid { background: var(--primary); }
.dash-hero-btn--solid:hover { background: var(--primary-dark); }

/* Cards and panels */
.app-card, .card { border: 1px solid var(--border-color); border-radius: 0.85rem; box-shadow: none; }
.app-card .card-header, .card .card-header { background: transparent; }
.card-title { font-size: 1rem; font-weight: 700; }
.dash-hero, .glass-panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 0.85rem; box-shadow: none; backdrop-filter: none; }
.dash-hero__title { font-size: 1.35rem; }
.dash-kpi, .dash-today { border-radius: 0.85rem; box-shadow: none; }
.dash-setup { box-shadow: none; border-radius: 0.85rem; }

/* Module tiles: colour stays on the icon, frames stay quiet */
.bento-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    box-shadow: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-dark .bento-tile { background: var(--bg-card); box-shadow: none; }
.bento-tile:hover, .bento-tile:focus-visible {
    transform: none;
    background: color-mix(in srgb, var(--tile-color) 6%, var(--bg-card));
    border-color: var(--tile-color);
    box-shadow: none;
}
.theme-dark .bento-tile:hover { background: color-mix(in srgb, var(--tile-color) 12%, var(--bg-card)); }
.dash-section-title { font-size: 0.95rem; color: var(--text-secondary); }

/* Tables */
.table thead th {
    background: transparent;
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: 1px solid var(--border-color);
}
.theme-dark .table thead th { background: transparent; }
.table tbody td { padding-block: 0.7rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--primary-soft); }

/* Status labels: soft tints that can be read at a glance without shouting */
.status-badge { min-height: 1.65rem; padding: 0.2rem 0.6rem; gap: 0.35rem; border: 0; border-radius: 0.5rem; box-shadow: none; font-size: 0.78rem; font-weight: 600; }
.status-badge .status-badge__icon { width: auto; height: auto; background: none; color: inherit; font-size: 0.72rem; }
.status-badge--primary { color: #115e59; background: rgba(15, 118, 110, 0.13); }
.status-badge--info { color: #075985; background: rgba(2, 132, 199, 0.13); }
.status-badge--success { color: #166534; background: rgba(22, 163, 74, 0.14); }
.status-badge--warning { color: #92400e; background: rgba(217, 119, 6, 0.16); }
.status-badge--danger { color: #991b1b; background: rgba(220, 38, 38, 0.12); }
.status-badge--secondary { color: #475569; background: rgba(100, 116, 139, 0.14); }
.status-badge--dark { color: #334155; background: rgba(51, 65, 85, 0.15); }
.theme-dark .status-badge--primary { color: #5eead4; background: rgba(45, 212, 191, 0.14); }
.theme-dark .status-badge--info { color: #7dd3fc; background: rgba(56, 189, 248, 0.14); }
.theme-dark .status-badge--success { color: #86efac; background: rgba(74, 222, 128, 0.14); }
.theme-dark .status-badge--warning { color: #fcd34d; background: rgba(251, 191, 36, 0.14); }
.theme-dark .status-badge--danger { color: #fca5a5; background: rgba(248, 113, 113, 0.14); }
.theme-dark .status-badge--secondary, .theme-dark .status-badge--dark { color: #cbd5e1; background: rgba(148, 163, 184, 0.16); }

/* Forms */
.form-label { font-weight: 600; font-size: 0.85rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-soft); }

@media print {
    .section-bar, .next-steps, .cash-date { display: none !important; }
}
/* Kurdish and Arabic: these blocks read from the right, first item on the right. */
body.lang-ku .dash-kpi-grid, body.lang-ar .dash-kpi-grid,
body.lang-ku .clinic-bento, body.lang-ar .clinic-bento,
body.lang-ku .dash-setup, body.lang-ar .dash-setup,
body.lang-ku .dash-today, body.lang-ar .dash-today,
body.lang-ku .next-steps, body.lang-ar .next-steps,
body.lang-ku .global-search, body.lang-ar .global-search,
body.lang-ku .duplicate-panel, body.lang-ar .duplicate-panel,
body.lang-ku .reminder-bar, body.lang-ar .reminder-bar,
body.lang-ku .reminder-list, body.lang-ar .reminder-list,
body.lang-ku .cash-date, body.lang-ar .cash-date,
body.lang-ku .cash-layout, body.lang-ar .cash-layout,
body.lang-ku .backup-status, body.lang-ar .backup-status { direction: rtl; }
body.lang-ku .dash-kpi__body, body.lang-ar .dash-kpi__body { text-align: start; }

.cash-redo { margin-top: 1rem; }
.cash-redo summary { margin-bottom: 0.75rem; color: var(--primary); font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.duplicate-panel__confirm { display: flex; align-items: center; gap: 0.55rem; padding: 0; }
.duplicate-panel__confirm .form-check-input { flex-shrink: 0; float: none; margin: 0; }

/* Dark mode: text inside cards follows the theme */
.theme-dark .card, .theme-dark .app-card, .theme-dark .card-title { color: var(--text-primary); }
.theme-dark .form-control::placeholder { color: var(--text-muted); }
.theme-dark .topbar-search__input { color: var(--text-primary); }
.theme-dark .topbar-search__input::placeholder { color: var(--slate-400); opacity: 1; }
.theme-dark .dash-kpi__money-iqd, .theme-dark .dash-kpi.tone-green .dash-kpi__money-iqd { color: #86efac; background: rgba(74, 222, 128, 0.14); }
.theme-dark .dash-kpi__icon { color: var(--primary-light); }
/* Follow-up fixes */
.theme-dark { color-scheme: dark; }
.theme-dark .table { --bs-table-color: var(--text-primary); --bs-table-striped-color: var(--text-primary); --bs-table-hover-color: var(--text-primary); color: var(--text-primary); }
.theme-dark .table a:not(.btn) { color: var(--primary-light); }
.theme-dark .cash-redo summary { color: var(--primary-light); }
.theme-dark .person-cell__name { color: var(--text-primary); }
/* Amounts mix digits and Latin letters, so they always read left to right. */
.cash-lines dd { direction: ltr; text-align: left; }
html[dir="ltr"] .cash-lines dd { text-align: right; }
.cash-list strong { direction: ltr; }
/* Button icons sit on the correct side in right-to-left blocks. */
html[dir="rtl"] .next-steps .btn i.me-1,
html[dir="rtl"] .cash-date .btn i.me-1,
html[dir="rtl"] .cash-form .btn i.me-1,
html[dir="rtl"] .dash-today__action .btn i.me-1,
html[dir="rtl"] .duplicate-panel__title i.me-1,
html[dir="rtl"] .reminder-row__label-sent i.me-1 { margin-right: 0 !important; margin-left: 0.35rem !important; }
/* ==========================================================================
   v2.12.0: walk-ins, work panels, reports, allergies, vitals, two-step sign-in
   ========================================================================== */
.walk-in__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; }
body.lang-ku .walk-in__grid, body.lang-ar .walk-in__grid,
body.lang-ku .insight-money, body.lang-ar .insight-money,
body.lang-ku .insight-facts, body.lang-ar .insight-facts,
body.lang-ku .insight-columns, body.lang-ar .insight-columns,
body.lang-ku .vitals-charts, body.lang-ar .vitals-charts,
body.lang-ku .two-factor, body.lang-ar .two-factor,
body.lang-ku .rx-allergy, body.lang-ar .rx-allergy,
body.lang-ku .rx-template-form, body.lang-ar .rx-template-form { direction: rtl; }

.dash-panel__list { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.dash-panel__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 48px;
    padding: 0.45rem 0;
    color: var(--text-primary);
    text-decoration: none;
    border-top: 1px solid var(--border-color);
}
.dash-panel__row:hover .dash-today__name { color: var(--primary); }
.dash-panel__side { flex-shrink: 0; font-weight: 600; color: var(--text-secondary); font-size: 0.875rem; }

.insight-total { white-space: nowrap; color: var(--text-secondary); font-size: 0.875rem; }
.insight-total strong { color: var(--text-primary); font-size: 1.05rem; }
.insight-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; margin-bottom: 0.85rem; }
.insight-money__item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 1rem 1.15rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
}
.insight-money__item span { color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; }
.insight-money__item strong { font-size: 1.5rem; line-height: 1.25; }
body.lang-ku .insight-money__item strong, body.lang-ar .insight-money__item strong,
body.lang-ku .insight-money__item small, body.lang-ar .insight-money__item small { text-align: right; }
.insight-money__item small { color: var(--text-secondary); }
.insight-money__item--ok strong { color: #15803d; }
.insight-money__item--off strong { color: #b91c1c; }
.theme-dark .insight-money__item--ok strong { color: #4ade80; }
.theme-dark .insight-money__item--off strong { color: #fca5a5; }
.insight-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.85rem; margin-bottom: 1.25rem; }
.insight-fact {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0 0.6rem;
    padding: 0.75rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
}
.insight-fact i { grid-row: span 2; color: var(--primary); font-size: 1.1rem; }
.insight-fact strong { font-size: 1.2rem; line-height: 1.2; }
.insight-fact span { color: var(--text-secondary); font-size: 0.78rem; }
.insight-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; align-items: start; }

.rx-allergy {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    color: #7f1d1d;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(185, 28, 28, 0.45);
    border-radius: 0.7rem;
}
.rx-allergy[hidden] { display: none; }
.theme-dark .rx-allergy { color: #fecaca; }
.rx-allergy__conflict { margin: 0.5rem 0; font-weight: 700; }
.rx-allergy__confirm { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; }
.rx-allergy__confirm .form-check-input { flex-shrink: 0; float: none; margin: 0; }
.rx-starters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-inline: auto; }
.rx-starters .form-select { width: auto; min-width: 11rem; }
.rx-template-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; padding: 0.85rem 1rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 0.85rem; }
.rx-template-form .form-control { flex: 1 1 14rem; width: auto; }

.vitals-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.vitals-charts figure { margin: 0; padding: 0.85rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 0.85rem; }
.vitals-charts figcaption { margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 700; }
.vitals-charts__box { position: relative; height: 190px; }

.two-factor { max-width: 720px; margin-inline: auto; }
.two-factor__steps { margin: 0; padding-inline-start: 1.25rem; }
.two-factor__steps > li { margin-bottom: 1rem; }
.two-factor__qr { margin: 0.6rem 0; }
.two-factor__qr img { display: block; background: #fff; border-radius: 0.5rem; }
.two-factor__key code { font-size: 0.95rem; word-break: break-all; }
.two-factor__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
.two-factor__form > div { flex: 1 1 14rem; }
.two-factor__code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.two-factor__code-list code { font-size: 1rem; color: var(--text-primary); }

@media (max-width: 767.98px) {
    .insight-money { grid-template-columns: minmax(0, 1fr); }
    .insight-money__item strong { font-size: 1.25rem; }
    .rx-starters { order: 3; flex-basis: 100%; margin-inline: 0; }
    .rx-starters .form-select { flex: 1 1 100%; }
    .card-header:has(.rx-starters) { flex-wrap: wrap; }
}
@media print {
    .rx-template-form { display: none !important; }
}