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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(160deg, #f0fdfa 0%, #e8f5ef 50%, #f0f4f8 100%);
    color: #172033;
    min-height: 100vh;
}

a { color: #0f766e; text-decoration: none; font-weight: 600; }

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border: 1px solid #e5ebe8;
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 12px 40px rgba(23, 32, 51, 0.08);
}

.auth-card-wide {
    max-width: 520px;
}

.label-required::after {
    content: ' *';
    color: #dc2626;
    font-weight: 700;
}

.sponsor-name-box {
    margin: -8px 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.sponsor-name-box.is-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.sponsor-name-box.is-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.auth-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    width: auto;
    max-width: none;
}

.auth-brand img {
    display: block;
    width: 140px;
    height: 140px;
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
}

.auth-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
    text-align: center;
}

.auth-sub {
    color: #6b7280;
    margin-bottom: 24px;
    font-size: 14px;
    text-align: center;
}

.auth-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-card input,
.auth-card textarea,
.auth-card select {
    width: 100%;
    min-height: 46px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 14px;
    margin-bottom: 16px;
    font-size: 16px;
    background: #fff;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.auth-card textarea {
    min-height: 90px;
    padding: 12px 14px;
    resize: vertical;
}

.auth-card input:focus,
.auth-card textarea:focus,
.auth-card select:focus {
    outline: none;
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-btn {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #159447, #075985);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    position: relative;
    z-index: 1;
}

.auth-btn:hover { filter: brightness(1.05); }

.auth-btn-ghost {
    background: #fff;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.auth-forgot-row {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 14px;
    font-size: 13px;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

.auth-back {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.5;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* Account panel */
.account-body { background: #f8fafc; min-height: 100vh; }
.account-wrap { width: min(1100px, 92%); margin: 30px auto; }
.account-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.account-top img { height: 52px; }
.account-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 22px;
    align-items: start;
}
.account-sidebar,
.account-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}
.account-sidebar { padding: 18px; }
.account-sidebar a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: #334155;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}
.account-sidebar a.active,
.account-sidebar a:hover {
    background: #f0fdfa;
    color: #0f766e;
}
.account-panel { padding: 24px; }
.account-panel h1 { font-size: 28px; margin-bottom: 8px; }
.account-sub { color: #64748b; margin-bottom: 22px; font-size: 14px; }
.account-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.account-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    background: #fbfdff;
}
.account-card h3 { font-size: 16px; margin-bottom: 8px; }
.account-card p { color: #64748b; font-size: 13px; line-height: 1.6; }
.orders-table-wrap { overflow-x: auto; }
.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.orders-table th,
.orders-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}
.orders-table th { color: #64748b; font-size: 12px; text-transform: uppercase; }
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #dbeafe; color: #1d4ed8; }
.status-processing { background: #e0e7ff; color: #4338ca; }
.status-shipped { background: #cffafe; color: #0e7490; }
.status-delivered { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #b91c1c; }
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
}

.sidebar-divider {
    display: block;
    margin: 14px 0 8px;
    padding: 0 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

.section-title {
    font-size: 16px;
    margin: 24px 0 12px;
    color: #334155;
}

.wallet-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 8px;
}

.wallet-cards-main {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.wallet-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    background: #fbfdff;
}

.wallet-card span {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

.wallet-card strong {
    font-size: 18px;
    color: #0f766e;
}

.wallet-card-highlight {
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
    border-color: #99f6e4;
}

.wallet-card-sm strong { font-size: 15px; }

.plan-member-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.plan-member-meta div {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    background: #f8fafc;
}

.plan-member-meta span {
    display: block;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.plan-note {
    font-size: 13px;
    color: #64748b;
    margin: 12px 0;
    line-height: 1.6;
}

.withdraw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 8px;
}

.withdraw-panel {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    background: #fbfdff;
}

.withdraw-panel label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.withdraw-panel input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    margin-bottom: 14px;
    font-family: inherit;
}

@media (max-width: 850px) {
    .account-grid,
    .account-cards,
    .auth-row,
    .wallet-cards,
    .withdraw-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .auth-card { padding: 28px 20px; }
}

/* Registration success popup */
body.reg-modal-open { overflow: hidden; }

.reg-success-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.reg-success-modal.is-open {
    display: flex;
}

.reg-success-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.reg-success-card {
    position: relative;
    width: min(520px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px 24px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
    border: 1px solid #e2e8f0;
    max-height: 90vh;
    overflow-y: auto;
}

.reg-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #159447, #075985);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 800;
    margin: 0 auto 14px;
}

.reg-success-card h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 8px;
    color: #17202a;
}

.reg-success-sub {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 18px;
}

.reg-success-details {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.reg-success-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
}

.reg-success-item span {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
}

.reg-success-item strong {
    font-size: 18px;
    color: #0f766e;
    word-break: break-all;
}

.reg-success-item-highlight {
    background: #ecfdf5;
    border-color: #6ee7b7;
}

.reg-success-item-highlight strong {
    font-size: 20px;
    color: #047857;
}

.reg-copy-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.reg-success-note {
    font-size: 12px;
    color: #64748b;
    line-height: 1.7;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
}

.reg-success-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
