:root {
    --sidebar: #1f2937;
    --sidebar-text: #d8dee9;
    --accent: #0d6efd;
    --content-icon: #0033A0;
    --surface: #ffffff;
    --line: #e5e7eb;
    --muted: #6b7280;
}

body {
    background: #f3f5f8;
    color: #1f2937;
    font-size: 14px;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 16px 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 18px;
}

.brand i {
    color: #f59e0b;
}

.app-sidebar .nav-link {
    color: var(--sidebar-text);
    border-radius: 6px;
    padding: 9px 10px;
    margin-bottom: 4px;
}

.app-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.app-sidebar .nav-link i {
    width: 20px;
    color: #f59e0b;
}

.nav-group-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    display: flex;
    justify-content: space-between;
    text-align: left;
    width: 100%;
}

.nav-group-chevron {
    font-size: 10px;
    margin-left: auto;
    width: auto !important;
}

.nav-submenu {
    margin: -2px 0 6px 14px;
    padding-left: 10px;
    border-left: 1px solid rgba(216, 222, 233, .2);
}

.app-sidebar .nav-submenu .nav-submenu-link {
    font-size: 13px;
    padding: 7px 8px;
}

.app-sidebar .nav-submenu .nav-submenu-link i {
    font-size: 12px;
}

.app-main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
}

.topbar h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.user-menu-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--muted);
    display: inline-flex;
    gap: 8px;
    padding: 5px 2px;
}

.user-menu-toggle:hover,
.user-menu-toggle:focus {
    color: var(--content-icon);
    outline: 0;
}

.user-menu-chevron {
    font-size: 10px;
}

.user-menu-dropdown {
    min-width: 210px;
}

.user-menu-dropdown .dropdown-item i {
    color: var(--content-icon);
    margin-right: 8px;
    width: 16px;
}

.content-wrap {
    padding: 18px 20px 32px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.app-main i.fa-solid {
    color: var(--content-icon);
}

.btn-primary {
    --bs-btn-bg: var(--content-icon);
    --bs-btn-border-color: var(--content-icon);
    --bs-btn-hover-bg: #002878;
    --bs-btn-hover-border-color: #002878;
    --bs-btn-active-bg: #00205f;
    --bs-btn-active-border-color: #00205f;
    --bs-btn-disabled-bg: var(--content-icon);
    --bs-btn-disabled-border-color: var(--content-icon);
}

.btn-primary i.fa-solid {
    color: #fff;
}

.btn-success i.fa-solid {
    color: #fff;
}

.metric-card,
.work-section,
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.metric-card {
    padding: 14px;
}

.metric-button {
    appearance: none;
    color: inherit;
    cursor: pointer;
    display: grid;
    gap: 5px;
    text-align: left;
    width: 100%;
}

.metric-button:hover,
.metric-button:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
    outline: 0;
}

.metric-icon {
    align-items: center;
    background: #eef4ff;
    border: 1px solid #c8d8ff;
    border-radius: 6px;
    color: var(--content-icon);
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.metric-card span:not(.metric-icon) {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.metric-card .metric-icon {
    color: var(--content-icon);
}

.metric-card .metric-label {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    margin-top: 4px;
}

.work-section {
    padding: 14px;
    margin-bottom: 14px;
}

.section-title {
    font-weight: 700;
    margin-bottom: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.section-title i {
    color: var(--content-icon);
    margin-right: 6px;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

.queue-item:first-of-type {
    border-top: 0;
}

.queue-item small {
    display: block;
    color: var(--muted);
}

.queue-item-form {
    align-items: flex-start;
}

.queue-item-form form {
    display: grid;
    flex: 0 1 680px;
    gap: 6px;
    grid-template-columns: minmax(120px, .8fr) minmax(220px, 1fr) auto auto;
}

.dashboard-inline-form {
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(110px, .8fr) minmax(160px, 1fr) auto;
    min-width: 360px;
}

.dashboard-detail-table .dashboard-row-actions {
    white-space: nowrap;
}

.dashboard-action-row > td {
    border-top: 0;
    padding: 0 !important;
}

.dashboard-action-panel {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 6px 0 12px;
    padding: 12px;
}

.dashboard-form-grid {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(160px, .8fr) minmax(220px, 1fr) auto;
}

.dashboard-form-submit {
    white-space: nowrap;
}

.dashboard-accordion .accordion-title {
    display: block;
    line-height: 1.2;
}

.dashboard-accordion .accordion-title small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 400;
    margin-top: 3px;
}

.delivery-plan {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}

.delivery-plan-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.delivery-plan-head span {
    color: var(--muted);
    margin-right: auto;
}

.color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    margin-left: 5px;
    margin-right: 5px;
    vertical-align: middle;
}

.hospital-ico-status {
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    color: #6c757d;
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    padding: 2px 6px;
    vertical-align: middle;
}

tr.contact-hospital-inactive > * {
    background: #f1f3f5 !important;
    color: #6c757d !important;
}

.contact-hospital-inactive .accordion-button {
    background: #f1f3f5;
    color: #6c757d;
}

.contact-hospital-inactive .accordion-button:not(.collapsed) {
    box-shadow: inset 0 -1px 0 #d7dce1;
}

.contact-hospital-inactive .dashboard-action-panel {
    background: #f8f9fa;
    border-color: #d7dce1;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-title {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.login-title i {
    font-size: 28px;
    color: var(--content-icon);
}

.login-title h1 {
    font-size: 22px;
    margin: 0;
}

.login-title p {
    color: var(--muted);
    margin: 0;
}

.user-hospitals {
    min-width: 220px;
}

.user-hospitals-count {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.user-hospitals-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.user-hospital-tag {
    align-items: center;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: #1e3a8a;
    display: inline-flex;
    font-size: 12px;
    gap: 5px;
    line-height: 1.3;
    max-width: 100%;
    padding: 4px 8px;
    white-space: normal;
}

.user-hospital-tag i.fa-solid {
    color: #2563eb;
    flex: 0 0 auto;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.solution-color-options {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.solution-color-option {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    gap: 8px;
    margin: 0;
    min-height: 38px;
    padding: 6px 8px;
}

.solution-color-option input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.solution-color-option:has(input:checked) {
    background: #eef4ff;
    border-color: var(--content-icon);
    box-shadow: 0 0 0 1px var(--content-icon);
}

.solution-color-option:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 51, 160, .15);
}

.solution-color-swatch {
    background: var(--solution-color);
    border: 1px solid rgba(31, 41, 55, .2);
    border-radius: 50%;
    flex: 0 0 16px;
    height: 16px;
    width: 16px;
}

.table {
    --bs-table-bg: transparent;
}

.subheading {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 8px;
}

.small-card {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.small-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.weekday-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
}

.weekday-grid label {
    white-space: nowrap;
}

.timeline {
    border-left: 3px solid #dbe4f0;
    padding-left: 12px;
}

.timeline-item {
    position: relative;
    padding-bottom: 12px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f59e0b;
}

.timeline-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.timeline-item p {
    margin: 4px 0 0;
}

.detail-card {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
}

.detail-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.detail-label {
    color: var(--muted);
    display: block;
    font-size: 12px;
}

.detail-log-grid {
    display: grid;
    gap: 14px;
}

.detail-log-panel {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.history-layout.has-expanded .panel-column.is-collapsed {
    display: none;
}

.history-layout.has-expanded .panel-column.is-expanded {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
}

.history-layout.has-expanded #deliveryDetailPanel.is-expanded .detail-log-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(260px, .4fr);
}

.history-layout.has-expanded #deliveryDetailPanel.is-expanded .detail-log-panel {
    border-left: 1px solid var(--line);
    border-top: 0;
    padding-left: 14px;
    padding-top: 0;
}

@media (max-width: 992px) {
    .app-shell {
        display: block;
    }

    .app-sidebar {
        width: auto;
        min-height: auto;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .queue-item-form,
    .queue-item-form form,
    .dashboard-inline-form,
    .dashboard-form-grid {
        display: block;
    }

    .queue-item-form form > *,
    .dashboard-inline-form > *,
    .dashboard-form-grid > * {
        margin-top: 6px;
    }

    .history-layout.has-expanded #deliveryDetailPanel.is-expanded .detail-log-grid {
        grid-template-columns: 1fr;
    }

    .history-layout.has-expanded #deliveryDetailPanel.is-expanded .detail-log-panel {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-left: 0;
        padding-top: 12px;
    }

    .solution-color-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .delivery-plan-head,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
