/* ============================================================
   LAMB lab · 浅色艺术风主题
   ============================================================ */
:root {
    --ivory:        #FAF7F2;
    --cream:        #F5F0E8;
    --paper:        #FFFFFF;
    --ink:          #2A2520;
    --ink-light:    #5C5347;
    --ink-muted:    #9A9088;
    --line:         #E8E0D4;
    --line-soft:    #F0EAE0;
    --terracotta:   #C95F3C;
    --terracotta-dark: #A14A2E;
    --ochre:        #D4A93C;
    --sage:         #7A8B6F;
    --rose:         #C89B9B;
    --shadow-sm:    0 1px 2px rgba(42, 37, 32, 0.04);
    --shadow:       0 4px 16px rgba(42, 37, 32, 0.06);
    --shadow-lg:    0 10px 40px rgba(42, 37, 32, 0.08);
    --radius:       4px;
    --radius-lg:    8px;
}

* { box-sizing: border-box; }

html, body {
    background: var(--ivory);
    color: var(--ink);
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .display-serif, .brand-serif {
    font-family: 'Cormorant Garamond', 'Playfair Display', 'Source Han Serif SC', 'Noto Serif SC', serif;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink);
    margin: 0;
}

.brand-serif {
    font-size: 1.6rem;
    letter-spacing: 0.05em;
}

.mono {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-feature-settings: 'tnum' 1;
}

/* 隐藏部署水印 */
#minimax-floating-ball, .minimax-ball-text, .minimax-ball-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============== 布局 ============== */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar {
    width: 240px;
    background: var(--paper);
    border-right: 1px solid var(--line);
    padding: 32px 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 28px 28px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 24px;
}

.sidebar-brand .brand-mark {
    display: inline-block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--terracotta);
    line-height: 1;
    margin-bottom: 6px;
}

.sidebar-brand .brand-sub {
    font-size: 0.75rem;
    color: var(--ink-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.nav-list { list-style: none; padding: 0; margin: 0; }
.nav-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 28px;
    color: var(--ink-light);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 2px solid transparent;
    transition: all .2s ease;
}
.nav-list li a:hover {
    color: var(--terracotta);
    background: var(--cream);
}
.nav-list li a.active {
    color: var(--terracotta);
    background: var(--cream);
    border-left-color: var(--terracotta);
    font-weight: 500;
}

.nav-list li a .nav-icon {
    width: 18px; height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}
.nav-list li a.active .nav-icon { opacity: 1; }

.sidebar-user {
    padding: 20px 28px;
    margin-top: 32px;
    border-top: 1px solid var(--line-soft);
    color: var(--ink-muted);
    font-size: 0.85rem;
}
.sidebar-user .user-name { color: var(--ink); font-weight: 500; }

.main {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main > .content { flex: 1; }

/* sidebar 内部三段：品牌 / 菜单 / 用户区；用户区用 margin-top:auto 推到底部 */
.sidebar-brand { flex-shrink: 0; }
.sidebar .nav-list { flex: 1 1 auto; }
.sidebar-user { flex-shrink: 0; margin-top: auto; }

.topbar {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h1 { font-size: 1.5rem; }
.topbar .breadcrumb { color: var(--ink-muted); font-size: 0.85rem; }

.content { padding: 32px 40px 60px; max-width: 1400px; }

/* ============== 卡片 ============== */
.card-art {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease;
}
.card-art:hover { box-shadow: var(--shadow); }
.card-art .card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--ink);
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 12px;
}

/* ============== 统计卡片 ============== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--terracotta);
}
.stat-card .stat-label {
    color: var(--ink-muted);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.stat-card .stat-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.1;
}
.stat-card .stat-value .currency {
    font-size: 1rem;
    color: var(--ink-muted);
    margin-right: 4px;
}
.stat-card .stat-sub {
    margin-top: 8px;
    color: var(--ink-muted);
    font-size: 0.85rem;
}
.stat-card.accent::before { background: var(--ochre); }
.stat-card.sage::before { background: var(--sage); }
.stat-card.rose::before { background: var(--rose); }

/* ============== 按钮 ============== */
.btn {
    border-radius: var(--radius);
    font-size: 0.9rem;
    padding: 8px 18px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all .2s ease;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    line-height: 1.5;
}
.btn-primary {
    background: var(--terracotta);
    color: white;
    border-color: var(--terracotta);
}
.btn-primary:hover {
    background: var(--terracotta-dark);
    color: white;
    border-color: var(--terracotta-dark);
}
.btn-outline {
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
}
.btn-outline:hover {
    border-color: var(--ink-light);
    background: var(--cream);
    color: var(--ink);
}
.btn-ghost {
    background: transparent;
    color: var(--ink-light);
    border: none;
    padding: 6px 10px;
}
.btn-ghost:hover {
    color: var(--terracotta);
}
.btn-sm { padding: 4px 12px; font-size: 0.85rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ============== 表格 ============== */
.table-art {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--paper);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table-art thead th {
    background: var(--cream);
    color: var(--ink-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 14px 16px;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid var(--line);
}
.table-art tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
}
.table-art tbody tr:last-child td { border-bottom: none; }
.table-art tbody tr:hover { background: var(--cream); }
.table-art .num {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    text-align: right;
    font-feature-settings: 'tnum' 1;
}

/* ============== 标签 ============== */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    background: var(--cream);
    color: var(--ink-light);
    border: 1px solid var(--line);
    letter-spacing: 0.05em;
}
.tag-wedding { background: rgba(201, 95, 60, 0.1); color: var(--terracotta); border-color: rgba(201, 95, 60, 0.2); }
.tag-engagement { background: rgba(212, 169, 60, 0.12); color: #A0821C; border-color: rgba(212, 169, 60, 0.25); }
.tag-birthday { background: rgba(200, 155, 155, 0.18); color: #A55858; border-color: rgba(200, 155, 155, 0.3); }
.tag-other { background: var(--cream); color: var(--ink-light); }
.tag-deposit { background: rgba(122, 139, 111, 0.15); color: var(--sage); border-color: rgba(122, 139, 111, 0.25); }
.tag-self { background: rgba(201, 95, 60, 0.1); color: var(--terracotta); border-color: rgba(201, 95, 60, 0.2); }

/* ============== 表单 ============== */
.form-art { background: var(--paper); padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--line); }
.form-section { margin-bottom: 28px; }
.form-section .section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem;
    color: var(--ink);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--line);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; }
.form-group label {
    font-size: 0.82rem;
    color: var(--ink-light);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}
.form-control, input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=email], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px rgba(201, 95, 60, 0.1);
}
textarea { min-height: 90px; resize: vertical; }
.form-hint { color: var(--ink-muted); font-size: 0.78rem; margin-top: 4px; }

/* 多选 chip 样式 */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select .chip {
    padding: 5px 12px;
    border-radius: 100px;
    background: var(--paper);
    border: 1px solid var(--line);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--ink-light);
    user-select: none;
    transition: all .15s ease;
}
.chip-select .chip:hover { border-color: var(--terracotta); color: var(--terracotta); }
.chip-select .chip.active {
    background: var(--terracotta);
    color: white;
    border-color: var(--terracotta);
}

/* ============== 提示 ============== */
.alert-art {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid;
    font-size: 0.9rem;
}
.alert-art.success { background: rgba(122, 139, 111, 0.08); border-color: rgba(122, 139, 111, 0.3); color: var(--sage); }
.alert-art.error { background: rgba(201, 95, 60, 0.06); border-color: rgba(201, 95, 60, 0.3); color: var(--terracotta-dark); }
.alert-art.info { background: rgba(212, 169, 60, 0.08); border-color: rgba(212, 169, 60, 0.3); color: #8C6E1A; }

/* ============== 登录页 ============== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FAF7F2 0%, #F0E8DC 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: 'LAMB';
    position: absolute;
    font-family: 'Cormorant Garamond', serif;
    font-size: 35rem;
    color: rgba(201, 95, 60, 0.04);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}
.login-card {
    background: var(--paper);
    padding: 56px 48px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--line);
}
.login-card .login-brand {
    text-align: center;
    margin-bottom: 32px;
}
.login-card .login-brand .logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3rem;
    font-weight: 600;
    color: var(--terracotta);
    line-height: 1;
    letter-spacing: 0.1em;
}
.login-card .login-brand .tagline {
    color: var(--ink-muted);
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 8px;
}
.login-card .login-hint {
    background: var(--cream);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--ink-light);
    margin-top: 20px;
    line-height: 1.6;
}
.login-card .login-hint .key {
    font-family: 'JetBrains Mono', monospace;
    background: var(--paper);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--terracotta);
}

/* ============== 详情 ============== */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
@media (max-width: 1024px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line-soft);
}
.detail-row .label { color: var(--ink-muted); font-size: 0.85rem; }
.detail-row .value { color: var(--ink); }
.detail-section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--ink);
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.profit-positive { color: var(--sage); font-weight: 500; }
.profit-negative { color: var(--terracotta); font-weight: 500; }

/* ============== 操作条 ============== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar .toolbar-left { display: flex; gap: 8px; align-items: center; }
.toolbar .toolbar-right { display: flex; gap: 8px; align-items: center; }

/* ============== 头像/人员 ============== */
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--cream);
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--terracotta);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Cormorant Garamond', serif;
}
.user-avatar-lg {
    width: 64px; height: 64px;
    font-size: 1.5rem;
}

/* 空白状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ink-muted);
}
.empty-state .empty-icon { font-size: 3rem; opacity: 0.4; margin-bottom: 12px; }

/* 响应式 */
@media (max-width: 1024px) {
    .app-shell { grid-template-columns: 200px 1fr; }
    .sidebar { width: 200px; }
}
@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 16px 0;
    }
    .nav-list { display: flex; flex-wrap: wrap; padding: 0 16px; }
    .nav-list li a { padding: 8px 14px; }
    .sidebar-user { display: none; }
    .content { padding: 20px; }
    .topbar { padding: 16px 20px; }

    /* ===== 表格 → 卡片化（移动端） ===== */
    .table-art { background: transparent; box-shadow: none; }
    .table-art thead { display: none; }
    .table-art, .table-art tbody, .table-art tr, .table-art td {
        display: block;
        width: 100% !important;
    }
    .table-art tr {
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        padding: 12px 16px;
        margin-bottom: 12px;
        box-shadow: var(--shadow-sm);
    }
    .table-art tr:last-child { margin-bottom: 0; }
    .table-art td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 5px 0;
        border: none !important;
        text-align: right;
        min-height: 24px;
    }
    .table-art td.num { text-align: right; }
    .table-art td::before {
        content: attr(data-label);
        color: var(--ink-muted);
        font-size: 0.72rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        font-weight: 500;
        flex-shrink: 0;
        text-align: left;
    }
    /* 隐藏次要列（移动端精简） */
    .table-art td.col-hide-mobile { display: none; }

    /* 移动端 stat-grid 更紧凑 */
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}