:root {
    color-scheme: dark;
    --bg: #0d1110;
    --panel: #151c19;
    --panel-raised: #1c2521;
    --line: #33423b;
    --text: #edf4f0;
    --muted: #9eb0a7;
    --accent: #67d99b;
    --accent-strong: #89f2b7;
    --accent-ink: #07120c;
    --warning: #f3c96b;
    --warning-bg: #2b2416;
    --danger: #ff9c91;
    --done: #83d9ff;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% -10%, #19362a 0, transparent 34rem),
        var(--bg);
    color: var(--text);
    font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

button,
input,
.button-link {
    font: inherit;
}

button,
.button-link {
    border: 0;
    border-radius: 0.65rem;
    cursor: pointer;
    padding: 0.7rem 1rem;
    transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

button:hover:not(:disabled),
.button-link:hover {
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

code {
    color: var(--accent-strong);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

.shell {
    width: min(76rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3.5rem 0 2rem;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.25rem;
}

.login-card {
    display: grid;
    width: min(27rem, 100%);
    gap: 0.75rem;
    padding: clamp(1.4rem, 5vw, 2.2rem);
    border: 1px solid var(--line);
    border-radius: 1.2rem;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
    box-shadow: 0 2rem 5rem rgb(0 0 0 / 0.35);
}

.login-card h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 8vw, 3.2rem);
}

.login-card .lede {
    margin-bottom: 0.7rem;
}

.login-card label {
    font-weight: 700;
}

.login-card input {
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    outline: none;
    background: var(--bg);
    color: var(--text);
}

.login-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(103 217 155 / 0.12);
}

.masthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.6rem;
}

.button-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.button-link.secondary {
    border: 1px solid var(--line);
    background: var(--panel-raised);
    color: var(--text);
}

.button-link.secondary:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.eyebrow,
.step {
    margin: 0 0 0.3rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

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

h1 {
    max-width: 18ch;
    margin-bottom: 0.7rem;
    font-size: clamp(2.1rem, 6vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

h2 {
    margin-bottom: 0;
    font-size: 1.35rem;
}

h3 {
    margin-bottom: 0;
    font-size: 1.25rem;
    overflow-wrap: anywhere;
}

.lede {
    max-width: 48rem;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.local-badge,
.counter,
.status-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    white-space: nowrap;
}

.local-badge {
    padding: 0.45rem 0.7rem;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
}

.notice,
.panel {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.notice {
    margin-bottom: 1rem;
    padding: 1rem 1.2rem;
    border-color: #66552c;
    background: var(--warning-bg);
}

.notice h2 {
    margin-bottom: 0.35rem;
    color: var(--warning);
    font-size: 1rem;
}

.notice p {
    margin-bottom: 0;
    color: #dfd2ae;
}

.panel {
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 0.16);
}

.section-heading,
.work-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-heading {
    margin-bottom: 1rem;
}

.counter {
    padding: 0.35rem 0.65rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.muted {
    color: var(--muted);
}

.file-picker {
    display: grid;
    gap: 0.25rem;
    min-height: 6rem;
    margin: 1rem 0;
    padding: 1.2rem;
    border: 1px dashed var(--line);
    border-radius: 0.8rem;
    background: var(--panel-raised);
    cursor: pointer;
}

.file-picker:hover,
.file-picker:focus-within {
    border-color: var(--accent);
}

.file-picker-title {
    font-weight: 700;
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.proxy-panel form {
    display: grid;
    gap: 0.65rem;
}

.import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.proxy-panel label {
    font-weight: 700;
}

.proxy-panel textarea {
    width: 100%;
    min-height: 8rem;
    padding: 0.75rem 0.85rem;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    outline: none;
    background: var(--bg);
    color: var(--text);
    font: 0.86rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.proxy-panel textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(103 217 155 / 0.12);
}

.proxy-panel button {
    justify-self: start;
}

.row-proxy-select {
    width: min(17rem, 100%);
    padding: 0.48rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    outline: none;
    background: var(--panel-raised);
    color: var(--text);
}

.row-proxy-select:focus {
    border-color: var(--accent);
}

.primary {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 750;
}

.primary:hover:not(:disabled) {
    background: var(--accent-strong);
}

.secondary {
    border: 1px solid var(--line);
    background: var(--panel-raised);
    color: var(--text);
}

.secondary:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.empty-state {
    padding: 2.5rem 1rem;
    border: 1px dashed var(--line);
    border-radius: 0.8rem;
    color: var(--muted);
    text-align: center;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.8rem 0.7rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

td:first-child {
    overflow-wrap: anywhere;
}

tr.selected {
    background: rgb(103 217 155 / 0.07);
}

.row-action {
    padding: 0.45rem 0.7rem;
    background: transparent;
    color: var(--accent);
}

.status-pill {
    padding: 0.22rem 0.55rem;
    font-size: 0.75rem;
}

.status-pill.pending {
    color: var(--warning);
}

.status-pill.complete {
    border-color: #285469;
    color: var(--done);
}

.work-area {
    margin-top: 1.25rem;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--panel-raised);
}

.work-topline {
    align-items: flex-start;
    margin-bottom: 1rem;
}

.credential-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.instructions {
    margin: 1.25rem 0;
    padding-left: 1.3rem;
    color: var(--muted);
}

.instructions li + li {
    margin-top: 0.35rem;
}

.recovery-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.6rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line);
}

.recovery-form label {
    grid-column: 1 / -1;
    font-weight: 700;
}

.recovery-form input,
.recovery-form textarea {
    min-width: 0;
    padding: 0.72rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    outline: none;
    background: var(--bg);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.recovery-form textarea {
    resize: vertical;
}

.recovery-form input:focus,
.recovery-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(103 217 155 / 0.12);
}

.browser-panel {
    overflow: hidden;
}

.browser-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

kbd {
    padding: 0.08rem 0.3rem;
    border: 1px solid var(--line);
    border-radius: 0.3rem;
    background: var(--bg);
    color: var(--text);
    font: 0.85em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.browser-frame {
    width: 100%;
    min-height: 42rem;
    margin-top: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: #060807;
}

footer {
    padding: 1rem 0;
    color: var(--muted);
    font-size: 0.85rem;
}

footer p {
    margin-bottom: 0;
}

.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    max-width: min(28rem, calc(100% - 2.5rem));
    padding: 0.8rem 1rem;
    border: 1px solid #39664f;
    border-radius: 0.7rem;
    background: #17281f;
    box-shadow: 0 0.8rem 2.5rem rgb(0 0 0 / 0.4);
}

.toast.error {
    border-color: #71413b;
    background: #2b1b18;
    color: var(--danger);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 680px) {
    .shell {
        padding-top: 1.5rem;
    }

    .masthead,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions {
        justify-content: flex-start;
    }

    .browser-actions {
        justify-content: flex-start;
    }

    .panel {
        padding: 1rem;
    }

    .recovery-form {
        grid-template-columns: 1fr;
    }

    .recovery-form label {
        grid-column: 1;
    }

    .browser-frame {
        min-height: 32rem;
    }
}
