/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f4f6fa;
    color: #2c3e50;
    line-height: 1.5;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,.08);
}
.sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header h2 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
}
.nav-list { list-style: none; padding: 8px 0; flex: 1; }
.nav-list li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 13.5px;
    transition: all .2s;
    border-left: 3px solid transparent;
}
.nav-list li a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    border-left-color: #1890ff;
}
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
    color: rgba(255,255,255,.5);
    text-decoration: none;
    font-size: 13px;
}
.sidebar-footer a:hover { color: #fff; }

/* ── Main Content ── */
.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 28px 32px;
    max-width: 100%;
}

/* ── Login ── */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin-left: -220px;
    width: 100vw;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-form {
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(20px);
    padding: 48px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    width: 400px;
}
.login-form h2 {
    text-align: center;
    margin-bottom: 28px;
    font-size: 22px;
    color: #1a1a2e;
}
.login-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}
.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 18px;
    transition: border-color .2s;
}
.login-form input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 3px rgba(24,144,255,.15);
}
.login-form button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.login-form button:hover { opacity: .9; }

/* ── Alert ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #cf1322;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e8ecf1;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
}
.count-badge {
    background: linear-gradient(135deg, #e6f7ff, #bae7ff);
    color: #1890ff;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Section Header ── */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8ecf1;
}
.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
}
.section-header .section-icon {
    font-size: 18px;
}
.section-header .section-sub {
    font-size: 12px;
    color: #999;
    margin-left: auto;
}

/* ── Stats Grid (Gradient Cards) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 3px 12px rgba(0,0,0,.08);
    transition: all .3s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 110px;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.stat-card .stat-number {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 12.5px;
    font-weight: 500;
    margin-top: 4px;
    opacity: .85;
}

/* Individual card gradient colors */
.stat-card.card-blue {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
}
.stat-card.card-purple {
    background: linear-gradient(135deg, #722ed1 0%, #531dab 100%);
    color: #fff;
}
.stat-card.card-green {
    background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
    color: #fff;
}
.stat-card.card-gold {
    background: linear-gradient(135deg, #faad14 0%, #d48806 100%);
    color: #fff;
}
.stat-card.card-pink {
    background: linear-gradient(135deg, #eb2f96 0%, #c41d7f 100%);
    color: #fff;
}
.stat-card.card-cyan {
    background: linear-gradient(135deg, #13c2c2 0%, #08979c 100%);
    color: #fff;
}
.stat-card.card-orange {
    background: linear-gradient(135deg, #fa8c16 0%, #d46b08 100%);
    color: #fff;
}

.stat-card .card-icon {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 28px;
    opacity: .25;
    line-height: 1;
}

/* ── Detail Card (white card) ── */
.detail-card {
    background: #fff;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 24px;
    transition: box-shadow .3s;
}
.detail-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.detail-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Today Stats (mini cards inside detail-card) ── */
.today-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}
.today-card {
    border-radius: 10px;
    padding: 14px 16px;
    background: #fafafa;
    border-left: 3px solid #ddd;
    transition: all .2s;
}
.today-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.today-card .today-number {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}
.today-card .today-label {
    font-size: 11.5px;
    color: #888;
    margin-top: 2px;
    font-weight: 500;
}
.today-card.today-blue { border-left-color: #1890ff; }
.today-card.today-blue .today-number { color: #1890ff; }
.today-card.today-green { border-left-color: #52c41a; }
.today-card.today-green .today-number { color: #52c41a; }
.today-card.today-pink { border-left-color: #eb2f96; }
.today-card.today-pink .today-number { color: #eb2f96; }
.today-card.today-gold { border-left-color: #faad14; }
.today-card.today-gold .today-number { color: #d48806; }
.today-card.today-purple { border-left-color: #722ed1; }
.today-card.today-purple .today-number { color: #722ed1; }

/* ── System Status ── */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}
.status-item {
    background: #fafafa;
    border-radius: 10px;
    padding: 14px 16px;
    transition: all .2s;
}
.status-item:hover {
    background: #f0f2f5;
}
.status-item .status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.status-item .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot.green { background: #52c41a; box-shadow: 0 0 6px rgba(82,196,26,.4); }
.status-dot.red { background: #ff4d4f; box-shadow: 0 0 6px rgba(255,77,79,.4); }
.status-dot.gold { background: #faad14; box-shadow: 0 0 6px rgba(250,173,20,.4); }
.status-dot.blue { background: #1890ff; box-shadow: 0 0 6px rgba(24,144,255,.4); }
.status-dot.pink { background: #eb2f96; box-shadow: 0 0 6px rgba(235,47,150,.4); }
.status-item .status-label {
    font-size: 12px;
    color: #666;
}
.status-item .status-value {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    padding-left: 16px;
}

/* ── Progress bar (for ratio stats) ── */
.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 16px;
    margin-top: 4px;
}
.progress-bar-track {
    flex: 1;
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .6s ease;
}
.progress-bar-fill.green { background: linear-gradient(90deg, #52c41a, #73d13d); }
.progress-bar-fill.blue { background: linear-gradient(90deg, #1890ff, #40a9ff); }
.progress-bar-fill.gold { background: linear-gradient(90deg, #faad14, #ffc53d); }
.progress-bar-text {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    white-space: nowrap;
}

/* ── Scout status pills ── */
.pill-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-left: 16px;
    margin-top: 4px;
}
.pill {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.pill-green { background: #f6ffed; color: #52c41a; }
.pill-blue { background: #e6f7ff; color: #1890ff; }
.pill-gold { background: #fffbe6; color: #d48806; }
.pill-pink { background: #fff0f6; color: #eb2f96; }

.chart-grid {
    display: grid;
    gap: 18px;
}
.chart-grid-two {
    grid-template-columns: 1fr 1fr;
}
.chart-grid-full {
    grid-template-columns: 1fr;
}

.chart-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: all .3s;
    border-left: 4px solid #e8e8e8;
}
.chart-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chart-card canvas {
    max-height: 250px;
    max-width: 100%;
}
.chart-card.card-line { border-left-color: #1890ff; }
.chart-card.card-bar { border-left-color: #722ed1; }
.chart-card.card-doughnut { border-left-color: #faad14; }

/* ── Tables ── */
.table-wrap {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead th {
    background: #fafafa;
    padding: 12px 16px;
    text-align: left;
    font-size: 12.5px;
    color: #666;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
}
tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f5f5f5;
}
tbody tr:hover { background: #f8f9fb; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    background: #fafafa;
    padding: 10px 14px;
    text-align: left;
    font-size: 12.5px;
    color: #666;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid #f5f5f5;
}
.data-table tbody tr:hover { background: #f8f9fb; }
code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: "SFMono-Regular", Consolas, monospace;
}

/* ── Tags ── */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
}
.tag-gold { background: #fffbe6; color: #d48806; border: 1px solid #ffe58f; }
.tag-blue { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tag-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-gray { background: #fafafa; color: #999; border: 1px solid #e8e8e8; }
.tag-yellow { background: #fffbe6; color: #d4a017; border: 1px solid #ffe58f; }
.tag-red { background: #fff2f0; color: #cf1322; border: 1px solid #ffccc7; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all .2s;
}
.btn:hover { opacity: .85; transform: translateY(-1px); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.btn-gold { background: #faad14; color: #fff; }
.btn-blue { background: #1890ff; color: #fff; }
.btn-red { background: #ff4d4f; color: #fff; }
.btn-green { background: #52c41a; color: #fff; }
.btn-cyan { background: #13c2c2; color: #fff; }

/* ── Card / Detail Grid ── */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card p { font-size: 13px; margin-bottom: 8px; }
.card label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}
.card input {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    transition: border-color .2s;
}
.card input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 3px rgba(24,144,255,.12);
}
.detail-grid { display: flex; flex-direction: column; gap: 16px; }
.info-table { width: auto; }
.info-table td {
    padding: 6px 16px 6px 0;
    font-size: 13px;
    border: none;
}
.inline-form { display: inline-block; margin-right: 6px; margin-top: 8px; }
.input-sm {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}
.input-medium { max-width: 300px !important; display: inline-block !important; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-row .inline-form { margin: 0; }

/* ── Misc ── */
.kw-list { list-style: none; }
.kw-list li { padding: 6px 0; font-size: 13px; }
.order-list { list-style: none; }
.order-list li { padding: 6px 0; font-size: 13px; }
.muted { color: #999; font-size: 13px; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.tips { padding-left: 20px; font-size: 13px; color: #666; }
.tips li { margin-bottom: 6px; }

/* ── Batch join status ── */
.batch-status {
    font-size: 12px;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 4px;
}
.batch-status.running {
    background: #fffbe6;
    color: #d48806;
    border: 1px solid #ffe58f;
}
.batch-status.done {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}
.batch-progress {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
}
.batch-form {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 10px;
    margin-top: 6px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .chart-grid-two { grid-template-columns: 1fr; }
    .main-content { padding: 20px 16px; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .status-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
