/* ═══════════════════════════════════════════════════════════════
   TULIS ENGINE — Design System
   tulis.tangani.id · by Tangani
   ═══════════════════════════════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
  --primary:          #e879f9;
  --primary-hover:    #d946ef;
  --primary-light:    #fdf4ff;
  --primary-glow:     rgba(232, 121, 249, 0.15);
  --primary-glow-lg:  rgba(232, 121, 249, 0.08);
  /* Sidebar — dark mode mengikuti tone gelap aplikasi */
  --sidebar-bg:       #0C0C0C;
  --sidebar-border:   #1A1A1A;
  --sidebar-border-soft: #161616;
  --sidebar-text:     rgba(240, 240, 240, 0.92);
  --sidebar-text-muted: #666666;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-active:   #e879f9;
  --sidebar-active-bg: rgba(232, 121, 249, 0.12);
  --bg:               #080808;
  --bg-card:          #111111;
  --bg-card-elevated: #161616;
  /* Input sedikit lebih terang dari kartu agar tidak terlihat nonaktif */
  --bg-input:         #2C2C2E;
  --bg-hover:         #1C1C1C;
  --text:             #F0F0F0;
  --text-secondary:   #888;
  --text-muted:       #4A4A4A;
  --border:           #1E1E1E;
  --border-light:     #262626;
  --border-medium:    #2E2E2E;
  --radius:           10px;
  --radius-lg:        14px;
  --radius-xl:        20px;
  --shadow:           0 2px 16px rgba(0,0,0,0.4);
  --shadow-md:        0 4px 24px rgba(0,0,0,0.45);
  --shadow-lg:        0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:      0 0 40px rgba(232, 121, 249, 0.08);
  --transition:       all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-weight-body:   500;
  --font-weight-strong: 600;
  --letter-body:        -0.011em;

  /* AI Brand Gradients */
  --grad-primary:     linear-gradient(135deg, #e879f9 0%, #f0abfc 50%, #c026d3 100%);
  --grad-blue:        linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);
  --grad-green:       linear-gradient(135deg, #10B981 0%, #4ADE80 100%);
  --grad-purple:      linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
  --grad-card:        linear-gradient(145deg, #141414 0%, #111111 100%);

  /* Footer: ringkas, tint sidebar transparan */
  --footer-rule-color: color-mix(in srgb, var(--sidebar-bg) 22%, var(--border));
  --footer-bg: color-mix(in srgb, var(--sidebar-bg) 16%, var(--bg));
  --sidebar-footer-bg: color-mix(in srgb, #fff 5%, transparent);
  --footer-pad-top: 6px;
  --footer-pad-bottom: 8px;
  --footer-pad-x: 24px;
  --footer-strip-min-height: 36px;
}

[data-theme="light"] {
  --bg:               #F5F4F2;
  --bg-card:          #FFFFFF;
  --bg-card-elevated: #FAFAFA;
  --bg-input:         #FAFAF8;
  --bg-hover:         #ECEAE7;
  --text:             #1A1A1A;
  --text-secondary:   #666;
  --text-muted:       #9CA3AF;
  --border:           #E8E7E4;
  --border-light:     #EEEDEA;
  --border-medium:    #DDDBD7;
  --shadow:           0 2px 16px rgba(0,0,0,0.06);
  --shadow-md:        0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:        0 8px 40px rgba(0,0,0,0.10);
  --shadow-glow:      0 0 40px rgba(192, 38, 211, 0.06);
  --sidebar-bg:       #701a75;
  --sidebar-border:   rgba(255, 255, 255, 0.22);
  --sidebar-border-soft: rgba(255, 255, 255, 0.14);
  --sidebar-text:     rgba(255, 255, 255, 0.97);
  --sidebar-text-muted: rgba(255, 255, 255, 0.62);
  --sidebar-hover-bg: rgba(0, 0, 0, 0.12);
  --sidebar-active:   #FFFFFF;
  --sidebar-active-bg: rgba(0, 0, 0, 0.16);
  --grad-card:        linear-gradient(145deg, #FFFFFF 0%, #FAFAFA 100%);

  --footer-rule-color: color-mix(in srgb, var(--sidebar-bg) 14%, var(--border));
  --footer-bg: color-mix(in srgb, var(--sidebar-bg) 10%, var(--bg));
  --sidebar-footer-bg: color-mix(in srgb, #000 7%, transparent);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg); color: var(--text);
  line-height: 1.6; font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ── LAYOUT ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden; z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar::after {
  content: '';
  position: absolute; top: 0; right: 0; width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.35) 45%, transparent 100%);
  pointer-events: none;
}
[data-theme="dark"] .sidebar::after {
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.06) 45%, transparent 100%);
}

.main-content {
  margin-left: 236px; flex: 1; display: flex; flex-direction: column; min-height: 100vh;
  font-weight: var(--font-weight-body);
  letter-spacing: var(--letter-body);
}
.page-content {
  font-weight: inherit;
  letter-spacing: inherit;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.topbar-biz {
  min-width: 0;
}
.topbar-biz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 4px 4px 4px 6px;
  margin: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}
.topbar-biz-toggle:hover {
  background: var(--bg-hover);
}
.topbar-biz-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}
.topbar-biz-toggle[aria-expanded="true"] {
  background: var(--primary-glow);
}
.topbar-biz-logo-wrap {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.topbar-biz-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.topbar-biz-logo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-glow);
}
.topbar-biz-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: min(280px, 38vw);
}
.topbar-biz-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.25;
}
.topbar-biz-sector {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
  margin-top: 1px;
}
.topbar-add-biz { flex-shrink: 0; }

.biz-switch-dropdown {
  position: relative;
  flex-shrink: 0;
}
.biz-switch-chevron {
  display: block;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s ease, color 0.2s ease;
}
.topbar-biz-toggle:hover .biz-switch-chevron {
  color: var(--primary);
}
.topbar-biz-toggle[aria-expanded="true"] .biz-switch-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
.biz-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  max-width: min(320px, 92vw);
  padding: 6px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 80;
}
.biz-switch-menu[hidden] {
  display: none !important;
}
.biz-switch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.biz-switch-item:hover:not(:disabled) {
  background: var(--bg-hover);
}
.biz-switch-item.is-active,
.biz-switch-item:disabled {
  opacity: 1;
  cursor: default;
  color: var(--primary);
  font-weight: 600;
}
.biz-switch-item-logo-wrap {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.biz-switch-item-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.biz-switch-item-logo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-glow);
}
.biz-switch-check {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 12px;
}
.biz-switch-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.biz-switch-item-tag {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}
.biz-switch-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}
.biz-switch-item-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--primary);
  font-weight: 500;
  padding-left: 50px; /* sejajar teks dengan baris yang ada logo 28px + gap */
}
.biz-switch-item-link:hover {
  background: var(--primary-glow);
  color: var(--primary-hover);
}

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(20px) saturate(180%);
  background: rgba(8, 8, 8, 0.85);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}
[data-theme="light"] .topbar {
  background: rgba(245, 244, 242, 0.88);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.page-content { padding: 28px 32px; flex: 1 1 auto; width: 100%; min-height: 0; }

/* ── SIDEBAR ── */
.sidebar-logo {
  box-sizing: border-box;
  height: 60px;
  min-height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--sidebar-border-soft);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-close {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.22);
}
[data-theme="dark"] .sidebar-close {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
[data-theme="dark"] .sidebar-close:hover {
  background: rgba(255, 255, 255, 0.14);
}
.sidebar-logo::after {
  content: '';
  position: absolute; bottom: -1px; left: 20px; right: 20px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
}
[data-theme="dark"] .sidebar-logo::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.sidebar-logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; flex: 1; }
.sidebar-brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: brightness(0) invert(1);
}
[data-theme="dark"] .sidebar-brand-logo {
  filter: none;
}
.sidebar .logo-text {
  font-size: 17px; font-weight: 800; letter-spacing: -0.5px;
  color: #FFFFFF;
  background: none;
  -webkit-text-fill-color: #FFFFFF;
  background-clip: border-box;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}
[data-theme="dark"] .sidebar .logo-text {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  text-shadow: none;
}
.sidebar .logo-sub {
  font-size: 10px; color: var(--sidebar-text-muted); display: block; margin-top: -1px;
  letter-spacing: 0.6px; text-transform: uppercase;
}
.logo-text-wrap { display: flex; flex-direction: column; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-group { margin-bottom: 4px; }
.nav-label {
  font-size: 9px; font-weight: 700; color: var(--sidebar-text-muted); letter-spacing: 1.2px;
  padding: 14px 20px 5px; text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .nav-label { text-shadow: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px 9px 17px;
  color: var(--sidebar-text); text-decoration: none; font-size: 13px;
  font-weight: 500; transition: var(--transition);
  border-left: 2px solid transparent; margin: 1px 0;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .nav-item { text-shadow: none; }
.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #FFFFFF;
  border-left-color: rgba(255, 255, 255, 0.45);
}
[data-theme="dark"] .nav-item:hover {
  color: var(--text);
  border-left-color: rgba(232, 149, 68, 0.45);
}
.nav-item.active {
  background: linear-gradient(90deg, var(--sidebar-active-bg) 0%, rgba(0, 0, 0, 0.06) 100%);
  color: var(--sidebar-active);
  border-left-color: #FFFFFF;
}
[data-theme="dark"] .nav-item.active {
  background: linear-gradient(90deg, var(--sidebar-active-bg) 0%, transparent 100%);
  border-left-color: var(--primary);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2px; height: 60%; background: #FFFFFF;
  border-radius: 0 2px 2px 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .nav-item.active::before {
  background: var(--primary);
  box-shadow: 2px 0 10px rgba(232, 149, 68, 0.25);
}
.nav-icon { width: 18px; display: flex; align-items: center; justify-content: center; opacity: 0.75; flex-shrink: 0; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; color: #FFFFFF; }
[data-theme="dark"] .nav-item.active .nav-icon { color: var(--primary); }

.nav-item-logout {
  margin-top: 6px;
  border-left-color: transparent;
}
.nav-item-logout:hover {
  background: rgba(0, 0, 0, 0.14);
  color: #FECACA;
  border-left-color: rgba(254, 202, 202, 0.65);
}
[data-theme="dark"] .nav-item-logout:hover {
  background: rgba(220, 38, 38, 0.12);
}
.nav-item-logout:hover .nav-icon { opacity: 1; color: #FECACA; }

.sidebar-footer {
  box-sizing: border-box;
  margin-top: auto;
  padding: 12px 12px 14px;
  border-top: 1px solid var(--footer-rule-color);
  background: var(--sidebar-footer-bg);
  min-height: 0;
}

.sidebar-footer-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-footer-tokens {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-footer-stack .sidebar-token-line,
.sidebar-footer-stack .sidebar-plan-row {
  padding: 3px 6px;
}

.sidebar-plan-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 2px;
}

.sidebar-token-line {
  font-size: 12px;
  line-height: 1.25;
  color: var(--sidebar-text-muted) !important;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none !important;
  border-radius: 6px;
  transition: var(--transition);
  cursor: pointer;
}
.sidebar-token-line:hover {
  background: var(--sidebar-hover-bg);
  color: #FFFFFF !important;
}
[data-theme="dark"] .sidebar-token-line:hover {
  color: var(--text) !important;
}
.sidebar-token-line:hover .sidebar-token-value {
  color: #FFFFFF;
}
[data-theme="dark"] .sidebar-token-line:hover .sidebar-token-value {
  color: var(--primary);
}
.sidebar-token-label {
  opacity: 0.9;
  flex-shrink: 0;
  font-weight: 500;
}
.sidebar-token-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.92);
  transition: var(--transition);
  text-align: right;
  min-width: 0;
  letter-spacing: -0.02em;
}
[data-theme="dark"] .sidebar-token-value {
  color: var(--sidebar-text);
}

.sidebar-plan-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

[data-theme="dark"] .sidebar-plan-name {
  color: var(--sidebar-text);
}

.sidebar-plan-active {
  font-size: 12px;
  line-height: 1.25;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.92);
  flex-shrink: 0;
  text-align: right;
}

[data-theme="dark"] .sidebar-plan-active {
  color: var(--sidebar-text);
}

.sidebar-plan-active--inactive {
  color: #FECACA;
}

/* ── Footer kredit (sidebar kiri bawah) ─────────────────────────────────── */
.sidebar-footer-card--credit {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  border: none;
  box-shadow: none;
}

[data-theme="dark"] .sidebar-footer-card--credit {
  background: none;
  border: none;
}

.sidebar-credit-block {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-decoration: none !important;
  color: inherit !important;
  border-radius: 6px;
  margin: 0;
  padding: 3px 6px;
  transition: var(--transition);
  cursor: pointer;
}

.sidebar-credit-block:hover {
  background: var(--sidebar-hover-bg);
}

[data-theme="dark"] .sidebar-credit-block:hover {
  background: var(--sidebar-hover-bg);
}

.sidebar-credit-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--sidebar-text-muted);
  line-height: 1.25;
  flex-shrink: 0;
  opacity: 0.9;
}

[data-theme="dark"] .sidebar-credit-label {
  color: var(--sidebar-text-muted);
}

.sidebar-credit-value {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: none;
  text-align: right;
  min-width: 0;
}

[data-theme="dark"] .sidebar-credit-value {
  color: var(--sidebar-text);
}

.sidebar-credit-block:hover .sidebar-credit-value {
  color: #FFFFFF;
}

[data-theme="dark"] .sidebar-credit-block:hover .sidebar-credit-value {
  color: var(--primary);
}

.sidebar-credit-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 6px 0;
  margin-top: 2px;
  border-top: none;
  min-width: 0;
}

[data-theme="dark"] .sidebar-credit-meta {
  border-top-color: rgba(255, 255, 255, 0.14);
}

.sidebar-credit-plan {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.sidebar-credit-expiry {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
}

[data-theme="dark"] .sidebar-credit-expiry {
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.95);
}

.sidebar-credit-expiry--inactive {
  background: rgba(220, 38, 38, 0.22);
  color: #FECACA;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 10px;
}
[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb {
  background: var(--border-medium);
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}
[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Tombol di atas panel oranye — kontras */
.sidebar .btn-primary {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.sidebar .btn-primary:hover {
  background: #FFF9F3;
  color: var(--primary-hover);
  filter: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

/* ── TOPBAR ── */
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.sidebar-toggle {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  padding: 7px; border-radius: 8px; display: none;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-input); color: var(--text); }
.business-switcher {
  max-width: 200px; padding: 7px 12px; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); cursor: pointer;
  transition: var(--transition);
}
.business-switcher:hover { border-color: var(--border-light); }
.user-menu-dropdown {
  position: relative;
  flex-shrink: 0;
  min-width: 0;
}
.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row;
  min-width: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 4px 4px 8px;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  transition: var(--transition);
}
.user-menu-toggle:hover {
  background: var(--bg-input);
}
.user-menu-toggle[aria-expanded="true"] {
  background: var(--bg-input);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad-primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 0 0 2px rgba(232,149,68,0.2);
  flex-shrink: 0;
}
.user-avatar--img {
  padding: 0;
  overflow: hidden;
  background: var(--bg-input);
  box-shadow: 0 0 0 2px rgba(232,149,68,0.2);
}
.user-avatar--img img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 188px;
  padding: 6px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 80;
}
.user-menu[hidden] {
  display: none !important;
}
.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  box-sizing: border-box;
}
.user-menu-item:hover {
  background: var(--bg-hover);
}
.user-menu-item--danger {
  color: var(--text-secondary);
}
.user-menu-item--danger:hover {
  color: #F87171;
  background: rgba(239, 68, 68, 0.08);
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(200px, 28vw);
  text-align: right;
}
/* Topbar — antrian tugas AI */
.topbar-ai-jobs-dropdown {
  position: relative;
  flex-shrink: 0;
}
.topbar-ai-jobs-dropdown[hidden] {
  display: none !important;
}
.topbar-ai-jobs-toggle {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  transition: var(--transition);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.topbar-ai-jobs-toggle:hover,
.topbar-ai-jobs-toggle[aria-expanded="true"] {
  background: var(--bg-input);
  color: var(--text);
}
.topbar-ai-jobs-icon-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-ai-jobs-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(232, 149, 68, 0.22);
  border-top-color: var(--primary);
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.topbar-ai-jobs-toggle.is-busy .topbar-ai-jobs-loader-ring {
  opacity: 1;
  animation: topbar-ai-jobs-ring-spin 0.85s linear infinite;
}
@keyframes topbar-ai-jobs-ring-spin {
  to { transform: rotate(360deg); }
}
.topbar-ai-jobs-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.topbar-ai-jobs-toggle.is-busy .topbar-ai-jobs-icon-svg {
  color: var(--primary);
}
.topbar-ai-jobs-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}
.topbar-ai-jobs-count[hidden] {
  display: none !important;
}
.topbar-ai-jobs-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 85;
  overflow: hidden;
}
.topbar-ai-jobs-panel[hidden] {
  display: none !important;
}
.topbar-ai-jobs-panel-head {
  padding: 12px 14px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.topbar-ai-jobs-list {
  list-style: none;
  margin: 0;
  padding: 0 6px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.topbar-ai-jobs-list:empty::before {
  content: '';
}
.topbar-ai-jobs-empty {
  padding: 12px 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.topbar-ai-jobs-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  margin-bottom: 4px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: var(--transition);
  box-sizing: border-box;
}
.topbar-ai-jobs-item:hover {
  background: var(--bg-hover);
}
.topbar-ai-jobs-item.is-active {
  background: rgba(232, 149, 68, 0.08);
}
.topbar-ai-jobs-item-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.topbar-ai-jobs-item-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-ai-jobs-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.topbar-ai-jobs-item-progress {
  height: 3px;
  border-radius: 2px;
  background: rgba(232, 149, 68, 0.2);
  margin-top: 8px;
  overflow: hidden;
}
.topbar-ai-jobs-item-progress-bar {
  height: 100%;
  width: 40%;
  background: var(--primary);
  border-radius: 2px;
  animation: topbar-ai-jobs-indeterminate 1.2s ease-in-out infinite;
}
@keyframes topbar-ai-jobs-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.badge-ai-queued {
  background: rgba(96, 165, 250, 0.12);
  color: #60A5FA;
  border: 1px solid rgba(96, 165, 250, 0.25);
}
.badge-ai-running {
  background: rgba(232, 149, 68, 0.12);
  color: var(--primary);
  border: 1px solid rgba(232, 149, 68, 0.25);
}
.badge-ai-done {
  background: rgba(74, 222, 128, 0.10);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.2);
}
.badge-ai-failed {
  background: rgba(239, 68, 68, 0.10);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.topbar-ai-jobs-panel-footer {
  display: block;
  padding: 10px 14px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  text-align: center;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-ai-jobs-panel-footer:hover {
  background: var(--bg-hover);
}


.theme-toggle,
.topbar-help-btn {
  background: none; border: none; cursor: pointer; padding: 7px;
  border-radius: 8px; transition: var(--transition);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover,
.topbar-help-btn:hover { background: var(--bg-input); color: var(--text); }
.theme-icon-sun,
.theme-icon-moon {
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
/* Mode gelap: tampilkan matahari = klik untuk mode terang */
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: flex; }
/* Mode terang: tampilkan bulan = klik untuk mode gelap */
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: flex; }

.app-footer {
  box-sizing: border-box;
  flex-shrink: 0;
  min-height: var(--footer-strip-min-height);
  padding: var(--footer-pad-top) var(--footer-pad-x) var(--footer-pad-bottom);
  border-top: 1px solid var(--footer-rule-color);
  display: flex;
  align-items: center;
  background: var(--footer-bg);
}
.app-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  width: 100%;
  line-height: 1.3;
}
.app-footer-powered {
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  opacity: 0.88;
  flex: 1 1 auto;
  min-width: 0;
}
.app-footer-reset {
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.88;
}
.app-footer-reset:hover { color: var(--primary); opacity: 1; }
.app-footer-reset.is-busy { opacity: 0.55; cursor: wait; }
.app-footer-version {
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  text-align: right;
}
.app-footer-legal {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 9.5px;
  letter-spacing: 0.02em;
}
.app-footer-legal a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}
.app-footer-legal a:hover { color: var(--primary); }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.page-subtitle {
  font-size: 13.5px; color: var(--text-secondary); margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px;
  border-radius: var(--radius); font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none; font-family: inherit; line-height: 1.4; letter-spacing: 0.1px;
}
.btn-primary {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 2px 10px rgba(232,149,68,0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232,149,68,0.35);
  color: #fff;
  filter: brightness(1.05);
}
.btn-primary:active { transform: translateY(0); }
.btn-blue {
  background: var(--grad-blue); color: #fff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.28);
}
.btn-blue:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.38);
  color: #fff;
  filter: brightness(1.05);
}
.btn-blue:active { transform: translateY(0); }
.btn-secondary {
  background: transparent; border: 1px solid var(--border-medium); color: var(--text);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; transform: translateY(-1px); }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14.5px; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger-text { color: #EF4444 !important; }
.btn-danger-text:hover { background: rgba(239,68,68,0.1) !important; }
.btn-ghost.btn-danger-text {
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-ghost.btn-danger-text:hover {
  border-color: rgba(239, 68, 68, 0.65);
}
.inline-form { display: inline; }

/* ── CARDS ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.card:hover { border-color: var(--border-light); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.form-card { max-width: 700px; }


/* OAuth Meta / Instagram — overlay saat menuju dialog Facebook */
.meta-oauth-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 12, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.meta-oauth-loading-overlay.is-visible {
  display: flex;
}
.meta-oauth-loading-panel {
  text-align: center;
  max-width: 340px;
  padding: 28px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.meta-oauth-loading-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 18px;
  border: 3px solid rgba(232, 149, 68, 0.22);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.meta-oauth-loading-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.meta-oauth-loading-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
@media (max-width: 960px) {
  .business-edit-layout {
    grid-template-columns: 1fr;
  }
  .business-edit-sidebar {
    position: static;
  }
}

.plan-create-full .form-card { max-width: none; width: 100%; }
.plan-create-full .card { padding: 16px 18px; }
.plan-create-full .form-layout { gap: 0; }
.plan-create-full .form-section { margin-bottom: 14px; }
.plan-create-full .form-section-title { margin-bottom: 8px; padding-bottom: 6px; font-size: 14px; }
.plan-create-full .form-group { margin-bottom: 8px; }
.plan-create-full label { margin-bottom: 3px; font-size: 12px; }
.plan-create-full input,
.plan-create-full select,
.plan-create-full textarea { padding: 7px 10px; font-size: 13px; }
.plan-create-full .form-actions { padding-top: 14px; margin-top: 4px; gap: 10px; }
.plan-create-full .form-hint { margin-top: 3px; font-size: 11px; }
.plan-create-full .schedule-type-options {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: stretch;
}
.plan-create-full .radio-card {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  margin: 0;
}
.plan-create-full .radio-card-inner--inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: left;
}
.plan-create-full .radio-card-inner--inline .radio-card-icon {
  font-size: 18px;
  margin: 0;
  flex-shrink: 0;
  line-height: 1;
}
.plan-create-full .radio-card-inner--inline strong {
  font-size: 13px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-create-full .day-checkboxes { gap: 6px; }
.plan-create-full .plan-day-checkboxes-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 720px) {
  .plan-create-full .plan-day-checkboxes-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 420px) {
  .plan-create-full .plan-day-checkboxes-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.plan-create-full .day-check {
  padding: 6px 8px;
  font-size: 12px;
  justify-content: center;
}
.plan-create-full .form-row { gap: 10px; }
.plan-create-full .plan-schedule-fields-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
@media (max-width: 520px) {
  .plan-create-full .plan-schedule-fields-row {
    grid-template-columns: 1fr;
  }
}
.plan-create-full .plan-schedule-panel {
  margin-bottom: 4px;
}
.plan-create-full .plan-weekly-days-wrap {
  margin-top: 4px;
}
.plan-create-full .plan-cal-wrap {
  margin-bottom: 0;
}
.plan-create-full .btn-lg { padding: 9px 18px; font-size: 14px; }

.plan-current-business {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}
.plan-current-business-label {
  color: var(--text-secondary);
}
.plan-current-business strong { font-size: 14px; font-weight: 600; }
.plan-title-full input { width: 100%; }

.post-time-section {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.post-time-main-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

/* ── FORMS ── */
.form-layout { display: flex; flex-direction: column; gap: 4px; }
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.required { color: #EF4444; }
input, select, textarea {
  width: 100%; padding: 10px 14px; background: var(--bg-input);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; outline: none;
  font-family: inherit; transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 60px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 22px; display: flex; align-items: center; gap: 16px;
  transition: var(--transition-slow); cursor: default;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--stat-accent, var(--grad-primary)); opacity: 0;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-medium); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card:hover::before { opacity: 1; }

.stat-card-amber { --stat-accent: linear-gradient(90deg, #E89544, #F0A860); }
.stat-card-blue   { --stat-accent: linear-gradient(90deg, #3B82F6, #60A5FA); }
.stat-card-green  { --stat-accent: linear-gradient(90deg, #10B981, #4ADE80); }
.stat-card-purple { --stat-accent: linear-gradient(90deg, #7C3AED, #A78BFA); }

.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon-amber { background: rgba(232,149,68,0.10); color: var(--primary); }
.stat-icon-blue  { background: rgba(96,165,250,0.10); color: #60A5FA; }
.stat-icon-green { background: rgba(74,222,128,0.10); color: #4ADE80; }
.stat-icon-purple{ background: rgba(167,139,250,0.10); color: #A78BFA; }

.stat-value { font-size: 30px; font-weight: 800; display: block; letter-spacing: -1.5px; line-height: 1; }
.stat-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 5px; font-weight: 500; letter-spacing: 0.1px; }
.stat-sublabel {
  font-size: 10px; color: var(--text-muted); margin-top: 3px; font-weight: 500;
  letter-spacing: 0.02em; line-height: 1.25; max-width: 140px;
}
.stat-info { display: flex; flex-direction: column; }

.stats-grid--compact {
  gap: 10px;
  margin-bottom: 16px;
}
.stats-grid--compact .stat-card {
  padding: 10px 12px;
  gap: 10px;
  border-radius: var(--radius);
}
.stats-grid--compact .stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.stats-grid--compact .stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.stats-grid--compact .stat-value {
  font-size: 22px;
  letter-spacing: -0.8px;
}
.stats-grid--compact .stat-label {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.3;
}
.stats-grid--compact .stat-label-range {
  display: block;
  margin-top: 1px;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-green  { background: rgba(34, 197, 94, 0.12); color: #16a34a; border: 1px solid rgba(34, 197, 94, 0.28); }
.badge-red    { background: rgba(239, 68, 68, 0.12); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.28); }
.badge-amber  { background: rgba(245, 158, 11, 0.12); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.28); }
.badge-gray   { background: rgba(136, 136, 136, 0.12); color: #888; border: 1px solid rgba(136, 136, 136, 0.22); }
[data-theme="dark"] .badge-green { color: #4ade80; }
[data-theme="dark"] .badge-red   { color: #f87171; }
[data-theme="dark"] .badge-amber { color: #fbbf24; }
.badge-pending   { background: rgba(232,149,68,0.12); color: #E89544; border: 1px solid rgba(232,149,68,0.2); }
.badge-approved  { background: rgba(74,222,128,0.10); color: #4ADE80; border: 1px solid rgba(74,222,128,0.2); }
.badge-rejected  { background: rgba(239,68,68,0.10); color: #F87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-scheduled { background: rgba(96,165,250,0.10); color: #60A5FA; border: 1px solid rgba(96,165,250,0.2); }
.badge-posted    { background: rgba(134,239,172,0.10); color: #86EFAC; border: 1px solid rgba(134,239,172,0.2); }
.badge-failed    { background: rgba(248,113,113,0.10); color: #F87171; border: 1px solid rgba(248,113,113,0.2); }
.badge-active    { background: rgba(74,222,128,0.10); color: #4ADE80; border: 1px solid rgba(74,222,128,0.2); }
.badge-trial     { background: rgba(96,165,250,0.10); color: #60A5FA; border: 1px solid rgba(96,165,250,0.2); }
.badge-suspended { background: rgba(239,68,68,0.10); color: #F87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-type-promo     { background: rgba(232,149,68,0.10); color: var(--primary); border: 1px solid rgba(232,149,68,0.2); }
.badge-type-edukasi   { background: rgba(96,165,250,0.10); color: #60A5FA; border: 1px solid rgba(96,165,250,0.2); }
.badge-type-testimoni { background: rgba(74,222,128,0.10); color: #4ADE80; border: 1px solid rgba(74,222,128,0.2); }
.badge-type-bts       { background: rgba(167,139,250,0.10); color: #A78BFA; border: 1px solid rgba(167,139,250,0.2); }
.badge-type-seasonal  { background: rgba(251,191,36,0.10); color: #FBBF24; border: 1px solid rgba(251,191,36,0.2); }
.badge-type-launching { background: rgba(244,114,182,0.10); color: #F472B6; border: 1px solid rgba(244,114,182,0.2); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 52px 24px; }
.empty-icon { font-size: 44px; margin-bottom: 16px; display: block; filter: grayscale(0.2); }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 20px; max-width: 340px; margin-left: auto; margin-right: auto; line-height: 1.6; }

/* ── FLASH MESSAGES ── */
.flash-message {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; margin: 8px 32px 0; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500; animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}
.flash-success { background: rgba(74,222,128,0.08); color: #4ADE80; border: 1px solid rgba(74,222,128,0.2); }
.flash-error { background: rgba(239,68,68,0.08); color: #F87171; border: 1px solid rgba(239,68,68,0.2); }
.flash-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 18px; opacity: 0.5; padding: 0 2px; }
.flash-close:hover { opacity: 1; }
@keyframes slideDown { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text); padding: 12px 20px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.2s forwards;
  max-width: min(420px, calc(100vw - 48px));
  line-height: 1.45;
}
.toast--error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}
[data-theme="dark"] .toast--error { color: #f87171; }
.toast--success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
}
[data-theme="dark"] .toast--success { color: #4ade80; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }

/* ── STREAMING ── */
.streaming-box {
  background: var(--bg-input); border-radius: var(--radius); padding: 20px;
  font-size: 14px; line-height: 1.8; white-space: pre-wrap; min-height: 120px;
  border: 1.5px solid var(--border);
}

/* ── PAGE HEADER ACTIONS ── */
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ── SPINNER ── */
.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BADGE DONE ── */
.badge-done { background: rgba(74,222,128,0.15); color: #4ADE80; }
.badge-generating { background: rgba(232,149,68,0.15); color: var(--primary); }
.badge-draft { background: rgba(136,136,136,0.15); color: #888; }
.badge-completed { background: rgba(74,222,128,0.15); color: #4ADE80; }

/* ── MODAL ── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay[hidden] { display: none !important; }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 24px; cursor: pointer; line-height: 1; padding: 0; transition: var(--transition); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }

/* SweetAlert2 — selaras dengan tema Tulis */
.tulis-swal-popup {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-lg);
  font-family: 'Inter', sans-serif;
  padding: 1.5rem 1.25rem 1.25rem;
}
.tulis-swal-title {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--text) !important;
}
.tulis-swal-text {
  font-size: 0.875rem !important;
  line-height: 1.55 !important;
  color: var(--text-muted) !important;
}
.tulis-swal-actions {
  gap: 8px !important;
  margin-top: 1.25rem !important;
}
.tulis-swal-btn {
  min-width: 96px;
  margin: 0 !important;
}

/* Opsi posting otomatis ke Instagram (modal jadwal, approve generate) */
.ig-publish-opt,
.gen-ig-schedule-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 0;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.ig-publish-opt:hover,
.gen-ig-schedule-opt:hover {
  border-color: var(--border-medium);
  background: rgba(232, 149, 68, 0.04);
}
.ig-publish-opt:has(input:focus-visible),
.gen-ig-schedule-opt:has(input:focus-visible) {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
  border-color: var(--primary);
}
.ig-publish-opt:has(input:checked),
.gen-ig-schedule-opt:has(input:checked) {
  border-color: rgba(232, 149, 68, 0.45);
  background: rgba(232, 149, 68, 0.08);
}
.ig-publish-opt input[type="checkbox"],
.gen-ig-schedule-opt input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  min-width: 1.125rem;
  margin: 2px 0 0;
  padding: 0;
  flex-shrink: 0;
  border-radius: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}
.ig-publish-opt span,
.gen-ig-schedule-opt span {
  flex: 1;
  min-width: 0;
}
.tangani-app-link-modal-text {
  margin: 0 0 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 14px;
}
.tangani-app-link-modal-url-wrap {
  margin: 0 0 20px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-break: break-all;
}
.tangani-app-link-modal-url {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tangani-app-link-modal-url:hover {
  color: var(--primary-hover);
}
.tangani-app-link-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.tangani-app-link-modal-actions--solo {
  justify-content: stretch;
}
.tangani-app-link-modal-actions--solo .btn {
  width: 100%;
}
.tangani-app-link-modal-owner-email {
  color: var(--text);
  font-weight: 700;
  word-break: break-all;
}
.tangani-app-link-modal-owner-panel[hidden],
.tangani-app-link-modal-app-panel[hidden] {
  display: none !important;
}
body.tangani-app-modal-open { overflow: hidden; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.action-buttons-stack { display: flex; flex-direction: column; gap: 8px; }
.approved-badge-lg {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.2);
  border-radius: var(--radius); color: #4ADE80; font-weight: 600;
}

/* ── SIDEBAR OVERLAY (Mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65); z-index: 99; backdrop-filter: blur(6px);
}

/* ── MOBILE BOTTOM NAV ── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  justify-items: stretch;
  gap: 0;
  min-height: 54px;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.mobile-nav-item {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-secondary);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.mobile-nav-item.is-active {
  color: var(--primary);
}
.mobile-nav-item.is-active .mobile-nav-icon {
  opacity: 1;
}
.mobile-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  opacity: 0.75;
  flex-shrink: 0;
}
.mobile-nav-item.is-active .mobile-nav-icon,
.mobile-nav-item:hover .mobile-nav-icon {
  opacity: 1;
}
.mobile-nav-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.15px;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mobile-nav-item--instant {
  justify-self: stretch;
  align-self: stretch;
  margin-top: 0;
  padding: 6px 2px;
  gap: 2px;
  color: var(--primary);
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-instant-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #701a75 0%, #e879f9 100%);
  color: #fff;
  box-shadow: none;
  border: none;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.mobile-nav-instant-btn svg {
  width: 14px;
  height: 14px;
}

.mobile-nav-item--instant:not(:disabled):hover .mobile-nav-instant-btn,
.mobile-nav-item--instant:not(:disabled):active .mobile-nav-instant-btn {
  transform: none;
  opacity: 0.92;
}

.mobile-nav-item--instant:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mobile-nav-item--instant:disabled .mobile-nav-instant-btn {
  background: var(--border-medium);
  color: var(--text-muted);
}

.mobile-nav-item--instant .mobile-nav-label {
  color: var(--primary);
  font-weight: 700;
}

.mobile-nav-item--more.is-open {
  color: var(--primary);
}

.mobile-nav-item--more.is-open .mobile-nav-icon {
  opacity: 1;
}

.mobile-nav-sheet {
  position: fixed;
  inset: 0;
  z-index: 220;
  pointer-events: none;
}
.mobile-nav-sheet:not([hidden]) {
  pointer-events: auto;
}
.mobile-nav-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.mobile-nav-sheet-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: none;
  padding: 0;
  background: var(--bg);
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  animation: mobile-nav-modal-in 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}
@keyframes mobile-nav-modal-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-nav-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.mobile-nav-sheet-head-text {
  flex: 1;
  min-width: 0;
}
.mobile-nav-sheet-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}
.mobile-nav-sheet-sub {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
.mobile-nav-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-sheet-close svg {
  width: 16px;
  height: 16px;
}
.mobile-nav-sheet-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.mobile-nav-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.mobile-nav-sheet-section {
  margin: 12px 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.mobile-nav-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.mobile-nav-sheet-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-sheet-card:active {
  transform: scale(0.98);
}
.mobile-nav-sheet-card.is-active {
  background: var(--primary-glow);
  border-color: rgba(232, 121, 249, 0.35);
}
.mobile-nav-sheet-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}
.mobile-nav-sheet-card-icon svg {
  width: 14px;
  height: 14px;
}
.mobile-nav-sheet-card-icon--plan {
  background: rgba(232, 121, 249, 0.14);
  color: #e879f9;
}
.mobile-nav-sheet-card-icon--trends {
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
}
.mobile-nav-sheet-card-icon--automation {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
}
.mobile-nav-sheet-card-icon--instagram {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(249, 115, 22, 0.12) 100%);
  color: #f472b6;
}
.mobile-nav-sheet-card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.mobile-nav-sheet-card-text strong {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.mobile-nav-sheet-card-text span {
  font-size: 0.625rem;
  line-height: 1.35;
  color: var(--text-secondary);
}
.mobile-nav-sheet-card.is-active .mobile-nav-sheet-card-text strong {
  color: var(--primary);
}
.mobile-nav-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-nav-sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-sheet-row:active {
  transform: scale(0.99);
}
.mobile-nav-sheet-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.mobile-nav-sheet-row-icon svg {
  width: 14px;
  height: 14px;
}
.mobile-nav-sheet-row-icon--guide {
  background: rgba(232, 121, 249, 0.1);
  color: var(--primary);
}
.mobile-nav-sheet-row--chat {
  border-color: rgba(232, 121, 249, 0.28);
  background: linear-gradient(135deg, rgba(112, 26, 117, 0.12) 0%, rgba(232, 121, 249, 0.08) 100%);
}
.mobile-nav-sheet-row--chat .mobile-nav-sheet-row-icon {
  background: linear-gradient(135deg, #701a75 0%, #e879f9 100%);
  color: #fff;
}
.mobile-nav-sheet-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-nav-sheet-row-text strong {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.3;
}
.mobile-nav-sheet-row-text span {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
.mobile-nav-sheet-row-chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  opacity: 0.7;
}
.mobile-nav-item--group.is-open {
  color: var(--primary);
}
.mobile-nav-item--group.is-open .mobile-nav-icon {
  opacity: 1;
}

body.mobile-nav-sheet-open {
  overflow: hidden;
}

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .gen-detail-grid { grid-template-columns: 1fr; }
  .gen-detail-sidebar { position: static; }
  .schedule-type-options:not(.plan-create-schedule-row) { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root {
    --footer-pad-top: 6px;
    --footer-pad-bottom: 8px;
    --footer-pad-x: 16px;
    --footer-strip-min-height: 34px;
  }
  .gen-cards-grid { gap: 14px; }
  .gen-cards-grid .gen-card-action {
    padding: 8px 10px 10px;
  }
  .gen-cards-grid .gen-card-action-btns {
    justify-content: center;
    gap: 5px;
  }
  .gen-cards-grid .gen-card-action .btn {
    padding: 5px 8px;
    font-size: 11px;
  }
  .gen-cards-list .gen-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 0;
  }
  .gen-cards-list .gen-card-main {
    flex-direction: row;
    flex: 1 1 auto;
    min-width: 0;
  }
  .gen-cards-list .gen-card-media {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    aspect-ratio: 1;
    align-self: stretch;
    border-right: 1px solid var(--border);
    border-bottom: none;
  }
  .gen-cards-list .gen-card-media-img,
  .gen-cards-list .gen-card-media-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
  .gen-cards-list .gen-card-body-link {
    flex: 1 1 auto;
    min-width: 0;
  }
  .gen-cards-list .gen-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: auto;
    min-width: 0;
    padding: 10px 12px;
  }
  .gen-cards-list .gen-card-title {
    font-size: 14px;
    margin-bottom: 4px;
    -webkit-line-clamp: 2;
  }
  .gen-cards-list .gen-card-meta {
    font-size: 11.5px;
    margin-bottom: 2px;
    -webkit-line-clamp: 1;
  }
  .gen-cards-list .gen-card-date {
    font-size: 11px;
    margin-bottom: 0;
  }
  .gen-cards-list .gen-card-preview {
    font-size: 12px;
    margin: 4px 0 0;
    -webkit-line-clamp: 2;
  }
  .gen-cards-list .gen-card-action {
    flex: 0 0 auto;
    flex-direction: column;
    align-self: stretch;
    justify-content: center;
    align-items: stretch;
    gap: 5px;
    margin-top: 0;
    padding: 8px 10px 8px 0;
    border-top: none;
    min-width: 108px;
  }
  .gen-cards-list .gen-card-action-btns {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
  .gen-cards-list .gen-card-action .btn {
    width: 100%;
    padding: 5px 8px;
    font-size: 11px;
    justify-content: center;
  }
  .modal-content.gen-ig-preview-modal {
    --gen-ig-panel-w: 100%;
    --gen-ig-media: min(92vw, 85vh, 520px);
    max-width: min(520px, 98vw);
    width: min(520px, 98vw);
  }
  .gen-ig-preview-shell {
    flex-direction: column;
    height: auto;
    max-height: min(92vh, 900px);
  }
  .gen-ig-preview-media-col {
    width: 100%;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    height: auto;
    max-height: min(92vw, 480px);
  }
  .gen-ig-preview-media {
    height: 100%;
  }
  .gen-ig-preview-panel {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: 1 1 auto;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: min(42vh, 340px);
  }
  .gen-pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .gen-pagination-pages {
    justify-content: center;
    flex-wrap: wrap;
  }
  .filter-tabs { flex-wrap: wrap; row-gap: 6px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .sidebar-toggle { display: flex; }
  .sidebar-close { display: flex; }
  .main-content { margin-left: 0; padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .mobile-bottom-nav { display: grid; }
  .mobile-nav-label { font-size: 9px; letter-spacing: -0.2px; }
  .mobile-nav-icon { width: 22px; height: 22px; }
  .mobile-nav-icon svg { width: 20px; height: 20px; }
  .app-footer { display: none; }
  .page-content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar-biz-text { max-width: min(220px, 52vw); }
  .topbar-biz-name { font-size: 14px; }
  .topbar-biz-sector { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 26px; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-header .page-subtitle,
  .bill-header .page-subtitle,
  .dashboard-greeting-text > p { display: none; }
  .user-name { display: none; }
  .auth-card { padding: 32px 24px; }
  .flash-message { margin: 8px 16px 0; }
}
@media (max-width: 480px) {
  :root {
    --footer-pad-top: 5px;
    --footer-pad-bottom: 7px;
    --footer-pad-x: 14px;
    --footer-strip-min-height: 32px;
  }
  .mobile-bottom-nav {
    min-height: 50px;
    padding: 5px 2px calc(5px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-nav-item { padding: 4px 1px; gap: 1px; }
  .mobile-nav-item--instant { padding: 4px 1px; }
  .mobile-nav-instant-btn { width: 20px; height: 20px; border-radius: 6px; }
  .mobile-nav-instant-btn svg { width: 12px; height: 12px; }
  .mobile-nav-label { font-size: 8.5px; }
  .mobile-nav-icon { width: 20px; height: 20px; }
  .mobile-nav-icon svg { width: 18px; height: 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px 14px; }
  .gen-cards-list .gen-card {
    flex-wrap: nowrap;
  }
  .gen-cards-list .gen-card-main {
    flex: 1 1 auto;
    min-width: 0;
  }
  .gen-cards-list .gen-card-media {
    width: 76px;
    min-width: 76px;
    max-width: 76px;
  }
  .gen-cards-list .gen-card-action {
    flex: 0 0 auto;
    min-width: 96px;
    padding: 8px 8px 8px 0;
  }
  .gen-cards-list .gen-card-action .btn {
    font-size: 10px;
    padding: 4px 6px;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-medium); }

/* ── A11y & logout forms ─────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  left: 0;
}

.nav-logout-form,
.user-menu-logout-form {
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
}
.nav-logout-form .nav-item,
button.nav-item.js-tangani-app-link,
.user-menu-logout-form button.user-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: normal;
  letter-spacing: normal;
}
button.nav-item.js-tangani-app-link {
  color: var(--sidebar-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] button.nav-item.js-tangani-app-link {
  text-shadow: none;
}
button.user-menu-item.js-tangani-app-link {
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}
.nav-logout-form .nav-item {
  color: var(--sidebar-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .nav-logout-form .nav-item {
  text-shadow: none;
}

/* ── FILTER TABS (shared base — usage, dll.) ── */
.filter-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.filter-tab {
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  bottom: -1px;
}
button.filter-tab {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  line-height: inherit;
  margin: 0;
}
button.filter-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px 4px 0 0;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.filter-count {
  background: var(--bg-input);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
}
.filter-tab.active .filter-count { background: var(--primary-glow); color: var(--primary); }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Selection */
::selection { background: rgba(232,149,68,0.2); color: var(--text); }



/* ══════════════════════════════════════════════
   Global Help Button & Modal (digunakan di semua halaman)
   ══════════════════════════════════════════════ */
.plan-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}
.plan-help-btn:hover {
  background: var(--primary-light, #FDF3E7);
  border-color: var(--primary, #E89544);
  color: var(--primary, #E89544);
}
.plan-help-btn--sm {
  width: 24px;
  height: 24px;
}

.plan-help-dialog {
  max-width: 680px;
  width: 96vw;
  max-height: 88vh;
  overflow-y: auto;
}

.plan-help-modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.plan-help-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light, #FDF3E7);
  color: var(--primary, #E89544);
  flex-shrink: 0;
}

.plan-help-body {
  padding: 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.plan-help-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.plan-help-section:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.plan-help-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 10px;
}

.plan-help-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.plan-help-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-help-steps li {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}

.plan-help-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.plan-help-list li {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.plan-help-tips li::before {
  content: '→';
  color: var(--primary, #E89544);
  flex-shrink: 0;
  margin-top: 1px;
}

.plan-help-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .plan-help-menu-grid { grid-template-columns: 1fr; }
}

.plan-help-menu-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
}

.plan-help-menu-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.plan-help-menu-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.plan-help-section--chat {
  border-bottom: none;
  padding-top: 18px;
  padding-bottom: 6px;
}

.plan-help-chat-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(112,26,117,0.06) 0%, rgba(232,121,249,0.08) 100%);
  border: 1px solid rgba(112,26,117,0.18);
  border-radius: 12px;
  flex-wrap: wrap;
}

.plan-help-chat-cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #701a75 0%, #e879f9 100%);
  color: #fff;
  flex-shrink: 0;
}

.plan-help-chat-cta-text {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.plan-help-chat-cta-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.plan-help-chat-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .plan-help-chat-cta {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .plan-help-chat-cta-btn {
    width: 100%;
    justify-content: center;
  }
}
