/* ============================================================
   NEOTRISH Crew — extra styles (builds on app-main.css variables)
   ============================================================ */

/* ---------- Generic helpers ---------- */
.fw-800 { font-weight: 800; }
.text-xs { font-size: .75rem; }
.cursor-pointer { cursor: pointer; }
.thumb-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: var(--border-color); display: block; }
.thumb-sm { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--border-color); }
.avatar-lg { width: 84px; height: 84px; border-radius: 50%; background: var(--nr-primary-light); color: var(--nr-primary-dark);
    display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--nr-primary-light); color: var(--nr-primary-dark);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--nr-success); } .dot-warn { background: var(--nr-warning); } .dot-bad { background: var(--nr-danger); }

/* ---------- Avatars ---------- */
.avatar-xs { width: 26px; height: 26px; border-radius: 50%; background: var(--nr-primary-light); color: var(--nr-primary-dark);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .72rem; flex-shrink: 0; }
.avatar-md { width: 52px; height: 52px; border-radius: 50%; background: var(--nr-primary-light); color: var(--nr-primary-dark);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; flex-shrink: 0; }
img.avatar-img { object-fit: cover; padding: 0; background: var(--border-color); border: 2px solid var(--card-bg); box-shadow: 0 0 0 1px var(--border-color); }
.avatar-edit { position: relative; display: inline-block; cursor: pointer; flex-shrink: 0; }
.avatar-edit .avatar-cam { position: absolute; bottom: 0; inset-inline-end: 0; background: var(--nr-primary); color: #fff; width: 28px; height: 28px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .85rem; border: 2px solid var(--card-bg); }
.avatar-edit input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.worker-chip { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border: 1px solid var(--border-color); border-radius: 14px;
    background: var(--card-bg); text-decoration: none; color: inherit; height: 100%; }
.worker-chip:hover { color: inherit; box-shadow: var(--card-shadow); }
.worker-chip .wc-name { font-weight: 700; font-size: .88rem; line-height: 1.2; }
.worker-chip .wc-sub { font-size: .72rem; color: var(--text-secondary); }

/* ---------- Score ring ---------- */
.score-ring { --p: 0; --c: var(--nr-primary); width: 96px; height: 96px; border-radius: 50%;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border-color) 0);
    display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; }
.score-ring::before { content: ''; position: absolute; inset: 9px; background: var(--card-bg); border-radius: 50%; }
.score-ring span { position: relative; font-weight: 800; font-size: 1.35rem; }
.score-ring.good { --c: var(--nr-success); } .score-ring.mid { --c: var(--nr-warning); } .score-ring.low { --c: var(--nr-danger); }
.score-ring.sm { width: 56px; height: 56px; } .score-ring.sm::before { inset: 6px; } .score-ring.sm span { font-size: .9rem; }

/* ---------- Chat (bot / manager / worker) ---------- */
.chat { display: flex; flex-direction: column; gap: .75rem; }
.bubble { max-width: 92%; padding: .7rem .95rem; border-radius: 14px; font-size: .88rem; white-space: pre-line; line-height: 1.7; }
.bubble .who { font-size: .72rem; font-weight: 700; margin-bottom: .2rem; opacity: .75; display: flex; align-items: center; gap: .35rem; }
.bubble .when { font-size: .68rem; opacity: .55; margin-top: .3rem; }
.bubble-bot { background: #eef2ff; color: #3730a3; align-self: flex-start; border-start-start-radius: 4px; }
.bubble-manager { background: var(--nr-primary-light); color: var(--nr-primary-dark); align-self: flex-start; border-start-start-radius: 4px; }
.bubble-worker { background: #f1f5f9; color: var(--text-primary); align-self: flex-end; border-start-end-radius: 4px; }
.theme-dark .bubble-bot { background: #27306b; color: #c7d2fe; }
.theme-dark .bubble-worker { background: #334155; }

/* ---------- Findings list ---------- */
.finding { display: flex; gap: .55rem; align-items: flex-start; font-size: .83rem; padding: .3rem 0; }
.finding i { margin-top: .15rem; }
.finding.ok i { color: var(--nr-success); } .finding.warn i { color: var(--nr-warning); } .finding.fail i { color: var(--nr-danger); }

/* ---------- Photo upload slots ---------- */
.photo-slot { border: 2px dashed var(--border-color); border-radius: 14px; padding: .8rem; text-align: center; position: relative;
    background: var(--card-bg); transition: var(--transition); }
.photo-slot.filled { border-style: solid; border-color: var(--nr-primary); }
.photo-slot .slot-title { font-weight: 700; font-size: .85rem; }
.photo-slot .slot-hint { font-size: .73rem; color: var(--text-muted); margin-bottom: .5rem; }
.photo-slot .slot-preview { display: none; width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; margin-bottom: .5rem; }
.photo-slot.filled .slot-preview { display: block; }
.photo-slot .slot-icon { font-size: 2rem; color: var(--nr-primary); }
.photo-slot.filled .slot-icon { display: none; }
.photo-slot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.photo-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.compress-badge { position: absolute; top: 6px; inset-inline-end: 8px; font-size: .65rem; background: var(--nr-primary); color: #fff; padding: .1rem .4rem; border-radius: 6px; display: none; }
.photo-slot.filled .compress-badge { display: block; }

/* ---------- Checklist ---------- */
.check-item { display: flex; align-items: center; gap: .7rem; padding: .7rem .85rem; border: 1px solid var(--border-color);
    border-radius: 12px; margin-bottom: .5rem; background: var(--card-bg); cursor: pointer; }
.check-item input { width: 1.2rem; height: 1.2rem; accent-color: var(--nr-primary); flex-shrink: 0; }
.check-item:has(input:checked) { border-color: var(--nr-primary); background: var(--nr-primary-light); }

/* ---------- Worker app (mobile first) ---------- */
body.worker-app { background: var(--body-bg); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.worker-top { position: sticky; top: 0; z-index: 1020; background: var(--topbar-bg); border-bottom: 1px solid var(--topbar-border);
    padding: .65rem 1rem; padding-top: calc(.65rem + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; }
.worker-top .brand { font-weight: 800; color: var(--nr-primary); font-size: 1.15rem; }
.worker-main { max-width: 720px; margin: 0 auto; padding: 1rem; }
.worker-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 1030; background: var(--card-bg); border-top: 1px solid var(--border-color);
    display: flex; justify-content: space-around; padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 14px rgba(0,0,0,.05); }
.worker-nav a { flex: 1; text-align: center; color: var(--text-secondary); text-decoration: none; font-size: .68rem; padding: .3rem 0; position: relative; font-weight: 600; }
.worker-nav a i { display: block; font-size: 1.35rem; margin-bottom: .1rem; }
.worker-nav a.active { color: var(--nr-primary); }
.worker-nav a .nav-dot { position: absolute; top: 2px; inset-inline-start: calc(50% + 6px); background: var(--nr-danger); color: #fff;
    font-size: .6rem; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; line-height: 16px; }

.hero-card { background: linear-gradient(135deg, var(--nr-primary), var(--nr-primary-dark)); color: #fff; border: 0; border-radius: 18px; padding: 1.2rem; }
.hero-card .muted { color: rgba(255,255,255,.8); font-size: .8rem; }
.hero-card .big { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.hero-card .btn-light { color: var(--nr-primary-dark); font-weight: 700; border-radius: 12px; }

.task-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border-color); border-radius: 14px;
    background: var(--card-bg); padding: .9rem 1rem; margin-bottom: .65rem; border-inline-start: 5px solid var(--border-color); }
.task-card:hover { color: inherit; box-shadow: var(--card-shadow); }
.task-card.st-pending { border-inline-start-color: var(--text-muted); }
.task-card.st-submitted { border-inline-start-color: var(--nr-warning); }
.task-card.st-approved { border-inline-start-color: var(--nr-success); }
.task-card.st-needs_fix, .task-card.st-missed { border-inline-start-color: var(--nr-danger); }
.task-card .t-title { font-weight: 700; font-size: .95rem; }
.task-card .t-meta { font-size: .76rem; color: var(--text-secondary); }
.cat-chip { font-size: .68rem; padding: .15rem .55rem; border-radius: 20px; background: var(--nr-primary-light); color: var(--nr-primary-dark); font-weight: 700; }

.big-btn { padding: .9rem 1rem; font-size: 1rem; border-radius: 14px; font-weight: 700; }
.declare-row { display: flex; align-items: center; justify-content: space-between; padding: .7rem 0; border-bottom: 1px dashed var(--border-color); font-size: .88rem; }
.declare-row .form-check-input { width: 2.6rem; height: 1.4rem; }

/* ---------- Notifications dropdown ---------- */
.notif-btn { position: relative; }
.notif-count { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--nr-danger); color: #fff; font-size: .62rem;
    min-width: 17px; height: 17px; line-height: 17px; border-radius: 9px; text-align: center; padding: 0 4px; display: none; }
.notif-menu { width: 330px; max-width: 92vw; padding: 0; }
.notif-menu .n-head { padding: .7rem 1rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.notif-menu .n-list { max-height: 360px; overflow-y: auto; }
.notif-menu a.n-item { display: block; padding: .65rem 1rem; border-bottom: 1px solid var(--border-color); font-size: .83rem; color: var(--text-primary); text-decoration: none; }
.notif-menu a.n-item.unread { background: var(--nr-primary-light); font-weight: 600; }
.notif-menu .n-time { font-size: .7rem; color: var(--text-muted); font-weight: 400; }

/* ---------- Leaderboard ---------- */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: .75rem; padding: 1rem 0 .5rem; }
.podium .p-col { text-align: center; flex: 1; max-width: 140px; }
.podium .p-bar { border-radius: 12px 12px 0 0; background: var(--nr-primary-light); color: var(--nr-primary-dark); display: flex; align-items: flex-start;
    justify-content: center; padding-top: .5rem; font-weight: 800; font-size: 1.4rem; }
.podium .p-1 .p-bar { height: 110px; background: linear-gradient(180deg,#fde68a,#f59e0b); color: #78350f; }
.podium .p-2 .p-bar { height: 80px; background: linear-gradient(180deg,#e2e8f0,#94a3b8); color: #334155; }
.podium .p-3 .p-bar { height: 60px; background: linear-gradient(180deg,#fed7aa,#c2703d); color: #7c2d12; }
.podium .p-name { font-weight: 700; font-size: .85rem; margin-bottom: .3rem; }
.podium .p-pts { font-size: .75rem; color: var(--text-secondary); }

/* ---------- 3D chart ---------- */
.chart-3d { width: 100%; height: 440px; }
.chart-box { position: relative; height: 280px; }
.chart-fallback { display: none; }

/* ---------- Timeline (hygiene weekly) ---------- */
.hy-week { border: 1px solid var(--border-color); border-radius: 14px; padding: .8rem; margin-bottom: .75rem; background: var(--card-bg); }
.hy-week .hy-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; font-size: .85rem; font-weight: 700; }

/* ---------- Table / toolbar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar .form-select, .filter-bar .form-control { min-width: 130px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card-bg); padding: .75rem 0; border-top: 1px solid var(--border-color); z-index: 5; }
.stat-mini { text-align: center; padding: .7rem .4rem; }
.stat-mini .n { font-size: 1.35rem; font-weight: 800; }
.stat-mini .l { font-size: .72rem; color: var(--text-secondary); }

/* ---------- Busy overlay on submit ---------- */
.busy-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center;
    z-index: 3000; color: #fff; flex-direction: column; gap: 1rem; font-weight: 700; }
.busy-overlay.show { display: flex; }

/* ---------- Print (monthly report) ---------- */
@media print {
    .sidebar, .topbar, .worker-nav, .worker-top, .no-print, .sidebar-backdrop, #page-preloader, .toast-container { display: none !important; }
    .main-content { margin: 0 !important; } .page-body { padding: 0 !important; }
    body { background: #fff !important; color: #000 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
    .print-page-break { page-break-before: always; }
}

@media (max-width: 575.98px) {
    .page-body { padding: 1rem .75rem; }
    .kpi-card .kpi-value { font-size: 1.35rem; }
    .chart-3d { height: 340px; }
}
