:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0E0E10;
    color: #F4F4F5;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: #0E0E10;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.download-link {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #26262B;
    border-radius: 6px;
    background: transparent;
    color: #F4F4F5;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease;
}

button:hover:not(:disabled),
.download-link:hover {
    background: #1E1E22;
}

button.primary {
    border-color: #7C3AED;
    background: #7C3AED;
    color: #FFFFFF;
}

button.primary:hover:not(:disabled) {
    border-color: #6D28D9;
    background: #6D28D9;
}

button.destructive {
    border-color: #EF4444;
    color: #EF4444;
}

button:disabled {
    cursor: not-allowed;
    color: #61616A;
    opacity: 0.75;
}

button.primary:disabled {
    border-color: #26262B;
    background: #1E1E22;
    color: #A1A1AA;
    opacity: 1;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #8B5CF6;
    outline-offset: 2px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #26262B;
    border-radius: 6px;
    background: #09090B;
    color: #F4F4F5;
}

input,
select {
    min-height: 40px;
    padding: 8px 10px;
}

textarea {
    min-height: 320px;
    padding: 14px;
    resize: vertical;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    tab-size: 4;
}

input::placeholder,
textarea::placeholder {
    color: #61616A;
}

label {
    display: block;
    margin-bottom: 7px;
    color: #F4F4F5;
    font-weight: 600;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
}

h2 {
    margin-bottom: 8px;
    font-size: 1.25rem;
}

h3 {
    margin-bottom: 10px;
    font-size: 1rem;
}

p,
li {
    color: #A1A1AA;
    line-height: 1.55;
}

.hidden {
    display: none !important;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    padding: 12px max(22px, calc((100vw - 1440px) / 2));
    border-bottom: 1px solid #26262B;
    background: #141416;
}

.site-title {
    color: #F4F4F5;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #A1A1AA;
    font-size: 0.875rem;
}

.page-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.status {
    min-height: 24px;
    margin-bottom: 16px;
    color: #A1A1AA;
}

.status.error,
.error-text {
    color: #EF4444;
}

.status.success {
    color: #10B981;
}

.signed-out-view {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: 18px;
}

.intro,
.auth-card,
.panel {
    border: 1px solid #26262B;
    border-radius: 7px;
    background: #17171A;
}

.intro {
    padding: clamp(24px, 5vw, 54px);
}

.intro ol {
    margin: 24px 0 0;
    padding-left: 22px;
}

.auth-card {
    padding: 24px;
}

.auth-card button {
    width: 100%;
    margin-top: 14px;
}

.supporting-copy,
.panel-heading p,
.section-heading p,
.empty-copy {
    margin-bottom: 0;
    color: #A1A1AA;
    font-size: 0.875rem;
}

.account-summary {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
}

.account-summary p {
    margin-bottom: 0;
}

.account-values {
    display: flex;
    gap: 28px;
}

.account-values div {
    display: grid;
    gap: 4px;
}

.account-values span {
    color: #A1A1AA;
    font-size: 0.8rem;
}

.notice {
    margin-bottom: 14px;
    padding: 11px 13px;
    border: 1px solid #26262B;
    border-radius: 6px;
}

.notice.warning {
    border-color: #EAB308;
    background: #EAB3081A;
    color: #EAB308;
}

.notice.error {
    border-color: #EF4444;
    background: #EF44441A;
    color: #EF4444;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.65fr);
    gap: 14px;
}

.panel {
    min-width: 0;
    padding: 18px;
}

.panel-heading,
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-heading h2,
.panel-heading h3,
.section-heading h2 {
    margin-bottom: 4px;
}

.input-tabs {
    display: flex;
    gap: 7px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #26262B;
}

.input-tabs button[aria-selected="true"] {
    border-color: #7C3AED;
    color: #A78BFA;
    background: #7C3AED1A;
}

.input-pane {
    margin-bottom: 16px;
}

#source-file {
    padding: 7px;
}

.submission-panel > .primary {
    margin-bottom: 10px;
}

.side-stack {
    display: grid;
    align-content: start;
    gap: 14px;
}

.compact-form {
    margin-bottom: 0;
}

.inline-form {
    display: flex;
    gap: 8px;
}

.inline-form input {
    min-width: 0;
}

.divider {
    height: 1px;
    margin: 20px 0;
    background: #26262B;
}

.purchase-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
}

.jobs-panel {
    margin-top: 14px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid #26262B;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #A1A1AA;
    font-weight: 600;
}

td {
    color: #F4F4F5;
}

td input,
td select {
    min-width: 105px;
}

.download-link {
    display: inline-flex;
    align-items: center;
}

.download-link.primary-link {
    border-color: #7C3AED;
    background: #7C3AED;
    color: #FFFFFF;
}

.download-link.primary-link:hover {
    border-color: #6D28D9;
    background: #6D28D9;
}

.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(14, 14, 16, 0.88);
}

.progress-dialog {
    width: min(440px, 100%);
    padding: 24px;
    border: 1px solid #26262B;
    border-radius: 7px;
    background: #17171A;
}

.progress-dialog:focus {
    outline: none;
}

.progress-dialog:focus-visible {
    outline: 2px solid #8B5CF6;
    outline-offset: 3px;
}

.progress-track {
    height: 9px;
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid #26262B;
    border-radius: 4px;
    background: #09090B;
}

.progress-fill {
    width: 0;
    height: 100%;
    background: #7C3AED;
}

.progress-fill.active {
    width: 34%;
    animation: job-progress 1.35s ease-in-out infinite;
}

.progress-fill.complete {
    width: 100%;
}

.progress-fill.failed {
    width: 100%;
    background: #EF4444;
}

.modal-message {
    margin: 16px 0 0;
}

.modal-message.error {
    color: #EF4444;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

@keyframes job-progress {
    from {
        transform: translateX(-110%);
    }

    to {
        transform: translateX(305%);
    }
}

.empty-copy {
    padding: 14px 0 4px;
}

.admin-console {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #26262B;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 400;
}

.checkbox-row input {
    width: 18px;
    min-height: 18px;
}

.generated-code {
    display: block;
    min-height: 24px;
    margin: 12px 0;
    overflow-wrap: anywhere;
    color: #A78BFA;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.record-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.record-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid #26262B;
    color: #A1A1AA;
    font-size: 0.8rem;
}

@media (max-width: 900px) {
    .signed-out-view,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .account-summary {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 14px 16px;
    }

    .account-header {
        width: 100%;
        flex-wrap: wrap;
    }

    .page-shell {
        padding: 16px;
    }

    .account-values {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .input-tabs {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .progress-dialog {
        padding: 20px;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .modal-actions > * {
        justify-content: center;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }

    .progress-fill.active {
        width: 55%;
        animation: none;
        transform: none;
    }
}
