:root {
    --side-width: 260px;
    --blue: #4f7df3;
    --blue-dark: #28428e;
    --muted: #64748b;
    --line: #e7edf5;
    --bg: #ffffff;
    --soft: #f8fafc;
    --text: #0f172a;
}
* { box-sizing: border-box; }
body { margin: 0; background: #fff; color: var(--text); font-size: 14px; font-family: Inter, Arial, Helvetica, sans-serif; }
a { text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-width); border-right: 1px solid #d8dee8; background: #fff; position: fixed; inset: 0 auto 0 0; overflow-y: auto; }
.brand-box { height: 58px; display: flex; align-items: center; padding-left: 38px; border-bottom: 1px solid var(--line); }
.brand-logo { display: inline-block; background: #5c8df6; color: #fff; letter-spacing: 3px; line-height: 18px; font-family: Georgia, serif; font-size: 17px; padding: 2px 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
.menu { padding: 14px 18px 28px; }
.menu-section { color: #0a1a44; font-weight: 700; font-size: 13px; margin: 16px 0 10px; }
.menu-link, .menu-group > summary { display: flex; align-items: center; gap: 12px; color: #42526e; padding: 9px 8px; border-radius: 8px; cursor: pointer; list-style: none; }
.menu-link:hover, .menu-group > summary:hover, .menu-link.active { color: #2563eb; background: #f6f9ff; }
.menu-link i, .menu-group i { width: 16px; color: #64748b; }
.menu-group { border-bottom: 1px solid #f0f3f7; padding-bottom: 5px; }
.menu-group summary::-webkit-details-marker { display: none; }
.menu-group > summary::after { content: '\f078'; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: auto; font-size: 10px; color: #9aa4b2; }
.menu-group[open] > summary::after { transform: rotate(180deg); }
.menu-group a { display: block; padding: 8px 0 8px 36px; color: #42526e; }
.menu-group a:hover { color: #2563eb; }
.main-area { margin-left: var(--side-width); min-height: 100vh; width: calc(100% - var(--side-width)); }
.topbar-app { height: 58px; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 28px 0 36px; gap: 20px; background: #fff; position: sticky; top: 0; z-index: 10; }
.search-pill { width: 220px; height: 34px; border-radius: 20px; background: #f4f5f7; color: #64748b; display: flex; align-items: center; gap: 11px; padding-left: 15px; }
.org-title { margin-left: auto; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.logout-icon { color: #64748b; font-size: 16px; }
.content-area { padding: 22px 26px 36px; }
.page-title-strip { background: var(--blue); color: #fff; font-size: 18px; font-weight: 700; padding: 12px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 9px; }
.panel-card { border: 1px solid #d6dce6; border-radius: 6px; background: #fff; padding: 16px; margin-bottom: 18px; }
.dashboard-card { border: 1px solid #e2e8f0; border-radius: 4px; background: #fff; box-shadow: 0 4px 16px rgba(15, 23, 42, .10); margin-bottom: 16px; }
.dashboard-card .card-head { background: #fbfcfe; border-bottom: 1px solid #e6edf5; padding: 12px 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.dashboard-card .card-body { padding: 16px; min-height: 180px; }
.form-label { color: #0f172a; margin-bottom: 7px; }
.required::after { content: '*'; color: #dc2626; margin-left: 2px; }
.form-control, .form-select { border-color: #d8dee8; border-radius: 5px; height: 39px; font-size: 14px; }
textarea.form-control { height: auto; }
.btn-primary, .btn-info { background: #3498db; border-color: #3498db; }
.btn-gradient { background: linear-gradient(135deg, #32b7f5, #525cf5); color: #fff; border: 0; box-shadow: 0 3px 8px rgba(37, 99, 235, .35); }
.btn-danger-soft { background: #f00; color:#fff; border:0; box-shadow: 0 4px 10px rgba(220, 38, 38, .35); }
.table { font-size: 13px; }
.table thead th { background: #fafbfe; font-weight: 700; color: #111827; border-bottom: 1px solid #d8dee8; padding: 13px 14px; white-space: nowrap; }
.table tbody td { padding: 13px 14px; color: #52657a; vertical-align: middle; }
.table .total-row td { background: #eeeeef; color: #111827; font-weight: 700; }
.table-scroll-x { overflow-x: auto; border-bottom: 1px solid #d8dee8; }
.status-dot { display:inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot-closed { background:#697986; } .dot-not { background:#5271ff; } .dot-complete { background:#1f9d55; } .dot-p2 { background:#f5b400; } .dot-p7 { background:#e73946; } .dot-old { background:#1f2937; }
.legend-bar { border:1px solid #d8dee8; border-radius:6px; padding: 8px; text-align:center; margin:18px 0 8px; }
.stat-box { box-shadow: 0 7px 18px rgba(15,23,42,.2); border-radius:4px; padding: 14px 18px; min-width: 240px; }
.status-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align:center; gap: 20px; margin-top: 12px; }
.status-title { font-size: 28px; font-weight: 700; }
.modal-header-blue { background: #3498db; color: #fff; }
.modal-header-primary { background: #4f7df3; color: #fff; }
.btn-close-whiteish { filter: invert(1) grayscale(100%) brightness(200%); }
.toggle { width: 48px; height: 24px; background:#c9c9c9; border-radius:999px; display:inline-flex; align-items:center; padding:2px; }
.toggle::after { content:""; width:20px; height:20px; border-radius:50%; background:#fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle.on { background:#3498db; justify-content:flex-end; }
.checkbox-row { display:flex; flex-wrap:wrap; gap: 14px; }
.small-muted { font-size:12px; color: #64748b; }
.no-data { color:#c4cbd5; text-align:center; padding:40px 0; }
.pagination-mini { display:flex; align-items:center; gap:12px; justify-content:flex-end; color:#64748b; }
.page-pill { background:#3498db; color:#fff; border-radius:5px; padding:7px 11px; }
.login-body { min-height:100vh; display:grid; place-items:center; background: linear-gradient(135deg, #eef4ff, #f8fbff); }
.auth-box { width: 380px; border-radius:8px; background:#fff; box-shadow: 0 12px 32px rgba(15,23,42,.18); padding:34px; }
@media (max-width: 900px) {
    :root { --side-width: 220px; }
    .status-cols { grid-template-columns: 1fr; }
    .org-title { font-size: 13px; }
}

/* ===== Mobile responsive fixes ===== */
html, body { max-width: 100%; overflow-x: hidden; }
img, canvas, svg { max-width: 100%; }
.mobile-menu-btn { display: none; border: 0; background: #f4f6fb; color: #0f172a; width: 38px; height: 38px; border-radius: 10px; align-items: center; justify-content: center; font-size: 18px; }
.mobile-sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 998; }
.dashboard-card .card-body,
.panel-card,
.modal-body { overflow-x: auto; }
.table { width: 100%; }
.table-responsive-mobile { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 991.98px) {
    :root { --side-width: 260px; }
    .app-shell { display: block; min-height: 100vh; }
    .sidebar {
        transform: translateX(-105%);
        transition: transform .22s ease-in-out;
        z-index: 999;
        box-shadow: 0 16px 42px rgba(15, 23, 42, .22);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .mobile-sidebar-backdrop { display: block; }
    body.sidebar-open { overflow: hidden; }
    .main-area { margin-left: 0; width: 100%; min-width: 0; }
    .topbar-app { height: auto; min-height: 58px; padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
    .mobile-menu-btn { display: inline-flex; flex: 0 0 auto; }
    .search-pill { flex: 1 1 160px; width: auto; min-width: 0; }
    .org-title { order: 3; flex: 1 0 100%; margin-left: 0; font-size: 13px; white-space: normal; line-height: 1.25; }
    .content-area { padding: 14px 12px 26px; }
    .page-title-strip { font-size: 16px; padding: 10px 12px; margin-bottom: 12px; }
    .panel-card { padding: 12px; border-radius: 5px; }
    .dashboard-card .card-body { min-height: auto; padding: 12px; }
    .stat-box { min-width: 0; width: 100%; }
    .pagination-mini { justify-content: flex-start; flex-wrap: wrap; }
    .checkbox-row { gap: 8px 12px; }
    .auth-box { width: calc(100vw - 28px); padding: 24px; }
    .modal-dialog { margin: .75rem; }
    .btn, .form-control, .form-select { min-height: 39px; }
    .col.text-end,
    .col-12.text-end,
    .col-md-3.d-flex.justify-content-end { text-align: left !important; justify-content: flex-start !important; }
}

@media (max-width: 575.98px) {
    body { font-size: 13px; }
    .brand-box { height: 54px; padding-left: 22px; }
    .menu { padding: 10px 14px 22px; }
    .search-pill { display: none; }
    .topbar-app .small.text-muted { max-width: calc(100% - 90px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .org-title { font-size: 12px; }
    .content-area { padding: 10px 8px 22px; }
    .page-title-strip { font-size: 15px; }
    .panel-card { padding: 10px; }
    .table { font-size: 12px; }
    .table thead th, .table tbody td { padding: 9px 10px; }
    .status-title { font-size: 22px; }
    .legend-bar { text-align: left; }
    .btn { width: auto; margin-bottom: 6px; }
}
/* User Add/Register Update page improvements */
.user-add-card .form-check-input,
.schedule-card .form-check-input {
    cursor: pointer;
}

.password-toggle {
    border-color: #d8dee8;
    background: #fff;
    cursor: pointer;
}

.schedule-card {
    padding-bottom: 22px;
}

.slab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 24px;
}

.slab-card {
    position: relative;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    padding: 22px 26px;
    min-height: 92px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    text-align: left;
    color: #0f172a;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.slab-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
    border-color: #b8c5d8;
}

.slab-card.slab-break {
    background: #dc3545;
    border-color: #dc3545;
    color: #111827;
    font-weight: 600;
}

.lunch-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(255,255,255,.9);
    color: #dc3545;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}

.user-days-row label {
    min-width: 90px;
}

#mappingTable .empty-row td {
    color: #334155;
}

@media (max-width: 991.98px) {
    .slab-grid {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        gap: 12px;
    }

    .slab-card {
        padding: 16px;
        gap: 10px;
    }
}

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

    .slab-card {
        min-height: 76px;
    }
}

/* ===== Kalix / role / registration / doctor call flow patch ===== */
.kalix-logo { font-family: Inter, Arial, sans-serif; letter-spacing: 1px; line-height: 16px; font-size: 15px; font-weight: 700; }
.permission-group { border: 1px solid #e5eaf3; border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.permission-group h6 { font-weight: 800; margin-bottom: 12px; color: #1f2a44; }
.permission-tile { display: flex; align-items: center; gap: 10px; border: 1px solid #e2e8f0; border-radius: 7px; padding: 10px 12px; cursor: pointer; min-height: 44px; background:#fff; }
.permission-tile:hover { background: #f8fbff; border-color: #bcd0ff; }
.registration-page { min-height: 680px; }
.reg-mobile-group .add-round, .add-round { border-radius: 999px !important; width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.suggestion-list { position: absolute; left: 0; right: 45px; top: 74px; background: #fff; border: 1px solid #cbd5e1; border-radius: 4px; z-index: 30; max-height: 260px; overflow-y: auto; box-shadow: 0 12px 24px rgba(15,23,42,.12); }
.suggestion-item { width: 100%; border: 0; background: #fff; text-align: left; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; display: block; }
.suggestion-item:hover, .suggestion-item:focus { background: #3498db; color: #fff; }
.suggestion-item small { display: block; color: inherit; opacity: .8; }
.free-slabs-title { font-size: 24px; font-weight: 800; text-align: left; margin-bottom: 14px; }
.free-slabs-list { display: grid; gap: 12px; max-height: calc(100vh - 210px); overflow-y: auto; padding-right: 6px; }
.free-slot-card { display: grid; grid-template-columns: 92px 1fr; align-items: stretch; border: 1px solid #e1e6ef; background: #fff; text-align: left; min-height: 86px; padding: 0; }
.free-slot-card .slot-time { background: #e6f7fb; color: #0f172a; font-weight: 700; padding: 12px 8px; text-align: center; font-size: 12px; border-right: 1px solid #d7e8ee; display:flex; align-items:center; justify-content:center; }
.free-slot-card .slot-doc { padding: 12px 10px; align-self: start; display: inline-block; border: 1px solid #555; border-radius: 3px; margin: 10px; color:#111827; }
.free-slot-card .slot-count { grid-column: 1 / 2; background: #fff; border-right: 1px solid #e1e6ef; padding: 6px; text-align: center; font-size: 11px; }
.free-slot-card.available:hover, .free-slot-card.selected { outline: 2px solid #3498db; }
.free-slot-card.not-available { opacity: .72; cursor: not-allowed; }
.free-slot-card.break .slot-time { background:#ef4444; color:#fff; }
.slot-doctor-card { border:1px solid #111; border-radius:6px; padding:18px; width:min(480px,100%); margin:auto; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.slot-legend { text-align:center; font-size:16px; }
.slot-legend .dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-left:12px; margin-right:4px; }
.dot-complete{background:#198754}.dot-booked{background:#2563eb}.dot-reschedule{background:#dc3545}.dot-transfer{background:#22c1dc}.dot-available{background:#e5e7eb;border:1px solid #cbd5e1}
.registration-slip { width: 820px; max-width: 100%; margin: 20px auto; border: 1px solid #111; padding: 28px 34px; color: #111; background: #fff; font-family: Georgia, 'Times New Roman', serif; }
.registration-slip h1 { text-align:center; font-size: 28px; letter-spacing: 8px; margin: 0 0 18px; }
.registration-slip h2 { text-align:center; font-size: 22px; margin: 0 0 8px; }
.registration-slip .center-text { text-align:center; margin: 4px 0; }
.slip-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; font-size: 18px; }
.signature-line { margin-top: 80px; text-align:right; font-size: 18px; }
.call-board .status-title { text-align: center; }
.call-card { display:block; width:100%; border:1px solid #d1d5db; border-radius:4px; background:#fff; margin-bottom:10px; padding:14px 18px; text-align:left; color:#111; }
button.call-card { cursor:pointer; }
.call-card-pending { background:#212529; color:#fff; }
.call-card-progress { background:#fff; }
.call-card-complete { background:#198754; color:#fff; }
.call-card-footer { border-top:1px solid rgba(148,163,184,.65); padding-top:8px; display:flex; justify-content:space-between; align-items:center; }
.btn-call-start { border-radius:8px; padding:8px 20px; }
.call-detail-header { font-size: 20px; line-height: 1.55; }
.history-card { border:1px solid #d1d5db; border-radius:6px; min-height:240px; overflow:hidden; background:#fff; }
.history-card .history-head { background:#23a744; color:#fff; padding:8px 18px; font-weight:700; }
.history-card p { margin: 12px 24px; }
@media print {
    .sidebar, .topbar-app, .d-print-none, .alert { display:none !important; }
    .main-area { margin-left:0 !important; width:100% !important; }
    .content-area { padding:0 !important; }
    .registration-slip { border:0; margin:0; width:100%; }
}
@media (max-width: 991.98px) {
    .free-slabs-list { max-height: none; }
    .free-slot-card { grid-template-columns: 80px 1fr; }
    .call-detail-header { font-size: 16px; }
}
@media (max-width: 575.98px) {
    .suggestion-list { right: 0; top: 72px; }
    .slip-grid { grid-template-columns: 1fr; font-size: 15px; }
    .registration-slip { padding: 16px; }
    .registration-slip h1 { font-size: 18px; letter-spacing: 4px; }
    .free-slot-card { grid-template-columns: 72px 1fr; }
    .free-slot-card .slot-doc { margin: 8px; font-size: 12px; }
    .call-card { padding: 12px; }
}

/* ===== QR Self Registration and half A4 slip ===== */
.public-self-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef4ff, #f8fbff);
}
.public-self-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
}
.public-self-card {
    width: min(980px, 100%);
    background: #fff;
    border: 1px solid #dbe4f0;
    box-shadow: 0 12px 32px rgba(15,23,42,.15);
    border-radius: 12px;
    padding: 24px;
}
.public-logo-box,
.slip-logo-box {
    border: 2px dashed #cbd5e1;
    color: #64748b;
    background: #f8fafc;
    display: grid;
    place-items: center;
    font-weight: 700;
}
.public-logo-box {
    width: 92px;
    height: 62px;
    margin: 0 auto 12px;
    border-radius: 8px;
}
.public-self-card h1 { font-size: 24px; margin: 0; font-weight: 800; color: #0f172a; }
.public-slots { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.free-slot-card:disabled { cursor: not-allowed; opacity: .7; }
.pending-self-card { border-left: 4px solid #f59e0b; }
.qr-box { width: 250px; min-height: 250px; display: grid; place-items: center; padding: 10px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.qr-admin-card { max-width: 430px; }

.half-a4-slip {
    width: 190mm;
    min-height: 135mm;
    max-height: 140mm;
    margin: 0 auto;
    padding: 9mm 10mm;
    border: 1px solid #111827;
    overflow: hidden;
    color: #111827;
}
.slip-header-row {
    display: grid;
    grid-template-columns: 30mm 1fr;
    gap: 8mm;
    align-items: start;
}
.slip-logo-box {
    width: 28mm;
    height: 23mm;
    font-size: 11px;
}
.slip-title-block h1 {
    margin: 0 0 3px;
    font-size: 18px;
    text-align: center;
    letter-spacing: 3px;
}
.slip-title-block h2 {
    margin: 0 0 3px;
    font-size: 19px;
    text-align: center;
    font-weight: 800;
}
.slip-title-block p { margin: 0; font-size: 12px; }
.slip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 18px;
    font-size: 13px;
}
.slip-note {
    border: 1px solid #cbd5e1;
    padding: 6px 8px;
    font-size: 12px;
    background: #f8fafc;
}
.signature-line {
    text-align: right;
    margin-top: 18mm;
    font-weight: 700;
}
@media print {
    @page { size: A4; margin: 10mm; }
    body { background: #fff !important; }
    .d-print-none, .sidebar, .topbar-app { display: none !important; }
    .main-area { margin-left: 0 !important; width: 100% !important; }
    .content-area { padding: 0 !important; }
    .registration-slip { box-shadow: none !important; }
    .half-a4-slip { margin: 0 auto !important; page-break-after: avoid; }
}
@media (max-width: 575.98px) {
    .public-self-wrap { padding: 10px; }
    .public-self-card { padding: 14px; border-radius: 8px; }
    .slip-grid { grid-template-columns: 1fr; }
}

/* ===== Public acknowledgement / proof ===== */
.acknowledgement-card { max-width: 920px; }
.proof-paper {
    width: min(190mm, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid #111827;
    padding: 10mm;
    color: #111827;
}
.ack-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e2e8f0;
    padding: 8px 10px;
    background: #f8fafc;
}
.ack-number { font-size: 15px; }
.ack-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #475569;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
}
@media print {
    .public-self-body { background: #fff !important; }
    .public-self-wrap { display: block; min-height: auto; padding: 0; }
    .public-self-card { box-shadow: none; border: 0; padding: 0; }
    .proof-paper { width: 190mm; border: 1px solid #111827; }
}
@media (max-width: 575.98px) {
    .ack-status-row { align-items: flex-start; flex-direction: column; }
    .proof-paper { padding: 14px; }
}

.dashboard-year-select {
    min-width: 95px;
}
