/* ==========================================================================
   Arundi Call Center CRM — Framed Sheet Design System
   Generated from tasteskill v2 (--app --style framed-sheet)
   ========================================================================== */

:root {
  --ground: #f9fbfc;
  --surface: #ffffff;
  --raised: #f4f6f8;
  --active: #ebedee;
  --border: #e8eaec;
  --rule: #f0f1f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --faint: #686a6c;
  --primary: #131416;
  --accent: #1b6c80;
  --accent-tint: #e6f2f5;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;
  --chart-1: #1b6c80;
  --chart-2: #2f70bb;
  --chart-3: #a86f0c;
  --chart-4: #5d5f60;

  --pill-positive-bg: #dcfae5;
  --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea;
  --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;
  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee;
  --pill-neutral-ink: #353736;
  --pill-accent-bg: #e0f0f4;
  --pill-accent-ink: #0f4452;

  /* Agent identity tints (at least 60 deg apart per app-screens.md §2.3) */
  --agent-arundi-bg: #e0f0f4;
  --agent-arundi-ink: #0f4452;
  --agent-dewmi-bg: #dcfae5;
  --agent-dewmi-ink: #04250e;
  --agent-amandi-bg: #fef3c7;
  --agent-amandi-ink: #78350f;
  --agent-admin-bg: #ebedee;
  --agent-admin-ink: #131416;

  --radius-card: 8px;
  --radius-control: 6px;
  --radius-sheet: 16px;
  --radius-chip: 4px;
  --sheet-inset: 8px;
  --row-height: 48px;
  --sidebar-width: 228px;
  --gap: 24px;
  --pad: 24px;
  --control-height: 34px;

  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 28px;
  --fs-body: 14px;
  --fs-small: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.num {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   1. Framed-Sheet App Shell (Desktop 1440px -> Tablet 768px -> Mobile 390px)
   ========================================================================== */

.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 48px 1fr;
  min-height: 100vh;
  background: var(--ground);
}

.app-frame.caller-mode {
  grid-template-columns: 1fr;
  grid-template-rows: 52px 1fr;
}

/* Sidebar */
.app-sidebar {
  grid-row: 1 / -1;
  grid-column: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--ground);
  user-select: none;
}

.app-frame.caller-mode .app-sidebar {
  display: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.brand-scope {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.nav-group-label {
  font-size: 12px;
  color: var(--muted);
  padding: 16px 10px 8px;
  font-weight: 400;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  transition: background-color 120ms ease, color 120ms ease;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--raised);
  color: var(--text);
}

.nav-item.active {
  background: var(--active);
  color: var(--text);
  font-weight: 500;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  flex: none;
}

.nav-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  background: var(--raised);
  border: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex: none;
}

.avatar-arundi { background: var(--agent-arundi-bg); color: var(--agent-arundi-ink); }
.avatar-dewmi  { background: var(--agent-dewmi-bg);  color: var(--agent-dewmi-ink); }
.avatar-amandi { background: var(--agent-amandi-bg); color: var(--agent-amandi-ink); }
.avatar-admin  { background: var(--agent-admin-bg);  color: var(--agent-admin-ink); }

/* Top Bar */
.app-topbar {
  grid-column: 2;
  grid-row: 1;
  height: 48px;
  padding: 0 24px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ground);
}

.app-frame.caller-mode .app-topbar {
  grid-column: 1;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  height: 32px;
  padding: 0 10px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-control);
  border: 1px solid var(--control);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
}

.sync-dot.offline {
  background: var(--warning);
}

/* White Inset Sheet */
.app-sheet {
  grid-column: 2;
  grid-row: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  padding: var(--pad);
  min-width: 0;
}

.app-frame.caller-mode .app-sheet {
  grid-column: 1;
  margin: 0;
  border: none;
  border-radius: 0;
  background: var(--ground);
  padding: 16px;
}

/* ==========================================================================
   2. Title Row, Scope Tabs, and Controls
   ========================================================================== */

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--fs-title);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-height);
  padding: 0 14px;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background: #27292d;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

.btn-accent:hover {
  background: #155768;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--control);
}

.btn-secondary:hover {
  background: var(--raised);
}

.btn-danger {
  background: var(--surface);
  color: var(--negative);
  border: 1px solid #f3c2c4;
}

.btn-danger:hover {
  background: var(--pill-negative-bg);
}

/* Underline Tabs */
.tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.tabs-list {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 2px 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   3. Divided KPI Strip (app-screens.md §5 — 1 container split by 1px rules)
   ========================================================================== */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  margin-bottom: 24px;
}

.kpi-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-cell:last-child {
  border-right: none;
}

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: var(--fs-kpi);
  font-weight: 400;
  color: var(--text);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.kpi-value.lead {
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
}

.kpi-unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 3px;
}

.kpi-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.delta-pos {
  color: var(--positive);
  font-weight: 500;
}

/* ==========================================================================
   4. Overview Grid (Main Column + 384px Right Rail, 24px gap)
   ========================================================================== */

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--gap);
  align-items: start;
}

.main-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.side-rail {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.panel-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: var(--fs-section);
  font-weight: 600;
  color: var(--text);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Agent Workload & Progress Rows */
.agent-board {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.agent-track-row {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.agent-track-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.agent-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-name {
  font-size: 15px;
  font-weight: 600;
}

.agent-range-tag {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.agent-metrics-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.progress-bar-wrap {
  height: 10px;
  background: var(--raised);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  gap: 2px;
}

.progress-seg {
  height: 100%;
  transition: width 260ms ease;
}

.seg-answered { background: var(--chart-1); }
.seg-noanswer { background: var(--chart-3); }
.seg-other    { background: var(--control); }

.agent-track-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Charts & Distribution Bars */
.two-col-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: stretch;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-list-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-list-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bar-list-track {
  height: 8px;
  background: var(--raised);
  border-radius: 999px;
  overflow: hidden;
}

.bar-list-fill {
  height: 100%;
  background: var(--chart-1);
  border-radius: 999px;
  transition: width 240ms ease;
}

/* Activity Feed in Right Rail */
.feed-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.feed-student {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-meta {
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   5. Status Pills & Chips (app-screens.md §7.6 — pale tint + dark ink)
   ========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-chip);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}

.pill-positive { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill-negative { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill-warning  { background: var(--pill-warning-bg);  color: var(--pill-warning-ink); }
.pill-neutral  { background: var(--pill-neutral-bg);  color: var(--pill-neutral-ink); }
.pill-accent   { background: var(--pill-accent-bg);   color: var(--pill-accent-ink); }

/* ==========================================================================
   6. Data Tables & Toolbar (app-screens.md §7 — No zebra, 12px grey headers)
   ========================================================================== */

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-control, .select-control {
  height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}

.input-search {
  width: 260px;
}

.input-control:focus, .select-control:focus, .textarea-control:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  height: 38px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}

.data-table td {
  height: var(--row-height);
  padding: 6px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--ground);
}

.data-table th.num, .data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.inline-select, .inline-input {
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font-size: 13px;
  width: 100%;
}

.inline-select:hover, .inline-input:hover,
.inline-select:focus, .inline-input:focus {
  border-color: var(--control);
  background: var(--surface);
}

/* ==========================================================================
   7. Mobile-First Caller Workspace (Arundi, Dewmi, Amandi)
   ========================================================================== */

.caller-shell {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 84px;
}

/* Top Progress & Queue Jump Card */
.caller-progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.caller-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.caller-counter-badge {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.caller-remaining-badge {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: var(--pill-accent-bg);
  padding: 2px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.caller-jump-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.caller-jump-select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
}

.filter-pills-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-chip {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--muted);
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

/* Student Contact & Dialer Card */
.caller-contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.student-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.student-index-tag {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--raised);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.student-name-display {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}

.dial-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dial-cta-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-card);
  background: var(--accent);
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.01em;
  transition: background-color 120ms ease, transform 80ms ease;
}

.dial-cta-btn:hover {
  background: #155768;
}

.dial-cta-btn:active {
  transform: scale(0.99);
}

.dial-cta-btn.secondary-dial {
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--control);
  font-size: 15px;
  padding: 10px 14px;
}

.dial-cta-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dial-cta-hint {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.9;
}

.warning-banner {
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--pill-warning-bg);
  border: 1px solid #fde68a;
  color: var(--pill-warning-ink);
  font-size: 12px;
  line-height: 1.4;
}

/* Form Sections inside Caller Card */
.caller-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.field-dropdown-sync {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--control);
  border-radius: 4px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.choice-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.choice-grid.cols-4 {
  grid-template-columns: repeat(2, 1fr);
}

.choice-btn {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--control);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  transition: background-color 100ms ease, border-color 100ms ease, color 100ms ease;
}

.choice-btn:hover {
  background: var(--raised);
}

.choice-btn.selected {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
  font-weight: 600;
}

.choice-btn.selected-positive {
  background: var(--positive);
  color: #ffffff;
  border-color: var(--positive);
}

.choice-btn.selected-negative {
  background: var(--negative);
  color: #ffffff;
  border-color: var(--negative);
}

.choice-btn.selected-warning {
  background: var(--chart-3);
  color: #ffffff;
  border-color: var(--chart-3);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--raised);
  font-size: 12px;
  color: var(--muted);
}

.preset-chip:hover, .preset-chip.active {
  background: var(--pill-accent-bg);
  color: var(--pill-accent-ink);
  border-color: #b7dce5;
}

.textarea-control {
  width: 100%;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 14px;
  resize: vertical;
}

/* Sticky Bottom Back / Next Navigation Bar */
.caller-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  z-index: 40;
}

.caller-bottom-inner {
  max-width: 540px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 8px;
}

.nav-step-btn {
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Completion Celebration Banner */
.completion-banner {
  background: var(--surface);
  border: 2px solid var(--positive);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUpFade 260ms ease-out;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   8. Login View (4 Profile Cards — 1-Tap Login)
   ========================================================================== */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--ground);
}

.login-sheet {
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  padding: 32px;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
  transition: border-color 120ms ease, background-color 120ms ease, transform 80ms ease;
}

.profile-card:hover {
  border-color: var(--accent);
  background: var(--ground);
}

.profile-card:active {
  transform: translateY(1px);
}

.profile-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-lg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.profile-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.profile-role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(19, 20, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
}

.toast-box {
  position: fixed;
  bottom: 74px;
  right: 20px;
  background: var(--text);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 500;
  z-index: 90;
  transition: opacity 180ms ease, transform 180ms ease;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   9. Responsive Breakpoints (Tablet <= 1024px, Phone <= 640px)
   ========================================================================== */

@media (max-width: 1080px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .kpi-cell {
    border-bottom: 1px solid var(--border);
  }
  .kpi-cell:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 820px) {
  .app-frame {
    grid-template-columns: 1fr;
    grid-template-rows: 52px 1fr;
  }
  .app-sidebar {
    display: none;
  }
  .app-sidebar.mobile-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: var(--surface);
    padding: 20px;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .app-topbar {
    grid-column: 1;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
  }
  .app-sheet {
    grid-column: 1;
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 18px 20px;
  }
  .two-col-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #topbarContextTitle {
    display: none;
  }
  .tabs-list {
    width: 100%;
    gap: 14px;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-cell {
    padding: 12px 14px;
  }
  .kpi-cell:last-child {
    grid-column: 1 / -1;
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .login-sheet {
    padding: 20px;
  }
  .input-search {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
