:root {
    --bg: #090f1a;
    --surface: #111827;
    --surface-soft: #182235;
    --ink: #edf6ff;
    --muted: #9db2c8;
    --line: #2a3a52;
    --primary: #6bb7ff;
    --primary-dark: #2f7fc2;
    --accent: #8fd3ff;
    --danger: #ef5f6b;
    --success-bg: #10283f;
    --error-bg: #391b24;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
    --shadow-hover: 0 26px 80px rgba(29, 117, 190, 0.24);
    --motion-fast: 140ms ease;
    --motion: 220ms ease;
    --sidebar-width: 286px;
    --sidebar-collapsed-width: 78px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(107, 183, 255, 0.18), transparent 34%),
        linear-gradient(135deg, rgba(143, 211, 255, 0.08), transparent 42%),
        var(--bg);
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    font-weight: 500;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 72px;
    padding: 12px clamp(18px, 4vw, 48px);
    background: rgba(9, 15, 26, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.has-sidebar .topbar {
    justify-content: space-between;
    min-height: 64px;
    margin-left: var(--sidebar-width);
    padding: 10px clamp(16px, 3vw, 34px);
    transition: margin-left var(--motion);
}

.has-sidebar.sidebar-collapsed .topbar {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 16px 14px;
    background: rgba(7, 13, 24, 0.96);
    border-right: 1px solid var(--line);
    box-shadow: 18px 0 56px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
    overflow-x: hidden;
    transition: width var(--motion), box-shadow var(--motion);
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px 16px;
    border-bottom: 1px solid rgba(42, 58, 82, 0.72);
}

.sidebar-brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-weight: 900;
    white-space: nowrap;
}

.sidebar-brand:hover {
    color: var(--accent);
    text-decoration: none;
}

.sidebar-brand-text,
.sidebar-label {
    overflow: hidden;
    transition: opacity var(--motion-fast), width var(--motion-fast), transform var(--motion-fast);
}

.sidebar-toggle {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    color: var(--primary);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: color var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

.sidebar-toggle:hover {
    color: #06111f;
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    padding-top: 16px;
    padding-right: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    width: calc(100% - 2px);
    padding: 10px 12px;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--ink);
    background: rgba(107, 183, 255, 0.14);
    border-color: rgba(107, 183, 255, 0.34);
    text-decoration: none;
    transform: none;
    box-shadow: 0 14px 34px rgba(29, 117, 190, 0.12);
}

.sidebar-icon {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.sidebar-badge,
.notification-dot {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    color: #fff;
    background: var(--danger);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.sidebar-badge {
    margin-left: auto;
}

.lucide {
    width: 20px;
    height: 20px;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding-inline: 10px;
}

.sidebar-collapsed .sidebar-head {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: center;
    justify-items: center;
    gap: 8px;
    padding: 0 0 16px;
}

.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    width: 100%;
    gap: 0;
}

.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-label {
    width: 0;
    opacity: 0;
    transform: translateX(-4px);
}

.sidebar-collapsed .sidebar-toggle {
    width: 34px;
    height: 34px;
    margin: 0 auto;
    box-shadow: none;
}

.sidebar-collapsed .sidebar-link {
    width: 46px;
    min-height: 46px;
    justify-content: center;
    justify-self: center;
    padding: 0;
    gap: 0;
}

.sidebar-collapsed .sidebar-link:hover,
.sidebar-collapsed .sidebar-link.active {
    transform: none;
}

.sidebar-collapsed .sidebar-link:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    z-index: 60;
    transform: translateY(-50%);
    width: max-content;
    max-width: 260px;
    padding: 8px 10px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    pointer-events: none;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 800;
    white-space: nowrap;
    transition: color var(--motion-fast), transform var(--motion-fast);
}

.brand:hover {
    color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--bg);
    background: #ffffff;
    border: 1px solid rgba(237, 247, 243, 0.18);
    border-radius: 50%;
    font-size: 11px;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

.tabs {
    display: flex;
    gap: 6px;
    flex: 1;
}

.tabs a {
    color: var(--muted);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
    transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

.tabs a.active,
.tabs a:hover {
    color: var(--ink);
    background: #eef3f0;
    text-decoration: none;
    transform: translateY(-1px);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    min-height: 39px;
    color: var(--muted);
    padding: 10px 14px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

.nav-dropdown-trigger.active,
.nav-dropdown:hover .nav-dropdown-trigger,
.nav-dropdown:focus-within .nav-dropdown-trigger {
    color: var(--ink);
    background: #eef3f0;
    transform: translateY(-1px);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 20;
    display: grid;
    gap: 4px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    min-width: 240px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: opacity var(--motion), transform var(--motion), visibility var(--motion);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown-menu a {
    display: block;
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 8px;
    transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

.nav-dropdown-menu a.active,
.nav-dropdown-menu a:hover {
    color: var(--ink);
    background: var(--surface-soft);
    transform: translateX(2px);
}

.account {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-weight: 700;
}

.global-search {
    display: flex;
    align-items: center;
    width: min(520px, 38vw);
    margin-right: auto;
}

.global-search input {
    min-height: 40px;
    border-radius: 8px 0 0 8px;
}

.global-search button {
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 40px;
    color: var(--ink);
    cursor: pointer;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 8px 8px 0;
}

.notification-link {
    position: relative;
}

.notification-dot {
    position: absolute;
    top: -6px;
    right: -6px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--primary);
    background: #eaf3ef;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}

.icon-button:hover,
.icon-button.active {
    color: #fff;
    background: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(107, 183, 255, 0.22);
}

.icon-danger-button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #ffd8dc;
    background: rgba(239, 95, 107, 0.16);
    border: 1px solid rgba(239, 95, 107, 0.34);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}

.icon-danger-button:hover {
    color: #06111f;
    background: var(--danger);
    border-color: var(--danger);
    transform: translateY(-1px);
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 64px;
}

.has-sidebar .page,
.has-sidebar .site-footer {
    width: min(1320px, calc(100% - var(--sidebar-width) - 64px));
    margin-left: calc(var(--sidebar-width) + max(32px, (100vw - var(--sidebar-width) - 1320px) / 2));
    margin-right: max(32px, (100vw - var(--sidebar-width) - 1320px) / 2);
    transition: margin-left var(--motion), width var(--motion);
}

.has-sidebar.sidebar-collapsed .page,
.has-sidebar.sidebar-collapsed .site-footer {
    width: min(1320px, calc(100% - var(--sidebar-collapsed-width) - 64px));
    margin-left: calc(var(--sidebar-collapsed-width) + max(32px, (100vw - var(--sidebar-collapsed-width) - 1320px) / 2));
    margin-right: max(32px, (100vw - var(--sidebar-collapsed-width) - 1320px) / 2);
}

.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 0 0 22px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.auth-shell {
    min-height: calc(100vh - 150px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
    align-items: center;
    gap: clamp(32px, 6vw, 80px);
}

.auth-intro h1,
.hero h1 {
    max-width: 760px;
    margin: 8px 0 14px;
    font-size: clamp(36px, 6vw, 64px);
    line-height: 1;
    letter-spacing: 0;
}

.auth-intro p,
.hero p {
    max-width: 620px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.panel,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.panel {
    padding: clamp(20px, 3vw, 30px);
}

.auth-card {
    width: 100%;
}

.approval-shell {
    grid-template-columns: minmax(320px, 640px);
    justify-content: center;
    justify-items: center;
}

.approval-card {
    max-width: 640px;
    text-align: center;
}

.approval-card .notice {
    text-align: center;
}

.approval-card .button {
    justify-self: center;
}

.form-heading {
    margin-bottom: 22px;
}

.form-heading h1,
.form-heading h2,
.section-heading h2 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.2;
}

.form-heading p,
.empty {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 700;
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fbfcfb;
    border: 1px solid #cfd9d3;
    border-radius: 8px;
    font: inherit;
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(23, 107, 91, 0.18);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(107, 183, 255, 0.08);
    transform: translateY(-1px);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 800;
}

.switch-control {
    position: relative;
    display: inline-flex;
    width: 46px;
    height: 26px;
    flex: 0 0 auto;
    cursor: pointer;
}

.switch-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: #22344f;
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: background var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
}

.switch-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
    transition: transform var(--motion-fast);
}

.switch-control input:checked + .switch-slider {
    background: var(--primary);
    border-color: var(--primary);
}

.switch-control input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-control input:focus-visible + .switch-slider {
    outline: 2px solid rgba(107, 183, 255, 0.55);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(107, 183, 255, 0.08);
}

.service-switch {
    width: auto;
    height: auto;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 850;
}

.service-switch .switch-slider {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex: 0 0 46px;
}

.switch-label {
    pointer-events: none;
}

.on-call-switch-form {
    margin: 0 0 18px;
}

.checkbox-field span {
    pointer-events: none;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.field-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    box-shadow: 0 12px 32px rgba(107, 183, 255, 0.2);
    transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast), filter var(--motion-fast);
}

.button:hover {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    box-shadow: 0 16px 42px rgba(107, 183, 255, 0.28);
    transform: translateY(-1px);
    text-decoration: none;
}

.button:active,
.icon-button:active,
.tabs a:active,
.nav-dropdown-trigger:active,
.profile-card:active,
.patient-card summary:active,
.catalog-row:active,
.invoice-line:active {
    transform: translateY(1px) scale(0.99);
}

.button.danger {
    background: linear-gradient(135deg, var(--danger), #ff8a94);
    box-shadow: 0 12px 32px rgba(239, 95, 107, 0.18);
}

.button.danger:hover {
    background: linear-gradient(135deg, #ff8a94, var(--danger));
}

.button.secondary {
    color: var(--primary);
    background: #eaf3ef;
    box-shadow: none;
}

.button.secondary:hover {
    color: #fff;
    background: var(--primary);
}

.button.small {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
}

.button:disabled,
.button:disabled:hover {
    cursor: not-allowed;
    color: #8d9891;
    background: #dbe2dd;
}

.switch-link {
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.notice {
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--primary-dark);
    background: var(--success-bg);
    border: 1px solid #c6e5d7;
    font-weight: 700;
    animation: notice-in var(--motion) both;
}

.notice.error {
    color: var(--danger);
    background: var(--error-bg);
    border-color: #ffd2ca;
}

.toast-notice {
    position: fixed;
    top: 82px;
    right: 24px;
    z-index: 120;
    max-width: min(420px, calc(100vw - 48px));
    color: var(--ink);
    background: rgba(17, 24, 39, 0.96);
    border-color: rgba(107, 183, 255, 0.36);
    box-shadow: var(--shadow);
}

.toast-notice.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.dashboard-counter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.dashboard-counter-card,
.search-result-card,
.notification-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}

.dashboard-counter-card:hover,
.search-result-card:hover,
.notification-card:hover {
    background: var(--surface-soft);
    border-color: rgba(107, 183, 255, 0.46);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.notification-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.notification-card-content {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: inherit;
}

.notification-card-content:hover {
    text-decoration: none;
}

.notification-delete-form {
    margin: 0;
}

.notification-delete-form .icon-danger-button {
    width: 34px;
    height: 34px;
}

.dashboard-counter-card span,
.search-result-card span,
.notification-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.dashboard-counter-card strong {
    font-size: 28px;
}

.dashboard-counter-card small {
    color: var(--primary);
    font-weight: 850;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.today-appointment-card.important {
    border-color: rgba(107, 183, 255, 0.56);
    box-shadow: 0 18px 46px rgba(107, 183, 255, 0.14);
}

.active-service-panel {
    margin-bottom: 24px;
}

.on-call-panel {
    margin-bottom: 24px;
}

.active-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.service-person-card {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(86px, 0.6fr));
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.service-person-main {
    display: grid;
    gap: 4px;
}

.service-person-main strong {
    font-size: 17px;
    overflow-wrap: anywhere;
}

.service-person-main span,
.service-person-meta span {
    color: var(--muted);
    font-weight: 700;
}

.service-person-meta {
    display: grid;
    gap: 4px;
    padding: 10px;
    background: rgba(9, 15, 26, 0.32);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.service-person-meta strong {
    color: var(--ink);
    font-size: 16px;
}

.on-call-card {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 160px);
    border-color: rgba(107, 183, 255, 0.34);
    background: linear-gradient(135deg, rgba(107, 183, 255, 0.13), rgba(18, 31, 51, 0.72));
}

.today-appointments-panel {
    margin-bottom: 24px;
}

.pending-requests-panel {
    margin-bottom: 24px;
}

.communication-hero {
    margin-bottom: 22px;
}

.communication-compose {
    margin-bottom: 22px;
}

.communication-topic-admin {
    margin-bottom: 22px;
}

.communication-admin-dropdown {
    margin-bottom: 14px;
}

.communication-topic-form {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 14px;
}

.communication-topic-edit-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.communication-topic-edit-form {
    display: grid;
    grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1fr) auto auto;
    align-items: end;
    gap: 12px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.communication-topic-edit-form > span {
    align-self: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.communication-form {
    max-width: 760px;
}

.communication-topic-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 22px;
}

.communication-topic-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 850;
    transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}

.communication-topic-tabs a:hover,
.communication-topic-tabs a.active {
    color: var(--ink);
    background: rgba(107, 183, 255, 0.14);
    border-color: rgba(107, 183, 255, 0.34);
    text-decoration: none;
    transform: translateY(-1px);
}

.communication-topic-tabs span {
    color: var(--primary);
    font-size: 12px;
}

.communication-feed {
    display: grid;
    gap: 18px;
}

.communication-post {
    overflow: hidden;
    padding: 0;
}

.communication-post-media {
    display: grid;
    place-items: center;
    padding: 0 clamp(20px, 3vw, 30px) clamp(20px, 3vw, 30px);
}

.communication-image-button {
    display: grid;
    place-items: center;
    max-width: 100%;
    padding: 0;
    cursor: zoom-in;
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.communication-image-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

.communication-post-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.communication-image-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    place-items: center;
    padding: clamp(18px, 4vw, 48px);
    background: rgba(3, 9, 18, 0.88);
    backdrop-filter: blur(8px);
}

.communication-image-modal.is-open {
    display: grid;
}

.communication-image-modal img {
    max-width: min(100%, 1180px);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.communication-image-modal-close {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 201;
    padding: 10px 14px;
    color: var(--ink);
    font-weight: 850;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.communication-post-body {
    display: grid;
    gap: 16px;
    padding: clamp(20px, 3vw, 30px);
}

.communication-text {
    color: var(--ink);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.communication-text a {
    color: var(--primary);
    font-weight: 850;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.communication-search-panel {
    margin-bottom: 18px;
}

.search-page-form,
.ward-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 10px;
    align-items: end;
}

.search-result-list,
.notification-list,
.compact-list {
    display: grid;
    gap: 10px;
}

.notification-card.unread {
    border-color: rgba(239, 95, 107, 0.5);
    box-shadow: 0 18px 48px rgba(239, 95, 107, 0.12);
}

.notification-card em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.activity-grid,
.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.patient-card.long-stay {
    border-color: rgba(255, 184, 107, 0.55);
    box-shadow: 0 18px 48px rgba(255, 184, 107, 0.1);
}

.patient-status-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pending-request-list {
    display: grid;
    gap: 10px;
}

.pending-request-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(180px, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.pending-request-card div {
    display: grid;
    gap: 4px;
}

.pending-request-card strong {
    color: var(--ink);
    overflow-wrap: anywhere;
}

.pending-request-card span {
    color: var(--muted);
    font-weight: 800;
}

.today-appointments-list {
    display: grid;
    gap: 10px;
}

.today-appointment-card {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.8fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.today-appointment-card div {
    display: grid;
    gap: 4px;
}

.today-appointment-card strong {
    color: var(--ink);
}

.today-appointment-card span {
    color: var(--muted);
    font-weight: 800;
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 34px;
    line-height: 1;
}

.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin: -6px 0 24px;
}

.profile-detail-card {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.profile-detail-card span {
    color: var(--muted);
    font-weight: 800;
}

.profile-detail-card strong {
    color: var(--ink);
    font-size: 16px;
    overflow-wrap: anywhere;
}

.two-columns,
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    align-items: start;
}

.notifications-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: 22px;
    align-items: start;
}

.sound-settings-form {
    display: grid;
    gap: 12px;
}

.sound-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.sound-option div {
    display: grid;
    gap: 4px;
}

.sound-option strong {
    color: var(--ink);
}

.sound-option span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.content-grid {
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.ward-page-grid {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr) 150px;
    gap: 22px;
    align-items: start;
}

.ward-registry-box {
    display: flex;
    justify-content: flex-start;
    padding-top: 8px;
}

.ward-registry-box .button {
    width: auto;
    min-height: 36px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
}

.billing-tool-shell {
    display: flex;
    justify-content: center;
}

.billing-tool-shell .panel {
    width: min(100%, 420px);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.section-heading span {
    color: var(--muted);
    font-weight: 700;
}

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.billing-total-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.billing-total-summary span {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    padding: 7px 10px;
    color: var(--ink);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
}

.status-filter {
    min-height: 38px;
    padding: 8px 12px;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    background: #f7faf8;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.status-filter:hover,
.status-filter.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.list {
    display: grid;
    gap: 10px;
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.list-row div {
    display: grid;
    gap: 5px;
}

.list-row span {
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

th,
td {
    padding: 13px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.compact-mode th,
.compact-mode td {
    padding: 8px 9px;
    font-size: 13px;
}

.compact-mode .panel {
    padding: 18px;
}

.compact-mode .list-row {
    padding: 8px 0;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    color: var(--primary-dark);
    background: #e7f1ed;
    border-radius: 8px;
    font-weight: 800;
}

.selected-item {
    display: grid;
    gap: 6px;
    padding: 16px;
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.selected-item span,
.muted {
    color: var(--muted);
}

.selected-item span {
    font-weight: 800;
}

.selected-item strong {
    font-size: 28px;
}

.selected-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.autocomplete {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.autocomplete-option {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background var(--motion-fast), transform var(--motion-fast), color var(--motion-fast);
}

.autocomplete-option:hover,
.autocomplete-option:focus {
    background: #eef3f0;
    outline: none;
    transform: translateX(2px);
}

.autocomplete-option span {
    display: grid;
    gap: 4px;
}

.autocomplete-option small,
.autocomplete-option em,
.autocomplete-empty {
    color: var(--muted);
}

.autocomplete-option em {
    flex: 0 0 auto;
    font-style: normal;
    font-weight: 800;
}

.autocomplete-empty {
    padding: 12px;
    font-weight: 700;
}

.invoice-lines,
.catalog-list {
    display: grid;
    gap: 10px;
}

.invoice-line,
.catalog-row {
    padding: 14px;
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.invoice-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.invoice-line div {
    display: grid;
    gap: 4px;
}

.invoice-line span {
    color: var(--muted);
}

.catalog-edit-form {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) minmax(100px, 0.65fr) minmax(160px, 1.4fr) auto;
    gap: 10px;
    align-items: end;
}

.catalog-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.inline-form {
    display: inline-grid;
    gap: 0;
}

.status-update-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 320px;
}

.service-time-form,
.service-admin-form {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.service-admin-form {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    margin-bottom: 8px;
}

.service-time-form label,
.service-admin-form label {
    gap: 4px;
    font-size: 12px;
}

.service-time-form input,
.service-admin-form input {
    min-height: 36px;
    padding: 7px 9px;
}

.service-admin-form .button {
    grid-column: 1 / -1;
}

.status-update-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.status-update-controls select {
    min-height: 36px;
    padding: 8px 10px;
}

.archive-form {
    display: grid;
    grid-template-columns: minmax(120px, 160px) auto;
    align-items: end;
    gap: 10px;
}

.public-service-pdf-form {
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 0.45fr) minmax(120px, 0.45fr) minmax(240px, 1fr) auto;
}

.pdf-week-preview {
    margin: 0;
    min-height: 68px;
}

.management-panel {
    margin-top: 22px;
}

.management-dropdown {
    margin-top: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.management-dropdown summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 58px;
    padding: 16px 20px;
    cursor: pointer;
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    list-style: none;
    transition: color var(--motion-fast), background var(--motion-fast);
}

.management-dropdown summary:hover {
    background: rgba(107, 183, 255, 0.08);
}

.management-dropdown summary::-webkit-details-marker {
    display: none;
}

.management-dropdown summary::after {
    content: "⌄";
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: var(--primary);
    background: #eaf3ef;
    border-radius: 8px;
    transition: transform var(--motion), background var(--motion-fast), color var(--motion-fast);
}

.management-dropdown[open] summary::after {
    content: "⌃";
    transform: rotate(180deg);
}

.management-dropdown .dropdown-body {
    padding: 0 20px 20px;
}

.management-dropdown[open] .dropdown-body,
.sub-dropdown[open] > .panel,
.patient-card[open] .patient-details {
    animation: dropdown-in var(--motion) both;
}

.management-dropdown .dropdown-body > .panel,
.management-dropdown .dropdown-body > .content-grid {
    margin-top: 0;
}

.sub-dropdown {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion);
}

.sub-dropdown > summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    transition: color var(--motion-fast), background var(--motion-fast);
}

.sub-dropdown > summary:hover {
    background: rgba(107, 183, 255, 0.08);
}

.sub-dropdown > summary::-webkit-details-marker {
    display: none;
}

.sub-dropdown > .panel {
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
}

.patient-card {
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.patient-card.lspd-arrest {
    color: #2a1116;
    background: #ffdfe4;
    border-color: #ef7b87;
}

.patient-card.lspd-arrest summary span,
.patient-card.lspd-arrest .patient-details span {
    color: #7a2b35;
}

.patient-card.lspd-arrest strong {
    color: #2a1116;
}

.patient-card.lspd-deposition {
    color: #2c1907;
    background: #ffe4bd;
    border-color: #f3a64b;
}

.patient-card.lspd-deposition summary span,
.patient-card.lspd-deposition .patient-details span {
    color: #86510f;
}

.patient-card.lspd-deposition strong {
    color: #2c1907;
}

.patient-card summary {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(190px, 1.6fr) minmax(92px, auto);
    gap: 10px;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    list-style: none;
    transition: background var(--motion-fast);
}

.patient-card summary:hover {
    background: rgba(107, 183, 255, 0.08);
}

.patient-card summary::-webkit-details-marker {
    display: none;
}

.patient-card summary span,
.patient-details span {
    color: var(--muted);
    font-weight: 700;
}

.patient-details {
    display: grid;
    gap: 12px;
    padding: 0 15px 15px;
}

.patient-details div {
    display: grid;
    gap: 4px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.profile-card {
    display: grid;
    gap: 7px;
    padding: 15px;
    color: var(--ink);
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color var(--motion), box-shadow var(--motion), transform var(--motion), background var(--motion);
}

.profile-card:hover,
.profile-card.active {
    background: #eef3f0;
    border-color: var(--primary);
    text-decoration: none;
}

.profile-card span {
    color: var(--muted);
    font-weight: 700;
}

.archive-card a {
    display: grid;
    gap: 7px;
    color: inherit;
}

.archive-card a:hover {
    text-decoration: none;
}

.archive-card form {
    margin-top: 10px;
}

.punch-panel {
    display: grid;
    gap: 20px;
}

.clock-box,
.active-service {
    display: grid;
    gap: 8px;
    padding: 18px;
    background: #f7faf8;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.clock-box span,
.active-service span {
    color: var(--muted);
    font-weight: 800;
}

.clock-box strong {
    font-size: 28px;
    line-height: 1.15;
}

.active-service strong {
    font-size: 24px;
    line-height: 1.15;
}

/* Dark theme overrides for reusable light blocks. */
.tabs a.active,
.tabs a:hover,
.nav-dropdown-trigger.active,
.nav-dropdown:hover .nav-dropdown-trigger,
.nav-dropdown:focus-within .nav-dropdown-trigger,
.icon-button,
.button.secondary,
.selected-item,
.clock-box,
.active-service,
.service-person-card,
.invoice-line,
.catalog-row,
.profile-card,
.patient-card,
.status-filter,
.sub-dropdown {
    background: var(--surface-soft);
}

.icon-button,
.button.secondary,
a,
.tabs a.active,
.tabs a:hover,
.nav-dropdown-trigger.active,
.nav-dropdown:hover .nav-dropdown-trigger,
.nav-dropdown:focus-within .nav-dropdown-trigger {
    color: var(--primary);
}

.button,
.button.secondary:hover,
.icon-button:hover,
.icon-button.active,
.status-filter:hover,
.status-filter.active {
    color: #06111f;
}

input,
select,
textarea {
    color: var(--ink);
    background: #0d1524;
    border-color: var(--line);
}

select option {
    color: #06111f;
    background: #ffffff;
}

input::placeholder,
textarea::placeholder {
    color: #7188a3;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline-color: rgba(107, 183, 255, 0.24);
}

th,
td,
.list-row {
    border-color: var(--line);
}

.badge {
    color: var(--primary);
    background: #102944;
}

.notice.success,
.notice.error {
    color: var(--ink);
}

.autocomplete-results {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: var(--shadow);
}

.autocomplete-option {
    color: var(--ink);
}

.autocomplete-option:hover,
.autocomplete-option:focus,
.profile-card:hover,
.profile-card.active {
    background: #1d2e49;
    border-color: var(--primary);
}

.panel:hover,
.stat-card:hover,
.selected-item:hover,
.service-person-card:hover,
.pending-request-card:hover,
.invoice-line:hover,
.catalog-row:hover,
.profile-card:hover,
.patient-card:hover,
.management-dropdown:hover,
.sub-dropdown:hover {
    border-color: rgba(107, 183, 255, 0.58);
    box-shadow: var(--shadow-hover);
}

.selected-item:hover,
.service-person-card:hover,
.pending-request-card:hover,
.invoice-line:hover,
.catalog-row:hover,
.profile-card:hover,
.patient-card:hover {
    transform: translateY(-2px);
}

.patient-card.lspd-arrest:hover {
    box-shadow: 0 24px 70px rgba(239, 95, 107, 0.2);
}

.patient-card.lspd-deposition:hover {
    box-shadow: 0 24px 70px rgba(243, 166, 75, 0.2);
}

@keyframes dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notice-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}

.live-refresh-banner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    max-width: min(360px, calc(100% - 40px));
    padding: 12px 16px;
    color: #06111f;
    background: var(--primary);
    border: 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.live-refresh-banner:hover {
    background: var(--accent);
}

.on-call-alert-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(5, 10, 18, 0.72);
    backdrop-filter: blur(8px);
}

.on-call-alert-box {
    width: min(520px, 100%);
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: 30px;
    color: var(--ink);
    text-align: center;
    background: var(--surface);
    border: 1px solid rgba(107, 183, 255, 0.48);
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
    animation: notice-in var(--motion) both;
}

.on-call-alert-box strong {
    color: var(--primary);
    font-size: 15px;
    text-transform: uppercase;
}

.on-call-alert-box p {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
    font-weight: 900;
}

.agenda-shell {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.agenda-form {
    position: sticky;
    top: 92px;
}

.agenda-main {
    display: grid;
    gap: 18px;
}

.agenda-toolbar {
    display: grid;
    gap: 16px;
}

.agenda-toolbar h1 {
    margin: 0 0 6px;
}

.agenda-toolbar p {
    margin: 0;
    color: var(--muted);
}

.agenda-actions,
.agenda-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.agenda-view-tabs a {
    min-height: 36px;
    padding: 8px 12px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
    transition: color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast), border-color var(--motion-fast);
}

.agenda-view-tabs a:hover,
.agenda-view-tabs a.active {
    color: #06111f;
    background: var(--primary);
    border-color: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.agenda-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.agenda-slots article {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: rgba(24, 34, 53, 0.88);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.agenda-slots span,
.agenda-slots small {
    color: var(--muted);
    font-weight: 700;
}

.agenda-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.agenda-board.month-view {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.agenda-day {
    min-height: 220px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.agenda-day.today {
    border-color: rgba(107, 183, 255, 0.72);
    box-shadow: 0 22px 70px rgba(107, 183, 255, 0.12);
}

.agenda-day header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--ink);
}

.agenda-day header span {
    color: var(--muted);
    font-weight: 800;
}

.agenda-day-list {
    display: grid;
    gap: 10px;
}

.appointment-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
}

.appointment-card:hover {
    border-color: rgba(107, 183, 255, 0.55);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.appointment-card[open] {
    position: fixed;
    inset: 5vh max(18px, calc((100vw - 980px) / 2));
    z-index: 70;
    display: grid;
    align-content: start;
    max-height: 90vh;
    overflow: auto;
    background: var(--surface);
    border-color: rgba(107, 183, 255, 0.76);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.64);
    transform: none;
}

.appointment-card[open]::before {
    content: "";
    position: fixed;
    inset: -100vh -100vw;
    z-index: -1;
    background: rgba(2, 8, 17, 0.72);
    backdrop-filter: blur(6px);
}

.appointment-card summary {
    display: grid;
    gap: 4px;
    padding: 12px;
    cursor: pointer;
    list-style: none;
}

.appointment-card summary::-webkit-details-marker {
    display: none;
}

.appointment-card summary span {
    color: var(--accent);
    font-weight: 900;
    font-size: 13px;
}

.appointment-card summary strong {
    color: var(--ink);
}

.appointment-card summary small {
    color: var(--muted);
    font-weight: 800;
}

.appointment-card[open] summary {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 22px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.appointment-card[open] summary::after {
    content: "Cliquer pour refermer";
    justify-self: start;
    width: fit-content;
    margin-top: 8px;
    padding: 6px 10px;
    color: var(--primary);
    background: rgba(107, 183, 255, 0.12);
    border: 1px solid rgba(107, 183, 255, 0.28);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
}

.appointment-card[open] summary strong {
    font-size: clamp(24px, 3vw, 34px);
}

.appointment-card[open] summary span {
    font-size: 15px;
}

.appointment-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    padding: 0 12px 12px;
}

.appointment-card[open] .appointment-details {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    padding: 18px 24px;
}

.appointment-details div {
    display: grid;
    gap: 4px;
    padding: 10px;
    background: rgba(9, 15, 26, 0.38);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.appointment-details strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.appointment-details span {
    color: var(--ink);
    overflow-wrap: anywhere;
}

.appointment-card[open] .appointment-details span {
    white-space: pre-wrap;
    line-height: 1.5;
}

.appointment-edit-form {
    padding: 12px;
    border-top: 1px solid var(--line);
}

.appointment-card[open] .appointment-edit-form {
    padding: 20px 24px 24px;
}

.agenda-today {
    box-shadow: none;
}

.request-list {
    display: grid;
    gap: 12px;
}

.request-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast), background var(--motion-fast);
}

.request-card:hover {
    border-color: rgba(107, 183, 255, 0.58);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.request-card.is-planned {
    background: rgba(18, 40, 63, 0.82);
}

.request-card summary {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
}

.request-card summary::-webkit-details-marker {
    display: none;
}

.request-card summary div {
    display: grid;
    gap: 4px;
}

.request-card summary strong {
    color: var(--ink);
    font-size: 17px;
}

.request-card summary span {
    color: var(--muted);
    font-weight: 800;
}

.request-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    padding: 0 16px 14px;
}

.request-details div {
    display: grid;
    gap: 5px;
    padding: 12px;
    background: rgba(9, 15, 26, 0.38);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.request-details strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.request-details span {
    color: var(--ink);
    overflow-wrap: anywhere;
}

.request-raw-answers {
    display: grid;
    gap: 10px;
    padding: 0 16px 14px;
}

.request-raw-answers h3 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
}

.request-raw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.request-raw-grid div {
    display: grid;
    gap: 6px;
    padding: 12px;
    background: rgba(9, 15, 26, 0.28);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.request-raw-grid strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.request-raw-grid span {
    color: var(--ink);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.request-assign-form {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--line);
}

.request-delete-form {
    display: flex;
    justify-content: flex-end;
    padding: 0 16px 16px;
}

@media (max-width: 860px) {
    .topbar {
        position: static;
        flex-wrap: wrap;
    }

    .has-sidebar .topbar,
    .has-sidebar.sidebar-collapsed .topbar {
        position: sticky;
        top: 0;
        margin-left: var(--sidebar-collapsed-width);
    }

    .has-sidebar .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .has-sidebar:not(.sidebar-collapsed) .sidebar {
        width: min(284px, calc(100vw - 24px));
        box-shadow: 22px 0 70px rgba(0, 0, 0, 0.42);
    }

    .has-sidebar .sidebar-brand-text,
    .has-sidebar .sidebar-label {
        width: 0;
        opacity: 0;
        transform: translateX(-4px);
    }

    .has-sidebar:not(.sidebar-collapsed) .sidebar-brand-text,
    .has-sidebar:not(.sidebar-collapsed) .sidebar-label {
        width: auto;
        opacity: 1;
        transform: none;
    }

    .has-sidebar .sidebar-head {
        justify-content: center;
        padding-inline: 0;
    }

    .has-sidebar:not(.sidebar-collapsed) .sidebar-head {
        justify-content: space-between;
        padding-inline: 4px;
    }

    .has-sidebar .sidebar-link {
        justify-content: center;
        padding-inline: 10px;
    }

    .has-sidebar:not(.sidebar-collapsed) .sidebar-link {
        justify-content: flex-start;
        padding-inline: 12px;
    }

    .has-sidebar .page,
    .has-sidebar .site-footer,
    .has-sidebar.sidebar-collapsed .page,
    .has-sidebar.sidebar-collapsed .site-footer {
        width: min(1180px, calc(100% - var(--sidebar-collapsed-width) - 24px));
        margin-left: calc(var(--sidebar-collapsed-width) + 12px);
        margin-right: 12px;
    }

    .tabs {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .nav-dropdown-menu {
        position: fixed;
        top: auto;
        min-width: 220px;
    }

    .account {
        margin-left: auto;
    }

    .auth-shell,
    .two-columns,
    .notifications-layout,
    .content-grid,
    .ward-page-grid,
    .agenda-shell,
    .activity-grid,
    .help-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-counter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .global-search {
        order: 3;
        width: 100%;
    }

    .communication-topic-form,
    .communication-topic-edit-form,
    .search-page-form,
    .ward-filter-form {
        grid-template-columns: 1fr;
    }

    .agenda-form {
        position: static;
    }

    .agenda-board.month-view {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .service-person-card,
    .pending-request-card,
    .today-appointment-card {
        grid-template-columns: 1fr;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .catalog-edit-form {
        grid-template-columns: 1fr;
    }

    .invoice-line {
        align-items: stretch;
        flex-direction: column;
    }

    .patient-card summary {
        grid-template-columns: 1fr;
    }

    .archive-form {
        grid-template-columns: 1fr;
    }

    .auth-intro h1,
    .hero h1 {
        font-size: 38px;
    }
}

@media (max-width: 560px) {
    .page {
        width: min(100% - 24px, 1180px);
        padding-top: 24px;
    }

    .has-sidebar .page,
    .has-sidebar .site-footer,
    .has-sidebar.sidebar-collapsed .page,
    .has-sidebar.sidebar-collapsed .site-footer {
        width: calc(100% - var(--sidebar-collapsed-width) - 18px);
        margin-left: calc(var(--sidebar-collapsed-width) + 9px);
        margin-right: 9px;
    }

    .topbar {
        padding: 12px;
        gap: 12px;
    }

    .account {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .tabs a {
        padding: 10px 12px;
    }

    .panel {
        padding: 18px;
    }
}
