/* ============================================================
   Dashboard CSS — sidebar, stat cards, tabel, chart
   Font utama tetap: Times New Roman
   ============================================================ */

.dash-body { background: var(--bg-alt); }
.dash-body .navbar { display: none; }

/* ---------- Sidebar ---------- */
.dash-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 258px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 200;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 18px 18px; border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}
.sidebar-brand a { display: flex; align-items: center; text-decoration: none; }
.sidebar-brand .brand-logo { max-height: 36px; }
.sidebar-brand .brand-name { font-size: 1.2rem; }
.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.side-section {
  font-size: .72rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
  padding: 16px 10px 6px;
}
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-soft); text-decoration: none; font-weight: 600;
  font-size: .94rem; margin-bottom: 2px; transition: all var(--transition);
  white-space: normal; overflow-wrap: break-word; min-width: 0;
}
.side-link svg { flex-shrink: 0; }
.side-link:hover { background: var(--surface-2); color: var(--accent); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.side-logout {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger);
  border: 0; cursor: pointer; font-family: var(--font-main);
  font-size: .94rem; font-weight: 700;
}
.side-logout:hover { filter: brightness(.95); }

/* ---------- Main area ---------- */
.dash-main { margin-left: 258px; min-height: 100vh; display: flex; flex-direction: column; }
.dash-topbar {
  position: sticky; top: 0; z-index: 90;
  height: var(--nav-height);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 600; }
.sidebar-open { display: none; }
.dash-content { flex: 1; padding: 26px 28px 40px; }
.dash-footer {
  padding: 14px 28px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .82rem;
}
.dash-overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 24, .5);
  z-index: 190; display: none;
}

/* ---------- Dash head ---------- */
.dash-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-head h1 { font-size: 1.6rem; margin: 0; }
.dash-head p { color: var(--text-soft); margin: 0; flex: 1; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { padding: 18px; display: flex; flex-direction: column; gap: 2px; transition: all var(--transition); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  color: var(--c, var(--accent)); margin-bottom: 8px;
}
.stat-num { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .86rem; }

/* ---------- Panels & tables ---------- */
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 1.1rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-alt); }
.table .cell-title { max-width: 340px; font-weight: 600; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.comment-cell { display: flex; gap: 10px; align-items: flex-start; max-width: 380px; }
.comment-cell p { margin: 0; font-size: .88rem; }

/* ---------- List rows ---------- */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px dashed var(--border);
  text-decoration: none;
}
.list-row:last-child { border-bottom: 0; }
.list-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
a.list-row-title:hover { color: var(--accent); }
.list-row-meta { display: flex; align-items: center; gap: 10px; }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar .input { min-width: 160px; }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 260px; }

/* ---------- Profile ---------- */
.profile-top { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.profile-top h4 { margin: 0 0 4px; font-size: 1.2rem; }

/* ---------- Editor form extras ---------- */
.slug-row { display: flex; align-items: center; gap: 8px; }
.slug-prefix {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 11px 12px; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: .88rem; color: var(--muted); border-right: 0;
}
.slug-row .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; flex: 1; }
.editor-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.editor-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.editor-actions .btn-block { width: 100%; }

/* ---------- Dev: error entries ---------- */
.error-entry { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.error-entry summary {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px;
  cursor: pointer; background: var(--surface-2); list-style: none;
}
.error-entry summary::-webkit-details-marker { display: none; }
.error-time { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.error-msg { flex: 1; font-weight: 700; color: var(--danger); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error-stack {
  margin: 0; padding: 14px; font-size: .78rem; overflow-x: auto;
  background: #0d1321; color: #a5b4cf;
}
[data-theme="dark"] .error-stack { background: #0a0f1a; }

/* ---------- Dev: backup & settings ---------- */
.logo-preview {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; background: var(--bg-alt);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  margin-bottom: 14px; padding: 10px;
}
.logo-img { max-height: 60px; width: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
}

@media (max-width: 768px) {
  .dash-sidebar { left: -100%; transform: none; box-shadow: var(--shadow-lg); width: min(280px, 85vw); transition: left .25s ease; }
  .dash-sidebar.open { left: 0; }
  .sidebar-close { display: inline-flex; }
  .dash-main { margin-left: 0; }
  .sidebar-open { display: inline-flex; }
  .dash-overlay.show { display: block; }
  .dash-content { padding: 20px 16px 32px; }
  .topbar-title { display: none; }
  .topbar-user span:not(.role-badge) { display: none; }
  .editor-side { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
