/* ==========================================================================
   宠百分 · 财务分账系统 - 现代金融与业务协同设计系统 (Design System v4.0)
   与同平台【库存管理系统】深度对齐视觉风格、色彩规范与交互体验
   ========================================================================== */

:root {
    /* 核心品牌色：深度对齐库存系统的鲜亮活力红与品牌红色阶 */
    --brand: #d92d20;
    --brand-dark: #b42318;
    --brand-darker: #912018;
    --brand-soft: #fff1f0;
    --brand-light: #fef3f2;
    --brand-glow: rgba(217, 45, 32, 0.12);
    --brand-border: rgba(217, 45, 32, 0.22);

    /* 兼容历史品牌色变量 */
    --brand-red: var(--brand);
    --brand-red-hover: var(--brand-dark);
    --brand-red-active: var(--brand-darker);
    --brand-red-light: var(--brand-soft);
    --brand-red-border: var(--brand-border);
    --brand-red-glow: var(--brand-glow);

    /* 现代极简背景灰阶体系 (对齐库存系统 Page & Panel 规范) */
    --bg-page: #f5f7fb;
    --page: #f5f7fb;
    --bg-surface: #ffffff;
    --panel: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-surface-subtle: #fafbfc;
    --bg-surface-sunken: #f2f4f7;
    --bg-surface-hover: #f8fafc;
    --bg-header: rgba(255, 255, 255, 0.96);

    /* 现代多层级文字阶梯 */
    --ink: #172033;
    --text-main: #172033;
    --text-regular: #344054;
    --text-muted: #667085;
    --muted: #667085;
    --text-light: #98a2b3;
    --text-inverse: #ffffff;

    /* 边框与精致微分割线规范 (对齐库存系统 --line: #e6e9ef) */
    --line: #e6e9ef;
    --border-color: #e6e9ef;
    --border-subtle: #f2f4f7;
    --border-light: #f2f4f7;
    --border-dark: #d0d5dd;

    /* 语义业务状态色盘 (与库存系统一览表对齐) */
    --color-success: #079455;
    --green: #079455;
    --bg-success: #ecfdf3;
    --border-success: #a6f4c5;

    --color-warning: #dc6803;
    --amber: #dc6803;
    --bg-warning: #fef0c7;
    --border-warning: #fedf89;

    --color-danger: #d92d20;
    --bg-danger: #fef3f2;
    --border-danger: #fecdca;

    --color-info: #1570ef;
    --blue: #1570ef;
    --bg-info: #eff8ff;
    --border-info: #b2ddff;

    --color-violet: #6938ef;
    --purple: #6938ef;
    --bg-violet: #f9f5ff;
    --border-violet: #e9d7fe;

    --color-neutral: #475467;
    --bg-neutral: #f2f4f7;
    --border-neutral: #eaecf0;

    /* 现代微阴影与环境光体系 (对齐库存系统 --theme-shadow) */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.05);
    --shadow-card-hover: 0 12px 28px -4px rgba(18, 27, 45, 0.08);
    --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.08);
    --shadow-focus: 0 0 0 3px var(--brand-glow);
    --theme-shadow: 0 10px 30px rgba(18, 27, 45, 0.06);

    /* 圆角规范 */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-full: 9999px;

    /* 容器最大宽度 (与库存系统 1540px/1600px 生产力视野完全一致) */
    --max-content-width: 1540px;

    /* 字体族 */
    --font-sans: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "Segoe UI", "SF Mono", Consolas, "Liberation Mono", Menlo, Courier, monospace;

    /* 兼容历史与衍生模块 Token */
    --app-ink: var(--text-main);
    --app-muted: var(--text-muted);
    --app-border: var(--border-color);
    --app-primary: var(--brand-red);
    --app-primary-dark: var(--brand-dark);
    --app-header: var(--bg-surface);
}

/* ==========================================================================
   全局重置与字体排版基础
   ========================================================================== */

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

html {
    background: var(--bg-page);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body, .app-body {
    min-height: 100vh;
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

input, button, select, textarea {
    font: inherit;
}

/* 统一细滚动条规范 (对齐库存系统) */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 999px;
}

/* ==========================================================================
   全局容器与母版外壳 (App Shell & Header)
   ========================================================================== */

.app-shell {
    width: min(var(--max-content-width), calc(100% - 48px));
    margin: 0 auto;
}

.app-main {
    padding: 24px 0 64px;
}

/* QA 测试环境横幅 (对齐库存管理系统 QA 醒目横幅) */
.qa-environment-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    background: #fbbf24;
    color: #111827;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-align: center;
}

/* 顶栏导航 - 现代毛玻璃与极细分界线 */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.app-header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* 品牌标识 (对齐库存系统的 Logo 与微型英文字标) */
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.app-brand:hover {
    opacity: 0.95;
}

.app-brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.app-brand-text strong {
    display: block;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.app-brand-text small {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* 导航链接集合 */
.app-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-primary-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-primary-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.app-primary-nav a:hover {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.app-primary-nav a.active {
    color: var(--brand);
    background: var(--brand-soft);
    font-weight: 700;
}

.app-primary-nav a.active::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 14px;
    right: 14px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--brand);
}

/* 关联生态快速切换入口 (库存管理系统联动) */
.app-ecosystem-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: #f3f4f6;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    transition: all 0.15s ease;
}

.app-ecosystem-link:hover {
    background: #e5e7eb;
    color: var(--text-main);
    border-color: #d1d5db;
}

.app-ecosystem-link svg {
    width: 14px;
    height: 14px;
    opacity: 0.75;
}

/* 管理下拉面板 */
.app-admin-menu {
    position: relative;
}

.app-admin-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: all 0.15s ease;
}

.app-admin-menu summary::-webkit-details-marker {
    display: none;
}

.app-admin-menu summary:hover,
.app-admin-menu[open] summary {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.app-admin-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    animation: menuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.app-admin-panel a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.12s ease;
}

.app-admin-panel a:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.app-admin-panel .divider {
    height: 1px;
    margin: 4px 0;
    background: var(--border-color);
}

/* ==========================================================================
   全局消息提示堆栈 (Flash Messages)
   ========================================================================== */

.flash-stack {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-xs);
    animation: fadeIn 0.15s ease;
}

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

.flash-item.flash-success {
    background: var(--bg-success);
    border-left: 4px solid var(--color-success);
    color: #065f46;
}

.flash-item.flash-danger {
    background: var(--bg-danger);
    border-left: 4px solid var(--color-danger);
    color: #991b1b;
}

.flash-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}

.flash-content {
    flex: 1;
}

.flash-close {
    background: none;
    border: 0;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 0 4px;
}

.flash-close:hover {
    opacity: 1;
}

/* ==========================================================================
   页面顶栏规范 (Page Hero / Page Header - 对齐库存管理系统)
   ========================================================================== */

.page-hero,
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 1.25rem;
    padding: 1.15rem 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 251, 251, 0.94) 100%);
    box-shadow: var(--theme-shadow);
    flex-wrap: wrap;
}

.page-header-start,
.page-hero-main {
    flex: 1;
    min-width: 260px;
}

.page-eyebrow {
    margin-bottom: 0.3rem;
    color: var(--brand);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.page-hero-title,
.page-title {
    font-size: 1.35rem;
    font-weight: 780;
    color: var(--text-main);
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.page-hero-desc,
.page-subtitle {
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.825rem;
    line-height: 1.5;
}

.page-hero-actions,
.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==========================================================================
   卡片与面板容器规范 (Cards & Panels - 对齐库存系统)
   ========================================================================== */

.card,
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--theme-shadow);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-pad {
    padding: 1.25rem 1.4rem;
}

.card-header,
.panel-head {
    padding: 1rem 1.35rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--bg-surface);
}

.card-title,
.card-header h2,
.panel-head h2 {
    font-size: 15px;
    font-weight: 750;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.card-subtitle,
.panel-head p {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.card-body {
    padding: 1.25rem 1.4rem;
}

.card-footer {
    padding: 0.85rem 1.35rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================================
   核心指标分栏概览带 (Settlement Overview Strip - 对齐库存管理系统)
   ========================================================================== */

.settlement-overview-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    margin-top: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}

.settlement-overview-cell {
    min-width: 0;
    padding: 10px 14px;
    border-right: 1px solid var(--border-color);
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: background 0.12s ease;
}

.settlement-overview-cell:last-child {
    border-right: 0;
}

.settlement-overview-cell .cell-label {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settlement-overview-cell .cell-value {
    display: block;
    margin-top: 3px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
}

/* 核心结算分账结果高亮强调列 */
.settlement-overview-cell.cell-highlight {
    background: linear-gradient(135deg, #fffbfb 0%, #fff4f2 100%);
}

.settlement-overview-cell.cell-highlight .cell-label {
    color: var(--brand-dark);
    font-weight: 750;
}

.settlement-overview-cell.cell-highlight .cell-value {
    color: var(--brand);
    font-size: 16px;
    font-weight: 800;
}

/* ==========================================================================
   高级门禁预警卡片 (Gate & Warn Alert Cards - 彻底摆脱刺眼大色块)
   ========================================================================== */

.gate-alert-card {
    background: #ffffff;
    border: 1px solid #fecdca;
    border-left: 4px solid var(--brand);
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 14px;
    box-shadow: 0 2px 6px rgba(217, 45, 32, 0.04);
}

.gate-alert-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.gate-alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 750;
    color: #912018;
}

.gate-alert-tag {
    font-size: 11px;
    font-weight: 700;
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
    padding: 2px 8px;
    border-radius: 999px;
}

.gate-alert-desc {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.gate-alert-list {
    display: flex;
    flex-direction: column;
}

.gate-alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-top: 1px dashed rgba(217, 45, 32, 0.2);
}

.gate-alert-item strong {
    color: #912018;
    font-size: 13px;
    font-weight: 650;
}

.gate-alert-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-dark);
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.gate-alert-btn:hover {
    background: #fee4e2;
    color: #7a1811;
    border-color: #fda29b;
}

.warn-alert-card {
    background: #ffffff;
    border: 1px solid #fedf89;
    border-left: 4px solid var(--amber);
    border-radius: 10px;
    padding: 12px 18px;
    margin-top: 12px;
    box-shadow: 0 2px 6px rgba(220, 104, 3, 0.04);
}

.warn-alert-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 750;
    color: #7a2e0e;
    margin-bottom: 4px;
}

.warn-alert-item {
    color: #92400e;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 3px;
}

/* ==========================================================================
   统计指标卡片规范 (Stat Grid & Cards - 8格网格与独立指标)
   ========================================================================== */

.stat-grid,
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}

.stat-card,
.dashboard-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 104px;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stat-label,
.dashboard-stat-label {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-muted);
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
}

.stat-value,
.dashboard-stat-value {
    font-size: 1.55rem;
    font-weight: 780;
    color: var(--text-main);
    margin: 6px 0 2px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: -0.02em;
}

.stat-hint,
.dashboard-stat-foot {
    font-size: 11px;
    color: var(--text-light);
}

/* 主指标卡片 (Primary Hero Card) */
.stat-card.stat-primary,
.metric-card-primary {
    border-color: rgba(220, 38, 38, 0.28);
    background: linear-gradient(135deg, #ffffff 0%, #fff6f6 100%);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.07);
}

.stat-card.stat-primary .stat-value,
.metric-card-primary .stat-value {
    color: var(--brand);
}

.stat-card.stat-warning {
    border-color: #fedf89;
    background: linear-gradient(180deg, #ffffff 0%, #fffdf5 100%);
}
.stat-card.stat-warning .stat-value {
    color: var(--color-warning);
}

.stat-card.stat-danger {
    border-color: #fecdca;
    background: linear-gradient(180deg, #ffffff 0%, #fff8f7 100%);
}
.stat-card.stat-danger .stat-value {
    color: var(--color-danger);
}

.stat-card.stat-success {
    border-color: #a6f4c5;
    background: linear-gradient(180deg, #ffffff 0%, #f6fdf9 100%);
}
.stat-card.stat-success .stat-value {
    color: var(--color-success);
}

/* ==========================================================================
   按钮系统规范 (Buttons - 对齐库存管理系统)
   ========================================================================== */

.btn,
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-xs);
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(0.99);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    border-color: var(--brand);
    box-shadow: 0 1px 3px rgba(217, 45, 32, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-darker) 100%);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-secondary {
    background: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

.btn-danger {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.btn-danger:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border-color: var(--brand);
    color: var(--brand);
}

.btn-outline:hover {
    background: var(--brand-soft);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-regular);
    box-shadow: none;
}

.btn-ghost:hover {
    background: #f3f4f6;
    color: var(--text-main);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 700;
}

/* ==========================================================================
   表单与筛选器规范 (Forms & Filter Cards)
   ========================================================================== */

.filter-bar,
.order-filter-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--theme-shadow);
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.grid-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 1fr) minmax(170px, 1fr) auto;
    gap: 14px;
    align-items: flex-end;
}

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

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-muted);
}

.form-control,
.form-select,
.form-input {
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus,
.form-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   数据表格规范 (Data Tables - 对齐库存管理系统)
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
    width: 100%;
    position: relative;
    border-top: 1px solid var(--border-color);
}

.data-table,
.product-table,
.order-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    text-align: left;
}

.data-table th,
.data-table td,
.product-table th,
.product-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th,
.product-table th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: background-color 0.12s ease;
    background-color: var(--bg-surface);
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

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

/* 粘性首列 (Sticky Column) */
.data-table th.table-sticky-col,
.data-table td.table-sticky-col {
    position: sticky;
    left: 0;
    z-index: 4;
    background-color: inherit;
    box-shadow: 3px 0 8px -2px rgba(15, 23, 42, 0.05);
}

.col-number {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: -0.01em;
}

.col-center {
    text-align: center !important;
}

.col-actions {
    text-align: right;
    white-space: nowrap;
}

.table-empty {
    padding: 48px 16px !important;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

/* ==========================================================================
   状态徽标与药丸 (Badges & Status Pills - 对齐库存系统)
   ========================================================================== */

.badge,
.status-pill,
.product-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-success, .status-pill.ready, .status-pill.success, .is-active {
    background: #ecfdf3;
    border-color: #a6f4c5;
    color: #067647;
}

.badge-warning, .status-pill.preview_ready, .status-pill.warning {
    background: #fef0c7;
    border-color: #fedf89;
    color: #b54708;
}

.badge-danger, .status-pill.blocked, .status-pill.danger, .is-warning {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.badge-info, .status-pill.info {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
}

.badge-violet, .status-pill.violet {
    background: #f9f5ff;
    border-color: #e9d7fe;
    color: #6938ef;
}

.badge-neutral, .status-pill.draft, .status-pill.neutral, .is-disabled {
    background: #f2f4f7;
    border-color: #eaecf0;
    color: #475467;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ==========================================================================
   提示横幅与预警卡片 (Alert Boxes)
   ========================================================================== */

.alert-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    box-shadow: var(--shadow-xs);
}

.alert-box.alert-danger {
    background: #fef3f2;
    border-color: #fecdca;
    color: #991b1b;
}

.alert-box.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-box.alert-info {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #1e40af;
}

.alert-box.alert-success {
    background: #ecfdf3;
    border-color: #a6f4c5;
    color: #065f46;
}

.alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}

.alert-title {
    font-weight: 750;
    font-size: 13px;
    margin-bottom: 3px;
}

.alert-content {
    font-size: 13px;
    line-height: 1.5;
}

.alert-content a {
    text-decoration: underline;
    font-weight: 600;
}

/* ==========================================================================
   通用工具类与微排版 (Utilities)
   ========================================================================== */

.text-danger { color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info { color: var(--color-info) !important; }
.text-muted { color: var(--text-muted) !important; }
.font-mono { font-family: "Segoe UI", "SF Mono", Consolas, monospace !important; }
.tabular-nums { font-variant-numeric: tabular-nums !important; font-feature-settings: "tnum" !important; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100% !important; }
.h-full { height: 100% !important; }
.whitespace-nowrap { white-space: nowrap !important; }
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
.text-xs { font-size: 11px !important; }
.text-sm { font-size: 13px !important; }
.text-base { font-size: 14px !important; }
.text-lg { font-size: 16px !important; }
.text-xl { font-size: 18px !important; }

/* 边框高亮指引 (与库存系统侧边彩条对齐) */
.border-l-brand { border-left: 4px solid var(--brand) !important; }
.border-l-warning { border-left: 4px solid var(--color-warning) !important; }
.border-l-success { border-left: 4px solid var(--color-success) !important; }
.border-l-danger { border-left: 4px solid var(--color-danger) !important; }

/* 门店级联选择器规范 */
.store-cascade-group,
.filter-store-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.store-cascade-group .form-group,
.filter-store-group .form-group {
    flex: 1;
    min-width: 120px;
}
.store-cascade-group .form-group-store,
.filter-store-group .form-group-store {
    flex: 2;
    min-width: 160px;
}

/* 常用响应式表单网格 */
.grid-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    align-items: flex-end;
}

.stat-grid-fluid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}

/* 通用空状态规范 */
.empty-state {
    text-align: center;
    padding: 42px 24px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 36px;
    margin-bottom: 10px;
    line-height: 1;
}
.empty-state-title {
    font-size: 15px;
    font-weight: 750;
    color: var(--text-main);
    margin-bottom: 4px;
}
.empty-state-desc {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 440px;
    margin: 0 auto 14px;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .app-shell {
        width: calc(100% - 20px);
    }
    .app-header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }
    .app-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .page-hero,
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }
    .stat-grid {
        grid-template-columns: 1fr;
    }
}
