.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.admin .btn { font-size: 14px; }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--header); }
.login-card { background: #fff; border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.login-card h2 { margin: 6px 0 8px; font-size: 20px; }
.login-card input { padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.logo-mark.big { width: 52px; height: 52px; font-size: 28px; margin: 0 auto; }
.login-error { color: #c5221f; font-size: 13px; min-height: 18px; }
.small-link { font-size: 13px; }

.admin-header { background: var(--header); color: #fff; position: sticky; top: 0; z-index: 50; }
.admin-header-inner { max-width: 1200px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 16px 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-header-actions { display: flex; gap: 8px; }
.admin-tabs { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.admin-tabs button { background: none; border: 0; color: #aeb8c3; padding: 10px 12px; cursor: pointer; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.admin-tabs button.active { color: #fff; border-bottom-color: #f5a623; }
.admin-page { max-width: 1200px; margin: 0 auto; padding: 16px 16px 40px; }

.admin-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.admin-toolbar input, .admin-toolbar select { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-toolbar input { flex: 1; min-width: 200px; }

.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-row { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; gap: 12px; align-items: center; }
.admin-row.hidden-row { opacity: .6; }
.admin-thumb { width: 64px; height: 64px; flex: none; border-radius: 8px; background: #f3f5f8; display: grid; place-items: center; overflow: hidden; cursor: pointer; font-size: 26px; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-row-main { flex: 1; min-width: 0; cursor: pointer; }
.admin-row-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-side { display: flex; align-items: center; gap: 12px; flex: none; }
.admin-price { font-weight: 700; min-width: 100px; text-align: right; }
.tag-hidden { background: #fce8e6; color: #c5221f; padding: 0 6px; border-radius: 4px; }
.qty-edit { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-edit button { border: 0; background: #f3f5f8; width: 30px; height: 30px; cursor: pointer; font-size: 16px; }
.qty-edit span { min-width: 34px; text-align: center; font-weight: 700; }
.qty-in { color: #1e8e3e; } .qty-out { color: #c5221f; }
.row-mini-actions { display: flex; gap: 4px; }
.row-mini-actions button, .small-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; height: 32px; min-width: 32px; cursor: pointer; padding: 0 8px; font-size: 13px; }
.danger { color: #c5221f; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.panel h3 { margin-top: 0; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { padding: 10px; border: 1px solid var(--line); border-radius: 8px; flex: 1; min-width: 180px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { background: var(--accent-soft); color: #0b4f96; border-radius: 20px; padding: 5px 6px 5px 12px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.chip button { border: 0; background: rgba(0,0,0,.08); border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 11px; }

.cat-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cat-row input:not([type=file]) { padding: 8px; border: 1px solid var(--line); border-radius: 8px; flex: 1; min-width: 150px; }
.cat-row input.cat-icon { flex: none; width: 54px; min-width: 0; text-align: center; font-size: 18px; }
.cat-row-order { display: flex; flex-direction: column; gap: 2px; }
.cat-row-order button { border: 1px solid var(--line); background: #fff; border-radius: 5px; font-size: 10px; padding: 1px 5px; cursor: pointer; }
.cat-row-order button:disabled { opacity: .3; }
.cat-row-img { width: 42px; height: 42px; border: 1px dashed #b8c2cc; border-radius: 8px; display: grid; place-items: center; cursor: pointer; overflow: hidden; font-size: 20px; flex: none; }
.cat-row-img img { width: 100%; height: 100%; object-fit: contain; }
.cat-row-count { width: 44px; }

.form-box { max-width: 820px; }
.form-box h2 { margin: 0 44px 16px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #34404d; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { padding: 10px; border: 1px solid #cfd6de; border-radius: 8px; font-size: 15px; font-weight: 400; background: #fff; width: 100%; }
.form-grid textarea { resize: vertical; font-family: inherit; }
.form-grid .check-label { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; }
.form-grid .check-label input { width: auto; }
.form-box h4 { margin: 20px 0 10px; }
.image-editor { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.img-item { position: relative; width: 110px; height: 110px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: #f7f8fa; }
.img-item.main { border-color: var(--accent); }
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-btn { position: absolute; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; }
.img-btn.del { right: 4px; } .img-btn.left { left: 4px; }
.img-main-tag { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); color: #fff; font-size: 11px; text-align: center; padding: 2px; }
.upload-btn { cursor: pointer; }
.sticky-actions { position: sticky; bottom: -22px; background: #fff; padding: 12px 0; margin-bottom: -10px; border-top: 1px solid var(--line); }

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .admin-row { flex-wrap: wrap; }
    .admin-row-main { flex-basis: calc(100% - 80px); }
    .admin-row-side { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-left: 0; }
    .admin-price { white-space: nowrap; }
    .admin-price { min-width: 0; text-align: left; }
    .img-item { width: calc(33.33% - 7px); height: auto; aspect-ratio: 1; }
    .sticky-actions { bottom: -16px; }
    .sticky-actions .btn { flex: 1; }
}

/* --- Rasmni ramka bilan kesish (crop) --- */
.img-btn.crop { right: 4px; top: auto; bottom: 22px; }
.img-item:not(.main) .img-btn.crop { bottom: 4px; }
.crop-modal { position: fixed; inset: 0; z-index: 150; background: #0d1116; display: none; flex-direction: column; color: #fff; }
.crop-modal.open { display: flex; }
.crop-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; font-weight: 600; font-size: 15px; }
.crop-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 16px; cursor: pointer; flex: none; }
.crop-area { flex: 1; min-height: 0; position: relative; }
.crop-area img { display: block; max-width: 100%; }
.crop-tools { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 10px 12px 4px; }
.crop-tools button { border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; border-radius: 8px; height: 36px; min-width: 40px; padding: 0 10px; cursor: pointer; font-size: 14px; }
.crop-tools button.active { background: #f5a623; border-color: #f5a623; color: #17202a; font-weight: 700; }
.crop-sep { width: 1px; height: 22px; background: rgba(255,255,255,.2); margin: 0 4px; }
.crop-actions { display: flex; gap: 10px; padding: 10px 14px max(14px, env(safe-area-inset-bottom)); }
.crop-actions .btn { flex: 1; }
.crop-actions .btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
/* Cropper ramkasini telefonda ushlash osonroq bo'lsin */
.crop-modal .cropper-view-box { outline: 2px solid #f5a623; outline-color: #f5a623; }
.crop-modal .cropper-point { width: 14px; height: 14px; background: #f5a623; opacity: 1; }
.crop-modal .cropper-point.point-se { width: 14px; height: 14px; }
.crop-modal .cropper-line { background: #f5a623; }

/* --- Sayt ichidagi kamera --- */
.img-add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.img-add-row .btn { flex: 1 1 160px; }
.cam-modal { position: fixed; inset: 0; z-index: 140; background: #000; display: none; flex-direction: column; color: #fff; }
.cam-modal.open { display: flex; }
.cam-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; font-weight: 600; font-size: 15px; }
.cam-view { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.cam-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-view.flash::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: .7; }
/* Ramka: tashqarisi xiralashtiriladi */
.cam-frame { position: absolute; left: 6%; right: 6%; top: 50%; transform: translateY(-50%); aspect-ratio: 4 / 3; max-height: 80%;
    border-radius: 10px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); pointer-events: none; }
.cam-frame i { position: absolute; width: 28px; height: 28px; border: 4px solid #f5a623; }
.cam-frame i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.cam-frame i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.cam-frame i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.cam-frame i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.cam-msg { position: absolute; left: 0; right: 0; top: 45%; text-align: center; color: #cfd6de; display: none; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px max(20px, env(safe-area-inset-bottom)); }
.cam-shot { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: #f5a623; cursor: pointer; box-shadow: inset 0 0 0 3px #000; }
.cam-shot:active { transform: scale(.94); }
.cam-side { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.cam-auto { border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; border-radius: 20px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.cam-modal.auto .cam-auto { background: #f5a623; border-color: #f5a623; color: #17202a; }
.cam-modal.auto .cam-frame { display: none; }
.cam-top .crop-x.done { width: auto; padding: 0 14px; border-radius: 18px; background: #1e8e3e; font-size: 14px; font-weight: 700; }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 13.5px; color: #fff; text-shadow: 0 1px 4px #000; pointer-events: none; }
.cam-last { position: relative; padding: 0; overflow: visible; border-radius: 10px; border: 2px solid #fff; background: #222; }
.cam-last img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.cam-last b { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; border-radius: 10px; background: #f5a623; color: #17202a; font-size: 12px; display: grid; place-items: center; padding: 0 4px; }

/* --- AI yordamchi --- */
.ai-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, #f3ecff, #e8f1fc); border: 1px solid #ddd3f5; }
.ai-btn { background: linear-gradient(135deg, #6a3de8, #0b6bcb); }
.ai-btn:disabled { opacity: .7; cursor: wait; }
.ai-result { margin-top: 10px; padding: 12px; border-radius: 10px; background: #f7f8fa; border: 1px solid var(--line); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.ai-result.ai-ok { background: #f0f7f2; border-color: #cfe8d6; }
.ai-result.ai-error { background: #fce8e6; border-color: #f5c6c2; color: #8c1d18; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ai-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-links a.small-btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--accent); }
@keyframes aiGlow { from { background: #efe6ff; border-color: #8b5cf6; } to { background: #fff; } }
.form-grid .ai-filled { animation: aiGlow 1.6s ease-out; }
/* Kamera ochiq bo'lganda xabar suratga olish tugmasini to'smasin */
.cam-modal.open ~ .toast { bottom: 150px; }

/* --- Sotuvchi (faqat admin ko'radi) --- */
.seller-tag { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 6px; background: #fff3d6; color: #7a5500; font-size: 12.5px; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.warn-banner { background: #fce8e6; border: 1px solid #f5c6c2; color: #8c1d18; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; line-height: 1.45; }

/* --- Xavfsizlik bo'limi --- */
.sec-results { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sec-summary { padding: 12px 14px; border-radius: 10px; font-weight: 700; }
.sec-summary.ok { background: #e6f4ea; color: #0d652d; }
.sec-summary.warn { background: #fff6d6; color: #7a5500; }
.sec-summary.bad { background: #fce8e6; color: #8c1d18; }
.sec-row { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; line-height: 1.4; }
.sec-row.bad { border-color: #f5c6c2; background: #fff8f7; }
.sec-row.warn { border-color: #f2e2a4; background: #fffdf3; }
.sec-row .small { color: #4a5563; margin-top: 2px; }
.sec-ico { flex: none; font-size: 18px; line-height: 1.2; }
.sec-account { display: grid; gap: 4px; font-size: 14.5px; }

/* --- Sotuvchilar (kabinet) --- */
.tab-badge { background: #f5a623; color: #17202a; border-radius: 10px; padding: 0 6px; font-size: 11.5px; margin-left: 2px; }
.info-banner { background: #e8f1fc; border: 1px solid #b9d4f5; color: #0b4f96; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; line-height: 1.5; }
.info-banner .btn { margin-left: 8px; }
.vendor-list { display: flex; flex-direction: column; gap: 8px; }
.vendor-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 1px solid var(--line); border-left: 4px solid #cfd6de; border-radius: 10px; padding: 10px 12px; background: #fff; }
.vendor-row.ok { border-left-color: #1e8e3e; } .vendor-row.warn { border-left-color: #f5a623; } .vendor-row.bad { border-left-color: #c5221f; }
.vendor-main { min-width: 0; flex: 1 1 260px; }
.vendor-name { font-weight: 700; font-size: 15.5px; }
.vendor-status { font-size: 13px; font-weight: 600; margin-top: 3px; }
.vendor-status.ok { color: #1e8e3e; } .vendor-status.warn { color: #b06000; } .vendor-status.bad { color: #c5221f; }
.vendor-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.small-btn.pay { background: #e6f4ea; border-color: #c7e6d0; color: #0d652d; font-weight: 700; }
.seller-tag.vendor { background: #e8f1fc; color: #0b4f96; }
.pn-note { font-size: 12px; font-weight: 500; color: #1e8e3e; }

/* --- Vaqtinchalik parol oynasi --- */
.pw-box { max-width: 420px; text-align: center; min-height: 0 !important; margin-top: 8vh; border-radius: 16px !important; }
.pw-box p { text-align: left; font-size: 14px; line-height: 1.5; }
.pw-code { font: 800 34px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 4px; margin: 14px 0 10px; padding: 14px; border-radius: 12px; background: #17202a; color: #fff; user-select: all; }

/* --- AI sarfi --- */
.usage-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-bottom: 8px; }
.usage-cards > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #f7f8fa; }
.usage-cards b { display: block; font-size: 18px; }
.usage-cards span { font-size: 12.5px; color: #5b6673; }
.usage-table { display: block; overflow-x: auto; max-width: 100%; border-collapse: collapse; font-size: 13.5px; }
.usage-table th, .usage-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.usage-table th { font-size: 12px; color: #5b6673; font-weight: 600; white-space: nowrap; }

.seller-tag.src-baza { background: #e6f4ea; color: #1e6b34; }
.seller-tag.src-ai { background: #f1e8fd; color: #5b2a9d; }
.ai-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 7px 12px; background: #1f2937; color: #fff; font-size: 13px; line-height: 1.35; box-shadow: 0 -2px 8px rgba(0,0,0,.18); }
.ai-footer .muted { color: #cbd5e1; }
.ai-footer .small-btn { background: #374151; color: #fff; border-color: #4b5563; }
body:has(.ai-footer[style*="flex"]) { padding-bottom: 76px; }

.cat-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding: 9px 12px; background: #f1f5f9; border-radius: 10px; font-size: 15px; }
.cat-group-head:first-child { margin-top: 4px; }
.cat-group-head .small-btn { margin-left: auto; }
.cat-row select.cat-row-group { padding: 8px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; flex: none; }
