:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface2: #1c2333;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --orange: #db6d28;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}
.container.wide {
    max-width: 1200px;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}
h1 a {
    color: var(--accent);
    text-decoration: none;
}
h2 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s;
}
.card:hover {
    border-color: var(--accent);
}
.card h2 {
    color: var(--accent);
    margin-bottom: 8px;
}
.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Status bar */
.status-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.status-bar.done { border-color: var(--green); }
.status-bar.error { border-color: var(--red); }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Label row */
.label-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.label-row label {
    font-weight: 600;
    white-space: nowrap;
}
.label-row input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn:hover { background: var(--surface2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}
.btn-primary:hover { background: #388bfd; }
.btn-primary:disabled { background: #1f6feb; opacity: 0.5; }
.btn-small { font-size: 0.8rem; padding: 6px 12px; cursor: pointer; }

.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.actions.center { justify-content: center; }

/* Sections */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.data-block {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-muted);
}

.json-output {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre;
    max-height: 500px;
    overflow-y: auto;
}

/* Compare page */
.compare-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.compare-col h3 {
    margin-bottom: 8px;
    color: var(--text-muted);
}
.compare-col textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 12px;
    border-radius: 6px;
    resize: vertical;
}
.compare-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-items: center;
}
.label-input-small {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Results */
.results { margin-top: 20px; }

.summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.diff-section {
    margin-bottom: 20px;
}
.section-anomaly { color: var(--orange); }
.section-critical { color: var(--red); }
.section-warning { color: var(--yellow); }
.section-info { color: var(--text-muted); }

.anomaly-card {
    background: var(--surface);
    border: 1px solid var(--orange);
    border-left: 4px solid var(--orange);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.anomaly-card .anomaly-profile {
    color: var(--accent);
    font-weight: 600;
}
.anomaly-card .anomaly-check {
    color: var(--orange);
    font-weight: 600;
}
.anomaly-card .anomaly-detail {
    color: var(--text-muted);
    margin-top: 2px;
}

/* Diff table */
.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-bottom: 12px;
}
.diff-table th, .diff-table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.diff-table th {
    background: var(--surface2);
    color: var(--text-muted);
    font-weight: 600;
}
.diff-table td {
    background: var(--surface);
}
.diff-table .val-match { color: var(--green); }
.diff-table .val-diff { color: var(--red); }
.diff-table .val-added { color: var(--green); background: #0d2818; }
.diff-table .val-removed { color: var(--red); background: #2d1215; }
.diff-table .val-absent { color: var(--text-muted); font-style: italic; }

/* Collapsible sections */
.collapse-toggle {
    cursor: pointer;
    user-select: none;
    padding: 8px 0;
}
.collapse-toggle::before {
    content: '\25B6 ';
    font-size: 0.7rem;
}
.collapse-toggle.open::before {
    content: '\25BC ';
}
.collapse-content {
    display: none;
}
.collapse-content.open {
    display: block;
}

/* Mobile */
@media (max-width: 768px) {
    .card-grid, .compare-inputs {
        grid-template-columns: 1fr;
    }
}
