:root {
    color-scheme: light;
    --bg: #f3f5f7;
    --surface: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --primary: #176b87;
    --primary-dark: #0f5369;
    --ready-bg: #e7f7ed;
    --ready-text: #146c43;
    --downloading-bg: #fff4da;
    --downloading-text: #916600;
    --queued-bg: #e9f1ff;
    --queued-text: #2459a8;
    --error-bg: #fdecec;
    --error-text: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.workspace {
    display: grid;
    gap: 24px;
}

.public-page {
    display: grid;
    gap: 16px;
    width: min(720px, 100%);
    margin: 14vh auto 0;
}

.public-page p:not(.eyebrow) {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.6;
}

.page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 36px;
    line-height: 1.1;
}

.status-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: var(--surface);
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.download-form,
.table-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(22, 34, 51, 0.06);
}

.download-form {
    display: grid;
    gap: 10px;
    padding: 20px;
}

label {
    font-size: 14px;
    font-weight: 700;
}

.input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

input {
    min-width: 0;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 14px;
    color: var(--text);
    font: inherit;
}

input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(23, 107, 135, 0.16);
}

button {
    height: 44px;
    border: 0;
    border-radius: 6px;
    padding: 0 18px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

button:hover {
    background: var(--primary-dark);
}

.primary-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 104px;
    height: 44px;
    border-radius: 6px;
    padding: 0 18px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

.primary-link-button:hover {
    background: var(--primary-dark);
}

#quota-error.form-error {
    display: block;
    min-height: 18px;
    margin: 0;
    color: var(--error-text);
    font-size: 13px;
    font-weight: 700;
}

.table-panel {
    overflow: hidden;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

th,
td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafc;
    color: #344054;
    font-size: 13px;
    font-weight: 800;
}

td strong,
td span {
    display: block;
}

td span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

td a {
    color: var(--primary);
    overflow-wrap: anywhere;
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.link-actions {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(188px, max-content) 34px;
    gap: 8px;
}

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

.action-message {
    min-width: 188px;
}

td a.table-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #ffffff;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

td a.table-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

td a.table-button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

td a.table-button-primary:hover {
    background: var(--primary-dark);
    color: #ffffff;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0;
    background: #ffffff;
    color: var(--muted);
    font-size: 24px;
    font-weight: 700;
    line-height: 0;
}

.icon-button:hover {
    border-color: var(--error-text);
    background: var(--error-bg);
    color: var(--error-text);
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    min-width: 104px;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 800;
}

.badge-ready {
    background: var(--ready-bg);
    color: var(--ready-text);
}

.badge-downloading {
    background: var(--downloading-bg);
    color: var(--downloading-text);
}

.badge-queued {
    background: var(--queued-bg);
    color: var(--queued-text);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.empty {
    color: var(--muted);
    text-align: center;
}

@media (max-width: 680px) {
    .shell {
        width: min(100% - 20px, 1080px);
        padding: 28px 0;
    }

    .page-header {
        align-items: start;
        flex-direction: column;
    }

    h1 {
        font-size: 30px;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    button {
        width: 100%;
    }

    .icon-button {
        width: 34px;
    }
}
