:root {
  --color-primary: #0f9d78;
  --color-primary-dark: #0b7a5c;
  --color-primary-light: #e4f6ef;
  --color-bg: #f6f8f7;
  --color-surface: #ffffff;
  --color-border: #e6eae8;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
  --gradient-primary-from: #0f9d78;
  --gradient-primary-to: #0b7a5c;
  --btn-secondary-hover-bg: #d3ede2;
  --dot-muted: #c7d2cd;
  --bar-muted: #d7e4de;
  --tint-success-bg: #e4f6ef;
  --tint-success-text: #0b7a5c;
  --tint-info-bg: #e6f0ff;
  --tint-info-text: #2c5cc5;
  --tint-warning-bg: #fef3e2;
  --tint-warning-text: #b45309;
  --tint-danger-bg: #fde8e8;
  --tint-danger-text: #b91c1c;
  --tint-muted-bg: #f1f3f2;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 10px 30px -12px rgba(15, 23, 42, 0.12);
  --shadow-elevated: 0 24px 48px -16px rgba(15, 23, 42, 0.22);
  --shadow-hover: 0 20px 30px -18px rgba(15, 23, 42, 0.25);
  --font-sans: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

/* Tema gelap: ikut preferensi OS secara default, atau dipaksa lewat
   [data-theme] yang diset assets/js/app.js saat pengguna menekan tombol
   ganti tema (tersimpan di localStorage, lihat theme_toggle_button()). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-primary: #1fae82;
    --color-primary-dark: #3fd6a6;
    --color-primary-light: #123a2f;
    --color-bg: #0e1713;
    --color-surface: #16221c;
    --color-border: #283b32;
    --color-text: #e7f0ea;
    --color-text-muted: #93a89c;
    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-danger: #f87171;
    --color-info: #60a5fa;
    --gradient-primary-from: #1c8f6d;
    --gradient-primary-to: #0b4d3b;
    --btn-secondary-hover-bg: #1c4a3b;
    --dot-muted: #3a4d44;
    --bar-muted: #2c3f37;
    --tint-success-bg: rgba(52, 211, 153, 0.16);
    --tint-success-text: #6ee7c4;
    --tint-info-bg: rgba(96, 165, 250, 0.16);
    --tint-info-text: #93c5fd;
    --tint-warning-bg: rgba(251, 191, 36, 0.16);
    --tint-warning-text: #fcd34d;
    --tint-danger-bg: rgba(248, 113, 113, 0.16);
    --tint-danger-text: #fca5a5;
    --tint-muted-bg: rgba(255, 255, 255, 0.06);
    --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
    --shadow-elevated: 0 24px 48px -16px rgba(0, 0, 0, 0.55);
    --shadow-hover: 0 20px 30px -18px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #1fae82;
  --color-primary-dark: #3fd6a6;
  --color-primary-light: #123a2f;
  --color-bg: #0e1713;
  --color-surface: #16221c;
  --color-border: #283b32;
  --color-text: #e7f0ea;
  --color-text-muted: #93a89c;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-danger: #f87171;
  --color-info: #60a5fa;
  --gradient-primary-from: #1c8f6d;
  --gradient-primary-to: #0b4d3b;
  --btn-secondary-hover-bg: #1c4a3b;
  --dot-muted: #3a4d44;
  --bar-muted: #2c3f37;
  --tint-success-bg: rgba(52, 211, 153, 0.16);
  --tint-success-text: #6ee7c4;
  --tint-info-bg: rgba(96, 165, 250, 0.16);
  --tint-info-text: #93c5fd;
  --tint-warning-bg: rgba(251, 191, 36, 0.16);
  --tint-warning-text: #fcd34d;
  --tint-danger-bg: rgba(248, 113, 113, 0.16);
  --tint-danger-text: #fca5a5;
  --tint-muted-bg: rgba(255, 255, 255, 0.06);
  --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 24px 48px -16px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 20px 30px -18px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.icon {
  width: 20px;
  height: 20px;
  display: block;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 26px;
  height: 26px;
  color: var(--color-primary);
}

.app-logo {
  display: block;
  flex-shrink: 0;
}

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

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Sidebar (desktop) */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
}

.brand-text {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.93rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.nav-link.is-active {
  background: var(--color-primary);
  color: #fff;
}

.nav-link.is-active .icon {
  color: #fff;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 32px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-heading h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
}

.topbar-heading p {
  margin: 2px 0 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  border: none;
  background: var(--color-bg);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--color-text-muted);
}

.icon-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.badge-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-danger);
  border: 2px solid var(--color-surface);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--color-border);
  margin-left: 4px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.topbar-user-meta strong {
  font-size: 0.85rem;
}

.topbar-user-meta small {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* Main content */
.main {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 32px 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Summary cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.summary-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-soft);
}

.summary-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-dark);
}

.summary-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 800;
}

.summary-sub {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.summary-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}

.trend-up {
  color: var(--color-success);
}

.trend-down {
  color: var(--color-danger);
}

.trend-flat {
  color: var(--color-text-muted);
}

/* Content grid: chart + AI */
.content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.panel-header p {
  margin: 2px 0 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-primary {
  background: var(--color-primary);
}

.dot-muted {
  background: var(--dot-muted);
}

/* Bar chart (mockup tren, murni CSS) */
.bar-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  height: 200px;
  padding-top: 8px;
}

.bar-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.bar-group {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 100%;
}

.bar {
  width: 12px;
  border-radius: 6px 6px 2px 2px;
}

.bar-primary {
  background: var(--color-primary);
}

.bar-muted {
  background: var(--bar-muted);
}

.bar-label {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

/* AI panel */
.ai-panel {
  background: linear-gradient(165deg, var(--gradient-primary-from) 0%, var(--gradient-primary-to) 100%);
  color: #fff;
  border: none;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-panel .panel-header h2 {
  color: #fff;
}

.ai-headline {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 14px;
}

.ai-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.ai-points li {
  font-size: 0.85rem;
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
  opacity: 0.95;
}

.ai-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

.ai-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.75rem;
  opacity: 0.9;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 14px;
}

.ai-footer .btn-link {
  color: #fff;
  text-decoration: underline;
  opacity: 0.9;
}

.ai-footer .link-arrow {
  color: #fff;
  font-weight: 700;
  opacity: 1;
}

.link-arrow {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--color-border);
}

.data-table tbody tr:hover {
  background: var(--color-bg);
}

.table-action a {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success {
  background: var(--tint-success-bg);
  color: var(--tint-success-text);
}

.badge-info {
  background: var(--tint-info-bg);
  color: var(--tint-info-text);
}

.badge-warning {
  background: var(--tint-warning-bg);
  color: var(--tint-warning-text);
}

.badge-danger {
  background: var(--tint-danger-bg);
  color: var(--tint-danger-text);
}

.badge-muted {
  background: var(--tint-muted-bg);
  color: var(--color-text-muted);
}

/* Bottom nav (mobile) */
.bottom-nav {
  display: none;
}

/* Responsive: tablet & mobile */
@media (max-width: 1023px) {
  .sidebar {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main {
    padding: 20px 16px 96px;
  }

  .topbar {
    padding: 16px 18px;
  }

  .topbar-user-meta {
    display: none;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }

  .bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 10px;
  }

  .bottom-nav-link .icon {
    width: 22px;
    height: 22px;
  }

  .bottom-nav-link.is-active {
    color: var(--color-primary-dark);
  }
}

@media (max-width: 599px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    height: 160px;
  }

  .panel-header {
    flex-direction: column;
  }
}

/* ============ Auth pages (login, 403) ============ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-shell {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
  padding: 36px 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
}

.auth-sub {
  margin: 0 0 22px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-demo {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.auth-demo p {
  margin: 0 0 6px;
}

.auth-demo ul {
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.auth-demo code {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
}

/* ============ Forms ============ */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

input,
select,
textarea {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 500;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
}

input,
select {
  max-width: 480px;
}

textarea {
  resize: vertical;
  font-weight: 400;
  max-width: 640px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-form-inline {
  max-width: 640px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.filter-form label {
  max-width: 360px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: var(--font-sans);
}

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

.btn-primary:hover {
  filter: brightness(0.92);
}

.btn-secondary {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover-bg);
}

.btn-block {
  width: 100%;
}

.btn-link {
  border: none;
  background: none;
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

/* ============ Alerts & empty state ============ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.alert-success {
  background: var(--tint-success-bg);
  color: var(--tint-success-text);
}

.alert-danger {
  background: var(--tint-danger-bg);
  color: var(--tint-danger-text);
}

.empty-note {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  padding: 8px 0;
}

/* ============ Content grid variants ============ */
.content-grid-form {
  grid-template-columns: 1fr 1.2fr;
}

.summary-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.ai-panel-full {
  max-width: 720px;
}

.row-detail {
  display: none;
}

.row-detail.is-open {
  display: table-row;
}

.row-detail td {
  background: var(--color-bg);
  padding: 18px 14px;
}

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

  .summary-grid-3 {
    grid-template-columns: 1fr;
  }
}

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

  .auth-card {
    padding: 28px 22px;
  }
}

/* ============ Laporan ============ */
.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-sub {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.text-success {
  color: var(--color-success);
  font-weight: 700;
}

.text-danger {
  color: var(--color-danger);
  font-weight: 700;
}

.hbar-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hbar-row {
  display: grid;
  grid-template-columns: 110px 1fr 140px;
  align-items: center;
  gap: 12px;
}

.hbar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.hbar-track {
  height: 10px;
  background: var(--color-bg);
  border-radius: 999px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 999px;
}

.hbar-positive {
  background: var(--color-success);
}

.hbar-negative {
  background: var(--color-danger);
}

.hbar-value {
  font-size: 0.82rem;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 599px) {
  .hbar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .hbar-value {
    text-align: left;
  }
}

/* ============ Asisten Chat ============ */
.chat-panel {
  display: flex;
  flex-direction: column;
  max-width: 720px;
  height: 72vh;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 4px 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.chat-user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-assistant {
  align-self: flex-start;
  background: var(--color-bg);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

.chat-form {
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}

.chat-form input[type="text"] {
  flex: 1;
}

.chat-confirm-card {
  align-self: flex-start;
  max-width: 90%;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-confirm-summary {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.chat-confirm-actions {
  display: flex;
  gap: 10px;
}

.chat-confirm-actions form {
  display: inline;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
}

@media (max-width: 599px) {
  .chat-panel {
    height: 78vh;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .chat-confirm-card {
    max-width: 100%;
  }
}

/* ============ Forum Diskusi ============ */
.forum-topic-title {
  font-weight: 700;
}

.forum-topic-title a {
  color: var(--color-text);
}

.forum-topic-title a:hover {
  color: var(--color-primary);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.forum-post {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.forum-post:last-child {
  border-bottom: none;
}

.forum-post-body {
  flex: 1;
  min-width: 0;
}

.forum-post-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.forum-post-author {
  font-weight: 700;
  font-size: 0.9rem;
}

.forum-post-time {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.forum-post-text {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.forum-post-actions {
  margin-top: 6px;
}

.forum-post-actions form {
  display: inline;
}

/* ============ Pengaturan AI ============ */
.settings-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.settings-status > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-status strong {
  font-size: 0.95rem;
}

@media (max-width: 599px) {
  .settings-status {
    grid-template-columns: 1fr;
  }
}

.provider-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.provider-actions form {
  display: inline;
}

.btn-link-danger {
  color: var(--color-danger);
}

.field-hint {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* ============ Landing page ============ */
.landing-body {
  background: var(--color-surface);
  color: var(--color-text);
}

.landing-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.landing-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.landing-hero {
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-surface) 100%);
  padding: 72px 24px;
  overflow: hidden;
}

.landing-hero-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 48px;
}

.landing-hero-text h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.landing-hero-text p {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin: 0 0 28px;
  max-width: 480px;
}

.landing-hero-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-start;
}

/* ---- Statistik berjalan ---- */
.landing-stats {
  display: flex;
  gap: 28px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.landing-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.landing-stat strong {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary-dark);
}

.landing-stat span {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  max-width: 130px;
}

/* ---- Ilustrasi dashboard animasi (CSS murni, tanpa gambar/video eksternal) ---- */
.landing-hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.landing-mock-card {
  width: 100%;
  max-width: 340px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  padding: 18px;
  animation: mock-card-enter 0.7s ease-out both, mock-card-float 6s ease-in-out 0.7s infinite;
}

@keyframes mock-card-enter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mock-card-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.landing-mock-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.landing-mock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}

.landing-mock-dot:nth-child(1) { background: #f87171; }
.landing-mock-dot:nth-child(2) { background: #fbbf24; }
.landing-mock-dot:nth-child(3) { background: var(--color-success); }

.landing-mock-title {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.landing-mock-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.landing-mock-stat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  border-radius: 12px;
  padding: 10px 12px;
}

.landing-mock-stat .icon {
  color: var(--color-primary-dark);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.landing-mock-stat strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
}

.landing-mock-stat span {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.landing-mock-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 90px;
}

.landing-mock-bar {
  flex: 1;
  height: var(--h);
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 6px 6px 2px 2px;
  transform-origin: bottom;
  animation: bar-grow 0.6s ease-out both, bar-pulse 3.2s ease-in-out infinite;
  animation-delay: var(--delay), calc(var(--delay) + 0.6s);
}

@keyframes bar-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes bar-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.landing-float-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.74rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.landing-float-badge .icon {
  width: 16px;
  height: 16px;
  color: var(--color-primary-dark);
  flex-shrink: 0;
}

.landing-float-badge-ai {
  top: -14px;
  right: 4px;
  color: var(--color-primary-dark);
  animation: float-badge 4s ease-in-out 0.9s infinite;
}

.landing-float-badge-chat {
  bottom: -10px;
  left: -18px;
  animation: float-badge 4s ease-in-out 1.6s infinite;
}

@keyframes float-badge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---- Scroll-reveal ---- */
[data-animate] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  transition-delay: var(--reveal-delay, 0s);
}

[data-animate].is-visible {
  opacity: 1;
  transform: none;
}

.landing-feature-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.landing-feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

@media (prefers-reduced-motion: reduce) {
  .landing-mock-card,
  .landing-mock-bar,
  .landing-float-badge-ai,
  .landing-float-badge-chat {
    animation: none !important;
  }

  [data-animate] {
    transition: none !important;
  }
}

@media (max-width: 1023px) {
  .landing-hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .landing-hero-text {
    text-align: center;
  }

  .landing-hero-text p {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .landing-hero-actions {
    justify-content: center;
  }

  .landing-stats {
    justify-content: center;
  }

  .landing-stat {
    align-items: center;
  }

  .landing-hero-visual {
    margin-top: 8px;
  }
}

@media (max-width: 599px) {
  .landing-float-badge-chat {
    left: 0;
  }

  .landing-float-badge-ai {
    right: 0;
  }

  .landing-mock-card {
    max-width: 100%;
  }
}

.landing-section {
  padding: 64px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.landing-section-alt {
  max-width: none;
  background: var(--color-bg);
}

.landing-section-alt > * {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.landing-section-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 40px;
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.landing-feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.landing-feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.landing-feature-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 700;
}

.landing-feature-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.landing-steps {
  display: flex;
  gap: 24px;
}

.landing-step {
  flex: 1;
  text-align: center;
}

.landing-step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.landing-step h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-weight: 700;
}

.landing-step p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.86rem;
}

.landing-cta {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 64px 24px;
}

.landing-cta h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 800;
}

.landing-cta p {
  margin: 0 0 24px;
  opacity: 0.9;
}

.landing-cta .btn-primary {
  background: #fff;
  color: #0b7a5c;
}

.landing-footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

@media (max-width: 1023px) {
  .landing-feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-steps {
    flex-direction: column;
    gap: 32px;
  }
}

@media (max-width: 599px) {
  .landing-hero {
    padding: 48px 20px;
  }

  .landing-hero h1 {
    font-size: 1.8rem;
  }

  .landing-hero-actions {
    flex-direction: column;
  }

  .landing-feature-grid {
    grid-template-columns: 1fr;
  }

  .landing-section {
    padding: 44px 20px;
  }

  .landing-nav-actions {
    gap: 10px;
  }
}

/* ============ Tombol ganti tema (terang/gelap) ============ */
.theme-toggle .icon-moon {
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

.auth-brand .theme-toggle {
  margin-left: auto;
}
