/**
 * Dedicated Operator Web Portal — CSS Foundation
 * Standard: Mobbin SaaS UI/UX (Linear, Supabase, Attio, Stripe)
 * Separation of Concerns: static/css/portal.css
 */

:root {
  --portal-slate-50: #f8fafc;
  --portal-slate-100: #f1f5f9;
  --portal-slate-200: #e2e8f0;
  --portal-slate-300: #cbd5e1;
  --portal-slate-400: #94a3b8;
  --portal-slate-500: #64748b;
  --portal-slate-600: #475569;
  --portal-slate-700: #334155;
  --portal-slate-800: #1e293b;
  --portal-slate-900: #0f172a;
  --portal-slate-950: #090d16;

  --portal-primary: #3b82f6;
  --portal-primary-hover: #2563eb;
  --portal-primary-soft: rgba(59, 130, 246, 0.08);
  --portal-primary-glow: rgba(59, 130, 246, 0.16);

  --portal-success: #10b981;
  --portal-success-soft: rgba(16, 185, 129, 0.1);
  --portal-warning: #f59e0b;
  --portal-warning-soft: rgba(245, 158, 11, 0.1);
  --portal-danger: #ef4444;
  --portal-danger-soft: rgba(239, 68, 68, 0.1);

  --portal-radius-sm: 6px;
  --portal-radius-md: 10px;
  --portal-radius-lg: 14px;
  --portal-radius-pill: 9999px;

  --portal-border-subtle: 1px solid rgba(0, 0, 0, 0.07);
  --portal-border-dark: 1px solid rgba(255, 255, 255, 0.08);
  --portal-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --portal-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --portal-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --portal-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --portal-shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

  --portal-transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --portal-sidebar-width: 232px;
}

/* Base Reset & Fonts */
* {
  box-sizing: border-box;
}

body.portal-body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--portal-slate-900);
  background-color: var(--portal-slate-50);
  font-size: 0.84rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   1. Master Layout: Sidebar + Main Content Area
   ========================================================================== */
.portal-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Enterprise Kompak (Pola Linear & Supabase) */
.portal-sidebar {
  width: var(--portal-sidebar-width);
  background-color: var(--portal-slate-950);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: var(--portal-border-dark);
  z-index: 100;
  transition: var(--portal-transition);
}

.portal-brand-header {
  padding: 1rem 1rem 0.85rem;
  display: flex;
  align-items: center;
  border-bottom: var(--portal-border-dark);
}

.portal-logo-badge {
  width: 32px;
  height: 32px;
  background-color: #ffffff;
  border-radius: 8px; /* Squircle */
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-right: 12px; /* Breathing space wajib 10-12px */
}

.portal-brand-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-brand-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.portal-brand-sub {
  font-size: 0.7rem;
  color: var(--portal-slate-400);
  white-space: nowrap;
}

.portal-nav-scroll {
  flex: 1;
  padding: 0.85rem 0.65rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.portal-section-heading {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--portal-slate-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.65rem 0.6rem 0.3rem;
  margin-top: 0.25rem;
}

.portal-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 0.65rem;
  color: var(--portal-slate-300);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  transition: var(--portal-transition);
  position: relative;
}

.portal-nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.portal-nav-item.active {
  background-color: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.portal-nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}
.portal-nav-item.active .portal-nav-icon {
  opacity: 1;
  color: var(--portal-primary);
}

.portal-nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--portal-radius-pill);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Pinned User Profile Footer (Sticky Bottom) */
.portal-user-footer {
  padding: 0.75rem 0.85rem;
  border-top: var(--portal-border-dark);
  background-color: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.portal-user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.portal-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--portal-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.portal-user-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-user-role {
  font-size: 0.68rem;
  color: var(--portal-slate-400);
}

.portal-logout-btn {
  background: transparent;
  border: none;
  color: var(--portal-slate-400);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  transition: var(--portal-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.portal-logout-btn:hover {
  color: var(--portal-danger);
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   2. Main Content Canvas & Header Bar
   ========================================================================== */
.portal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--portal-slate-50);
}

.portal-topbar {
  height: 52px;
  background-color: #ffffff;
  border-bottom: var(--portal-border-subtle);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--portal-shadow-xs);
}

.portal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--portal-slate-500);
}
.portal-breadcrumb .active-crumb {
  color: var(--portal-slate-900);
  font-weight: 600;
}

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

.portal-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--portal-radius-pill);
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.portal-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.portal-content {
  padding: 1.25rem;
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   3. Modern SaaS Density: 4 Kartu KPI Pipih & Surface Layering
   ========================================================================== */
.portal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 1024px) {
  .portal-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .portal-kpi-grid { grid-template-columns: 1fr; }
}

.portal-kpi-card {
  background: #ffffff;
  border: var(--portal-border-subtle);
  border-radius: var(--portal-radius-md);
  padding: 0.85rem 1.15rem;
  box-shadow: var(--portal-shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--portal-transition);
}
.portal-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--portal-shadow-sm);
}

.portal-kpi-label {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--portal-slate-500);
  margin-bottom: 0.25rem;
}
.portal-kpi-val {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--portal-slate-900);
  line-height: 1.2;
}
.portal-kpi-sub {
  font-size: 0.68rem;
  color: var(--portal-slate-400);
  margin-top: 0.2rem;
}

.portal-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px; /* Squircle */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.portal-kpi-icon.blue { background: rgba(59, 130, 246, 0.1); color: var(--portal-primary); }
.portal-kpi-icon.green { background: rgba(16, 185, 129, 0.1); color: #059669; }
.portal-kpi-icon.purple { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.portal-kpi-icon.amber { background: rgba(245, 158, 11, 0.1); color: #d97706; }

/* Elevated Cards */
.portal-card {
  background: #ffffff;
  border: var(--portal-border-subtle);
  border-radius: var(--portal-radius-md);
  box-shadow: var(--portal-shadow-xs);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.portal-card-header {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--portal-slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.portal-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--portal-slate-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.portal-card-subtitle {
  font-size: 0.75rem;
  color: var(--portal-slate-500);
  margin: 0.2rem 0 0 0;
}
.portal-card-body {
  padding: 1.15rem;
}

/* ==========================================================================
   4. Gaya A Universal Input System & Toolbar
   ========================================================================== */
.portal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.portal-search-box {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--portal-radius-sm);
  padding: 0 0.65rem;
  height: 36px;
  min-width: 260px;
  box-shadow: var(--portal-shadow-xs);
  transition: var(--portal-transition);
}
.portal-search-box:focus-within {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px var(--portal-primary-glow);
}
.portal-search-box input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-size: 0.82rem;
  color: var(--portal-slate-900);
  width: 100%;
}
.portal-search-box .search-icon {
  color: var(--portal-slate-400);
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
}
.portal-kbd {
  font-size: 0.68rem;
  background: var(--portal-slate-100);
  border: 1px solid var(--portal-slate-300);
  color: var(--portal-slate-500);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Buttons */
.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--portal-radius-sm);
  cursor: pointer;
  transition: var(--portal-transition);
  text-decoration: none;
  white-space: nowrap;
}
.portal-btn-primary {
  background: var(--portal-primary);
  color: #ffffff;
  border: 1px solid var(--portal-primary);
  box-shadow: var(--portal-shadow-xs);
}
.portal-btn-primary:hover:not(:disabled) {
  background: var(--portal-primary-hover);
  border-color: var(--portal-primary-hover);
  transform: translateY(-1px);
}
.portal-btn-secondary {
  background: #ffffff;
  color: var(--portal-slate-700);
  border: 1px solid var(--portal-slate-300);
}
.portal-btn-secondary:hover:not(:disabled) {
  background: var(--portal-slate-50);
  border-color: var(--portal-slate-400);
}
.portal-btn-danger {
  background: #ffffff;
  color: var(--portal-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.portal-btn-danger:hover:not(:disabled) {
  background: #fef2f2;
}

/* ==========================================================================
   5. Modern Data Table (Attio / Supabase Style)
   ========================================================================== */
.portal-table-container {
  overflow-x: auto;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}
.portal-table th {
  background: var(--portal-slate-50);
  color: var(--portal-slate-500);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--portal-slate-200);
  white-space: nowrap;
}
.portal-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--portal-slate-100);
  color: var(--portal-slate-700);
  vertical-align: middle;
  height: 42px;
}
.portal-table tbody tr {
  transition: var(--portal-transition);
}
.portal-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Soft Capsule / Pill Badges */
.portal-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--portal-radius-pill);
  line-height: 1.2;
}
.portal-pill.active {
  background: #ecfdf5;
  color: #059669;
}
.portal-pill.inactive {
  background: var(--portal-slate-100);
  color: var(--portal-slate-500);
}
.portal-pill.channel-web {
  background: #eff6ff;
  color: #2563eb;
}
.portal-pill.channel-wa {
  background: #f0fdf4;
  color: #16a34a;
}
.portal-pill.handoff {
  background: #fef3c7;
  color: #d97706;
}
.portal-pill.warning,
.portal-pill.warn {
  background: #fffbeb;
  color: #b45309;
}

/* ==========================================================================
   6. Custom Login Page (Pola Linear & Supabase)
   ========================================================================== */
.portal-login-canvas {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--portal-slate-50);
  padding: 1.5rem;
}
.portal-login-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: var(--portal-border-subtle);
  border-radius: var(--portal-radius-lg);
  box-shadow: var(--portal-shadow-float);
  padding: 2rem;
}
.portal-login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.portal-login-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--portal-slate-900);
  color: #ffffff;
  font-size: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  box-shadow: var(--portal-shadow-md);
}
.portal-login-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--portal-slate-900);
  margin: 0 0 0.35rem 0;
  letter-spacing: -0.01em;
}
.portal-login-subtitle {
  font-size: 0.8rem;
  color: var(--portal-slate-500);
  margin: 0;
}

.portal-field {
  margin-bottom: 1.15rem;
}
.portal-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--portal-slate-700);
  margin-bottom: 0.35rem;
}
.portal-input-group {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--portal-radius-sm);
  padding: 0 0.75rem;
  height: 38px;
  box-shadow: var(--portal-shadow-xs);
  transition: var(--portal-transition);
}
.portal-input-group:focus-within {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px var(--portal-primary-glow);
}
.portal-input-group input,
.portal-input-group select,
.portal-input-group textarea {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  width: 100%;
  font-size: 0.84rem;
  color: var(--portal-slate-900);
  padding: 0.45rem 0;
}
.portal-input-group .prefix-icon {
  color: var(--portal-slate-400);
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
}
.portal-toggle-pwd {
  background: transparent;
  border: none;
  color: var(--portal-slate-400);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
}
.portal-toggle-pwd:hover {
  color: var(--portal-slate-700);
}

.portal-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.65rem 0.85rem;
  border-radius: var(--portal-radius-sm);
  font-size: 0.78rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-alert-warning {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #92400e;
  padding: 0.75rem 1rem;
  border-radius: var(--portal-radius-sm);
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   7. Modal Dialog (Pola Attio / Linear)
   ========================================================================== */
.portal-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.portal-modal-backdrop.active {
  display: flex;
}
.portal-modal,
.portal-modal-dialog {
  background: #ffffff;
  border-radius: var(--portal-radius-lg);
  box-shadow: var(--portal-shadow-float);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  border: var(--portal-border-subtle);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.portal-modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--portal-slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--portal-slate-900);
  margin: 0;
}
.portal-modal-close {
  background: transparent;
  border: none;
  color: var(--portal-slate-400);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
}
.portal-modal-body {
  padding: 1.25rem;
}
.portal-modal-footer {
  padding: 0.85rem 1.25rem;
  background: var(--portal-slate-50);
  border-top: 1px solid var(--portal-slate-100);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ==========================================================================
   8. Floating Toast Notifications
   ========================================================================== */
.portal-toast-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.portal-toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--portal-slate-900);
  color: #ffffff;
  padding: 0.65rem 1rem;
  border-radius: var(--portal-radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--portal-shadow-float);
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.portal-toast.success { border-left: 3px solid var(--portal-success); }
.portal-toast.error { border-left: 3px solid var(--portal-danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   9. Chat Playground Quick Suggestion Chips (Mobbin Pattern)
   ========================================================================== */
.pt-quick-chips {
  padding: 0.6rem 1rem;
  background: #ffffff;
  border-top: 1px solid var(--portal-slate-100);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.pt-chips-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--portal-slate-500);
  flex-shrink: 0;
}

.pt-chips-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.pt-chips-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera, Edge Chromium */
}

.pt-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--portal-radius-pill);
  background: var(--portal-slate-50);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--portal-slate-700);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--portal-transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.pt-chip-btn:hover {
  background: #e2e8f0;
  color: var(--portal-slate-900);
  border-color: rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.pt-chip-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   10. Typing Indicator Dots Animation
   ========================================================================== */
.pt-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}

.pt-typing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--portal-primary);
  animation: pt-dot-bounce 1.3s infinite ease-in-out;
}

.pt-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.pt-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pt-dot-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ==========================================================================
   11. WhatsApp Quick Action Button (Pola Squircle Pastel Sesuai Gambar 2)
   ========================================================================== */
.portal-btn-wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  background-color: #dcfce7;
  color: #15803d !important;
  border: 1px solid #86efac;
  border-radius: 7px;
  text-decoration: none;
  transition: var(--portal-transition);
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.12);
  flex-shrink: 0;
}

.portal-btn-wa svg {
  width: 14px;
  height: 14px;
  display: block;
}

.portal-btn-wa:hover {
  background-color: #bbf7d0;
  border-color: #4ade80;
  color: #166534 !important;
  transform: scale(1.08);
  box-shadow: 0 2px 5px rgba(22, 163, 74, 0.22);
}

.portal-btn-wa:active {
  transform: scale(0.96);
}

.portal-btn-wa-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: #dcfce7;
  color: #15803d !important;
  border: 1px solid #86efac;
  border-radius: 6px;
  text-decoration: none;
  transition: var(--portal-transition);
}

.portal-btn-wa-pill:hover {
  background-color: #bbf7d0;
  border-color: #4ade80;
  color: #166534 !important;
  transform: scale(1.02);
}

.portal-btn-wa-pill:active {
  transform: scale(0.98);
}

/* ==========================================================================
   11b. Modern SaaS WhatsApp Manager Enhancements (Pola Supabase & Linear)
   ========================================================================== */
.portal-card-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--portal-slate-700);
  flex-shrink: 0;
}

.portal-card-icon-badge.emerald {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.portal-card-icon-badge.indigo {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
}

.portal-card-icon-badge.amber {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.portal-copy-box {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--portal-radius-sm);
  padding: 0 0.5rem 0 0.75rem;
  height: 38px;
  transition: var(--portal-transition);
}

.portal-copy-box:focus-within {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px var(--portal-primary-glow);
  background: #ffffff;
}

.portal-copy-box input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--portal-slate-800);
  width: 100%;
  padding: 0.45rem 0;
}

.portal-btn-inline-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 0.65rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--portal-slate-600);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--portal-transition);
  white-space: nowrap;
}

.portal-btn-inline-copy:hover {
  background: #f1f5f9;
  color: var(--portal-slate-900);
  border-color: #94a3b8;
}

.portal-btn-inline-copy:active {
  transform: scale(0.97);
}

.portal-meta-steps {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--portal-radius-sm);
  padding: 0.85rem 1rem;
}

.portal-meta-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.77rem;
  color: var(--portal-slate-600);
  line-height: 1.45;
}

.portal-meta-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #e2e8f0;
  color: var(--portal-slate-700);
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.portal-btn-send-wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 38px;
  font-weight: 600;
  font-size: 0.84rem;
  color: #ffffff;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border: 1px solid #1d4ed8;
  border-radius: var(--portal-radius-sm);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: var(--portal-transition);
}

.portal-btn-send-wa:hover:not(:disabled) {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.portal-btn-send-wa:active:not(:disabled) {
  transform: translateY(0);
}

.portal-btn-send-wa:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.portal-status-pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: portalPulse 2s infinite;
  margin-right: 5px;
}

@keyframes portalPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================================
   12. Onboarding-Style Form Components for Modals & Dialogs
   ========================================================================== */
.portal-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 768px) {
  .portal-grid-2col {
    grid-template-columns: 1fr;
  }
}

.portal-field-group {
  margin-bottom: 1rem;
}

.portal-label-req {
  color: var(--portal-danger);
  margin-left: 2px;
}

.portal-input-container {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--portal-radius-sm);
  padding: 0 0.75rem;
  transition: var(--portal-transition);
  box-shadow: var(--portal-shadow-xs);
  min-height: 38px;
}

.portal-input-container:focus-within {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px var(--portal-primary-glow);
  background-color: #ffffff;
}

.portal-prefix-icon {
  color: var(--portal-slate-400);
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
  user-select: none;
}

.portal-input-container input,
.portal-input-container select,
.portal-input-container textarea {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  width: 100%;
  color: var(--portal-slate-900);
  font-size: 0.84rem;
  padding: 0.45rem 0;
  font-family: inherit;
}

.portal-input-container input::placeholder,
.portal-input-container textarea::placeholder {
  color: var(--portal-slate-400);
}

.portal-help {
  font-size: 0.72rem;
  color: var(--portal-slate-500);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Tone of Voice Selector Cards */
.portal-tone-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
@media (max-width: 640px) {
  .portal-tone-selector {
    grid-template-columns: 1fr;
  }
}

.portal-tone-card {
  border: 1.5px solid var(--portal-slate-200);
  border-radius: var(--portal-radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  background: #ffffff;
  transition: var(--portal-transition);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.portal-tone-card:hover {
  border-color: var(--portal-slate-400);
  background: var(--portal-slate-50);
}

.portal-tone-card.selected {
  border-color: var(--portal-primary);
  background: rgba(59, 130, 246, 0.04);
  box-shadow: 0 0 0 1px var(--portal-primary), 0 2px 4px var(--portal-primary-glow);
}

.portal-tone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-tone-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--portal-slate-900);
}

.portal-tone-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--portal-radius-pill);
  background: #ecfdf5;
  color: #059669;
}

.portal-tone-desc {
  font-size: 0.76rem;
  color: var(--portal-slate-500);
  margin: 0;
  line-height: 1.4;
}

/* Brand Color Swatches */
.portal-color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.portal-swatches {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.portal-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--portal-slate-200);
  cursor: pointer;
  transition: var(--portal-transition);
}

.portal-swatch:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.portal-swatch.active {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--portal-primary);
  transform: scale(1.08);
}

.portal-color-custom {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.portal-color-custom input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.portal-color-custom input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.portal-color-custom input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--portal-slate-300);
  border-radius: 8px;
}

/* Chat Assistant Lightweight Markdown Formatting */
.chat-bubble-assistant .pt-msg-content strong {
  font-weight: 600;
  color: var(--portal-slate-900);
}

.chat-bubble-assistant .pt-msg-content em {
  font-style: italic;
}

/* Floating Action Toolbar (Pola Mobbin #4 - Batch Actions) */
.portal-floating-batch-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 1.15rem;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), 0 8px 10px -6px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.portal-floating-batch-bar.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.portal-batch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #f8fafc;
}

.portal-batch-pill .counter {
  background: #3b82f6;
  color: #ffffff;
  border-radius: 9999px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
}

.portal-batch-btn-cancel {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.portal-batch-btn-cancel:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.portal-batch-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.portal-batch-btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.portal-kb-checkbox {
  width: 13.5px;
  height: 13.5px;
  cursor: pointer;
  border-radius: 3.5px;
  accent-color: #2563eb;
  vertical-align: middle;
  margin: 0;
}

.portal-pill-duplicate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  white-space: nowrap;
}

.portal-row-duplicate {
  background: #fffdf5 !important;
}

.portal-btn-duplicates-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59e0b;
  color: #ffffff;
  border-radius: 9999px;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 6px;
}

/* ==========================================================================
   Modern Compact SaaS Icon Button (Pola Linear & Mobbin #11)
   ========================================================================== */
.portal-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--portal-slate-200);
  background: #ffffff;
  color: var(--portal-slate-600);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.portal-icon-btn:hover {
  background: var(--portal-slate-100);
  color: var(--portal-slate-900);
  border-color: var(--portal-slate-300);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.portal-icon-btn:active {
  transform: translateY(0);
}

.portal-icon-btn.is-active {
  color: #16a34a;
  background: #f0fdf4;
  border-color: rgba(22, 163, 74, 0.25);
}

.portal-icon-btn.is-active:hover {
  background: #dcfce7;
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.4);
}

.portal-icon-btn-danger:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: rgba(220, 38, 38, 0.3) !important;
}


