/* ============================================
   一人办 - 财务收支管理系统 样式文件
   ============================================ */

/* CSS变量 - 主题管理 */
:root {
    /* 主色调 */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #DBEAFE;
    --primary-dark: #1E40AF;

    /* 功能色 */
    --success: #10B981;
    --success-hover: #059669;
    --success-light: #D1FAE5;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --info: #6B7280;
    --info-light: #F3F4F6;

    /* 中性色 */
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    /* 布局 */
    --navbar-height: 56px;
    --sidebar-width: 200px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

    /* 过渡 */
    --transition: all 0.2s ease;
}

/* 全局重置 */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   顶部导航栏
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.navbar-divider {
    color: var(--border);
    font-size: 20px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-date {
    color: var(--text-secondary);
    font-size: 13px;
}

/* 组织选择器 */
.org-selector {
    position: relative;
}

.org-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    transition: var(--transition);
    min-width: 160px;
    justify-content: space-between;
}

.org-selector-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.icon-arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.org-selector.open .icon-arrow {
    transform: rotate(180deg);
}

/* 组织下拉菜单 */
.org-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 240px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 200;
    overflow: hidden;
}

.org-selector.open .org-dropdown {
    display: block;
    animation: fadeInDown 0.15s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.org-dropdown-list {
    max-height: 240px;
    overflow-y: auto;
}

.org-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.org-dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.org-dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.org-dropdown-item .org-type {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--info-light);
    padding: 1px 6px;
    border-radius: 3px;
}

.org-dropdown-item.active .org-type {
    background: var(--primary);
    color: white;
}

.org-dropdown-item .org-delete-btn {
    color: var(--text-muted);
    padding: 2px;
    border-radius: 3px;
    opacity: 0;
    transition: var(--transition);
    flex-shrink: 0;
}

.org-dropdown-item:hover .org-delete-btn {
    opacity: 1;
}

.org-dropdown-item .org-delete-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

.org-dropdown-footer {
    border-top: 1px solid var(--border);
    padding: 8px;
}

/* ============================================
   主体布局
   ============================================ */
.main-container {
    display: flex;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    z-index: 50;
    overflow-y: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item.active svg {
    fill: white;
}

.nav-item svg {
    flex-shrink: 0;
}

/* ============================================
   主内容区域
   ============================================ */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-width: 0;
}

/* 页面标题 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

/* ============================================
   筛选栏
   ============================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group input,
.filter-group select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    transition: var(--transition);
    min-width: 140px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* ============================================
   按钮样式
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-link {
    background: none;
    color: var(--primary);
    padding: 6px 12px;
    font-size: 13px;
}

.btn-link:hover {
    background: var(--primary-light);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--info-light);
    color: var(--text);
}

.btn-icon.danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ============================================
   表格样式
   ============================================ */
.table-container {
    background: var(--card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

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

thead {
    background: var(--bg);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

th.sortable {
    cursor: pointer;
}

th.sortable:hover {
    color: var(--primary);
}

th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.4;
}

th.sortable.asc .sort-icon,
th.sortable.desc .sort-icon {
    opacity: 1;
    color: var(--primary);
}

td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

/* 斑马纹 */
tbody tr:nth-child(even) {
    background: var(--bg);
}

/* hover高亮 */
tbody tr:hover {
    background: var(--primary-light);
}

/* 收入/支出标识 */
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.type-badge.income {
    background: var(--success-light);
    color: var(--success);
}

.type-badge.expense {
    background: var(--danger-light);
    color: var(--danger);
}

/* 金额样式 */
.amount-income {
    color: var(--success);
    font-weight: 600;
}

.amount-expense {
    color: var(--danger);
    font-weight: 600;
}

/* 操作按钮组 */
.action-group {
    display: flex;
    gap: 4px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============================================
   分页控件
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* 交易记录合计 */
.transaction-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 16px;
    font-weight: 600;
}

.summary-value.income {
    color: var(--income);
}

.summary-value.expense {
    color: var(--expense);
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-info select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 12px;
}

.pagination-btns {
    display: flex;
    gap: 4px;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
    background: var(--card);
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   统计卡片
   ============================================ */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.stat-card-value.income {
    color: var(--success);
}

.stat-card-value.expense {
    color: var(--danger);
}

.stat-card-value.balance {
    color: var(--primary);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon.income {
    background: var(--success-light);
    color: var(--success);
}

.stat-card-icon.expense {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card-icon.balance {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card-icon.count {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================
   图表容器
   ============================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
}

.chart-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.chart-container {
    position: relative;
    width: 100%;
    /* 柱状图高度 */
    height: 300px;
}

.chart-container.pie {
    height: 320px;
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    font-size: 20px;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--info-light);
    color: var(--text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ============================================
   表单样式
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

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

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

/* 帮助图标 */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.help-icon:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* 帮助内容样式 */
.help-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.help-content p {
    margin-bottom: 12px;
}

.help-content ul {
    margin-top: 8px;
}

.help-content li {
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error,
.form-select.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea {
    height: 80px;
    padding: 8px 12px;
    resize: vertical;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
    display: none;
}

.form-error.visible {
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   Toast提示
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 12px);
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    color: var(--text);
    animation: toastIn 0.3s ease;
    min-width: 260px;
    max-width: 400px;
}

.toast.toast-out {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

.toast.success .toast-icon {
    background: var(--success);
}

.toast.error .toast-icon {
    background: var(--danger);
}

.toast.warning .toast-icon {
    background: var(--warning);
}

.toast.info .toast-icon {
    background: var(--info);
}

.toast-message {
    flex: 1;
}

/* ============================================
   导出页面
   ============================================ */
.export-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    max-width: 600px;
}

.export-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 20px;
}

.export-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ============================================
   年份选择器
   ============================================ */
.year-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.year-selector label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.year-selector select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
}

/* ============================================
   分类明细表格区域
   ============================================ */
.detail-section {
    margin-bottom: 24px;
}

.detail-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

/* ============================================
   加载状态
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   确认模态框
   ============================================ */
.confirm-content {
    text-align: center;
    padding: 20px 0;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--danger-light);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-message {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 8px;
}

.confirm-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   响应式布局
   ============================================ */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 16px 0;
    }

    .sidebar .nav-item span {
        display: none;
    }

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

    .content {
        margin-left: 60px;
        padding: 16px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group input,
    .filter-group select {
        min-width: auto;
        width: 100%;
    }

    .filter-actions {
        flex-direction: row;
    }

    .stats-cards {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        max-width: 100%;
        margin: 10px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

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

    .navbar {
        padding: 0 12px;
    }

    .app-title {
        font-size: 16px;
    }

    .org-selector-btn {
        min-width: 120px;
        font-size: 12px;
    }
}

/* ============================================
   滚动条美化
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   工具类
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.flex {
    display: flex;
}

.gap-8 {
    gap: 8px;
}

.hidden {
    display: none !important;
}

/* ============================================
   周期管理页面样式
   ============================================ */

/* 周期卡片网格布局 */
.periods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* 响应式布局：大屏3列，中屏2列，小屏1列 */
@media (max-width: 1200px) {
    .periods-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* ============================================
   报税日历组件样式
   ============================================ */

.tax-calendar-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.tax-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tax-calendar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tax-calendar-month {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.tax-calendar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tax-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--border);
    transition: var(--transition);
}

.tax-item:hover {
    background: var(--primary-light);
}

.tax-item.status-pending {
    border-left-color: var(--warning);
}

.tax-item.status-completed {
    border-left-color: var(--success);
}

.tax-item.status-urgent {
    border-left-color: var(--danger);
    background: var(--danger-light);
}

.tax-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tax-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

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

.tax-item-deadline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tax-deadline-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.tax-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tax-status-badge.status-pending {
    background: var(--warning-light);
    color: var(--warning);
}

.tax-status-badge.status-completed {
    background: var(--success-light);
    color: var(--success);
}

.tax-status-badge.status-urgent {
    background: var(--danger-light);
    color: var(--danger);
}

.tax-custom-badge {
    display: inline-block;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    background: #EDE9FE;
    color: #7C3AED;
    margin-left: 6px;
    vertical-align: middle;
}

.tax-calendar-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.tax-calendar-legend {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.tax-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tax-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.tax-legend-dot.pending {
    background: var(--warning);
}

.tax-legend-dot.completed {
    background: var(--success);
}

.tax-legend-dot.urgent {
    background: var(--danger);
}

/* 报税日历与周期网格布局 */
.periods-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

@media (max-width: 1200px) {
    .periods-layout {
        grid-template-columns: 1fr;
    }
    
    .tax-calendar-card {
        margin-bottom: 20px;
    }
}

/* ============================================
   附件上传样式
   ============================================ */

.attachment-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    background: var(--bg);
    transition: var(--transition);
    cursor: pointer;
}

.attachment-dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.attachment-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.01);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.attachment-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-light);
}

.attachment-name {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.attachment-remove {
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.attachment-remove:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* 表格中的附件图标 */
.attachment-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 12px;
}

.attachment-icon.clickable:hover {
    color: var(--primary-hover, #1677ff);
    transform: scale(1.1);
    transition: all 0.2s ease;
}

.attachment-detail-item:hover {
    background-color: var(--bg-hover, #f5f5f5);
    transition: background-color 0.2s ease;
}

/* 税务分类标签 */
.tax-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--info-light);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 11px;
}

/* 事项文本 */
.item-text {
    color: var(--text);
    font-size: 13px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 周期卡片 */
.period-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.period-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.period-card.period-active {
    border-color: var(--primary);
    border-width: 2px;
}

.period-card.period-closed {
    opacity: 0.85;
}

/* 周期卡片头部 */
.period-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.period-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 状态标签 */
.period-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.period-status.status-active {
    background: var(--primary-light);
    color: var(--primary);
}

.period-status.status-closed {
    background: var(--info-light);
    color: var(--info);
}

/* 日期范围 */
.period-date-range {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.period-date-range svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

/* 金额行 */
.period-balance-row {
    display: flex;
    gap: 20px;
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.period-balance-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.period-balance-value {
    font-size: 18px;
    font-weight: 700;
}

.period-balance-value.period-start-balance {
    color: var(--primary);
}

/* 卡片操作按钮 */
.period-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.period-card-actions .btn {
    flex: 1;
    min-width: 70px;
}

/* 关闭周期模态框信息 */
.close-period-info {
    background: var(--bg);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.close-period-info p {
    margin-bottom: 8px;
    font-size: 14px;
}

.close-period-info p:last-child {
    margin-bottom: 0;
}

.close-period-tip {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* 导航栏中的周期标签 */
.period-tag {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== 登录/注册页面 ==================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

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

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-block {
    width: 100%;
}

/* ==================== 侧边栏底部用户信息 ==================== */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.user-detail {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-level {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== 用户中心 ==================== */
.user-center-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.uc-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.uc-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}

.uc-info h3 {
    margin: 0 0 4px;
    font-size: 20px;
    color: var(--text);
}

.uc-info p {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.level-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.level-badge.level-premium {
    background: linear-gradient(135deg, #f6d365, #fda085);
    color: #7c2d12;
}

.level-badge.level-basic {
    background: #e2e8f0;
    color: #475569;
}

.test-notice {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #92400e;
}

/* 付费卡片 */
.pricing-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.pricing-options {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.pricing-item {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.pricing-item.pricing-active {
    border-color: var(--primary);
    background: #f0f4ff;
}

.pricing-item.pricing-best {
    border-color: #f59e0b;
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 2px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
}

.pricing-price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
}

.pricing-save {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
}

.pricing-current {
    text-align: center;
    color: var(--primary);
    font-weight: 600;
    padding: 8px;
}

/* 设置列表 */
.settings-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.settings-item:last-child {
    border-bottom: none;
}

.settings-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

.settings-desc {
    font-size: 13px;
    color: var(--text-secondary);
}
