/*
 * StreamFlow - Live Streaming Lewat VPS
 *
 * Custom Features & UI Components
 * Light-only design system (shadcn-inspired, compact, pastel accents).
 */

@font-face {
  font-family: 'tabler-icons';
  src: url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@2.30.0/fonts/tabler-icons.woff2') format('woff2');
  font-display: block;
  font-weight: normal;
  font-style: normal;
}

.ti {
  font-family: 'tabler-icons' !important;
  visibility: visible !important;
  opacity: 1;
}

/* ==========================================================================
   Design tokens. Single source of truth for colours, radii and type scale.
   Values mirror the Tailwind theme in /js/tailwind-theme.js so utility
   classes and hand-written CSS stay in sync.
   ========================================================================== */
:root {
  color-scheme: light;

  /* Brand */
  --primary-color: #2563EB;
  --sf-primary-hover: #1D4ED8;
  --sf-primary-soft: #EFF6FF;
  --sf-primary-border: #BFDBFE;

  /* Surfaces */
  --sf-page: #F8FAFC;
  --sf-surface: #FFFFFF;
  --sf-muted: #F1F5F9;
  --sf-hover: #F1F5F9;
  --sf-line: #E2E8F0;
  --sf-input-border: #CBD5E1;

  /* Text */
  --sf-text-primary: #0F172A;
  --sf-text-body: #334155;
  --sf-text-secondary: #64748B;
  --sf-text-faint: #94A3B8;

  /* Status */
  --sf-live: #15803D;
  --sf-live-bg: #DCFCE7;
  --sf-scheduled: #B45309;
  --sf-scheduled-bg: #FEF3C7;
  --sf-offline: #475569;
  --sf-offline-bg: #F1F5F9;
  --sf-error: #B91C1C;
  --sf-error-bg: #FEE2E2;
  --sf-starting: #1D4ED8;
  --sf-starting-bg: #DBEAFE;

  /* Shape */
  --sf-radius: 8px;
  --sf-radius-sm: 6px;
  --sf-card-padding: 16px;
  --sf-card-gap: 12px;
  --sf-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --sf-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--sf-page);
  color: var(--sf-text-primary);
}

.modal-overlay {
  /* Overlay gelap polos (sengaja tanpa efek blur) agar scroll modal mulus. */
  background-color: rgba(15, 23, 42, 0.6);
  transition: opacity 0.12s ease-out;
  overscroll-behavior: contain;
}

.modal-overlay.active {
  opacity: 1;
}

[onclick^="setVideoOrientation"] {
  position: relative;
  overflow: hidden;
}

[onclick^="setVideoOrientation"]:before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-color);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

[onclick^="setVideoOrientation"].bg-primary:before {
  opacity: 0.1;
}

[onclick^="setVideoOrientation"]:hover:before {
  opacity: 0.05;
}

[onclick^="setVideoOrientation"] i {
  transition: transform 0.2s ease-in-out;
}

[onclick^="setVideoOrientation"]:active i {
  transform: scale(0.9);
}

/* ==========================================================================
   Scrollbar tunggal untuk seluruh aplikasi.
   Semua halaman memuat styles.css, jadi cukup satu definisi di sini.
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.28) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(100, 116, 139, 0.28);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 116, 139, 0.45);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Utilitas: sembunyikan scrollbar horizontal pada tab yang bisa digeser */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Reusable components
   ========================================================================== */
.sf-card {
  background-color: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  padding: var(--sf-card-padding);
}

.sf-card-tight {
  padding: 12px;
}

.sf-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--sf-text-primary);
}

.sf-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sf-text-primary);
}

.sf-text-secondary {
  color: var(--sf-text-secondary);
  font-size: 12px;
}

.sf-text-live { color: var(--sf-live); }
.sf-text-scheduled { color: var(--sf-scheduled); }
.sf-text-offline { color: var(--sf-offline); }

/* Tab Business: segmented control ringan, hanya warna yang berubah */
.sf-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background-color: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  padding: 6px;
}

.sf-tabs-label {
  display: inline-flex;
  align-items: center;
  padding: 0 10px 0 6px;
  margin-right: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sf-text-secondary);
  white-space: nowrap;
}

.sf-tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sf-text-secondary);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sf-tab:hover {
  background-color: var(--sf-muted);
  color: var(--sf-text-primary);
}

.sf-tab-active,
.sf-tab-active:hover {
  background-color: var(--primary-color);
  color: #FFFFFF;
}

/* Grafik pendapatan Overview: batang CSS, tanpa library */
.biz-trend {
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 150px;
}

.biz-trend-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.biz-trend-bar {
  background-color: var(--primary-color);
  border-radius: 6px 6px 0 0;
  min-height: 2px;
  opacity: 0.85;
}

.biz-trend-bar-zero { min-height: 0; }
.biz-trend-col:hover .biz-trend-bar { opacity: 1; }

.biz-trend-label {
  margin-top: 6px;
  text-align: center;
  font-size: 10px;
  color: var(--sf-text-secondary);
  white-space: nowrap;
}

.biz-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.biz-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.biz-list dt { color: var(--sf-text-secondary); }
.biz-list dd { font-weight: 600; color: var(--sf-text-primary); }

/* Shared compact statistic cards used across the Business tabs. */
.biz-page .sf-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  background-color: var(--sf-surface);
  box-sizing: border-box;
}

.biz-stat-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--biz-stat-border, var(--sf-line));
  border-radius: var(--sf-radius);
  background-color: var(--biz-stat-bg, var(--sf-surface));
  color: var(--biz-stat-color, var(--sf-text-primary));
  box-sizing: border-box;
}

.biz-stat-card--primary { --biz-stat-bg: #EFF6FF; --biz-stat-border: #BFDBFE; --biz-stat-color: #1D4ED8; }
.biz-stat-card--success { --biz-stat-bg: #ECFDF5; --biz-stat-border: #A7F3D0; --biz-stat-color: #047857; }
.biz-stat-card--warning { --biz-stat-bg: #FFFBEB; --biz-stat-border: #FDE68A; --biz-stat-color: #B45309; }
.biz-stat-card--danger { --biz-stat-bg: #FEE2E2; --biz-stat-border: #FECACA; --biz-stat-color: #B91C1C; }
.biz-stat-card__label { font-size: 12px; line-height: 1.4; opacity: 0.85; }
.biz-stat-card__value { margin-top: 2px; font-size: 20px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }

.sf-stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.sf-stat-icon,
.sf-tile-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--sf-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sf-stat-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--sf-text-secondary);
  padding-top: 6px;
}

.sf-stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--sf-text-primary);
}

/* --------------------------------------------------------------------------
   Pastel statistic cards (dashboard only). Each card keeps its own tint,
   border and metric colour; no gradients, no heavy shadows.
   -------------------------------------------------------------------------- */
.sf-stat-total { background-color: #EFF6FF; border-color: #BFDBFE; }
.sf-stat-total .sf-stat-value { color: #1D4ED8; }

.sf-stat-live { background-color: #ECFDF5; border-color: #A7F3D0; }
.sf-stat-live .sf-stat-value { color: #047857; }

.sf-stat-scheduled { background-color: #FFFBEB; border-color: #FDE68A; }
.sf-stat-scheduled .sf-stat-value { color: #B45309; }

.sf-stat-offline { background-color: #F1F5F9; border-color: #CBD5E1; }
.sf-stat-offline .sf-stat-value { color: #475569; }

.sf-stat-active,
.sf-stat-quota {
  background-color: var(--sf-surface);
}

/* Icon wrappers for the statistic cards */
.sf-stat-icon-primary { background-color: #DBEAFE; color: #1D4ED8; }
.sf-stat-icon-live { background-color: #D1FAE5; color: #047857; }
.sf-stat-icon-scheduled { background-color: #FEF3C7; color: #B45309; }
.sf-stat-icon-offline { background-color: #E2E8F0; color: #475569; }

/* Icon wrappers for the secondary summary row */
.sf-tile-icon-active { background-color: #EDE9FE; color: #6D28D9; }
.sf-tile-icon-quota { background-color: #CFFAFE; color: #0E7490; }

/* --------------------------------------------------------------------------
   Status badges
   -------------------------------------------------------------------------- */
.sf-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.sf-status-live { background-color: var(--sf-live-bg); color: var(--sf-live); }
.sf-status-scheduled { background-color: var(--sf-scheduled-bg); color: var(--sf-scheduled); }
.sf-status-offline { background-color: var(--sf-offline-bg); color: var(--sf-offline); }
.sf-status-error { background-color: var(--sf-error-bg); color: var(--sf-error); }
.sf-status-starting { background-color: var(--sf-starting-bg); color: var(--sf-starting); }

/* --------------------------------------------------------------------------
   Buttons: one canonical size per context.
   -------------------------------------------------------------------------- */
.sf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--sf-radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.sf-btn-sm {
  height: 30px;
  padding: 0 10px;
  gap: 4px;
  font-size: 12px;
}

.sf-btn-primary { background: var(--primary-color); color: #fff; }
.sf-btn-primary:hover { background: var(--sf-primary-hover); }

.sf-btn-ghost {
  background: var(--sf-surface);
  color: var(--sf-text-body);
  border-color: var(--sf-input-border);
}
.sf-btn-ghost:hover { background: var(--sf-hover); }

.sf-btn-danger {
  background: var(--sf-error-bg);
  color: var(--sf-error);
  border-color: #FECACA;
}
.sf-btn-danger:hover { background: #FEE2E2; }

.sf-btn:disabled, .sf-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Inputs */
.sf-input {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface);
  border: 1px solid var(--sf-input-border);
  color: var(--sf-text-primary);
  font-size: 13px;
  width: 100%;
}

.sf-input::placeholder { color: var(--sf-text-faint); }

.sf-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.sf-search {
  height: 36px;
  width: 100%;
  padding: 0 12px 0 34px;
  border-radius: var(--sf-radius-sm);
  background: var(--sf-surface);
  border: 1px solid var(--sf-input-border);
  color: var(--sf-text-primary);
  font-size: 13px;
}

.sf-search::placeholder { color: var(--sf-text-faint); }

.sf-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ==========================================================================
   Modal frame standar: header/body/footer dengan flex, body scrollable.
   Pemakaian: overlay (fixed inset-0 modal-overlay) > wrapper flex > .sf-modal
   ========================================================================== */
.sf-modal {
  background: var(--sf-surface);
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  max-height: 90dvh; /* fallback modern; browser lama memakai 90vh di atas */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--sf-shadow-md);
}

.sf-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sf-line);
  background: var(--sf-surface);
}

.sf-modal__body {
  flex: 1 1 auto;
  min-height: 0;           /* kunci: izinkan flex child mengecil agar scroll bekerja */
  overflow-y: auto;        /* satu-satunya area scroll modal */
  overscroll-behavior-y: contain; /* cegah scroll berantai ke halaman */
  scroll-behavior: auto;   /* native, tanpa smooth scroll buatan */
  padding: 16px;
}

.sf-modal__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--sf-line);
  background: var(--sf-surface);
}

/* Body scroll lock saat modal terbuka */
body.sf-modal-open {
  overflow: hidden;
}

/* ==========================================================================
   Sidebar: ukuran dipertahankan (80px / 64px / ikon 20px / label 12px).
   Warna mengikuti tema terang: netral, aktif biru lembut.
   ========================================================================== */
.sidebar-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 64px;
  width: 64px;
  margin: 0 auto 12px;
  color: var(--sf-text-secondary);
  border-radius: 12px;
  transition: background-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.sidebar-icon i {
  font-size: 20px;
  line-height: 1;
}

.sidebar-icon span {
  font-size: 12px;
  line-height: 1.2;
  margin-top: 2px;
}

.sidebar-icon:hover {
  background-color: var(--sf-hover);
  color: var(--sf-text-primary);
}

.sidebar-icon.sidebar-active {
  background: var(--sf-primary-soft);
  color: var(--primary-color);
}

.sidebar-tooltip {
  position: absolute;
  padding: 4px 8px;
  left: 76px;
  border-radius: var(--sf-radius-sm);
  box-shadow: var(--sf-shadow-md);
  color: #FFFFFF;
  background-color: #1E293B;
  font-size: 12px;
  font-weight: 500;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0);
  transform-origin: left;
  pointer-events: none;
  white-space: nowrap;
  z-index: 60;
}

.sidebar-icon:hover .sidebar-tooltip {
  transform: scale(1);
}

/* Shared table rhythm and contained horizontal scrolling for Business views. */
.biz-page .sf-table {
  border-collapse: separate;
  border-spacing: 0;
  color: var(--sf-text-body);
  font-size: 14px;
}
.biz-page .sf-table thead { background-color: var(--sf-muted); }
.biz-page .sf-table th {
  padding: 12px 14px;
  color: var(--sf-text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.biz-page .sf-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--sf-line);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  vertical-align: middle;
}
.biz-page .sf-table tbody tr:hover { background-color: #F8FAFC; }
.biz-page .sf-table .biz-table-number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.biz-page .biz-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }

@media (prefers-reduced-motion: reduce) {
  .sf-card, .sf-btn, .sidebar-icon,
  .modal-overlay, .sf-modal, .sidebar-tooltip {
    transition: none;
  }
}

/* Spin Animation - Use Tailwind's built-in or define if needed */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ti.animate-spin {
  animation: spin 1s linear infinite !important;
  display: inline-block;
}

@media (max-width: 768px) {
  .modal-input {
    padding: 0.75rem;
    font-size: 16px;
  }
}

/* Bar tab Settings: satu baris, dapat digeser horizontal di mobile.
   Scrollbar disembunyikan agar tidak menambah tinggi dan tidak bentrok
   dengan scrollbar halaman. */
.settings-tabs {
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.settings-tabs::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.settings-tab {
  scroll-snap-align: start;
}
@media (max-width: 1023px) {
  .settings-tab {
    padding-left: 12px;
    padding-right: 12px;
  }
  .settings-tab i {
    font-size: 16px;
  }
}

/* Form polish: consistent Light Pastel focus, hover, disabled and autofill. */
.sf-input:hover:not(:disabled):not([readonly]),
.sf-search:hover:not(:disabled):not([readonly]) { border-color: #94A3B8; }
.sf-input:focus, .sf-input:focus-visible,
.sf-search:focus, .sf-search:focus-visible { background: #FFFFFF; }
.sf-input:disabled, .sf-search:disabled { background: #F1F5F9; color: #94A3B8; cursor: not-allowed; }
.sf-input[readonly], .sf-search[readonly] { background: #F1F5F9; color: #64748B; }

/* Utility-class inputs (login, modals) must not show the browser default
   focus outline; use one consistent ring instead. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible,
select:focus, select:focus-visible,
textarea:focus, textarea:focus-visible {
  outline: none;
  border-color: #2563EB;
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px #DBEAFE;
}

/* Keep a clear keyboard indicator on links and buttons. */
a:focus-visible, button:focus-visible { outline: 2px solid #2563EB; outline-offset: 2px; }

/* Uniform autofill colour across Chromium and Edge. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: #0F172A;
  box-shadow: 0 0 0 1000px #F8FAFC inset;
  transition: background-color 9999s ease-out 0s;
  caret-color: #0F172A;
}

/* ==========================================================================
   Sidebar desktop: struktur tiga bagian (brand / navigasi / profil).
   Hanya area navigasi yang boleh scroll, sehingga logo tetap di atas dan
   avatar tetap di bawah pada layar pendek (1024x768, 1280x720, 1366x768).
   Ukuran 80px / item 64px / ikon 20px / label 12px tidak berubah.
   ========================================================================== */
html {
  /* Ruang scrollbar dipesan permanen agar konten tidak bergeser ketika
     modal membuka scroll lock atau ketika scrollbar muncul/hilang. */
  scrollbar-gutter: stable;
}

.sf-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  /* 100vh membuat avatar bisa jatuh di bawah viewport mobile browser;
     dvh mengikuti tinggi viewport yang benar-benar terlihat. */
  max-height: 100dvh;
}

.sf-sidebar-brand,
.sf-sidebar-footer {
  flex: 0 0 auto;
}

.sf-sidebar-nav {
  /* Tanpa min-height: 0 item flex menolak menyusut di bawah tinggi konten
     dan footer terdorong keluar area sidebar yang overflow: hidden. */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.sf-sidebar-nav > .sidebar-icon {
  /* Menu tidak boleh menyusut saat jumlah menu melebihi tinggi layar;
     kelebihan item ditangani scroll di .sf-sidebar-nav. */
  flex: 0 0 auto;
}

/* ==========================================================================
   Rich text editor (legal documents). Pure CSS, no library.
   Without JS the .rte-value textarea stays visible and editable.
   ========================================================================== */
.rte {
  border: 1px solid var(--sf-line);
  border-radius: 8px;
  background: var(--sf-surface);
  overflow: hidden;
}

.rte:not(.rte--ready) .rte-toolbar,
.rte:not(.rte--ready) .rte-editor,
.rte:not(.rte--ready) .rte-source {
  display: none;
}

.rte.rte--ready .rte-value {
  display: none;
}

.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--sf-muted);
  border-bottom: 1px solid var(--sf-line);
}

.rte-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 6px;
  margin-right: 2px;
  border-right: 1px solid var(--sf-line);
}

.rte-group-end {
  margin-left: auto;
  border-right: 0;
}

.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--sf-text-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.rte-btn i {
  font-size: 16px;
  line-height: 1;
}

.rte-btn:hover {
  background: var(--sf-hover);
  color: var(--sf-text-primary);
  border-color: var(--sf-line);
}

.rte-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

.rte-mode-btn.active {
  background: var(--sf-primary-soft);
  color: var(--primary-color);
  border-color: var(--sf-primary-border);
}

.rte-editor {
  min-height: 400px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 18px 20px;
  color: var(--sf-text-body);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  outline: none;
  background: var(--sf-surface);
}

.rte-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.rte-editor h2,
.rte-editor h3,
.rte-editor h4 {
  color: var(--sf-text-primary);
  margin: 1.2em 0 0.5em;
  line-height: 1.25;
}

.rte-editor h2 { font-size: 1.5em; }
.rte-editor h3 { font-size: 1.25em; }
.rte-editor h4 { font-size: 1.1em; }

.rte-editor p { margin: 0 0 0.75em; }
.rte-editor ul,
.rte-editor ol { margin: 0 0 0.75em 1.4em; padding-left: 1.2em; }
.rte-editor a { color: var(--primary-color); text-decoration: underline; }
.rte-editor blockquote {
  margin: 0 0 0.75em;
  padding: 0.5em 1em;
  border-left: 3px solid var(--sf-line);
  color: var(--sf-text-secondary);
}
.rte-editor pre {
  margin: 0 0 0.75em;
  padding: 0.75em 1em;
  background: var(--sf-muted);
  border-radius: 6px;
  overflow-x: auto;
}
.rte-editor code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--sf-muted);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.rte-source {
  display: block;
  width: 100%;
  min-height: 400px;
  max-height: 70vh;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid var(--sf-line);
  background: var(--sf-surface);
  color: var(--sf-text-body);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.rte-fullscreen-open {
  overflow: hidden;
}

.rte--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: var(--sf-surface);
}

.rte--fullscreen .rte-editor,
.rte--fullscreen .rte-source {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

@media (max-width: 700px) {
  .rte-toolbar { padding: 4px; gap: 3px; }
  .rte-group { padding-right: 4px; margin-right: 1px; }
  .rte-btn { min-width: 28px; height: 28px; padding: 0 4px; }
  .rte-editor { min-height: 320px; padding: 14px; }
  .rte-source { min-height: 320px; }
}
