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

:root {
    --primary: #0f4c81;
    --primary-dark: #0a355a;
    --accent: #c7a252;
    --bg-dark: #0b1118;
    --bg-card: #121b25;
    --bg-page: #0d151f;
    --text-primary: #f3f6fa;
    --text-secondary: #9ca9b8;
    --border-color: #233446;
    --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.d-none {
    display: none !important;
}

.public-app-content {
    width: 100%;
}

.public-offer-banner {
    display: none;
}

.public-offer-banner.active {
    display: block;
    max-width: 1400px;
    margin: 10px auto 0;
    padding: 10px 14px;
    border: 1px solid rgba(255, 173, 49, 0.45);
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(15, 76, 129, 0.22), rgba(199, 162, 82, 0.18));
    position: relative;
}

.public-offer-title {
    font-size: 13px;
    font-weight: 800;
    color: #ffcc70;
}

.public-offer-body {
    font-size: 12px;
    color: var(--text-primary);
    margin-top: 2px;
}

.public-offer-cta {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #0b1118;
    background: #ffad31;
    border-radius: 999px;
    padding: 6px 12px;
    text-decoration: none;
}

.public-offer-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-size: 12px;
}

.header {
    background: var(--bg-card);
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    height: 72px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.desktop-profile-btn {
    border: 1px solid rgba(255, 173, 49, 0.45);
    background: rgba(255, 173, 49, 0.12);
    color: #ffad31;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.desktop-auth-btn,
.desktop-logout-btn {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.desktop-auth-user {
    font-size: 11px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 7px 10px;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-menu-toggle svg {
    width: 20px;
    height: 20px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-nav-desktop {
    display: flex;
}

.mobile-drawer,
.mobile-drawer-overlay {
    display: none;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.header-nav a.active {
    color: var(--primary);
}

.auth-page-card {
    max-width: 520px;
    margin: 40px auto;
    background: linear-gradient(180deg, rgba(15, 76, 129, 0.28), rgba(11, 17, 24, 0.95));
    border: 1px solid rgba(35, 52, 70, 0.9);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.auth-page-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}

.auth-page-subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
    margin-bottom: 16px;
}

.auth-page-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.auth-page-tab {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.auth-page-tab.active {
    color: #ffad31;
    border-color: rgba(255, 173, 49, 0.45);
    background: rgba(255, 173, 49, 0.12);
}

.auth-page-message {
    min-height: 20px;
    color: #ffcc70;
    font-size: 12px;
    margin-bottom: 6px;
}

.auth-page-field {
    margin-bottom: 12px;
}

.auth-page-field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-page-field input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(11, 17, 24, 0.9);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
}

.auth-page-submit {
    width: 100%;
    border: 1px solid rgba(255, 173, 49, 0.45);
    border-radius: 12px;
    background: linear-gradient(120deg, #d69b2e, #ffbb4d);
    color: #111;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 11px 12px;
    cursor: pointer;
}

.search-container {
    position: relative;
}

.search-input {
    padding: 10px 16px 10px 42px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    width: 280px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-input:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.footer {
    background: var(--bg-card);
    padding: 24px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
}

.footer-logo img {
    height: 32px;
    width: auto;
}

.footer-logo-text {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 12px;
}

@media (max-width: 768px) {
    body {
        background: radial-gradient(circle at top, #111c2d 0%, #0b1118 38%, #090d14 100%);
    }

    .public-app-content {
        padding-bottom: calc(82px + env(safe-area-inset-bottom));
    }

    .public-offer-banner.active {
        margin: 8px 8px 0;
    }

    .header-content {
        padding: max(10px, env(safe-area-inset-top)) 12px 10px;
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .header-actions {
        margin-left: auto;
        width: auto;
        justify-content: flex-end;
        gap: 8px;
    }

    .header-nav-desktop,
    .header-search-desktop,
    .desktop-profile-btn {
        display: none !important;
    }

    .mobile-drawer {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        width: min(84vw, 360px);
        height: 100vh;
        padding: calc(env(safe-area-inset-top) + 64px) 12px calc(env(safe-area-inset-bottom) + 16px);
        background: rgba(11, 18, 30, 0.98);
        border-left: 1px solid var(--border-color);
        box-shadow: -16px 0 30px rgba(0, 0, 0, 0.5);
        transform: translateX(100%);
        transition: transform 0.24s ease;
        z-index: 1400;
        overflow-y: auto;
    }

    .mobile-drawer.active {
        transform: translateX(0);
    }

    .mobile-drawer-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(3, 6, 12, 0.6);
        z-index: 1390;
    }

    .mobile-drawer-overlay.active {
        display: block;
    }

.mobile-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    }

    .mobile-drawer-nav a {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        border-radius: 10px;
    }

    .mobile-drawer-action {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: rgba(255, 173, 49, 0.12);
        color: #ffad31;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-decoration: none;
        display: block;
    }

    .mobile-auth-user {
        display: block;
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-primary);
        font-size: 12px;
        font-weight: 600;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 10px;
    }

    .search-input {
        width: 100%;
        max-width: 100%;
        height: 40px;
        border-radius: 10px;
        padding-left: 38px;
    }

    .logo-img {
        height: 38px;
    }

    .logo-text {
        font-size: 12px;
        letter-spacing: 0.03em;
    }

    .mobile-drawer-search {
        width: 100%;
    }

    .footer {
        display: none;
    }
}

.auth-modal-overlay {
    display: none;
}

.auth-modal {
    display: none;
}

@media (max-width: 768px) {
    .auth-modal-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.62);
        z-index: 1470;
    }

    .auth-modal {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        min-height: 44vh;
        background: #0c1522;
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        transform: translateY(110%);
        transition: transform 0.22s ease;
        z-index: 1480;
        padding: 14px;
    }

    .auth-modal.active {
        transform: translateY(0);
    }
}

@media (min-width: 769px) {
    .auth-modal-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.62);
        z-index: 1470;
    }

    .auth-modal {
        display: block;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -40%);
        width: min(92vw, 420px);
        background: #0c1522;
        border: 1px solid var(--border-color);
        border-radius: 14px;
        z-index: 1480;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
        padding: 14px;
    }

    .auth-modal.active {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, -50%);
    }
}

.auth-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-modal-head h3 {
    font-size: 16px;
    margin: 0;
}

.auth-modal-close {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.auth-modal-tabs {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.auth-tab {
    border: 1px solid var(--border-color);
    background: #101a2a;
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
}

.auth-tab.active {
    border-color: #2d7fbd;
    color: #9fd4ff;
}

.auth-modal-body {
    margin-top: 10px;
}

.auth-message {
    font-size: 12px;
    color: var(--text-secondary);
    min-height: 16px;
    margin-bottom: 8px;
}

.auth-field {
    margin-bottom: 8px;
}

.auth-field label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.auth-field input {
    width: 100%;
    background: #0f1928;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 10px 11px;
}

.auth-submit-btn {
    width: 100%;
    border: 1px solid #2d7fbd;
    background: rgba(45, 127, 189, 0.18);
    color: #9fd4ff;
    border-radius: 9px;
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
}

.mobile-tabbar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-tabbar {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        align-items: center;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1300;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        background: rgba(6, 10, 16, 0.96);
        border-top: 1px solid var(--border-color);
        backdrop-filter: blur(8px);
    }

    .mobile-tabbar-item {
        appearance: none;
        border: 0;
        background: transparent;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 11px;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 6px 0;
        cursor: pointer;
    }

    .mobile-tabbar-item svg {
        width: 20px;
        height: 20px;
    }

    .mobile-tabbar-item.active {
        color: #ffad31;
    }

    .mobile-tabbar-item:focus {
        outline: none;
    }

    .mobile-tabbar-item:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }
}

.profile-sheet-overlay {
    display: none;
}

.profile-sheet {
    display: none;
}

@media (max-width: 768px) {
    .profile-sheet-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.62);
        z-index: 1450;
    }

    .profile-sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        min-height: 42vh;
        max-height: 70vh;
        background: #0c1522;
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        transform: translateY(110%);
        transition: transform 0.22s ease;
        z-index: 1460;
        padding: 14px;
    }

    .profile-sheet.active {
        transform: translateY(0);
    }

    .profile-sheet-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }

    .profile-sheet-head h3 {
        font-size: 16px;
        margin: 0;
    }

    .profile-sheet-close {
        border: 1px solid var(--border-color);
        background: transparent;
        color: var(--text-secondary);
        border-radius: 8px;
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .profile-sheet-message {
        font-size: 12px;
        color: var(--text-secondary);
        margin-bottom: 8px;
    }

    .profile-sheet-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow-y: auto;
        max-height: calc(70vh - 90px);
    }

    .profile-row {
        border: 1px solid var(--border-color);
        background: #101a2a;
        color: var(--text-primary);
        border-radius: 10px;
        text-align: left;
        padding: 10px 12px;
    }

    .profile-row.active {
        border-color: #ffad31;
        box-shadow: inset 0 0 0 1px rgba(255, 173, 49, 0.2);
    }

    .profile-row-name {
        display: block;
        font-size: 13px;
        font-weight: 700;
    }

    .profile-row-content {
        display: block;
    }

    .profile-row-meta {
        display: block;
        font-size: 11px;
        color: var(--text-secondary);
        margin-top: 2px;
    }

    .profile-row-delete {
        margin-left: auto;
        color: #ff7d7d;
        font-size: 11px;
        font-weight: 700;
        padding-left: 10px;
    }

    .profile-sheet-form {
        margin-top: 14px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }

    .profile-sheet-form h4 {
        margin: 0 0 8px;
        font-size: 13px;
    }

    .profile-form-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .profile-form-grid input {
        width: 100%;
        background: #0f1928;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 12px;
        padding: 9px 10px;
    }

    .profile-child-check {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: var(--text-secondary);
        margin: 8px 0;
    }

    .profile-add-btn {
        width: 100%;
        border: 1px solid #2d7fbd;
        background: rgba(45, 127, 189, 0.16);
        color: #9fd4ff;
        border-radius: 9px;
        padding: 9px 10px;
        font-size: 12px;
        font-weight: 700;
    }
}
