:root { --afb: #1f3864; --afb-accent: #1d4ed8; }
body { background: #f4f6fa; font-size: 0.95rem; }
.afb-nav { background: var(--afb); }
.afb-logo { display: inline-flex; align-items: center; justify-content: center; background: var(--afb-accent); color: #fff;
            font-weight: 800; border-radius: 6px; padding: 2px 6px; font-size: .85rem; letter-spacing: .5px; }
.afb-logo-lg { width: 64px; height: 64px; font-size: 1.3rem; border-radius: 14px; display: flex; }
.login-wrap { min-height: 85vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; }

.stat-card { display: block; padding: 16px; border-radius: 10px; background: #fff; color: #333; text-decoration: none;
             border-left: 5px solid #999; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); color: #000; }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-warn { border-color: #f0ad4e; } .stat-ok { border-color: #28a745; } .stat-info { border-color: #17a2b8; }

.thumb { width: 84px; height: 60px; border-radius: 6px; overflow: hidden; background: #e9ecef; display: flex;
         align-items: center; justify-content: center; font-size: .7rem; color: #888; flex-shrink: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.price { font-size: 1.6rem; font-weight: 700; color: var(--afb); }
.spec-table th { width: 40%; color: #666; font-weight: 500; }

.photo-card { background: #fff; border: 2px solid #dee2e6; border-radius: 10px; overflow: hidden; }
.photo-card.review-pending { border-color: #f0ad4e; }
.photo-card.review-masked, .photo-card.review-clear { border-color: #28a745; }
.photo-box { position: relative; aspect-ratio: 4 / 3; background: #222; }
.photo-box img { width: 100%; height: 100%; object-fit: contain; }
.photo-box.missing::after { content: "Photo file missing on server"; position: absolute; inset: 0; display: flex; align-items: center;
                            justify-content: center; color: #ccc; font-size: .8rem; }
.photo-box.missing img { display: none; }
.photo-tag { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: .72rem;
             padding: 2px 8px; border-radius: 20px; }
.review-pending .photo-tag { background: #f0ad4e; color: #000; }
.review-masked .photo-tag, .review-clear .photo-tag { background: #28a745; }

.mask-stage { position: relative; background: #111; display: flex; justify-content: center; align-items: center;
              min-height: 300px; user-select: none; touch-action: none; cursor: crosshair; border-radius: 8px; overflow: hidden; }
.mask-stage img { max-width: 100%; max-height: 70vh; display: block; pointer-events: none; }
.mask-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aaa; }
.mask-box { position: absolute; background: #fff; border: 2px solid var(--afb); border-radius: 4px; display: flex;
            align-items: center; justify-content: center; overflow: hidden; }
.mask-box.drawing { background: rgba(243,112,33,.25); border: 2px dashed var(--afb-accent); }
.mask-label { color: var(--afb); font-weight: 800; white-space: nowrap; font-family: Arial, sans-serif; }
.mask-box-del { position: absolute; top: -2px; right: -2px; border: 0; background: #dc3545; color: #fff; width: 18px; height: 18px;
                font-size: 12px; line-height: 18px; padding: 0; border-radius: 0 3px 0 6px; cursor: pointer; }
.photo-card.review-auto { border-color: #0d6efd; }
.review-auto .photo-tag { background: #0d6efd; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
.master-list textarea { font-family: Consolas, monospace; font-size: .85rem; }
.json-editor { font-family: Consolas, monospace; font-size: .8rem; min-height: 420px; }
.kv th { width: 35%; color: #666; font-weight: 500; }

.chat-wrap { display: flex; flex-direction: row; height: calc(100vh - 120px); min-height: 480px; overflow: hidden; }
.chat-list { width: 320px; border-right: 1px solid #e3e6ee; overflow-y: auto; background: #fff; flex-shrink: 0; }
.chat-list-head { padding: 14px 16px; font-weight: 700; background: var(--afb); color: #fff; }
.chat-contact { display: flex; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f0f2f6; }
.chat-contact:hover, .chat-contact.active { background: #eef3ff; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--afb-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid #e3e6ee; background: #fff; min-height: 60px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; background: #e9e4dc; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 70%; padding: 8px 12px 18px; border-radius: 10px; background: #fff; position: relative; align-self: flex-start; word-wrap: break-word; }
.bubble.mine { align-self: flex-end; background: #d9fdd3; }
.bubble .meta { position: absolute; right: 8px; bottom: 3px; font-size: .68rem; color: #667; }
.chat-input { display: flex; gap: 8px; padding: 10px; background: #f6f7f9; border-top: 1px solid #e3e6ee; }
@media (max-width: 768px) { .chat-list { width: 120px; } .chat-contact .flex-grow-1 { display: none; } }

.afb-logo-img { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; padding: 2px 5px; height: 34px; vertical-align: middle; margin-right: 4px; }
.afb-logo-img img { height: 28px; width: auto; }


/* ---------- Left side menu (grouped) ---------- */
.afb-side { position: fixed; top: 0; left: 0; bottom: 0; width: 250px; background: linear-gradient(180deg, #0a1a3f, #132a63); color: #fff; overflow-y: auto; z-index: 1040; transition: transform .2s; }
.afb-side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; color: #fff; text-decoration: none; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.12); }
.afb-side-brand img { height: 38px; width: auto; }
.afb-side-brand small { display: block; font-weight: 400; opacity: .7; font-size: .72rem; }
.afb-side-menu { padding: 6px 10px 24px; }
.afb-side-group { margin: 16px 8px 6px; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.5); font-weight: 700; }
.afb-side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: rgba(255,255,255,.86); text-decoration: none; font-size: .9rem; line-height: 1.2; }
.afb-side-link .ic { width: 22px; text-align: center; flex: none; }
.afb-side-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.afb-side-link.active { background: #1d4ed8; color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(29,78,216,.45); }
.afb-top { position: sticky; top: 0; z-index: 1030; margin-left: 250px; height: 54px; display: flex; align-items: center; padding: 0 18px; background: #fff; border-bottom: 1px solid #e3e8f2; }
.afb-main { margin-left: 250px; width: auto; }
.afb-side-shade { display: none; }
@media (max-width: 991.98px) {
    .afb-side { transform: translateX(-100%); }
    body.side-open .afb-side { transform: none; }
    body.side-open .afb-side-shade { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
    .afb-top, .afb-main { margin-left: 0; }
}
@media print { .afb-side, .afb-top { display: none; } .afb-main { margin-left: 0; } }
