* { box-sizing: border-box; }

body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    color: #222;
}

header {
    background: #1d3557;
    color: #fff;
    padding: 24px 32px;
}

header h1 { margin: 0 0 4px 0; font-size: 24px; }
.subtitle { margin: 0; opacity: 0.85; font-size: 14px; }

nav.tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid #d9dde3;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 14px 28px;
    font-size: 15px;
    cursor: pointer;
    color: #555;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #1d3557;
    border-bottom-color: #1d3557;
    font-weight: 600;
}

main {
    padding: 24px 32px;
    max-width: 1200px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
}

button, .btn {
    background: #1d3557;
    color: #fff;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }
button:hover:not(:disabled), .btn:hover { background: #2a4d7a; }

input[type="file"] { display: none; }

#upload-filename { color: #555; font-size: 13px; }

.hint {
    background: #fffbe6;
    border-left: 4px solid #faad14;
    padding: 10px 14px;
    margin: 0 0 16px 0;
    font-size: 13px;
}

.camera-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}

.camera-grid video, .camera-grid img {
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 4px;
}

.camera-grid h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #555;
}

.job-panel {
    margin-top: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid #d9dde3;
    border-radius: 4px;
    display: none;
}

.job-panel.active { display: block; }

.job-status {
    font-weight: 600;
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e5e9f0;
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0 16px 0;
}

.progress-bar-fill {
    height: 100%;
    background: #1d3557;
    transition: width 0.3s;
}

.job-result video {
    width: 100%;
    max-width: 720px;
    border-radius: 4px;
}

.job-result h4 {
    margin: 16px 0 6px 0;
}

.job-result pre {
    background: #f0f2f5;
    padding: 12px;
    border-radius: 4px;
    max-height: 240px;
    overflow: auto;
    font-size: 12px;
    white-space: pre-wrap;
}

.error {
    color: #c62828;
    font-size: 13px;
    margin-top: 8px;
}

aside.legend {
    padding: 16px 32px 32px 32px;
    max-width: 1200px;
}

aside.legend h3 { margin: 0 0 12px 0; font-size: 15px; }

aside.legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

aside.legend li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
}

.swatch.green  { background: #00ff00; }
.swatch.yellow { background: #ffff00; }
.swatch.blue   { background: #0000ff; }
.swatch.red    { background: #ff0000; }
