:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface-hover: #1a2744;
    --accent: #0f3460;
    --accent-light: #4da6ff;
    --text: #e4e4e4;
    --text-muted: #8899aa;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --info: #2196f3;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 2rem 1rem 1rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    flex: 1;
    padding: 1rem 2rem;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

/* Drop zone */
.drop-zone {
    border: 3px dashed var(--accent);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--surface);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent-light);
    background: var(--surface-hover);
    transform: scale(1.01);
}

.drop-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.drop-content h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.pick-btn {
    background: var(--accent-light);
    color: #000;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

.pick-btn:hover {
    opacity: 0.9;
}

.hint {
    color: var(--text-muted);
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Queue section */
.queue-section {
    margin-top: 2rem;
}

.queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.queue-header h2 {
    font-size: 1.4rem;
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.12);
}

.queue-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ov-status {
    font-size: 0.85rem;
    color: var(--text-dim, #9aa0aa);
}

/* Queue table */
.queue-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.queue-table thead {
    background: rgba(0,0,0,0.2);
}

.queue-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.queue-table td {
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.queue-table tr {
    transition: background 0.15s;
}

.queue-table tbody tr:hover {
    background: var(--surface-hover);
}

.cell-name {
    font-weight: 500;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-progress {
    width: 150px;
}

.cell-result {
    width: 60px;
    text-align: center;
}

.cell-action {
    width: 80px;
    text-align: center;
}

/* Mini progress bar */
.progress-bar-mini {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: var(--accent-light);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-fill-mini.indeterminate {
    width: 40%;
    animation: indeterminate 1.2s ease-in-out infinite;
}

.progress-fill-mini.cancelled-bar {
    width: 30%;
    background: var(--text-muted);
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.progress-detail {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Result badges */
.result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
}

.result-badge.pass {
    background: rgba(76,175,80,0.2);
    color: var(--success);
}

.result-badge.fail {
    background: rgba(244,67,54,0.2);
    color: var(--error);
}

.result-badge.cancelled {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
}

.result-badge.reading,
.result-badge.working {
    background: rgba(33,150,243,0.15);
    color: var(--info);
}

/* Cancel button */
.btn-cancel-small {
    background: transparent;
    border: 1px solid rgba(244,67,54,0.5);
    color: var(--error);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-cancel-small:hover {
    background: rgba(244,67,54,0.1);
    border-color: var(--error);
}

.btn-restart-small {
    background: transparent;
    border: 1px solid rgba(77,166,255,0.5);
    color: var(--accent-light);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-restart-small:hover {
    background: rgba(77,166,255,0.1);
    border-color: var(--accent-light);
}

.btn-priority {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-muted);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.15s;
    margin: 0 1px;
}

.btn-priority:hover:not(:disabled) {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.4);
    color: var(--text);
}

.btn-priority:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Tooltip */
.detail-tooltip {
    position: fixed;
    z-index: 1000;
    background: #0d1b2a;
    border: 1px solid rgba(77,166,255,0.3);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 400px;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Utility */
.hidden { display: none !important; }

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--accent-light);
    text-decoration: none;
}

.privacy {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.limitations {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.limitations summary {
    cursor: pointer;
    color: var(--text-muted);
}

.limitations ul {
    margin: 0.4rem 0 0.4rem 1.5rem;
    line-height: 1.6;
}

.limitations code {
    background: rgba(255,255,255,0.06);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 { font-size: 1.8rem; }
    .drop-zone { padding: 2rem 1rem; }
    main { padding: 1rem; }
    .cell-progress { width: 80px; }
    .cell-name { max-width: 120px; }
}

/* Detail Panel */
.detail-panel {
    margin-top: 1rem;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    overflow: hidden;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.btn-close:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.detail-content {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

.detail-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.detail-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
}

.detail-badge.pass {
    background: rgba(76,175,80,0.2);
    color: var(--success);
}

.detail-badge.fail {
    background: rgba(244,67,54,0.2);
    color: var(--error);
}

.detail-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.detail-notes {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.detail-note {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.detail-note.note-error {
    background: rgba(244,67,54,0.08);
}

.detail-note.note-warning {
    background: rgba(255,152,0,0.08);
}

.detail-note.note-info {
    background: rgba(33,150,243,0.08);
}

.note-msg {
    color: var(--text);
}

.note-file {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

.detail-status {
    color: var(--text-muted);
    font-style: italic;
}

.detail-error {
    color: var(--error);
}

/* Selected row highlight */
tr.selected {
    background: rgba(77,166,255,0.1) !important;
    outline: 1px solid rgba(77,166,255,0.3);
}
