/* ===== Soft Dark Theme — Full Custom ===== */
/* Sesuai PLAN.md: abu-abu gelap hangat, aksen sage green, kontras rendah-sedang */

:root {
  --bg-main: #0F1115;
  --bg-sidebar: #161B22;
  --bg-card: #181C23;
  --bg-hover: #202632;
  --bg-input: #11141a;
  --border: #2B313C;
  --border-light: #374151;
  --text-main: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent: #3B82F6;
  --accent-hover: #60A5FA;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-blue: #3B82F6;
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 8px;
  --sidebar-w: 224px;
  --topbar-h: 64px;
  --font: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-logo {
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.logo-icon {
  font-size: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.logo-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.nav {
  padding: 14px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  padding: 14px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
}
.nav-section:first-child { padding-top: 4px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-item:hover .nav-icon { color: var(--text-main); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--accent); }
/* Modern blue active indicator bar */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-icon svg, .bn-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bn-icon svg { width: 20px; height: 20px; display: block; }
.nav-separator { height: 1px; background: var(--border); margin: 8px 4px; opacity: 0.6; }


.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

/* Sidebar footer: kuota upload harian + reset */
.sidebar-quota {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-input, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 10px;
}
.squota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.squota-name { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.2px; }
.squota-val  { font-size: 11px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.squota-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.squota-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.4s ease;
}
.squota-fill.warn   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.squota-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }
.squota-reset {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.4;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); }

/* Premium Logout Button */
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  margin-top: 12px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 12px;
  color: #f87171;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
  transform: translateY(-1px);
}
.btn-logout:active {
  transform: translateY(0);
}
.status-dot.offline { background: var(--error); }

/* ===== Main ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(15, 17, 21, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 8;
}
.topbar-title { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; }
.topbar h1 { font-size: 18px; font-weight: 700; white-space: nowrap; letter-spacing: -0.3px; line-height: 1.2; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-subtitle:empty { display: none; }
.topbar-actions { display: flex; gap: 10px; flex-shrink: 0; align-items: center; }

/* ===== Topbar menus (dropdown) ===== */
.tb-menu { position: relative; }
.tb-caret { opacity: 0.7; transition: transform 0.2s ease; }
.tb-menu [aria-expanded="true"] .tb-caret { transform: rotate(180deg); }

.tb-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}
.tb-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.tb-dropdown-wide { min-width: 320px; }
.tb-dropdown-right { min-width: 250px; }

.tb-dropdown-head {
  padding: 8px 10px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.tb-dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }

.tb-dropdown-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.14s ease;
  font-family: inherit;
}
.tb-dropdown-item:hover { background: var(--bg-hover); }
.tb-dropdown-item.danger { color: #f87171; }
.tb-dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.1); }
.tb-dd-ico {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border-radius: 9px;
  font-size: 16px;
}
.tb-dd-ico svg, .btn-icon-only svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-icon-only { overflow: visible; }
.topbar-btn-icon { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-tone-blue { color: #7d9cff; background: rgba(92,130,246,.14); }
.icon-tone-cyan { color: #65d7d8; background: rgba(48,190,193,.13); }
.icon-tone-amber { color: #f3bf65; background: rgba(243,191,101,.13); }
.icon-tone-violet { color: #c3a2ff; background: rgba(157,117,240,.13); }
.icon-tone-red { color: #fa8790; background: rgba(239,92,105,.13); }
.icon-btn-tone-blue { color: #91aaff; }
.icon-btn-tone-amber { color: #f3bf65; }
.tb-caret svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.action-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-icon-blue { color: #82a0ff; }
.action-icon-violet { color: #c09dff; }
.action-icon-green { color: #6ed7a0; }
.action-icon-gold { color: #e9b85d; }
.action-icon-white { color: #ffffff; }
.btn .action-icon { margin-left: -2px; }
.settings-action-compact {
  align-self: center;
  width: auto !important;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
  text-align: center;
}
.tb-dd-body { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tb-dd-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-dd-sub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* User button */
.tb-user-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 5px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.14s ease, border-color 0.14s ease;
  font-family: inherit;
}
.tb-user-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.tb-user-avatar {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.tb-user-avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.tb-user-info { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0; max-width: 130px; }
.tb-user-name { width: 100%; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user-role { font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; color: var(--text-muted); line-height: 1.2; }
.tb-user-head { display: flex; align-items: center; gap: 11px; padding: 8px 10px 10px; }
.tb-user-head-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.tb-user-email { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Notification */
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--error);
  border: 2px solid var(--bg-topbar, var(--bg-card));
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: badgePop 0.25s cubic-bezier(.34,1.56,.64,1) both;
}
.notif-badge:not([style*="display: none"]) { box-shadow: 0 0 0 3px rgba(217,101,101,.16); }
@media (prefers-reduced-motion: no-preference) {
  .notif-badge:not([style*="display: none"]) { animation: badgePop .25s cubic-bezier(.34,1.56,.64,1) both, notifPulse 1.8s ease-out infinite .3s; }
}
@keyframes badgePop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.notif-list { max-height: 300px; }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.14s ease;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item--new {
  background: rgba(99,102,241,0.07);
  border-left: 2px solid var(--primary);
  padding-left: 6px;
}
.notif-item--new:hover { background: rgba(99,102,241,0.12); }

.notif-ico {
  width: 30px; height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 14px;
  background: var(--bg-input);
}
.notif-ico.ok { background: rgba(34,197,94,0.12); }
.notif-ico.fail { background: rgba(239,68,68,0.12); }
.notif-ico.warn { background: rgba(245,158,11,0.12); }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 12.5px; color: var(--text-main); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px;
  max-width: 1400px;
  width: 100%;
}

/* ===== Buttons ===== */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: rgba(217, 101, 101, 0.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 5px 8px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-sm svg { width: 13px; height: 13px; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-title { font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.card-title svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-secondary); }

/* ===== Stat cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--border-light); }
.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   PREMIUM DASHBOARD (v2 redesign) — monitoring layout
   ============================================================ */

/* Greeting header */
.dash-greeting { margin-bottom: 26px; }
.dash-greeting h2 {
  font-family: var(--font);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text-main);
  line-height: 1.2;
}
.dash-greeting p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.dash-wave { display: inline-block; transform-origin: 70% 70%; animation: dash-wave 2.4s ease-in-out 1; }
@keyframes dash-wave {
  0%,60%,100% { transform: rotate(0deg); }
  10%,30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(-4deg); }
}

/* KPI grid — exactly 4 primary cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}
.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#userKpi .kpi-head 
.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-icon.blue   { background: rgba(59,130,246,0.12);  color: #60a5fa; }
.kpi-icon.green  { background: rgba(34,197,94,0.12);   color: #4ade80; }
.kpi-icon.orange { background: rgba(245,158,11,0.12);  color: #fbbf24; }
.kpi-icon.purple { background: rgba(168,85,247,0.12);  color: #c084fc; }
.kpi-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text-main);
  line-height: 1.05;
  font-family: var(--font);
}
.kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11.5px;
}
.kpi-trend.up   { color: var(--success); background: rgba(34,197,94,0.12); }
.kpi-trend.down { color: var(--error);   background: rgba(239,68,68,0.12); }
.kpi-trend.flat { color: var(--text-secondary); background: rgba(148,163,184,0.1); }
.kpi-trend svg { width: 12px; height: 12px; }

/* Dashboard section layouts */
.dash-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-row.split-2-1 { grid-template-columns: 1.9fr 1fr; }
.dash-row.split-1-1 { grid-template-columns: 1fr 1fr; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title svg { width: 16px; height: 16px; color: var(--text-secondary); }
.panel-sub { font-size: 12px; color: var(--text-muted); }

/* Weekly activity chart */
.chart-wrap { width: 100%; height: 220px; position: relative; }
.chart-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-area { fill: url(#chartGrad); opacity: 0.9; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--bg-card); stroke: var(--accent); stroke-width: 2.5; transition: r 0.15s ease; }
.chart-dot:hover { r: 6; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.5; }
.chart-label { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }

/* System health list */
.health-list { display: flex; flex-direction: column; gap: 2px; }
.health-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.health-item:last-child { border-bottom: none; }
.health-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.health-dot.ok   { background: var(--success); box-shadow: 0 0 0 0 rgba(34,197,94,0.5); animation: health-pulse 2s infinite; }
.health-dot.warn { background: var(--warning); }
.health-dot.down { background: var(--error); }
@keyframes health-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.45); }
  70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.health-name { font-size: 13.5px; color: var(--text-main); flex: 1; }
.health-status { font-size: 12px; font-weight: 500; }
.health-status.ok { color: var(--success); }
.health-status.warn { color: var(--warning); }
.health-status.down { color: var(--error); }

/* Task status monitoring grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.status-card:hover { transform: translateY(-2px); border-color: var(--border-light); }
.status-ring {
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.status-ring svg { width: 20px; height: 20px; }
.status-ring.running { background: rgba(245,158,11,0.12); color: #fbbf24; }
.status-ring.waiting { background: rgba(59,130,246,0.12); color: #60a5fa; }
.status-ring.success { background: rgba(34,197,94,0.12); color: #4ade80; }
.status-ring.failed  { background: rgba(239,68,68,0.12); color: #f87171; }
.status-info .status-num { font-size: 22px; font-weight: 700; color: var(--text-main); line-height: 1.1; letter-spacing: -0.5px; }
.status-info .status-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Quota progress cards */
.quota-list { display: flex; flex-direction: column; gap: 20px; }
.quota-row .quota-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.quota-name { font-size: 13.5px; font-weight: 500; color: var(--text-main); }
.quota-pct { font-size: 13px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; }
.quota-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
}
.quota-fill {
  height: 100%;
  border-radius: 6px;
  width: 0;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.quota-fill.blue  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.quota-fill.green { background: linear-gradient(90deg, #22c55e, #4ade80); }
.quota-fill.purple{ background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.quota-fill.orange{ background: linear-gradient(90deg, #f97316, #fb923c); }
.quota-fill.warn  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.quota-fill.danger{ background: linear-gradient(90deg, #ef4444, #f87171); }
.quota-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* Scrollable dashboard lists (custom scrollbar, konsisten design system) */
.dash-scroll { overflow-y: auto; overflow-x: hidden; }
.dash-scroll::-webkit-scrollbar { width: 6px; }
.dash-scroll::-webkit-scrollbar-track { background: transparent; }
.dash-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.dash-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.dash-scroll { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }
.recent-list.dash-scroll { max-height: 340px; }
.task-list.dash-scroll { max-height: 296px; padding-right: 4px; }
#channelStats.dash-scroll { max-height: 234px; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
#channelStats.dash-scroll::-webkit-scrollbar { width: 6px; }
#channelStats.dash-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ============================================================
   ASET — tabbed layout (redesign)
   ============================================================ */
.asset-panel { display: none; }
.asset-panel.active { display: block; }
.asset-retention-note {
  display: block;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.45;
}
.asset-preview-media {
  max-width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
  background: #000;
}
.asset-preview-video { max-height: 70vh; }
.asset-preview-image { max-height: 80vh; background: transparent; }
.asset-preview-audio { width: 100%; }
.asset-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.asset-panel-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.asset-panel-name { font-size: 15px; font-weight: 700; color: var(--text-main); }
.asset-panel-desc { font-size: 12.5px; color: var(--text-muted); }
.asset-panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.asset-body { padding: 12px 14px; }
.asset-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.asset-list::-webkit-scrollbar { width: 6px; }
.asset-list::-webkit-scrollbar-track { background: transparent; }
.asset-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.asset-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
@media (max-width: 640px) {
  .asset-panel-head { padding: 14px; }
  .asset-panel-actions { width: 100%; }
  .asset-panel-actions .btn-primary { margin-left: auto; }
}

/* ============================================================
   SCHEDULE — redesign
   ============================================================ */
.sched-manual-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 14px;
  align-items: end;
}
.sched-manual-grid .form-group { margin: 0; }
.sched-manual-btn .btn { width: 100%; white-space: nowrap; }
.sched-smart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 22px;
}
.sched-config { display: flex; flex-direction: column; gap: 14px; }
.sched-config .form-group { margin: 0; }
.sched-preview { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 860px) {
  .sched-manual-grid { grid-template-columns: 1fr; }
  .sched-smart-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SETTINGS — redesign (masonry-ish auto grid)
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-grid > .card { margin: 0; }
.settings-grid > .card[style*="1/-1"] { grid-column: 1 / -1; }
.settings-channel-list {
  max-height: 224px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.settings-channel-list::-webkit-scrollbar { width: 6px; }
.settings-channel-list::-webkit-scrollbar-track { background: transparent; }
.settings-channel-list::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.settings-channel-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Preset manager */
.preset-manager {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
}
.preset-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.preset-manager-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.preset-manager-row .select { flex: 1; min-width: 140px; }
.preset-list { margin-top: 10px; display: flex; flex-direction: column; }
@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; gap: 14px; }
  .preset-manager-row .select { min-width: 0; width: 100%; flex-basis: 100%; }
}

/* Recent activity list (dashboard) */
.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-ico {
  width: 30px; height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.recent-ico svg { width: 15px; height: 15px; }
.recent-ico.ok   { background: rgba(34,197,94,0.12); color: #4ade80; }
.recent-ico.fail { background: rgba(239,68,68,0.12); color: #f87171; }
.recent-ico.wait { background: rgba(245,158,11,0.12); color: #fbbf24; }
.recent-ico.warn { background: rgba(245,158,11,0.12); color: #fbbf24; }
.recent-body { flex: 1; min-width: 0; }
.recent-text {
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.recent-time { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; }

/* Per-channel stats (dashboard) */
.channel-stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.channel-stat-item:last-child { border-bottom: none; }
.channel-stat-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.channel-stat-body { flex: 1; min-width: 0; }
.channel-stat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.channel-stat-name { font-size: 13px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-stat-rate { font-size: 12px; font-weight: 700; flex-shrink: 0; }
.channel-stat-rate.green { color: #4ade80; }
.channel-stat-rate.warn { color: #fbbf24; }
.channel-stat-rate.danger { color: #f87171; }
.channel-stat-meta { display: flex; gap: 12px; font-size: 11.5px; }

/* Skeleton loading */
.skel {
  background: linear-gradient(90deg, var(--bg-hover) 25%, rgba(255,255,255,0.04) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
}
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Fade-in on render */
.dash-fade { animation: dash-fade 0.4s ease both; }
@keyframes dash-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Responsive dashboard */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row.split-2-1, .dash-row.split-1-1 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-greeting h2 { font-size: 21px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 26px; }
  .status-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .panel { padding: 15px; }
  .chart-wrap { height: 180px; }
}

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.input-mono { font-family: var(--font-mono); }

/* Custom select arrow */
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b919d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}
.select option {
  background: var(--bg-card);
  color: var(--text-main);
  padding: 8px 12px;
}
.select:focus {
  border-color: var(--accent);
  background-color: var(--bg-hover);
}
.select:hover {
  border-color: var(--border-light);
}

/* ===== Task list ===== */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.task-item .checkbox-custom {
  align-self: center;
  flex-shrink: 0;
}
/* Auto gap: task-item langsung setelah task-item tanpa .task-list wrapper */
.task-item + .task-item { margin-top: 8px; }
/* Card body yang hanya berisi task-items juga dapat gap */
.card-body > .task-item + .task-item,
#channelList > .task-item + .task-item,
#apiKeyList > .task-item + .task-item { margin-top: 8px; }
.task-item:hover { border-color: var(--border-light); background: var(--bg-hover); }
.task-info { flex: 1; min-width: 0; overflow: hidden; }
.task-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.task-meta > span { white-space: nowrap; }
.task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Badge "sedang diproses" — pengganti tombol Edit saat task masih berjalan */
.task-processing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  background: rgba(232, 184, 74, 0.12);
  border: 1px solid rgba(232, 184, 74, 0.22);
  white-space: nowrap;
}
.task-processing-badge svg { width: 14px; height: 14px; }
.ic-spin { animation: ic-spin 0.9s linear infinite; transform-origin: center; }
@keyframes ic-spin { to { transform: rotate(360deg); } }

/* Status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-pending { background: rgba(139, 145, 157, 0.15); color: var(--text-secondary); }
.badge-queued { background: rgba(91, 143, 217, 0.15); color: var(--accent-blue); }
.badge-rendering, .badge-uploading { background: rgba(232, 184, 74, 0.15); color: var(--warning); }
.badge-completed { background: rgba(92, 184, 122, 0.15); color: var(--success); }
.badge-failed, .badge-render_failed { background: rgba(217, 101, 101, 0.15); color: var(--error); }
.badge-scheduled { background: rgba(108, 192, 160, 0.15); color: var(--accent); }

/* Progress bar */
.progress-bar {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
  width: 100%;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}
.progress-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== Lyrics Video ===== */
.lyrics-grid { display:grid; grid-template-columns:minmax(0, 1.15fr) minmax(300px, .85fr); gap:16px; align-items:start; }
.lyrics-card { min-width:0; }
.lyrics-card .card-title > span { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; margin-right:8px; border-radius:50%; background:var(--bg-hover); color:var(--accent); font-family:var(--font-mono); font-size:10px; }
.lyrics-card-body { padding:18px; }
.lyrics-drop { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; min-height:142px; padding:24px 18px; border:1px dashed var(--border-light); border-radius:var(--radius-sm); background:var(--bg-input); color:var(--text-secondary); cursor:pointer; text-align:center; transition:border-color .15s, background .15s; }
.lyrics-drop:hover, .lyrics-drop.dragging { border-color:var(--accent); background:var(--bg-hover); }
.lyrics-drop:focus-within { border-color:var(--accent); box-shadow:0 0 0 2px rgba(91, 143, 217, .18); }
.lyrics-drop strong { color:var(--text-main); font-size:13px; font-weight:600; }
.lyrics-drop span, .lyrics-drop small { font-size:12px; }.lyrics-drop small { color:var(--text-muted); margin-top:4px; }
.lyrics-action-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.lyrics-preview { max-height:298px; overflow:auto; padding:12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg-input); color:var(--text-secondary); font-size:13px; line-height:1.6; }
.lyrics-preview strong { display:block; margin-bottom:8px; color:var(--text-main); font-weight:600; }.lyrics-preview div { display:grid; grid-template-columns:64px minmax(0, 1fr); gap:8px; padding:2px 0; }.lyrics-preview span { color:var(--text-muted); font-family:var(--font-mono); font-size:11px; }
.lyrics-range { width:100%; accent-color:var(--accent); cursor:pointer; }.form-hint { margin-top:6px; color:var(--text-muted); font-size:11px; line-height:1.45; }
.lyrics-mode { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px; }.lyrics-mode .seg-tab { display:flex; flex-direction:column; gap:2px; min-height:54px; padding:8px 10px; text-align:left; white-space:normal; }.lyrics-mode .seg-tab strong { font-size:12px; font-weight:600; }.lyrics-mode .seg-tab span { color:var(--text-muted); font-family:var(--font-mono); font-size:10px; }.lyrics-mode .seg-tab.active span { color:inherit; opacity:.72; }.lyrics-submit { width:100%; justify-content:center; }.lyrics-monitor { margin-top:16px; padding:12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg-input); }.lyrics-monitor-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; }.lyrics-monitor-meta .progress-text { margin-top:7px; }.lyrics-elapsed { margin-top:7px; color:var(--text-muted); font-family:var(--font-mono); font-size:11px; white-space:nowrap; }.lyrics-log { max-height:180px; overflow:auto; margin:10px 0; color:var(--text-secondary); font-family:var(--font-mono); font-size:11px; line-height:1.55; white-space:pre-wrap; }.lyrics-preview-video { display:block; width:100%; max-height:280px; margin:0 0 12px; border-radius:var(--radius-sm); background:#000; }.lyrics-history-card { margin-top:16px; }.lyrics-history-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }.lyrics-history-item:last-child { border-bottom:0; }
@media (max-width: 760px) { .lyrics-grid { grid-template-columns:1fr; }.lyrics-card-body { padding:14px; }.lyrics-mode { gap:6px; } }

/* ===== Activity feed ===== */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 0;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 14px; flex-shrink: 0; }
.activity-text {
  flex: 1;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-time { color: var(--text-muted); font-size: 12px; flex-shrink: 0; white-space: nowrap; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal-large { max-width: 800px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text-main); }
.modal-close:focus-visible, .btn:focus-visible, .nav-item:focus-visible, .bottom-nav-item:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}
@keyframes notifPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,101,101,.38); }
  55% { box-shadow: 0 0 0 6px rgba(217,101,101,0); }
}
.modal-body { display: flex; flex-direction: column; gap: 0; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ===== Toast ===== */
#toastRoot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
  word-break: break-word;
  position: relative;
  overflow: hidden;
}
.toast::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  animation: toastBar 4.5s linear forwards;
  opacity: 0.4;
}
.toast.error { border-left-color: var(--error); }
.toast.error::after { background: var(--error); }
.toast.success { border-left-color: var(--success); }
.toast.success::after { background: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning::after { background: var(--warning); }
.toast-icon { font-size: 14px; flex-shrink: 0; line-height: 1.4; }
.toast-icon svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.toast-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toast-text { flex: 1; line-height: 1.4; padding-top: 1px; }
.toast-en { font-size: 11.5px; color: var(--text-muted); opacity: 0.85; line-height: 1.35; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text-main); }
.toast-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateX(100%); opacity: 0; } }
@keyframes toastBar { from { width: 100%; } to { width: 0%; } }

/* Confirm/prompt dialog message */
.confirm-message {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
}

/* ===== Drag & drop zone ===== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-main);
}
.dropzone-icon { font-size: 36px; margin-bottom: 10px; }

/* ===== Radio & checkbox ===== */
.radio-group, .check-group { display: flex; flex-direction: column; gap: 8px; }
.radio-item, .check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  flex-wrap: wrap;
}
.radio-item:hover, .check-item:hover { background: var(--bg-hover); }
.radio-item.selected, .check-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.radio-item input, .check-item input { accent-color: var(--accent); flex-shrink: 0; }

/* ===== Table ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.table th { color: var(--text-secondary); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:hover td { background: var(--bg-hover); }

/* ===== Grid helpers ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.5; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Range slider */
input[type="range"], input.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  margin-top: 14px;
}
input[type="range"]::-webkit-slider-thumb, input.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-main);
}
input[type="range"]::-moz-range-thumb, input.range-input::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-main);
}
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="number"] {
  font-family: inherit;
  color-scheme: dark;
}
/* Ikon kalender/jam agar mengikuti tema gelap + seluruh box bisa diklik */
input[type="date"], input[type="time"], input[type="datetime-local"] {
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(2);
  opacity: 0.9;
  cursor: pointer;
  transition: opacity 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Flowra product system: cool surfaces, restrained blue accent, clear focus. */
:root {
  --bg-main: #0b1018;
  --bg-sidebar: #101722;
  --bg-card: #131c29;
  --bg-hover: #192538;
  --bg-input: #0d141e;
  --border: #223044;
  --border-light: #3a4d68;
  --text-main: #f3f6fb;
  --text-secondary: #a6b2c4;
  --text-muted: #77869d;
  --accent: #5c82f6;
  --accent-hover: #7d9cff;
  --accent-soft: rgba(92, 130, 246, .13);
  --shadow: 0 12px 30px rgba(5, 10, 18, .24);
  --shadow-lg: 0 22px 58px rgba(5, 10, 18, .48);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 240px;
  --topbar-h: 68px;
}

html { color-scheme: dark; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
}
.sidebar { background: linear-gradient(180deg, #111a27 0%, var(--bg-sidebar) 100%); }
.sidebar-logo { height: var(--topbar-h); padding: 0 22px; }
.nav { padding: 18px 14px; gap: 3px; }
.nav-section { padding: 17px 12px 7px; color: var(--text-muted); }
.nav-item { min-height: 42px; border-radius: 9px; }
.nav-item.active { box-shadow: inset 2px 0 var(--accent); }
.nav-item.active::before { display: none; }
.topbar { height: var(--topbar-h); padding: 0 32px; background: rgba(11,16,24,.86); }
.topbar h1 { font-size: 19px; letter-spacing: -.45px; }
.topbar-actions { gap: 8px; }
.content { padding: 30px 32px 44px; max-width: 1480px; }
.btn { min-height: 40px; padding: 9px 15px; border-radius: 9px; }
.btn-primary { box-shadow: 0 8px 20px rgba(92,130,246,.2); }
.btn:active { transform: translateY(1px); }
.btn-icon-only { min-width: 40px; min-height: 40px; }
.tb-user-btn { min-height: 42px; }
.card, .panel, .stat-card, .kpi-card, .status-card, .data-panel {
  border-color: var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,.02);
}
.panel, .card { padding: 22px; }
.page-head { margin-bottom: 28px; }
.page-head h2 { font-size: 25px; letter-spacing: -.7px; }
.page-head p { color: var(--text-secondary); max-width: 68ch; }
.toolbar { margin-bottom: 20px; }
.seg-tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tab { min-height: 38px; }
.data-table thead th { background: rgba(255,255,255,.018); }
.data-table tbody tr:hover td { background: rgba(92,130,246,.055); }
.input, .select, .textarea, .custom-select-trigger { min-height: 42px; border-color: var(--border); }
.input:focus, .select:focus, .textarea:focus, .custom-select-trigger:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.empty-state, .empty-premium { min-height: 160px; display: grid; place-content: center; justify-items: center; gap: 6px; }
.empty-icon, .empty-premium .empty-ic { margin-bottom: 5px; }
.progress-bar, .quota-track, .squota-track { background: #202d40; }
.task-item { border-color: var(--border); }
.task-item:hover { border-color: var(--border-light); background: rgba(25,37,56,.55); }
.modal-overlay { background: rgba(4,8,14,.74); backdrop-filter: blur(4px); }
.modal { box-shadow: var(--shadow-lg); }
#toastRoot { bottom: 24px; right: 24px; }

@media (max-width: 900px) {
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px 40px; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  .topbar { height: var(--topbar-h); }
  .content { padding: 18px 14px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .topbar h1 { font-size: 16px; }
  .topbar-subtitle { display: none; }
  .panel, .card { padding: 16px; }
  .page-head h2 { font-size: 22px; }
  .page-head-actions, .page-head-actions .btn { width: 100%; }
  .page-head-actions .btn { justify-content: center; }
  .btn, .btn-sm { min-height: 40px; }
  .tb-user-btn, .btn-icon-only { min-height: 38px; }
  #toastRoot { left: 14px; right: 14px; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); max-width: none; }
  .topbar-title, .topbar-actions, .page-head-text, .page-head-actions, .card, .panel, .task-info, .task-actions { min-width: 0; max-width: 100%; }
  .topbar h1 { overflow: hidden; text-overflow: ellipsis; }
  .page-head p, .panel-desc, .task-name, .task-meta, .recent-text, .recent-sub, .activity-text, .channel-stat-name { overflow-wrap: anywhere; word-break: normal; }
  .task-meta > span, .activity-time, .recent-time { white-space: normal; }
  .task-actions { overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; }
  .task-actions .btn { flex: 0 0 auto; }
  .btn { font-size: 12px; padding: 8px 12px; }
  .btn-sm { font-size: 11px; padding: 7px 10px; }
  .tb-dropdown-item { min-width: 0; }
  .tb-dd-body, .tb-dd-title, .tb-dd-sub { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .tb-user-btn { max-width: 42px; }
}

/* The mobile drawer is available alongside the compact bottom navigation. */
@media (max-width: 640px) {
  .sidebar {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 280px);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .2s ease;
    z-index: 20;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: inline-flex !important; }
  .sidebar-overlay.open { z-index: 19; }
}

/* ===== Placeholder chip — clickable copy button ===== */
.placeholder-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.placeholder-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}
.placeholder-chip:active {
  transform: scale(0.95);
}
.placeholder-chip::before {
  content: '⎘';
  font-size: 10px;
  opacity: 0.6;
}

/* Placeholder grid layout */
.placeholder-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: center;
  margin-top: 10px;
}
.placeholder-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Hamburger Button (mobile only) ===== */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
}
.mobile-menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-main);
}
.mobile-menu-btn svg {
  display: block;
  flex-shrink: 0;
}

/* ===== Sidebar Overlay (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 9;
  transition: background 0.28s ease;
  pointer-events: none;
}
.sidebar-overlay.open {
  display: block;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  backdrop-filter: blur(1px);
}

/* ===== Responsive — Tablet (≤900px) ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .content { padding: 18px 20px; }
  .topbar { padding: 0 20px; }
  .card { padding: 16px; }
}

/* ===== Responsive — Mobile (≤640px) ===== */
@media (max-width: 640px) {
  /* ============================================================
     LAYOUT UTAMA
     ============================================================ */

  /* Layout: kolom tunggal, konten penuh */
  #app {
    height: 100dvh;
    flex-direction: column;
  }

  .main {
    height: 100%;
    overflow: hidden;
  }

  /* Content — padding aman, tambah ruang bawah untuk bottom nav */
  .content {
    padding: 12px 14px calc(60px + env(safe-area-inset-bottom, 0px) + 30px) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    max-width: 100%;
  }

  /* ============================================================
     TOP BAR — lebih compact
     ============================================================ */
  .topbar {
    height: 46px;
    padding: 0 10px;
    gap: 6px;
    flex-shrink: 0;
  }
  .topbar h1 {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  /* Tombol topbar — lebih kecil dan compact */
  .topbar-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
    gap: 4px;
  }
  /* Mobile: sembunyikan detail user, cukup avatar + dropdown lebar penuh */
  .tb-user-info { display: none; }
  .tb-user-btn { padding: 4px; }
  .tb-dropdown { position: fixed; left: 12px; right: 12px; top: 56px; min-width: 0; max-width: calc(100vw - 24px); }
  .tb-dropdown-wide, .tb-dropdown-right { min-width: 0; }

  /* ============================================================
     BOTTOM NAVIGATION BAR
     ============================================================ */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    padding: 6px 4px;
    transition: color 0.15s;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item .bn-icon {
    font-size: 19px;
    line-height: 1;
  }
  .bottom-nav-item span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .bottom-nav-item:hover,
  .bottom-nav-item.active {
    color: var(--accent);
  }

  /* ============================================================
     CARDS
     ============================================================ */
  .card {
    padding: 10px;
    border-radius: 8px;
  }
  .card-header {
    gap: 6px;
    margin-bottom: 10px;
  }
  .card-title { font-size: 13px; }

  /* ============================================================
     STAT CARDS
     ============================================================ */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }
  .stat-card {
    padding: 10px 12px;
    border-radius: 8px;
  }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .stat-sub { font-size: 10px; }

  /* ============================================================
     LAYOUT GRIDS
     ============================================================ */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* ============================================================
     TASK ITEMS
     ============================================================ */
  .task-item {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 10px;
    align-items: flex-start;
  }
  .task-info {
    flex: 1;
    min-width: 0;
  }
  .task-name {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .task-meta {
    font-size: 9.5px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    align-items: center;
  }
  .task-meta .task-date {
    display: none !important;
  }
  /* Actions pindah ke bawah, full-width */
  .task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
  }
  /* Task item wrap saat ada action bawah */
  .task-item:has(.task-actions) {
    flex-wrap: wrap;
  }
  .task-actions .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 40px;
  }
  .task-thumb { width: 44px; height: 33px; }

  /* ============================================================
     BUTTONS — touch targets
     ============================================================ */
  .btn {
    min-height: 40px;
    font-size: 12px;
    padding: 8px 12px;
  }
  .btn-sm {
    min-height: 36px;
    font-size: 11px;
    padding: 6px 9px;
  }

  /* ============================================================
     FORMS — compact
     ============================================================ */
  .form-group { margin-bottom: 8px; }
  .input, .select, .textarea {
    font-size: 12px;
    padding: 8px 10px;
    min-height: 40px;
  }
  .form-label { font-size: 10px; margin-bottom: 3px; }

  /* ============================================================
     MODAL — Centered Pop-up style
     ============================================================ */
  .modal-overlay {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }
  .modal {
    border-radius: 12px;
    max-height: 85dvh;
    max-width: 500px !important;
    width: 100%;
    padding: 20px 16px;
    position: relative;
    animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
  }
  /* Remove swipe bar indicator as it is no longer a bottom sheet */
  .modal::before {
    display: none;
  }
  .modal-header {
    margin-top: 0;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .modal-title { font-size: 15px; }
  .modal-body { font-size: 13px; }
  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
  }
  .modal-footer .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }

  /* ============================================================
     QUOTA TABLE — horizontal scroll
     ============================================================ */
  .quota-table {
    font-size: 10.5px;
    min-width: 350px;
  }
  .quota-table th {
    font-size: 9.5px;
    padding: 6px 8px;
  }
  .quota-table td {
    padding: 6px 8px;
  }
  .quota-table .ql-sub td {
    font-size: 9.5px;
  }

  /* ============================================================
     SETTINGS — compact
     ============================================================ */
  /* Footer preview di settings */
  #footerPreview {
    font-size: 11px !important;
    padding: 10px 8px !important;
  }

  /* ============================================================
     PLACEHOLDER GRID (template modal)
     ============================================================ */
  .placeholder-grid {
    grid-template-columns: 1fr;
    gap: 4px 8px;
  }
  .placeholder-desc { display: none; }

  /* ============================================================
     TOPBAR: hamburger button disembunyikan di mobile
     ============================================================ */
  .mobile-menu-btn {
    display: none !important;
  }

  /* Sembunyikan text label pada tombol topbar di layar ≤420px */
  .topbar-btn-label,
  .topbar-lang-label {
    display: none;
  }
  .topbar-actions .btn {
    padding: 6px 8px !important;
    min-width: 32px;
    justify-content: center;
  }

  /* ============================================================
     FILTER / FLEX WRAP
     ============================================================ */
  .flex-between { flex-wrap: wrap; gap: 8px; }
  .flex-wrap { flex-wrap: wrap; gap: 6px; }

  /* ============================================================
     SCROLLBAR tipis
     ============================================================ */
  ::-webkit-scrollbar { width: 3px; height: 3px; }

  /* ============================================================
     TOAST — full width di bawah
     ============================================================ */
  #toastRoot {
    bottom: 68px !important; /* di atas bottom nav */
    right: 10px !important;
    left: 10px !important;
  }
  .toast {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }

  /* ============================================================
     AI result card di metadata
     ============================================================ */
  #aiResult .card {
    padding: 12px;
  }
}

/* Extra small (≤380px) — iPhone SE, small android */
@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar-actions .btn { padding: 5px 8px; font-size: 11px; }
  .card { padding: 12px 10px; }
  .bottom-nav-item span:last-child { display: none; } /* hanya ikon */
  .bottom-nav { height: 52px; }
  .content { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px) + 24px) !important; }
}

/* Billing plan cards — pastikan full-width di mobile */
@media (max-width: 640px) {
  /* Plan cards di billing: tampilkan sebagai column, tiap card full width */
  div[style*="scroll-snap-type"] > .card,
  div[style*="scroll-snap-type"] > div[style*="scroll-snap-align"] {
    min-width: calc(85vw - 32px) !important;
    flex: 0 0 calc(85vw - 32px) !important;
  }
}

/* Mobile polish for dashboard/app pages. Desktop rules stay untouched above 640px. */
@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body { font-size: 13px; }
  * { min-width: 0; }

  #app,
  .main,
  .content,
  #view {
    max-width: 100%;
    overflow-x: hidden;
  }

  .content {
    padding: 14px 12px calc(60px + env(safe-area-inset-bottom, 0px) + 26px) !important;
  }

  .topbar {
    height: 50px;
    padding: 0 12px;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 15px;
    line-height: 1.2;
  }

  .topbar-actions { gap: 5px; }
  .topbar-actions .btn {
    min-width: 34px;
    min-height: 34px;
    padding: 7px 9px !important;
    border-radius: 10px;
    font-size: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .card-header {
    gap: 8px;
    margin-bottom: 12px;
    align-items: flex-start;
  }

  .card-title {
    font-size: 14px;
    line-height: 1.35;
  }

  .dash-greeting { margin-bottom: 18px; }
  .dash-greeting h2 {
    font-size: 20px;
    line-height: 1.25;
  }
  .dash-greeting p {
    font-size: 12.5px;
    line-height: 1.5;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 13px;
    border-radius: 13px;
  }

  .kpi-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .kpi-label {
    font-size: 11.5px;
    line-height: 1.35;
  }

  .kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .kpi-value {
    font-size: 25px;
    letter-spacing: -0.5px;
  }

  .kpi-foot {
    font-size: 11px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .dash-row {
    gap: 12px;
    margin-bottom: 12px;
  }

  .panel {
    padding: 14px;
    border-radius: 13px;
  }

  .panel-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
  }

  .panel-title {
    font-size: 13.5px;
    line-height: 1.35;
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .status-card {
    padding: 12px;
    gap: 10px;
    align-items: center;
  }

  .status-ring {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .status-info .status-num { font-size: 19px; }
  .status-info .status-lbl { font-size: 11px; }

  .recent-item,
  .health-item,
  .channel-stat-item {
    gap: 9px;
    padding: 10px 0;
  }

  .recent-text,
  .channel-stat-name,
  .health-name { font-size: 12.5px; }

  .recent-time,
  .recent-sub,
  .channel-stat-meta,
  .health-status { font-size: 10.5px; }

  .quota-list { gap: 14px; }
  .quota-name,
  .quota-pct { font-size: 12px; }
  .quota-meta { font-size: 10.5px; }

  .btn {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
  }

  .btn-sm {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 11.5px;
  }

  .task-item {
    flex-wrap: wrap;
    padding: 10px;
  }

  .task-name { font-size: 12.5px; }
  .task-meta { font-size: 10.5px; }

  .task-actions {
    justify-content: stretch;
  }

  .task-actions .btn-sm {
    flex: 1 1 calc(50% - 4px);
    min-height: 32px;
    padding: 7px 9px;
    font-size: 11.5px;
  }

  .form-group { margin-bottom: 10px; }
  .input,
  .select,
  .textarea {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .form-label {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .page-head {
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-head h2 {
    font-size: 18px;
    line-height: 1.25;
  }

  .page-head h2 svg {
    width: 19px;
    height: 19px;
  }

  .page-head p {
    font-size: 12.5px;
    line-height: 1.5;
  }

  .page-head-actions {
    width: 100%;
    gap: 8px;
  }

  .page-head-actions .btn { flex: 1 1 auto; }

  .flex-between,
  .flex-wrap,
  .toolbar {
    gap: 8px;
  }

  .flex-between > *,
  .flex-wrap > *,
  .toolbar > * {
    max-width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar .btn,
  .toolbar .select,
  .toolbar .custom-select-container {
    flex: 1 1 auto;
  }

  .asset-panel-head { gap: 10px; }
  .asset-panel-actions {
    gap: 8px;
    align-items: stretch;
  }
  .asset-panel-actions .btn { flex: 1 1 auto; }

  .tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .media-tile .tile-del { opacity: 1; }
  .media-tile .tile-body { padding: 8px; }
  .media-tile .tile-name { font-size: 11.5px; }
}

@media (max-width: 380px) {
  .kpi-grid,
  .status-grid,
  .tile-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ===== Quota table ===== */
.quota-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.quota-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.quota-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.quota-table tbody tr:last-child td { border-bottom: none; }
.quota-table tbody tr:hover td { background: var(--bg-hover); }
.quota-table tr.ql-main td { font-weight: 500; }
.quota-table .ql-sub td {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 4px;
  padding-bottom: 4px;
}
.quota-table .ql-sub:hover td { background: transparent; }
.quota-table th:not(:first-child), .quota-table td:not(:first-child) { text-align: center; }

/* ===== Task thumbnail ===== */
.task-thumb {
  width: 48px; height: 36px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  align-self: center;
  background: var(--bg-input);
}
.task-icon {
  width: 48px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  align-self: center;
  border-radius: 6px;
  background: var(--bg-input);
  text-align: center;
}

/* ===== Custom checkbox inline ===== */
.checkbox-custom {
  position: relative;
  padding-left: 22px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
  display: inline-flex;
  align-items: center;
}
.checkbox-custom input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-custom .checkmark {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  border: 1.5px solid var(--border-light);
  border-radius: 3px;
  background: var(--bg-input);
  transition: all 0.15s;
  flex-shrink: 0;
}
.checkbox-custom:hover .checkmark {
  border-color: var(--accent);
}
.checkbox-custom input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-custom input:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 8px;
  border: solid var(--bg-main);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* "Pilih semua" toolbar control — compact chip */
.checkbox-custom.pick-all {
  gap: 8px;
  padding: 6px 12px 6px 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.checkbox-custom.pick-all .checkmark { left: 10px; }
.checkbox-custom.pick-all:hover { border-color: var(--accent); color: var(--text-main); }
.checkbox-custom.pick-all .pick-all-label { line-height: 1; }
@media (max-width: 640px) {
  .checkbox-custom.pick-all { padding: 5px 10px 5px 28px; font-size: 11.5px; }
}
.text-sm { font-size: 12px; overflow-wrap: anywhere; }
.text-dim { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mb-8 { margin-bottom: 8px; }

/* ===== Toggle Switch ===== */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: 11px;
  transition: background 0.2s, border-color 0.2s;
  display: inline-block;
}
.toggle-switch input:checked ~ .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s, box-shadow 0.2s;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  z-index: 1;
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Custom Dropdown / Select List */
.custom-select-container {
  position: relative;
  width: 100%;
}
.custom-select-trigger {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  transition: border-color 0.15s, background-color 0.15s;
  text-align: left;
}
.custom-select-trigger:hover {
  border-color: var(--border-light);
}
.custom-select-trigger:focus {
  border-color: var(--accent);
  background-color: var(--bg-hover);
}
.custom-select-trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.2s;
  display: inline-block;
  pointer-events: none;
  margin-right: 2px;
}
.custom-select-container.open .custom-select-trigger::after {
  transform: rotate(-135deg);
  margin-top: 1px;
}
.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: none;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}
.custom-select-container.open .custom-select-menu {
  display: block;
}
.custom-select-option {
  padding: 8px 12px;
  color: var(--text-main);
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.custom-select-option:hover {
  background-color: var(--bg-hover);
  color: var(--accent);
}
.custom-select-option.selected {
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* User Action Buttons styling */
.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.page-head-actions .btn, .settings-grid .btn { text-align: center; justify-content: center; }
.btn-action:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}
.btn-action.btn-edit:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.btn-action.btn-reset:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}
.btn-action.btn-delete:hover {
  color: var(--error);
  background: rgba(217, 101, 101, 0.1);
  border-color: var(--error);
}

/* ============================================================
   PREMIUM PAGES (v2 redesign) — shared layout for Tasks, Assets,
   Metadata, Schedule, Settings, Billing, Users
   Built on top of the dashboard v2 design tokens.
   ============================================================ */

/* Page fade-in */
.page-fade { animation: dash-fade 0.4s ease; }

/* Page header — title + subtitle + actions */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head-text { min-width: 0; }
.page-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-main);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 9px;
}
.page-head h2 svg { width: 22px; height: 22px; color: var(--text-secondary); flex-shrink: 0; }
.page-head p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.5;
}
.page-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }

/* Server clock (WIB) — dipakai di halaman Jadwal */
.server-clock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  flex-shrink: 0;
}
.server-clock svg { width: 15px; height: 15px; color: var(--text-secondary); flex-shrink: 0; }
.server-clock-tz { color: var(--text-secondary); font-weight: 600; font-size: 11px; letter-spacing: .5px; }

/* Premium toolbar (filter + search + actions row) */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar-spacer { flex: 1; }

/* Search field with icon */
.search-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 220px;
}
.search-field svg {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-field input::placeholder { color: var(--text-muted); }

/* Segmented tabs */
.seg-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-wrap: wrap;
}
.seg-tab {
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.seg-tab:hover { color: var(--text-main); }
.seg-tab.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.35); }
.seg-tab .seg-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
  background: rgba(148,163,184,0.15);
  color: var(--text-secondary);
}
.seg-tab.active .seg-count { background: rgba(255,255,255,0.22); color: #fff; }

/* Premium table wrapper */
.data-panel { padding: 0; overflow: hidden; }
.data-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  padding: 13px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.015);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table .td-actions { text-align: right; white-space: nowrap; }
.data-table .td-muted { color: var(--text-secondary); }
.users-mobile-list { display:none; }
@media (max-width: 640px) {
  .users-desktop-table { display:none; }
  .users-mobile-list { display:grid; gap:10px; padding:10px; }
  .user-mobile-card { padding:14px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg-input); }
  .user-mobile-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
  .user-mobile-head strong { display:block; font-size:15px; overflow-wrap:anywhere; }
  .user-mobile-head .td-muted { margin-top:3px; font-size:12px; overflow-wrap:anywhere; }
  .user-mobile-badges { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
  .user-mobile-meta { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:14px 0; }
  .user-mobile-meta div { min-width:0; }
  .user-mobile-meta dt { color:var(--text-muted); font-size:11px; }
  .user-mobile-meta dd { margin:3px 0 0; font-size:12px; line-height:1.4; overflow-wrap:anywhere; }
  .user-mobile-actions { display:flex; align-items:center; gap:7px; padding-top:12px; border-top:1px solid var(--border); }
  .user-mobile-actions .btn-plan { margin-right:auto; }
  .user-mobile-actions .btn-action { width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; }
  .user-mobile-actions .btn-action svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2.25; stroke-linecap:round; stroke-linejoin:round; }
}

/* Section panel title with description */
.panel-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }

.sandbox-page { min-height:100vh; background:var(--bg); color:var(--text); display:grid; place-items:center; padding:24px; }
.sandbox-shell { width:min(100%, 520px); }
.sandbox-brand { display:flex; align-items:center; gap:9px; margin-bottom:18px; color:var(--text-muted); font-size:13px; }
.sandbox-brand strong { color:var(--text); font-size:20px; }
.sandbox-brand span:last-child { padding-left:10px; border-left:1px solid var(--border); }
.sandbox-mark { display:grid; place-items:center; width:28px; height:28px; border-radius:8px; color:white; background:var(--accent); font-size:12px; }
.sandbox-card { padding:30px; border:1px solid var(--border); border-radius:16px; background:var(--bg-card); box-shadow:0 20px 60px rgba(0,0,0,.25); }
.sandbox-kicker { color:var(--accent-hover); font:600 10px var(--font-mono); letter-spacing:.16em; }
.sandbox-card h1 { margin:8px 0; font-size:30px; }
.sandbox-copy { color:var(--text-muted); line-height:1.6; margin-bottom:22px; }
.sandbox-status { padding:10px 12px; border:1px solid var(--border); border-radius:9px; color:var(--text-muted); font-size:13px; margin-bottom:18px; }
.sandbox-status.ok { color:var(--success); border-color:var(--success); }
.sandbox-form, .sandbox-session { display:grid; gap:9px; }
.sandbox-form label { color:var(--text-secondary); font-size:12px; font-weight:600; }
.sandbox-form input { width:100%; padding:11px 12px; border:1px solid var(--border); border-radius:9px; color:var(--text); background:var(--bg-input); }
.sandbox-form button { margin-top:8px; }
.sandbox-session { gap:12px; }
.sandbox-user { padding:10px 12px; border-radius:9px; background:var(--bg-input); color:var(--text-secondary); font-size:13px; }
.sandbox-message { min-height:22px; color:var(--success); font-size:13px; margin-top:16px; }
.sandbox-message.error { color:var(--error); }
.sandbox-back { display:block; color:var(--text-muted); font-size:13px; margin-top:20px; text-align:center; }

/* Pill badge (generic, custom-styled) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.4;
  white-space: nowrap;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pill-neutral { background: rgba(148,163,184,0.14); color: var(--text-secondary); }
.pill-blue    { background: rgba(59,130,246,0.14); color: #60a5fa; }
.pill-green   { background: rgba(34,197,94,0.14); color: #4ade80; }
.pill-orange  { background: rgba(245,158,11,0.14); color: #fbbf24; }
.pill-red     { background: rgba(239,68,68,0.14); color: #f87171; }
.pill-purple  { background: rgba(168,85,247,0.14); color: #c084fc; }

/* Empty state (premium) */
.empty-premium {
  text-align: center;
  padding: 54px 24px;
  color: var(--text-secondary);
}
.empty-premium .empty-ic {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.empty-premium .empty-ic svg { width: 26px; height: 26px; }
.empty-premium h3 { font-size: 15px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }
.empty-premium p { font-size: 13px; line-height: 1.6; max-width: 340px; margin: 0 auto; }

/* Locked / upsell state */
.locked-card {
  max-width: 460px;
  margin: 40px auto;
  text-align: center;
  padding: 40px 28px;
}
.locked-card .lock-ic {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
}
.locked-card .lock-ic svg { width: 30px; height: 30px; }
.locked-card h3 { font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.locked-card p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 24px; }

/* Media tile grid (assets) */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.media-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-input);
  transition: transform 0.16s ease, border-color 0.16s ease;
  cursor: pointer;
}
.media-tile:hover { transform: translateY(-2px); border-color: var(--border-light); }
.media-tile .tile-preview {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: #000;
}
.media-tile .tile-preview-icon {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--text-muted);
  background: var(--bg-main);
}
.media-tile .tile-body { padding: 9px 11px; }
.media-tile .tile-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-tile .tile-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.media-tile .tile-check {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
}
.media-tile .tile-del {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.media-tile:hover .tile-del { opacity: 1; }

/* Collapsible section (accordion) */
.accordion { display: flex; flex-direction: column; gap: 14px; }
.acc-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}
.acc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  cursor: pointer;
  user-select: none;
}
.acc-head:hover { background: var(--bg-hover); }
.acc-head .acc-title { font-size: 14px; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 9px; }
.acc-head .acc-title svg { width: 17px; height: 17px; color: var(--text-secondary); }
.acc-head .acc-chevron { transition: transform 0.2s; color: var(--text-muted); display: inline-flex; }
.acc-head .acc-chevron svg { width: 18px; height: 18px; }
.acc-section.collapsed .acc-chevron { transform: rotate(-90deg); }
.acc-body { padding: 0 18px 18px; }
.acc-section.collapsed .acc-body { display: none; }
.acc-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 100px;
  background: rgba(148,163,184,0.15);
  color: var(--text-secondary);
}

/* ===== Active Plan Status card (billing) ===== */
.plan-status-card { padding: 0; overflow: hidden; }
.plan-status-card .ps-top {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(59,130,246,0.06), transparent);
}
.ps-top-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ps-top-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; color: var(--text-main); }
.ps-top-title svg { width: 19px; height: 19px; color: var(--accent); }
.ps-expiry { font-size: 12.5px; font-weight: 600; }
.ps-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 0;
}
.ps-col { padding: 20px 22px; }
.ps-col + .ps-col { border-left: 1px solid var(--border); }
.ps-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ps-section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-muted); }
.ps-section-label .ps-period { color: var(--text-secondary); font-weight: 600; }
.ps-reset { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
.ps-reset svg { width: 13px; height: 13px; }

.ps-usage-grid { display: flex; flex-direction: column; gap: 14px; }
.ps-usage {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.ps-usage-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ps-usage-ic { display: inline-flex; }
.ps-usage-ic svg { width: 16px; height: 16px; color: var(--text-secondary); }
.ps-usage-label { font-size: 13px; font-weight: 600; color: var(--text-main); }
.ps-usage-unit { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.ps-usage-num { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: var(--text-main); margin-bottom: 8px; }
.ps-usage-num .ps-usage-lim, .ps-usage-num .ps-usage-inf { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ps-usage-num .ps-usage-inf { color: var(--success); }
.ps-usage-track { height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; }
.ps-usage-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); transition: width 0.5s ease; }
.ps-usage[data-state="warn"] .ps-usage-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.ps-usage[data-state="danger"] .ps-usage-fill { background: linear-gradient(90deg, #ef4444, #f87171); }
.ps-usage[data-state="warn"] .ps-usage-ic svg { color: var(--warning); }
.ps-usage[data-state="danger"] .ps-usage-ic svg { color: var(--error); }

.ps-feats { display: flex; flex-direction: column; gap: 4px; }
.ps-feat {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  transition: background 0.14s ease;
}
.ps-feat:hover { background: var(--bg-hover); }
.ps-feat-ic { display: inline-flex; }
.ps-feat-ic svg { width: 16px; height: 16px; color: var(--text-muted); }
.ps-feat-label { font-size: 13px; color: var(--text-secondary); }
.ps-feat-val { margin-left: auto; font-size: 13.5px; font-weight: 700; color: var(--text-main); }
.ps-feat-val svg { width: 16px; height: 16px; color: var(--success); }
.ps-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.ps-badge svg { width: 12px; height: 12px; }
.ps-badge-on { background: rgba(34,197,94,0.14); color: var(--success); }
.ps-badge-off { background: rgba(100,116,139,0.16); color: var(--text-muted); }
@media (max-width: 720px) {
  .ps-grid { grid-template-columns: 1fr; }
  .ps-col + .ps-col { border-left: none; border-top: 1px solid var(--border); }
}

/* Plan cards (billing) */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.plan-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 22px 20px;
  transition: transform 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
}
.plan-card:hover { transform: translateY(-3px); border-color: var(--border-light); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card.popular { border-color: rgba(99,102,241,0.5); }
.plan-ribbon {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 100px;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
}
.plan-name { font-size: 15px; font-weight: 700; text-transform: capitalize; }
.plan-price { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin: 10px 0 2px; }
.plan-price .plan-period { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.plan-feats { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan-feats li { font-size: 12.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.plan-feats li svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; }

/* Info-row (key/value list) */
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-row .info-key { color: var(--text-secondary); }
.info-row .info-val { font-weight: 600; color: var(--text-main); text-align: right; }

/* Setting field row helper */
.set-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }

/* Responsive: pages */
@media (max-width: 900px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head-actions { justify-content: flex-start; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .search-field { min-width: 0; width: 100%; }
  .toolbar { gap: 8px; }
  .data-table thead th, .data-table tbody td { padding: 11px 12px; }

  /* Segmented tabs: satu baris geser horizontal, rapih tanpa scrollbar terlihat */
  .seg-tabs {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 10px;
    gap: 3px;
    padding: 3px;
  }
  .seg-tabs::-webkit-scrollbar { display: none; }
  .seg-tab {
    padding: 6px 11px;
    font-size: 12px;
    gap: 5px;
    flex-shrink: 0;
  }
  .seg-tab .seg-count { font-size: 10px; padding: 1px 6px; }
}
