:root {
    color-scheme: light;
    --ink: #15251e;
    --muted: #68756e;
    --line: #dce4df;
    --surface: #ffffff;
    --soft: #f3f7f4;
    --green: #186b4c;
    --green-dark: #0f5239;
    --green-pale: #e5f4ec;
    --danger: #b42318;
    --success: #147a50;
    --shadow: 0 24px 70px rgba(25, 52, 40, 0.1);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #f7faf8;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 85% 8%, rgba(46, 139, 94, 0.1), transparent 28rem),
        #f7faf8;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 32px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 190px;
    height: auto;
}

.brand-logo-login {
    width: min(230px, 100%);
}

.brand-centered {
    justify-content: center;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 0 18px;
    font-weight: 700;
    transition: 160ms ease;
}

.button svg {
    width: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.button-ghost {
    border-color: var(--line);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.8);
}

.button-ghost:hover {
    border-color: #aebdb4;
    background: white;
}

.button-primary {
    color: white;
    background: var(--green);
}

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

.button-wide {
    width: 100%;
}

.generator-shell {
    display: grid;
    max-width: 1180px;
    min-height: 620px;
    grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
    margin: 34px auto 80px;
    overflow: hidden;
    border: 1px solid rgba(213, 224, 217, 0.9);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.editor-panel {
    padding: 68px 72px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

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

h1 {
    max-width: 520px;
    margin-bottom: 16px;
    font-size: clamp(36px, 4vw, 52px);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.lead {
    max-width: 520px;
    margin-bottom: 38px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.65;
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 0 0 32px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--soft);
}

.type-selector label {
    position: relative;
}

.type-selector input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.type-selector span {
    display: grid;
    min-height: 45px;
    place-items: center;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 700;
    transition: 160ms ease;
    cursor: pointer;
}

.type-selector input:checked + span {
    color: var(--green);
    background: white;
    box-shadow: 0 2px 9px rgba(20, 50, 36, 0.08);
}

.type-selector input:focus-visible + span {
    outline: 3px solid rgba(24, 107, 76, 0.25);
}

.field-group > label,
.login-form label {
    display: block;
    margin-bottom: 9px;
    font-size: 14px;
    font-weight: 750;
}

.field-group input,
.login-form input {
    width: 100%;
    height: 58px;
    border: 1px solid #cbd7d0;
    border-radius: 12px;
    outline: none;
    padding: 0 16px;
    color: var(--ink);
    background: white;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field-group input:focus,
.login-form input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(24, 107, 76, 0.1);
}

.field-group input::placeholder,
.login-form input::placeholder {
    color: #9ba8a1;
}

.field-footer {
    display: flex;
    min-height: 46px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding-top: 10px;
}

.field-message {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.field-message.is-error {
    color: var(--danger);
}

.field-message.is-success {
    color: var(--success);
}

.processing {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    color: var(--green);
    font-size: 12px;
    font-weight: 700;
}

.processing[hidden] {
    display: none;
}

.processing i {
    width: 13px;
    height: 13px;
    border: 2px solid #b8d9c9;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.qr-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 52px;
    background: var(--soft);
}

.qr-panel-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.qr-panel-heading h2 {
    margin-bottom: 0;
    font-size: 24px;
    letter-spacing: -0.03em;
}

.copy-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    border: 1px solid #c7d5cd;
    border-radius: 10px;
    padding: 0 13px;
    color: var(--green);
    background: white;
    font-size: 12px;
    font-weight: 800;
}

.copy-button:hover:not(:disabled) {
    border-color: var(--green);
}

.copy-button:disabled {
    color: #9aa69f;
    background: #edf1ee;
}

.copy-button.is-copied {
    border-color: #9ed1b8;
    color: var(--success);
    background: #edf9f2;
}

.copy-button svg {
    width: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.qr-stage {
    display: grid;
    min-height: 364px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: white;
}

#qr-canvas {
    display: block;
    width: 300px;
    height: 300px;
    max-width: calc(100% - 32px);
    object-fit: contain;
    image-rendering: pixelated;
}

#qr-canvas[hidden],
.qr-placeholder[hidden] {
    display: none;
}

.qr-placeholder {
    display: grid;
    max-width: 210px;
    place-items: center;
    color: #8a9991;
    text-align: center;
}

.qr-placeholder svg {
    width: 70px;
    margin-bottom: 18px;
    fill: none;
    stroke: #b2c1b8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.2;
}

.qr-placeholder p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.copy-message {
    min-height: 20px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.copy-message.is-error {
    color: var(--danger);
}

.copy-message.is-success {
    color: var(--success);
}

.login-page,
.error-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card,
.error-card {
    width: min(100%, 430px);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 42px;
    background: white;
    box-shadow: var(--shadow);
}

.login-heading {
    margin: 38px 0 28px;
    text-align: center;
}

.login-heading h1 {
    margin-bottom: 12px;
    font-size: 30px;
}

.login-heading > p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

.login-form input {
    height: 52px;
    margin-bottom: 20px;
}

.login-form .button {
    margin-top: 6px;
}

.alert {
    margin-bottom: 20px;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
}

.alert-error {
    color: #8e1c14;
    background: #fff0ee;
}

.error-card {
    text-align: center;
}

.error-code {
    color: var(--green);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.15em;
}

.error-card h1 {
    margin: 12px 0;
    font-size: 34px;
}

.error-card p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

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

@media (max-width: 920px) {
    .generator-shell {
        grid-template-columns: 1fr;
        margin: 20px 24px 60px;
    }

    .editor-panel,
    .qr-panel {
        padding: 48px;
    }
}

@media (max-width: 560px) {
    .site-header {
        padding: 20px;
    }

    .brand-logo {
        width: 155px;
    }

    .generator-shell {
        margin: 10px 14px 40px;
        border-radius: 20px;
    }

    .editor-panel,
    .qr-panel {
        padding: 32px 22px;
    }

    h1 {
        font-size: 36px;
    }

    .qr-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .qr-stage {
        min-height: 332px;
    }

    .login-card,
    .error-card {
        padding: 32px 24px;
    }
}
