/* ============================================================
   Tribratanews Polresta Sorong Kota — Admin Panel CSS
   Dark Mode Premium Design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  --bg-base:       #0b1120;
  --bg-surface:    #111827;
  --bg-card:       #1a2235;
  --bg-card-hover: #1f2b42;
  --sidebar-bg:    #0d1526;
  --sidebar-w:     260px;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --accent:         #3b82f6;
  --accent-hover:   #2563eb;
  --accent-glow:    rgba(59,130,246,.25);
  --accent-light:   rgba(59,130,246,.12);

  --success:        #22c55e;
  --success-light:  rgba(34,197,94,.12);
  --warning:        #f59e0b;
  --warning-light:  rgba(245,158,11,.12);
  --danger:         #ef4444;
  --danger-light:   rgba(239,68,68,.12);

  --border:         rgba(255,255,255,.06);
  --border-focus:   rgba(59,130,246,.5);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.5);

  --transition: .2s ease;
  --topbar-h:   64px;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

/* ── Layout ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}

.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition);
}

.main-content {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
}

/* ── Sidebar Brand ────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.sidebar-brand-icon {
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-title {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: .02em;
}

.brand-sub {
  display: block;
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ── Sidebar Nav ──────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
}

.nav-section-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: .75rem .5rem .35rem;
  margin-top: .5rem;
}

.sidebar-nav ul { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-link svg { flex-shrink: 0; opacity: .7; }

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

.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link.active svg { opacity: 1; }

/* ── Sidebar Footer ───────────────────────────────────────── */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.user-info { display: flex; align-items: center; gap: .625rem; flex: 1; min-width: 0; }

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-detail { min-width: 0; }

.user-name {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role { font-size: .7rem; color: var(--text-muted); }

.btn-logout {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-logout:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(10px);
}

.btn-menu {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  padding: .375rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-menu:hover { background: var(--accent-light); color: var(--accent); }

.topbar-title h1 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right { margin-left: auto; }

.topbar-time {
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 2rem 0;
  padding: .875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  animation: slideDown .3s ease;
}

.flash-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,.2); }
.flash-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid rgba(239,68,68,.2); }
.flash-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,.2); }
.flash-info    { background: var(--accent-light);  color: var(--accent);  border: 1px solid rgba(59,130,246,.2); }

.flash-close {
  background: none; border: none; cursor: pointer;
  color: inherit; font-size: 1rem; opacity: .7;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.flash-close:hover { opacity: 1; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--stat-color, var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--stat-color, var(--accent)); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  background: var(--stat-bg, var(--accent-light));
  flex-shrink: 0;
}

.stat-info { flex: 1; min-width: 0; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

/* Stat colors */
.stat-blue  { --stat-color: var(--accent);  --stat-bg: var(--accent-light); }
.stat-green { --stat-color: var(--success); --stat-bg: var(--success-light); }
.stat-amber { --stat-color: var(--warning); --stat-bg: var(--warning-light); }
.stat-red   { --stat-color: var(--danger);  --stat-bg: var(--danger-light); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.125rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; box-shadow: 0 0 0 3px var(--accent-glow); }

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(34,197,94,.2);
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-sm { padding: .375rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

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

thead {
  background: rgba(255,255,255,.03);
}

th {
  padding: .875rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,.025); }

.td-title {
  font-weight: 500;
  color: var(--text-primary);
  max-width: 300px;
}

.td-title a { color: var(--text-primary); }
.td-title a:hover { color: var(--accent); }

.table-img {
  width: 56px; height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.table-img-placeholder {
  width: 56px; height: 40px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
}

.action-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}

.badge-green   { background: var(--success-light); color: var(--success); }
.badge-amber   { background: var(--warning-light); color: var(--warning); }
.badge-blue    { background: var(--accent-light);  color: var(--accent); }
.badge-red     { background: var(--danger-light);  color: var(--danger); }
.badge-default { background: rgba(255,255,255,.06); color: var(--text-muted); }

/* ── Forms ────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 1.25rem;
}

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

.form-group { display: flex; flex-direction: column; gap: .4rem; }

label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .03em;
}

.form-control {
  width: 100%;
  padding: .65rem .9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: .9rem;
  transition: all var(--transition);
  outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}

textarea.form-control {
  resize: vertical;
  min-height: 200px;
  line-height: 1.7;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

select.form-control option { background: var(--bg-surface); }

.form-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* Image Upload */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-surface);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-area input[type="file"] {
  display: none;
}

.upload-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: .75rem;
  display: none;
}

.upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.upload-label { font-size: .875rem; color: var(--text-secondary); }
.upload-hint  { font-size: .75rem;  color: var(--text-muted); margin-top: .25rem; }

/* ── Quill.js Dark Theme ─────────────────────────────────── */
.ql-toolbar.ql-snow {
  background: var(--bg-surface);
  border: 1px solid var(--border) !important;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  padding: .6rem .75rem !important;
}

.ql-container.ql-snow {
  background: var(--bg-surface);
  border: 1px solid var(--border) !important;
  border-top: none !important;
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  font-family: inherit !important;
  font-size: .95rem !important;
  color: var(--text-primary);
  min-height: 350px;
}

.ql-editor {
  min-height: 350px;
  line-height: 1.7;
  color: var(--text-primary);
}

.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
}

.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
}

.ql-snow .ql-picker-options {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
}

.ql-snow .ql-picker-item:hover,
.ql-snow .ql-picker-item.ql-selected {
  color: var(--accent) !important;
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-picker-label:hover .ql-stroke {
  stroke: var(--accent) !important;
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent) !important;
}

.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header-left h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.page-header-left .breadcrumb {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 .3rem; }

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.filter-bar .form-group { min-width: 150px; margin: 0; }
.filter-bar .form-control { padding: .5rem .75rem; font-size: .85rem; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { margin-top: 1.5rem; display: flex; justify-content: center; }

.pagination ul {
  display: flex;
  align-items: center;
  gap: .3rem;
  list-style: none;
}

.pagination li a,
.pagination li.active a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.pagination li a:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.pagination li.active a { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination li.ellipsis { color: var(--text-muted); padding: 0 .25rem; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: .5; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: .5rem; }
.empty-state p  { font-size: .875rem; margin-bottom: 1.5rem; }

/* ── Dashboard Recent Table ───────────────────────────────── */
.recent-list { width: 100%; }

/* ── Login Page ───────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 10% 20%, rgba(59,130,246,.15) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(99,102,241,.1) 0%, transparent 50%),
    var(--bg-base);
}

.login-box {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: fadeUp .4s ease;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand .icon { font-size: 3rem; filter: drop-shadow(0 0 16px var(--accent-glow)); }

.login-brand h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: .75rem;
}

.login-brand p {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

.login-box .form-group { margin-bottom: 1rem; }

.login-box .btn-primary {
  width: 100%;
  justify-content: center;
  padding: .75rem;
  margin-top: .5rem;
  font-size: .95rem;
}

.login-error {
  background: var(--danger-light);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--danger);
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .75rem;
  color: var(--text-muted);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Confirm Dialog ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .25s ease;
}

.modal-icon { font-size: 2.5rem; text-align: center; margin-bottom: 1rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); text-align: center; }
.modal-body  { font-size: .875rem; color: var(--text-secondary); text-align: center; margin-top: .5rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1.5rem; }

/* ── Overlay & Mobile ─────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: .35rem .6rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.sidebar-close-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ── Content Grids ────────────────────────────────────────── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.kategori-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

/* ── Responsive Media Queries ─────────────────────────────── */
@media (max-width: 1024px) {
  .editor-grid {
    grid-template-columns: 1fr 280px;
    gap: 1.25rem;
  }

  .kategori-grid {
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
  }

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

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

  .kategori-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .kategori-form-card {
    order: -1; /* Form tambah / edit muncul di atas pada layar HP / tablet */
  }
}

@media (max-width: 580px) {
  .hide-on-mobile {
    display: none !important;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-w: 280px;
  }

  /* Prevent auto-zoom on iOS */
  input[type="text"],
  input[type="password"],
  input[type="datetime-local"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .sidebar {
    width: min(85vw, 300px);
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0,0,0,.7);
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-wrapper {
    margin-left: 0;
    width: 100%;
    overflow-x: hidden;
  }

  .btn-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
  }

  .main-content {
    padding: 1rem .875rem 2.5rem;
  }

  .topbar {
    padding: 0 1rem;
    height: 58px;
  }

  .topbar-title h1 {
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  .topbar-time {
    font-size: .75rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: .875rem;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    padding: 1rem;
    gap: .875rem;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .stat-label {
    font-size: .75rem;
  }

  .card {
    padding: 1.125rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    flex-wrap: wrap;
    gap: .75rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: .875rem;
    margin-bottom: 1.25rem;
  }

  .page-header .btn {
    justify-content: center;
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: .875rem;
    padding: 1rem;
  }

  .filter-bar .form-group {
    width: 100%;
    min-width: 0;
  }

  .filter-bar .form-group div[style*="display:flex"] {
    width: 100%;
  }

  .filter-bar .form-group div[style*="display:flex"] .btn {
    flex: 1;
    justify-content: center;
  }

  .table-wrapper {
    margin: 0 -1.125rem;
    border-radius: 0;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 580px;
  }

  .flash-message {
    margin: .625rem .875rem 0;
    padding: .75rem 1rem;
    font-size: .82rem;
  }

  .modal-box {
    width: calc(100% - 2rem);
    padding: 1.5rem;
    margin: 1rem;
  }

  .quick-links-grid {
    grid-template-columns: 1fr;
    gap: .875rem;
  }
}

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

  .topbar-time {
    display: none;
  }

  .login-box {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
  }

  .login-brand .icon {
    font-size: 2.5rem;
  }

  .login-brand h2 {
    font-size: 1.2rem;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Utilities ────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.font-mono    { font-family: 'Courier New', monospace; }
.w-full       { width: 100%; }
