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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6fa;
    color: #1f2937;
    min-height: 100vh;
}

.topbar {
    height: 60px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar h2 {
    font-size: 20px;
    color: #2563eb;
    margin: 0;
}

.menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    max-width: 38px;
    max-height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2563eb;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .2s;
}

.avatar:hover {
    transform: scale(1.05);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
}

.card {
    width: 100%;
    max-width: 460px;
    margin: 32px auto;
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .07);
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
}

button {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity .15s;
}

.card form button.btn-primary-full,
.card form button[type="submit"]:not(.btn-inline):not(.icon-btn) {
    width: 100%;
    padding: 10px 16px;
}

button:hover {
    opacity: .92;
}

.btn-secondary {
    background: #f3f4f6;
    color: #1f2937;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-inline {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    font-size: 13.5px;
    border-radius: 9px;
}

.profile-footer-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.profile-footer-actions form {
    margin: 0;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.auth-links {
    margin-top: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-avatar {
    width: 112px;
    height: 112px;
    max-width: 112px;
    max-height: 112px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #2563eb;
    display: block;
    margin: 0 auto 18px;
}

h1 {
    font-size: 26px;
    margin-bottom: 12px;
}

h2 {
    margin-bottom: 18px;
}

hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #e5e7eb;
}

.success-box {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
}

.error-box {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.board-card {
    background: #fff;
    padding: 18px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.board-card h3 {
    margin-bottom: 4px;
    font-size: 18px;
    word-break: break-word;
}

.board-meta {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.visibility-badge {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    width: fit-content;
}

.board-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.board-actions form {
    margin: 0;
}

.icon-btn {
    width: auto;
    padding: 6px 11px;
    font-size: 13px;
    border-radius: 8px;
}

.empty-state {
    background: #fff;
    padding: 36px;
    border-radius: 14px;
    text-align: center;
    color: #6b7280;
}

.community-badge {
    background: #ecfdf5;
    color: #047857;
}

.community-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.community-search-bar input {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.community-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.community-author img {
    width: 28px;
    height: 28px;
    max-width: 28px;
    max-height: 28px;
    min-width: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #cbd5e1;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: #9ca3af;
    font-size: 12px;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.google-auth-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.google-auth-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    text-decoration: none;
}

.community-sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.sort-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
}

.sort-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.sort-chip:hover {
    background: #f3f4f6;
    text-decoration: none;
}

.sort-chip.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.community-stats-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 6px 0 8px;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
}

.stat-pill.star {
    background: #fef3c7;
    color: #92400e;
}

@media (max-width: 768px) {
    .topbar {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }

    .card {
        width: 94%;
        margin: 18px auto;
        padding: 18px;
    }

    h1 {
        font-size: 22px;
    }
}

.user-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 46px;
    right: 0;
    width: 220px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    border: 1px solid #e5e7eb;
    padding: 6px;
    z-index: 2500;
}

.user-dropdown.show {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-header {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #1f2937;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.user-dropdown-item:hover {
    background: #f1f5f9;
    text-decoration: none;
}

.user-dropdown-item.danger {
    color: #dc2626;
}

.user-lang-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}

.aleboard-lang-select {
    width: auto !important;
    padding: 4px 8px !important;
    margin-bottom: 0 !important;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 12px;
}

.card-lang-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.card-lang-bar h2 {
    margin-bottom: 0;
}

.board-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.rename-inline-btn {
    padding: 4px 7px !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-radius: 7px !important;
    font-size: 13px !important;
    flex-shrink: 0;
}

.rename-inline-btn:hover {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
}

/* --- BRAND LOGO & PWA INSTALL --- */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.brand-lockup:hover {
    text-decoration: none;
}

.brand-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.card-brand-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.pwa-install-btn {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
}

.pwa-install-btn:hover {
    background: #dbeafe !important;
}

.pwa-install-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
    z-index: 6000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pwa-install-modal.open {
    display: flex;
}

.pwa-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.24);
    border: 1px solid #e2e8f0;
}

.pwa-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    padding: 0 !important;
    border-radius: 50%;
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 14px;
}

.pwa-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-right: 26px;
}

.pwa-modal-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
}

.pwa-modal-head h3 {
    margin: 0 0 3px;
    font-size: 18px;
    color: #0f172a;
}

.pwa-modal-head p {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

.pwa-modal-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
}

.pwa-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    line-height: 1.45;
    color: #1e293b;
}

.pwa-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.pwa-btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.pwa-btn-secondary {
    background: #f1f5f9;
    color: #1e293b;
}

.pwa-offline-pill {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6100;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.pwa-offline-pill.show {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-notebook {
    background: #7c3aed !important;
    color: #ffffff !important;
}

.btn-donate {
    background: #fef2f2 !important;
    color: #be123c !important;
    border: 1px solid #fecdd3 !important;
}

.notebook-badge {
    background: #f3e8ff;
    color: #6d28d9;
}

.policy-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
    max-width: 820px;
    margin: 0 auto;
}

.policy-lead {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 18px;
}

.policy-section {
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 12px;
}

.policy-section h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: #0f172a;
}

.policy-section p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: #334155;
}

.policy-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.ale-page-footer {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #64748b;
}

.ale-footer-link-btn {
    background: transparent !important;
    color: #be123c !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    font-weight: 600;
}

.ale-donor-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #f59e0b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.18);
}

.ale-donor-badge-pill.sm {
    padding: 2px 8px;
    font-size: 11px;
}

.ale-donor-card {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
    text-align: left;
}
