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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
}

.topbar {
    background: #0f172a; padding: 0 24px; height: 56px;
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-size: 18px; font-weight: 700; color: #f8fafc; letter-spacing: -.3px; white-space: nowrap; }
.topbar .logo span { color: #818cf8; }
.topbar .subtitle { font-size: 12px; color: #64748b; white-space: nowrap; }
.navlinks { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.nav-a { color: #94a3b8; font-size: 13px; text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav-a:hover { background: #1e293b; color: #e2e8f0; }
.nav-a.active { background: #1e293b; color: #c7d2fe; }
.userchip { margin-left: auto; font-size: 12px; color: #cbd5e1; background: #1e293b; padding: 5px 12px; border-radius: 20px; border: 1px solid #334155; white-space: nowrap; }

.container { max-width: 1080px; margin: 32px auto; padding: 0 20px 60px; }
.container.narrow { max-width: 860px; }

.card {
    background: #fff; border-radius: 12px; border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 22px 26px; margin-bottom: 14px;
}
.card h2 { font-size: 16px; font-weight: 600; color: #0f172a; margin-bottom: 4px; }
.card h3 {
    font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase;
    letter-spacing: .8px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}
.card p.sub { font-size: 13px; color: #64748b; margin-bottom: 14px; }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #374151; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"], .field input[type="number"],
.field textarea, .field select {
    width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 10px 14px;
    font-size: 14px; color: #111827; font-family: inherit; outline: none;
    transition: border-color .15s; resize: vertical; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,.15);
}
.field textarea { min-height: 130px; }
.field .hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.btn {
    display: inline-block; padding: 10px 20px; background: #4f46e5; color: #fff;
    border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .15s; text-decoration: none;
}
.btn:hover { background: #4338ca; }
.btn:disabled { background: #94a3b8; cursor: not-allowed; }
.btn.secondary { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn.secondary:hover { background: #e2e8f0; }
.btn.green { background: #16a34a; } .btn.green:hover { background: #15803d; }
.btn.orange { background: #ea580c; } .btn.orange:hover { background: #c2410c; }
.btn.small { padding: 6px 14px; font-size: 12px; }

.error-box { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 10px; padding: 14px 18px; color: #dc2626; font-size: 14px; margin-bottom: 16px; }
.ok-box { background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px; padding: 14px 18px; color: #15803d; font-size: 14px; margin-bottom: 16px; }
.info-box { background: #eff6ff; border: 1px solid #93c5fd; border-radius: 10px; padding: 14px 18px; color: #1d4ed8; font-size: 13px; margin-bottom: 16px; }

table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
    color: #94a3b8; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
table.list td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.list tr:hover td { background: #f8fafc; }
table.list a.tno { font-weight: 700; color: #4f46e5; text-decoration: none; }

.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card {
    flex: 1; min-width: 130px; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-card .num { font-size: 26px; font-weight: 700; color: #0f172a; }
.stat-card .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; margin-top: 2px; }

.result-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.confidence-bar-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.confidence-bar { width: 80px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.confidence-bar-fill { height: 100%; border-radius: 3px; }
.priority-reason { font-size: 12px; color: #64748b; font-style: italic; margin-top: 10px; }

.result-section ul { list-style: none; padding: 0; }
.result-section ul li {
    font-size: 14px; line-height: 1.6; color: #374151; padding: 6px 0 6px 22px;
    position: relative; border-bottom: 1px solid #f8fafc;
}
.result-section ul li:last-child { border-bottom: none; }
.result-section ul li::before { content: attr(data-prefix); position: absolute; left: 0; color: #818cf8; font-weight: 700; }
.result-section p { font-size: 14px; line-height: 1.7; color: #374151; }

.components-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.component-tag {
    background: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; font-size: 12px;
    font-weight: 500; padding: 4px 10px; border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
}

.timeline { border-left: 2px solid #e2e8f0; margin-left: 8px; padding-left: 20px; }
.timeline .titem { position: relative; padding-bottom: 14px; font-size: 13px; color: #475569; }
.timeline .titem::before {
    content: ''; position: absolute; left: -26px; top: 4px; width: 10px; height: 10px;
    background: #818cf8; border-radius: 50%; border: 2px solid #fff;
}
.timeline .tdate { font-size: 11px; color: #94a3b8; }

.round-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.round-tab {
    padding: 6px 16px; border-radius: 20px; font-size: 12px; font-weight: 600;
    border: 1px solid #e2e8f0; background: #fff; color: #64748b; cursor: pointer; text-decoration: none;
}
.round-tab.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }

.suggest-row {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; background: #f8fafc; font-size: 13px;
}
.suggest-row .who { font-weight: 700; color: #0f172a; }

.upload-zone {
    border: 2px dashed #cbd5e1; border-radius: 10px; padding: 30px 20px; text-align: center;
    cursor: pointer; transition: all .2s; background: #f8fafc;
}
.upload-zone:hover { border-color: #818cf8; background: #eef2ff; }
.upload-zone input[type="file"] { display: none; }
.upload-zone .up-title { font-size: 14px; font-weight: 600; color: #374151; }
.upload-zone .up-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.upload-zone .file-chosen { font-size: 13px; color: #4f46e5; font-weight: 500; margin-top: 8px; }

.mode-tabs {
    display: flex; gap: 0; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 3px; margin-bottom: 18px; width: fit-content;
}
.mode-tab {
    padding: 7px 18px; border-radius: 6px; font-size: 13px; font-weight: 500;
    cursor: pointer; color: #64748b; border: none; background: transparent; transition: all .15s;
}
.mode-tab.active { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.spinner {
    display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite;
    vertical-align: middle; margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer-meta { font-size: 11px; color: #94a3b8; text-align: right; margin-top: 8px; }
