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

:root {
    --bg-page: #f3f4f6;
    --bg-card: #ffffff;
    --bg-subtle: #f9fafb;
    --bg-hover: #eff6ff;
    --border: #e5e7eb;
    --border-mid: #d1d5db;
    --text-1: #111827;
    --text-2: #374151;
    --text-3: #6b7280;
    --text-4: #9ca3af;
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --blue-dark: #1d4ed8;
    --blue-mid: #bfdbfe;
    --blue-dark: #1d4ed8;
    --navy: #1a1a2e;
    --green-bg: #f0fdf4;
    --green-bd: #bbf7d0;
    --green-tx: #15803d;
    --red-tx: #dc2626;
    --red-bd: #fca5a5;
    --red-bg: #fef2f2;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: system-ui, "Segoe UI", sans-serif;
    background: var(--bg-page);
    min-height: 100vh;
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.5;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
}


.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px
}
.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--navy);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-icon i {
    color: #60a5fa;
    font-size: 20px;
}
.logo-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-1);
}

.tab-group {
    display: flex;
    gap: 4px;
    background: #fff;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.tab {
    padding: 7px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-3);
    transition: all 0.15s;
    font-family: inherit;
    text-decoration: none;
}
.tab.active {
    background: var(--blue);
    color: #fff;
}
.tab:not(.active):hover {
    background: var(--bg-page);
    color: var(--text-1);
}

.custom-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 16px;
}
.section-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-4);
    margin-bottom: 12px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.history-count {
    font-size: 12px;
    color: var(--text-4);
    background: var(--bg-subtle);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
}
.job-item {
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
}
.job-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.job-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.job-icon i {
    font-size: 18px;
    color: var(--text-3);
}
.job-meta {
    flex: 1;
    min-width: 0;
}
.job-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.job-id {
    font-size: 11px;
    color: var(--text-4);
    font-family: "Menlo", "Consolas", monospace;
    margin-top: 2px;
}
.job-right {
    text-align: right;
    flex-shrink: 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid transparent;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}
.pill-success {
    background: var(--green-bg);
    border-color: var(--green-bd);
    color: var(--green-tx);
}
.pill-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.pill-secondary {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #4b5563;
}
.pill-info {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #0f766e;
}
.pill-primary {
    background: var(--blue-light);
    border-color: var(--blue-mid);
    color: var(--blue);
}
.pill-danger {
    background: var(--red-bg);
    border-color: var(--red-bd);
    color: var(--red-tx);
}
.pill-dark {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

#task-list {
    height: 40vh;
    overflow: auto;
}

.manual-grid {
    display: grid;
    grid-template-columns: 1fr 272px;
    gap: 24px;
    align-items: start;
}

.manual-grid:has(.settings-panel[style*="display: none"]) {
    grid-template-columns: 1fr;
}

.manual-grid > div {
    min-width: 0;
}
.drop-zone {
    border: 2px dashed var(--border-mid);
    border-radius: var(--radius-lg);
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
    padding: 36px 24px;
    text-align: center;
}
.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--blue);
    background: var(--blue-light);
}
.drop-icon {
  width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.drop-icon i {
  font-size: 24px;
  color: var(--text-3);
}
.drop-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}
.drop-sub {
    font-size: 12px;
    color: var(--text-4);
    margin-top: 2px;
}
.file-detected {
    align-items: center;
    gap: 8px;

    overflow: hidden;

    max-width: 100%;

    margin-top: 16px;
    padding: 9px 14px;
    background: var(--blue-light);
    border: 1px solid var(--blue-mid);
    border-radius: var(--radius-md);
    flex-wrap: nowrap;
}

.file-detected i {
    font-size: 16px;
    color: var(--blue);
    flex-shrink: 0;
}
#fileName {
    flex: 1;
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 13px;
    color: var(--blue);
    font-weight: 500;
}
.file-tag {
    flex-shrink: 0;

    font-size: 11px;
    background: var(--blue-mid);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.settings-panel {
    flex-direction: column;
    gap: 20px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field label {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}
.field input {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-1);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.field input:focus {
    border-color: var(--blue);
    background: #fff;
}
.res-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
    transition: all 0.12s;
    user-select: none;
}
.region-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-bg);
    border: 1px solid var(--green-bd);
    color: var(--green-tx);
    font-size: 12px;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: var(--radius-md);
    text-transform: capitalize;
}
.info-note {
    font-size: 12px;
    color: var(--text-4);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.info-note i {
    font-size: 14px;
    margin-top: 1px;
    flex-shrink: 0;
}

.action-row {
    gap: 10px;
    margin-top: 20px;
}
.btn-primary {
    flex: 1;
    padding: 11px 16px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-primary:hover {
    background: var(--blue);
}
.btn-primary:disabled,
.btn-primary.disabled {
    background: #6c6e70;
    color: #e5eaf1;
    cursor: not-allowed;

    opacity: 0.75;
    box-shadow: none;
    pointer-events: none;
}

.btn-primary:disabled i,
.btn-primary.disabled i {
    color: #e5eaf1;
}
.btn-danger {
    padding: 11px 18px;
    background: transparent;
    color: var(--red-tx);
    border: 1px solid var(--red-bd);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: all 0.15s;
}
.btn-danger:hover {
    background: var(--red-bg);
}

.progress-wrap {
    margin-top: 14px;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-4);
    margin-bottom: 6px;
}
.progress-bar {
    height: 4px;
    background: var(--bg-subtle);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 4px;
    animation: width 0.2s ease;
}


.zoom-btn {
    width: 100%;
    padding: 12px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: background 0.15s;
}
.zoom-btn:hover {
    background: #1d4ed8;
}

.zoom-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.divider {
    border: none;
    border-top: 1px solid #000;
    margin: 20px 0;
}

.output-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.output-row input {
    flex: 1;
    min-width: 160px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-1);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.output-row input:focus {
    border-color: var(--blue);
    background: #fff;
}
.process-btn {
    width: 100%;
    padding: 12px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: background 0.15s;
}
.process-btn:hover {
    background: var(--blue);
}
.process-btn:disabled,
.process-btn.disabled {
    background: #6c6e70;
    color: #e5eaf1;
    cursor: not-allowed;

    opacity: 0.75;
    box-shadow: none;
    pointer-events: none;
}
.process-btn:disabled i,
.process-btn.disabled i {
    color: #e5eaf1;
}


.custom-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    align-items: center; justify-content: center;
    padding: 24px;
}
.custom-modal {
    background: #fff;
    border-radius: var(--radius-xl);
    width: 100%; max-width: 980px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: modalIn 0.18s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(0.97) translateY(8px); } to { opacity:1; transform: none; } }

.custom-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.custom-modal-title { font-size: 16px; font-weight: 600; color: var(--text-1); }
.custom-modal-close {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-subtle);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-3); transition: all 0.15s;
}
.custom-modal-close:hover { background: var(--border); color: var(--text-1); }

.custom-modal-filters {
    display: flex; flex-direction: column; gap: 0;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.filter-row {
    display: flex; align-items: center;
    padding: 12px 24px; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.filter-row:last-child { border-bottom: none; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--text-3); width: 80px; flex-shrink: 0; }
.filter-row input, .filter-row select {
    flex: 1; background: var(--bg-subtle);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 8px 12px; font-size: 13px; color: var(--text-1);
    font-family: inherit; outline: none; transition: border-color 0.15s;
}
.filter-row input:focus, .filter-row select:focus { border-color: var(--blue); background: #fff; }
.filter-row select { cursor: pointer; }

/* Modal body: two-column */
.custom-modal-body {
    grid-template-columns: 260px 1fr;
    flex: 1; 
    overflow: hidden; 
    min-height: 0;
}

.sessions-list {
    border-right: 1px solid var(--border);
    overflow-y: auto; padding: 8px 0;
}
.session-item {
    padding: 11px 18px; cursor: pointer;
    font-size: 13px; color: var(--blue);
    border-left: 3px solid transparent;
    transition: all 0.12s; line-height: 1.4;
}
.session-item:hover { background: var(--blue-light); }
.session-item.active {
    background: var(--blue-light);
    border-left-color: var(--blue);
    color: var(--blue-dark); font-weight: 600;
}

.detail-pane {
    flex-direction: column;
    overflow: hidden; min-height: 0;
}

.meta-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.meta-cell {
    padding: 12px 16px; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 3px;
}
.meta-cell:last-child { border-right: none; }
.meta-key { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-4); }
.meta-val { font-size: 12.5px; color: var(--text-1); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-val.mono { font-family: 'Menlo','Consolas',monospace; font-size: 11px; color: var(--text-2); }

.meta-row2 {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.meta-row2 .meta-cell { padding: 10px 16px; }
.transcription-cell {
    grid-column: span 1;
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    border-right: 1px solid var(--border);
}
.transcription-cell label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-4); white-space: nowrap; }
.transcription-cell select {
    flex: 1; background: var(--bg-subtle); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 7px 10px; font-size: 12px;
    color: var(--text-1); font-family: inherit; outline: none;
}
.transcription-cell select:focus { border-color: var(--blue); }

.sub-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--border); flex-shrink: 0; padding: 0 16px;
}
.sub-tab {
    padding: 10px 16px; font-size: 13px; font-weight: 500; cursor: pointer;
    border: none; background: transparent; color: var(--text-3);
    font-family: inherit; border-bottom: 2px solid transparent;
    transition: all 0.15s; margin-bottom: -1px;
}
.sub-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.sub-tab:hover:not(.active) { color: var(--text-1); }

.files-table-wrap { flex: 1; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 10px 14px; text-align: left;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-4);
    background: var(--bg-subtle); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 12px 14px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-subtle); }
tbody tr.selected td { background: var(--blue-light); }
.check-cell { width: 40px; }
.check-cell input[type=checkbox] {
    width: 16px; height: 16px; cursor: pointer; accent-color: var(--blue);
}
.id-cell { font-family: 'Menlo','Consolas',monospace; font-size: 11.5px; color: var(--text-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
}
.ext-badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    background: var(--blue-light); color: var(--blue); border: 1px solid var(--blue-mid);
}
.size-cell { color: var(--text-3); font-size: 12px; }

.custom-modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 14px 24px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.btn-save {
    padding: 9px 22px; background: var(--blue); color: #fff;
    border: none; border-radius: var(--radius-md);
    font-size: 13px; font-weight: 600; cursor: pointer;
    font-family: inherit; transition: background 0.15s;
    display: flex; align-items: center; gap: 7px;
}
.btn-save:hover { background: var(--blue-dark); }

@media (max-width: 700px) {
    .custom-modal-body { grid-template-columns: 1fr; }
    .sessions-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 160px; }
    .meta-grid, .meta-row2 { grid-template-columns: 1fr 1fr; }
    .field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .manual-grid {
        grid-template-columns: 1fr;
    }
    .zoom-fields {
        grid-template-columns: 1fr;
    }
    .action-row {
        flex-direction: column;
    }
}