:root {
    --app-bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --border: #e3eaf5;
    --text-main: #14213d;
    --text-muted: #73819b;
    --sidebar-start: #0f172a;
    --sidebar-end: #18243f;
    --primary: #2f80ed;
    --success: #1fbc73;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #7c4dff;
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

body,
.app-body {
    font-size: 0.95rem;
    font-family: Inter, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--app-bg);
    color: var(--text-main);
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    padding: 1.35rem 1rem;
    background: linear-gradient(180deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1035;
    box-shadow: 18px 0 50px rgba(15, 23, 42, 0.15);
}

.sidebar-brand-wrap {
    padding-bottom: 0.35rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: #fff;
    padding: 0.85rem 0.9rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2f80ed 0%, #6ea8ff 100%);
    font-size: 1.2rem;
    box-shadow: 0 12px 22px rgba(47, 128, 237, 0.32);
}

.sidebar-brand-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand-subtitle {
    display: block;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.68);
    margin-top: 0.1rem;
}

.sidebar-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.48);
    padding: 0 0.75rem;
    margin-top: 0.25rem;
}

.sidebar-nav {
    display: grid;
    gap: 0.42rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.78);
    padding: 0.88rem 0.95rem;
    border-radius: 16px;
    transition: all 0.18s ease;
    font-weight: 500;
}

.sidebar-link i {
    font-size: 1.1rem;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.28);
}

.sidebar-summary-card {
    margin-top: auto;
    border-radius: 22px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-summary-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.sidebar-summary-role {
    font-size: 1.08rem;
    font-weight: 700;
    margin-top: 0.35rem;
}

.sidebar-summary-text {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

.app-main {
    margin-left: 272px;
    min-height: 100vh;
    padding: 1.15rem;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

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

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topbar-icon-btn,
.topbar-chip,
.topbar-alert,
.topbar-user,
.topbar-search {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(227, 234, 245, 0.9);
    box-shadow: var(--shadow-soft);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-radius: 18px;
    padding: 0.85rem 1rem;
    min-width: 320px;
}

.topbar-search i {
    color: var(--text-muted);
}

.topbar-search input {
    border: 0;
    outline: 0;
    width: 100%;
    background: transparent;
    color: var(--text-main);
}

.topbar-chip,
.topbar-user {
    border-radius: 18px;
    padding: 0.82rem 1rem;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-main);
}

.topbar-alert {
    position: relative;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    border-radius: 16px;
    text-decoration: none;
}

.topbar-alert.has-alert {
    color: var(--danger);
}

.topbar-alert-count {
    position: absolute;
    top: -4px;
    right: -3px;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.35rem;
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.28);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.topbar-avatar {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.topbar-user-name {
    font-weight: 700;
    line-height: 1.1;
}

.topbar-user-role {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.page-container {
    background: linear-gradient(180deg, rgba(248, 250, 255, 0.95) 0%, rgba(255,255,255,0.96) 100%);
    border-radius: 30px;
    padding: 1.5rem;
    min-height: calc(100vh - 98px);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.06);
}

.surface-card,
.card {
    border: 1px solid rgba(227, 234, 245, 0.95) !important;
    border-radius: 24px !important;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06) !important;
    overflow: hidden;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.stat-card {
    border: 0 !important;
    border-radius: 24px !important;
    overflow: hidden;
}

.dashboard-hero {
    position: relative;
    padding: 1.4rem 1.6rem;
    border-radius: 28px;
    background: linear-gradient(135deg, #eef4ff 0%, #ffffff 50%, #f5f8ff 100%);
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.dashboard-hero::after {
    content: '';
    position: absolute;
    inset: auto -36px -40px auto;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(47, 128, 237, 0.13), rgba(47, 128, 237, 0));
}

.hero-kicker {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #5f7fb7;
    font-weight: 700;
}

.hero-subtext {
    color: var(--text-muted);
    max-width: 760px;
}

.dashboard-stat {
    color: #fff;
    padding: 1.15rem 1.2rem;
    border-radius: 24px;
    min-height: 138px;
    position: relative;
    overflow: hidden;
}

.dashboard-stat::before {
    content: '';
    position: absolute;
    inset: auto -18px -22px auto;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.dashboard-stat.primary { background: linear-gradient(135deg, #2f80ed 0%, #4f9cff 100%); }
.dashboard-stat.success { background: linear-gradient(135deg, #18b777 0%, #25d18f 100%); }
.dashboard-stat.warning { background: linear-gradient(135deg, #fb923c 0%, #f6ad55 100%); }
.dashboard-stat.purple { background: linear-gradient(135deg, #6f4ef6 0%, #9a78ff 100%); }
.dashboard-stat.dark { background: linear-gradient(135deg, #0f172a 0%, #334155 100%); }
.dashboard-stat.danger { background: linear-gradient(135deg, #ef4444 0%, #fb7185 100%); }

.dashboard-stat .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    margin-bottom: 0.95rem;
}

.dashboard-stat .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.dashboard-stat .stat-value {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
}

.dashboard-stat .stat-meta {
    font-size: 0.82rem;
    margin-top: 0.35rem;
    opacity: 0.86;
}

.section-heading {
    font-size: 1.15rem;
    font-weight: 700;
}

.section-subtitle,
.text-muted {
    color: var(--text-muted) !important;
}

.analytics-card {
    padding: 1.25rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.panel-muted {
    font-size: 0.84rem;
    color: var(--text-muted);
}

.metric-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px dashed var(--border);
}

.metric-inline:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.metric-inline:first-child {
    padding-top: 0;
}

.metric-label {
    font-weight: 600;
}

.soft-badge {
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.soft-badge.primary { background: rgba(47, 128, 237, 0.1); color: #2168c5; }
.soft-badge.success { background: rgba(31, 188, 115, 0.12); color: #14915b; }
.soft-badge.warning { background: rgba(245, 158, 11, 0.13); color: #b97700; }
.soft-badge.danger { background: rgba(239, 68, 68, 0.12); color: #cc2d2d; }
.soft-badge.dark { background: rgba(15, 23, 42, 0.08); color: #0f172a; }
.soft-badge.purple { background: rgba(124, 77, 255, 0.12); color: #6842db; }

.chart-wrap {
    margin-top: 1rem;
}

.chart-grid {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.8rem;
}

.analytics-svg {
    width: 100%;
    height: 270px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
    border: 1px solid var(--border);
}

.activity-list,
.quick-grid {
    display: grid;
    gap: 0.85rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.95rem 0;
    border-bottom: 1px dashed var(--border);
}

.activity-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.activity-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(47, 128, 237, 0.12);
    color: #2168c5;
    flex-shrink: 0;
}

.activity-title {
    font-weight: 700;
}

.activity-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
}

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

.quick-action {
    text-decoration: none;
    padding: 1rem;
    border-radius: 20px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: var(--text-main);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
    color: var(--text-main);
}

.quick-action .icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.quick-action.blue .icon { background: rgba(47, 128, 237, 0.12); color: #2168c5; }
.quick-action.green .icon { background: rgba(31, 188, 115, 0.12); color: #14915b; }
.quick-action.orange .icon { background: rgba(245, 158, 11, 0.14); color: #b97700; }
.quick-action.purple .icon { background: rgba(124, 77, 255, 0.12); color: #6842db; }

.progress-soft {
    height: 10px;
    border-radius: 999px;
    background: #edf2fb;
    overflow: hidden;
}

.progress-soft-bar {
    height: 100%;
    border-radius: 999px;
}

.table-card .table,
.card .table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
    border-bottom-color: #edf2fb;
    vertical-align: middle;
}

.table thead th {
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #f8fbff !important;
}

.form-control,
.form-select {
    border-radius: 14px;
    border: 1px solid #dbe5f0;
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #8eb8f7;
    box-shadow: 0 0 0 0.25rem rgba(47, 128, 237, 0.15) !important;
}

.btn {
    border-radius: 14px;
    padding: 0.68rem 1rem;
    font-weight: 600;
}

.btn-sm {
    border-radius: 12px;
}

.btn-primary {
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    border-color: #2563eb;
}

.btn-outline-dark,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-warning {
    border-width: 1px;
}

.alert {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.06);
}

.badge-soft {
    padding: 0.5rem 0.7rem;
    font-size: 0.75rem;
}

.order-card {
    border-radius: 1rem;
}

.timeline {
    position: relative;
    margin-left: 0.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 15px;
    width: 2px;
    background: #d7e2f0;
}

.timeline-item {
    position: relative;
    padding-left: 45px;
    margin-bottom: 1.25rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.preview-box {
    border: 1px dashed #ced4da;
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fff;
}

.file-preview img {
    max-width: 130px;
    max-height: 130px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.delayed-row td { background: #fff8e6 !important; }
.urgent-row td { background: #fff0f0 !important; }
.expedite-inline-form { min-width: 180px; }
.task-note-textarea { min-height: 78px; }

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top left, rgba(47, 128, 237, 0.18), transparent 34%), linear-gradient(135deg, #eef4ff 0%, #f7faff 45%, #eef5ff 100%);
    padding: 1.5rem;
}

.login-card {
    max-width: 1080px;
    width: 100%;
    border-radius: 34px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(227, 234, 245, 0.9);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.12);
}

.login-brand-panel {
    min-height: 100%;
    padding: 2.3rem;
    background: linear-gradient(145deg, #0f172a 0%, #1d4ed8 100%);
    color: #fff;
}

.login-brand-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: rgba(255,255,255,0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.1rem;
}

.login-mini-stat {
    border-radius: 18px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 1rem;
}

.public-body { color: #1f2937; }
.hero-section { background: linear-gradient(135deg, #111827 0%, #374151 100%); color: #fff; }
.contact-card { border: 1px solid #e5e7eb; }
.nav-pills .nav-link { border-radius: 999px; }

@media (max-width: 1399.98px) {
    .topbar-search {
        min-width: 250px;
    }
}

@media (max-width: 1199.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

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

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

    .app-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        justify-content: space-between;
    }
}

@media (max-width: 991.98px) {
    .expedite-inline-form {
        flex-direction: column;
        align-items: stretch !important;
        min-width: auto;
    }

    .dashboard-stat {
        min-height: 124px;
    }
}

@media (max-width: 767.98px) {
    .page-container {
        border-radius: 24px;
        padding: 1rem;
    }

    .topbar-search {
        min-width: 100%;
        width: 100%;
    }

    .topbar-actions {
        width: 100%;
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.report-stat .card-body {
    padding: 1.2rem 1.25rem;
}

.summary-bar-row {
    margin-bottom: 1rem;
}

.summary-bar {
    margin-top: 0.55rem;
    height: 10px;
    border-radius: 999px;
    background: #e8eef8;
    overflow: hidden;
}

.summary-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
}

.report-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom-width: 1px;
}

.report-table tbody td {
    vertical-align: middle;
}

.audit-details-cell {
    max-width: 360px;
    white-space: normal;
    word-break: break-word;
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: #dbe4f0;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.18);
}

.btn.rounded-4 {
    border-radius: 16px !important;
}

.alert {
    border-radius: 18px;
    border: 0;
    box-shadow: var(--shadow-soft);
}

.soft-badge.neutral {
    background: rgba(100, 116, 139, 0.12);
    color: #334155;
}

@media (max-width: 991.98px) {
    .page-heading {
        flex-direction: column;
    }

    .topbar-search {
        min-width: 100%;
    }
}


.dashboard-card-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
}

.dashboard-card-row::-webkit-scrollbar {
    height: 8px;
}

.dashboard-card-row::-webkit-scrollbar-thumb {
    background: rgba(115, 129, 155, 0.35);
    border-radius: 999px;
}

.dashboard-card-col {
    flex: 0 0 min(240px, calc((100% - 5rem) / 6));
    min-width: 210px;
}

@media (max-width: 1599.98px) {
    .dashboard-card-col {
        flex-basis: 220px;
    }
}

@media (max-width: 991.98px) {
    .dashboard-card-row {
        gap: 0.85rem;
    }

    .dashboard-card-col {
        flex-basis: 230px;
    }
}
