:root {
    --bg: #f3f6fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #63708a;
    --primary: #6d3df5;
    --primary-dark: #5128d6;
    --danger: #b42318;
    --danger-bg: #fff0ed;
    --line: #e5eaf3;
    --shadow: 0 18px 45px rgba(25, 36, 64, .10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 34px;
    border: 1px solid rgba(255,255,255,.8);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    letter-spacing: .04em;
    color: var(--primary);
    text-transform: uppercase;
}

.brand::before {
    content: "";
    width: 13px;
    height: 13px;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--primary), #ff5aa5);
    display: inline-block;
}

.brand.small {
    font-size: 13px;
}

h1 {
    margin: 12px 0 8px;
    font-size: 32px;
    line-height: 1.1;
}

h2 {
    margin: 0 0 20px;
}

.muted {
    color: var(--muted);
    margin-top: 0;
}

.form {
    margin-top: 24px;
    display: grid;
    gap: 12px;
}

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

input, select {
    width: 100%;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 14px;
    background: #fff;
    color: var(--text);
    font-size: 15px;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(109, 61, 245, .10);
}

button {
    height: 48px;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary), #9a66ff);
    color: white;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(109, 61, 245, .25);
}

button:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.alert {
    padding: 16px 18px;
    border-radius: 18px;
    margin: 0 0 18px;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #ffd3ca;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
}

.topbar {
    max-width: 1180px;
    margin: 28px auto 0;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.topbar p {
    color: var(--muted);
    margin-top: 6px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.user, .logout {
    background: rgba(255,255,255,.75);
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.logout:hover {
    color: var(--primary);
}

.container {
    max-width: 1180px;
    margin: 20px auto 60px;
    padding: 0 24px;
}

.card {
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(255,255,255,.92);
    box-shadow: var(--shadow);
    border-radius: 28px;
    padding: 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
}

.card.subtle {
    box-shadow: none;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.checkbox-field {
    grid-column: span 2;
    align-content: center;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input {
    width: 20px;
    height: 20px;
}

.checkbox-field small {
    color: var(--muted);
    line-height: 1.4;
}

.submit-row {
    display: flex;
    align-items: end;
}

.submit-row button {
    width: 100%;
}

.cards-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.mini-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 22px;
}

.mini-card b {
    display: block;
    font-size: 18px;
    margin-bottom: 6px;
}

.mini-card span {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    color: var(--primary);
    font-size: 13px;
}

.mini-card p {
    color: var(--muted);
    margin-bottom: 0;
}

ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

li + li {
    margin-top: 8px;
}

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
    }

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

    .checkbox-field {
        grid-column: span 1;
    }

    h1 {
        font-size: 28px;
    }
}


.full-field {
    grid-column: 1 / -1;
}

.shops-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.shop-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-weight: 800;
}

.shop-chip input {
    width: 18px;
    height: 18px;
}

.shop-chip.disabled {
    opacity: .55;
    background: #f8f9fc;
}

.shop-chip small {
    color: var(--danger);
    font-weight: 700;
}

.hint {
    color: var(--muted);
    line-height: 1.45;
}

.env-example {
    background: #0f172a;
    color: #dbeafe;
    border-radius: 18px;
    padding: 18px;
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,.08);
}

code {
    background: rgba(109, 61, 245, .08);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 7px;
}

.export-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    white-space: nowrap;
    overflow: hidden;
}

.export-btn .btn-text {
    display: inline-block;
}

.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, .45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wb-spin .8s linear infinite;
}

.export-btn.is-loading .btn-spinner {
    display: inline-block;
}

.export-btn.is-loading {
    cursor: wait;
    opacity: .92;
}

@keyframes wb-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}