/* ==========================================================================
   「稳住」用户数据后台系统样式表
   主题色彩：Kiwi Green (#76A035 / #8BC34A), Deep Slate (#1E293B), Crisp Dot Bg
   ========================================================================== */

:root {
    --bg-page: #F4F7EE;
    --card-bg: #FFFFFF;
    --primary: #6E9B2F;
    --primary-hover: #5D8525;
    --primary-light: #EBF3DC;
    --primary-border: #D2E4B3;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    --border-color: #E2E8F0;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --amber: #F59E0B;
    --amber-light: #FEF3C7;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.07);
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    --font-stack: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--bg-page);
    background-image: radial-gradient(#CBD5E1 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Container & Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* --- Navigation Header --- */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
}

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

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #8BC34A, #689F38);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    box-shadow: 0 3px 8px rgba(110, 155, 47, 0.3);
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.brand-text p {
    font-size: 11px;
    color: var(--text-muted);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #DCFCE7;
    color: #166534;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.live-dot {
    width: 7px;
    height: 7px;
    background: #22C55E;
    border-radius: 50%;
    box-shadow: 0 0 6px #22C55E;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

.admin-tag {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    background: var(--bg-page);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 2px 6px rgba(110, 155, 47, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(110, 155, 47, 0.35);
}

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

.btn-secondary:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #FECACA;
}

.btn-danger:hover {
    background: #FEE2E2;
}

/* --- Update Banner --- */
.update-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.update-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.update-divider {
    color: #CBD5E1;
    font-weight: bold;
}

.metrics-dual {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
}

.metric-card.hero-secondary {
    background: linear-gradient(145deg, #FFFFFF 0%, #F0F7FF 100%);
    border: 1.5px solid #BFDBFE;
}

/* --- Metrics Grid --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 22px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.metric-card.hero {
    grid-column: span 2;
    background: linear-gradient(145deg, #FFFFFF 0%, #F5F9EC 100%);
    border: 1.5px solid var(--primary-border);
}

@media (max-width: 768px) {
    .metric-card.hero {
        grid-column: span 1;
    }
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.icon-kiwi { background: var(--primary-light); color: var(--primary); }
.icon-blue { background: #E0F2FE; color: #0284C7; }
.icon-amber { background: var(--amber-light); color: var(--amber); }
.icon-purple { background: #F3E8FF; color: #9333EA; }

.metric-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.metric-card.hero .metric-value {
    font-size: 44px;
    color: var(--primary);
}

.metric-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Section Card (Chart & Table) --- */
.section-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-subtitle {
    font-size: 12px;
    font-weight: normal;
    color: var(--text-muted);
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Search input */
.search-box {
    position: relative;
}

.search-input {
    padding: 8px 14px 8px 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 220px;
    transition: all 0.2s ease;
    background: #F8FAFC;
}

.search-input:focus {
    width: 260px;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(110, 155, 47, 0.15);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 13px;
    pointer-events: none;
}

/* --- Custom Chart Area --- */
.chart-container {
    width: 100%;
    height: 220px;
    position: relative;
    margin-top: 10px;
}

canvas#trendChart {
    width: 100%;
    height: 100%;
    display: block;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-line {
    width: 14px;
    height: 3px;
    border-radius: 2px;
}

.line-new { background: #6E9B2F; }
.line-active { background: #0284C7; }

/* --- Table Styles --- */
.table-responsive {
    overflow-x: auto;
    margin: 0 -24px;
    padding: 0 24px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table th {
    background: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #F1F5F9;
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #F8FAF5;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.device-id-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11.5px;
    background: #F1F5F9;
    padding: 3px 6px;
    border-radius: 4px;
    color: #475569;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #166534;
}

.status-dot-active {
    width: 6px;
    height: 6px;
    background: #22C55E;
    border-radius: 50%;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.page-buttons {
    display: flex;
    gap: 6px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
    background: #F1F5F9;
    border-color: #CBD5E1;
}

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

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.6;
}

/* --- Login Page Specifics --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    text-align: center;
}

.login-logo {
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #8BC34A, #689F38);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    margin-bottom: 16px;
    box-shadow: 0 8px 16px rgba(110, 155, 47, 0.3);
}

.login-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.form-group {
    text-align: left;
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
    background: #F8FAFC;
}

.form-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(110, 155, 47, 0.18);
}

.alert-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    margin-bottom: 18px;
    display: none;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #FECACA;
}

.alert-success {
    background: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: var(--radius-full);
    margin-top: 8px;
}

/* --- Modal Dialog --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    padding: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}
