/* ==========================================================================
   Clean Minimal White Theme - Enterprise Design System (Widescreen Full Layout)
   ========================================================================== */

:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-subtle-hover: #e2e8f0;

  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #0f172a;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --primary: #0f172a;
  --primary-hover: #1e293b;
  --primary-text: #ffffff;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --info: #2563eb;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* Top Navigation Bar */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem clamp(12rem, 14vw, 20rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-badge {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand h1 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand span.version-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

.api-docs-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.api-docs-link:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

/* Tabs Navigation */
.tabs-header {
  padding: 0 clamp(12rem, 14vw, 20rem);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

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

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

/* Main Content Area - Full Widescreen */
.main-content,
.content-area {
  flex: 1;
  padding: 1.75rem clamp(12rem, 14vw, 20rem) 4.5rem clamp(12rem, 14vw, 20rem);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tab-pane {
  display: none;
  width: 100%;
}

.tab-pane.active {
  display: block;
}

/* Page Header / Action Bar */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.page-title h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

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

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

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

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

.btn-danger {
  background: var(--bg-surface);
  color: var(--danger);
  border-color: var(--border-color);
}

.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

/* Cards & Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: #cbd5e1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-header .tenant-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

/* Service Status Indicators */
.service-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.6rem 0;
}

.pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.pill-active {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.pill-inactive {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* API Key Box */
.api-key-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.api-key-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

/* Forms */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Form Row Grid */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Segmented Control Pill Switcher */
.segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.segmented-control label {
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-control input[type="radio"]:checked+label {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Alias Page Header & Platform Switcher */
.alias-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.alias-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.segmented-control .platform-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.segmented-control .platform-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle-hover);
}

.segmented-control .platform-tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.segmented-control .platform-tab-btn.telegram svg {
  color: #229ED9;
}

.segmented-control .platform-tab-btn.mattermost svg {
  color: #1C58D9;
}

.segmented-control .platform-tab-btn.whatsapp svg {
  color: #25D366;
}

/* Platform Settings & Side Setup Guide Layout */
.platform-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .platform-settings-layout {
    grid-template-columns: 1fr;
  }
}

.platform-credential-card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.platform-credential-card:hover {
  border-color: #cbd5e1;
}

.platform-credential-card.active-platform-card {
  border-color: var(--primary);
  box-shadow: 0 0 0 1.5px var(--primary);
}

.platform-guide-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.guide-step-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.guide-step-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.guide-step-num {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.15rem;
  border: 1px solid var(--border-color);
}

.guide-step-content {
  flex: 1;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.guide-step-content strong {
  color: var(--text-primary);
}

.guide-code-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  margin-top: 0.35rem;
  word-break: break-all;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.guide-btn-copy {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
  flex-shrink: 0;
}

.guide-btn-copy:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-primary);
}

.guide-pro-tip {
  margin-top: 1.25rem;
  padding: 0.75rem 0.85rem;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  color: #1e40af;
  line-height: 1.45;
}

/* Multi-File Upload Zone & Queue List */
.file-upload-zone {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.file-upload-zone:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.file-upload-hint {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.file-upload-subhint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.selected-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
  max-height: 180px;
  overflow-y: auto;
}

.file-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  transition: border-color 0.12s ease;
}

.file-queue-item:hover {
  border-color: #cbd5e1;
}

.file-queue-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.file-queue-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.file-queue-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.file-queue-remove {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background 0.12s ease;
}

.file-queue-remove:hover {
  background: var(--danger-bg);
}

/* Quick-Add Recipient Chips */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  align-items: center;
}

/* Interactive Group & Channel Selector */
.chat-selector-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 210px;
  overflow-y: auto;
  margin-top: 0.4rem;
}

.platform-section-header {
  padding: 0.4rem 0.85rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.platform-section-header:first-child {
  border-top: none;
}

/* Interactive Selector Items (Platforms & Recipients) */
.chat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

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

.chat-item:hover {
  background: var(--bg-subtle);
}

.chat-item.is-selected,
.chat-item:has(input[type="checkbox"]:checked) {
  background: #f8fafc;
}

.chat-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
  margin: 0;
}

.chat-item-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.item-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.chat-item:hover .item-icon-box {
  transform: scale(1.04);
}

.item-icon-box.telegram-bg {
  background: #e0f2fe;
  color: #0284c7;
}

.item-icon-box.mattermost-bg {
  background: #ede9fe;
  color: #6366f1;
}

.item-icon-box.whatsapp-bg {
  background: #dcfce7;
  color: #16a34a;
}

.item-icon-box.group-bg {
  background: #f1f5f9;
  color: #475569;
}

.item-icon-box.channel-bg {
  background: #fef3c7;
  color: #d97706;
}

.item-icon-box.direct-bg {
  background: #f1f5f9;
  color: #475569;
}

.chat-item-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 0.15rem;
}

.chat-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-type {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.platform-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.platform-pill-tag.telegram {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.platform-pill-tag.mattermost {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}

.platform-pill-tag.whatsapp {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* ==========================================================================
   Enterprise Data Table System
   ========================================================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.825rem;
  text-align: left;
}

.data-table thead th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: background 0.12s ease;
}

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

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

/* Status Indicator Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.status-pill.active {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-pill.inactive {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Platform Entitlement Badges with Icons */
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-sm);
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.platform-chip.telegram {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.platform-chip.mattermost {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
}

.platform-chip.whatsapp {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.platform-chip.disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  opacity: 0.6;
  text-decoration: line-through;
}

/* Access Permission Chips */
.access-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.access-chip.allowed {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.access-chip.denied {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Monospace & Code Helpers */
.alias-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.chat-id-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.api-key-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-subtle);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.api-key-dots {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  min-width: 110px;
}

.btn-icon-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-icon-sm:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger-border);
  background: #fff;
  color: var(--danger);
  cursor: pointer;
  transition: all 0.12s ease;
}

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

.custom-recipient-bar {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.chip-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-right: 0.2rem;
}

.chip-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.chip-btn:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

/* ==========================================================================
   Full Widescreen Broadcast Layout with Sidebar
   ========================================================================== */
.broadcast-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

@media (max-width: 1024px) {
  .broadcast-layout {
    grid-template-columns: 1fr;
  }
}

/* Progress / Activity Card */
.activity-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
}

.stat-box .stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-box .stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
}

.progress-bar-container {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.85rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

/* Tables */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin-top: 0.75rem;
}

.results-table th,
.results-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.results-table th {
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg-subtle);
}

.results-table code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Recent Broadcasts List */
.recent-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
  max-height: 320px;
  overflow-y: auto;
}

.job-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.15s ease;
  cursor: pointer;
}

.job-item:hover {
  border-color: #cbd5e1;
}

.job-meta-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.job-meta-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  padding: 1rem;
}

.modal-overlay.open,
.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(60px);
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: #15803d;
}

.toast.error {
  background: #b91c1c;
}

.toast.info {
  background: #0f172a;
}

/* Code Block */
.code-block {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #f8fafc;
  overflow-x: auto;
  position: relative;
  margin-top: 0.5rem;
}

.copy-snippet-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.copy-snippet-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 1280px) {
  .navbar, .tabs-header, .main-content, .content-area {
    padding-left: clamp(2rem, 6vw, 6rem);
    padding-right: clamp(2rem, 6vw, 6rem);
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0.85rem 1.25rem;
  }

  .tabs-header {
    padding: 0 1.25rem;
  }

  .main-content, .content-area {
    padding: 1.25rem 1.25rem;
  }
}

/* ==========================================================================
   Super Admin Authentication Overlay & Components
   ========================================================================== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  width: 100%;
  max-width: 400px;
  padding: 2.25rem 2.25rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.auth-header p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-error-alert {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
}

.navbar-user-section {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.navbar-user-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* Entitlement & Permission UI */
.perm-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.perm-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.perm-option-card:hover {
  border-color: var(--text-muted);
  background: var(--bg-subtle);
}

.perm-option-card input[type="checkbox"] {
  margin-top: 0.2rem;
  cursor: pointer;
}

.perm-option-label {
  display: flex;
  flex-direction: column;
}

.perm-option-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.perm-option-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-platform {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-right: 0.25rem;
  margin-bottom: 0.2rem;
}

.badge-platform.enabled {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.badge-platform.disabled {
  opacity: 0.45;
  text-decoration: line-through;
}

.badge-access {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-right: 0.25rem;
}

.badge-access.allowed {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.badge-access.denied {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Fixed Footer across all pages and tenant portal tabs */
.fixed-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.85rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  pointer-events: none;
}

.auth-footer {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* Execution Status Banner (replacing 3 metric cards) */
.execution-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
  transition: all 0.25s ease;
}

.spinner-svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}