/* styles.css — Screen B (mobile app look). agent2. */
.app-b {
  background: linear-gradient(180deg, var(--brand-700), var(--brand-600) 40%, var(--bg) 40%);
  min-height: 100vh; min-height: 100dvh;
}
.phone {
  max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; position: relative;
}

/* Header */
.app-header {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--sp-4) 12px;
  color: #fff;
}
.app-title { font-weight: 800; font-size: 1.1rem; flex: 1; text-align: center; }
.icon-btn {
  position: relative; background: rgba(255,255,255,.18); border: none; color: #fff;
  width: 44px; height: 44px; border-radius: var(--radius-pill); font-size: 1.2rem; cursor: pointer;
}
.app-header .lang-toggle { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }
.app-header .count-badge { position: absolute; inset-block-start: -2px; inset-inline-end: -2px; }

/* View area */
.view { flex: 1; padding: var(--sp-4); padding-bottom: 96px; }

/* Auth card */
.brand-hero { text-align: center; color: #fff; padding: var(--sp-4) 0 var(--sp-5); }
.brand-hero .logo { width: 76px; height: 76px; margin: 0 auto var(--sp-3); }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: var(--sp-5); }
.seg { display: flex; background: var(--surface-2); border-radius: var(--radius-pill); padding: 4px; margin-bottom: var(--sp-4); }
/* 44px: this is the very first control anyone touches in the app, and it was
   36px — the login/register switch on the sign-in screen. */
.seg button { flex: 1; border: none; background: transparent; padding: 10px; min-height: 44px; border-radius: var(--radius-pill); font-weight: 700; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--brand-600); color: #fff; }

/* Home */
.hello { color: var(--text-2); }
.hello b { color: var(--text); }
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.counters .stat .n { font-size: 1.5rem; }
/* Six tiles on a 360px phone: the card padding has to give, not the numbers. */
.counters.six { gap: var(--sp-2); }
.counters.six .stat { padding: var(--sp-3) 4px; }
.counters.six .stat .n { font-size: 1.35rem; line-height: 1.2; }
.counters.six .stat .l { font-size: .68rem; line-height: 1.25; }
.section-head { color: var(--text-2); font-size: .85rem; margin-block-end: calc(-1 * var(--sp-2)); }

/* Charts (hand-written SVG — no library, see app.js) */
.chart-title { margin: 0 0 var(--sp-3); font-size: .95rem; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.bar-hit { cursor: pointer; }
.bar-detail {
  margin-block-start: var(--sp-3); padding-block-start: var(--sp-3);
  border-top: 1px solid var(--border); font-size: .9rem;
}
.donut-wrap { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: none; }
.legend { flex: 1; min-width: 150px; display: grid; gap: 6px; }
.legend-row { display: flex; align-items: center; gap: var(--sp-2); font-size: .85rem; }
.legend-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Connectivity strip — always visible while offline or while the outbox drains,
   because "you have no signal" is something to know BEFORE recording a video. */
.conn-bar {
  position: sticky; inset-block-start: 0; z-index: 400;
  padding: 8px 14px; text-align: center; font-size: .82rem; font-weight: 700;
  background: var(--brand-600); color: #fff;
}
.conn-bar.is-offline { background: var(--warning); color: #1a1200; }

/* Archive status filter */
.filter-chips { gap: 6px; margin-block-end: var(--sp-3); }
.chip-filter {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: var(--radius-pill); padding: 6px 12px; font-size: .78rem; font-weight: 700;
  /* 44px, not 32px. These are the only controls on Screen B that were under the
     touch target — and this is the phone app, where every control is touched. */
  cursor: pointer; min-height: 44px;
}
.chip-filter.on { background: var(--chip, var(--brand-600)); border-color: transparent; color: #fff; }

/* Tabbar */
.tabbar {
  position: fixed; inset-inline: 0; inset-block-end: 0; max-width: 480px; margin: 0 auto;
  background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
}
.tab {
  border: none; background: transparent; color: var(--text-2); font-weight: 700; font-size: .72rem;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 6px;
}
.tab span { font-size: .72rem; }
.tab.active { color: var(--brand-600); }
.tab > :first-child { font-size: 1.25rem; }

/* Attachments */
.attach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.attach-btn {
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
  padding: var(--sp-3); text-align: center; cursor: pointer; font-size: .8rem; color: var(--text-2);
  display: block; width: 100%; min-height: 44px;   /* touch target */
}
/* The file picker is the fallback, not the headline — it reads quieter than the
   capture buttons above it, but stays a full-size touch target. */
.attach-btn.subtle { border-style: dotted; opacity: .8; font-size: .72rem; padding: var(--sp-2); }
.attach-or { margin: var(--sp-3) 0 var(--sp-2); }

/* In-app capture */
.modal.capture { max-width: 420px; }
.cap-video {
  width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: var(--radius);
  margin-block: var(--sp-3); object-fit: cover;
}
.cap-audio {
  width: 100%; height: 120px; display: grid; place-items: center; font-size: 2.6rem;
  background: var(--surface-2); border-radius: var(--radius); margin-block: var(--sp-3);
}
/* "6 / 30s" is a numeric readout, not prose. Left to the page's RTL direction
   the bidi algorithm reorders the neutral " / " and renders it "30s / 6", which
   reads as the wrong number entirely. Isolate it as LTR — the flex row still
   places the element on the correct side. */
.cap-clock {
  font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text-2);
  direction: ltr; unicode-bidi: isolate;
}
.modal.capture.recording .cap-clock { color: var(--danger); }
.modal.capture.recording .cap-video,
.modal.capture.recording .cap-audio { outline: 3px solid var(--danger); outline-offset: 2px; }
/* A recording indicator that does not depend on colour alone. */
.modal.capture.recording .cap-audio span { animation: cap-pulse 1s ease-in-out infinite; }
@keyframes cap-pulse { 50% { opacity: .35; transform: scale(.92); } }
@media (prefers-reduced-motion: reduce) { .modal.capture.recording .cap-audio span { animation: none; } }
.cap-actions { margin-block-start: var(--sp-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-100); color: var(--brand-700);
  border-radius: var(--radius-pill); padding: 4px 10px; font-size: .78rem; font-weight: 700; }
.chip button { border: none; background: transparent; color: var(--danger); cursor: pointer; font-weight: 800; }

/* Ticket list */
.ticket-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.ticket-item .no { font-weight: 800; color: var(--brand-700); }

/* Rating */
.rate-row { display: flex; gap: var(--sp-3); }
.rate-row .btn { flex: 1; }
