/* Design tokens for ReachSMS redesign
 * Source of truth: design_handoff_reachsms_redesign/README.md §Design Tokens
 * Edits here must be mirrored upstream to design_handoff_reachsms_redesign/README.md
 */

/* Toast must sit above modal backdrops (z-index: 1000) */
#toast { z-index: 1100 !important; }

/* Force-hide legacy shim elements — JS still writes to these IDs but the
 * visible UI is rendered elsewhere (topnav.js, renderUnifiedList, etc.) */
#nav-service-badge,
#nav-service,
#nav-email,
#change-service-btn,
#logout-btn,
#unread-list,
#history-list,
#my-stats-section { display: none !important; }

:root {
  /* Colors — Ink */
  --ink-900: #0B1220;
  --ink-700: #1A2233;
  --ink-500: #5A6573;
  --ink-400: #97A0AE;
  --ink-300: #D7DCE4;

  /* Colors — Line & Background */
  --line: #E6E8EC;
  --line-soft: #F0F1F4;
  --bg: #FFFFFF;
  --bg-soft: #F7F8FA;
  --bg-warm: #FAFBFC;

  /* Colors — Brand */
  --brand-500: #F47C20;
  --brand-400: #FF9A3D;
  --brand-50: #FFF1E4;
  --brand-100: #FFF8F0;
  --brand-200: #FFD1A8;
  --brand-900: #B8560C;
  --brand-gradient: linear-gradient(180deg, #FF9A3D, #F47C20);

  /* Colors — Success */
  --success-700: #0F6B3E;
  --success-500: #1F9D6A;
  --success-200: #B8E6CC;
  --success-50: #E6F6EE;

  /* Colors — Danger */
  --danger-600: #C02E2E;
  --danger-50: #FDECEC;

  /* Typography — Fonts */
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing (px) */
  --spacing-4: 4px;
  --spacing-6: 6px;
  --spacing-8: 8px;
  --spacing-10: 10px;
  --spacing-12: 12px;
  --spacing-14: 14px;
  --spacing-16: 16px;
  --spacing-18: 18px;
  --spacing-20: 20px;
  --spacing-22: 22px;
  --spacing-24: 24px;
  --spacing-26: 26px;
  --spacing-28: 28px;
  --spacing-32: 32px;
  --spacing-40: 40px;

  /* Radii (px) */
  --radius-5: 5px;
  --radius-7: 7px;
  --radius-8: 8px;
  --radius-10: 10px;
  --radius-11: 11px;
  --radius-12: 12px;
  --radius-14: 14px;
  --radius-16: 16px;
  --radius-18: 18px;
  --radius-22: 22px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-button: 0 6px 14px -6px rgba(244, 124, 32, 0.5);
  --shadow-button-hover: 0 8px 20px -6px rgba(244, 124, 32, 0.5);
  --shadow-modal: 0 40px 100px -20px rgba(11, 18, 32, 0.4);
  --shadow-modal-backdrop-blur: 8px;
  --shadow-modal-backdrop-color: rgba(11, 18, 32, 0.3);
}

/* Focus ring utility */
.focus-ring:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ==========================================================================
   TopNav — shared 64px dark-navy chrome
   Task 03 | renderTopNav(targetEl, { user, service })
   ========================================================================== */

.topnav {
  height: 64px;
  background: var(--bg);                /* #FFFFFF */
  border-bottom: 1px solid var(--line); /* #E6E8EC */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-24);
  flex-shrink: 0;
  font-family: var(--font-body);
}

/* ── Left cluster ─────────────────────────────────────────────── */
.topnav__left {
  display: flex;
  align-items: center;
  gap: var(--spacing-14);
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-10);
}

/* Gradient logo tile */
.topnav__logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-8);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* "Reach SMS" wordmark */
.topnav__wordmark {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  white-space: nowrap;
}

.topnav__wordmark strong {
  font-weight: 700;
  color: var(--brand-500);   /* orange "SMS" */
}

/* Divider between brand and service chip */
.topnav__sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex-shrink: 0;
}

/* Active service chip */
.topnav__service-chip {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
  padding: var(--spacing-6) var(--spacing-12);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-10);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
}

.topnav__service-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--success-500);
  flex-shrink: 0;
}

.topnav__service-name {
  color: var(--ink-900);
}

/* ── Right cluster ────────────────────────────────────────────── */
.topnav__right {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
}

/* Services nav link */
.topnav__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  text-decoration: none;
  padding: var(--spacing-6) var(--spacing-10);
  border-radius: var(--radius-7);
  transition: color 0.15s ease, background 0.15s ease;
}

.topnav__link:hover {
  color: var(--ink-900);
  background: var(--bg-soft);
}

/* Log out button */
.topnav__logout {
  display: flex;
  align-items: center;
  gap: var(--spacing-6);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-7);
  padding: var(--spacing-6) var(--spacing-10);
  cursor: pointer;
  font-family: var(--font-body);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.topnav__logout:hover {
  color: var(--ink-900);
  background: var(--bg-soft);
  border-color: var(--ink-300);
}

/* User pill */
.topnav__user-pill {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
  padding: var(--spacing-4) var(--spacing-12) var(--spacing-4) var(--spacing-4);
  background: var(--bg-soft);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  white-space: nowrap;
}

/* Avatar circle with gradient */
.topnav__avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--brand-gradient);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.topnav__user-email {
  color: var(--ink-500);
}

/* =============================================================================
   LOGIN PAGE — Direction B split-screen
   Task 04 | public/index.html
   ============================================================================= */

/* Full-viewport wrapper */
.login-body-wrap {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--bg);
}

/* Split container */
.login-split {
  display: flex;
  width: 100%;
  height: 100%;
}

/* ── LEFT PANEL ── */
.login-left {
  flex: 0 0 46%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--spacing-40);
  background: linear-gradient(160deg, #FFF1E4 0%, #FFFFFF 60%, #FFF7EF 100%);
  overflow: hidden;
}

/* Brand row */
.login-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-10);
}

.login-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-8);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-500));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

.login-brand-accent {
  color: var(--brand-500);
}

/* Chat bubble + tagline area */
.login-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--spacing-20) 4px;
  gap: var(--spacing-20);
}

.login-bubbles {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-10);
}

.login-bubble {
  max-width: 75%;
  padding: var(--spacing-10) var(--spacing-14);
  font-size: 14px;
  line-height: 1.4;
}

.login-bubble--in {
  align-self: flex-start;
  background: var(--bg);
  color: var(--ink-900);
  border: 1px solid #F2F0EC;
  border-radius: var(--radius-18) var(--radius-18) var(--radius-18) 4px;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 20px -8px rgba(20, 20, 20, 0.1);
}

.login-bubble--out {
  align-self: flex-end;
  background: var(--brand-gradient);
  color: #fff;
  border-radius: var(--radius-18) var(--radius-18) 4px var(--radius-18);
  box-shadow: 0 8px 20px -8px rgba(244, 124, 32, 0.5);
}

/* Tagline */
.login-tagline {
  max-width: 360px;
}

.login-tagline-heading {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink-900);
  margin: 0 0 var(--spacing-10);
}

.login-tagline-sub {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-500);
  margin: 0;
}

/* Left footer */
.login-left-footer {
  font-size: 11px;
  color: var(--ink-400);
}

/* ── RIGHT PANEL ── */
.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-32);
  background: var(--bg);
  overflow-y: auto;
}

.login-form-wrap {
  width: 100%;
  max-width: 360px;
}

/* Eyebrow */
.login-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--spacing-8);
}

/* Heading */
.login-heading {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 var(--spacing-8);
  color: var(--ink-900);
}

/* Subhead */
.login-subhead {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0 0 var(--spacing-28);
}

/* Error banner */
.login-error {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-8);
  background: var(--danger-50);
  color: var(--danger-600);
  border: 1px solid rgba(192, 46, 46, 0.2);
  border-radius: var(--radius-10);
  padding: var(--spacing-10) var(--spacing-14);
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: var(--spacing-20);
}

/* Form field wrapper */
.login-field {
  margin-bottom: var(--spacing-14);
}

.login-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--spacing-6);
}

.login-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: var(--spacing-6);
}

/* Input */
.login-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--spacing-14);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-12);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--bg);
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.login-input:hover {
  border-color: var(--ink-300);
}

.login-input:focus {
  border-color: var(--brand-500);
  outline: none;
}

/* Password field with toggle */
.login-input-wrap {
  position: relative;
}

.login-input--pw {
  padding-right: 44px;
}

.login-pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: var(--spacing-8);
  cursor: pointer;
  color: var(--ink-400);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-5);
  transition: color 0.15s;
}

.login-pw-toggle:hover {
  color: var(--ink-700);
}

/* Primary submit button */
.login-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-8);
  width: 100%;
  height: 50px;
  border: none;
  border-radius: var(--radius-14);
  background: var(--brand-gradient);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: var(--spacing-8);
  box-shadow: 0 8px 24px -8px rgba(244, 124, 32, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: box-shadow 0.15s, opacity 0.15s;
}

.login-btn-primary:hover {
  box-shadow: 0 10px 28px -6px rgba(244, 124, 32, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.login-btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* OR divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: var(--spacing-12);
  margin: var(--spacing-20) 0;
}

.login-divider-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.login-divider-label {
  font-size: 11px;
  color: var(--ink-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Microsoft SSO button */
.login-btn-ms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-10);
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-14);
  background: var(--bg);
  color: var(--ink-900);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}

.login-btn-ms:hover {
  border-color: var(--ink-300);
  background: var(--bg-soft);
}

/* Help footnote */
.login-footnote {
  font-size: 12px;
  color: var(--ink-400);
  text-align: center;
  margin: var(--spacing-24) 0 0;
}

.login-footnote-link {
  color: #2F6FEB;
  text-decoration: none;
}

.login-footnote-link:hover {
  text-decoration: underline;
}

/* Responsive — stack panels below 768 px */
@media (max-width: 768px) {
  .login-body-wrap {
    height: auto;
    overflow: auto;
  }

  .login-split {
    flex-direction: column;
  }

  .login-left {
    flex: 0 0 auto;
    padding: var(--spacing-24) var(--spacing-20);
  }

  .login-hero {
    padding: var(--spacing-16) 0;
  }

  .login-tagline-heading {
    font-size: 24px;
  }

  .login-right {
    flex: 1;
    padding: var(--spacing-24) var(--spacing-20);
  }
}

/* =============================================================================
   SELECT SERVICE PAGE — Task 05
   ============================================================================= */

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-14);
  width: 100%;
}

.service-tile {
  display: block;
  text-align: left;
  padding: var(--spacing-20);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-18);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 20px -12px rgba(20, 20, 20, 0.1);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.service-tile:hover {
  border-color: var(--brand-500);
  box-shadow: 0 1px 2px rgba(244, 124, 32, 0.1), 0 16px 40px -18px rgba(244, 124, 32, 0.4);
  transform: translateY(-2px);
}

.service-tile:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Responsive: 2 columns on larger screens, auto-fit smaller screens */
@media (min-width: 992px) {
  .service-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .service-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   SELECT SERVICE PAGE — Task 05
   Styles for select-service.html (extracted from inline styles)
   ============================================================================= */

.select-service-body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--bg-soft);
}

.select-service-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-40) var(--spacing-20);
  min-height: calc(100vh - 64px);
}

.select-service-wrapper {
  width: 100%;
  max-width: 720px;
}

.select-service-heading {
  text-align: center;
  margin-bottom: 36px;
}

.select-service-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  color: var(--ink-900);
}

.select-service-subtitle {
  font-size: 15px;
  color: var(--ink-500);
  margin: 0;
}

.select-service-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--danger-50);
  color: var(--danger-600);
  border: 1px solid rgba(192, 46, 46, 0.2);
  border-radius: var(--radius-10);
  padding: var(--spacing-10) var(--spacing-14);
  font-size: 13.5px;
  line-height: 1.45;
  margin-bottom: 20px;
}

.select-service-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #E0EFF9;
  color: #1E5A96;
  border: 1px solid rgba(30, 90, 150, 0.2);
  border-radius: var(--radius-10);
  padding: var(--spacing-12) var(--spacing-14);
  font-size: 13.5px;
}

.select-service-grid-wrap {
  display: none;
}

.select-service-empty {
  display: none;
  text-align: center;
  padding: var(--spacing-40) var(--spacing-20);
}

.select-service-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.select-service-empty-text {
  font-size: 15px;
  color: var(--ink-500);
  margin: 0;
}

/* =============================================================================
   MESSAGING PAGE — Task 06
   3-section layout: TopNav (64px) + rail (360px) + main (flex 1)
   ============================================================================= */

/* Full-viewport app shell — no body scroll */
.msg-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg);
}

/* Row beneath the TopNav — fills remaining height */
.msg-below-nav {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ── Left rail (360px) ──────────────────────────────────────────────────── */
.msg-rail {
  width: 360px;
  flex-shrink: 0;
  background: var(--bg-soft);        /* #F7F8FA */
  border-right: 1px solid var(--line); /* #E6E8EC */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Main chat area (flex 1, white) ────────────────────────────────────── */
.msg-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);             /* #FFFFFF */
}

/* chat-window fills the timeline placeholder */
#chat-timeline .chat-window {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* =============================================================================
   MESSAGING PAGE — Task 07
   Left rail: header, search, filter chips, unified conversation list
   ============================================================================= */

/* ── Rail header ─────────────────────────────────────────────────────────── */
.rail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 10px;
  flex-shrink: 0;
}

.rail-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  margin: 0;
  flex: 1;
}

.rail-new-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 0;
  background: var(--brand-gradient);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -6px rgba(244, 124, 32, 0.6);
  flex-shrink: 0;
  padding: 0;
  transition: opacity 0.15s;
}
.rail-new-btn:hover { opacity: 0.88; }
.rail-new-btn::before {
  /* pencil/edit icon via inline SVG background — Icons.edit(15) equiv */
  content: '';
  display: block;
  width: 15px;
  height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ── Search input ────────────────────────────────────────────────────────── */
.rail-search-wrap {
  position: relative;
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.rail-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-60%);
  width: 15px;
  height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2397A0AE' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}

.rail-search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink-900);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.rail-search-input:focus {
  border-color: var(--brand-500);
}
.rail-search-input::placeholder {
  color: var(--ink-400);
}

/* ── Filter chips ────────────────────────────────────────────────────────── */
.rail-chips {
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-500);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.filter-chip:hover {
  border-color: var(--ink-300);
  color: var(--ink-900);
}
.filter-chip--active {
  background: var(--ink-900);
  color: #fff;
  border-color: var(--ink-900);
}
.filter-chip--active:hover {
  background: var(--ink-700);
  border-color: var(--ink-700);
  color: #fff;
}

.filter-chip__badge {
  background: var(--brand-500);
  color: #fff;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
}

/* ── Unified conversation list ───────────────────────────────────────────── */
.rail-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
  min-height: 0;
}

/* ── Empty state inside rail ─────────────────────────────────────────────── */
.rail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--ink-400);
  font-size: 13px;
  text-align: center;
  gap: 8px;
}
.rail-empty__icon {
  font-size: 28px;
  line-height: 1;
}

/* ── Rail footer (stats button) ──────────────────────────────────────────── */
.rail-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* ── Conversation row ────────────────────────────────────────────────────── */
.conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  min-height: 68px;
  border-radius: 12px;
  cursor: pointer;
  background: transparent;
  margin-bottom: 2px;
  transition: background 0.1s, box-shadow 0.1s;
  outline: none;
}
.conv-row:hover {
  background: rgba(255, 255, 255, 0.7);
}
.conv-row:focus-visible {
  box-shadow: 0 0 0 2px var(--brand-500);
}
.conv-row--active {
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(20,20,20,.04), 0 6px 16px -10px rgba(20,20,20,.15);
}

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ── Row body ────────────────────────────────────────────────────────────── */
.conv-body {
  flex: 1;
  min-width: 0;
}

.conv-row__top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.conv-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  flex: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-row--unread .conv-number {
  font-weight: 700;
}

.conv-ts {
  font-size: 11px;
  color: var(--ink-400);
  font-weight: 400;
  flex-shrink: 0;
}
.conv-ts--unread {
  color: var(--brand-500);
  font-weight: 700;
}

.conv-row__meta {
  display: flex;
  align-items: center;
  gap: 5px;
}

.conv-au-chip {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
  line-height: 14px;
}

.conv-preview {
  font-size: 13px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.conv-preview--unread {
  color: var(--ink-900);
  font-weight: 500;
}

/* ── Unread dot marker ───────────────────────────────────────────────────── */
.conv-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-500);
  flex-shrink: 0;
}

/* =============================================================================
   MESSAGING PAGE — Task 08
   Chat header, chat timeline, message bubbles, date chips
   ============================================================================= */

/* ── Chat header ─────────────────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.chat-header__avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  /* default neutral colours — overwritten by updateChatHeader() */
  background: var(--bg-soft);
  color: var(--ink-400);
}

.chat-header__info {
  flex: 1;
  min-width: 0;
}

.chat-header__number {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.chat-header__flag {
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--ink-500);
  flex-shrink: 0;
}

.chat-header__meta {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-header__pill {
  height: 34px;
  padding: 0 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-900);
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.chat-header__pill:hover {
  background: var(--line-soft);
}

.chat-header__pill--icon svg {
  display: inline-block;
  vertical-align: middle;
}

/* Mobile-number input bar — hidden by default; revealed when search is active. */
.chat-header__input-bar {
  display: none;
  padding: 0 var(--spacing-16) var(--spacing-10);
  border-top: 1px solid var(--line-soft);
}
.chat-header__input-bar.search-open {
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
}
.chat-header__mobile-input {
  flex: 1;
  height: 36px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-10);
  padding: 0 var(--spacing-12);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--bg-soft);
  outline: none;
  transition: border-color 0.15s;
}
.chat-header__mobile-input:focus {
  border-color: var(--brand-500);
}
.chat-header__search-go {
  height: 36px;
  padding: 0 var(--spacing-14);
  border-radius: var(--radius-10);
  background: var(--brand-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}
/* Active state for search button */
#lookup-btn.search-active {
  background: var(--brand-50);
  color: var(--brand-500);
  border-color: var(--brand-200);
}

.chat-header__mobile-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--bg-soft);
  outline: none;
  font-variant-numeric: tabular-nums;
}
.chat-header__mobile-input:focus {
  border-color: var(--brand-500);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(244,124,32,.15);
}

/* ── Chat timeline ───────────────────────────────────────────────────────── */
#chat-timeline {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#chat-timeline .chat-window {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(180deg, #FFFFFF, var(--bg-warm));
}

/* ── Date chip ───────────────────────────────────────────────────────────── */
.date-chip {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-400);
  padding: 6px 0;
  margin: 8px 0;
  letter-spacing: 0.04em;
}

/* ── Bubble wrapper (replaces old .bubble-wrap.inbound/.outbound) ────────── */
.bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  gap: 3px;
  animation: fadeIn .22s ease both;
}

/* Inbound: LEFT — grey background */
.bubble-wrap.bubble-in {
  align-self: flex-start;
  align-items: flex-start;
}

/* Outbound: RIGHT — brand gradient */
.bubble-wrap.bubble-out {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble {
  padding: 9px 14px;
  font-size: 14.5px;
  line-height: 1.5;
  font-weight: 400;
  word-break: break-word;
  white-space: pre-wrap;
}

/* Inbound bubble style */
.bubble-wrap.bubble-in .bubble {
  background: #EDEFF3;
  color: var(--ink-900);
  border-radius: 20px 20px 20px 4px;   /* tail bottom-left */
  box-shadow: none;
}

/* Outbound bubble style */
.bubble-wrap.bubble-out .bubble {
  background: var(--brand-gradient);
  color: #FFFFFF;
  border-radius: 20px 20px 4px 20px;   /* tail bottom-right */
  box-shadow: 0 6px 14px -6px rgba(244,124,32,.4);
}

/* Bubble meta line (timestamp, author, delivered) */
.bubble-meta {
  font-size: 10.5px;
  color: var(--ink-400);
  padding: 0 6px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.bubble-meta__delivered {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--success-500);
  font-weight: 600;
}
.bubble-meta__delivered svg {
  color: var(--success-500);
}

@media (max-width: 600px) {
  .bubble-wrap { max-width: 85%; }
  #chat-timeline .chat-window { padding: 16px; }
  .chat-header { padding: 10px 14px; gap: 10px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Task 10 — Templates Modal
   ═══════════════════════════════════════════════════════════════════════════ */

/* Backdrop / scrim */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--shadow-modal-backdrop-color, rgba(11, 18, 32, 0.3));
  backdrop-filter: blur(var(--shadow-modal-backdrop-blur, 8px));
  -webkit-backdrop-filter: blur(var(--shadow-modal-backdrop-blur, 8px));
  font-family: 'Inter', system-ui, sans-serif;
}

.modal-backdrop.open {
  display: flex;
}

/* The card */
.tmpl-modal {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 64px);
  background: var(--bg, #ffffff);
  border-radius: 22px;
  box-shadow: var(--shadow-modal, 0 40px 100px -20px rgba(11, 18, 32, 0.4));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.tmpl-modal-header {
  padding: 22px 26px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}

.tmpl-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500, #f47c20);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tmpl-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900, #0b1220);
  margin: 0 0 6px;
  line-height: 1.2;
}

.tmpl-starred-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-500, #5a6573);
}

.tmpl-close-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: none;
  border-radius: 10px;
  background: var(--bg-soft, #f7f8fa);
  color: var(--ink-500, #5a6573);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.tmpl-close-btn:hover { background: var(--line, #e6e8ec); }
.tmpl-close-btn:focus-visible { outline: 2px solid var(--brand-500, #f47c20); outline-offset: 2px; }

/* Search + New toolbar */
.tmpl-toolbar {
  padding: 0 26px 14px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.tmpl-search-wrap {
  flex: 1;
  position: relative;
}

.tmpl-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400, #97a0ae);
  pointer-events: none;
}

.tmpl-search {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  background: var(--bg-soft, #f7f8fa);
  border: 1.5px solid transparent;
  border-radius: 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-900, #0b1220);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.tmpl-search:focus {
  border-color: var(--brand-500, #f47c20);
  outline: none;
}

.tmpl-new-btn {
  height: 42px;
  padding: 0 16px;
  background: linear-gradient(180deg, var(--brand-400, #ff9a3d), var(--brand-500, #f47c20));
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 16px -6px rgba(244, 124, 32, 0.5);
  transition: box-shadow 0.15s, opacity 0.15s;
}
.tmpl-new-btn:hover { opacity: 0.9; }
.tmpl-new-btn:focus-visible { outline: 2px solid var(--brand-500, #f47c20); outline-offset: 2px; }

/* Tabs */
.tmpl-tabs {
  padding: 0 26px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line, #e6e8ec);
  flex-shrink: 0;
}

.tmpl-tab {
  height: 40px;
  padding: 0 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--ink-400, #97a0ae);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s, border-color 0.15s;
}
.tmpl-tab:hover { color: var(--ink-700, #1a2233); }
.tmpl-tab--active {
  color: var(--ink-900, #0b1220);
  font-weight: 600;
  border-bottom-color: var(--brand-500, #f47c20);
}
.tmpl-tab:focus-visible { outline: 2px solid var(--brand-500, #f47c20); outline-offset: 2px; }

/* Scrollable body */
.tmpl-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tmpl-empty {
  font-size: 13px;
  color: var(--ink-400, #97a0ae);
  padding: 8px 0;
  margin: 0;
}

/* Template list container */
.tmpl-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual template row */
.tmpl-entry {
  position: relative;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-soft, #f7f8fa);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tmpl-entry:hover {
  background: var(--bg-soft, #f7f8fa);
  border-color: var(--line, #e6e8ec);
}

.tmpl-entry--starred {
  background: var(--brand-100, #fff8f0);
  border-color: var(--brand-200, #ffd1a8);
}
.tmpl-entry--starred:hover {
  background: var(--brand-100, #fff8f0);
  border-color: var(--brand-200, #ffd1a8);
}

/* Text portion */
.tmpl-entry-content {
  flex: 1;
  min-width: 0;
}
.tmpl-entry-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-900, #0b1220);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tmpl-entry-body {
  font-size: 13px;
  color: var(--ink-500, #5a6573);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action buttons cluster */
.tmpl-entry-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Star button */
.tmpl-star-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--ink-400, #97a0ae);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tmpl-star-btn:hover {
  background: var(--brand-50, #fff1e4);
  color: var(--brand-500, #f47c20);
}
.tmpl-star-btn--on {
  background: var(--brand-50, #fff1e4);
  color: var(--brand-500, #f47c20);
}
.tmpl-star-btn:focus-visible { outline: 2px solid var(--brand-500, #f47c20); outline-offset: 2px; }

/* Edit / delete action buttons */
.tmpl-act-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--ink-400, #97a0ae);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tmpl-act-btn:hover {
  background: var(--bg-soft, #f7f8fa);
  color: var(--ink-700, #1a2233);
}
.tmpl-act-btn.delete:hover {
  background: #fdecec;
  color: var(--danger-600, #c02e2e);
}
.tmpl-act-btn:focus-visible { outline: 2px solid var(--brand-500, #f47c20); outline-offset: 2px; }

/* Invisible overlay button that makes the whole row clickable for "use" */
.tmpl-use-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  z-index: 0;
}

/* Footer "new" link inside personal list */
.tmpl-list-footer {
  padding: 10px 2px 0;
}
.tmpl-inline-new-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-500, #f47c20);
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.tmpl-inline-new-btn:hover { text-decoration: underline; }
.tmpl-inline-new-btn:focus-visible { outline: 2px solid var(--brand-500, #f47c20); outline-offset: 2px; }

@media (max-width: 640px) {
  .modal-backdrop { padding: 12px; }
  .tmpl-modal { border-radius: 18px; max-height: calc(100vh - 24px); }
  .tmpl-modal-header { padding: 16px 16px 10px; }
  .tmpl-toolbar { padding: 0 16px 12px; }
  .tmpl-tabs { padding: 0 16px; }
  .tmpl-body { padding: 12px 16px 20px; }
  .tmpl-entry-name { font-size: 13.5px; }
}

/* ── Task 09: Composer + quick-reply chips ──────────────────────────────── */

/* Outer composer wrapper */
.composer {
  background: var(--bg, #ffffff);
  border-top: 1px solid var(--line, #e6e8ec);
  padding: 14px 18px 16px;
  flex-shrink: 0;
}

/* Quick-reply chip row */
.qr-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.qr-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-400, #97a0ae);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-right: 2px;
  white-space: nowrap;
}

.qr-eyebrow svg {
  color: var(--brand-500, #f47c20);
}

/* Chip container — wraps the individual chips */
.qr-chips {
  display: contents; /* chips flow inline with the row */
}

/* Individual quick-reply chip */
.qr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--bg-soft, #f7f8fa);
  border: 1.5px solid var(--line, #e6e8ec);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-700, #1a2233);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}

.qr-chip:hover {
  background: var(--brand-50, #fff1e4);
  border-color: var(--brand-200, #ffd1a8);
  color: var(--brand-900, #b8560c);
}

.qr-chip:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.qr-chip-emoji {
  font-size: 13px;
  line-height: 1;
}

/* "All templates" trailing chip — dashed border */
.qr-chip--dashed {
  background: var(--bg, #ffffff);
  border-style: dashed;
  border-color: var(--ink-300, #d7dce4);
  color: var(--ink-500, #5a6573);
}

.qr-chip--dashed:hover {
  background: var(--bg-soft, #f7f8fa);
  border-color: var(--brand-200, #ffd1a8);
  color: var(--brand-900, #b8560c);
}

/* Empty-state hint */
.qr-empty-hint {
  font-size: 12px;
  color: var(--ink-400, #97a0ae);
  font-style: italic;
}

/* Textarea wrapper — rounded pill border */
.composer-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1.5px solid var(--line, #e6e8ec);
  border-radius: 22px;
  background: var(--bg, #ffffff);
  padding: 6px 6px 6px 18px;
  transition: border-color 0.15s;
}

.composer-input-wrap:focus-within {
  border-color: var(--brand-200, #ffd1a8);
}

/* Auto-growing transparent textarea */
.composer-textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink-900, #0b1220);
  outline: none;
  line-height: 1.5;
  padding: 8px 0;
  min-height: 24px;
  max-height: 180px;
  overflow-y: auto;
  align-self: center;
}

.composer-textarea::placeholder {
  color: var(--ink-400, #97a0ae);
}

/* Right-side column: char counter + seg hint + send button */
.composer-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  align-self: flex-end;
  padding-bottom: 4px;
}

/* Char counter (inherits existing .char-count rules; these extend it) */
.composer-right .char-count {
  font-size: 11px;
  color: var(--ink-400, #97a0ae);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Segment hint */
.seg-hint {
  font-size: 10.5px;
  color: var(--ink-400, #97a0ae);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Circular gradient send button */
.send-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-400, #ff9a3d), var(--brand-500, #f47c20));
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -6px rgba(244, 124, 32, 0.5);
  transition: box-shadow 0.15s, opacity 0.15s;
  flex-shrink: 0;
}

.send-btn:hover {
  box-shadow: 0 8px 20px -6px rgba(244, 124, 32, 0.5);
  opacity: 0.92;
}

.send-btn:active {
  opacity: 0.82;
  box-shadow: 0 4px 10px -6px rgba(244, 124, 32, 0.5);
}

.send-btn:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Task 11: Usage Modal (redesigned) ──────────────────────────────────── */

/* Usage modal container (600px, centered) */
.usage-modal {
  width: 600px;
  max-height: 100%;
  background: var(--bg, #ffffff);
  border-radius: 22px;
  box-shadow: 0 40px 100px -20px rgba(11, 18, 32, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header section */
.usage-modal-header {
  padding: 22px 26px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}

.usage-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500, #f47c20);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.usage-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink-900, #0b1220);
}

.usage-subtitle {
  font-size: 13px;
  color: var(--ink-500, #5a6573);
  margin-top: 4px;
}

.usage-close-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: var(--bg-soft, #f7f8fa);
  cursor: pointer;
  color: var(--ink-500, #5a6573);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s, color 0.15s;
}

.usage-close-btn:hover {
  background: var(--line-soft, #f0f1f4);
  color: var(--ink-700, #1a2233);
}

.usage-close-btn:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

/* Filter buttons */
.usage-filters {
  padding: 14px 26px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.usage-filter-btn {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg, #ffffff);
  color: var(--ink-500, #5a6573);
  border: 1px solid var(--line, #e6e8ec);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.usage-filter-btn:hover:not(.usage-filter-btn--active) {
  border-color: var(--brand-500, #f47c20);
  color: var(--brand-500, #f47c20);
}

.usage-filter-btn--active {
  background: var(--ink-900, #0b1220);
  color: var(--bg, #ffffff);
  border-color: var(--ink-900, #0b1220);
}

.usage-filter-btn:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

/* Body section */
.usage-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 26px 24px;
}

/* Total usage card */
.usage-total-card {
  padding: 22px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-50, #fff1e4) 0%, var(--bg, #ffffff) 60%);
  border: 1px solid var(--brand-200, #ffd1a8);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.usage-total-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-900, #b8560c);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.usage-total-number {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink-900, #0b1220);
  font-variant-numeric: tabular-nums;
}

.usage-total-meta {
  font-size: 13px;
  color: var(--ink-500, #5a6573);
  margin-top: 6px;
}

/* Sparkline wrapper */
.usage-sparkline-wrap {
  flex: 1;
}

.usage-sparkline {
  width: 100%;
  height: 160px;
}

/* Recipients list */
.usage-recipients-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usage-recipient-item {
  padding: 12px 14px;
  background: var(--bg-soft, #f7f8fa);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.usage-recipient-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: hsl(22, 70%, 94%);
  color: hsl(22, 60%, 32%);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.usage-recipient-info {
  flex: 1;
}

.usage-recipient-number {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-900, #0b1220);
  font-variant-numeric: tabular-nums;
}

.usage-recipient-details {
  font-size: 11.5px;
  color: var(--ink-400, #97a0ae);
  margin-top: 2px;
}

.usage-recipient-bar {
  width: 160px;
  height: 6px;
  background: var(--line, #e6e8ec);
  border-radius: 999px;
  overflow: hidden;
}

.usage-recipient-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-400, #ff9a3d), var(--brand-500, #f47c20));
}

.usage-recipient-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900, #0b1220);
  width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Footer section */
.usage-footer {
  padding: 14px 26px;
  border-top: 1px solid var(--line, #e6e8ec);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--bg-warm, #fafbfc);
  flex-shrink: 0;
}

.usage-footer-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.usage-footer-btn--outline {
  background: var(--bg, #ffffff);
  border: 1.5px solid var(--line, #e6e8ec);
  color: var(--ink-900, #0b1220);
}

.usage-footer-btn--outline:hover {
  border-color: var(--brand-500, #f47c20);
  color: var(--brand-500, #f47c20);
}

.usage-footer-btn--outline:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.usage-footer-btn--primary {
  background: linear-gradient(180deg, var(--brand-400, #ff9a3d), var(--brand-500, #f47c20));
  color: var(--bg, #ffffff);
  border: none;
  box-shadow: 0 6px 16px -6px rgba(244, 124, 32, 0.5);
}

.usage-footer-btn--primary:hover {
  box-shadow: 0 8px 20px -6px rgba(244, 124, 32, 0.5);
  opacity: 0.92;
}

.usage-footer-btn--primary:active {
  opacity: 0.82;
  box-shadow: 0 4px 10px -6px rgba(244, 124, 32, 0.5);
}

.usage-footer-btn--primary:focus-visible {
  outline: 2px solid var(--bg, #ffffff);
  outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .usage-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 18px;
  }
  .usage-modal-header {
    padding: 16px 16px 10px;
  }
  .usage-filters {
    padding: 12px 16px 0;
  }
  .usage-body {
    padding: 12px 16px 20px;
  }
  .usage-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .usage-footer-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ──────────────────────────────────────────────────────────────────────── */
/* Bulk Recipients Modal (Task 12)                                          */
/* ──────────────────────────────────────────────────────────────────────── */

.bulk-recipients-shell {
  width: 640px;
  max-height: 100%;
  background: var(--bg, #ffffff);
  border-radius: 22px;
  box-shadow: 0 40px 100px -20px rgba(11, 18, 32, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bulk-recipients-header {
  padding: 22px 26px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}

.bulk-recipients-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-50, #fff1e4);
  color: var(--brand-500, #f47c20);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bulk-recipients-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500, #f47c20);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bulk-recipients-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink-900, #0b1220);
}

.bulk-recipients-description {
  font-size: 13.5px;
  color: var(--ink-500, #5a6573);
  margin-top: 6px;
  line-height: 1.5;
}

.bulk-recipients-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--bg-soft, #f7f8fa);
  cursor: pointer;
  color: var(--ink-500, #5a6573);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.2s, color 0.2s;
}

.bulk-recipients-close:hover {
  background: var(--line, #e6e8ec);
}

.bulk-recipients-close:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.bulk-recipients-body {
  padding: 0 26px 14px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bulk-recipients-textarea-wrap {
  position: relative;
}

.bulk-recipients-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-soft, #f7f8fa);
  border: 1.5px solid var(--line, #e6e8ec);
  border-radius: 14px;
  font-size: 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--ink-900, #0b1220);
  line-height: 1.55;
  resize: vertical;
  outline: none;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.bulk-recipients-textarea:focus {
  border-color: var(--brand-500, #f47c20);
  box-shadow: 0 0 0 3px rgba(244, 124, 32, 0.1);
}

.bulk-recipients-count {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-500, #f47c20);
  background: var(--brand-50, #fff1e4);
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
}

.bulk-recipients-success {
  padding: 10px 14px;
  background: var(--success-50, #f0fbf5);
  border: 1px solid var(--success-200, #b8e6cc);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--success-700, #0f6b3e);
  flex-shrink: 0;
}

.bulk-recipients-success svg {
  color: var(--success-500, #1f9d6a);
  flex-shrink: 0;
}

.bulk-recipients-errors {
  padding: 10px 14px;
  background: var(--danger-50, #fdecec);
  border: 1px solid #fcc8c8;
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--danger-600, #c02e2e);
}

.bulk-recipients-error-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.bulk-recipients-error-item::before {
  content: '×';
  color: var(--danger-600, #c02e2e);
  font-weight: 700;
  flex-shrink: 0;
}

.bulk-recipients-footer {
  padding: 14px 26px;
  border-top: 1px solid var(--line, #e6e8ec);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg-warm, #fafbfc);
  flex-shrink: 0;
}

.bulk-recipients-btn {
  height: 42px;
  padding: 0 16px;
  background: var(--bg, #ffffff);
  border: 1.5px solid var(--line, #e6e8ec);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-900, #0b1220);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.bulk-recipients-btn:hover:not(:disabled) {
  background: var(--line-soft, #f0f1f4);
}

.bulk-recipients-btn:active:not(:disabled) {
  opacity: 0.85;
}

.bulk-recipients-btn:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.bulk-recipients-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bulk-recipients-btn--outline {
  /* Already styled above */
}

.bulk-recipients-btn--primary {
  height: 42px;
  padding: 0 22px;
  background: linear-gradient(180deg, var(--brand-400, #ff9a3d), var(--brand-500, #f47c20));
  color: var(--bg, #ffffff);
  border: none;
  box-shadow: 0 6px 16px -6px rgba(244, 124, 32, 0.5);
}

.bulk-recipients-btn--primary:hover:not(:disabled) {
  box-shadow: 0 8px 20px -6px rgba(244, 124, 32, 0.5);
  opacity: 0.92;
}

.bulk-recipients-btn--primary:active:not(:disabled) {
  opacity: 0.82;
  box-shadow: 0 4px 10px -6px rgba(244, 124, 32, 0.5);
}

.bulk-recipients-btn--primary:focus-visible {
  outline: 2px solid var(--bg, #ffffff);
  outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 680px) {
  .bulk-recipients-shell {
    width: calc(100vw - 24px);
    border-radius: 18px;
  }
  .bulk-recipients-header {
    padding: 16px 16px 10px;
  }
  .bulk-recipients-body {
    padding: 0 16px 14px;
  }
  .bulk-recipients-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .bulk-recipients-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Task 13 — Bulk Compose Overlay
   ───────────────────────────────────────────────────────────────────────────── */

/* Fullscreen overlay — sits above all page content */
.bulk-compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--bg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
}
.bulk-compose-overlay.open {
  display: flex;
}

/* TopNav mount — inherits topnav styles from task 03 */
#bc-topnav-mount .topnav {
  position: static; /* override sticky so it participates in flex column */
}

/* ── Banner ────────────────────────────────────────────────────────────────── */
.bulk-compose-banner {
  background: linear-gradient(180deg, #FFF8F0, #FFF1E4);
  border-bottom: 1px solid var(--brand-200);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.bulk-compose-banner__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bulk-compose-banner__body {
  flex: 1;
  min-width: 0;
}
.bulk-compose-banner__title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.3;
}
.bulk-compose-banner__count {
  color: var(--brand-900);
}
.bulk-compose-banner__sub {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 2px;
}
.bulk-compose-banner__exit {
  height: 34px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--brand-200);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-900);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.bulk-compose-banner__exit:hover {
  background: var(--brand-50);
  border-color: var(--brand-500);
}
.bulk-compose-banner__exit:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ── Body: left + right panels ─────────────────────────────────────────────── */
.bulk-compose-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* LEFT — recipients panel */
.bulk-compose-left {
  width: 360px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bulk-compose-left__header {
  padding: 16px 16px 10px;
  flex-shrink: 0;
}
.bulk-compose-left__eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-400);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.bulk-compose-left__add-btn {
  width: 100%;
  height: 38px;
  background: var(--bg);
  border: 1.5px dashed var(--ink-300);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.bulk-compose-left__add-btn:hover {
  border-color: var(--brand-500);
  color: var(--brand-500);
  background: var(--brand-100);
}
.bulk-compose-left__add-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Chip list */
.bulk-compose-left__chips {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Individual chip */
.bulk-compose-chip {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.bulk-compose-chip__avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.bulk-compose-chip__num {
  flex: 1;
  font-size: 13.5px;
  color: var(--ink-900);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.bulk-compose-chip__del {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.bulk-compose-chip__del:hover {
  background: var(--danger-50);
  color: var(--danger-600);
}
.bulk-compose-chip__del:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Left panel footer */
.bulk-compose-left__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 12px;
  color: var(--ink-500);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bulk-compose-left__footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bulk-compose-left__footer-valid {
  color: var(--success-500);
  font-variant-numeric: tabular-nums;
}
.bulk-compose-left__footer-deliver {
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}

/* ── RIGHT — compose ────────────────────────────────────────────────────────── */
.bulk-compose-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.bulk-compose-right__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px 40px;
}
.bulk-compose-right__inner {
  max-width: 640px;
  margin: 0 auto;
}
.bulk-compose-right__heading {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--ink-900);
}
.bulk-compose-right__sub {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Quick-starter chips */
.bulk-compose-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.bulk-compose-starters__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
  align-self: center;
  margin-right: 4px;
}
.bc-starter-chip {
  height: 32px;
  padding: 0 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-900);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.bc-starter-chip:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-900);
}
.bc-starter-chip:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}
.bc-starter-chip--dashed {
  border-style: dashed;
  color: var(--ink-500);
}
.bc-starters-empty {
  font-size: 12px;
  color: var(--ink-400);
  font-style: italic;
}

/* Textarea container */
.bulk-compose-textarea-wrap {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.bulk-compose-textarea-wrap:focus-within {
  border-color: var(--brand-500);
}
.bulk-compose-textarea {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink-900);
  outline: none;
  line-height: 1.55;
  min-height: 120px;
}
.bulk-compose-textarea::placeholder {
  color: var(--ink-400);
}
.bulk-compose-textarea-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}

/* Preview */
.bulk-compose-preview-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-400);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 20px 0 10px;
}
.bulk-compose-preview-card {
  padding: 18px 20px;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.bulk-compose-preview-bubble {
  max-width: 80%;
  padding: 10px 14px;
  background: linear-gradient(180deg, #FF9A3D, #F47C20);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 6px 14px -6px rgba(244,124,32,.4);
  transition: opacity 0.15s;
}

/* ── Action bar ─────────────────────────────────────────────────────────────── */
.bulk-compose-action-bar {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.bulk-compose-schedule-btn {
  height: 40px;
  padding: 0 16px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-400);
  cursor: not-allowed;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.6;
}
.bulk-compose-info-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-soft);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--ink-500);
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.bulk-compose-send-btn {
  height: 44px;
  padding: 0 22px;
  background: linear-gradient(180deg, #FF9A3D, #F47C20);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 20px -6px rgba(244,124,32,.5);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  transition: box-shadow 0.2s, opacity 0.15s;
}
.bulk-compose-send-btn:hover:not(:disabled) {
  box-shadow: 0 10px 24px -6px rgba(244,124,32,.65);
}
.bulk-compose-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.bulk-compose-send-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ── Mobile responsive ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .bulk-compose-left {
    display: none; /* collapse on small screens; chips could be shown in a toggle */
  }
  .bulk-compose-right__scroll {
    padding: 20px 16px;
  }
  .bulk-compose-action-bar {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .bulk-compose-info-pill {
    order: -1;
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BULK HISTORY MODAL (Task 14)
   ═══════════════════════════════════════════════════════════════════════════════ */

.bulk-history-shell {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 64px);
  background: var(--bg, #ffffff);
  border-radius: 22px;
  box-shadow: var(--shadow-modal, 0 40px 100px -20px rgba(11, 18, 32, 0.4));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bulk-history-header {
  padding: 22px 26px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line, #E6E8EC);
}

.bulk-history-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500, #F47C20);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bulk-history-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink-900, #0B1220);
}

.bulk-history-description {
  font-size: 13px;
  color: var(--ink-500, #5A6573);
  margin-top: 4px;
}

.bulk-history-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--bg-soft, #F7F8FA);
  cursor: pointer;
  color: var(--ink-500, #5A6573);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  padding: 0;
}

.bulk-history-close:hover {
  background: var(--line-soft, #F0F1F4);
  color: var(--ink-700, #1A2233);
}

.bulk-history-close:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.bulk-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bulk-history-row {
  padding: 14px 16px;
  background: var(--bg-soft, #F7F8FA);
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.15s;
}

.bulk-history-row:hover:not(.bulk-history-row--skeleton) {
  background: var(--line-soft, #F0F1F4);
}

.bulk-history-row--skeleton {
  pointer-events: none;
  opacity: 0.6;
}

.bulk-history-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg, #FFFFFF);
  border: 1px solid var(--line, #E6E8EC);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-500, #F47C20);
  flex-shrink: 0;
}
.bulk-history-date-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-50, #FFF1E4);
  border: 1px solid var(--brand-200, #FFD1A8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.bulk-history-date-dd {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-900, #B8560C);
}
.bulk-history-date-mm {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-500, #F47C20);
  margin-top: 1px;
}

.bulk-history-icon-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--line, #E6E8EC);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bulk-history-content {
  flex: 1;
  min-width: 0;
}

.bulk-history-time {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-900, #0B1220);
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}

.bulk-history-time-placeholder {
  height: 16px;
  background: var(--line, #E6E8EC);
  border-radius: 4px;
  margin-bottom: 6px;
  animation: pulse 2s infinite;
}

.bulk-history-preview {
  font-size: 12.5px;
  color: var(--ink-500, #5A6573);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bulk-history-preview-placeholder {
  height: 12px;
  background: var(--line, #E6E8EC);
  border-radius: 4px;
  width: 70%;
  animation: pulse 2s infinite;
}

.bulk-history-stats {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.bulk-history-stat {
  padding: 6px 10px;
  border-radius: 10px;
  text-align: center;
  min-width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.bulk-history-stat-value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.bulk-history-stat-label {
  font-size: 10px;
  opacity: 0.7;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bulk-history-stat-placeholder {
  width: 56px;
  height: 40px;
  background: var(--line, #E6E8EC);
  border-radius: 8px;
  animation: pulse 2s infinite;
}

.bulk-history-progress {
  width: 80px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.bulk-history-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--line, #E6E8EC);
  border-radius: 999px;
  overflow: hidden;
}

.bulk-history-progress-label {
  font-size: 10.5px;
  color: var(--ink-400, #97A0AE);
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bulk-history-chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-400, #97A0AE);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bulk-history-footer {
  padding: 14px 26px;
  border-top: 1px solid var(--line, #E6E8EC);
  background: var(--bg-warm, #FAFBFC);
  font-size: 12px;
  color: var(--ink-500, #5A6573);
  flex-shrink: 0;
}

.bulk-history-footer-info {
  font-size: 12px;
  color: var(--ink-500, #5A6573);
}

.bulk-history-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--ink-400, #97A0AE);
  min-height: 200px;
}

.bulk-history-empty-text {
  font-size: 13px;
  color: var(--ink-400, #97A0AE);
  font-weight: 500;
}

.bulk-history-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  min-height: 200px;
}

.bulk-history-error-message {
  font-size: 13px;
  color: var(--danger-600, #C02E2E);
  text-align: center;
  max-width: 400px;
}

.bulk-history-retry-btn {
  height: 40px;
  padding: 0 18px;
  background: var(--brand-500, #F47C20);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, box-shadow 0.2s;
}

.bulk-history-retry-btn:hover {
  opacity: 0.9;
  box-shadow: 0 8px 20px -6px rgba(244,124,32,.5);
}

.bulk-history-retry-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ── Bulk Detail Modal (Task 15) ───────────────────────────────────── */

.bulk-detail-shell {
  width: 760px;
  max-height: calc(100vh - 64px);
  background: var(--bg, #ffffff);
  border-radius: 22px;
  box-shadow: var(--shadow-modal, 0 40px 100px -20px rgba(11, 18, 32, 0.4));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bulk-detail-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line, #e6e8ec);
}

.bulk-detail-back {
  height: 34px;
  padding: 0 12px;
  background: var(--bg-soft, #f7f8fa);
  border: 1.5px solid var(--line, #e6e8ec);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-900, #0b1220);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  transition: opacity 0.15s, background 0.15s;
}

.bulk-detail-back:hover {
  opacity: 0.9;
  background: var(--line-soft, #f0f1f4);
}

.bulk-detail-back:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.bulk-detail-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-500, #f47c20);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.bulk-detail-timestamp {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink-900, #0b1220);
  font-variant-numeric: tabular-nums;
}

.bulk-detail-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--bg-soft, #f7f8fa);
  cursor: pointer;
  color: var(--ink-500, #5a6573);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, background 0.15s;
}

.bulk-detail-close:hover {
  opacity: 0.8;
  background: var(--line-soft, #f0f1f4);
}

.bulk-detail-close:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.bulk-detail-message-preview {
  padding: 0 22px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.bulk-detail-message-preview > div:first-child {
  flex-shrink: 0;
}

.bulk-detail-preview-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-400, #97a0ae);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.bulk-detail-preview-text {
  font-size: 13px;
  color: var(--ink-900, #0b1220);
  line-height: 1.45;
}

.bulk-detail-controls {
  padding: 0 22px 14px;
  flex-shrink: 0;
}

.bulk-detail-filter-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bulk-detail-filter-tab {
  height: 36px;
  padding: 0 14px;
  background: var(--bg-soft, #f7f8fa);
  color: var(--ink-900, #0b1220);
  border: 0;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.bulk-detail-filter-tab:hover {
  opacity: 0.85;
}

.bulk-detail-filter-tab:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.bulk-detail-filter-tab--active {
  background: var(--ink-900, #0b1220);
  color: #ffffff;
}

.bulk-detail-filter-tab--danger {
  color: var(--danger-600, #c02e2e);
}

.bulk-detail-filter-tab--danger.bulk-detail-filter-tab--active {
  background: var(--danger-600, #c02e2e);
  color: #ffffff;
}

.bulk-detail-filter-count {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.06);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bulk-detail-filter-tab--active .bulk-detail-filter-count {
  background: rgba(255, 255, 255, 0.2);
}

.bulk-detail-search {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-soft, #f7f8fa);
  border: 1.5px solid var(--line, #e6e8ec);
  border-radius: 10px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  color: var(--ink-900, #0b1220);
  transition: border-color 0.15s;
}

.bulk-detail-search:focus {
  border-color: var(--brand-500, #f47c20);
}

.bulk-detail-search::placeholder {
  color: var(--ink-400, #97a0ae);
}

.bulk-detail-table-wrapper {
  flex: 1;
  overflow: auto;
  padding: 0 22px 4px;
  min-height: 0;
}

.bulk-detail-table-header {
  display: grid;
  grid-template-columns: 48px 1fr 140px 120px 100px;
  padding: 8px 14px;
  background: var(--ink-900, #0b1220);
  color: #ffffff;
  border-radius: 10px 10px 0 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  align-items: center;
  flex-shrink: 0;
}

.bulk-detail-table-body {
  border: 1px solid var(--line, #e6e8ec);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

.bulk-detail-table-row {
  display: grid;
  grid-template-columns: 48px 1fr 140px 120px 100px;
  padding: 11px 14px;
  align-items: center;
  background: var(--bg, #ffffff);
  border-bottom: 1px solid var(--line-soft, #f0f1f4);
  font-size: 13px;
  color: var(--ink-900, #0b1220);
  font-variant-numeric: tabular-nums;
}

.bulk-detail-table-row:last-child {
  border-bottom: none;
}

.bulk-detail-table-row:nth-child(even) {
  background: var(--bg-warm, #fafbfc);
}

.bulk-detail-table-col {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-detail-table-col--index {
  color: var(--ink-400, #97a0ae);
  font-weight: 600;
}

.bulk-detail-table-col--right {
  text-align: right;
  font-weight: 600;
}

.bulk-detail-number-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bulk-detail-avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bulk-detail-number {
  font-weight: 500;
  word-break: break-all;
}

.bulk-detail-country-chip {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--line-soft, #f0f1f4);
  color: var(--ink-500, #5a6573);
  border-radius: 5px;
  font-weight: 600;
  flex-shrink: 0;
}

.bulk-detail-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.bulk-detail-status-delivered {
  background: var(--success-50, #e6f6ee);
  color: var(--success-500, #1f9d6a);
}

.bulk-detail-status-failed {
  background: var(--danger-50, #fdecec);
  color: var(--danger-600, #c02e2e);
}

.bulk-detail-time-cell {
  color: var(--ink-500, #5a6573);
  font-size: 12.5px;
}

.bulk-detail-sms-cost {
  text-align: right;
  font-weight: 600;
}

.bulk-detail-sms-cost--zero {
  color: var(--ink-400, #97a0ae);
}

.bulk-detail-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line, #e6e8ec);
  background: var(--bg-warm, #fafbfc);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.bulk-detail-footer-info {
  font-size: 12px;
  color: var(--ink-500, #5a6573);
}

.bulk-detail-footer-btn {
  height: 38px;
  padding: 0 14px;
  background: var(--bg, #ffffff);
  border: 1.5px solid var(--line, #e6e8ec);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-900, #0b1220);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.bulk-detail-footer-btn:hover {
  background: var(--bg-soft, #f7f8fa);
}

.bulk-detail-footer-btn:focus-visible {
  outline: 2px solid var(--brand-500, #f47c20);
  outline-offset: 2px;
}

.bulk-detail-footer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bulk-detail-resend-btn {
  margin-left: auto;
}

.bulk-detail-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--ink-400, #97a0ae);
  min-height: 200px;
}

@media (max-width: 900px) {
  .bulk-detail-shell {
    width: calc(100% - 32px);
    max-width: 760px;
  }
}

/* ── Report Modal (redesigned) ─────────────────────────────────────────────── */
.report-modal-shell {
  width: 700px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  background: var(--bg, #ffffff);
  border-radius: 22px;
  box-shadow: 0 40px 100px -20px rgba(11, 18, 32, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.report-modal-header {
  padding: 22px 26px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line-soft, #e6e8ec);
}

.report-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
  padding: 20px 24px;
}

@media (max-width: 760px) {
  .report-modal-shell {
    width: calc(100vw - 24px);
    border-radius: 18px;
  }
}
