/* KapGelsin — Ana renk: #28a745 */
:root,
[data-theme="dark"] {
    --brand: #28a745;
    --brand-dark: #1e7e34;
    --brand-light: #d4edda;
    --brand-rgb: 40, 167, 69;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: var(--brand);
    --primary-dark: var(--brand-dark);
    --primary-light: var(--brand-light);
    --success: var(--brand);
    --warning: #eab308;
    --danger: #ef4444;
    --info: #3b82f6;
    --border: #334155;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,.35);
    --header-bg: rgba(15,23,42,.92);
    --nav-bg: rgba(15,23,42,.95);
    --overlay-bg: rgba(15,23,42,.7);
    --auth-gradient: linear-gradient(160deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    --input-bg: var(--bg);
    --on-primary: #fff;
    --header-h: 56px;
    --nav-h: 64px;
    --sidebar-w: 240px;
    --desktop-dock-h: 88px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    accent-color: var(--brand);
}

[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-elevated: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 24px rgba(15,23,42,.08);
    --header-bg: rgba(255,255,255,.92);
    --nav-bg: rgba(255,255,255,.95);
    --overlay-bg: rgba(15,23,42,.45);
    --auth-gradient: linear-gradient(160deg, #f8fafc 0%, #e8f5e9 50%, #f1f5f9 100%);
    --input-bg: #ffffff;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Logo — yuvarlak gorunum (tum sayfalarda) */
img.brand-logo,
img.landing-logo,
img.footer-logo,
img.auth-side-logo,
img.hero-logo-img,
img.auth-mobile-logo,
.auth-mobile-brand img {
    border-radius: 50%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    image-rendering: auto;
    background: #fff;
    box-shadow: 0 2px 12px rgba(var(--brand-rgb), .18);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea {
    font-family: inherit;
    font-size: 16px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .25);
}

.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    min-width: 0;
    overflow: hidden;
    border-radius: 50%;
}

.brand-logo {
    height: 40px;
    width: 40px;
    max-height: 40px;
    max-width: 40px;
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Header nav — sadece masaustu (mobilde alt menu) */
.header-nav {
    display: none !important;
}

.header-nav-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-muted);
    white-space: nowrap;
    transition: background .2s, color .2s;
    text-decoration: none;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.header-nav-item + .header-nav-item {
    margin-left: 4px;
}

.header-nav-item:hover {
    color: var(--text);
    background: var(--bg-elevated);
    border-color: var(--border);
}

.header-nav-item.active {
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
    border-color: var(--primary);
}

.courier-map-mode .map-header {
    display: none;
}

/* Tek profil avatar — chip disindaki yinelenen A gizlenir */
.header-actions > .user-avatar { display: none !important; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--bg-card);
    border-radius: 999px;
    font-size: .85rem;
    max-width: calc(100vw - 200px);
}

.user-chip .user-avatar {
    display: flex !important;
    flex-shrink: 0;
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

@media (min-width: 480px) {
    .user-name { max-width: 160px; }
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .8rem;
    color: var(--on-primary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background .2s, color .2s;
}
.btn-icon:hover { background: var(--bg-card); color: var(--text); }

.app-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    height: calc(var(--nav-h) + var(--safe-bottom));
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: .65rem;
    font-weight: 500;
    padding: 6px 2px;
    min-height: 48px;
    min-width: 0;
    transition: color .2s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .nav-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bottom-nav:has(.bottom-nav-item:nth-child(5)) .bottom-nav-item {
    font-size: .58rem;
    padding: 6px 1px;
}

.bottom-nav:has(.bottom-nav-item:nth-child(5)) .nav-icon {
    font-size: 1.2rem;
}

.bottom-nav:has(.bottom-nav-item:nth-child(4)) .bottom-nav-item {
    font-size: .6rem;
}

.bottom-nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.35rem; line-height: 1; }

/* Auth page */
.auth-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--auth-gradient);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .emoji { font-size: 3rem; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; }
.auth-logo p { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

label.required {
    color: var(--danger);
    font-weight: 600;
}

label.required::after {
    content: ' *';
}

input.field-error,
textarea.field-error,
select.field-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
}

.form-group.field-error-group label.required {
    color: #f87171;
}

.role-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.role-tab {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 500;
    text-align: center;
    transition: all .2s;
}

.role-tab.active {
    background: rgba(var(--brand-rgb), .15);
    border-color: var(--primary);
    color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .95rem;
    transition: transform .15s, background .2s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary.btn-block,
form .btn-primary { width: 100%; }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
}
.btn-secondary:hover { background: var(--bg-elevated); }

.btn-success { background: var(--success); color: var(--on-primary); }
.btn-danger { background: var(--danger); color: var(--on-primary); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-block { width: 100%; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

/* Cards & stats */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    font-size: .9rem;
    margin-top: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: .95rem;
}

.card-body { padding: 16px; }

/* Order cards */
.order-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color .2s;
}

.order-card:active { border-color: var(--primary); }

.order-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.order-id { font-weight: 700; font-size: .95rem; }
.order-meta { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-warning { background: rgba(234,179,8,.2); color: var(--warning); }
.badge-info { background: rgba(59,130,246,.2); color: var(--info); }
.badge-primary { background: rgba(var(--brand-rgb), .2); color: var(--primary); }
.badge-success { background: rgba(34,197,94,.2); color: var(--success); }
.badge-danger { background: rgba(239,68,68,.2); color: var(--danger); }
.badge-secondary { background: var(--bg-elevated); color: var(--text-muted); }

.order-address {
    font-size: .85rem;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.order-items {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.order-total { font-weight: 700; color: var(--primary); }

.order-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Scan page */
.scan-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    margin-bottom: 16px;
}

.scan-zone:hover, .scan-zone.dragover {
    border-color: var(--primary);
    background: rgba(var(--brand-rgb), .05);
}

.scan-zone .scan-icon { font-size: 2.5rem; margin-bottom: 8px; }
.scan-zone p { color: var(--text-muted); font-size: .9rem; }

.preview-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: var(--bg);
}

.items-editor { margin-bottom: 16px; }

.item-row {
    display: grid;
    grid-template-columns: 1fr 60px 80px 36px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.item-row input { padding: 8px 10px; font-size: .85rem; }

.btn-remove {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(239,68,68,.15);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Map */
.map-container {
    height: 280px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.map-container.full { height: calc(100dvh - var(--header-h) - var(--nav-h) - 48px); }

/* Pull-to-refresh / overscroll kilidi — kurye tam ekran harita */
html.map-scroll-lock,
body.map-scroll-lock,
body.courier-map-mode {
    overscroll-behavior: none;
    overflow: hidden;
    height: 100%;
    width: 100%;
    position: fixed;
}

body.courier-map-mode .app-shell {
    height: 100dvh;
    overflow: hidden;
}

body.courier-map-mode .courier-map-main {
    overflow: hidden;
    touch-action: none;
}

.kapgelsin-map.leaflet-container,
.leaflet-container.kapgelsin-map {
    background: #d9e3e8;
    font-family: var(--font);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

[data-theme="dark"] .kapgelsin-map.leaflet-container,
[data-theme="dark"] .leaflet-container.kapgelsin-map {
    background: #0b1016;
}

.map-filter-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Açık tema: koyu teal yollar, yeşil etiketler */
.kapgelsin-map-theme-light .leaflet-tile.kapgelsin-map-road-tiles-light {
    filter: saturate(0.72) hue-rotate(158deg) brightness(0.84) contrast(1.18);
    -webkit-filter: saturate(0.72) hue-rotate(158deg) brightness(0.84) contrast(1.18);
}

.kapgelsin-map-theme-light .leaflet-tile.kapgelsin-map-label-tiles-light {
    filter: hue-rotate(90deg) saturate(1.5) brightness(1.03);
    -webkit-filter: hue-rotate(90deg) saturate(1.5) brightness(1.03);
}

/* Koyu tema: cyan/teal yollar, turuncu-kahve etiketler → yeşil */
.kapgelsin-map-theme-dark .leaflet-tile.kapgelsin-map-road-tiles {
    filter: brightness(2.15) contrast(0.7) sepia(0.3) hue-rotate(162deg) saturate(2.35);
    -webkit-filter: brightness(2.15) contrast(0.7) sepia(0.3) hue-rotate(162deg) saturate(2.35);
}

.kapgelsin-map-theme-dark .leaflet-tile.kapgelsin-map-label-tiles {
    filter: hue-rotate(84deg) saturate(1.6) brightness(1.2) contrast(1.05);
    -webkit-filter: hue-rotate(84deg) saturate(1.6) brightness(1.2) contrast(1.05);
}

.kapgelsin-map-theme-dark.leaflet-container,
.leaflet-container.kapgelsin-map-theme-dark {
    background: #0a0e13 !important;
}

.kapgelsin-map-fullscreen {
    touch-action: none;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15) !important;
    overflow: hidden;
    border-radius: var(--radius-sm) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text) !important;
    border-bottom: 1px solid var(--border) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-elevated) !important;
    color: var(--primary) !important;
}

.leaflet-control-zoom-in { border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important; }
.leaflet-control-zoom-out { border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important; border-bottom: none !important; }

.map-pin-wrap {
    background: transparent !important;
    border: none !important;
}

.map-pin {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    border: 2px solid #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
}

.map-pin-courier {
    background: var(--primary);
}

.map-pin-delivery {
    background: var(--bg-card);
    border-color: var(--primary);
    color: var(--primary);
    font-size: 14px;
}

.map-pin-restaurant {
    background: var(--bg-card);
    border-color: var(--border);
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card);
    color: var(--text);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0;
}

.leaflet-popup-content {
    margin: 10px 12px;
    font-size: .82rem;
    line-height: 1.45;
}

.leaflet-popup-tip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: none;
}

.map-popup strong {
    display: block;
    font-size: .85rem;
    margin-bottom: 4px;
    color: var(--text);
}

.map-popup-line {
    color: var(--text-muted);
    font-size: .8rem;
}

.map-region-label-wrap {
    background: transparent !important;
    border: none !important;
}

.map-region-label {
    display: inline-block;
    transform: translate(-50%, -50%);
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: #1a1a2e;
    border: 2px solid #28a745;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

[data-theme="dark"] .map-region-label {
    background: rgba(15, 23, 42, .92);
    color: #f1f5f9;
}

.leaflet-container { background: #d9e3e8; font-family: var(--font); }

[data-theme="dark"] .leaflet-container,
[data-theme="dark"] .kapgelsin-map.leaflet-container {
    background: #0a0e13;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, .88) !important;
    color: var(--text-muted) !important;
    font-size: 9px !important;
    padding: 2px 6px !important;
    border-radius: 4px 0 0 0;
    border: 1px solid var(--border);
    border-right: none;
    border-bottom: none;
}

[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(30, 41, 59, .9) !important;
    color: var(--text-muted) !important;
}

/* Toggle switch */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.toggle {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(24px); }

/* Table (admin) */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th { color: var(--text-muted); font-weight: 500; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }

/* Toast */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 200;
    opacity: 0;
    transition: transform .3s, opacity .3s;
    max-width: calc(100% - 32px);
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* Loading */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.loading-overlay.show { opacity: 1; pointer-events: auto; }

.loading-box {
    background: var(--bg-card);
    padding: 24px 32px;
    border-radius: var(--radius);
    text-align: center;
}

.loading-box .spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    border-color: var(--border);
    border-top-color: var(--primary);
}

/* Filters */
.filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
    padding: 10px 16px;
    min-height: 40px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all .2s;
}

.filter-chip.active {
    background: rgba(var(--brand-rgb), .15);
    border-color: var(--primary);
    color: var(--primary);
}

a.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
}

.admin-subnav {
    margin-bottom: 12px;
}

.admin-subnav-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Profile */
.profile-header {
    text-align: center;
    padding: 24px 16px;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #1e7e34);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--on-primary);
    margin: 0 auto 12px;
}

.score-ring {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(var(--brand-rgb), .15);
    border-radius: 999px;
    color: var(--primary);
    font-weight: 600;
    font-size: .9rem;
}

.info-list { list-style: none; }

.info-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.info-list li span:first-child { color: var(--text-muted); }

.demo-banner {
    background: rgba(59,130,246,.15);
    border: 1px solid rgba(59,130,246,.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .8rem;
    color: var(--info);
    margin-bottom: 16px;
}

.hide-mobile { display: none !important; }
.show-mobile-only { display: none !important; }
.show-tablet-only { display: none !important; }

/* ===== MOBILE FIRST (default) ===== */

/* Stats - 2 columns mobile */
.stats-grid {
    grid-template-columns: repeat(2, 1fr);
}

.stats-grid.stats-5 .stat-card:last-child {
    grid-column: span 2;
}

/* Item rows - stack on tiny screens */
.item-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.item-row .item-name { grid-column: 1; }
.item-row .item-qty,
.item-row .item-price { width: 100%; }
.item-row .btn-remove {
    width: 100%;
    height: 36px;
    margin-top: 4px;
}

/* Order cards mobile */
.order-card-top { flex-direction: column; align-items: flex-start; }
.order-footer { flex-direction: column; align-items: stretch; }
.order-actions { width: 100%; }
.order-actions .btn { flex: 1; min-width: 0; text-align: center; }

.user-card { margin-bottom: 12px; }
.user-meta { font-size: .85rem; color: var(--text-muted); margin-top: 4px; word-break: break-word; }
.user-address { font-size: .85rem; margin-top: 6px; word-break: break-word; }
.user-notes { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.scan-hint { font-size: .8rem; margin-top: 4px; color: var(--text-muted); }
.scan-left .btn { margin-top: 16px; }
.scan-layout { display: flex; flex-direction: column; gap: 20px; }
.scan-left, .scan-right { width: 100%; }

.flex { display: flex !important; }

.user-card-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.user-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}
.user-card-actions .btn { flex: 1; min-width: calc(50% - 4px); }

/* Map mobile */
.map-container { height: 240px; min-height: 200px; }
.map-container.full {
    height: calc(100dvh - var(--header-h) - var(--nav-h) - 80px);
    min-height: 220px;
}

/* Page header */
.page-header h1 { font-size: 1.25rem; word-break: break-word; }

/* Info list mobile */
.info-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* Toast - no bottom nav on auth */
body:not(:has(.bottom-nav)) .toast {
    bottom: calc(var(--safe-bottom) + 16px);
}

/* ===== TABLET (480px+) ===== */
@media (min-width: 480px) {
    .item-row {
        grid-template-columns: 1fr 70px 90px 40px;
        padding: 0;
        background: transparent;
        border: none;
    }
    .item-row .btn-remove { width: 40px; margin-top: 0; }
    .order-card-top { flex-direction: row; align-items: flex-start; }
    .order-footer { flex-direction: row; align-items: center; }
    .order-actions { width: auto; }
    .order-actions .btn { flex: none; }
    .user-card-header { flex-direction: row; justify-content: space-between; align-items: flex-start; }
    .user-card-actions { width: auto; }
    .user-card-actions .btn { flex: none; min-width: auto; }
    .info-list li { flex-direction: row; align-items: center; }
    .map-container { height: 300px; }
}

/* List & action layouts */
.list-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-grid .order-card,
.list-grid .user-card {
    margin-bottom: 0;
}

.list-grid .empty-state {
    grid-column: 1 / -1;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.form-page {
    max-width: 100%;
}

/* ===== TABLET (768px+) ===== */
@media (min-width: 768px) {
    .hide-mobile { display: inline !important; }
    .hide-mobile.flex { display: flex !important; }
    .show-mobile-only { display: none !important; }

    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-grid.stats-5 { grid-template-columns: repeat(5, 1fr); }
    .stats-grid.stats-5 .stat-card:last-child { grid-column: auto; }
    .stats-grid.stats-3 { grid-template-columns: repeat(3, 1fr); }

    .app-main { padding: 24px; }

    .page-header {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px 20px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 1.5rem;
        margin: 0;
        flex: 1 1 auto;
    }

    .page-header > p {
        flex: 1 1 100%;
        margin: 0;
    }

    .page-header .btn {
        margin-top: 0 !important;
        flex-shrink: 0;
        align-self: center;
    }

    .quick-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .quick-actions .btn {
        flex: 1 1 220px;
        width: auto;
    }

    .map-container.full {
        height: calc(100dvh - var(--header-h) - 64px);
    }

    .user-name { max-width: 220px; }

    .filter-bar {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    /* Masaustu: ust menu gorunur, alt menu gizli */
    .bottom-nav { display: none !important; }
    .desktop-sidebar { display: none !important; }

    .app-header {
        height: auto;
        min-height: var(--header-h);
        padding: 10px 0;
    }

    .header-inner {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 16px 24px;
        max-width: 1400px;
        padding: 0 24px;
        min-height: 48px;
    }

    .header-nav {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 0;
        width: fit-content;
        max-width: 100%;
        margin: 0 auto;
        padding: 6px 8px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 999px;
        box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .header-nav::-webkit-scrollbar { display: none; }

    .header-nav-item + .header-nav-item {
        margin-left: 0;
    }

    .header-nav-item {
        padding: 9px 16px;
        font-size: .84rem;
    }

    .header-nav:has(.header-nav-item:nth-child(5)) {
        gap: 4px;
        padding: 5px 6px;
    }

    .header-nav:has(.header-nav-item:nth-child(5)) .header-nav-item {
        padding: 8px 12px;
        font-size: .8rem;
    }

    [data-theme="light"] .header-nav {
        background: #fff;
        border-color: #e2e8f0;
    }

    .app-main.with-sidebar {
        margin-left: auto;
        margin-right: auto;
        max-width: 1200px;
        width: 100%;
        padding: 24px 28px 32px;
    }

    /* Kurye harita: masaustunde ust header menu, altta menu yok */
    .courier-map-mode .map-header {
        display: block !important;
    }

    .courier-map-mode .bottom-nav {
        display: none !important;
    }

    .courier-map-mode .courier-map-main {
        margin-left: 0;
        width: 100%;
        min-height: calc(100dvh - var(--header-h));
        padding-bottom: 0;
    }

    .courier-map-mode .courier-map-screen {
        height: calc(100dvh - var(--header-h));
    }

    .courier-map-mode .delivery-panel-overlay {
        max-width: 420px;
        left: auto;
        right: 24px;
        bottom: 24px;
        max-height: 70vh;
    }

    .courier-map-mode .event-popup {
        bottom: 24px;
        left: 16px;
        right: 16px;
    }

    .courier-map-mode .map-header .header-inner {
        grid-template-columns: auto 1fr;
    }
}

/* ===== DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .stats-grid.stats-5 { grid-template-columns: repeat(5, 1fr); }

    .map-container { height: 400px; }
    .map-container.full {
        height: calc(100dvh - var(--header-h) - 48px);
    }

    .scan-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        align-items: start;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .dashboard-grid .full-width { grid-column: 1 / -1; }

    .form-page {
        max-width: 720px;
    }

    .gamification-desktop {
        display: grid;
        grid-template-columns: 1fr 380px;
        gap: 24px;
        align-items: start;
    }

    .gamification-desktop .gamification-panel {
        margin-bottom: 0;
    }

    .gamification-side {
        position: sticky;
        top: calc(var(--header-h) + 16px);
        align-self: start;
    }

    .message-thread {
        max-height: 60vh;
    }
}

/* ===== LARGE DESKTOP (1280px+) ===== */
@media (min-width: 1280px) {
    .app-main.with-sidebar {
        padding: 32px 40px 40px;
    }

    .list-grid.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .list-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 767px) {
    .show-mobile-only { display: flex !important; }
    .show-mobile-only.user-avatar { display: flex !important; }

    /* Mobil: sadece alt menu, ust header menu gizli */
    .header-nav {
        display: none !important;
    }

    .bottom-nav {
        display: flex !important;
    }

    .courier-map-mode .map-header {
        display: none !important;
    }

    .app-main.with-sidebar {
        padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    }
}


.desktop-sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    overflow-y: auto;
    z-index: 90;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 4px;
    transition: background .2s, color .2s;
}

.sidebar-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover { background: var(--bg-elevated); color: var(--text); }
.sidebar-link.active { background: rgba(var(--brand-rgb), .15); color: var(--primary); }

/* Badge tiers */
.badge-tiers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.badge-tier-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.badge-tier-card h3 {
    font-size: 1rem;
    margin: 8px 0 2px;
}

.badge-tier-level {
    font-size: .75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.badge-tier-img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto;
    display: block;
    box-shadow: 0 4px 16px rgba(var(--brand-rgb), .2);
}

.badge-tier-img-md {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.badge-tier-img-sm {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-badge-img {
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
}

.badge-visual {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(var(--brand-rgb), .25);
}

.profile-header .badge-visual {
    margin-left: auto;
    margin-right: auto;
}

.badge-visual.badge-tier-img,
.badge-visual.badge-tier-img-md,
.badge-visual.badge-tier-img-sm {
    margin: 0;
}

.badge-visual.badge-tier-img { width: 88px; height: 88px; }
.badge-visual.badge-tier-img-md { width: 72px; height: 72px; }
.badge-visual.badge-tier-img-sm { width: 48px; height: 48px; }

.badge-visual.badge-tier-1 { background: linear-gradient(135deg, #e8a86b, #a0622a); }
.badge-visual.badge-tier-2 { background: linear-gradient(135deg, #f0f0f0, #9a9a9a); }
.badge-visual.badge-tier-3 { background: linear-gradient(135deg, #ffe566, #d4a017); }

.badge-visual-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.badge-visual-fallback {
    display: none;
    font-size: 2.2rem;
    line-height: 1;
}

.badge-visual.use-fallback .badge-visual-fallback { display: flex; }
.badge-visual.use-fallback .badge-visual-img { display: none; }

.badge-tier-card .form-label {
    text-align: left;
    margin-top: 8px;
}

@media (min-width: 768px) {
    .badge-tiers-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Gamification */
.gamification-panel {
    margin-bottom: 16px;
}

.level-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.level-card-empty { opacity: .9; }

.level-icon { font-size: 2rem; line-height: 1; }

.level-name { font-weight: 600; font-size: .95rem; }

.level-hint { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

.gamification-stats { margin-bottom: 14px; }

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

.form-hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin: -4px 0 10px;
    line-height: 1.4;
}

.reg-location-map {
    width: 100%;
    height: 220px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    z-index: 1;
}

.reg-location-status {
    font-size: .8rem;
    color: var(--danger);
    margin: 0 0 10px;
}

.reg-location-status.selected {
    color: var(--success);
}

@media (max-width: 480px) {
    .manual-name-row { grid-template-columns: 1fr; }
}

.gamification-section { margin-bottom: 16px; }

.gamification-title {
    margin: 0 0 10px;
    font-size: .9rem;
    font-weight: 600;
}

.gamification-empty {
    font-size: .8rem;
    color: var(--text-muted);
    margin: 0;
}

.badge-icons-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-icon-item {
    font-size: 1.6rem;
    cursor: help;
    line-height: 1;
}

.mission-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.mission-card.mission-done {
    opacity: .7;
    border-color: var(--primary);
}

.mission-title { font-weight: 600; font-size: .875rem; margin-bottom: 8px; }

.mission-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .3s;
}

.mission-count {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.mission-reward {
    font-size: .75rem;
    color: var(--primary);
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 6px;
    font-size: .85rem;
}

.leaderboard-row.me {
    border-color: var(--primary);
    background: rgba(var(--brand-rgb), .1);
}

.leaderboard-row .rank {
    font-weight: 700;
    min-width: 24px;
    color: var(--text-muted);
}

.leaderboard-row .name { flex: 1; font-weight: 500; }

.leaderboard-row .pts {
    font-size: .8rem;
    color: var(--text-muted);
}

.event-popup {
    display: none;
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 24px);
    left: 16px;
    right: 16px;
    max-width: 320px;
    margin: 0 auto;
    background: #1a1a1a;
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: .9rem;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
}

.event-popup.show { display: block; }

/* Teslimat ozeti modal */
.delivery-summary-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 600;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}

.delivery-summary-modal.show {
    display: flex;
}

.delivery-summary-backdrop {
    position: absolute;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
}

.delivery-summary-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
}

.delivery-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.delivery-summary-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(var(--brand-rgb), .15);
    color: var(--primary);
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delivery-summary-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.delivery-summary-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    text-align: left;
    font-size: .9rem;
}

.delivery-summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.delivery-summary-list li:last-child {
    border-bottom: none;
}

.delivery-summary-list li span:first-child {
    color: var(--text-muted);
}

.delivery-summary-hint {
    font-size: .75rem;
    color: var(--text-muted);
    padding-top: 4px !important;
    border-bottom: none !important;
}

.delivery-summary-hint span:last-child {
    text-align: right;
    flex: 1;
}

.delivery-summary-total {
    margin-top: 4px;
    padding-top: 12px !important;
    border-top: 1px dashed var(--border) !important;
    font-weight: 700;
    font-size: 1rem;
}

.delivery-summary-total span:last-child {
    color: var(--primary);
}

.order-financials {
    list-style: none;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: rgba(var(--brand-rgb), .06);
    border: 1px solid rgba(var(--brand-rgb), .15);
    border-radius: var(--radius-sm);
    font-size: .8rem;
}

.order-financials li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
}

.order-financials li + li {
    border-top: 1px solid rgba(var(--brand-rgb), .1);
}

.order-financials li span:first-child {
    color: var(--text-muted);
}

.order-financials li strong {
    color: var(--primary);
}

.confetti-piece {
    position: fixed;
    top: 10%;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    z-index: 199;
    pointer-events: none;
    animation: confettiFall 1.5s ease-out forwards;
}

@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(300px) rotate(720deg); opacity: 0; }
}

/* Courier fullscreen map */
.courier-map-mode .app-shell {
    min-height: 100dvh;
}

.courier-map-mode .courier-map-main {
    padding: 0;
    margin: 0;
    max-width: none;
    min-height: calc(100dvh - var(--nav-h) - var(--safe-bottom));
    padding-bottom: 0;
}

.courier-map-screen {
    position: relative;
    width: 100%;
    height: calc(100dvh - var(--nav-h) - var(--safe-bottom));
    min-height: 320px;
    overflow: hidden;
}

.courier-map-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.courier-status-pill {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 500;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .02em;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}

.courier-status-pill:active:not(:disabled) {
    transform: scale(.96);
}

.courier-status-pill:disabled {
    cursor: default;
    opacity: .95;
}

.courier-status-pill.status-musait {
    background: var(--primary);
    color: #fff;
}

.courier-status-pill.status-mesgul {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.courier-status-pill.status-yolda {
    background: #3b82f6;
    color: #fff;
}

.courier-map-tools {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.courier-map-tool {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    backdrop-filter: blur(8px);
}

[data-theme="light"] .courier-map-tool {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    border: 1px solid var(--border);
}

.courier-map-tool:active {
    transform: scale(0.94);
}

.courier-map-tool.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 20px rgba(var(--brand-rgb), 0.45);
}

.courier-map-tool svg {
    display: block;
}

.delivery-panel-overlay {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 400;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.delivery-queue-info {
    font-size: .75rem;
    color: var(--text);
    text-align: center;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, .75);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

[data-theme="light"] .delivery-queue-info {
    background: rgba(255, 255, 255, .92);
}

.delivery-order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
    backdrop-filter: blur(10px);
}

.courier-map-mode .event-popup {
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 100px);
}

@media (min-width: 768px) {
    .courier-map-mode .courier-map-main {
        padding-bottom: 0;
    }
}

/* Legacy courier delivery (removed layout) */
.courier-delivery-page {
    display: none;
}

.delivery-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.delivery-step {
    flex: 1;
    text-align: center;
    font-size: .65rem;
    font-weight: 600;
    padding: 6px 4px;
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.delivery-step.active {
    background: rgba(var(--brand-rgb), .2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.delivery-step.done {
    background: rgba(34, 197, 94, .15);
    color: var(--success);
}

.delivery-order-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.delivery-order-id {
    font-weight: 700;
    font-size: .9rem;
}

.delivery-customer {
    font-size: 1.05rem;
    margin: 0 0 6px;
}

.delivery-address {
    font-size: .875rem;
    color: var(--text-muted);
    margin: 0 0 10px;
    line-height: 1.4;
}

.delivery-call-btn { margin-bottom: 10px; }

.delivery-items {
    font-size: .8rem;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.delivery-amount {
    font-size: .9rem;
    margin: 0 0 14px;
}

.delivery-action-btn {
    min-height: 48px;
    font-size: 1rem;
    font-weight: 600;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a1a;
    border: none;
}

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

/* Theme toggle & settings */
.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-sun { display: block; }
[data-theme="light"] .theme-toggle-btn .icon-moon { display: block; }

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 500;
    transition: all .2s;
}

.theme-option:hover {
    border-color: var(--primary);
    color: var(--text);
}

.theme-option.active {
    border-color: var(--primary);
    background: rgba(var(--brand-rgb), .12);
    color: var(--primary);
}

.theme-option-icon { font-size: 1.5rem; line-height: 1; }

.settings-section { margin-bottom: 20px; }

.settings-section-title {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding: 0 4px;
}

/* Bildirim ve destek */
.inbox-item {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .2s;
}

.inbox-item.unread {
    border-color: var(--primary);
    background: rgba(var(--brand-rgb), .06);
}

.inbox-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.inbox-item-body {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.5;
}

.inbox-item-meta {
    font-size: .75rem;
    color: var(--text-muted);
}

.support-list-item {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    margin-bottom: 10px;
    color: var(--text);
    transition: border-color .2s, background .2s;
}

.support-list-item:hover,
.support-list-item.active {
    border-color: var(--primary);
    background: rgba(var(--brand-rgb), .06);
}

.support-list-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.support-list-sub,
.support-list-meta {
    font-size: .8rem;
    color: var(--text-muted);
}

.support-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px 0;
}

.chat-bubble {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
}

.chat-mine {
    align-self: flex-end;
    background: rgba(var(--brand-rgb), .15);
    border: 1px solid rgba(var(--brand-rgb), .25);
}

.chat-theirs {
    align-self: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.chat-sender {
    font-size: .75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.chat-text { line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.chat-time {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: 6px;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

@media (min-width: 900px) {
    .support-layout {
        grid-template-columns: 320px 1fr;
        align-items: start;
    }
}

@media (max-width: 767px) {
    .form-row { grid-template-columns: 1fr !important; }
}
