:root {
    --bg: #0d1117;
    --card: #161b22;
    --card-soft: #11161d;
    --border: #30363d;
    --border-strong: #484f58;
    --text: #f0f6fc;
    --muted: #8b949e;
    --green: #238636;
    --green-hover: #2ea043;
    --green-light: #7ee787;
    --blue: #58a6ff;
    --danger: #f85149;
    --content-width: 1180px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
}

body {
    min-width: 320px;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(45, 51, 59, 0.82);
    background: rgba(13, 17, 23, 0.9);
    backdrop-filter: blur(16px);
    transition: box-shadow 180ms ease, background-color 180ms ease;
}

.site-header.is-scrolled {
    background: rgba(13, 17, 23, 0.96);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.navbar {
    position: relative;
    width: min(calc(100% - 40px), var(--content-width));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.navbar__logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 720;
    letter-spacing: -0.025em;
}

.navbar__logo-mark {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    color: var(--green-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 15px;
    font-weight: 800;
}

.navbar__links {
    display: flex;
    align-items: center;
    gap: 3px;
}

.navbar__links a {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 8px 13px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 560;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.navbar__links a:hover,
.navbar__links a.is-active {
    background: var(--card);
    color: var(--text);
}

.navbar__links a.is-active:not(.navbar__signup) {
    border-color: var(--border);
}

.navbar__links .navbar__signup {
    margin-left: 8px;
    border-color: rgba(240, 246, 252, 0.08);
    background: var(--green);
    color: #fff;
}

.navbar__links .navbar__signup:hover,
.navbar__links .navbar__signup.is-active {
    background: var(--green-hover);
    color: #fff;
    transform: translateY(-1px);
}

.navbar__menu-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}

.navbar__menu-button span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 180ms ease, opacity 180ms ease;
}

.navbar__menu-button[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar__menu-button[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.navbar__menu-button[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.auth-page {
    min-height: calc(100vh - 73px);
    padding: 36px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-shell {
    width: min(100%, 460px);
}

.auth-shell--wide {
    width: min(100%, 760px);
}

.auth-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 30px;
    background: var(--card-soft);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.auth-header {
    margin-bottom: 26px;
    text-align: center;
}

.auth-header h1,
.auth-header h2 {
    margin-bottom: 8px;
    font-size: 28px;
    letter-spacing: -0.03em;
}

.auth-header p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 18px;
}

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

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

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

.form-field label {
    color: #c9d1d9;
    font-size: 13px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 13px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field input::placeholder {
    color: #6e7681;
}

.form-field input:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12);
}

.form-field input[readonly] {
    background: #0f141a;
    color: #b1bac4;
}

.form-field .code-input {
    letter-spacing: 0.28em;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 72px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 7px;
    padding: 6px 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.password-toggle:hover {
    background: var(--card);
    color: var(--text);
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 13px;
}

.form-row a:hover,
.auth-footer a:hover {
    color: var(--text);
}

.primary-button,
.secondary-button,
.google-button {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 650;
}

.primary-button {
    border: 1px solid rgba(240, 246, 252, 0.08);
    background: var(--green);
    color: #fff;
}

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

.secondary-button {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
}

.secondary-button:hover {
    border-color: var(--border-strong);
    background: #1b222c;
}

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

.google-button {
    border: 1px solid #d0d7de;
    background: #fff;
    color: #24292f;
}

.google-button:hover {
    background: #f6f8fa;
}

.google-icon {
    width: 18px;
    height: 18px;
}

.recovery-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 4, 9, 0.76);
    backdrop-filter: blur(5px);
}

.auth-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 470px);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 32px;
    background: #11161d;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56);
    animation: modal-in 160ms ease-out;
}

.auth-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
}

.auth-modal__close:hover {
    border-color: var(--border);
    background: var(--card);
    color: var(--text);
}

.auth-modal__header {
    margin: 4px 28px 26px;
}

.auth-modal__message {
    margin-top: 16px;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.divider::before,
.divider::after {
    height: 1px;
    background: var(--border);
    content: "";
}

.auth-footer {
    margin-top: 22px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.field-note,
.form-message {
    color: var(--muted);
    font-size: 12px;
}

.form-message {
    min-height: 18px;
    text-align: center;
}

.form-message.is-error {
    color: #ff7b72;
}

.form-message.is-success {
    color: #7ee787;
}

.cep-status {
    min-height: 16px;
    color: var(--muted);
    font-size: 12px;
}

.cep-status.is-error {
    color: #ff7b72;
}

@media (max-width: 780px) {
    .navbar {
        min-height: 68px;
    }

    .navbar__menu-button {
        display: flex;
    }

    .navbar__links {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        border: 1px solid var(--border);
        border-radius: 18px;
        padding: 10px;
        display: none;
        align-items: stretch;
        flex-direction: column;
        background: rgba(17, 22, 29, 0.98);
        box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
    }

    .navbar__links.is-open {
        display: flex;
    }

    .navbar__links a {
        border-radius: 12px;
        padding: 12px 14px;
    }

    .navbar__links .navbar__signup {
        margin: 6px 0 0;
        text-align: center;
    }
}

@media (max-width: 680px) {
    .auth-page {
        min-height: calc(100vh - 69px);
        align-items: flex-start;
        padding: 24px 14px;
    }

    .auth-card {
        padding: 24px 18px;
    }

    .auth-modal {
        align-items: end;
        padding: 12px;
    }

    .auth-modal__dialog {
        width: 100%;
        border-radius: 20px;
        padding: 28px 18px 22px;
    }

    .auth-modal__header {
        margin-left: 20px;
        margin-right: 20px;
    }

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

    .form-field--full {
        grid-column: auto;
    }
}

@media (max-width: 560px) {
    .navbar {
        width: min(calc(100% - 24px), var(--content-width));
    }
}
