:root {
    --sidebar-width: 220px;
    --topbar-height: 50px;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: #3b82f6;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    --bg-main: #f1f5f9;
    --bg-topbar: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-main);
    height: 100%;
}

.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h2 {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-nav {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-nav .nav-group-title {
    padding: 16px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 9px 20px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--text-sidebar-active);
    border-left-color: var(--bg-sidebar-active);
}

.nav-icon {
    margin-right: 10px;
    font-size: 10px;
    opacity: 0.6;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* 页面通用样式 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.data-table th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: #f8fafc;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    color: var(--text-primary);
    transition: all 0.15s;
    text-decoration: none;
}

.btn:hover {
    background: #f1f5f9;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-danger {
    color: #ef4444;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fef2f2;
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    transition: border-color 0.15s;
}

.form-control:focus {
    border-color: #3b82f6;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 20px;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination button {
    padding: 4px 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 标签 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

.badge-success {
    background: #dcfce7;
    color: #16a34a;
}

.badge-danger {
    background: #fef2f2;
    color: #ef4444;
}

.badge-warning {
    background: #fef9c3;
    color: #ca8a04;
}

.badge-info {
    background: #dbeafe;
    color: #2563eb;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-bar .form-control {
    width: auto;
    min-width: 180px;
}

/* 错误提示 */
#blazor-error-ui {
    background: #fef3c7;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 10px 20px;
    position: fixed;
    width: 100%;
    z-index: 1000;
    text-align: center;
    font-size: 13px;
}

#blazor-error-ui .reload {
    color: #2563eb;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 12px;
    color: #92400e;
}

/* 验证 */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

/* 弹窗遮罩 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 弹窗主体 */
.modal-dialog {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    width: 400px;
    max-width: 90vw;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Toast 提示 */
.toast {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 12px;
}

.toast.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.toast.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* 二维码弹窗 */
.qr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: qrOverlayIn 0.2s ease-out;
}

@keyframes qrOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.qr-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    width: 360px;
    max-width: 90vw;
    overflow: hidden;
    animation: qrFadeIn 0.25s ease-out;
    position: relative;
}

@keyframes qrFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.qr-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    position: relative;
}

.qr-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    flex: 1;
    text-align: center;
}

.qr-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.qr-close:hover {
    color: #334155;
    background: rgba(0, 0, 0, 0.05);
}

.qr-modal-body {
    padding: 32px 24px 28px;
    text-align: center;
}

.qr-merchant-name {
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 24px;
}

.qr-code-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #fff;
    border: 2px solid #e8ecf1;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.qr-code-box canvas,
.qr-code-box img {
    display: block;
    width: 200px !important;
    height: 200px !important;
}

.qr-merchant-code {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    background: #f1f5f9;
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
}

.qr-hint {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 4px;
}

/* 操作按钮组 */
.btn-group-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-qr {
    background: #FF6B35;
    color: #fff;
    border-color: #FF6B35;
}

.btn-qr:hover {
    background: #e85d2c;
    border-color: #e85d2c;
}
