@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   ENTERPRISE LIGHT DESIGN SYSTEM — HARDENED SENIOR SPECIFICATION
   Mode: Operate (Restrained, high-density, defensive resilience)
   Palette: Clean Canvas + White Surfaces + Deep Navy Text + Lime/Emerald Action
   ========================================================================== */

:root {
  /* Canvas & Structural Neutrals */
  --bg-canvas: #f8fafc;
  --bg-sidebar: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f8fafc;
  --bg-surface-subtle: #f1f5f9;
  --bg-active: #e2e8f0;

  /* Crisp 1px Line System */
  --line-border: #e2e8f0;
  --line-border-subtle: #edf2f7;
  --line-border-strong: #cbd5e1;

  /* Typography Colors (WCAG AAA Contrast Compliant) */
  --text-primary: #0f172a;       /* Slate 900 (Contrast > 14:1) */
  --text-secondary: #334155;     /* Slate 700 (Contrast > 7:1) */
  --text-tertiary: #475569;      /* Slate 600 (Contrast > 5.5:1 on #f1f5f9 / #ffffff) */
  --text-disabled: #64748b;      /* Slate 500 (Accessible for non-active states) */

  /* Brand Accents */
  --riley-navy: #0f2942;
  --riley-navy-hover: #0a1c2e;
  --riley-green: #15803d;        /* Accessible Forest/Emerald (Contrast > 4.5:1) */
  --riley-green-light: #dcfce7;
  --riley-green-badge: #166534;
  --riley-lime: #8cc63f;

  /* Functional Semantic Status Tints */
  --blue-badge-bg: #eff6ff;
  --blue-badge-text: #1d4ed8;
  --blue-badge-border: #bfdbfe;

  --green-badge-bg: #f0fdf4;
  --green-badge-text: #15803d;
  --green-badge-border: #bbf7d0;

  --amber-badge-bg: #fffbeb;
  --amber-badge-text: #b45309;
  --amber-badge-border: #fde68a;

  --red-badge-bg: #fef2f2;
  --red-badge-text: #b91c1c;
  --red-badge-border: #fecaca;

  /* Component Elevation (Subtle border + calibrated shadow) */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

  /* Geometry & Rhythm */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Typography Standards — Public Sans (Institutional Authority) */
  --font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ==========================================================================
   RESET & BROWSER SURFACES THEME
   ========================================================================== */

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

html, body {
  height: 100%;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: #bbf7d0;
  color: #0f172a;
}

/* Tabular Numbers for all metrics and data */
.tabular-nums, th, td, .metric-val, .badge, .timestamp {
  font-variant-numeric: tabular-nums;
}

/* Scrollbar Craft */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Focus States */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--riley-navy);
  outline-offset: 1px;
}

/* ==========================================================================
   LAYOUT SHELL (240px Fixed Rail + Top Utility Header)
   ========================================================================== */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR RAIL */
.app-sidebar {
  width: 240px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--line-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 16px 12px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 16px;
  border-bottom: 1px solid var(--line-border);
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--riley-navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.brand-title {
  min-width: 0;
}

.brand-title h1 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-title p {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* Workspace Selector */
.workspace-selector {
  margin: 12px 0 16px;
  padding: 8px 10px;
  background-color: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease;
}

.workspace-selector:hover {
  border-color: var(--line-border-strong);
}

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

.workspace-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.workspace-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Nav Menu */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  min-height: 36px;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--bg-surface);
  color: var(--riley-navy);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--line-border);
}

.nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.nav-item.active svg {
  color: var(--riley-navy);
}

.nav-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background-color: var(--bg-surface-subtle);
  color: var(--text-secondary);
}

.nav-item.active .nav-badge {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pacing-status-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.pacing-header-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--text-primary);
}

.pacing-timer-subrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #16a34a;
  box-shadow: 0 0 0 2px #dcfce7;
  flex-shrink: 0;
}

.status-indicator-dot.paused {
  background-color: #dc2626 !important;
  box-shadow: 0 0 0 2px #fecaca !important;
}

.user-profile-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 4px;
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--riley-navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.user-text-meta {
  flex: 1;
  min-width: 0;
}

.user-name-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

/* ==========================================================================
   MAIN VIEWPORT & TOPBAR
   ========================================================================== */

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* TOPBAR */
.app-topbar {
  height: 52px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--line-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.topbar-left strong {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-divider {
  color: var(--line-border);
}

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

/* EMERGENCY ENGINE KILL SWITCH & VELOCITY TELEMETRY */
.engine-control-bay {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
}

.engine-live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.engine-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--riley-green);
  box-shadow: 0 0 0 2px #dcfce7;
  flex-shrink: 0;
}

.engine-status-dot.paused {
  background-color: #dc2626 !important;
  box-shadow: 0 0 0 2px #fecaca !important;
}

.btn-emergency-halt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background-color: #ffffff;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-xs);
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-emergency-halt:hover {
  background-color: #fef2f2;
  border-color: #ef4444;
}

.btn-emergency-halt.engaged {
  background-color: #b91c1c;
  color: #ffffff;
  border-color: #991b1b;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.2);
}

.btn-emergency-halt.engaged:hover {
  background-color: #991b1b;
}

/* TOP EMERGENCY BANNER */
.emergency-halt-banner {
  background-color: #fff1f2;
  border-bottom: 2px solid #e11d48;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: banner-slide-down 0.2s ease-out;
}

@keyframes banner-slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.halt-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9f1239;
  font-size: 12.5px;
}

.halt-banner-content i {
  font-size: 16px;
  color: #e11d48;
}

.btn-emergency-resume {
  background-color: #0f2942;
  color: #ffffff;
  border: 1px solid #0f2942;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.btn-emergency-resume:hover {
  background-color: #0a1c2e;
}

.search-field {
  position: relative;
  width: 220px;
}

.search-field input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.search-field input:focus {
  background-color: #ffffff;
  border-color: var(--riley-navy);
}

.search-field svg {
  position: absolute;
  left: 9px;
  top: 8px;
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

/* ==========================================================================
   PAGE CONTAINER & VIEW SWITCHER
   ========================================================================== */

.page-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* PAGE HEADER */
.page-title-block {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title-block h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-title-block p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.action-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   BUTTON VOCABULARY (RESTRICTED & RESTRAINED)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  line-height: 1.2;
}

.btn-primary {
  background-color: var(--riley-navy);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--riley-navy-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--line-border);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--line-border-strong);
}

.btn-action-green {
  background-color: var(--riley-green);
  color: #ffffff;
}

.btn-action-green:hover {
  background-color: #166534;
}

.btn-danger-outline {
  background-color: transparent;
  border-color: var(--red-badge-border);
  color: var(--red-badge-text);
}

.btn-danger-outline:hover {
  background-color: var(--red-badge-bg);
}

/* ==========================================================================
   METRIC STRIP & HIGH-DENSITY KPI CARDS
   ========================================================================== */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}

.kpi-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-top: 8px;
}

.kpi-card.kpi-card-interactive {
  cursor: pointer;
  transition: all 0.15s ease;
}

.kpi-card.kpi-card-interactive:hover {
  border-color: var(--line-border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.quota-counter-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.kpi-footer-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Progress bar for quota */
.quota-progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-surface-subtle);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.quota-progress-bar {
  height: 100%;
  background-color: var(--riley-green);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   SURFACE CARDS & DATA TABLES
   ========================================================================== */

.card-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header-strip {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfc;
}

.card-header-strip h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-header-strip p {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ENTERPRISE DATA TABLE */
.table-wrap {
  overflow-x: auto;
  padding: 4px 12px 12px;
}

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

.enterprise-table th {
  background-color: #fafbfc;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-border);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.enterprise-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.enterprise-table tbody tr:hover td {
  background-color: #f8fafc;
}

/* BADGES */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
  font-weight: 500;
  border: 1px solid transparent;
}

.badge-blue {
  background-color: var(--blue-badge-bg);
  color: var(--blue-badge-text);
  border-color: var(--blue-badge-border);
}

.badge-green {
  background-color: var(--green-badge-bg);
  color: var(--green-badge-text);
  border-color: var(--green-badge-border);
}

.badge-amber {
  background-color: var(--amber-badge-bg);
  color: var(--amber-badge-text);
  border-color: var(--amber-badge-border);
}

.badge-red {
  background-color: var(--red-badge-bg);
  color: var(--red-badge-text);
  border-color: var(--red-badge-border);
}

/* ==========================================================================
   CONVERSATION INBOX (3-COLUMN HIGH DENSITY DESK)
   ========================================================================== */

.inbox-desk-grid {
  display: grid;
  grid-template-columns: 290px 1fr 270px;
  background-color: var(--bg-surface);
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  height: calc(100vh - 145px);
  min-height: 560px;
  overflow: hidden;
}

/* Col 1: Thread List */
.inbox-thread-pane {
  border-right: 1px solid var(--line-border);
  display: flex;
  flex-direction: column;
  background-color: #fafbfc;
}

.thread-search-box {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-border);
}

.thread-search-box input {
  width: 100%;
  padding: 6px 10px;
  background-color: #ffffff;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
}

.thread-list-container {
  flex: 1;
  overflow-y: auto;
}

.thread-item-row {
  position: relative;
  padding: 12px 14px 12px 16px;
  border-bottom: 1px solid var(--line-border-subtle);
  cursor: pointer;
  background-color: #ffffff;
  transition: background-color 0.12s ease;
}

.thread-item-row:hover {
  background-color: var(--bg-canvas);
}

.thread-item-row.active {
  background-color: #f1f5f9;
}

.thread-item-row.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background-color: var(--riley-navy);
}

.thread-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.thread-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.thread-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.thread-snippet {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Col 2: Chat Viewport */
.inbox-chat-pane {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

.chat-banner-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fafbfc;
}

.chat-contact-meta h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-contact-meta p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Takeover Banner Alert */
.takeover-bar {
  padding: 8px 18px;
  background-color: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #1e40af;
}

.chat-message-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #ffffff;
}

.chat-row {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.chat-row.outbound {
  align-self: flex-end;
}

.chat-row.inbound {
  align-self: flex-start;
}

.chat-balloon {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.5;
}

.chat-row.outbound .chat-balloon {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.chat-row.inbound .chat-balloon {
  background-color: #f8fafc;
  border: 1px solid var(--line-border);
  color: var(--text-primary);
}

.chat-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.chat-row.outbound .chat-meta {
  text-align: right;
}

.chat-input-desk {
  padding: 14px 18px;
  border-top: 1px solid var(--line-border);
  background-color: #fafbfc;
}

.chat-input-desk textarea {
  width: 100%;
  height: 64px;
  padding: 8px 10px;
  background-color: #ffffff;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 12.5px;
  color: var(--text-primary);
  resize: none;
  outline: none;
}

.chat-input-desk textarea:focus {
  border-color: var(--riley-navy);
}

.chat-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* Col 3: Profile Intelligence */
.inbox-profile-pane {
  border-left: 1px solid var(--line-border);
  padding: 16px;
  overflow-y: auto;
  background-color: #fafbfc;
}

.profile-group {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-border);
}

.profile-group:last-child {
  border-bottom: none;
}

.profile-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.profile-val {
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   PIPELINE KANBAN BOARD
   ========================================================================== */

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  min-height: 520px;
  align-items: start;
}

.kanban-column {
  background-color: #f1f5f9;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.kanban-column-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background-color: #f8fafc;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-column-head h3 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.kanban-cards-stack {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

.kanban-card {
  background-color: #ffffff;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: all 0.12s ease;
}

.kanban-card:hover {
  border-color: var(--line-border-strong);
  box-shadow: var(--shadow-sm);
}

.kanban-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.kanban-card p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ==========================================================================
   AUTH SCREEN (SECURE LOGIN VIEW)
   ========================================================================== */

.auth-overlay-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  padding: 24px;
}

.auth-card-box {
  width: 100%;
  max-width: 420px;
  background-color: #ffffff;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  box-shadow: var(--shadow-lg);
}

.auth-logo-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-badge-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: var(--radius-md);
  background-color: var(--riley-navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.auth-logo-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-logo-header p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.auth-field input {
  width: 100%;
  padding: 8px 12px;
  background-color: #ffffff;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
}

.auth-field input:focus {
  border-color: var(--riley-navy);
}

.auth-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.auth-foot-row a {
  color: var(--riley-navy);
  text-decoration: none;
  font-weight: 500;
}

.auth-foot-row a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   TOAST NOTIFICATION DESK
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-pill {
  padding: 10px 14px;
  background-color: #ffffff;
  border: 1px solid var(--line-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM & MOBILE RESILIENCE (WCAG 44PX TOUCH TARGETS)
   ========================================================================== */

@media (max-width: 1024px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .inbox-desk-grid {
    grid-template-columns: 260px 1fr;
    height: auto;
    min-height: 500px;
  }

  .inbox-profile-pane {
    display: none;
  }

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

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line-border);
    padding: 12px 16px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-item {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 44px;
  }

  .sidebar-footer {
    margin-top: 10px;
    padding-top: 10px;
  }

  .app-topbar {
    height: auto;
    padding: 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-right {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .search-field {
    width: 100%;
  }

  .engine-control-bay {
    width: 100%;
    justify-content: space-between;
  }

  .btn {
    min-height: 40px;
  }

  .btn-emergency-halt {
    min-height: 40px;
  }

  .page-content-scroll {
    padding: 16px;
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }

  .inbox-desk-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .inbox-chat-pane {
    min-height: 420px;
  }

  .kanban-grid {
    grid-template-columns: 1fr;
  }

  .emergency-halt-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }
}
