/* ========================================
   New Features — Login, Filter, Share, Settings
   ======================================== */
.login-screen {
  align-items: center;
  background: var(--wash);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 200;
}
.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  padding: 40px 36px;
  width: 100%;
  animation: fadeSlideUp 500ms var(--ease-out) both;
}
.login-brand {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 28px;
  text-transform: uppercase;
}
.login-brand .brand-mark {
  height: 48px;
  width: 48px;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(194, 143, 43, 0.35);
}
.login-brand .brand-mark::after {
  font-size: 28px;
}
.login-brand .brand-name strong {
  color: var(--gold-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  letter-spacing: 0.12em;
}
.login-brand .brand-name em {
  color: var(--ink-secondary);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.55em;
}
.login-card form {
  display: grid;
  gap: 16px;
}
.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 44px;
}
.password-toggle {
  align-items: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  height: 100%;
  justify-content: center;
  padding: 0 14px;
  position: absolute;
  right: 0;
  top: 0;
  transition: color var(--transition);
}
.password-toggle:hover {
  color: var(--ink-secondary);
}
.password-toggle i {
  font-size: 18px;
}

.login-error {
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  min-height: 20px;
  text-align: center;
}
/* ========================================
   Overdue Banner
   ======================================== */
.overdue-banner {
  align-items: center;
  background: var(--red-soft);
  border: 1.5px solid var(--red);
  border-radius: var(--radius);
  display: none;
  gap: 10px;
  margin: 20px 0 16px;
  padding: 12px 16px;
  animation: fadeSlideUp 300ms var(--ease-out) both;
}
.overdue-icon {
  align-items: center;
  background: var(--red);
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 14px;
  height: 32px;
  justify-content: center;
  width: 32px;
}
.overdue-text {
  color: var(--ink);
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}
.overdue-text strong {
  color: var(--red);
}
.overdue-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
}
.overdue-close:hover {
  color: var(--ink);
}

/* Overdue table row */
tr.overdue-row td {
  border-left: 3px solid var(--red);
}
tr.overdue-row .status-pill {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red);
}

.filter-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  padding: 16px 22px;
}
.filter-row {
  align-items: end;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  gap: 6px;
  min-width: 160px;
}
.filter-label input {
  font-size: 13px;
  min-height: 38px;
  padding: 0 10px;
}
.share-link-info {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
  word-break: break-all;
}
.share-link-info a {
  color: var(--gold-dark);
  text-decoration: underline;
}
.share-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px clamp(16px, 6vw, 120px);
  animation: fadeSlideUp 450ms var(--ease-out) both;
}
/* Samakan lebar konten (termasuk invoice) dengan halaman detail backend:
   wrapper lebar memberi padding luar, anak dibatasi 1140px & dipusatkan. */
.share-page > * {
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
}
.share-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
}
.share-header .brand {
  opacity: 1;
  text-transform: uppercase;
}
.share-footer {
  margin-top: 24px;
  padding-top: 18px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.share-footer p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.share-list-banner {
  margin-bottom: 20px;
}
.share-list-banner-link {
  align-items: center;
  background: linear-gradient(135deg, rgba(194, 143, 43, 0.08) 0%, rgba(194, 143, 43, 0.03) 100%);
  border: 1.5px solid var(--line-gold);
  border-radius: var(--radius);
  color: var(--ink-secondary);
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  text-decoration: none;
  transition: all var(--transition);
}
.share-list-banner-link:hover {
  background: linear-gradient(135deg, rgba(194, 143, 43, 0.14) 0%, rgba(194, 143, 43, 0.06) 100%);
  border-color: var(--gold);
  box-shadow: var(--shadow-glow);
}
.banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.banner-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}
.banner-text strong {
  color: var(--gold-dark);
  font-weight: 700;
}
.banner-arrow {
  color: var(--gold-dark);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.share-list-banner-link:hover .banner-arrow {
  transform: translateX(4px);
}
.share-list-link {
  color: var(--gold-dark);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-gold);
  transition: color var(--transition);
}
.share-list-link:hover {
  color: var(--gold);
}
.share-list-intro {
  margin-bottom: 24px;
}
.share-list-intro h1 {
  font-size: 32px;
  margin: 0 0 6px;
}
.share-list-intro .muted {
  font-size: 14px;
  margin: 0;
}
.share-list-row {
  cursor: pointer;
  transition: background var(--transition);
}
.share-list-row:hover {
  background: rgba(194, 143, 43, 0.06);
}
#dbGuide h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--ink-secondary);
}
#dbGuide ol {
  margin: 0;
}
#dbGuide ol li {
  margin-bottom: 6px;
}
#logoutButton {
  color: var(--muted);
  border-color: transparent;
  font-size: 18px;
  min-height: 36px;
  min-width: 36px;
  padding: 0;
  line-height: 1;
}
#logoutButton:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: #e8b4b2;
}
#settingsButton {
  font-size: 13px;
}
.hidden {
  display: none !important;
}
@media (max-width: 640px) {
  .login-card { padding: 28px 24px; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-label { min-width: auto; }
  .share-page { padding: 20px 16px; }
  /* Share banner mobile */
  .share-list-banner-link { padding: 12px 14px; gap: 10px; }
  .banner-icon { font-size: 18px; }
  .banner-text { font-size: 13px; }
  .banner-arrow { font-size: 15px; }
}

/* --- Pagination --- */
.pagination-bar {
  align-items: center;
  border-top: 1px solid var(--line);
  display: none;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
}
.load-more-sentinel {
  display: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  text-align: center;
  transition: color 200ms;
}
.load-more-sentinel:hover {
  color: var(--gold-dark);
}

.pagination-bar .ghost-button {
  font-size: 13px;
  min-height: 36px;
  padding: 0 14px;
}
.client-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.client-name-cell {
  align-items: center;
  display: flex;
  font-weight: 600;
  gap: 6px;
  line-height: 1;
}
.client-name-cell i {
  color: var(--gold-dark);
  font-size: 12px;
  opacity: 0.7;
}
.client-phone-cell {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
}
.client-phone-cell i {
  font-size: 12px;
  color: var(--gold-dark);
  opacity: 0.7;
}

.pagination-bar .ghost-button:disabled {
  cursor: not-allowed;
}
.page-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
}

/* ========================================
   Dashboard Skeleton
   ======================================== */
.skel-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.skel-stat-title {
  width: 80px;
  height: 12px;
}
.skel-stat-value {
  width: 60px;
  height: 32px;
  border-radius: 8px;
}
.skel-stat-bar {
  width: 80%;
  height: 10px;
}

/* Dashboard skeleton rows — use table-row, not grid */
#invoiceRows > tr.skel-tr {
  display: table-row;
}
#invoiceRows > tr.skel-tr td {
  padding: 12px 16px;
}

/* Staggered entry animation for stats and rows */
#statsGrid > .stat-card,
#invoiceRows > tr:not(.skel-tr) {
  animation: fadeSlideUp 400ms var(--ease-out) both;
}
#statsGrid > .stat-card:nth-child(1) { animation-delay: 0ms; }
#statsGrid > .stat-card:nth-child(2) { animation-delay: 60ms; }
#statsGrid > .stat-card:nth-child(3) { animation-delay: 120ms; }
#statsGrid > .stat-card:nth-child(4) { animation-delay: 180ms; }
#invoiceRows > tr:nth-child(1) { animation-delay: 40ms; }
#invoiceRows > tr:nth-child(2) { animation-delay: 80ms; }
#invoiceRows > tr:nth-child(3) { animation-delay: 120ms; }
#invoiceRows > tr:nth-child(4) { animation-delay: 160ms; }
#invoiceRows > tr:nth-child(5) { animation-delay: 200ms; }

/* Smooth page transition with different timing per section */
.hero-row { animation: fadeSlideUp 350ms var(--ease-out) both; }
.filter-panel { animation: fadeSlideUp 400ms var(--ease-out) both; animation-delay: 50ms; }
.table-panel { animation: fadeSlideUp 450ms var(--ease-out) both; animation-delay: 100ms; }
.pagination-bar { animation: fadeSlideUp 350ms var(--ease-out) both; animation-delay: 250ms; }

/* ========================================
   Skeleton Loading
   ======================================== */
.invoice-skeleton {
  padding: 28px 32px;
}
.skel-top {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--line-gold);
}
.skel-row {
  display: flex;
  gap: 24px;
  align-items: center;
}
.skel-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  padding: 24px 0;
}
.skel-divider {
  height: 2px;
  background: var(--line-gold);
}
.skel-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 0;
}
.skel-th {
  display: grid;
  grid-template-columns: 30px 1.5fr 80px 100px 100px 100px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--wash);
  border-radius: var(--radius);
}
.skel-tr {
  display: grid;
  grid-template-columns: 30px 1.5fr 80px 100px 100px 100px;
  gap: 12px;
  padding: 12px 16px;
}
.skel-bottom {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--line-gold);
}
.skel-box {
  background: linear-gradient(90deg, #e8ddd0 25%, #f0e8de 50%, #e8ddd0 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.6s ease-in-out infinite;
}
.skel-line {
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, #e8ddd0 25%, #f0e8de 50%, #e8ddd0 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.6s ease-in-out infinite;
}
.skel-th .skel-line {
  height: 12px;
}
.skel-tr .skel-line {
  height: 12px;
}
@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========================================
   Dark Mode Float Button
   ======================================== */
.theme-float {
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--line-gold);
  border-radius: 50%;
  bottom: 24px;
  box-shadow: var(--shadow);
  color: var(--gold-dark);
  cursor: pointer;
  display: flex;
  height: 44px;
  justify-content: center;
  position: fixed;
  right: 24px;
  transition: background var(--transition), box-shadow var(--transition), color var(--transition), transform var(--transition);
  width: 44px;
  z-index: 999;
}
.theme-float:hover {
  box-shadow: var(--shadow-glow);
  color: var(--gold);
  transform: scale(1.08);
}
.theme-float i {
  font-size: 20px;
  pointer-events: none;
}


/* --- Badge "Terakhir diperbarui" (Harga Emas di Pengaturan) --- */
.update-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gold-dark);
  background: var(--gold-glow);
  border: 1px solid var(--line-gold);
  padding: 5px 12px;
  border-radius: 100px;
}
.update-badge i {
  font-size: 12px;
  color: var(--gold);
}
.update-badge strong {
  font-weight: 700;
  color: var(--ink);
}
[data-theme="dark"] .update-badge strong { color: var(--ink); }

/* ========================================
   Pengaturan — Harga Emas (form gaya daftar harga landing + auto-save)
   ======================================== */
.price-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.price-card-head h2 { margin: 0; }

/* Status auto-save */
.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  min-height: 28px;
}
.autosave-status.saving { color: var(--gold-dark); background: var(--gold-glow); }
.autosave-status.saved  { color: var(--green); background: var(--green-soft); }
.autosave-status.error  { color: var(--red); background: var(--red-soft); }

/* --- Kalkulator: input dasar --- */
.price-calc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calc-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}
.calc-hint {
  font-size: 11.5px;
  color: var(--muted);
}
/* input dengan suffix (%) di kanan */
.input-with-icon.suffix .input-suffix {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 14px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  pointer-events: none;
}
.input-with-icon.suffix input { padding-left: 14px; padding-right: 36px; }

/* --- Kartu Spread (keuntungan) --- */
.spread-card {
  margin: 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(232, 200, 106, 0.18) 0%, transparent 60%),
    var(--gold-gradient);
  box-shadow: var(--shadow-glow);
  color: #fff;
}
.spread-main { display: flex; flex-direction: column; gap: 4px; }
.spread-label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
}
.spread-label i { margin-right: 6px; }
.spread-value { display: flex; align-items: baseline; gap: 6px; }
.spread-value strong {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.spread-unit { font-size: 14px; opacity: 0.9; }
.spread-side { text-align: right; }
.spread-pct {
  display: inline-block;
  font-size: 16px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.22);
  margin-bottom: 8px;
}
.spread-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  opacity: 0.95;
}
.spread-sub strong { font-weight: 700; }
.spread-card.negative {
  background: linear-gradient(135deg, #c0392b 0%, #922b21 100%);
}

/* --- Tabel pecahan (hasil hitung) --- */
.price-bars-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.price-bars-head h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.price-bars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 18px;
}
/* Kolom penyesuaian aktif → baris butuh ruang ekstra untuk input ±Rp */
.price-bars-grid.adjust-on { grid-template-columns: repeat(2, 1fr); }
.bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash-warm);
}
.bar-row .pl-denom {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}
.bar-price {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold-dark);
  white-space: nowrap;
}
.bar-adjust {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.bar-adjust.hidden { display: none; }
.adjust-icon { font-size: 11px; color: var(--muted); font-weight: 700; }
.adjust-input {
  width: 84px;
  padding: 5px 8px;
  font-size: 12.5px;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
.adjust-input:focus { border-color: var(--gold); outline: none; }

@media (max-width: 720px) {
  .price-calc-grid { grid-template-columns: 1fr; }
  .price-bars-grid,
  .price-bars-grid.adjust-on { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .price-bars-grid,
  .price-bars-grid.adjust-on { grid-template-columns: 1fr; }
  .spread-side { text-align: left; }
}

/* ========================================
   Database PostgreSQL — Pengaturan
   ======================================== */

/* --- Settings Card (enhanced form-card) --- */
.s-card {
  position: relative;
  padding-top: 28px;
}
.s-card-head {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}
.s-card-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}
.s-card-icon {
  align-items: center;
  display: flex;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 16px;
  flex-shrink: 0;
}
.s-icon-accent {
  background: var(--gold-soft);
  color: var(--gold-dark);
}
.s-icon-gold {
  background: var(--gold-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(194, 143, 43, 0.25);
}
.s-icon-green {
  background: var(--green-soft);
  color: var(--green);
}
.s-icon-muted {
  background: var(--wash);
  color: var(--muted);
}

/* Highlight card — gold accent left border (auto on active panel) */
.settings-panel.active .s-card {
  border-left: none;
  overflow: hidden;
}
.settings-panel.active .s-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold-gradient);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

/* --- Settings Tab Navigation --- */
.settings-tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: var(--wash);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 10;
}
.settings-tab {
  align-items: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  gap: 7px;
  padding: 9px 16px;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}
.settings-tab:hover {
  color: var(--ink-secondary);
  background: rgba(194, 143, 43, 0.06);
}
.settings-tab.active {
  background: var(--paper);
  color: var(--gold-dark);
  box-shadow: var(--shadow-sm);
}
/* Active tab underline indicator */
.settings-tab.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--gold-gradient);
  animation: tabIndicatorIn 250ms ease-out;
}
@keyframes tabIndicatorIn {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}
.settings-tab i {
  font-size: 13px;
}

/* --- Settings Panel Show/Hide --- */
.settings-panel {
  display: none;
}
.settings-panel.active {
  display: block;
  animation: panelFadeIn 300ms ease-out;
}
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Password Strength Indicator --- */
/* Kolom Password & Konfirmasi disejajarkan dari atas agar input Konfirmasi tidak
   ikut ke tengah/bawah saat label Password tumbuh karena indikator kekuatan. */
.settings-panel[data-panel="sectionAccount"] .form-grid.two {
  align-items: start;
}
.pw-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  min-height: 16px;
}
.pw-strength-bar {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width 300ms var(--ease-out), background 300ms var(--ease-out);
}
.pw-strength-fill.level-weak { width: 33%; background: var(--red); }
.pw-strength-fill.level-fair { width: 66%; background: #e8a317; }
.pw-strength-fill.level-strong { width: 100%; background: var(--green); }
.pw-strength-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 54px;
}
.pw-strength-text.weak { color: var(--red); }
.pw-strength-text.fair { color: #e8a317; }
.pw-strength-text.strong { color: var(--green); }

/* --- Database Section --- */
.settings-panel[data-panel="sectionDatabase"] {
  display: none;
  flex-direction: column;
  gap: 20px;
}
.settings-panel[data-panel="sectionDatabase"].active {
  display: flex;
}
.db-section {
  padding: 28px 30px;
}

/* Header flex: judul kiri, badge kanan */
.db-section-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 20px;
}
.db-section-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}

/* Badge status */
.db-status-badge {
  align-items: center;
  background: var(--wash);
  border-radius: 20px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 7px;
  padding: 5px 14px 5px 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.db-status-dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
  flex-shrink: 0;
}
/* Warna badge berdasarkan state */
.db-badge-ok {
  background: var(--green-soft);
  color: var(--green);
}
.db-badge-ok .db-status-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.db-badge-error {
  background: var(--red-soft);
  color: var(--red);
}
.db-badge-error .db-status-dot {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}
.db-badge-loading {
  background: var(--wash-warm);
  color: var(--muted);
}
.db-badge-loading .db-status-dot {
  background: var(--muted);
  animation: dbPulse 1.2s ease-in-out infinite;
}
.db-badge-idle {
  background: var(--wash);
  color: var(--muted);
}
.db-badge-idle .db-status-dot {
  background: var(--muted);
  opacity: 0.5;
}

@keyframes dbPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Grid info koneksi — 3 kolom */
.db-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 18px;
  background: var(--wash);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.db-info-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.db-info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.db-info-label i {
  font-size: 11px;
  width: 14px;
  text-align: center;
  color: var(--gold-dark);
}
.db-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
  font-family: 'Inter', monospace;
}

/* Statistik ringkas (ukuran DB, jumlah tabel) */
.db-stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.db-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 100px;
}
.db-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.db-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Baris aksi Backup / Restore */
.db-action-row {
  align-items: center;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.db-action-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
}
.db-action-info strong {
  font-size: 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
}
.db-action-info .muted {
  font-size: 13px;
}

/* --- Guide Accordion --- */
.guide-accordion {
  margin-bottom: 12px;
}
.guide-accordion:last-child {
  margin-bottom: 0;
}
.guide-accordion-btn {
  align-items: center;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-secondary);
  padding: 12px 16px;
  width: 100%;
  transition: all var(--transition);
}
.guide-accordion-btn:hover {
  background: var(--wash-warm);
  border-color: var(--line-gold);
}
.guide-accordion-btn.active {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom-color: transparent;
  color: var(--gold-dark);
}
.guide-accordion-arrow {
  font-size: 12px;
  transition: transform 300ms var(--ease-out);
  color: var(--muted);
}
.guide-accordion-btn.active .guide-accordion-arrow {
  transform: rotate(180deg);
  color: var(--gold);
}
.guide-accordion-body {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  max-height: 0;
  transition: max-height 350ms var(--ease-out);
}
.guide-accordion-body.open {
  max-height: 800px;
}

/* --- Guide Steps (visual step cards) --- */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
}
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  position: relative;
  transition: background var(--transition);
}
.guide-step:hover {
  background: var(--wash-warm);
}
/* Connector line between steps */
.guide-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 36px;
  bottom: -12px;
  width: 2px;
  background: var(--line);
}
.guide-step-num {
  align-items: center;
  display: flex;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.guide-step-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}
.guide-step-body strong {
  font-size: 14px;
  color: var(--ink);
}
.guide-step-body .muted {
  font-size: 13px;
}
.guide-step-body code {
  display: inline-block;
  font-size: 13px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 8px;
  margin-top: 2px;
  color: var(--brown-soft);
}

/* Dark theme overrides */
[data-theme="dark"] .db-status-badge.db-badge-ok {
  background: rgba(34, 197, 94, 0.12);
}
[data-theme="dark"] .db-status-badge.db-badge-error {
  background: rgba(239, 68, 68, 0.12);
}
[data-theme="dark"] .db-info-grid {
  background: var(--wash-warm);
}
[data-theme="dark"] .s-icon-accent {
  background: rgba(212, 164, 58, 0.15);
  color: var(--gold-light);
}
[data-theme="dark"] .settings-panel.active .s-card::before {
  background: var(--gold-gradient);
}
[data-theme="dark"] .settings-tab.active {
  background: var(--paper);
  color: var(--gold-light);
}
[data-theme="dark"] .settings-tab:hover {
  background: rgba(212, 164, 58, 0.08);
}
[data-theme="dark"] .guide-accordion-btn {
  background: var(--wash);
}
[data-theme="dark"] .guide-accordion-btn:hover {
  background: var(--wash-warm);
}
[data-theme="dark"] .guide-accordion-body {
  background: var(--wash);
}
[data-theme="dark"] .guide-step:hover {
  background: var(--wash-warm);
}
[data-theme="dark"] .guide-step-num {
  background: rgba(212, 164, 58, 0.18);
  color: var(--gold-light);
}
[data-theme="dark"] .guide-step-body code {
  background: var(--paper);
  color: var(--brown);
}

/* Responsive */
@media (max-width: 720px) {
  .db-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .db-section-head {
    flex-direction: column;
    gap: 10px;
  }
  .db-action-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .settings-tab-nav {
    gap: 2px;
  }
  .settings-tab {
    padding: 8px 12px;
    font-size: 12px;
  }
  .settings-tab span {
    display: none;
  }
  .s-card-head {
    gap: 10px;
  }
}
@media (max-width: 480px) {
  .db-info-grid {
    grid-template-columns: 1fr;
  }
}
