:root {
    --bg: #f3efe6;
    --panel: #fcfaf6;
    --panel-alt: #f7f1e7;
    --ink: #231815;
    --muted: #6f6258;
    --line: #dbcdbd;
    --hero: #d96c3d;
    --hero-deep: #7e2f1d;
    --info: #2f6c66;
    --success: #4a8d3f;
    --danger: #c14a3a;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
}

.hero {
    background: linear-gradient(135deg, var(--hero) 0%, var(--hero-deep) 100%);
    color: #fffaf5;
    padding: 28px 24px;
}
.hero-inner { max-width: 1100px; margin: 0 auto; }
.hero h1 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.hero .subtitle { margin: 0; opacity: 0.88; font-size: 13px; }

.container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(126,47,29,0.04);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px 0 14px;
    gap: 12px;
    flex-wrap: wrap;
}
.card-header h2 { margin: 0; font-size: 16px; color: var(--hero-deep); }

.hidden { display: none !important; }

.drop-zone {
    border: 2px dashed var(--line);
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    padding: 36px 20px;
}
.drop-zone.dragover {
    border-color: var(--hero);
    background: #fbeee5;
}
.drop-icon { font-size: 42px; margin-bottom: 8px; }
.drop-title { font-size: 16px; margin: 0 0 4px; color: var(--ink); }
.drop-hint { color: var(--muted); margin: 4px 0 12px; }
.drop-meta { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

.primary-btn {
    background: var(--hero);
    color: #fffaf5;
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.primary-btn:hover { background: var(--hero-deep); }
.primary-btn:disabled { background: #ccc; cursor: not-allowed; }

.secondary-btn {
    background: var(--panel-alt);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}
.secondary-btn:hover { background: #ece2d2; }

.file-list ul { list-style: none; padding: 0; margin: 0; }
.file-list li {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.file-list li:hover { border-color: var(--hero); }
.file-list li.selected { border-color: var(--hero); background: #fbeee5; }
.file-list li .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-list li .status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.file-list li.status-processing .status { color: var(--info); }
.file-list li.status-done .status { color: var(--success); }
.file-list li.status-error .status { color: var(--danger); }
.file-list li .actions { display: flex; gap: 6px; }
.download-btn {
    background: var(--success);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}
.download-btn:hover { background: #3a7430; }

.viz-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--muted);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
    background: var(--hero);
    color: #fffaf5;
    border-color: var(--hero);
}
.viz-content { min-height: 200px; }

.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 24px;
}
.kv-grid .kv {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px dashed var(--line);
}
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { color: var(--ink); font-weight: 500; font-size: 13px; text-align: right; word-break: break-all; }
.section-title {
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--hero-deep);
    border-left: 3px solid var(--hero);
    padding-left: 8px;
}

canvas.track-canvas {
    width: 100%; max-width: 100%; height: 480px;
    background: #fbf6ee; border: 1px solid var(--line); border-radius: 6px; display: block;
}
canvas.line-canvas {
    width: 100%; height: 240px;
    background: #fbf6ee; border: 1px solid var(--line); border-radius: 6px; display: block;
}
.canvas-legend { color: var(--muted); font-size: 12px; margin-top: 8px; }

.json-view {
    background: #2a221d; color: #f6efe3;
    padding: 14px; border-radius: 6px;
    max-height: 540px; overflow: auto;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px; line-height: 1.5; white-space: pre;
}

.error-box { background: #fdecea; border-color: #e9b5ad; }
.error-title { color: var(--danger); font-weight: 700; margin-bottom: 6px; }
.error-box pre { margin: 0; color: #6b1f15; font-size: 12px; white-space: pre-wrap; word-break: break-word; }

.button-timeline-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbf6ee;
}
.button-timeline-label { color: var(--muted); font-size: 12px; margin-top: 8px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
.footer p { margin: 0 0 4px; }
.footer-brand { font-size: 14px; font-weight: 600; color: var(--text); }
.footer-link { color: var(--primary); text-decoration: none; }
.footer-link:hover { text-decoration: underline; }
