/* ============================================================
   超市电子秤实时监控系统 - 全局样式
   设计风格：科技蓝 + 黑色背景 + 发光效果 + 动画
   ============================================================ */

/* === CSS 变量 === */
:root {
    --bg-primary: #050a1a;
    --bg-secondary: #0a1628;
    --bg-card: rgba(10, 25, 55, 0.85);
    --bg-card-hover: rgba(15, 35, 70, 0.95);
    --border-color: rgba(0, 180, 255, 0.12);
    --border-glow: rgba(0, 150, 255, 0.35);
    --text-primary: #e0e8ff;
    --text-secondary: #7a8bb5;
    --text-muted: #4a5a80;
    --accent-cyan: #00d4ff;
    --accent-blue: #0077ff;
    --accent-green: #00ff88;
    --accent-orange: #ff8c00;
    --accent-red: #ff3366;
    --accent-purple: #a855f7;
    --accent-yellow: #ffd700;
    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.25);
    --glow-blue: 0 0 15px rgba(0, 119, 255, 0.2);
    --glow-green: 0 0 12px rgba(0, 255, 136, 0.25);
    --glow-red: 0 0 12px rgba(255, 51, 102, 0.3);
    --glow-orange: 0 0 12px rgba(255, 140, 0, 0.3);
    --radius: 6px;
    --transition: all 0.3s ease;
    --font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* === 重置与基础 === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-cyan); text-decoration: none; transition: var(--transition); }
a:hover { color: #66e5ff; text-shadow: 0 0 8px rgba(0, 212, 255, 0.5); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: rgba(0, 180, 255, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 180, 255, 0.5); }

/* === 扫描线装饰动画 === */
.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    opacity: 0.4;
    z-index: 9999;
    animation: scanMove 4s linear infinite;
    pointer-events: none;
}

@keyframes scanMove {
    0% { top: 0; opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% { top: 100%; opacity: 0; }
}

/* === 通用动画 === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 212, 255, 0.2); }
    50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.4); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes rotateGlow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes numberPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ============================================================
   头部导航栏
   ============================================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 20px;
    background: linear-gradient(180deg, rgba(10, 22, 50, 0.98), rgba(5, 10, 26, 0.95));
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 20px rgba(0, 100, 255, 0.08);
    position: relative;
    z-index: 100;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    opacity: 0.5;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.5));
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #fff, var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.header-center {
    display: flex;
    align-items: center;
}

.datetime-display {
    display: flex;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-secondary);
}

.datetime-display .time {
    color: var(--accent-cyan);
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.total-weight-box {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius);
}

.tw-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.tw-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.5);
    min-width: 100px;
    text-align: right;
}

.tw-unit {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-header {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.btn-header:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-header-link {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    text-decoration: none;
}

.btn-header-link:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.admin-badge {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
}

.user-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   状态统计栏
   ============================================================ */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 8px 20px;
    background: rgba(10, 22, 45, 0.6);
    border-bottom: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.5s ease;
}

.stat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-online { background: var(--accent-green); box-shadow: var(--glow-green); }
.dot-offline { background: var(--text-muted); }
.dot-error { background: var(--accent-red); box-shadow: var(--glow-red); animation: blink 1.5s ease infinite; }
.dot-total { background: var(--accent-cyan); box-shadow: var(--glow-cyan); }
.dot-refresh { background: var(--accent-orange); transition: var(--transition); }
.dot-refresh.active { background: var(--accent-green); box-shadow: var(--glow-green); }

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-online .stat-value { color: var(--accent-green); }
.stat-offline .stat-value { color: var(--text-muted); }
.stat-error .stat-value { color: var(--accent-red); }
.stat-total .stat-value { color: var(--accent-cyan); }

/* ============================================================
   大屏主体布局
   ============================================================ */
.dashboard-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 100, 255, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(0, 200, 255, 0.03) 0%, transparent 50%),
        linear-gradient(180deg, #050a1a 0%, #0a1228 50%, #050a1a 100%);
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 8px;
    gap: 8px;
}

.side-panel {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.left-panel { animation: slideInLeft 0.6s ease; }
.right-panel { animation: slideInRight 0.6s ease; }

.center-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 4px;
}

/* === 面板卡片 === */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease;
}

.panel-card:hover {
    border-color: rgba(0, 180, 255, 0.25);
    box-shadow: var(--glow-blue);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 100, 255, 0.03);
}

.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-cyan);
    letter-spacing: 1px;
}

.panel-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.alert-badge {
    background: rgba(255, 51, 102, 0.15);
    color: var(--accent-red);
    border-color: rgba(255, 51, 102, 0.3);
}

/* === 图表容器 === */
.chart-box {
    flex: 1;
    min-height: 180px;
    padding: 8px;
}

.chart-box-wide {
    flex: 1;
    min-height: 160px;
    padding: 8px;
}

/* ============================================================
   电子秤卡片网格
   ============================================================ */
.scales-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 4px 0;
}

.scale-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease both;
}

.scale-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.scale-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: var(--glow-cyan);
    transform: translateY(-2px);
}

.scale-card:hover::before {
    opacity: 1;
}

.scale-card.status-offline {
    opacity: 0.6;
    border-color: rgba(100, 100, 120, 0.2);
}

.scale-card.status-error {
    border-color: rgba(255, 51, 102, 0.3);
    animation: fadeIn 0.4s ease both, glow 2s ease infinite;
}

.scale-card.status-error::before {
    background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
    opacity: 1;
}

.scale-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.scale-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85%;
}

.scale-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.scale-status-dot.online { background: var(--accent-green); box-shadow: var(--glow-green); }
.scale-status-dot.offline { background: var(--text-muted); }
.scale-status-dot.error { background: var(--accent-red); box-shadow: var(--glow-red); animation: blink 1s ease infinite; }

.scale-weight {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
    margin-bottom: 4px;
    transition: color 0.3s;
}

.scale-weight.weight-warning {
    color: var(--accent-orange);
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.4);
}

.scale-weight.weight-danger {
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.4);
}

.scale-unit {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
}

.scale-sparkline {
    width: 100%;
    height: 30px;
    margin-top: 4px;
}

.scale-location {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   报警列表
   ============================================================ */
.alerts-panel {
    flex: 1.2;
}

.alerts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 300px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    margin-bottom: 6px;
    background: rgba(255, 51, 102, 0.06);
    border: 1px solid rgba(255, 51, 102, 0.1);
    border-radius: 4px;
    font-size: 11px;
    animation: slideInRight 0.3s ease;
}

.alert-item.alert-overweight {
    border-color: rgba(255, 140, 0, 0.2);
    background: rgba(255, 140, 0, 0.06);
}

.alert-item.alert-recovery {
    border-color: rgba(0, 255, 136, 0.15);
    background: rgba(0, 255, 136, 0.04);
}

.alert-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.alert-message {
    color: var(--text-secondary);
    font-size: 10px;
}

.alert-time {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.alert-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
    font-size: 13px;
}

/* ============================================================
   底部图表
   ============================================================ */
.bottom-charts {
    display: flex;
    gap: 8px;
    padding: 0 8px 8px;
    height: 200px;
    min-height: 200px;
}

.bottom-charts .panel-card {
    flex: 1;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 30px;
    background: rgba(10, 22, 45, 0.8);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================
   弹窗
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 0 40px rgba(0, 100, 255, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 16px;
    color: var(--accent-cyan);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--accent-red);
}

.modal-body {
    padding: 20px;
}

.modal-info {
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-label {
    color: var(--text-secondary);
    min-width: 80px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-chart {
    height: 300px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================================
   认证页面（登录/注册）
   ============================================================ */
.auth-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(0, 100, 255, 0.06) 0%, transparent 60%),
        var(--bg-primary);
}

.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 400px;
    max-width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 100, 255, 0.1);
    animation: fadeIn 0.5s ease;
}

.auth-card-header {
    padding: 30px 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 100, 255, 0.03);
}

.auth-card-header h2 {
    font-size: 22px;
    color: var(--accent-cyan);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-form {
    padding: 24px 30px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.optional {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
    background: rgba(0, 20, 50, 0.4);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-error {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid rgba(255, 51, 102, 0.2);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 4px;
    font-family: var(--font-family);
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-footer {
    padding: 16px 30px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   管理后台
   ============================================================ */
.admin-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
}

.admin-container {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-cyan);
    background: var(--bg-card);
    border-color: var(--border-color);
    border-bottom-color: var(--bg-card);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.admin-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(0, 100, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.admin-table tr:hover td {
    background: rgba(0, 100, 255, 0.03);
}

.loading-text {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
    font-size: 13px;
}

.btn-action {
    padding: 6px 14px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius);
    color: var(--accent-cyan);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-action:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: var(--glow-cyan);
}

.btn-danger {
    background: rgba(255, 51, 102, 0.1);
    border-color: rgba(255, 51, 102, 0.2);
    color: var(--accent-red);
}

.btn-danger:hover {
    background: rgba(255, 51, 102, 0.2);
    box-shadow: var(--glow-red);
}

.btn-success {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.btn-success:hover {
    background: rgba(0, 255, 136, 0.2);
    box-shadow: var(--glow-green);
}

.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.role-admin {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.role-user {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.role-test {
    background: rgba(255, 215, 0, 0.1);
    color: var(--accent-yellow);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.role-authorized {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.status-online-badge {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.status-offline-badge {
    background: rgba(100, 100, 120, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(100, 100, 120, 0.3);
}

.status-error-badge {
    background: rgba(255, 51, 102, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(255, 51, 102, 0.2);
}

/* 系统统计卡片 */
.system-stats {
    padding: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.stats-card {
    background: rgba(0, 50, 100, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}

.stats-card-title {
    font-size: 14px;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    font-weight: 600;
}

.stats-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

.stats-card-label {
    color: var(--text-secondary);
}

.stats-card-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 600;
}

/* ============================================================
   响应式适配
   ============================================================ */
@media (max-width: 1600px) {
    .scales-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .side-panel {
        width: 250px;
        min-width: 250px;
    }
}

@media (max-width: 1200px) {
    .scales-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .side-panel {
        width: 220px;
        min-width: 220px;
    }
    .bottom-charts {
        height: 180px;
    }
}

@media (max-width: 992px) {
    /* Reason: 移动端三栏堆叠为单列，需要允许整页滚动 */
    .dashboard-body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .main-content {
        flex-direction: column;
        overflow: visible;
        flex: none;
        height: auto;
    }
    .side-panel {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        height: auto;
        max-height: none;
    }
    .side-panel .panel-card {
        flex: 1;
        min-height: 200px;
    }
    .center-area {
        flex: none;
        height: auto;
        overflow: visible;
    }
    .scales-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .bottom-charts {
        flex-direction: column;
        height: auto;
    }
    .bottom-charts .panel-card {
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .header-title {
        font-size: 14px;
        letter-spacing: 1px;
    }
    .total-weight-box {
        display: none;
    }
    .scales-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-bar {
        gap: 16px;
        flex-wrap: wrap;
    }
    .datetime-display {
        display: none;
    }
    .admin-container {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .scales-grid {
        grid-template-columns: 1fr;
    }
    .auth-card {
        border-radius: 0;
    }
    .auth-form {
        padding: 20px;
    }
}

/* ===== 导出功能样式 ===== */

/* 大屏导出下拉按钮 */
.btn-export-dropdown {
    position: relative;
}

.export-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    box-shadow: var(--glow-blue), 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
}

.export-menu.show {
    display: block;
    animation: fadeSlideDown 0.2s ease;
}

@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-menu-item {
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.export-menu-item:hover {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-cyan);
}

.export-menu-item + .export-menu-item {
    border-top: 1px solid rgba(0, 180, 255, 0.08);
}

/* 管理后台导出按钮 */
.panel-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-export {
    background: rgba(0, 212, 255, 0.08) !important;
    border-color: rgba(0, 212, 255, 0.25) !important;
    color: var(--accent-cyan) !important;
}

.btn-export:hover {
    background: rgba(0, 212, 255, 0.18) !important;
    box-shadow: var(--glow-cyan);
}
