:root {
    --pink: #e91e8c;
    --pink-light: #fce4f3;
    --gold: #c9a227;
    --bg: #faf7f9;
    --card: #ffffff;
    --text: #2d2a2e;
    --muted: #7a757c;
    --border: #ece6ea;
    --success: #2e7d5a;
    --warning: #d4a017;
    --danger: #c62828;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(233, 30, 140, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--pink);
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pink);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: var(--muted);
    font-size: 0.95rem;
}

.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.loading-screen {
    text-align: center;
    padding: 4rem;
    color: var(--muted);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0.25rem 0 0;
}

.subtitle, .muted {
    color: var(--muted);
}

.back-link {
    font-size: 0.9rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.card h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.auth-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin-top: 0;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--muted);
}

.auth-social {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 4px;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

.btn-google {
    background: #fff;
    color: #333;
    border-color: #dadce0;
}

.btn-google:hover {
    background: #f8f9fa;
}

.btn-facebook {
    background: #1877f2;
    color: #fff;
}

.btn-facebook:hover {
    background: #166fe5;
    color: #fff;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
}

.btn-google .social-icon {
    color: #4285f4;
}

.btn-facebook .social-icon {
    background: rgba(255, 255, 255, 0.15);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border, #e5e7eb);
}

.auth-divider span {
    white-space: nowrap;
}

.auth-oauth-hint {
    font-size: 12px;
    line-height: 1.5;
    margin: 0 0 4px;
    text-align: center;
}

.auth-oauth-hint code {
    font-size: 11px;
    word-break: break-all;
}

.btn-social-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.2rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pink), #d4147a);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fdecea;
    color: var(--danger);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.project-card {
    display: block;
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: inherit;
    transition: transform 0.15s;
}

.project-card:hover {
    transform: translateY(-2px);
}

.project-card h3 {
    margin: 0 0 0.5rem;
}

.amount {
    color: var(--pink);
    font-weight: 700;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-bar.large {
    height: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pink), var(--gold));
    border-radius: 99px;
}

.progress-fill.warning {
    background: var(--warning);
}

.progress-fill.danger {
    background: var(--danger);
}

.dashboard-grid {
    display: grid;
    gap: 1rem;
}

.budget-numbers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.budget-numbers .label {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.budget-numbers strong {
    font-size: 1.1rem;
}

.budget-numbers .accent {
    color: var(--pink);
}

.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.category-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
    min-width: 90px;
    font-family: inherit;
}

.category-chip.active {
    border-color: var(--pink);
    background: var(--pink-light);
}

.items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.item-row.status-done,
.item-row.status-delivered {
    background: #eef8f2;
}

.item-row.status-reserved {
    background: #fff9e6;
}

.item-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.price {
    color: var(--pink);
    font-weight: 600;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    background: var(--border);
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.8rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.form-row .input {
    flex: 1;
    min-width: 120px;
}

.add-item-form {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 10px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    overflow-y: auto;
}

.modal {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    margin: auto;
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-actions-spacer {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

#blazor-error-ui {
    background: #ffffe0;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
}

.alert-success {
    background: #eef8f2;
    color: var(--success);
}

.deploy-done-banner {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 16px;
    border: 1px solid #b8e6c8;
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.deploy-card {
    max-width: 520px;
    margin: 2rem auto;
}

.deploy-progress {
    margin: 1rem 0;
}

.deploy-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.deploy-progress-track {
    height: 10px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.deploy-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pink), #f062b0);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.deploy-progress-percent {
    margin: 4px 0 0;
    font-size: 12px;
    text-align: left;
}

.deploy-log {
    margin-top: 1rem;
    padding: 1rem;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.5;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    direction: ltr;
    text-align: left;
}

.project-nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    padding-bottom: 0.25rem;
}

.nav-tab {
    padding: 0.55rem 1rem;
    border-radius: 99px;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-tab.active {
    background: var(--pink-light);
    color: var(--pink);
}

.nav-tab:hover {
    color: var(--pink);
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.card-title-row h2 {
    margin: 0;
}

.link-sm {
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-wide {
    max-width: 520px;
}

.modal-item-editor {
    max-width: 520px;
    padding: 0;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-editor-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    min-height: 0;
}

.modal-item-editor .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-item-editor .modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.modal-item-editor .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    min-height: 0;
}

.modal-item-editor .modal-footer {
    flex-shrink: 0;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--card);
    margin-top: 0;
}

.btn-icon {
    min-width: 2.25rem;
    padding: 0.35rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1;
}

.form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.input-sm {
    padding: 0.45rem 0.75rem;
    max-width: 140px;
}

.category-budget-row {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.category-budget-row:last-child {
    border-bottom: none;
}

.category-budget-row.over-budget {
    background: #fff5f5;
    margin: 0 -1.25rem;
    padding: 1rem 1.25rem;
}

.category-budget-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.category-budget-edit {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.badge-muted {
    background: var(--bg);
    color: var(--text-muted);
}

.budget-allocation-summary {
    margin-bottom: 1rem;
}

.budget-share-hint {
    min-width: 2.5rem;
    font-size: 0.85rem;
}

.badge-danger {
    background: #fdecea;
    color: var(--danger);
}

.invite-link-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background: var(--bg);
    padding: 0.75rem;
    border-radius: 10px;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.invite-link-box code {
    flex: 1;
    word-break: break-all;
    font-size: 0.85rem;
}

.filters-card {
    margin-bottom: 1rem;
}

.file-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    margin: 0;
}

.file-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
    width: 100%;
    height: 100%;
}

.item-row-subcategory,
.item-row-group {
    background: #fdf8fa;
    border-right: 3px solid var(--pink);
}

.item-progress {
    display: block;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.subcategory-icon,
.group-icon {
    margin-left: 0.35rem;
}

.item-subcategory-subtitle,
.item-group-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
}

.item-subcategory-plan,
.item-group-plan {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg);
    border-radius: 10px;
}

.card-inline {
    border: 1px solid var(--border);
}

.item-subcategory-actions,
.item-group-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.purchase-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.purchase-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
}

.purchase-row:hover {
    background: var(--bg);
}

.purchase-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.item-subcategory-total,
.item-group-total {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.empty-state.compact {
    padding: 1.5rem;
}

.form-hint {
    margin: -0.25rem 0 0.75rem;
    font-size: 0.85rem;
}

.category-manage-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-manage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-wrap: wrap;
}

.category-manage-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-manage-icon {
    font-size: 1.5rem;
}

.category-manage-info .muted {
    display: block;
    font-size: 0.85rem;
}

.category-manage-actions {
    display: flex;
    gap: 0.35rem;
}

.category-manage-edit {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
}

.category-manage-edit .input {
    flex: 1;
    min-width: 120px;
}

.input-icon {
    max-width: 80px;
    flex: 0 0 80px;
}

.item-subcategory-modal,
.item-group-modal {
    max-width: 560px;
}

.item-image-section {
    background: var(--bg);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 1rem;
}

.item-image-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 140px;
    max-height: 220px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.item-image-preview img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.item-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 120px;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: #fff;
}

.item-image-placeholder span:first-child {
    font-size: 2rem;
}

.item-image-upload {
    margin-bottom: 0;
}

.input-file {
    padding: 0.5rem;
    font-size: 0.85rem;
}

.input-date {
    direction: ltr;
    text-align: right;
}

@media (max-width: 520px) {
    .form-row-grid {
        grid-template-columns: 1fr;
    }

    .modal-item-editor,
    .item-editor-form {
        max-height: calc(100vh - 1rem);
    }

    .modal-item-editor .modal-footer {
        flex-wrap: wrap;
    }

    .modal-item-editor .modal-footer .btn-danger {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

.profile-card {
    text-align: center;
}

.profile-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.profile-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-link-profile {
    color: var(--muted);
    font-weight: 600;
}

.nav-link-profile:hover {
    color: var(--pink);
}

.countdown-card {
    background: linear-gradient(135deg, var(--pink-light), #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.countdown-card.countdown-soon {
    border-color: var(--pink);
    box-shadow: var(--shadow);
}

.countdown-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--pink);
    line-height: 1.2;
}

.countdown-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
}

.countdown-date {
    display: block;
    color: var(--muted);
    margin-top: 0.25rem;
}

.countdown-inline {
    color: var(--pink);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0.25rem 0 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.danger-zone {
    border-color: #f5c6cb;
}

.members-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.member-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.member-row:last-child {
    border-bottom: none;
}

.welcome-screen {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.welcome-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.welcome-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.welcome-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.welcome-dots .dot.active {
    background: var(--pink);
}

.welcome-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

@media (max-width: 640px) {
    .form-row-grid {
        grid-template-columns: 1fr;
    }

    .budget-numbers {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 1rem;
    }

    .project-nav {
        gap: 0.15rem;
    }

    .nav-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

.admin-users-table-wrap {
    overflow-x: auto;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.admin-users-table th,
.admin-users-table td {
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
    vertical-align: middle;
}

.admin-users-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.82rem;
}

.admin-users-table tr.is-selected {
    background: var(--pink-light);
}

.admin-check-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-admin {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-success {
    background: #e8f5e9;
    color: var(--success);
}

.badge-muted {
    background: #f0ecef;
    color: var(--muted);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
