/* ===== 基础变量与重置 ===== */
/* 主题严格还原 HTML 参考页面（customer.html / home.html 等） */
:root {
    /* 参考页面主题色 */
    --primary: #1a237e;
    --primary-light: #283593;
    --border: #e0e0e0;
    --surface: #ffffff;
    --surface-muted: #f5f7fa;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-tertiary: #999;
    --accent: #1976d2;
    --positive: #2e7d32;
    --warning: #ed6c02;
    --danger: #d32f2f;

    /* 兼容别名（沿用现有视图引用） */
    --primary-dark: #283593;
    --text: #1a1a1a;
    --text-muted: #666;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06);

    /* 布局尺寸（还原参考页面主框架） */
    --sidebar-w: 220px;
    --topbar-h: 56px;

    /* 主题化语义变量（各主题均需完整定义） */
    --on-primary: #ffffff;
    --on-primary-muted: rgba(255, 255, 255, .9);
    --hover-bg: rgba(0, 0, 0, .04);
    --input-bg: #ffffff;
    --input-border: #d5d9e0;
    --header-bg: #f5f7fa;
    --row-hover: rgba(0, 0, 0, .025);
    --sidebar-text: #b3b8d0;
    --shadow-2: 0 8px 40px rgba(0, 0, 0, .08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 13px;
    margin: 0;
}

/* 已登录时应用全屏，body 不滚动（内容区内部滚动） */
body:has(.app) {
    height: 100vh;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== 顶部导航 ===== */
.topbar {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
}

.brand-icon {
    font-size: 22px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.main-nav a {
    color: rgba(255, 255, 255, .9);
    text-decoration: none;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}

.main-nav a:hover {
    color: #fff;
    border-bottom-color: #fff;
}

.nav-user {
    color: rgba(255, 255, 255, .9);
    white-space: nowrap;
}

.logout-form {
    display: inline;
}

.btn-link {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .9);
    font-size: 14px;
    cursor: pointer;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
    transition: color .2s;
}

.btn-link:hover {
    color: #fff;
    border-bottom-color: #fff;
}

/* ===== 移动端菜单按钮 ===== */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

/* ===== 主内容 ===== */
.main-content {
    flex: 1;
    padding-top: 24px;
    padding-bottom: 40px;
}

/* ===== 登录页（严格还原参考页 login.html 左右分栏布局） ===== */
.login-wrapper {
    display: flex;
    width: 900px;
    max-width: 96vw;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .08);
    overflow: hidden;
    margin: 0 auto;
}

/* 左侧品牌区 */
.login-brand {
    width: 380px;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}

.login-brand::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
}

.brand-top {
    position: relative;
    z-index: 1;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-logo-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, .15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.brand-logo-text {
    font-size: 20px;
    font-weight: 600;
}

.brand-slogan {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
}

.brand-desc {
    font-size: 14px;
    opacity: .75;
    line-height: 1.8;
}

.brand-bottom {
    position: relative;
    z-index: 1;
    font-size: 12px;
    opacity: .5;
}

/* 右侧表单区 */
.login-form-area {
    flex: 1;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-header {
    margin-bottom: 28px;
}

.form-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-left: 40px !important;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
}

.input-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.input-eye:hover {
    color: var(--text-secondary);
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-wrap input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.forgot-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.forgot-link:hover {
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-login:hover {
    background: var(--primary-light);
}

.btn-login:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ===== 表单通用（登录页用） ===== */
.login-form-area .form-group {
    margin-bottom: 18px;
}

.login-form-area .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-form-area .form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color .2s, box-shadow .2s;
}

.login-form-area .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, .08);
}

.login-form-area .form-group input::placeholder {
    color: #bbb;
}

.login-form-area .form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.login-form-area .field-validation {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.login-form-area .alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.login-form-area .alert-error ul {
    padding-left: 18px;
    margin: 0;
}

/* 登录页响应式 */
@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
        width: 100%;
        max-width: 420px;
        margin: 16px auto;
    }
    .login-brand {
        width: 100%;
        padding: 32px 24px;
        min-height: 200px;
    }
    .login-form-area {
        padding: 32px 24px;
    }
}

/* ===== 表单组件 ===== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, .08);
}

.form-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.form-check input {
    width: 16px;
    height: 16px;
}

.field-validation {
    color: var(--danger);
    font-size: 13px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s, opacity .2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--surface-muted);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #eceff1;
}

.btn-block {
    width: 100%;
}

/* ===== 提示框 ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
}

.alert-error ul {
    padding-left: 18px;
}

/* ===== 首页卡片 ===== */
.welcome {
    margin-bottom: 24px;
}

.welcome h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

.muted {
    color: var(--text-muted);
    font-size: 14px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 12px;
}

a.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.card p {
    color: var(--text-muted);
    font-size: 13px;
}

.info-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-panel h2,
.info-panel h3 {
    margin-bottom: 10px;
}

.info-panel p {
    margin-bottom: 8px;
}

/* ===== 页脚 ===== */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== 应用外壳：侧边栏 + 主区（严格还原参考页 index.html） ===== */
.app {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* 兼容旧类名 */
.app-shell {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width .25s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed, 64px);
}

.sidebar-logo {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.sidebar-logo .logo-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-logo .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.menu-group {
    margin-bottom: 4px;
}

.menu-group + .menu-group {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 6px;
}

.menu-group-title {
    padding: 8px 20px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity .2s;
}

.sidebar.collapsed .menu-group-title {
    opacity: 0;
    padding: 4px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 16px;
    margin: 2px 8px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    white-space: nowrap;
    position: relative;
    transition: all .15s;
    text-decoration: none;
}

.menu-item:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

.menu-item.active {
    background: rgba(26, 35, 126, .06);
    color: var(--primary);
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.menu-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-text {
    font-size: 13px;
    opacity: 1;
    transition: opacity .2s;
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* 二级子分组切换器 */
.menu-arrow {
    margin-left: auto;
    font-size: 11px;
    opacity: .5;
    transition: transform .2s;
}

.menu-item.expanded .menu-arrow {
    transform: rotate(90deg);
}

.sidebar.collapsed .menu-arrow {
    display: none;
}

/* 子菜单（折叠/展开） */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    padding-left: 20px;
}

.submenu.open {
    max-height: 500px;
}

.menu-item.subgroup-toggle {
    font-weight: 600;
    color: var(--text-primary);
}

.menu-item.subgroup-toggle:hover {
    background: var(--surface-muted);
}

.submenu .menu-item {
    padding: 8px 16px;
    margin: 1px 8px 1px 16px;
    font-size: 12px;
}

.submenu .menu-item::before {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    white-space: nowrap;
    transition: opacity .2s;
}

.sidebar.collapsed .sidebar-footer {
    opacity: 0;
}

/* 主区域 */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* 顶部栏 */
.topbar {
    height: var(--topbar-h);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, .2);
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 门店切换器（含下拉） */
.topbar-store-switcher {
    position: relative;
    max-width: 180px;
}
.store-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .15s;
}
.store-switcher-btn:hover {
    background: rgba(255, 255, 255, .22);
}
.store-switcher-arrow {
    font-size: 9px;
    margin-left: 2px;
    opacity: .7;
}
.store-dropdown {
    position: absolute;
    top: 42px;
    left: 0;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
    z-index: 2000;
    padding: 6px 0;
}
.store-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background .12s;
}
.store-dropdown-item:hover {
    background: var(--surface-muted);
}
.store-dropdown-item.active {
    background: rgba(26,35,126,.06);
    color: var(--primary);
    font-weight: 600;
}
.store-check {
    color: var(--primary);
    font-size: 13px;
}

/* 顶部搜索 */
.topbar-search {
    position: relative;
}

.topbar-search input {
    width: 240px;
    padding: 7px 12px 7px 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    transition: all .2s;
}

.topbar-search input::placeholder {
    color: rgba(255, 255, 255, .5);
}

.topbar-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, .2);
    width: 300px;
}

.topbar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, .5);
    font-size: 13px;
}

/* 图标按钮 */
.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    transition: background .15s;
    font-family: inherit;
}

.topbar-icon-btn:hover {
    background: rgba(255, 255, 255, .18);
}

.badge-num {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    font-weight: 600;
}

/* 用户下拉 */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    position: relative;
    transition: background .15s;
}

.user-dropdown:hover {
    background: rgba(255, 255, 255, .1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.user-info {
    line-height: 1.3;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.user-role {
    font-size: 11px;
    opacity: .7;
    color: #fff;
}

.user-panel {
    position: absolute;
    top: 44px;
    right: 0;
    width: 200px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
    border: 1px solid var(--border);
    display: none;
    overflow: hidden;
    z-index: 100;
}

.user-panel.show {
    display: block;
}

.user-panel-item {
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    background: var(--surface);
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    text-decoration: none;
}

.user-panel-item:hover {
    background: var(--surface-muted);
}

.user-panel-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.user-panel-logout {
    display: block;
    margin: 0;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--bg);
}

.main-content-login {
    padding: 0 !important;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
}

/* ===== 多页签 tabbar（严格还原参考页 index.html） ===== */
.tabbar {
    height: 40px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    position: relative;
}

.tabbar::-webkit-scrollbar {
    height: 3px;
}

.tabbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.tabbar-scroll {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
}

.tab {
    padding: 0 16px;
    border-right: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    transition: all .15s;
    flex-shrink: 0;
    user-select: none;
}

.tab:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

.tab.active {
    background: var(--surface-muted);
    color: var(--primary);
    font-weight: 500;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab .tab-text {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    font-size: 14px;
    opacity: .35;
    line-height: 1;
    transition: opacity .15s, color .15s;
}

.tab-close:hover {
    opacity: 1;
    color: var(--danger);
}

.tab-placeholder {
    flex: 1;
    flex-shrink: 0;
    min-width: 0;
}

/* ===== iframe 内容区 ===== */
.content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

.iframe-wrap {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.iframe-wrap.active {
    display: block;
}

.iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg);
}

.iframe-wrap.loading iframe {
    opacity: 0;
}

.loading-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 14px;
    z-index: 5;
}

.iframe-wrap:not(.loading) .loading-mask {
    display: none;
}

/* ===== 右键菜单 ===== */
.ctx-menu {
    position: fixed;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
    border: 1px solid var(--border);
    padding: 6px 0;
    min-width: 160px;
    display: none;
    z-index: 1000;
    font-size: 13px;
}

.ctx-menu.show {
    display: block;
}

.ctx-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background .15s;
}

.ctx-item:hover {
    background: var(--surface-muted);
}

.ctx-item.danger {
    color: var(--danger);
}

.ctx-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    /* 提示要压过所有弹窗与遮罩（sku-overlay 3000 / alert-overlay 4000 / confirm-overlay 5000），
       否则弹窗打开时校验提示会被挡住 */
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
    animation: toastIn .2s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== iframe 内精简布局页面样式 ===== */
.tab-page {
    background: var(--bg);
    margin: 0;
}

.tab-content-area {
    padding: 16px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* ===== KPI 统计卡片 ===== */
.stat-card {
    text-align: center;
    padding: 22px 16px;
}

.stat-icon {
    font-size: 30px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

/* ===== 响应式（移动端，还原参考页 index.html） ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 100;
        transform: translateX(-100%);
        height: 100vh;
        transition: transform .25s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        width: var(--sidebar-w);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .topbar-search input {
        width: 140px;
    }

    .topbar-search input:focus {
        width: 180px;
    }

    .user-info {
        display: none;
    }

    .topbar-store-switcher {
        max-width: 110px;
    }
    .store-switcher-btn {
        max-width: 110px;
    }

    .main-content {
        padding: 12px;
    }
}

/* ===== P2 基础主数据：侧边栏分组 ===== */
.nav-group {
    padding: 14px 14px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ===== P2 页面头（还原参考页 topbar） ===== */
.page-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    max-width: 1400px;
}

.page-topbar h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

.topbar-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-icon {
    font-size: 20px;
    line-height: 1;
}

/* ===== 门店管理页面头（还原参考页 store_manage.html page-header） ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== P2 页面头 + 过滤条 ===== */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.page-head h2 {
    font-size: 20px;
    margin: 0;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    width: auto;
    min-width: 160px;
}

/* ===== P2 表格卡片 ===== */
.table-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--surface-muted);
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

.col-actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 32px !important;
}

.cell-truncate {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 客户/商品单元格 ===== */
.customer-cell, .product-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.customer-avatar {
    width: 34px;
    height: 34px;
    background: #e8eaf6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.product-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.product-img {
    width: 48px;
    height: 48px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.product-spec {
    font-size: 12px;
    color: var(--text-tertiary);
}

.customer-name {
    font-weight: 600;
}

.customer-id {
    font-size: 11px;
    color: var(--text-muted);
}

.amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-disabled { background: #f5f5f5; color: var(--text-secondary); }
.badge-vip { background: #fff3e0; color: #e65100; }
.badge-gold { background: #fff3e0; color: #b45309; }
.badge-normal { background: #f5f5f5; color: var(--text-secondary); }
.badge-tag { background: #e3f2fd; color: var(--accent); margin-right: 4px; }
.badge-cat { background: #e8f5e9; color: #2e7d32; }
.badge-frame { background: #e3f2fd; color: var(--accent); }
.badge-lens { background: #f3e5f5; color: #7b1fa2; }
.badge-contact { background: #e8f5e9; color: var(--positive); }
.badge-acc { background: #fff3e0; color: var(--warning); }
.badge-accessory { background: #fff3e0; color: var(--warning); }
.badge-sunglasses { background: #ede7f6; color: #4527a0; }
.badge-reading { background: #fff8e1; color: #b45309; }
.badge-other { background: #eceff1; color: #546e7a; }
.badge-prescription { background: #e3f2fd; color: #1565c0; }
.badge-plain { background: #f5f5f5; color: var(--text-secondary); }
.badge-draft { background: #fff3e0; color: #ed6c02; }
.badge-submitted { background: #e8f5e9; color: #2e7d32; }

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 内联表单（删除按钮） ===== */
.inline-form {
    display: inline;
}

/* ===== 表单面板 ===== */
.form-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    max-width: 720px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

/* 弹窗全屏模式 */
.modal-box.fullscreen {
    max-width: none;
    max-height: none;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover { opacity: .88; }

.btn-success {
    background: var(--positive);
    color: #fff;
}

.btn-success:hover { opacity: .88; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-create {
    padding: 7px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    font-family: inherit;
}
.btn-create:hover { filter: brightness(.92); }

.btn-cancel {
    padding: 7px 18px;
    background: #f0f0f0;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.btn-cancel:hover { background: #e0e0e0; }

.btn-save {
    padding: 7px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.btn-save:hover { filter: brightness(.92); }

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* ===== 会员等级颜色圆点 ===== */
.color-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.1);
    vertical-align: middle;
}

/* ===== 商品分类子分类缩进 ===== */
.child-indent {
    padding-left: 18px;
    position: relative;
}

.child-indent::before {
    content: "└ ";
    color: var(--text-muted);
    position: absolute;
    left: 0;
}

/* ===== 客户管理：左右分栏布局（还原参考页 main-layout） ===== */
.main-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    max-width: 1400px;
    align-items: start;
}

.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.content-area {
    min-width: 0;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chip {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    transition: all .15s;
    text-decoration: none;
    display: inline-block;
}

.tag-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tag-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-group-row {
    display: flex;
    gap: 8px;
}

.filter-group-row input,
.filter-group-row select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}

.side-panel .card {
    padding: 0;
}

.side-panel .card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.rule-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.rule-item:last-child {
    border-bottom: none;
}

.rule-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}

.rule-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 表格内操作按钮 hover 显示（还原参考页） */
.actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity .2s;
}

tr:hover .actions {
    opacity: 1;
}

/* 分页按钮 active */
.pagination .btn-sm.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 客户筛选面板的 form 元素 */
.filter-panel .filter-group {
    margin-bottom: 14px;
}

.filter-panel .filter-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.filter-panel input,
.filter-panel select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.filter-panel .card {
    padding: 16px;
}

/* 客户管理响应式 */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .filter-panel {
        display: none;
    }
}

/* ===== 响应式调整 ===== */
@media (max-width: 720px) {
    .form-row { grid-template-columns: 1fr; }
    .filter-bar .form-control { width: 100%; }
    .table-card { overflow-x: auto; }
}

/* ===== 工作台（还原参考页面 home.html） ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-sep {
    opacity: .4;
}

.welcome-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.welcome-text h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-text p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.welcome-date {
    font-size: 13px;
    color: var(--text-tertiary);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.quick-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    cursor: pointer;
    transition: all .2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
}

.quick-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    border-color: var(--border);
}

.quick-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.quick-icon.blue { background: #e3f2fd; }
.quick-icon.green { background: #e8f5e9; }
.quick-icon.orange { background: #fff3e0; }
.quick-icon.purple { background: #f3e5f5; }

.quick-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.quick-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.kpi-mini {
    background: var(--surface-muted);
    border-radius: 8px;
    padding: 10px;
}

.kpi-mini-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-mini-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.kpi-mini-change {
    font-size: 11px;
    margin-top: 4px;
}

.kpi-mini-change.up { color: var(--positive); }
.kpi-mini-change.down { color: var(--danger); }

/* 待办事项（还原参考页 home.html） */
.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.todo-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.todo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.todo-dot.urgent { background: var(--danger); }
.todo-dot.warning { background: var(--warning); }
.todo-dot.info { background: var(--accent); }

.todo-content { flex: 1; }

.todo-title {
    font-size: 13px;
    font-weight: 500;
}

.todo-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.todo-action {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all .15s;
    font-family: inherit;
}

.todo-action:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 快捷入口网格（还原参考页 home.html module-grid 6列） */
.module-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.module-item {
    background: var(--surface);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
}

.module-item:hover {
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    transform: translateY(-2px);
}

.module-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 auto 6px;
}

.module-name {
    font-size: 12px;
    font-weight: 500;
}

/* ===== 工作台响应式 ===== */
@media (max-width: 1100px) {
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .dashboard-row { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .quick-actions { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: repeat(3, 1fr); }
    .welcome-bar { flex-direction: column; align-items: flex-start; }
}

/* ===== 客户管理：弹窗基础（对齐参考页 customer.html） ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
    animation: modalIn .25s ease;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
}

.modal-close:hover { background: var(--surface-muted); }

.modal-box > form {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

/* 表单组 */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    background: var(--input-bg);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--primary); }

/* 复选框/单选框不受通用输入框拉伸影响，与文字紧凑对齐 */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    padding: 0;
    margin: 0;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--primary);
}
.form-group input[type="radio"] { border-radius: 50%; }

/* 弹窗内表单行：1fr 1fr（对齐参考页） */
.modal-box .form-row {
    grid-template-columns: 1fr 1fr;
}

/* ===== 客户详情弹窗 ===== */
/* 加宽版弹窗：内容含表格/选项卡，需要更大可视区域 */
.detail-box-lg {
    max-width: 1100px;
    width: 94%;
}

.detail-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7ff, #fff);
    border-bottom: 1px solid var(--border);
}

.detail-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e8eaf6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.detail-info { flex: 1; min-width: 0; }

.detail-name { font-size: 18px; font-weight: 700; }

.detail-phone {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0 8px;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.detail-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.detail-meta .m {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
}

.detail-meta .m .v {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.detail-meta .m .k { font-size: 11px; color: var(--text-muted); }

.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    background: var(--surface);
}

.detail-tab {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.detail-panel { padding: 16px 20px 20px; min-height: 160px; }

/* 视力档案卡片 */
.rx-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.rx-card .rx-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.rx-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    font-size: 12px;
}

.rx-grid .rx-item {
    background: var(--surface-muted);
    border-radius: 6px;
    padding: 6px 8px;
}

.rx-grid .rx-item b { display: block; font-size: 13px; color: var(--text-primary); }
.rx-grid .rx-item span { color: var(--text-muted); font-size: 11px; }

/* 迷你表格（订单/预约） */
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }

.mini-table th {
    background: var(--surface-muted);
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.mini-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
.mini-table tr:last-child td { border-bottom: none; }

/* 家属关联 */
.rel-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.rel-card .rel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e3f2fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.rel-card .rel-name { font-weight: 600; font-size: 13px; }
.rel-card .rel-relation { font-size: 12px; color: var(--text-muted); }

.empty-tip {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
    font-size: 13px;
}

/* ===== 充值弹窗 ===== */
.recharge-box { max-width: 460px; }

.balance-display {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.balance-label { font-size: 12px; opacity: .85; }
.balance-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

.recharge-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.recharge-option {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    background: var(--surface);
}

.recharge-option:hover { border-color: var(--primary); }
.recharge-option.active { border-color: var(--primary); background: #eef0ff; }
.recharge-option .amt { font-weight: 700; font-size: 14px; color: var(--primary); }
.recharge-option .gift { font-size: 11px; color: var(--warning); margin-top: 2px; }
.recharge-option .gift.empty { color: var(--text-muted); }

/* ===== toast 提示 ===== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #323232;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s;
    /* 与上方 .toast 保持一致：提示永远在最上层 */
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #2e7d32; }
.toast.error { background: var(--danger); }
/* 兼容旧类名（err 与 error 等价，ok 与 success 等价） */
.toast.err { background: #c62828; }
.toast.ok { background: #2e7d32; }

/* 通用搜索框 */
.search-box input {
    width: 220px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
}

/* 通用按钮禁用态 */
button:disabled, .btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
 * 多皮肤主题系统
 * 默认主题为 :root 现行值；以下主题仅覆盖变量值，选择器零改动。
 * 切换机制见 js/theme.js（<html data-theme> + localStorage + storage 事件同步）。
 * ============================================================ */

/* ---- 深色主题 · 暗夜 ---- */
:root[data-theme="dark"] {
    --primary: #111827;
    --primary-light: #1f2937;
    --primary-dark: #1f2937;
    --border: #2d3748;
    --surface: #1a2332;
    --surface-muted: #222d3d;
    --text-primary: #e6edf3;
    --text-secondary: #9aa7b4;
    --text-tertiary: #6b7a8a;
    --accent: #4c9aff;
    --positive: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --text: #e6edf3;
    --text-muted: #9aa7b4;
    --bg: #0b1120;
    --card-bg: #1a2332;
    --on-primary: #ffffff;
    --on-primary-muted: rgba(255, 255, 255, .85);
    --hover-bg: rgba(255, 255, 255, .06);
    --input-bg: #0f1626;
    --input-border: #37455a;
    --header-bg: #222d3d;
    --row-hover: rgba(255, 255, 255, .03);
    --sidebar-text: #9aa7b4;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-2: 0 8px 40px rgba(0, 0, 0, .5);
}

/* ---- 暖色主题 · 护眼 ---- */
:root[data-theme="warm"] {
    --primary: #8d6e63;
    --primary-light: #a1887f;
    --primary-dark: #a1887f;
    --border: #e8ddd2;
    --surface: #fffdf9;
    --surface-muted: #faf3ec;
    --text-primary: #3e3a34;
    --text-secondary: #7a7168;
    --text-tertiary: #a89f94;
    --accent: #b07d5f;
    --positive: #7a8450;
    --warning: #c98a2d;
    --danger: #c0564c;
    --text: #3e3a34;
    --text-muted: #7a7168;
    --bg: #f7f1ea;
    --card-bg: #fffdf9;
    --on-primary: #fff8f0;
    --on-primary-muted: rgba(255, 248, 240, .9);
    --hover-bg: rgba(141, 110, 99, .06);
    --input-bg: #fffdf9;
    --input-border: #dccfc2;
    --header-bg: #faf3ec;
    --row-hover: rgba(141, 110, 99, .04);
    --sidebar-text: #d5c5b8;
    --shadow-2: 0 8px 40px rgba(0, 0, 0, .12);
}

/* ---- 清新主题 · 海洋 ---- */
:root[data-theme="ocean"] {
    --primary: #0f6b7c;
    --primary-light: #14879c;
    --primary-dark: #14879c;
    --border: #d7e9ee;
    --surface: #ffffff;
    --surface-muted: #f2f9fb;
    --text-primary: #16353d;
    --text-secondary: #5b7a83;
    --text-tertiary: #8faab2;
    --accent: #0ea5b7;
    --positive: #2e8b8b;
    --warning: #e0a03c;
    --danger: #d06060;
    --text: #16353d;
    --text-muted: #5b7a83;
    --bg: #eef7f9;
    --card-bg: #ffffff;
    --on-primary: #f0fcff;
    --on-primary-muted: rgba(240, 252, 255, .9);
    --hover-bg: rgba(15, 107, 124, .06);
    --input-bg: #ffffff;
    --input-border: #c4dde4;
    --header-bg: #eaf4f7;
    --row-hover: rgba(15, 107, 124, .04);
    --sidebar-text: #a9d3dc;
    --shadow-2: 0 8px 40px rgba(0, 0, 0, .1);
}

/* ---- 主题切换面板 ---- */
.theme-switcher { position: relative; }

.theme-panel {
    position: absolute;
    right: 0;
    top: 46px;
    width: 176px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-2);
    padding: 6px;
    z-index: 2100;
    display: none;
}
.theme-panel.open { display: block; }
.theme-panel-title {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 6px 10px 4px;
}
.theme-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    user-select: none;
}
.theme-item:hover { background: var(--hover-bg); }
.theme-item.current { background: var(--hover-bg); font-weight: 600; }
.theme-item.current::after { content: '✓'; margin-left: auto; color: var(--primary); }
.theme-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    flex: none;
}

/* ---- 深色主题细节适配 ---- */
[data-theme="dark"] .recharge-option.active { background: rgba(255, 255, 255, .08); }
/* 状态徽章：浅色底替换为半透明白，避免突兀（排除顶栏角标 .badge-num） */
[data-theme="dark"] .badge-active,
[data-theme="dark"] .badge-vip,
[data-theme="dark"] .badge-gold,
[data-theme="dark"] .badge-tag,
[data-theme="dark"] .badge-cat,
[data-theme="dark"] .badge-frame,
[data-theme="dark"] .badge-lens,
[data-theme="dark"] .badge-contact,
[data-theme="dark"] .badge-acc,
[data-theme="dark"] .badge-accessory,
[data-theme="dark"] .badge-sunglasses,
[data-theme="dark"] .badge-reading,
[data-theme="dark"] .badge-prescription,
[data-theme="dark"] .badge-draft,
[data-theme="dark"] .badge-submitted { background: rgba(255, 255, 255, .08); color: var(--text-primary); }
[data-theme="dark"] .badge-disabled,
[data-theme="dark"] .badge-normal,
[data-theme="dark"] .badge-plain,
[data-theme="dark"] .badge-other { background: rgba(255, 255, 255, .05); color: var(--text-tertiary); }
/* 通用表单控件深色兜底 */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: var(--input-bg); color: var(--text-primary); }
[data-theme="dark"] .topbar-search input { background: rgba(255, 255, 255, .15); color: var(--on-primary); }

/* ===== AI 创作模块（内容创作）公共样式 ===== */
.ai-empty {
    grid-column: 1 / -1;
    padding: 32px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.ai-inline { display: flex; gap: 8px; align-items: center; }
/* 内联「文本框 + 按钮」组合：此前只给了 flex，输入框会退化成浏览器默认外观
   （直角灰边、无内边距），与站内 .form-control 不一致。这里补齐视觉。
   刻意保持低特异性（class + 元素），让 [data-theme="dark"] 的主题背景/文字色仍能生效。 */
.ai-inline input {
    flex: 1 1 auto; min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--input-bg);
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}
.ai-inline input:focus { outline: none; border-color: var(--primary); }
.ai-inline input::placeholder { color: var(--text-muted); }
.ai-inline .btn { flex: 0 0 auto; white-space: nowrap; }

/* 商品选择列表的样式已内聚到 aicreative-shared.js 的 ensureProductStyle()，
   这里不再保留旧版纵向列表规则，避免与新分栏布局互相覆盖 */

/* 应用到商品弹窗 */
.ai-apply-preview {
    margin-bottom: 14px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    text-align: center;
}
.ai-apply-preview img,
.ai-apply-preview video { max-width: 100%; max-height: 260px; display: block; margin: 0 auto; }
.ai-targets { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-target {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.ai-target:hover { border-color: var(--accent); }
.ai-target.active { border-color: var(--accent); color: var(--accent); background: rgba(64, 128, 255, .08); font-weight: 500; }
.ai-apply-tip { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
