:root {
    --bg: #090909;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-strong: rgba(255, 255, 255, 0.1);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f5f5f2;
    --muted: #a9aca5;
    --ok: #d4ffd0;
    --ok-bg: rgba(64, 126, 57, 0.18);
    --error: #ffd2d2;
    --error-bg: rgba(140, 39, 39, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 28%),
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.05), transparent 24%),
        var(--bg);
    color: var(--text);
    font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
}

code {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    color: #ffffff;
}

.no-break {
    white-space: nowrap;
}

.noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(circle at center, black 45%, transparent 100%);
}

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

.site-footer {
    padding: 0 0 26px;
    text-align: center;
}

.site-footer a {
    color: var(--muted);
    font-size: 0.88rem;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text);
}

.header-row,
.grid {
    display: grid;
    gap: 20px;
}

.header-row {
    grid-template-columns: 1fr auto;
    align-items: start;
    margin-bottom: 24px;
}

.grid {
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 24px;
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.brand-lockup {
    margin-bottom: 18px;
}

.brand-lockup-centered {
    display: flex;
    justify-content: center;
}

.brand-lockup-inline {
    margin-bottom: 14px;
}

.brand-logo {
    display: block;
    width: 92px;
    height: 92px;
    object-fit: contain;
    filter:
        drop-shadow(0 0 1px rgba(255, 255, 255, 0.95))
        drop-shadow(0 0 14px rgba(255, 255, 255, 0.18))
        drop-shadow(0 12px 24px rgba(0, 0, 0, 0.3));
}

.login-panel {
    width: min(460px, 100%);
    margin: 10vh auto 0;
}

.eyebrow {
    color: var(--muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.72rem;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    margin-top: 10px;
    font-size: clamp(2rem, 5vw, 3.3rem);
    line-height: 0.95;
}

h2 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.lede {
    margin-top: 12px;
    color: var(--muted);
    max-width: 62ch;
}

.stack {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

label {
    display: grid;
    gap: 8px;
}

label span {
    font-size: 0.92rem;
    color: var(--muted);
}

input,
textarea,
button {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 14px 16px;
    font: inherit;
}

input,
textarea {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 130px;
}

button {
    cursor: pointer;
    background: #f5f5f2;
    color: #0a0a0a;
    border-color: #f5f5f2;
    font-weight: 600;
    transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
    transform: translateY(-1px);
}

button.ghost {
    width: auto;
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}

button.danger {
    width: auto;
    padding: 10px 14px;
    background: rgba(140, 39, 39, 0.18);
    color: var(--error);
    border-color: rgba(214, 110, 110, 0.25);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
}

.icon-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
}

.flash-success {
    background: var(--ok-bg);
    color: var(--ok);
}

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

.history {
    display: grid;
    gap: 12px;
    max-height: 70vh;
    overflow: auto;
}

.history-item {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.history-item.ok {
    border-color: rgba(112, 198, 112, 0.25);
}

.history-item.error {
    border-color: rgba(214, 110, 110, 0.25);
}

.history-top,
.history-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.history-top span,
.history-meta,
.empty {
    color: var(--muted);
    font-size: 0.9rem;
}

.history-item p {
    margin: 10px 0 12px;
    line-height: 1.5;
}

.history-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .shell {
        width: min(100%, calc(100% - 24px));
        padding: 24px 0 40px;
    }

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

    .header-row {
        gap: 14px;
        margin-bottom: 18px;
    }

    .panel {
        padding: 20px;
        border-radius: 20px;
    }

    .login-panel {
        margin-top: 6vh;
    }

    .brand-logo {
        width: 76px;
        height: 76px;
    }

    .history {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100%, calc(100% - 18px));
        padding: 16px 0 28px;
    }

    .panel {
        padding: 16px;
        border-radius: 18px;
    }

    .brand-logo {
        width: 68px;
        height: 68px;
    }

    h1 {
        font-size: clamp(1.8rem, 11vw, 2.5rem);
    }

    .eyebrow {
        letter-spacing: 0.12em;
        font-size: 0.68rem;
    }

    .lede {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .stack {
        gap: 12px;
        margin-top: 18px;
    }

    input,
    textarea,
    button {
        padding: 13px 14px;
        border-radius: 14px;
    }

    button.ghost {
        width: 100%;
    }

    .header-row form {
        width: 100%;
    }

    .no-break {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .history-item {
        padding: 14px;
    }

    .history-top,
    .history-meta {
        gap: 8px;
    }

    .history-top span,
    .history-meta,
    .empty {
        font-size: 0.82rem;
    }

    .history-actions {
        margin-top: 10px;
    }

    .icon-button {
        width: 36px;
        height: 36px;
    }

    .site-footer {
        padding: 0 0 18px;
    }
}
