/* ============================================
   苹果系统风格全局CSS - 响应式设计
   支持：电脑(≥1200px) / 平板(768-1199px) / 手机(<768px)
   ============================================ */

/* === 基础重置与字体 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --apple-bg: #f5f5f7;
    --apple-bg-secondary: #fafafa;
    --apple-surface: #ffffff;
    --apple-border: #e5e5ea;
    --apple-border-secondary: #d2d2d7;
    --apple-text: #1d1d1f;
    --apple-text-secondary: #6e6e73;
    --apple-text-tertiary: #86868b;
    --apple-blue: #0071e3;
    --apple-blue-hover: #0077ed;
    --apple-green: #30d158;
    --apple-red: #ff3b30;
    --apple-orange: #ff9500;
    --apple-yellow: #ffd60a;
    --apple-purple: #5e5ce6;
    --apple-pink: #ff2d55;
    --apple-teal: #64d2ff;
    --apple-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --apple-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --apple-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --apple-radius-sm: 8px;
    --apple-radius: 12px;
    --apple-radius-lg: 16px;
    --apple-radius-xl: 20px;
    --apple-sidebar-width: 260px;
    --apple-topbar-height: 56px;
    --apple-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html[dir="rtl"] {
    direction: rtl;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        sans-serif;
    background: var(--apple-bg);
    color: var(--apple-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

html[dir="rtl"] body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
    text-align: right;
}

a {
    color: var(--apple-blue);
    text-decoration: none;
    transition: var(--apple-transition);
}

a:hover {
    color: var(--apple-blue-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
    border: none;
    background: none;
}

/* === 滚动条样式 === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    transition: var(--apple-transition);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* === 按钮样式 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--apple-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--apple-transition);
    white-space: nowrap;
    user-select: none;
}

.btn-primary {
    background: var(--apple-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--apple-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    background: var(--apple-bg-secondary);
    border-color: var(--apple-border-secondary);
}

.btn-danger {
    background: var(--apple-red);
    color: #fff;
}

.btn-danger:hover {
    background: #d70015;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.35);
}

.btn-success {
    background: var(--apple-green);
    color: #fff;
}

.btn-success:hover {
    background: #1fbf45;
}

.btn-warning {
    background: var(--apple-orange);
    color: #fff;
}

.btn-warning:hover {
    background: #e18500;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* === 输入框样式 === */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--apple-surface);
    border: 1.5px solid var(--apple-border);
    border-radius: var(--apple-radius-sm);
    font-size: 14px;
    transition: var(--apple-transition);
    color: var(--apple-text);
}

.form-control::placeholder {
    color: var(--apple-text-tertiary);
}

.form-control:hover {
    border-color: var(--apple-border-secondary);
}

.form-control:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.form-row-4 {
    display: grid;
    /* auto-fit：隐藏任一子项（如站点视角锁定跳转路径）时，剩余项自动均分列宽，不留空轨道 */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}

html[dir="rtl"] select.form-control {
    background-position: left 12px center;
    padding-right: 14px;
    padding-left: 38px;
}

/* === 文件上传（简洁原生样式，参考第二张图） === */
/* 隐藏紧跟在 file-upload-wrap 后面的原生 file input */
.file-upload-wrap + input[type="file"] {
    display: none;
}

/* 隐藏在 file-upload-wrap 内部的原生 file input */
.file-upload-wrap input[type="file"] {
    display: none;
}

.file-upload-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.file-upload-btn {
    display: inline-block;
    padding: 6px 16px;
    background: #fff;
    border: 1px solid var(--apple-border);
    border-radius: 4px;
    color: var(--apple-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.file-upload-btn:hover {
    border-color: var(--apple-blue);
    color: var(--apple-blue);
}

.file-upload-filename {
    color: var(--apple-text-tertiary);
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 兼容旧的 upload-box（统一转为简洁样式） */
.upload-box {
    display: none;
}

.upload-preview {
    position: relative;
    display: inline-block;
    margin-top: 10px;
}

.upload-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--apple-border);
    display: block;
}

.upload-preview .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--apple-red);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    border: 2px solid #fff;
    z-index: 2;
}

/* === 多图上传列表 === */
.multi-upload-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}
.multi-upload-item {
    position: relative;
    width: 80px;
    height: 80px;
}
.multi-upload-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--apple-border);
    display: block;
}
.multi-upload-item .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--apple-red);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    border: 2px solid #fff;
    z-index: 2;
}

/* === 卡片样式 === */
.card {
    background: var(--apple-surface);
    border-radius: var(--apple-radius-lg);
    box-shadow: var(--apple-shadow-sm);
    overflow: hidden;
    transition: var(--apple-transition);
}

.card:hover {
    box-shadow: var(--apple-shadow);
}

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

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--apple-text);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--apple-border);
    background: var(--apple-bg-secondary);
}

/* === 布局 === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--apple-sidebar-width);
    background: var(--apple-surface);
    border-right: 1px solid var(--apple-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--apple-border);
}

.sidebar-logo {
    height: var(--apple-topbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid var(--apple-border);
    flex-shrink: 0;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--apple-blue), var(--apple-purple));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.sidebar-logo .logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--apple-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.menu-group {
    margin-bottom: 4px;
}

.menu-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--apple-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--apple-text);
    transition: var(--apple-transition);
    user-select: none;
}

.menu-group-title:hover {
    background: var(--apple-bg);
}

.menu-group-title .menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--apple-text-secondary);
    transition: var(--apple-transition);
}

.menu-group-title.active .menu-icon {
    color: var(--apple-blue);
}

.menu-group-title .menu-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-group-title .menu-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
    color: var(--apple-text-tertiary);
    flex-shrink: 0;
}

.menu-group.open .menu-group-title .menu-arrow {
    transform: rotate(90deg);
}

html[dir="rtl"] .menu-group.open .menu-group-title .menu-arrow {
    transform: rotate(-90deg);
}

.menu-group-title.active {
    background: rgba(0, 113, 227, 0.08);
    color: var(--apple-blue);
}

.menu-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-group.open .menu-children {
    max-height: 1000px;
}

.menu-children-inner {
    padding: 4px 0 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px 9px 42px;
    border-radius: var(--apple-radius-sm);
    font-size: 13px;
    color: var(--apple-text-secondary);
    cursor: pointer;
    transition: var(--apple-transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html[dir="rtl"] .menu-item {
    padding: 9px 42px 9px 12px;
}

.menu-item:hover {
    background: var(--apple-bg);
    color: var(--apple-text);
}

.menu-item.active {
    background: rgba(0, 113, 227, 0.1);
    color: var(--apple-blue);
    font-weight: 500;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    right: auto;
    left: 10px;
    width: 3px;
    height: 16px;
    background: var(--apple-blue);
    border-radius: 2px;
}

html[dir="rtl"] .menu-item.active::before {
    left: auto;
    right: 10px;
}

.menu-item {
    position: relative;
}

/* 主内容区 */
.main-wrapper {
    flex: 1;
    margin-left: var(--apple-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

html[dir="rtl"] .main-wrapper {
    margin-left: 0;
    margin-right: var(--apple-sidebar-width);
}

/* 顶部导航 */
.topbar {
    height: var(--apple-topbar-height);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--apple-border);
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

.topbar-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--apple-transition);
}

.topbar-menu-btn:hover {
    background: var(--apple-bg);
}

.topbar-menu-btn svg {
    width: 20px;
    height: 20px;
    color: var(--apple-text);
}

.topbar-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--apple-text-secondary);
}

.topbar-breadcrumb .current {
    color: var(--apple-text);
    font-weight: 500;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-switch {
    display: flex;
    align-items: center;
    padding: 5px 4px;
    background: var(--apple-bg);
    border-radius: 8px;
    gap: 2px;
}

.lang-switch a {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    color: var(--apple-text-secondary);
    font-weight: 500;
    transition: var(--apple-transition);
}

.lang-switch a.active {
    background: var(--apple-surface);
    color: var(--apple-blue);
    box-shadow: var(--apple-shadow-sm);
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: 100px;
    cursor: pointer;
    transition: var(--apple-transition);
}

html[dir="rtl"] .user-dropdown {
    padding: 4px 4px 4px 12px;
}

.user-dropdown:hover {
    background: var(--apple-bg);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--apple-blue), var(--apple-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-info .username {
    font-size: 13px;
    font-weight: 500;
    color: var(--apple-text);
}

.user-info .role {
    font-size: 11px;
    color: var(--apple-text-tertiary);
}

/* 内容区 */
.content-wrapper {
    flex: 1;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--apple-text);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

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

/* === 表格样式 === */
.table-wrapper {
    background: var(--apple-surface);
    border-radius: var(--apple-radius-lg);
    box-shadow: var(--apple-shadow-sm);
    overflow: hidden;
}

.table-toolbar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--apple-border);
}

.table-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    background: var(--apple-bg);
    padding: 3px;
    border-radius: 10px;
    gap: 2px;
}

.filter-tabs .tab {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--apple-text-secondary);
    transition: var(--apple-transition);
    white-space: nowrap;
}

.filter-tabs .tab:hover {
    color: var(--apple-text);
}

.filter-tabs .tab.active {
    background: var(--apple-surface);
    color: var(--apple-text);
    font-weight: 500;
    box-shadow: var(--apple-shadow-sm);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--apple-bg);
    border-radius: 10px;
    padding: 0 12px;
    min-width: 220px;
    transition: var(--apple-transition);
}

.search-box:focus-within {
    background: var(--apple-surface);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.search-box svg {
    width: 16px;
    height: 16px;
    color: var(--apple-text-tertiary);
    flex-shrink: 0;
}

.search-box input {
    padding: 9px 8px;
    width: 100%;
    font-size: 13px;
}

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

.data-table thead {
    background: var(--apple-bg-secondary);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--apple-text-secondary);
    letter-spacing: 0.2px;
    text-transform: none;
    white-space: nowrap;
    border-bottom: 1px solid var(--apple-border);
}

html[dir="rtl"] .data-table th {
    text-align: right;
}

.data-table td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--apple-text);
    border-bottom: 1px solid var(--apple-border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--apple-transition);
}

.data-table tbody tr:hover {
    background: var(--apple-bg-secondary);
}

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

html[dir="rtl"] .data-table td {
    text-align: right;
}

.table-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--apple-bg);
}

.table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--apple-blue), var(--apple-purple));
}

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

.badge-success {
    background: rgba(48, 209, 88, 0.15);
    color: var(--apple-green);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.15);
    color: var(--apple-red);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.15);
    color: var(--apple-orange);
}

.badge-info {
    background: rgba(0, 113, 227, 0.15);
    color: var(--apple-blue);
}

.badge-primary {
    background: rgba(0, 113, 227, 0.15);
    color: var(--apple-blue);
}

/* Radio inline */
.radio-inline {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid var(--apple-border);
    border-radius: 10px;
    transition: all 0.2s;
    user-select: none;
}
.radio-inline:hover {
    border-color: var(--apple-blue);
}
.radio-inline input[type="radio"] {
    margin-right: 6px;
    accent-color: var(--apple-blue);
}
.radio-inline input[type="radio"]:checked + span {
    color: var(--apple-blue);
    font-weight: 500;
}
.radio-inline:has(input:checked) {
    border-color: var(--apple-blue);
    background: rgba(0, 113, 227, 0.05);
}

.badge-secondary {
    background: var(--apple-bg);
    color: var(--apple-text-secondary);
}

.badge-purple {
    background: rgba(94, 92, 230, 0.15);
    color: var(--apple-purple);
}

/* 操作按钮组 */
.action-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    cursor: pointer;
    transition: var(--apple-transition);
    color: var(--apple-text-secondary);
    background: transparent;
    border: none;
    padding: 0;
}

.action-btn:hover {
    background: var(--apple-bg);
    color: var(--apple-text);
}

.action-btn.danger:hover {
    background: rgba(255, 59, 48, 0.1);
    color: var(--apple-red);
}

.action-btn.success:hover {
    background: rgba(48, 209, 88, 0.1);
    color: var(--apple-green);
}

.action-btn.primary:hover {
    background: rgba(0, 113, 227, 0.1);
    color: var(--apple-blue);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* ===== 取消申请审批按钮（通过✓/驳回✕）— 纯图标圆形，订单管理/派单中心统一 ===== */
.cancel-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    border: none; border-radius: 50%;
    color: #fff; cursor: pointer; flex-shrink: 0;
    font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.cancel-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.cancel-btn-approve {
    background: linear-gradient(135deg, #34C759, #28A745);
    box-shadow: 0 2px 10px rgba(52, 199, 89, .38);
}
.cancel-btn-reject {
    background: linear-gradient(135deg, #FF3B30, #E0332A);
    box-shadow: 0 2px 10px rgba(255, 59, 48, .38);
}
.cancel-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cancel-btn-approve:hover { box-shadow: 0 4px 14px rgba(52, 199, 89, .5); }
.cancel-btn-reject:hover { box-shadow: 0 4px 14px rgba(255, 59, 48, .5); }
.cancel-btn:active { transform: translateY(0) scale(.95); filter: brightness(.94); }

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--apple-border-secondary);
    transition: 0.3s;
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-slider {
    background-color: var(--apple-green);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(18px);
}

html[dir="rtl"] .switch input:checked + .switch-slider:before {
    transform: translateX(-18px);
}

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

.pagination-info {
    font-size: 13px;
    color: var(--apple-text-secondary);
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--apple-text-secondary);
    transition: var(--apple-transition);
    border: 1px solid transparent;
}

.page-btn:hover:not(:disabled) {
    background: var(--apple-bg);
    color: var(--apple-text);
}

.page-btn.active {
    background: var(--apple-blue);
    color: #fff;
}

.page-btn.active:hover {
    background: var(--apple-blue-hover);
}

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

/* === 弹窗（Modal） === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.modal-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease;
}

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

.modal-sm {
    max-width: 480px;
}

.modal-md {
    max-width: 640px;
}

.modal-lg {
    max-width: 860px;
}

.modal-xl {
    max-width: 1080px;
}

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

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

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--apple-transition);
    color: var(--apple-text-secondary);
}

.modal-close:hover {
    background: var(--apple-bg);
    color: var(--apple-text);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

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

/* 弹窗表单：form 夹在 container(flex column) 与 modal-body 之间时，
   必须让 form 也成为占满剩余高度的 flex 列容器，否则内容超高时
   modal-body 不滚动、modal-footer 被挤出 90vh 裁掉（保存按钮消失） */
.modal-container > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: #fff;
}

html[dir="rtl"] .modal-footer {
    justify-content: flex-start;
}

/* === 仪表盘统计卡片 === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--apple-surface);
    border-radius: var(--apple-radius-lg);
    padding: 24px;
    box-shadow: var(--apple-shadow-sm);
    transition: var(--apple-transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--apple-blue);
}

.stat-card:nth-child(2)::before { background: var(--apple-green); }
.stat-card:nth-child(3)::before { background: var(--apple-orange); }
.stat-card:nth-child(4)::before { background: var(--apple-purple); }
.stat-card:nth-child(5)::before { background: var(--apple-pink); }
.stat-card:nth-child(6)::before { background: var(--apple-teal); }

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

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--apple-text);
    letter-spacing: -1px;
    line-height: 1.1;
    margin-bottom: 10px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--apple-text-secondary);
}

.stat-trend.up { color: var(--apple-green); }
.stat-trend.down { color: var(--apple-red); }

.stat-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 113, 227, 0.1);
    color: var(--apple-blue);
}

.stat-card:nth-child(2) .stat-icon { background: rgba(48, 209, 88, 0.1); color: var(--apple-green); }
.stat-card:nth-child(3) .stat-icon { background: rgba(255, 149, 0, 0.1); color: var(--apple-orange); }
.stat-card:nth-child(4) .stat-icon { background: rgba(94, 92, 230, 0.1); color: var(--apple-purple); }
.stat-card:nth-child(5) .stat-icon { background: rgba(255, 45, 85, 0.1); color: var(--apple-pink); }
.stat-card:nth-child(6) .stat-icon { background: rgba(100, 210, 255, 0.1); color: var(--apple-teal); }

html[dir="rtl"] .stat-icon {
    right: auto;
    left: 20px;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

/* 图表卡片 */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chart-card {
    background: var(--apple-surface);
    border-radius: var(--apple-radius-lg);
    padding: 24px;
    box-shadow: var(--apple-shadow-sm);
}

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

.chart-container {
    width: 100%;
    height: 280px;
}

/* 侧边栏遮罩（移动端） */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    display: none;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

html[dir="rtl"] .toast-container {
    right: auto;
    left: 24px;
}

.toast {
    min-width: 280px;
    max-width: 400px;
    background: var(--apple-surface);
    padding: 14px 18px;
    border-radius: var(--apple-radius);
    box-shadow: var(--apple-shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastIn 0.3s ease;
}

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

.toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast.success .toast-icon { color: var(--apple-green); }
.toast.error .toast-icon { color: var(--apple-red); }
.toast.info .toast-icon { color: var(--apple-blue); }
.toast.warning .toast-icon { color: var(--apple-orange); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-content .toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--apple-text);
    margin-bottom: 2px;
}

.toast-content .toast-message {
    font-size: 13px;
    color: var(--apple-text-secondary);
}

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

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--apple-text-tertiary);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    color: var(--apple-text-secondary);
}

/* 设置区块（系统设置） */
.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--apple-text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--apple-border);
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--apple-blue);
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: -2px;
}

html[dir="rtl"] .section-title::before {
    margin-right: 0;
    margin-left: 10px;
}

/* 授权配置行 */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-radius: var(--apple-radius);
    background: var(--apple-bg-secondary);
    margin-bottom: 10px;
    transition: var(--apple-transition);
}

.auth-row:hover {
    background: var(--apple-bg);
}

.auth-row-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--apple-surface);
    box-shadow: var(--apple-shadow-sm);
    font-size: 18px;
}

.auth-row-info .auth-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--apple-text);
    margin-bottom: 2px;
}

.auth-row-info .auth-desc {
    font-size: 12px;
    color: var(--apple-text-tertiary);
}

/* ===== 响应式设计 ===== */

/* 平板 (768px - 1199px) */
@media screen and (max-width: 1199px) {
    :root {
        --apple-sidebar-width: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板以下 (≤991px) */
@media screen and (max-width: 991px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 手机 (<768px) */
@media screen and (max-width: 767px) {
    :root {
        --apple-sidebar-width: 80%;
        --apple-topbar-height: 52px;
    }

    .content-wrapper {
        padding: 16px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    html[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
    }

    html[dir="rtl"] .sidebar.mobile-open {
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
    }

    .main-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-menu-btn {
        display: flex;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .user-info {
        display: none;
    }

    .page-title {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        top: 14px;
        right: 14px;
    }

    .stat-icon svg {
        width: 18px;
        height: 18px;
    }

    .card {
        border-radius: var(--apple-radius);
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: 16px;
    }

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

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

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 0;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .pagination {
        flex-direction: column;
        align-items: center;
        padding: 12px 16px;
    }

    .modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: var(--apple-radius-lg);
        margin: 0;
        top: 50%;
    }

    .modal-header,
    .modal-footer {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    html[dir="rtl"] .toast-container {
        left: 12px;
        right: 12px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .card-title {
        font-size: 15px;
    }

    .section-title {
        font-size: 14px;
    }
}

/* 超小手机 (<480px) */
@media screen and (max-width: 479px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar-actions .lang-switch {
        display: none;
    }

    .auth-row {
        padding: 12px 14px;
    }

    .auth-row-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* ===================== 菜单角标：未处理/未读数量 ===================== */
.menu-badge {
    margin-left: auto;
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--apple-red, #ff3b30);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    border-radius: 9px;
    box-sizing: border-box;
}
/* 独立菜单标题里的角标与子菜单角标保持一致 */
.menu-group-title .menu-badge,
.menu-item .menu-badge {
    pointer-events: none;
}

/* ===================== 列表行待审数字标签（骑士资料/银行卡/微笑记录待审数） ===================== */
/* 骑士列表姓名列：待审资料项 + 银行卡待审；微笑管理列表：待审微笑记录数 */
.row-pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: #ff3b30;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    border-radius: 9px;
    box-sizing: border-box;
    vertical-align: middle;
    box-shadow: 0 1px 4px rgba(255,59,48,0.35);
    cursor: default;
}
/* 微笑管理列表里的待审标签同样红色（与骑士列表资料待审视觉统一） */
.row-pending-badge.smile {
    background: #ff3b30;
    box-shadow: 0 1px 4px rgba(255,59,48,0.35);
}

