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

:root {
    --primary: #007AFF;
    --primary-dark: #0059c9;
    --bg: #F2F2F7;
    --card-bg: #FFFFFF;
    --text: #1C1C1E;
    --text-secondary: #8A8A8E;
    --danger: #FF3B30;
    --success: #34C759;
    --warning: #FF9500;
    --border: #E5E5EA;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Login screen ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-wrap { width: 100%; max-width: 400px; }

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.login-logo { font-size: 48px; margin-bottom: 12px; }

.login-card h1 { font-size: 22px; margin-bottom: 6px; }

.login-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

.login-form { text-align: left; }

.field { margin-bottom: 16px; }

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

.field input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: #F9F9FB;
}

.field input:focus { outline: none; border-color: var(--primary); }

.btn-primary {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
    cursor: pointer;
}

.btn-primary:active { background: var(--primary-dark); }

.alert-error {
    background: #FFEBEA;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* ---------- App shell ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(242,242,247,0.94);
    backdrop-filter: blur(10px);
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
    border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 20px; font-weight: 700; }

.content {
    padding: 16px 16px calc(90px + env(safe-area-inset-bottom, 0px));
    min-height: 100vh;
}

.loader {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 0;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 14px;
}

.empty-state .emoji { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- Order cards ---------- */
.order-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.order-name { font-size: 16px; font-weight: 600; }

.order-amount { font-size: 16px; font-weight: 700; color: var(--primary); }

.order-meta {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.order-meta svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

.order-note {
    font-size: 13px;
    color: var(--warning);
    background: #FFF6E9;
    padding: 8px 10px;
    border-radius: 8px;
    margin-top: 10px;
}

.order-date { font-size: 12px; color: var(--text-secondary); margin: 10px 0 12px; }

.btn-accept, .btn-deliver {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
}

.btn-accept { background: var(--success); }
.btn-deliver { background: var(--primary); margin-top: 10px; }

.btn-accept:active, .btn-deliver:active { opacity: 0.8; }

.btn-accept:disabled, .btn-deliver:disabled { background: #C7C7CC; }

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 10px;
}

.badge-progress { background: #FFF3E0; color: var(--warning); }
.badge-delivered { background: #E8F9EC; color: var(--success); }

/* ---------- Locked info ---------- */
.order-meta.locked {
    color: #B0B0B5;
    font-style: italic;
}

/* ---------- Balance card ---------- */
.balance-card {
    background: linear-gradient(135deg, var(--primary), #3F9BFF);
    border-radius: 18px;
    padding: 22px;
    text-align: center;
    color: #fff;
    margin-bottom: 16px;
}

.balance-label { font-size: 13px; opacity: 0.85; }

.balance-value { font-size: 26px; font-weight: 800; margin: 6px 0 16px; }

.btn-withdraw {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-withdraw:active { background: rgba(255,255,255,0.3); }

/* ---------- Menu list (Profil ichidagi bo'limlar) ---------- */
.menu-list {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 16px;
}

.menu-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.menu-row:last-child { border-bottom: none; }

.menu-row .chevron { color: var(--text-secondary); font-size: 18px; }

/* ---------- Back button ---------- */
.btn-back {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    padding: 8px 0 16px;
    cursor: pointer;
}

/* ---------- Withdraw form ---------- */
.form-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
}

/* ---------- Notifications ---------- */
.notif-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.notif-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 6px;
}

/* ---------- Login switch link ---------- */
.login-switch {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 18px;
}

.login-switch a { color: var(--primary); font-weight: 600; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    animation: fade-in 0.15s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    animation: slide-up 0.2s ease;
}

@keyframes slide-up { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (min-width: 600px) {
    .modal-overlay { align-items: center; }
    .modal-box { border-radius: 20px; }
}

.modal-box h3 { font-size: 17px; margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; }

.modal-actions { display: flex; gap: 10px; margin-top: 6px; }

.btn-ghost-modal {
    flex: 1;
    padding: 13px;
    background: #F2F2F7;
    color: var(--text);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.modal-actions .btn-primary { flex: 1; margin-top: 0; }

/* ---------- Profile photo upload ---------- */
.avatar-upload-wrap {
    position: relative;
    width: 76px;
    height: 76px;
    margin: 0 auto 12px;
}

.profile-avatar-img {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-edit-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

/* ---------- Profile ---------- */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 24px;
}

.profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.profile-name { font-size: 19px; font-weight: 700; }
.profile-username { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }

.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-box {
    flex: 1;
    background: var(--card-bg);
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
}

.stat-value { font-size: 17px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

.info-list {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value { font-weight: 500; }

.btn-logout {
    width: 100%;
    padding: 14px;
    background: #FFEBEA;
    color: var(--danger);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Bottom tab bar (iOS style) ---------- */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 0 calc(env(safe-area-inset-bottom, 0px) + 6px);
    z-index: 20;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    padding: 6px 0 2px;
    cursor: pointer;
}

.tab-item svg { width: 24px; height: 24px; }

.tab-item.active { color: var(--primary); }

@media (min-width: 600px) {
    .content { max-width: 480px; margin: 0 auto; }
    .tabbar > * { max-width: 480px; }
    .tabbar { justify-content: center; }
    .tabbar .tab-item { max-width: 160px; }
}
