/**
 * Design system terpusat — MEI022 ARJ Marketing Dashboard
 * Palet netral enterprise, tipografi Inter, komponen konsisten.
 */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --surface-hover: #f0f2f5;
  --text: #111827;
  --text-secondary: #4b5563;
  --muted: #6b7280;
  --line: #e2e6eb;
  --line-strong: #cdd3dc;

  --primary: #0f4c81;
  --primary-hover: #0c3d68;
  --primary-soft: #e8f0f8;
  --primary-border: #b8cfe4;

  --success: #047857;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;

  --sidebar-bg: #15202b;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(15, 76, 129, 0.35);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow: 0 4px 16px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.08);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-width: 264px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  background: var(--surface-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 20px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

.brand small,
.brand span {
  display: block;
  color: var(--sidebar-text);
  font-size: 12px;
  font-weight: 400;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 0 12px;
  margin-bottom: -8px;
}

.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  color: #94a3b8;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.nav-icon i { width: 15px; height: 15px; stroke-width: 2; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-meta { min-width: 0; flex: 1; }

.user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta span {
  display: block;
  font-size: 11px;
  color: var(--sidebar-text);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.btn-logout i { width: 15px; height: 15px; }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 24px 28px 64px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 520px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-actions { display: flex; gap: 8px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}

a.topbar-user:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.topbar-user .user-avatar { width: 32px; height: 32px; font-size: 12px; }

.topbar-user .user-meta strong { color: var(--text); font-size: 12px; }
.topbar-user .user-meta span { font-size: 11px; }

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  margin: 5px 0;
}

body.drawer-open::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  z-index: 50;
}

/* ── Buttons ── */
.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

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

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

.btn-soft {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.btn-soft:hover { background: var(--primary-soft); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: var(--surface-muted); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.btn-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.btn-sm { padding: 6px 10px; min-height: 32px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── Layout grids ── */
.grid { display: grid; gap: 16px; }

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

/* KPI cards — full color + watermark icon (CSS only) */
.kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: none;
  color: #fff;
  box-shadow: 0 10px 28px var(--kpi-glow, rgba(15, 76, 129, 0.25));
}

.kpi-card::before {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 72px;
  opacity: 0.22;
  background: center / contain no-repeat;
  pointer-events: none;
}

.kpi-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  right: -40px;
  bottom: -50px;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.kpi-card small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}

.kpi-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
}

.kpi-card span {
  display: block;
  font-size: 12px;
  opacity: 0.88;
}

.kpi-green  { background: linear-gradient(135deg, #065f46, #10b981); --kpi-glow: rgba(16, 185, 129, 0.35); }
.kpi-green::before  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4'/%3E%3C/svg%3E"); }

.kpi-blue   { background: linear-gradient(135deg, #1e3a8a, #3b82f6); --kpi-glow: rgba(59, 130, 246, 0.35); }
.kpi-blue::before   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"); }

.kpi-red    { background: linear-gradient(135deg, #991b1b, #ef4444); --kpi-glow: rgba(239, 68, 68, 0.35); }
.kpi-red::before    { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3'/%3E%3C/svg%3E"); }

.kpi-orange { background: linear-gradient(135deg, #9a3412, #f59e0b); --kpi-glow: rgba(245, 158, 11, 0.35); }
.kpi-orange::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 12a2.25 2.25 0 00-2.25-2.25H15a3 3 0 11-6 0H5.25A2.25 2.25 0 003 12m18 0v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 9m18 0V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v3'/%3E%3C/svg%3E"); }

.kpi-purple { background: linear-gradient(135deg, #5b21b6, #8b5cf6); --kpi-glow: rgba(139, 92, 246, 0.35); }
.kpi-purple::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M2.25 18.75a60.07 60.07 0 0115.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 013 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 00-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 01-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 003 15h-.375M15 10.5a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3C/svg%3E"); }

.kpi-teal   { background: linear-gradient(135deg, #115e59, #14b8a6); --kpi-glow: rgba(20, 184, 166, 0.35); }
.kpi-teal::before   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.941'/%3E%3C/svg%3E"); }

.kpi-indigo { background: linear-gradient(135deg, #3730a3, #6366f1); --kpi-glow: rgba(99, 102, 241, 0.35); }
.kpi-indigo::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z'/%3E%3C/svg%3E"); }

.kpi-rose   { background: linear-gradient(135deg, #be123c, #fb7185); --kpi-glow: rgba(251, 113, 133, 0.35); }
.kpi-rose::before   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z'/%3E%3C/svg%3E"); }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ── Forms & filters ── */
.filter-panel {
  padding: 0;
  overflow: hidden;
  margin-bottom: 20px;
}

.filter-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.filter-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-toggle i { width: 18px; height: 18px; color: var(--primary); }

.filter-chevron {
  transition: transform 0.2s ease;
  color: var(--muted);
}

.filter-panel.is-open .filter-chevron { transform: rotate(180deg); }

.filter-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.filter-body { display: block; }

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  padding: 16px;
}

.filter-panel .filters {
  margin-bottom: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.filter-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-actions-row .btn { flex: 1; min-width: 120px; }

.resi-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resi-form-grid .form-group-label {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}

.resi-form-grid .form-group-label:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.resi-form-grid .field-span-2 {
  grid-column: span 2;
}

@media (max-width: 820px) {
  .resi-form-grid { grid-template-columns: 1fr; }
  .resi-form-grid .field-span-2 { grid-column: span 1; }
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}

.form-left { text-align: left; }
.mt-16 { margin-top: 16px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }

/* ── Tables ── */
.card:has(> .page-head + .table-wrap),
.card:has(> .section-title + .table-wrap) {
  padding-bottom: 0;
  overflow: hidden;
}

.card > .page-head + .table-wrap,
.card > .section-title + .table-wrap {
  margin-top: 4px;
}

.card > .table-wrap + .pagination {
  padding: 16px 20px 20px;
  margin-top: 0;
}

.card > .table-wrap:only-child,
.card > .table-wrap:first-child:last-child {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-wrap {
  overflow: auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

.table th,
.table td {
  padding: 14px 18px;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.table th {
  background: #eef2f7;
  color: var(--primary);
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #dde4ed;
  white-space: nowrap;
}

.table td {
  border-bottom: 1px solid #eef1f5;
  color: var(--text);
}

.table tbody tr {
  transition: background 0.15s ease;
}

.table tbody tr:hover td {
  background: #f8fafc;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .col-no {
  width: 52px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.table .cell-main {
  font-weight: 600;
  color: var(--text);
}

.table .cell-sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.4;
}

.table .cell-stack {
  display: grid;
  gap: 2px;
}

.cell-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.cell-copy > span,
.cell-copy > b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

.copy-btn.is-copied {
  background: var(--success-soft);
  color: var(--success);
  border-color: #a7f3d0;
}

.copy-btn i { width: 14px; height: 14px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.badge.green  { background: #dcfce7; color: #15803d; }
.badge.red    { background: #fee2e2; color: #b91c1c; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.blue   { background: #dbeafe; color: #1d4ed8; }
.badge.gray   { background: #f1f5f9; color: #475569; }
.badge.brown  { background: #9a3412; color: #fff; }
.badge.purple { background: #ede9fe; color: #6d28d9; }

.split { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 16px; }

/* ── Alerts ── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-weight: 500;
  font-size: 13px;
}

.alert.success { background: var(--success-soft); color: var(--success); border: 1px solid #a7f3d0; }
.alert.error   { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecdca; }
.alert.info    { background: var(--info-soft); color: var(--info); border: 1px solid #bae6fd; }

.upload-zone {
  border: 2px dashed var(--line-strong);
  background: var(--surface-muted);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
}

.muted { color: var(--muted); }

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.pagination a {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pagination a:hover { background: var(--surface-muted); border-color: var(--line-strong); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-nav { padding: 7px 9px; }
.pagination .page-nav.disabled { opacity: 0.4; pointer-events: none; }
.pagination .page-nav i { width: 14px; height: 14px; }
.pagination .dots { padding: 0 4px; color: var(--muted); font-weight: 500; }

.chart-box { height: 320px; }
.mini-chart { width: 100%; height: 280px; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mobile-bottom-nav { display: none; }

.summary-list { display: grid; gap: 6px; }

.summary-list div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.summary-list b { color: var(--text); font-weight: 600; }

.status-row { display: flex; gap: 8px; flex-wrap: wrap; }

.page-tabs { margin-bottom: 16px; }

.tab-nav {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab-item:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.tab-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.tab-item i { width: 16px; height: 16px; }

.page-tabs-nested { margin-top: -4px; margin-bottom: 16px; }
.page-tabs-nested .tab-nav { padding: 4px; background: var(--surface-muted); }

.empty { padding: 32px; text-align: center; color: var(--muted); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.page-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.page-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform 0.15s, background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.action-icon:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.action-icon-view {
  color: #2563eb;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.action-icon-view:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.action-icon-edit {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.action-icon-edit:hover {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.action-icon-danger {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}

.action-icon-danger:hover {
  background: #fee4e2;
  border-color: #fda29b;
  color: #912018;
}

.action-icon i { width: 16px; height: 16px; }
button.action-icon { cursor: pointer; font: inherit; padding: 0; }

.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.section-stack { display: grid; gap: 16px; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.meta-list { display: grid; gap: 8px; }

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* ── Auth / Login ── */
.auth-body {
  min-height: 100vh;
  margin: 0;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card-login {
  width: min(100%, 400px);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  padding: 36px 32px 32px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.auth-logo-stack {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(145deg, #0f4c81, #1d6bb8);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 20px rgba(15, 76, 129, 0.35);
}

.auth-logo-stack h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-logo-stack p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-form { display: grid; gap: 16px; }

.auth-submit {
  margin-top: 4px;
  min-height: 44px;
  font-size: 14px;
}

.auth-card-login .input {
  min-height: 44px;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    width: min(82vw, 300px);
    z-index: 60;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 16px 16px 88px;
  }

  .hamburger { display: block; }
  .topbar-actions { display: none; }
  .topbar-user { display: none; }
  .topbar h1 { font-size: 20px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 14px; }

  .filter-toggle { display: flex; }

  .filter-panel:not(.is-open) .filter-body { display: none; }

  .filter-panel .filters { border-top: 1px solid var(--line); }

  .filter-actions-row { flex-direction: column; }
  .filter-actions-row .btn { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr; }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    z-index: 40;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 12px rgba(17, 24, 39, 0.04);
  }

  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    padding: 8px 4px;
    border-radius: var(--radius-sm);
  }

  .mobile-bottom-nav a.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .mobile-bottom-nav i { width: 18px; height: 18px; }

  .footer { flex-direction: column; text-align: center; }
  .table th, .table td { font-size: 12px; padding: 12px 14px; }
  .table-actions { gap: 6px; }
  .action-icon { width: 34px; height: 34px; }
  .copy-btn { width: 26px; height: 26px; }
  .card { padding: 16px; }
}

@media (max-width: 520px) {
  .filters { grid-template-columns: 1fr; }
  .section-title { flex-direction: column; align-items: flex-start; }
  .btn { width: 100%; }
  .status-row .btn { width: auto; }
  .kpi strong { font-size: 22px; }
  .page-head { flex-direction: column; }
  .auth-card-login { padding: 24px 20px; }
}
