:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); font-size: 13px; margin: 6px 0; }

/* ---------- вход ---------- */
#login-screen {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-card {
  background: var(--panel); padding: 36px; border-radius: 14px; box-shadow: var(--shadow);
  width: 340px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }

/* ---------- оформление ---------- */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: 200px; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
.brand { font-size: 17px; font-weight: 700; padding: 18px 16px; }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-btn {
  background: none; border: none; color: #cbd5e1; text-align: left; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.nav-btn:hover { background: #1e293b; }
.nav-btn.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar-bottom { margin-top: auto; padding: 14px 16px; border-top: 1px solid #1e293b; display: flex; flex-direction: column; gap: 8px; }
#main { flex: 1; padding: 0 24px 40px; min-width: 0; }
#topbar { padding: 14px 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
#client-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
#channel-tabs, #owner-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.channel-tab {
  border: 1px solid var(--border); background: var(--panel); padding: 4px 11px;
  border-radius: 14px; cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.channel-tab.active { background: #1e293b; border-color: #1e293b; color: #fff; font-weight: 600; }
.channel-tab .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.client-tab {
  border: 1px solid var(--border); background: var(--panel); padding: 6px 14px;
  border-radius: 20px; cursor: pointer; font-size: 13px;
}
.client-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------- бутони и полета ---------- */
.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
input, select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px;
  font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ---------- изгледи ---------- */
.view-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 16px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 20px; flex: 1; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* табло */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.card .big { font-size: 30px; font-weight: 700; }
.card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.card li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.card li b { font-weight: 600; }
.section-title { font-size: 15px; font-weight: 700; margin: 22px 0 10px; }

/* планер — часова мрежа */
.pl-grid { display: flex; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.pl-hours { flex-shrink: 0; width: 52px; border-right: 1px solid var(--border); }
.pl-hr { font-size: 11px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; box-sizing: border-box; }
.pl-days { display: flex; flex: 1; min-width: 0; }
.pl-days-1 { max-width: 420px; }
.pl-col { flex: 1; min-width: 90px; border-right: 1px solid var(--border); }
.pl-colhead { height: 34px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
.pl-colhead.today { color: #fff; background: var(--accent); border-radius: 6px 6px 0 0; }
.pl-colbody { position: relative; }
.pl-line { border-bottom: 1px solid #eef2f7; box-sizing: border-box; }
.pl-ev { position: absolute; left: 2px; right: 2px; border-radius: 6px; padding: 3px 5px; overflow: hidden; cursor: pointer; font-size: 11px; }
.pl-ev-t { font-weight: 700; }
.pl-ev-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-ev-loc { color: var(--muted); font-size: 10px; }

/* календар */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-day {
  background: var(--panel); border-radius: 8px; min-height: 96px; padding: 5px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  min-width: 0; overflow: hidden;
}
.cal-day.other { opacity: .45; }
.cal-week-cell { min-height: 340px; }
.day-list { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.day-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.day-row:last-child { border-bottom: 0; }
.day-row:hover { background: #f8fafc; }
.day-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.day-ch { font-size: 12px; color: var(--muted); width: 92px; flex-shrink: 0; }
.day-title { flex: 1; font-weight: 500; }
.cal-day.today { outline: 2px solid var(--accent); }
.cal-num { font-size: 11px; color: var(--muted); font-weight: 600; }
.chip {
  border-radius: 5px; padding: 2px 4px 2px 5px; font-size: 11px; color: #fff; cursor: pointer;
  display: flex; align-items: center; gap: 4px; min-width: 0;
}
.chip-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stdot {
  flex-shrink: 0; width: 15px; height: 15px; border-radius: 50%; color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .65);
}
.chip.dimmed { opacity: .5; }
.task-chip { border: 1px dashed rgba(255, 255, 255, .7); font-weight: 600; }
.task-chip.overdue { box-shadow: 0 0 0 2px #dc2626, 0 0 6px rgba(220, 38, 38, .5); }
.due-badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #f1f5f9; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.due-badge.overdue { background: #fee2e2; color: #dc2626; font-weight: 700; }
.overdue-tag { color: #dc2626; font-weight: 700; font-size: 11px; }
.overdue-input { border-color: #dc2626 !important; background: #fef2f2; color: #dc2626; font-weight: 600; }
.chk-badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #e0e7ff; color: #4338ca; font-weight: 600; white-space: nowrap; }
.chk-badge.full { background: #dcfce7; color: #15803d; }
.badge.city { background: #e0f2fe; color: #0369a1; }
#pwa-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  background: #0f172a; color: #fff; border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.28);
  font-size: 14px; max-width: 560px; margin: 0 auto;
}
#pwa-banner span { flex: 1; }
#pwa-banner .btn.small { flex-shrink: 0; }
.checklist { display: flex; flex-direction: column; gap: 2px; }
.chk-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; }
.chk-row input { width: 17px; height: 17px; }
.chk-row.done { background: #f0fdf4; color: var(--muted); }
.chk-row.done span { text-decoration: line-through; }
.map-box { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.map-box:empty { display: none; }
.mapframe { width: 100%; height: 240px; border: 0; border-radius: 10px; }
.status-legend {
  display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 12px;
  font-size: 12px; color: var(--muted);
}
.status-legend .lg-item { display: inline-flex; align-items: center; gap: 4px; }
.status-legend .stdot { width: 16px; height: 16px; box-shadow: none; }

/* канбан */
.kanban { display: flex; gap: 10px; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; }
.kan-col { background: #eef2f7; border-radius: var(--radius); min-width: 210px; width: 210px; flex-shrink: 0; }
.kanban-tasks .kan-col { flex: 1; width: auto; min-width: 230px; }
.kan-col h4 { margin: 0; padding: 10px 12px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); display: flex; justify-content: space-between; }
.kan-cards { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 10px; min-height: 40px; }
.kan-card {
  background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px;
  cursor: grab; border-left: 4px solid var(--accent); font-size: 13px;
}
.kan-card .meta { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; align-items: center; }
.kan-col.drag-over { outline: 2px dashed var(--accent); }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.badge.owner { background: #f1f5f9; color: var(--muted); }

/* списък / таблици */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.grid th { text-align: left; font-size: 12px; color: var(--muted); padding: 9px 10px; border-bottom: 2px solid var(--border); background: #f8fafc; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
table.grid tr:hover td { background: #f8fafc; }
table.grid tr { cursor: pointer; }
.status-pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; }

/* модал */
#modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto;
}
#modal { background: var(--panel); border-radius: 14px; width: 560px; max-width: 100%; padding: 22px; }
#modal h3 { margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.form-grid label.full { grid-column: 1 / -1; }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; justify-content: flex-end; }
.modal-actions .left { margin-right: auto; }
.activity-log { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; max-height: 140px; overflow-y: auto; }

/* инструкции (playbook) */
.doc { max-height: 55vh; overflow-y: auto; padding-right: 6px; }
.doc h3 { margin: 14px 0 6px; font-size: 17px; }
.doc h4 { margin: 12px 0 4px; font-size: 15px; }
.doc h5 { margin: 10px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.doc-p { margin: 4px 0; line-height: 1.55; }
.doc-li { margin: 2px 0 2px 8px; line-height: 1.5; }
.doc-img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.doc .yt { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; margin: 6px 0; }
.prompt-box { background: #0f172a; border-radius: 8px; padding: 10px; margin: 8px 0; position: relative; }
.prompt-box pre { color: #a5f3fc; font-size: 12px; white-space: pre-wrap; margin: 30px 0 0; font-family: ui-monospace, monospace; }
.prompt-box .copy-btn { position: absolute; top: 8px; right: 8px; }

/* чат/бележки по задача */
.chat-box {
  max-height: 220px; overflow-y: auto; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; font-size: 13px; max-width: 85%; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: #bfdbfe; }
.chat-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.chat-msg.returned { border-left: 4px solid #dc2626; background: #fef2f2; }
.chat-msg.approved { border-left: 4px solid #16a34a; background: #f0fdf4; }
.chat-input { display: flex; gap: 8px; margin-top: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; resize: vertical; }

/* видео плеър в модала */
.video-box { margin-top: 12px; background: #0f172a; border-radius: 10px; padding: 8px; text-align: center; }
.video-box .vplayer {
  width: 100%; max-width: 100%; height: 52vh; max-height: 480px;
  border: 0; border-radius: 8px; background: #000;
}
.video-box a { color: #a5f3fc; }
.video-box .vimg { max-width: 100%; max-height: 480px; border-radius: 8px; display: block; margin: 0 auto; }

/* персонално табло */
.client-group { margin: 10px 0 4px; }
.cg-head {
  font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 7px;
  padding: 8px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.cg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* фактури */
.inv-item { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.inv-item .ii-desc { flex: 1; }
.inv-item .ii-qty { width: 70px; } .inv-item .ii-price { width: 100px; }
.inv-item .ii-sum { width: 100px; text-align: right; font-weight: 600; font-size: 12px; }
.inv-total { text-align: right; margin: 10px 2px; font-size: 14px; }

/* реклами */
.ads-chart { width: 100%; max-width: 640px; height: auto; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; }
.ads-legend { display: flex; gap: 16px; margin: 8px 2px; font-size: 12px; color: var(--muted); }
.ads-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
tr.ads-total td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--border); }
.cur-note { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.cur-note.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.badge.cur-badge { background: #fef3c7; color: #92400e; font-weight: 700; }

/* таймер и отчети */
.timer-chip {
  background: #16a34a; color: #fff; border-radius: 8px; padding: 7px 9px;
  font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.timer-chip .timer-title {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9;
}
.work-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.report-cols { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }
@media (max-width: 900px) { .report-cols { grid-template-columns: 1fr; } }

/* одобрение (клиент) */
.approve-bar { display: flex; gap: 8px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.approve-bar textarea { flex: 1; min-width: 200px; }

/* мобилни филтри: скрити зад бутон, всяка лента = 1 ред с плъзгане */
.filters-toggle { display: none; }
@media (max-width: 760px) {
  .filters-toggle { display: inline-flex; align-self: flex-start; }
  #topbar:not(.open) #client-tabs,
  #topbar:not(.open) #channel-tabs,
  #topbar:not(.open) #owner-tabs { display: none; }
  #topbar.open #client-tabs,
  #topbar.open #channel-tabs,
  #topbar.open #owner-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none;
  }
  #topbar.open #client-tabs::-webkit-scrollbar,
  #topbar.open #channel-tabs::-webkit-scrollbar,
  #topbar.open #owner-tabs::-webkit-scrollbar { display: none; }
  .client-tab, .channel-tab { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 760px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto;
    /* да не се крие под нотча/статус лентата в Safari и в инсталираното приложение */
    padding-top: env(safe-area-inset-top, 0px);
  }
  #main { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  #nav { flex-direction: row; }
  /* мобилно меню: иконка центрирана НАД надписа */
  .nav-btn { flex-direction: column; align-items: center; gap: 3px; font-size: 12px; padding: 8px 12px; }
  .nav-btn .ni { font-size: 19px; line-height: 1; }
  .nav-btn .nl { line-height: 1; }
  .sidebar-bottom { margin: 0 0 0 auto; border: none; flex-direction: row; align-items: center; }
  .brand { display: none; }
  #main { padding: 0 10px 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .cal-day { min-height: 64px; }
}

/* ---------- автопарк ---------- */
.fleet-wrap { display: flex; flex-direction: column; gap: 18px; padding-bottom: 30px; }
.fleet-sec { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.fleet-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fleet-sec-head h3 { margin: 0; font-size: 16px; }
.fleet-remind { background: #fff7ed; border: 1px solid #fed7aa; border-radius: var(--radius); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* балончета за избор на кола */
.veh-bubbles { display: flex; flex-wrap: wrap; gap: 10px; }
.veh-bubble { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border: 2px solid var(--accent); border-radius: 999px; background: var(--panel); cursor: pointer; font-size: 15px; transition: transform .06s, background .12s; }
.veh-bubble:hover { background: var(--accent-soft); transform: translateY(-1px); }
.veh-bubble b { font-weight: 700; }
.veh-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.veh-plate { font-family: ui-monospace, monospace; background: #f1f5f9; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px; letter-spacing: .5px; }
.veh-active { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius); padding: 12px 14px; }

/* админ карти за коли */
.veh-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.veh-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.veh-card.inactive { opacity: .55; }
.veh-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.veh-exps { display: flex; flex-direction: column; gap: 5px; }
.veh-card-act { display: flex; gap: 6px; }
.exp-chip { font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: #f8fafc; }
.exp-chip.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.exp-chip.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.exp-chip.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; font-weight: 600; }
.exp-chip.none { color: var(--muted); }

/* глоби */
.fines-list { display: flex; flex-direction: column; gap: 10px; }
.fine-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.fine-row.admin { align-items: center; }
.fine-row.todo { border-left: 4px solid var(--danger); }
.fine-row.done { border-left: 4px solid var(--ok); }
.fine-main { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 4px; }
.fine-main > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fine-act { display: flex; gap: 6px; }
.fine-decl { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.fine-thumb { flex: none; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; background: #f8fafc; font-size: 11px; color: var(--muted); text-align: center; }
.fine-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fine-thumb.big { width: 100%; height: auto; max-height: 260px; margin-bottom: 6px; }
.fine-thumb.big img { height: auto; object-fit: contain; }

/* дневник */
.fleet-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.fleet-tbl th, .fleet-tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.fleet-tbl th { color: var(--muted); font-weight: 600; }
.chip.live { background: #dcfce7; color: #166534; }
.chk-row { flex-direction: row !important; align-items: center; gap: 8px !important; }

/* известия на клиента (по статус) */
.np-wrap { display: flex; flex-wrap: wrap; gap: 16px; margin: 6px 0 4px; }
.np-group { flex: 1; min-width: 200px; }
.np-title { font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.np-cb { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.np-cb input { width: 16px; height: 16px; }

/* отчети по услуги */
.avg-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.avg-row.weeks { margin-top: -4px; }
.avg-chip { font-size: 12px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px; padding: 4px 9px; }
.avg-row.weeks .avg-chip { background: #eff6ff; border-color: #bfdbfe; }
.rep-tbl td, .rep-tbl th { font-size: 13px; }
#timer-box { display: flex; flex-direction: column; gap: 6px; }

/* демо режим */
#demo-badge {
  position: fixed; right: 14px; bottom: 14px; z-index: 200; cursor: pointer;
  background: #7c3aed; color: #fff; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
#demo-badge u { opacity: .85; }

/* 📸 референции за заснемане */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.att-grid:empty { display: none; }
.att-tile { margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f8fafc; display: flex; flex-direction: column; }
.att-tile img, .att-tile video { width: 100%; height: 130px; object-fit: cover; display: block; background: #0f172a; }
.att-tile audio { width: 100%; margin: 8px 0; }
.att-tile .att-doc { display: flex; align-items: center; justify-content: center; height: 130px; padding: 8px; font-size: 13px; text-align: center; word-break: break-word; }
.att-tile figcaption { font-size: 11px; color: var(--muted); padding: 5px 7px; display: flex; gap: 4px; align-items: center; }
.att-tile figcaption span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-del { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0 2px; }
.att-drop { display: block; margin-top: 10px; border: 1.5px dashed var(--border); border-radius: 8px; padding: 12px; text-align: center; cursor: pointer; font-size: 13px; }
.att-drop:hover, .att-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.att-progress:empty { display: none; }
.att-progress { margin-top: 6px; }

/* 🎤 гласови бележки */
.voice-btn { font-size: 16px; padding: 6px 11px; }
.voice-btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; animation: voicepulse 1.2s infinite; }
@keyframes voicepulse { 50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, .25); } }
@media (prefers-reduced-motion: reduce) { .voice-btn.rec { animation: none; } }
.voice-panel { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #f8fafc; }
.voice-panel audio { width: 100%; }
.voice-rec { font-size: 13px; }
.voice-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); margin-right: 4px; }
.voice-live { margin-top: 4px; font-style: italic; }
.voice-actions { display: flex; gap: 8px; justify-content: flex-end; }
.chat-audio { width: 100%; max-width: 320px; height: 36px; display: block; margin: 2px 0; }

/* ⋮ меню на бележка */
.chat-msg { position: relative; }
.chat-more { float: right; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; margin-left: 6px; border-radius: 4px; }
.chat-more:hover, .chat-more:focus-visible { background: rgba(15, 23, 42, .08); color: var(--text); outline: none; }
.chat-menu { position: absolute; right: 8px; top: 26px; z-index: 5; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(15, 23, 42, .15); display: flex; flex-direction: column; min-width: 170px; overflow: hidden; }
.chat-menu button { border: 0; background: none; text-align: left; padding: 9px 12px; font-size: 13px; cursor: pointer; color: var(--text); }
.chat-menu button:hover { background: #f1f5f9; }
.chat-menu button.danger { color: var(--danger); }

/* ---------- Резултати (дневни данни от Supermetrics) ---------- */
.res-meta { color: var(--muted); font-size: 12.5px; margin: -8px 0 14px; line-height: 1.6; }
.res-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.res-kpi { padding: 14px 16px; }
.res-kpi h3 { margin-bottom: 6px; }
.res-kpi .big { font-size: 26px; line-height: 1.15; }
.res-delta { display: inline-block; margin-top: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.res-delta.good { color: var(--ok); }
.res-delta.bad { color: var(--danger); }
.res-delta.flat { color: var(--muted); font-weight: 500; }
.res-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; }
.res-chart { position: relative; padding: 14px 14px 8px; }
.res-chart h3 { margin: 0 0 6px; }
.res-chart svg { display: block; max-width: 100%; }
.res-chart svg .res-hit { cursor: crosshair; }
.res-tip { position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -100%); background: #0f172a; color: #fff;
  font-size: 12px; line-height: 1.45; padding: 6px 10px; border-radius: 8px; white-space: nowrap; box-shadow: 0 4px 14px rgba(15, 23, 42, .18); }
.res-scroll { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--panel); }
.res-scroll table.grid { box-shadow: none; min-width: 560px; }
table.res-table tr { cursor: default; }
table.res-table th.num, table.res-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.res-sub { display: block; font-size: 11.5px; }
.res-sub .res-delta { margin-top: 1px; font-size: 11.5px; }
.res-status { font-size: 12px; white-space: nowrap; }
.res-status.on { color: var(--ok); font-weight: 600; }
.res-status.off { color: var(--muted); }
.res-ads { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.res-ad { display: flex; gap: 12px; align-items: flex-start; padding: 12px; }
.res-ad img, .res-ad .noimg { width: 72px; height: 72px; flex: none; object-fit: cover; border-radius: 8px; background: #f1f5f9; border: 1px solid var(--border); }
.res-ad img.broken { visibility: hidden; }
.res-ad b { display: block; font-size: 13px; line-height: 1.3; word-break: break-word; }
.res-ad-stats { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 6px; font-size: 12.5px; }
.res-alerts { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.res-alert { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; font: inherit; font-size: 13px; color: var(--text);
  padding: 8px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--border); cursor: pointer; }
.res-alert.high { background: #fef2f2; border-color: #fecaca; }
.res-alert.warn { background: #fffbeb; border-color: #fde68a; }
.res-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.res-note { line-height: 1.55; }
.res-note textarea { width: 100%; min-height: 120px; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.res-note-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.res-foot { margin-top: 18px; max-width: 760px; }
@media (max-width: 760px) {
  .res-kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .res-kpi .big { font-size: 22px; }
  .res-charts { grid-template-columns: 1fr; }
}

/* --- преглед от екипа (v46) --- */
.review-bar { border-left: 3px solid #c2410c; padding-left: 8px; }
.claim-row { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; }
.claim-badge { font-size: 12px; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 999px; padding: 2px 8px; }
.chat-input { flex-wrap: wrap; }
.chat-internal { flex-basis: 100%; display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: #64748b; font-weight: 400; }
.chat-msg.internal { border: 1px dashed #fdba74; background: #fffbf5; }
