/* 1. Theme colors and base layout. */
:root {
    --brand: #127b66;
    --brand-dark: #095b4b;
    --brand-soft: #e7f5ef;
    --ink: #1c3040;
    --muted: #6b7e89;
    --line: #e1e8e7;
    --page: #f4f7f6;
    --radius: 16px;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        'Segoe UI',
        sans-serif;
    color: var(--ink);
    background: var(--page);
}

* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
a {
    color: var(--brand);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
button,
input,
select {
    font: inherit;
}
button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}
[hidden] {
    display: none !important;
}

/* 2. Top navigation and page layout. */
.topbar {
    height: 80px;
    padding: 0 max(24px, calc((100vw - 1200px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 750;
    font-size: 19px;
    color: var(--ink);
}
.brand-icon {
    background: var(--brand);
    color: #fff;
    border-radius: 11px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 27px;
}
.top-label {
    color: var(--muted);
    font-size: 13px;
}
.container {
    max-width: 1248px;
    margin: 0 auto;
    padding: 38px 24px;
}
.page-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}
.eyebrow {
    color: var(--brand);
    font-size: 11px;
    letter-spacing: 1.8px;
    font-weight: 750;
}
h1 {
    font-size: clamp(28px, 3.6vw, 40px);
    margin: 10px 0;
    letter-spacing: -1.2px;
    overflow-wrap: anywhere;
}
h2 {
    font-size: 18px;
    margin: 0 0 7px;
}
h3 {
    margin: 20px 0 7px;
    font-size: 20px;
}
p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    margin: 0;
}
.back-link {
    display: inline-block;
    font-size: 13px;
    margin-bottom: 23px;
}
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.pill {
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 650;
    white-space: nowrap;
}
.muted {
    color: #6b737b;
    background: #edf0f1;
}
.muted-text {
    color: var(--muted);
}
.footer {
    padding: 20px 24px 40px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* 3. New batch form. */
.create-card,
.setup-card {
    padding: 28px;
}
.card-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 25px;
}
.step-icon {
    font-size: 25px;
    background: var(--brand-soft);
    color: var(--brand);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
}
.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
    gap: 16px;
}
label {
    font-size: 12px;
    font-weight: 650;
}
input:not([type='file']),
select {
    width: 100%;
    padding: 12px;
    margin-top: 9px;
    border: 1px solid #cfdbd7;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
}
input:focus,
select:focus {
    outline: 2px solid #68ac98;
    outline-offset: 2px;
}
.form-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
}
.form-bottom p {
    font-size: 12px;
}
.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 9px;
    font-weight: 650;
    font-size: 13px;
    cursor: pointer;
}
.button:hover {
    text-decoration: none;
    background: #f0f6f3;
}
.button.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.button.primary:hover {
    background: var(--brand-dark);
}
.button.secondary {
    border-color: #bad9cd;
    color: var(--brand);
}
.button.small {
    padding: 9px 12px;
    font-size: 12px;
}
.button:disabled {
    opacity: 0.45;
    cursor: default;
}
.notice {
    padding: 15px 18px;
    border-radius: 10px;
    background: #fff2e5;
    color: #8b501b;
    margin: 18px 0;
    font-size: 13px;
    overflow-wrap: anywhere;
}
.notice.success {
    background: var(--brand-soft);
    color: var(--brand-dark);
}
.setup-card li {
    margin: 16px 0;
    line-height: 1.7;
}
code {
    font-size: 13px;
    background: #f0f4f2;
    padding: 3px 5px;
    overflow-wrap: anywhere;
}

/* 4. Batch cards and statistics. */
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 30px 0 18px;
}
.section-heading > span {
    color: var(--muted);
    font-size: 12px;
}
.batch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.batch-card {
    display: block;
    padding: 24px;
    color: var(--ink);
    transition:
        border-color 0.2s,
        transform 0.2s;
}
.batch-card:hover {
    border-color: #82b9a6;
    transform: translateY(-2px);
    text-decoration: none;
}
.batch-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.folder-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #f1f8f4;
    font-size: 29px;
    border-radius: 12px;
}
.batch-card h3 {
    overflow-wrap: anywhere;
}
.batch-date {
    font-size: 11px;
}
.batch-numbers {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 8px;
    margin: 22px 0;
}
.batch-numbers strong {
    font-size: 17px;
    display: block;
}
.batch-numbers span {
    color: var(--muted);
    font-size: 10px;
    display: block;
    margin-top: 5px;
}
.batch-link {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 17px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 650;
}
.empty {
    text-align: center;
    padding: 55px 24px;
}
.empty-icon {
    color: #87b6a6;
    font-size: 42px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 24px 0;
}
.stat {
    padding: 22px;
}
.stat span {
    color: var(--muted);
    font-size: 12px;
    display: block;
}
.stat strong {
    display: block;
    font-size: 25px;
    margin-top: 12px;
    letter-spacing: -0.7px;
}

/* 5. Drop zone and upload queue. */
.upload-card {
    padding: 24px;
}
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 35px 20px;
    border: 2px dashed #bfd8cd;
    background: #fbfdfb;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
}
.dropzone.active,
.dropzone:focus-within {
    border-color: var(--brand);
    background: #edf8f0;
}
.dropzone input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.dropzone strong {
    font-size: 18px;
}
.dropzone span:not(.drop-icon),
.dropzone small {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}
.drop-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 30px;
}
.upload-help {
    display: flex;
    align-items: center;
    gap: 25px;
    justify-content: space-between;
    margin: 18px 0;
}
.upload-help p {
    font-size: 12px;
}
.settings-summary {
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}
.queue-card,
.result-card {
    padding: 24px;
    margin-top: 24px;
}
.queue-card .section-heading,
.result-card .section-heading {
    margin-top: 0;
}
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.queue-item {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 160px 2fr;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}
.queue-item strong {
    overflow-wrap: anywhere;
}
.queue-item progress {
    width: 100%;
    height: 8px;
    accent-color: var(--brand);
}
.queue-item span {
    color: var(--muted);
    overflow-wrap: anywhere;
}
.queue-item.failed span {
    color: #b5482c;
}

/* 6. Persisted image table. */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 12px;
}
th {
    color: var(--muted);
    font-weight: 550;
    white-space: nowrap;
}
th,
td {
    padding: 15px 10px;
    border-bottom: 1px solid #edf1ef;
    text-align: left;
}
td:first-child {
    min-width: 150px;
    max-width: 260px;
    overflow-wrap: anywhere;
}
td small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 5px;
    overflow-wrap: anywhere;
}
.status {
    display: inline-block;
    padding: 5px 8px;
    background: #f0f3f2;
    color: #687b74;
    border-radius: 6px;
    white-space: nowrap;
}
.status.completed {
    background: var(--brand-soft);
    color: var(--brand);
}
.status.failed,
.status.interrupted {
    background: #fff0e8;
    color: #a55628;
}
.status.processing {
    background: #eaf2fd;
    color: #42678b;
}
.search {
    max-width: 340px;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 20px 0 0;
}

/* 7. Tablet and mobile layout. */
@media (max-width: 1000px) {
    .form-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .form-grid .wide {
        grid-column: 1 / -1;
    }
    .batch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .topbar {
        height: 68px;
        padding: 0 18px;
    }
    .top-label {
        display: none;
    }
    .container {
        padding: 25px 16px;
    }
    .page-intro,
    .form-bottom,
    .upload-help,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
    .batch-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat {
        padding: 17px;
    }
    .stat strong {
        font-size: 21px;
    }
    .create-card,
    .upload-card,
    .queue-card,
    .result-card {
        padding: 20px;
    }
    .queue-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .form-bottom .button {
        width: 100%;
    }
}
