:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --primary: #155e75;
    --primary-dark: #0f4556;
    --primary-soft: #e6f6fa;
    --border: #e5e7eb;
    --danger: #dc2626;
    --success: #15803d;
    --warning: #d97706;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(21, 94, 117, 0.10), transparent 34%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
    color: var(--text);
    font-family: "Cairo", sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(10px);
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-card {
    min-width: 260px;
    padding: 28px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.loader-ring {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 5px solid #dbeafe;
    border-top-color: var(--primary);
    animation: spin 0.85s linear infinite;
}

.loader-title {
    font-size: 20px;
    font-weight: 900;
}

.loader-subtitle {
    margin-top: 6px;
    color: var(--muted);
    font-size: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.main-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.topbar-container {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    min-height: 82px;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-brand {
    min-width: 245px;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-size: 32px;
    font-weight: 900;
    overflow: hidden;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
}

.brand-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.nav-link {
    min-height: 44px;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 14px;
    color: #334155;
    border: 1px solid transparent;
    transition: 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(21, 94, 117, 0.18);
}

.topbar-user {
    min-width: 260px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.user-pill {
    min-height: 48px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 18px;
    font-weight: 900;
}

.user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 900;
    color: var(--text);
    font-size: 14px;
}

.user-role {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.logout-form {
    margin: 0;
}

.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
}

.mobile-nav-panel {
    display: none;
}

.page-wrapper {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 150px);
}

.page-header-card {
    margin-bottom: 20px;
    padding: 22px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.page-title {
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
}

.page-subtitle {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-footer {
    max-width: 1500px;
    margin: 0 auto;
    padding: 18px 24px 26px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.card,
.panel,
.box,
.stats-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card {
    padding: 22px;
}

.btn {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 900;
    transition: 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-light {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid;
    background: #fff;
    font-weight: 700;
}

.alert ul {
    margin: 8px 0 0;
}

.alert-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.alert-danger {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-warning {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

input,
select,
textarea,
.form-control,
.form-select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 13px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: 0.2s ease;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21, 94, 117, 0.12);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 900;
    color: #243044;
}

.table-wrapper,
.responsive-table {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 9px;
}

thead th {
    color: var(--muted);
    font-size: 14px;
    font-weight: 900;
    padding: 10px 14px;
    text-align: right;
}

tbody tr {
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

tbody td {
    padding: 14px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

tbody td:first-child {
    border-right: 1px solid var(--border);
    border-radius: 0 16px 16px 0;
}

tbody td:last-child {
    border-left: 1px solid var(--border);
    border-radius: 16px 0 0 16px;
}

.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
    background: var(--primary-soft);
    color: var(--primary);
}

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

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

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

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

@media (max-width: 1200px) {
    .topbar-container {
        flex-wrap: wrap;
    }

    .topbar-brand {
        flex: 1;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-top: 8px;
    }

    .topbar-user {
        min-width: auto;
    }
}

@media (max-width: 820px) {
    .topbar-container {
        min-height: 72px;
        padding: 10px 14px;
    }

    .brand-title {
        font-size: 16px;
    }

    .brand-subtitle {
        font-size: 12px;
    }

    .mobile-menu-btn {
        display: grid;
        place-items: center;
    }

    .main-nav {
        display: none;
    }

    .topbar-user {
        display: none;
    }

    .mobile-nav-panel {
        display: none;
        position: sticky;
        top: 72px;
        z-index: 999;
        margin: 0 12px;
        padding: 12px;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 0 0 20px 20px;
        box-shadow: var(--shadow);
    }

    body.mobile-nav-open .mobile-nav-panel {
        display: grid;
        gap: 8px;
    }

    .mobile-nav-link {
        padding: 13px 14px;
        display: flex;
        align-items: center;
        gap: 10px;
        border-radius: 14px;
        background: #f8fafc;
        color: var(--text);
    }

    .mobile-nav-link.active {
        background: var(--primary);
        color: #fff;
    }

    .mobile-logout-form {
        margin: 6px 0 0;
    }

    .page-wrapper {
        padding: 16px;
    }

    .page-header-card {
        padding: 18px;
        flex-direction: column;
        align-items: stretch;
    }

    .page-title {
        font-size: 23px;
    }

    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .page-actions .btn {
        flex: 1;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .app-footer {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }
}

@media (max-width: 520px) {
    .brand-info {
        max-width: 190px;
    }

    .brand-title,
    .brand-subtitle {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .brand-logo {
        width: 46px;
        height: 46px;
        min-width: 46px;
    }

    .btn {
        width: 100%;
    }
}

@media print {
    .main-topbar,
    .mobile-nav-panel,
    .page-loader,
    .app-footer,
    .page-header-card {
        display: none !important;
    }

    .page-wrapper {
        max-width: none;
        padding: 0;
        margin: 0;
        background: #fff;
    }

    .card {
        box-shadow: none;
        border: none;
    }
}

.embedded-mini-form {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #f8fafc;
}

.embedded-mini-form h2 {
    margin: 0 0 16px;
    font-size: 21px;
    font-weight: 900;
    color: var(--text);
}

.embedded-mini-form .primary-button {
    margin-top: 12px;
}

.room-board-note {
    margin: 6px 0 18px;
    color: var(--muted);
    font-weight: 700;
}



.exact-room-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exact-room-column h3 {
    margin-bottom: 8px;
}

.exact-slot-patient {
    margin-top: 10px;
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
}

.exact-slot-details {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-weight: 700;
}

.exact-slot-doctor {
    margin-top: 8px;
    color: var(--primary-dark);
    font-weight: 800;
}

.empty-room {
    padding: 18px;
    border-radius: 16px;
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--border);
    font-weight: 800;
}

/*.modern-room-board {*/
/*    padding: 24px;*/
/*    border-radius: 22px;*/
/*    background: #ffffff;*/
/*    border: 1px solid var(--border);*/
/*    box-shadow: var(--shadow);*/
/*}*/

.modern-room-title-row {
    margin-bottom: 20px;
}

.modern-room-title-row h2 {
    margin: 0;
    font-size: 25px;
    font-weight: 900;
    color: var(--text);
}

.modern-room-title-row p {
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 700;
}

/*.modern-room-grid {*/
/*    display: grid;*/
/*    grid-template-columns: repeat(3, minmax(0, 1fr));*/
/*    gap: 16px;*/
/*}*/

.modern-room-column {
    min-height: 260px;
    padding: 16px;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px solid #dbe3ee;
}

.modern-room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid #dbe3ee;
}

.modern-room-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    color: var(--primary-dark);
}

.modern-room-header span {
    padding: 5px 10px;
    border-radius: 999px;
    background: #e6f6fa;
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
}

.modern-room-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/*.modern-surgery-card {*/
/*    display: block;*/
/*    padding: 14px;*/
/*    border-radius: 18px;*/
/*    background: #ffffff;*/
/*    border: 1px solid #dbe3ee;*/
/*    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);*/
/*    transition: 0.2s ease;*/
/*    color: var(--text);*/
/*    text-align: right;*/
/*}*/

/*.modern-surgery-card:hover {*/
/*    transform: translateY(-2px);*/
/*    border-color: var(--primary);*/
/*    background: #f0fbfd;*/
/*}*/

.modern-surgery-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.time-badge {
    direction: ltr;
    unicode-bidi: plaintext;
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
}

.duration-badge {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef6ff;
    color: #0f3b66;
    font-size: 13px;
    font-weight: 900;
}

.modern-surgery-patient {
    font-size: 19px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 6px;
}

.modern-surgery-name {
    color: var(--muted);
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 10px;
}

.modern-surgery-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dbe3ee;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 800;
}

.modern-empty-room {
    min-height: 150px;
    display: grid;
    place-items: center;
    padding: 18px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    color: var(--muted);
    font-weight: 900;
    text-align: center;
}

@media (max-width: 1100px) {
    .modern-room-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .modern-room-board {
        padding: 16px;
    }

    .modern-surgery-time,
    .modern-surgery-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .time-badge,
    .duration-badge {
        width: 100%;
        justify-content: center;
    }
}

.availability-board {
    margin-top: 22px;
    padding: 24px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.availability-header {
    margin-bottom: 20px;
}

.availability-header h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    color: var(--text);
}

.availability-header p {
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 700;
}

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

.availability-room {
    border: 1px solid #dbe3ee;
    border-radius: 22px;
    background: #f8fafc;
    overflow: hidden;
}

.availability-room-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eef6ff;
    border-bottom: 1px solid #dbe3ee;
}

.availability-room-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 900;
    color: var(--primary-dark);
}

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

.availability-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.availability-block {
    display: block;
    padding: 15px;
    border-radius: 18px;
    border: 1px solid;
    transition: 0.2s ease;
    text-align: right;
}

.availability-block:hover {
    transform: translateY(-2px);
}

.free-block {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}

.free-block:hover {
    background: #dcfce7;
}

.busy-block {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #7c2d12;
}

.busy-block:hover {
    background: #ffedd5;
}

.busy-block.locked {
    opacity: 0.82;
    cursor: not-allowed;
}

.block-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.block-status {
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
}

.block-status.free {
    background: #16a34a;
    color: #ffffff;
}

.block-status.busy {
    background: #ea580c;
    color: #ffffff;
}

.block-time {
    direction: ltr;
    unicode-bidi: plaintext;
    font-size: 16px;
    font-weight: 900;
}

.block-title {
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 6px;
}

.block-subtitle {
    color: inherit;
    opacity: 0.78;
    font-weight: 800;
    margin-bottom: 10px;
}

.block-footer {
    padding-top: 10px;
    border-top: 1px dashed rgba(15, 23, 42, 0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 800;
}

@media (max-width: 1100px) {
    .availability-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .availability-board {
        padding: 16px;
    }

    .block-top,
    .block-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .block-time {
        width: 100%;
    }
}

.short-block {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
    opacity: 0.88;
    cursor: not-allowed;
}

.block-status.short {
    background: #64748b;
    color: #ffffff;
}

.is-invalid {
    border-color: #dc2626 !important;
    background: #fff7f7 !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.10) !important;
}

.field-error {
    margin-top: 6px;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 800;
}

#client-validation-box {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}


.important-links-section {
    padding: 24px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.important-links-heading {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.important-links-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    font-weight: 900;
}

.important-links-heading p {
    margin: 7px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.important-links-count {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 900;
    white-space: nowrap;
}

.important-links-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.important-link-card {
    min-height: 225px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    border: 1px solid #dbe3ee;
    border-radius: 22px;
    background:
        radial-gradient(
            circle at top left,
            rgba(21, 94, 117, 0.10),
            transparent 40%
        ),
        #ffffff;
    color: var(--text);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.important-link-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.10);
}

.important-link-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.important-link-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: var(--primary);
    color: #ffffff;
    font-size: 27px;
}

.important-link-number {
    color: #94a3b8;
    font-size: 17px;
    font-weight: 900;
}

.important-link-content {
    flex: 1;
    padding-top: 18px;
}

.important-link-content h3 {
    margin: 0;
    font-size: 21px;
    font-weight: 900;
    color: var(--text);
}

.important-link-content p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.8;
    font-weight: 700;
}

.important-link-footer {
    margin-top: 18px;
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed #dbe3ee;
    color: var(--primary);
    font-weight: 900;
}

.important-link-arrow {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    transition: 0.2s ease;
}

.important-link-card:hover .important-link-arrow {
    background: var(--primary);
    color: #ffffff;
}

.important-links-empty {
    grid-column: 1 / -1;
    padding: 35px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
    font-weight: 900;
}

@media (max-width: 1100px) {
    .important-links-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .important-links-section {
        padding: 16px;
    }

    .important-links-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .important-links-grid {
        grid-template-columns: 1fr;
    }

    .important-link-card {
        min-height: 200px;
    }
}


.report-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.report-fieldset:disabled {
    opacity: 0.78;
}

.report-fieldset:disabled input,
.report-fieldset:disabled select,
.report-fieldset:disabled textarea {
    cursor: not-allowed;
    background: #f8fafc;
}

.report-access-message {
    margin-bottom: 18px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1px solid;
    border-radius: 16px;
}

.report-access-open {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.report-access-locked {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.monitoring-toolbar {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.monitoring-toolbar h2 {
    margin: 0;
    font-size: 22px;
}

.monitoring-toolbar p {
    margin: 5px 0 0;
    color: var(--muted);
}

.monitoring-table-wrapper {
    overflow-x: auto;
}

.anesthesia-monitoring-table {
    min-width: 1500px;
}

.anesthesia-monitoring-table input,
.anesthesia-monitoring-table select {
    min-width: 90px;
    padding: 8px;
}

.anesthesia-monitoring-table input[type="datetime-local"] {
    min-width: 185px;
}

.elapsed-time {
    display: inline-flex;
    min-width: 70px;
    justify-content: center;
    padding: 6px 8px;
    border-radius: 999px;
    background: #eef6ff;
    color: #0f3b66;
    font-weight: 900;
}

.monitoring-remove-button {
    padding: 7px 10px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    cursor: pointer;
    font-weight: 900;
}

.vital-warning-input {
    border-color: #f59e0b !important;
    background: #fffbeb !important;
}

.vital-danger-input {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
    color: #991b1b !important;
    font-weight: 900;
}

.vital-danger {
    background: #dc2626;
    color: #ffffff;
}

@media (max-width: 700px) {
    .monitoring-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}



/* =========================================================
   خيار تم إجراء العمل الجراحي
   ========================================================= */

.surgery-completed-toggle {
    position: relative;
    width: 100%;
    margin-bottom: 22px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

/*
 * منع التنسيق العام للـ input من تكبير checkbox.
 */
.surgery-completed-toggle > input[type="checkbox"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.surgery-completed-toggle:hover {
    border-color: #0f6b82;
    background: #f1f9fb;
    box-shadow: 0 8px 22px rgba(15, 107, 130, 0.08);
    transform: translateY(-1px);
}

/* المسار الخارجي للمفتاح */
.surgery-toggle-track {
    position: relative;
    width: 58px;
    height: 32px;
    min-width: 58px;
    display: inline-block;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.12);
    transition:
        background-color 0.25s ease,
        box-shadow 0.25s ease;
}

/* الدائرة المتحركة */
.surgery-toggle-thumb {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.25);
    transition: transform 0.25s ease;
}

/* عند التفعيل */
.surgery-completed-toggle
> input[type="checkbox"]:checked
+ .surgery-toggle-track {
    background: #16a34a;
    box-shadow:
        inset 0 2px 5px rgba(15, 23, 42, 0.12),
        0 0 0 4px rgba(22, 163, 74, 0.12);
}

.surgery-completed-toggle
> input[type="checkbox"]:checked
+ .surgery-toggle-track
.surgery-toggle-thumb {
    transform: translateX(-26px);
}

/* النص */
.surgery-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.surgery-toggle-text strong {
    color: #172033;
    font-size: 17px;
    font-weight: 900;
}

.surgery-toggle-text small {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

/* تلوين البطاقة كاملة عند التفعيل */
.surgery-completed-toggle:has(
    > input[type="checkbox"]:checked
) {
    border-color: #86efac;
    background: #f0fdf4;
}

.surgery-completed-toggle:has(
    > input[type="checkbox"]:checked
) .surgery-toggle-text strong {
    color: #166534;
}

/* عند تعطيل التقرير بسبب انتهاء مهلة التعديل */
.surgery-completed-toggle:has(
    > input[type="checkbox"]:disabled
) {
    opacity: 0.68;
    cursor: not-allowed;
    transform: none;
}

/* دعم الهاتف */
@media (max-width: 600px) {
    .surgery-completed-toggle {
        padding: 14px;
        align-items: flex-start;
    }

    .surgery-toggle-track {
        margin-top: 3px;
    }

    .surgery-toggle-text strong {
        font-size: 16px;
    }
}
/* =========================================================
   System V2 — تحسينات تنظيمية وتجربة استخدام
   ========================================================= */

.form-section-card {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.form-section-heading {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8edf3;
}

.form-section-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-heading h3 {
    margin: 0;
    font-size: 21px;
    font-weight: 900;
    color: var(--text);
}

.form-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.form-section-step {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
}

.sticky-form-actions {
    position: sticky;
    bottom: 12px;
    z-index: 40;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.85);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-date-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.availability-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.availability-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.availability-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 50%;
}

.legend-free {
    background: #16a34a;
}

.legend-busy {
    background: #ea580c;
}

.legend-short {
    background: #64748b;
}

.chart-card canvas {
    min-height: 300px;
}

.alert ul {
    margin-bottom: 0;
}

input[readonly] {
    background: #f8fafc;
    color: #475569;
}

label small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.5;
}

@media (max-width: 820px) {
    .form-section-heading,
    .dashboard-hero,
    .availability-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-section-heading > div {
        align-items: flex-start;
    }

    .sticky-form-actions {
        bottom: 8px;
    }
}

.filter-form-actions,
.row-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.remember-login {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.remember-login input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
}


/* الملفات المرفقة وأخطاء الحقول */
.field-error {
    display: block;
    margin-top: 7px;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.current-attachment-link {
    display: inline-flex;
    width: fit-content;
    margin-top: 10px;
    color: #0f6b82;
    font-weight: 900;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.patient-attachment-card {
    margin-top: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid #cfe3ea;
    border-radius: 18px;
    background: #f4fbfd;
}

.patient-attachment-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.patient-attachment-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: #dff4f8;
    font-size: 24px;
}

.patient-attachment-info h3 {
    margin: 0;
    color: #172033;
    font-size: 18px;
    font-weight: 900;
}

.patient-attachment-info p {
    margin: 5px 0 0;
    color: #64748b;
    font-weight: 700;
}

@media (max-width: 700px) {
    .patient-attachment-card {
        align-items: stretch;
        flex-direction: column;
    }

    .patient-attachment-card .btn {
        justify-content: center;
        width: 100%;
    }
}


/* =========================================================
   التحقق المباشر من توفر غرفة العمليات
   ========================================================= */
.schedule-availability-status {
    margin-top: 16px;
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-weight: 900;
    line-height: 1.7;
}

.schedule-availability-status.is-checking {
    display: block;
    color: #1e3a8a;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.schedule-availability-status.is-available {
    display: block;
    color: #166534;
    background: #f0fdf4;
    border-color: #86efac;
}

.schedule-availability-status.is-unavailable {
    display: block;
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}
