/* ThreeCostAdmin - Modern SaaS Design System */
:root {
    --primary: #3954ac;
    --primary-dark: #2c4289;
    --primary-darker: #1e2d5c;
    --primary-light: #eef2fb;
    --sidebar-bg: #1a2744;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(57, 84, 172, 0.35);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --brand-column-bg: #1a2744;
    --accent-teal: #0d9488;
    --accent-amber: #d97706;
    --accent-violet: #7c3aed;
    --surface: #ffffff;
    --bg: #f4f6fb;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --header-h: 64px;
    --sidebar-w: 220px;
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --transition: 0.18s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Shell ── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: var(--header-h);
    display: flex;
    align-items: stretch;
    padding-right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-toolbar {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 0 20px 0 24px;
}

.header-toolbar-start {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.header-year-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.header-year-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.header-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s cubic-bezier(0.32, 0.72, 0, 1),
        background 0.2s cubic-bezier(0.32, 0.72, 0, 1),
        color 0.2s cubic-bezier(0.32, 0.72, 0, 1),
        box-shadow 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.header-logout-btn:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.08);
}

.header-logout-btn:active {
    transform: scale(0.98);
}

.header-logout-btn img {
    width: 14px;
    height: 14px;
    display: block;
    object-fit: contain;
}

.header-logout-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0f172a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.header-logout-btn:hover .header-logout-icon {
    background: #7f1d1d;
}

.header .header-toolbar-start .period-selector {
    margin: 0;
}

.header .header-toolbar-start .saas-select,
.header .header-toolbar-start .selectClass {
    margin-left: 0;
}

.logo {
    width: var(--sidebar-w);
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--brand-column-bg);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.logo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 42%);
    pointer-events: none;
}

.logo::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, rgba(57, 84, 172, 0.35) 100%);
    opacity: 0.85;
}

.logo img {
    position: relative;
    z-index: 1;
    max-width: 78%;
    max-height: 42px;
    object-fit: contain;
    filter: brightness(1.05);
}

.wrapper {
    display: flex;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
}

.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--brand-column-bg);
    padding: 16px 12px 24px;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
}

.nav-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-item a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active a,
.nav-item a.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary-light);
}

.nav-item img {
    width: 18px;
    height: 18px;
    opacity: 0.9;
    flex-shrink: 0;
}

.nav-item .nav-text {
    flex: 1;
    white-space: nowrap;
}

.main-content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    min-height: calc(100vh - var(--header-h));
    padding: 20px 24px 32px;
    background: var(--bg);
    overflow-y: auto;
    max-height: calc(100vh - var(--header-h));
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 99px;
}

/* ── Header controls & custom selects ── */
.selectClass {
    margin-left: 20px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.selectClass:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 84, 172, 0.12);
}

/* 自定义下拉（admin-select.js） */
.saas-select {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    min-width: 88px;
}

.saas-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0, 0, 0, 0);
    overflow: hidden;
    white-space: nowrap;
}

.saas-select-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.2s cubic-bezier(0.32, 0.72, 0, 1),
        box-shadow 0.2s cubic-bezier(0.32, 0.72, 0, 1),
        background 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.saas-select-trigger::after {
    content: "";
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.55;
    transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.saas-select.is-open .saas-select-trigger::after {
    transform: rotate(180deg);
}

.saas-select-trigger:hover {
    border-color: var(--border-strong);
}

.saas-select.is-open .saas-select-trigger,
.saas-select-trigger:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 84, 172, 0.12);
    outline: none;
}

.saas-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 400;
    min-width: 100%;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.06);
}

.saas-select-panel[hidden] {
    display: none !important;
}

.saas-select-option {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.saas-select-option:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.saas-select-option.is-active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* 筛选区：主色胶囊样式 */
.saas-select--chip .saas-select-trigger {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.saas-select--chip.is-open .saas-select-trigger,
.saas-select--chip .saas-select-trigger:hover {
    border-color: transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 4px 14px rgba(57, 84, 172, 0.28);
}

.filter-row--time {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.time-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.time-field-suffix {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.header .saas-select {
    margin-left: 0;
    min-width: 96px;
}

.header .selectClass {
    margin-left: 0;
}

.selectSpan {
    margin-left: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.selectSpan1 {
    font-size: 13px;
    margin-right: 6px;
    color: rgba(255, 255, 255, 0.9);
}

.selectspan2 {
    margin-left: 12px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    vertical-align: middle;
}

.selectspan2 .selectClass {
    margin: 0;
    border: none;
    background: transparent;
    color: #fff;
    padding: 4px 6px;
    font-size: 13px;
    font-weight: 500;
}

/* ── Period / action toolbar ── */
.period-selector,
.period-selector1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    margin: 4px 6px 4px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.period-selector a {
    color: inherit;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: center;
}

.period-selector:hover,
.period-selector1:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.period-selector.selected,
.period-selector1 {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.period-selector.selected a {
    color: #fff;
}

.period-selector1 {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.period-selector1:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.period-selector1--danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.period-selector1--danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

button.period-selector1 {
    font-family: inherit;
    line-height: inherit;
}

.month-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0 20px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.month-links a {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.month-links a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.month-links a.active {
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-color: var(--primary);
}

/* ── Page content ── */
.container {
    padding: 0;
}

.page-title,
h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}

.data-summary {
    margin-bottom: 24px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.data-summary h2 {
    font-size: 16px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    width: 100%;
}

.summary-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.summary-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.chart-card {
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 18px 20px;
    min-width: 280px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.chart-card .card-header {
    color: rgba(255, 255, 255, 0.75);
}

.more {
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary-light);
    font-weight: 600;
    transition: background var(--transition), color var(--transition);
}

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

.card-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
}

.chart-card .card-amount {
    color: #fff;
}

/* ── DataSummary page ── */
.page-head {
    margin-bottom: 20px;
}

.page-head-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-head-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.filter-toolbar {
    margin-bottom: 22px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.filter-toolbar-label {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.period-selectors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.period-selectors .period-selector {
    margin: 0;
}

.filter-toolbar .month-links {
    margin: 0;
    padding: 10px 12px;
    background: var(--bg);
    border-style: dashed;
}

.data-summary-sections {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.data-summary {
    margin-bottom: 0;
}

.cards-container .summary-card {
    position: relative;
    overflow: hidden;
}

.cards-container .summary-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 3px 0 0 3px;
    background: var(--primary);
}

.cards-container .summary-card:nth-child(2)::before {
    background: var(--accent-teal);
}

.cards-container .summary-card:nth-child(3)::before {
    background: var(--accent-amber);
}

.cards-container .summary-card:nth-child(4)::before {
    background: var(--accent-violet);
}

.cards-container .summary-card:nth-child(1) .card-amount {
    color: var(--primary);
}

.cards-container .summary-card:nth-child(2) .card-amount {
    color: var(--accent-teal);
}

.cards-container .summary-card:nth-child(3) .card-amount {
    color: var(--accent-amber);
}

.cards-container .summary-card:nth-child(4) .card-amount {
    color: var(--accent-violet);
}

@media (max-width: 768px) {
    .page-head-title {
        font-size: 18px;
    }

    .filter-toolbar {
        padding: 14px;
    }

    .period-selectors .period-selector {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    .cards-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .summary-card {
        padding: 14px;
    }

    .card-amount {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .cards-container {
        grid-template-columns: 1fr;
    }
}

/* ── Tables ── */
.main-content > .container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    table-layout: fixed;
}

/* 表头行：禁止被详情页工具栏的 .table-header flex 规则污染 */
.table thead tr,
tr.table-header {
    display: table-row;
}

.table thead th {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 14px 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    white-space: nowrap;
    vertical-align: middle;
}

.table thead th:last-child {
    border-right: none;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
    word-break: break-word;
}

/* 序号 */
.table th:nth-child(1),
.table td:nth-child(1) {
    width: 64px;
    text-align: center;
}

/* 团队 */
.table th:nth-child(2),
.table td:nth-child(2) {
    width: 14%;
    text-align: left;
    padding-left: 16px;
    font-weight: 500;
    color: var(--text);
}

/* 金额列 */
.table th:nth-child(3),
.table th:nth-child(4),
.table th:nth-child(5),
.table th:nth-child(6),
.table td:nth-child(3),
.table td:nth-child(4),
.table td:nth-child(5),
.table td:nth-child(6) {
    text-align: right;
    padding-right: 16px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* 未审核数量 */
.table th:nth-child(7),
.table td:nth-child(7) {
    width: 96px;
    text-align: center;
}

/* 操作 */
.table th:nth-child(8),
.table td:nth-child(8) {
    width: 140px;
    text-align: center;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: #f8fafc;
}

.th-first {
    border-top-left-radius: 0;
}

.th-last {
    border-top-right-radius: 0;
}

/* ── Buttons ── */
.btn-stop,
.btn-state,
.btn-delete,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    margin: 2px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

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

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

.btn-state {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-state:hover {
    background: #dce4f7;
    color: var(--primary-darker);
}

.btn-delete {
    background: #fef2f2;
    color: #b91c1c;
}

.btn-delete:hover {
    background: #fee2e2;
}

.btn-link {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    text-decoration: none;
}

.status,
.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: #f1f5f9;
    color: var(--text-muted);
}

.selectorright {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    float: right;
    margin-left: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition);
}

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

.selectorright img {
    width: 16px;
    height: auto;
}

/* ── Modals ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    margin: 10vh auto;
    padding: 28px 32px;
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    position: relative;
}

.modal-content h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.modal-content .saas-select {
    width: 100%;
}

.modal-content .saas-select-panel {
    min-width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 84, 172, 0.12);
}

#teamName {
    background: #f8fafc;
}

.error-msg {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.reset-btn {
    width: 100%;
    padding: 11px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
}

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

.reset-btn:active {
    transform: scale(0.98);
}

.reset-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* ── Upload / import ── */
.content-box {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    width: min(480px, 100%);
    background: var(--surface);
    transition: border-color var(--transition), background var(--transition);
}

.content-box:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity var(--transition);
}

.upload-icon:hover {
    opacity: 1;
}

.file-input {
    display: none;
}

.upload-button {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 11px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

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

.file-format {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 12px;
}

.upload-progress {
    width: min(480px, 100%);
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 99px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.custom-alert {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(360px, 90vw);
    padding: 24px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    z-index: 1100;
    text-align: center;
    border: 1px solid var(--border);
}

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

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

.custom-alert button {
    margin-top: 14px;
    padding: 9px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

/* ── Layui overrides ── */
.layui-input,
.layui-select,
.layui-textarea {
    height: 42px;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
}

.layui-form-select dl {
    border-radius: var(--radius-sm);
}

/* ── Utility ── */
.chart-container {
    height: 200px;
    margin-top: 16px;
    width: 100%;
}

.summary-grid-with-chart {
    align-items: stretch;
}

.summary-grid-with-chart .cards-container {
    grid-template-columns: repeat(2, 1fr);
    flex: 1;
}

.summary-grid-with-chart .chart-card {
    flex: 1;
    min-width: 280px;
}

.panel-box {
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.content-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.header-buttons {
    display: flex;
    gap: 8px;
}

.header-buttons button {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.header-buttons button:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .summary-grid-with-chart {
        flex-direction: column;
    }

    .summary-grid-with-chart .cards-container {
        grid-template-columns: 1fr;
    }
}

#uploadProgress {
    width: 100%;
    height: 5px;
    background: var(--border);
    margin-top: 10px;
    display: none;
    border-radius: 99px;
    overflow: hidden;
}

#uploadProgress div {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

#uploadResult {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .sidebar {
        width: 72px;
        padding: 12px 8px;
    }

    .nav-item a .nav-text {
        display: none;
    }

    .nav-item a {
        justify-content: center;
        padding: 12px;
    }

    .nav-item img {
        margin-right: 0;
    }

    .main-content {
        margin-left: 72px;
        width: calc(100% - 72px);
        padding: 16px;
    }

    .logo {
        width: 72px;
    }
}

/* ── Detail page (ProjectInitiationDetial) ── */
.detail-page h2 {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.table-container {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    font-size: 13px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* 详情页工具栏（勿与表格 thead tr.table-header 混用） */
.table-container > .table-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: #fafbfc;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.category-tab {
    cursor: pointer;
}

.category-link {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 4px;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

.category-link:hover {
    color: var(--primary);
}

.category-link.active {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background var(--transition);
}

.download-btn,
.edit-button {
    background: var(--primary);
    color: #fff;
}

.download-btn:hover,
.edit-button:hover {
    background: var(--primary-dark);
}

.add-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.table-content {
    min-height: 280px;
    padding: 0;
    overflow-x: auto;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.table-content table {
    width: 100%;
    border-collapse: collapse;
}

.table-content th,
.table-content td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

.table-content th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-content tbody tr:hover td {
    background: #f8fafc;
}

.quarter-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.quarters a {
    text-decoration: none;
    color: var(--text);
}


/* ── Login page ── */
.login-body {
    min-height: 100dvh;
    margin: 0;
    background: var(--surface);
}

.login-page {
    min-height: 100dvh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

.login-shell {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.login-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.login-bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
}

.login-bg-orb--1 {
    width: 520px;
    height: 520px;
    top: -120px;
    left: -80px;
    background: radial-gradient(circle, rgba(57, 84, 172, 0.85) 0%, transparent 68%);
}

.login-bg-orb--2 {
    width: 440px;
    height: 440px;
    right: -60px;
    bottom: -100px;
    background: radial-gradient(circle, rgba(13, 148, 136, 0.35) 0%, transparent 70%);
}

.login-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(90deg, #000 0%, #000 75%, transparent 100%);
}

.login-brand {
    position: relative;
    min-height: 100dvh;
    padding: 48px 56px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    overflow: hidden;
    background:
        linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 42%, transparent 100%),
        linear-gradient(180deg, rgba(26, 39, 68, 0.72) 0%, rgba(26, 39, 68, 0.96) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.login-brand > :not(.login-bg) {
    position: relative;
    z-index: 1;
}

.login-brand-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.login-brand-logo img {
    height: 38px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.96;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.login-brand-body h1 {
    margin: 0 0 14px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.login-brand-body p {
    margin: 0 0 24px;
    max-width: 420px;
    font-size: 14px;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.78);
}

.login-brand-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-brand-features li {
    position: relative;
    padding-left: 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
}

.login-brand-features li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 84, 172, 0.35);
}

.login-brand-footer {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

.login-panel {
    min-height: 100dvh;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 56px;
}

.login-panel-inner {
    width: 100%;
    max-width: 400px;
}

.login-panel-head {
    margin-bottom: 32px;
}

.login-panel h2 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.login-panel .login-desc {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.login-form .login-field {
    margin-bottom: 20px;
}

.login-form .login-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.login-input-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.login-panel .form-group input[type="text"],
.login-panel .form-group input[type="password"] {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: #f8fafc;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.login-panel .form-group input[type="text"]:focus,
.login-panel .form-group input[type="password"]:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(57, 84, 172, 0.12);
}

.login-input-wrap:focus-within .login-input-icon {
    color: var(--primary);
}

.login-btn {
    width: 100%;
    height: 48px;
    margin-top: 8px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 10px 24px rgba(57, 84, 172, 0.28);
}

.login-btn:hover:not(:disabled) {
    box-shadow: 0 14px 28px rgba(57, 84, 172, 0.34);
}

.login-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.login-btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

@media (max-width: 860px) {
    .login-page,
    .login-shell {
        height: auto;
        min-height: 100dvh;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand {
        min-height: auto;
        padding: 32px 24px 28px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        gap: 20px;
    }

    .login-brand-body h1 {
        font-size: 22px;
    }

    .login-brand-features {
        display: none;
    }

    .login-panel {
        min-height: auto;
        padding: 32px 24px 40px;
    }

    .login-panel-inner {
        max-width: none;
    }

    .login-panel-head {
        margin-bottom: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ── Shared admin pages ── */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.upload-page-layout {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.teams,
.teams-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.team {
    width: 132px;
    padding: 18px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.team:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.team a {
    text-decoration: none;
}

.team img {
    width: 52px;
    height: 52px;
    margin-bottom: 10px;
}

.team-name {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-all;
}

.page-section-title,
.container > .title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text);
}

.no-data {
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.dark-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 100%);
    border-radius: var(--radius-lg);
    color: #fff;
}

.dark-section .left-column,
.dark-section .right-column {
    padding: 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    text-align: center;
}

.dark-section .value {
    margin-top: 6px;
    font-size: 18px;
    font-weight: 700;
}

.form-section {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.form-section .section-title {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.form-section input[type="text"],
.form-section input[type="password"] {
    display: block;
    width: 100%;
    max-width: 360px;
    height: 42px;
    margin-bottom: 12px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.form-section input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 84, 172, 0.12);
}

.form-section button,
.form-section #submitBtn {
    margin-top: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.form-section button:hover,
.form-section #submitBtn:hover {
    background: var(--primary-dark);
}

.filter-toolbar .toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

/* ── Account history page ── */
.account-history-table {
    min-width: 980px;
}

.account-history-table .account-cell,
.account-history-table .password-cell {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    color: var(--text);
    text-align: left;
    padding-left: 14px;
}

.status-tag--ok {
    background: #ecfdf5;
    color: #047857;
}

/* 历史数据页 Tab */
.history-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    padding-bottom: 0;
}

.history-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted, #6b7280);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.history-tab:hover {
    color: var(--primary, #3954ac);
}

.history-tab.active {
    color: var(--primary, #3954ac);
    border-bottom-color: var(--primary, #3954ac);
}

.history-panel {
    display: none;
}

.history-panel.active {
    display: block;
}

.history-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    color: var(--primary, #3954ac);
    text-decoration: none;
    font-size: 14px;
}

.history-back-link:hover {
    text-decoration: underline;
}

/* DataSummary 团队明细弹窗 */
.modal-content--wide {
    max-width: 760px;
    margin: 6vh auto;
    padding: 24px 28px 28px;
}

.summary-detail-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--bg, #f8fafc);
    color: var(--text-muted, #6b7280);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.summary-detail-close:hover {
    background: var(--primary-light, #eef2ff);
    color: var(--primary, #3954ac);
}

.summary-detail-subtitle {
    margin: -8px 0 14px;
    font-size: 13px;
    color: var(--text-muted, #6b7280);
}

.summary-detail-total {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--primary-light, #eef2ff);
    border-radius: var(--radius-sm, 8px);
    font-size: 14px;
    font-weight: 600;
    color: var(--primary, #3954ac);
}

.summary-detail-table-wrap {
    max-height: 52vh;
    overflow: auto;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
}

.summary-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.summary-detail-table th,
.summary-detail-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border, #e5e7eb);
    white-space: nowrap;
}

.summary-detail-table th {
    position: sticky;
    top: 0;
    background: var(--bg, #f8fafc);
    font-weight: 600;
    color: var(--text-secondary, #475569);
    z-index: 1;
}

.summary-detail-table tbody tr:hover {
    background: rgba(57, 84, 172, 0.04);
}

.summary-detail-table td:nth-child(3),
.summary-detail-table td:nth-child(4),
.summary-detail-table td:nth-child(5) {
    font-variant-numeric: tabular-nums;
}

/* ── 期间上下文提示 ── */
.period-context-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 18px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border: 1px solid rgba(57, 84, 172, 0.15);
    border-radius: var(--radius-lg);
    font-size: 13px;
    color: var(--text-secondary);
}

.period-context-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.period-context-mode {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.period-context-hint {
    color: var(--text-muted);
    font-size: 12px;
}

.period-context-banner--readonly {
    background: linear-gradient(135deg, #fff7ed 0%, #f8fafc 100%);
    border-color: rgba(234, 88, 12, 0.2);
}

.period-context-banner--readonly .period-context-mode {
    background: #ea580c;
}

.import-target-banner {
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.import-target-banner strong {
    color: var(--primary);
}

.card-amount.is-loading {
    color: var(--text-muted) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: 0;
}

/* ── 工具栏分组 ── */
.toolbar-section {
    margin-bottom: 14px;
}

.toolbar-section:last-child {
    margin-bottom: 0;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sidebar .nav-item a[title] {
    position: relative;
}
