:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-weak: #eff6ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --pending: #9ca3af;
    --processing: #2563eb;
    --completed: #16a34a;
    --failed: #dc2626;
    --radius: 12px;
    --shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
}

.app-root {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--panel);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}

.auth-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
}

.auth-sub {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
}

.form-item {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--muted);
}

.form-control,
select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}

.form-control:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
}

.btn {
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 14px;
    cursor: pointer;
    transition: 0.2s;
}

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

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

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.btn-secondary:hover {
    background: #f8fafc;
}

.btn-danger {
    background: #fff5f5;
    border-color: #fecaca;
    color: #b91c1c;
}

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid transparent;
}

.tag-admin {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.tag-user {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #374151;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #0f172a;
    color: #cbd5e1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    padding: 8px 10px;
}

.brand small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-btn {
    text-align: left;
    border: none;
    background: transparent;
    color: inherit;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
}

.menu-btn.active,
.menu-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #fff;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 0 10px;
    font-size: 13px;
    color: #94a3b8;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-pill {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
}

.status-pill.ok {
    color: #166534;
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.status-pill.bad {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat-box {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fcfdff;
}

.stat-k {
    color: var(--muted);
    font-size: 12px;
}

.stat-v {
    margin-top: 6px;
    font-size: 20px;
    font-weight: 700;
}

.upload-box {
    border: 2px dashed #bfdbfe;
    border-radius: 14px;
    background: #f8fbff;
    padding: 24px;
    text-align: center;
    transition: 0.2s;
}

.upload-box.dragover {
    border-color: var(--primary);
    background: #eef4ff;
}

.upload-hint {
    color: var(--muted);
    font-size: 13px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.task-head {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-pending {
    background: var(--pending);
}

.status-processing {
    background: var(--processing);
    animation: blink 1.1s infinite;
}

.status-completed {
    background: var(--completed);
}

.status-failed {
    background: var(--failed);
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.35; }
    100% { opacity: 1; }
}

.task-name {
    font-weight: 700;
}

.task-sub {
    font-size: 12px;
    color: var(--muted);
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-body {
    border-top: 1px solid var(--line);
    padding: 12px;
    display: none;
    background: #fbfcff;
}

.task-card.open .task-body {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 12px;
}

.report {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 12px;
}

.report h4,
.report h5 {
    margin: 10px 0 6px;
}

.report p {
    margin: 6px 0;
    line-height: 1.6;
}

.report ul {
    margin: 6px 0;
    padding-left: 18px;
}

.report li {
    margin: 4px 0;
}

.summary-card {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
}

.summary-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
}

.stars {
    color: #f59e0b;
    letter-spacing: 1px;
}

.comp-table-wrap {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.comp-table th,
.comp-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.comp-table th {
    background: #f8fafc;
    font-weight: 700;
}

.thumb {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #fff;
}

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

.table th,
.table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 10px;
    text-align: left;
}

.table th {
    background: #f8fafc;
}

.inline-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.space-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.muted {
    color: var(--muted);
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.notice {
    font-size: 12px;
    color: var(--muted);
}

.toast {
    position: fixed;
    right: 16px;
    top: 16px;
    background: #111827;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    z-index: 999;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: all 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1080px) {
    .task-card.open .task-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-bottom: 1px solid rgba(148, 163, 184, 0.25);
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .menu {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-bottom {
        margin-left: auto;
    }
}