:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --surface: #f7f9fb;
    --accent: #0f6b63;
    --accent-dark: #0a4f49;
    --danger: #b42318;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    background: #ffffff;
}

button, input { font: inherit; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px clamp(18px, 4vw, 54px);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand img {
    width: 156px;
    max-width: 42vw;
    height: auto;
}

.brand p, .brand h1 { margin: 0; }
.brand p { color: var(--muted); font-size: 14px; }
.brand h1 { font-size: clamp(24px, 3vw, 38px); line-height: 1.05; }
.limit { color: var(--muted); font-size: 14px; white-space: nowrap; }

.workspace {
    width: min(1180px, calc(100% - 36px));
    margin: 34px auto 42px;
}

.upload-panel {
    display: grid;
    gap: 18px;
    margin-bottom: 34px;
}

.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 190px;
    border: 2px dashed #aab7c4;
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
    cursor: pointer;
}

.dropzone strong { color: var(--ink); font-size: clamp(20px, 2.4vw, 28px); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.dragover { border-color: var(--accent); background: #edf7f5; transform: translateY(-1px); }

.progress-block { display: grid; gap: 8px; }
.progress-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.progress {
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: #e8edf2;
}

.progress > div {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width .2s ease;
}

.progress.indeterminate > div {
    width: 38%;
    animation: load 1.1s infinite ease-in-out;
}

@keyframes load {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(290%); }
}

.status { min-height: 22px; margin: 0; color: var(--muted); }
.status.error { color: var(--danger); }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 14px;
}

.section-head h2 { margin: 0 0 4px; font-size: 22px; }
.section-head p { margin: 0; color: var(--muted); }

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 15px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

button {
    border: 0;
    border-radius: 7px;
    padding: 9px 12px;
    background: #edf2f6;
    color: var(--ink);
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .55; }
.primary { background: var(--accent); color: white; padding: 12px 18px; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { color: var(--danger); }
.icon-btn { width: 38px; height: 38px; padding: 0; font-size: 26px; line-height: 1; }

.batch-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 22px;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 23, 42, .55);
    z-index: 10;
}

.modal[hidden] { display: none; }
.modal-shell, .convert-shell {
    width: min(980px, 100%);
    max-height: min(760px, calc(100vh - 44px));
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .24);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.preview-content { height: min(680px, calc(100vh - 130px)); background: #eef2f6; }
.preview-content iframe, .preview-content img { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; }

.convert-shell {
    width: min(520px, 100%);
    padding: 24px;
}

.stages {
    margin: 18px 0;
    padding-left: 22px;
    color: var(--muted);
}

.stages li { margin: 8px 0; }
.stages li.active { color: var(--accent-dark); font-weight: 700; }
.stages li.done { color: var(--ink); }
#elapsed { color: var(--muted); margin: 14px 0 0; }

@media (max-width: 720px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .limit { white-space: normal; }
    .section-head, .batch-actions { align-items: stretch; flex-direction: column; }
    .batch-actions .primary { width: 100%; }
}
