/**
 * 后台管理端统一视觉系统。
 * 在不改变业务页面结构的前提下，统一导航、卡片、表格、表单和反馈组件。
 */
:root {
    --admin-primary: #4f46e5;
    --admin-primary-dark: #3730a3;
    --admin-primary-soft: #eef2ff;
    --admin-accent: #06b6d4;
    --admin-bg: #f4f7fb;
    --admin-surface: #ffffff;
    --admin-border: #e6eaf0;
    --admin-text: #172033;
    --admin-muted: #6b7280;
    --admin-sidebar: #0b1220;
    --admin-sidebar-soft: #121c30;
    --admin-success: #059669;
    --admin-warning: #d97706;
    --admin-danger: #dc2626;
    --admin-radius: 14px;
    --admin-shadow: 0 8px 28px rgba(30, 41, 59, 0.07);
    --admin-shadow-hover: 0 14px 38px rgba(30, 41, 59, 0.12);
}

html,
body.app-shell {
    min-height: 100%;
    background: var(--admin-bg);
}

.app-shell .min-w-0 {
    min-width: 0;
}

body.app-shell {
    margin: 0;
    color: var(--admin-text);
    font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.app-shell .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    width: 264px;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 0%, rgba(79, 70, 229, 0.26), transparent 32%),
        linear-gradient(180deg, var(--admin-sidebar) 0%, #0d1628 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.12);
    transition: transform 0.25s ease;
}

.app-shell .sidebar-inner {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 20px 14px 16px;
}

.app-shell .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 3px 8px 22px;
    color: #fff;
    text-decoration: none;
}

.app-shell .brand:hover {
    color: #fff;
}

.app-shell .brand-mark {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    background: linear-gradient(145deg, #6366f1, #06b6d4);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 13px;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.3);
}

.app-shell .brand-copy {
    min-width: 0;
}

.app-shell .brand-title {
    display: block;
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shell .brand-subtitle {
    display: block;
    margin-top: 2px;
    color: #8391aa;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-shell .sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 3px;
}

.app-shell .nav-section-label {
    margin: 8px 12px 7px;
    color: #66758f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.app-shell .sidebar a {
    color: #aebbd0;
    text-decoration: none;
}

.app-shell .sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 43px;
    margin: 2px 0;
    padding: 9px 12px;
    color: #aebbd0;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.app-shell .sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.app-shell .sidebar .nav-link.active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.34), rgba(6, 182, 212, 0.12));
    border-color: rgba(129, 140, 248, 0.2);
    box-shadow: inset 3px 0 0 #818cf8;
}

.app-shell .nav-icon {
    display: grid;
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    place-items: center;
    font-size: 15px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 8px;
}

.app-shell .nav-link.active .nav-icon {
    background: rgba(129, 140, 248, 0.2);
}

.app-shell .nav-chevron {
    margin-left: auto;
    color: #68758c;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.app-shell .nav-link[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.app-shell .sidebar .submenu {
    margin: 2px 0 5px 15px;
    padding: 3px 0 3px 16px;
    background: transparent;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.app-shell .sidebar .submenu .nav-link {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12.5px;
}

.app-shell .sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    color: #72819a;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.app-shell .status-dot {
    width: 7px;
    height: 7px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.app-shell .content-wrapper {
    position: relative;
    min-height: 100vh;
    margin-left: 264px;
    padding: 0 28px 36px;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 92% 0%, rgba(99, 102, 241, 0.055), transparent 24%),
        var(--admin-bg);
}

.app-shell .app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    margin: 0 -28px 25px;
    padding: 13px 28px;
    background: rgba(244, 247, 251, 0.88);
    border-bottom: 1px solid rgba(226, 232, 240, 0.82);
    backdrop-filter: blur(16px);
}

.app-shell .page-heading {
    min-width: 0;
}

.app-shell .page-heading h1 {
    margin: 0;
    color: var(--admin-text);
    font-size: clamp(21px, 2vw, 27px);
    font-weight: 750;
    letter-spacing: -0.035em;
}

.app-shell .page-kicker {
    margin-top: 4px;
    color: #8490a3;
    font-size: 11px;
}

.app-shell .mobile-menu-button {
    display: none;
    width: 40px;
    height: 40px;
    margin-right: 10px;
    padding: 0;
    color: var(--admin-text);
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
}

.app-shell .user-menu-button {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 6px;
    color: var(--admin-text);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}

.app-shell .user-menu-button:hover,
.app-shell .user-menu-button:focus {
    color: var(--admin-primary);
    background: #fff;
    border-color: #c7d2fe;
}

.app-shell .user-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: #fff;
    font-size: 13px;
    background: linear-gradient(145deg, #6366f1, #4f46e5);
    border-radius: 9px;
}

.app-shell .sidebar-backdrop {
    display: none;
}

/* 通用内容组件 */
.app-shell .card {
    overflow: visible;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
}

.app-shell .card-header {
    padding: 16px 19px;
    background: #fff !important;
    border-bottom: 1px solid #edf0f4;
    border-radius: var(--admin-radius) var(--admin-radius) 0 0 !important;
}

.app-shell .card-body {
    padding: 19px;
}

.app-shell .card-title,
.app-shell h5.card-title {
    color: #253047;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.app-shell .stat-card {
    overflow: hidden;
    border: 0;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.11);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-shell .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--admin-shadow-hover);
}

.app-shell .stat-card.bg-primary { background: linear-gradient(135deg, #4f46e5, #6366f1) !important; }
.app-shell .stat-card.bg-success { background: linear-gradient(135deg, #059669, #10b981) !important; }
.app-shell .stat-card.bg-warning { color: #fff !important; background: linear-gradient(135deg, #d97706, #f59e0b) !important; }
.app-shell .stat-card.bg-info { background: linear-gradient(135deg, #0284c7, #06b6d4) !important; }
.app-shell .stat-card.bg-danger { background: linear-gradient(135deg, #dc2626, #f43f5e) !important; }

.app-shell .table-responsive {
    border: 1px solid var(--admin-border);
    border-radius: 11px;
}

.app-shell .table {
    margin-bottom: 0;
    color: #344054;
    font-size: 13px;
    vertical-align: middle;
}

.app-shell .table > :not(caption) > * > * {
    padding: 12px 13px;
    border-bottom-color: #edf0f4;
}

.app-shell .table thead th {
    color: #667085;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.025em;
    white-space: nowrap;
    background: #f8fafc;
    border-bottom-width: 1px;
}

.app-shell .table tbody tr {
    transition: background-color 0.15s ease;
}

.app-shell .table tbody tr:hover {
    background: #f8faff;
}

.app-shell .form-label {
    margin-bottom: 6px;
    color: #475467;
    font-size: 12px;
    font-weight: 650;
}

.app-shell .form-control,
.app-shell .form-select {
    min-height: 40px;
    color: #263247;
    font-size: 13px;
    background-color: #fff;
    border: 1px solid #dce2ea;
    border-radius: 9px;
    box-shadow: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-shell textarea.form-control {
    min-height: 96px;
}

.app-shell .form-control:focus,
.app-shell .form-select:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.app-shell .input-group-text {
    color: #667085;
    background: #f8fafc;
    border-color: #dce2ea;
}

.app-shell .btn {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 650;
    border-radius: 9px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

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

.app-shell .btn-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    border-color: #4f46e5;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.18);
}

.app-shell .btn-outline-primary {
    color: #4f46e5;
    border-color: #c7d2fe;
}

.app-shell .btn-outline-primary:hover,
.app-shell .btn-outline-primary.active {
    color: #fff;
    background: #4f46e5;
    border-color: #4f46e5;
}

.app-shell .btn-sm {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 12px;
}

.app-shell .badge {
    padding: 5px 8px;
    font-weight: 650;
    border-radius: 999px;
}

.app-shell .bg-info {
    background-color: #0891b2 !important;
}

.app-shell .dropdown-menu {
    padding: 7px;
    border: 1px solid var(--admin-border);
    border-radius: 11px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
}

.app-shell .dropdown-item {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 7px;
}

.app-shell .dropdown-item:hover {
    background: var(--admin-primary-soft);
}

.app-shell .modal-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.app-shell .modal-header,
.app-shell .modal-footer {
    border-color: var(--admin-border);
}

.app-shell .alert {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: 10px;
}

.app-shell .pagination .page-link {
    min-width: 34px;
    margin: 0 2px;
    color: #475467;
    text-align: center;
    border-color: var(--admin-border);
    border-radius: 8px !important;
}

.app-shell .pagination .active .page-link {
    color: #fff;
    background: var(--admin-primary);
    border-color: var(--admin-primary);
}

.app-shell .border.rounded.bg-light,
.app-shell .border.rounded.p-3.bg-light {
    background: #fafbfc !important;
    border-color: var(--admin-border) !important;
    border-radius: 11px !important;
}

/* 高频业务页：筛选、结果列表与报告工作区 */
.app-shell .section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.app-shell .section-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0;
    color: #253047;
    font-size: 15px;
    font-weight: 750;
}

.app-shell .section-icon {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--admin-primary);
    font-size: 15px;
    font-weight: 800;
    background: var(--admin-primary-soft);
    border: 1px solid #dfe3ff;
    border-radius: 10px;
}

.app-shell .section-subtitle {
    margin: 4px 0 0 45px;
    color: #8a94a6;
    font-size: 11.5px;
}

.app-shell .filter-card {
    background: linear-gradient(180deg, #fff, #fdfdff);
}

.app-shell .filter-card .card-body {
    padding: 18px 20px 17px;
}

.app-shell .management-toolbar,
.app-shell .report-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-shell .management-toolbar {
    align-items: flex-end;
    justify-content: flex-end;
}

.app-shell .result-card .card-body {
    padding: 0;
}

.app-shell .result-card .surface-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 66px;
    padding: 15px 19px;
    border-bottom: 1px solid var(--admin-border);
}

.app-shell .result-card .surface-header .card-title {
    margin: 0;
}

.app-shell .data-surface {
    min-height: 240px;
    max-height: 640px;
    overflow: auto;
    background: #fff;
}

.app-shell .data-surface > .table-responsive {
    border: 0;
    border-radius: 0;
}

.app-shell .data-surface .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc !important;
}

.app-shell .empty-state {
    display: grid;
    min-height: 238px;
    padding: 32px;
    place-items: center;
    color: #8a94a6;
    text-align: center;
}

.app-shell .empty-state-mark {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 auto 13px;
    place-items: center;
    color: #6674d8;
    font-size: 20px;
    font-weight: 800;
    background: #f0f2ff;
    border: 1px solid #dfe3ff;
    border-radius: 16px;
}

.app-shell .empty-state-title {
    margin-bottom: 4px;
    color: #475467;
    font-weight: 700;
}

.app-shell .empty-state-text {
    margin: 0;
    font-size: 12px;
}

.app-shell .ticket-data-table {
    min-width: 1320px;
}

.app-shell .ticket-data-table td:first-child,
.app-shell .ticket-data-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
}

.app-shell .ticket-data-table th:first-child {
    z-index: 3;
    background: #f8fafc;
}

.app-shell .ticket-data-table td:last-child,
.app-shell .ticket-data-table th:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    min-width: 178px;
    background: #fff;
    box-shadow: -8px 0 14px rgba(15, 23, 42, 0.04);
}

.app-shell .ticket-data-table th:last-child {
    z-index: 3;
    background: #f8fafc;
}

.app-shell .report-workspace > [class*="col-"] {
    display: flex;
}

.app-shell .report-workspace .card {
    width: 100%;
}

.app-shell .report-parameter-card {
    position: sticky;
    top: 101px;
    align-self: flex-start;
}

.app-shell .report-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
    color: #667085;
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.app-shell .report-step::before {
    width: 18px;
    height: 3px;
    content: "";
    background: linear-gradient(90deg, var(--admin-primary), var(--admin-accent));
    border-radius: 999px;
}

.app-shell .report-result-card {
    min-height: 610px;
}

.app-shell .report-result-card .card-body {
    display: flex;
    min-height: 610px;
    flex-direction: column;
    padding: 0;
}

.app-shell .report-result-card .surface-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 67px;
    padding: 15px 19px;
    border-bottom: 1px solid var(--admin-border);
}

.app-shell .report-preview {
    flex: 1;
    min-height: 475px;
    margin: 0;
    padding: 27px clamp(20px, 4vw, 48px);
    color: #344054;
    line-height: 1.78;
    white-space: pre-wrap;
    background:
        linear-gradient(90deg, transparent 0, transparent 31px, rgba(79, 70, 229, 0.06) 32px, transparent 33px),
        #fdfdfd;
    border: 0 !important;
    border-radius: 0 !important;
}

.app-shell .report-preview .empty-state {
    min-height: 420px;
}

.app-shell .report-toolbar {
    margin: 0 !important;
    padding: 13px 19px;
    background: #fafbfc;
    border-top: 1px solid var(--admin-border);
}

.app-shell .card-footer {
    padding: 14px 18px;
    border-color: var(--admin-border);
    border-radius: 0 0 var(--admin-radius) var(--admin-radius) !important;
}

@media (max-width: 1199.98px) {
    .app-shell .report-parameter-card {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .app-shell .section-header,
    .app-shell .result-card .surface-header,
    .app-shell .report-result-card .surface-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-shell .management-toolbar {
        justify-content: flex-start;
    }

    .app-shell .management-toolbar .btn {
        flex: 1 1 calc(50% - 8px);
    }
}

.app-shell ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.app-shell ::-webkit-scrollbar-thumb {
    background: #cbd3df;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

.app-shell .sidebar ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.28);
    border: 2px solid transparent;
    background-clip: padding-box;
}

@media (max-width: 991.98px) {
    .app-shell .sidebar {
        transform: translateX(-105%);
    }

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

    .app-shell .content-wrapper {
        margin-left: 0;
        padding-right: 18px;
        padding-left: 18px;
    }

    .app-shell .app-topbar {
        margin-right: -18px;
        margin-left: -18px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .app-shell .mobile-menu-button {
        display: inline-grid;
        place-items: center;
    }

    .app-shell .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1035;
        display: block;
        visibility: hidden;
        background: rgba(15, 23, 42, 0.46);
        opacity: 0;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .app-shell.sidebar-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
    }
}

@media (max-width: 575.98px) {
    .app-shell .content-wrapper {
        padding-bottom: 24px;
    }

    .app-shell .app-topbar {
        min-height: 66px;
        margin-bottom: 18px;
    }

    .app-shell .page-kicker,
    .app-shell .user-name {
        display: none;
    }

    .app-shell .card-body {
        padding: 15px;
    }
}

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