/* ========== 基础样式 ========== */
:root {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --orange: #f97316;
    --blue: #3b82f6;
    --green: #22c55e;
    --gray: #6b7280;
    --red: #ef4444;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ========== 页面切换 ========== */
.page {
    display: none;
    min-height: 100vh;
}
.page.active {
    display: block;
}

/* ========== 登录页 - 品牌级设计 ========== */
#page-login {
    background: linear-gradient(145deg, #065f46 0%, #047857 30%, #059669 60%, #10b981 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 背景装饰圆 */
.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.login-bg-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    background: white;
}
.login-bg-circle.c1 { width: 400px; height: 400px; top: -120px; right: -80px; }
.login-bg-circle.c2 { width: 300px; height: 300px; bottom: -80px; left: -60px; }
.login-bg-circle.c3 { width: 150px; height: 150px; top: 40%; left: 10%; }

.login-container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 品牌区域 */
.login-brand { margin-bottom: 28px; }
.login-logo-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}
.login-emoji {
    font-size: 56px;
    display: block;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
.login-logo-img {
    width:80px; height:80px; border-radius:50%;
    object-fit:cover; display:block;
    border:3px solid rgba(255,255,255,0.3);
    box-shadow:0 4px 16px rgba(0,0,0,0.2);
}
.logo-glow {
    position: absolute;
    width: 70px; height: 70px;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.2);
    filter: blur(12px);
    z-index: -1;
}
.login-brand-name {
    font-size: 28px;
    font-weight: 800;
    color: white;
    letter-spacing: 4px;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.login-brand-slogan {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    font-weight: 300;
    letter-spacing: 2px;
}
.login-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}
.login-divider span {
    width: 36px;
    height: 1px;
    background: rgba(255,255,255,0.3);
}
.login-divider small {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    letter-spacing: 1px;
}

/* 登录卡片 */
.login-form-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px 24px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.04);
}

.form-label {
    display: block;
    text-align: left;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}
.input-wrap input {
    padding-left: 42px !important;
}

.btn-login {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 17px !important;
    font-weight: 600 !important;
    letter-spacing: 3px;
    height: 48px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    transition: all 0.25s ease;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(34,197,94,0.35) !important; }
.btn-login:active { transform: scale(0.98); }
.btn-arrow { font-size: 18px; transition: transform 0.2s; }
.btn-login:hover .btn-arrow { transform: translateX(4px); }

/* 底部版权 */
.login-footer {
    margin-top: 20px;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
    background: var(--card-bg);
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    border-color: var(--primary);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-danger {
    background: var(--red);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* ========== 顶部导航 ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo {
    font-size: 22px;
}

.header-title {
    font-size: 17px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ========== 底部Tab栏 ========== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

.tab-item.active {
    color: var(--primary);
}

.tab-icon {
    font-size: 20px;
}

.tab-label {
    font-size: 10px;
    font-weight: 600;
}

.tab-add {
    position: relative;
    top: -12px;
}

.tab-icon-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(34,197,94,0.4);
}

/* ========== 内容区 ========== */
.content {
    padding: 60px 16px 72px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ========== 看板卡片 ========== */
.dashboard-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.card-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.card-value {
    font-size: 22px;
    font-weight: 800;
}

.card-total .card-value { color: var(--orange); }
.card-today .card-value { color: var(--blue); }
.card-week .card-value { color: var(--green); }
.card-income .card-value { color: var(--primary); }

.card-total { border-left: 4px solid var(--orange); }
.card-today { border-left: 4px solid var(--blue); }
.card-week { border-left: 4px solid var(--green); }
.card-income { border-left: 4px solid var(--primary); }

/* ========== 利润卡片 ========== */
.profit-card {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.profit-label {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.profit-value {
    font-size: 32px;
    font-weight: 800;
}

.profit-value.negative {
    color: #fca5a5;
}

.profit-hint {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

/* ========== 区块 ========== */
.section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* ========== 柱状图 ========== */
.chart-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 120px;
    padding-top: 20px;
}

.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    max-width: 36px;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.chart-label {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 4px;
}

.chart-value {
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

/* ========== 分类列表 ========== */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.category-item:last-child {
    border-bottom: none;
}

.category-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-icon {
    font-size: 20px;
}

.category-name {
    font-size: 13px;
    font-weight: 500;
}

.category-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--orange);
}

/* ========== 记录列表 ========== */
.record-list {
    display: flex;
    flex-direction: column;
}

.record-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--text-light);
    font-size: 14px;
}

.record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.record-item:last-child {
    border-bottom: none;
}

.record-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.record-icon {
    font-size: 24px;
    width: 36px;
    text-align: center;
}

.record-info {
    display: flex;
    flex-direction: column;
}

.record-category {
    font-size: 14px;
    font-weight: 600;
}

.record-note {
    font-size: 12px;
    color: var(--text-light);
}

.record-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.record-amount {
    font-size: 16px;
    font-weight: 800;
    color: var(--orange);
}

.record-amount.income {
    color: var(--primary);
}

.record-date {
    font-size: 11px;
    color: var(--text-light);
}

.record-delete {
    font-size: 11px;
    color: var(--red);
    cursor: pointer;
    background: none;
    border: none;
    padding: 2px 6px;
}

/* 日报卡片 */
.report-item-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 16px !important;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

/* ========== 视图头部 ========== */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.view-header h2 {
    font-size: 18px;
}

.filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--card-bg);
    outline: none;
}

/* ========== 设置页 ========== */
.settings-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.settings-avatar {
    font-size: 40px;
}

.settings-info {
    display: flex;
    flex-direction: column;
}

.settings-name {
    font-size: 18px;
    font-weight: 700;
}

.settings-role {
    font-size: 13px;
    color: var(--primary);
}

.settings-phone {
    font-size: 13px;
    color: var(--text-light);
}

.settings-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item.danger {
    color: var(--red);
}

.settings-version {
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    margin-top: 24px;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 40px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* ========== PC适配 ========== */
@media (min-width: 768px) {
    .dashboard-cards {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .modal-content {
        border-radius: 20px;
        margin-bottom: 20px;
    }
    
    .modal {
        align-items: center;
    }
    
    .content {
        max-width: 640px;
        margin: 0 auto;
    }
}
