/* ═════════════════════════════════════════════════════════════════
   SIMPAD LITE — Seamless Full-Width Minimalist UI
   Fluid Responsive Width · No Annoying Divider Lines · Clean Slate & Blue
   Bapperida Kota Metro
═════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --blue-600:  #2563eb;
  --blue-700:  #1d4ed8;
  --blue-50:   #eff6ff;
  --blue-100:  #dbeafe;
  
  --bg-page:   #f8fafc;
  --bg-card:   #ffffff;
  --border:    #e2e8f0;
  --border-sub: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════
   HEADER & NAVBAR (Seamless, No Extra Lines)
══════════════════════════════════ */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  width: 100%;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-wrap img {
  max-height: 34px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Centered Navigation Tabs */
.navbar-nav {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 1.25rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--slate-900);
  background: #ffffff;
}

.nav-link.active {
  background: #ffffff;
  color: var(--blue-600);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ══════════════════════════════════
   SEAMLESS PAGE TITLE BAR (No extra borders)
══════════════════════════════════ */
.page-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.page-header-bar h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.02em;
}

.page-header-bar p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ══════════════════════════════════
   MAIN CONTAINER (Full Fluid Responsive Size)
═══════════════════════════════ */
.main-wrapper {
  width: 100%;
  padding: 1.5rem 2rem;
  flex: 1;
}

/* ══════════════════════════════════
   BUTTONS
═══════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  line-height: 1.2;
}

.btn-primary {
  background: var(--blue-600);
  color: #ffffff;
  border-color: var(--blue-600);
}
.btn-primary:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.btn-secondary {
  background: #ffffff;
  color: var(--slate-900);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--border-sub);
}

.btn-danger {
  background: #ffffff;
  color: #b91c1c;
  border-color: #fee2e2;
}
.btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════
   STATS CARDS (Full Width Grid)
═══════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.03em;
  margin-top: 0.2rem;
  line-height: 1.1;
}

.stat-meta {
  font-size: 0.74rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ══════════════════════════════════
   CHARTS & CARDS
═══════════════════════════════ */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}

.card-header {
  padding: 0.95rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-900);
}

.card-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.card-body {
  padding: 1.35rem;
}

/* ══════════════════════════════════
   FILTER BAR (Full Width)
═══════════════════════════════ */
.filter-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto;
  gap: 0.85rem;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.form-control {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.48rem 0.8rem;
  outline: none;
  transition: border-color 0.12s ease;
  width: 100%;
}

.form-control:focus {
  border-color: var(--blue-600);
}

/* Time Chips */
.chip-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.chip-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.chip-item {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  text-decoration: none;
  transition: all 0.12s ease;
}

.chip-item:hover {
  background: #e2e8f0;
  color: var(--slate-900);
}

.chip-item.active {
  background: var(--blue-600);
  color: #ffffff;
}

/* ══════════════════════════════════
   DATA TABLE (Full Width Responsive)
═══════════════════════════════ */
.table-meta-bar {
  padding: 0.65rem 1.35rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-meta-bar strong {
  color: var(--slate-900);
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th {
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.8rem 1.35rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-main);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background-color: #f8fafc;
}

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

.td-number {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--slate-900);
  font-weight: 600;
}

.td-title-group .title-main {
  font-weight: 600;
  color: var(--slate-900);
  line-height: 1.35;
}

.td-title-group .title-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.td-date-group {
  white-space: nowrap;
  font-size: 0.78rem;
}

.td-date-group .date-sub {
  font-size: 0.68rem;
  color: var(--text-light);
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  background: #f1f5f9;
  color: var(--slate-800);
  border: 1px solid var(--border);
}

.badge.badge-accent {
  background: var(--blue-50);
  color: var(--blue-600);
  border-color: var(--blue-100);
}

/* ══════════════════════════════════
   PAGINATION
═══════════════════════════════ */
.pagination-wrapper {
  padding: 0.75rem 1.35rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  background: #ffffff;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #ffffff;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.12s ease;
}

.page-btn:hover:not(.disabled) {
  border-color: var(--border-sub);
  color: var(--slate-900);
  background: #f8fafc;
}

.page-btn.active {
  background: var(--slate-900);
  color: #ffffff;
  border-color: var(--slate-900);
}

.page-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ══════════════════════════════════
   EMPTY STATE
═══════════════════════════════ */
.empty-box {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.empty-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-900);
}

.empty-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ══════════════════════════════════
   MODAL
═══════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  overflow-y: auto;
}

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

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  margin: auto;
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-900);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--slate-900);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

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

.form-group.span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--slate-800);
}

.form-label .req {
  color: #dc2626;
  margin-left: 2px;
}

.form-textarea {
  resize: vertical;
  min-height: 75px;
}

.form-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  grid-column: span 2;
  margin-top: 0.35rem;
}

.penerima-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.penerima-row {
  display: flex;
  gap: 0.35rem;
}

.penerima-row input {
  flex: 1;
}

.btn-remove-row {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0 0.55rem;
  cursor: pointer;
}

.dropzone {
  border: 1px dashed var(--border-sub);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  background: #fafafa;
  transition: all 0.12s ease;
}

.dropzone:hover {
  border-color: var(--blue-600);
  background: #ffffff;
}

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

.dropzone span {
  color: var(--blue-600);
  font-weight: 600;
}

.file-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  margin-top: 0.4rem;
}

.app-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--slate-900);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 9999;
}

/* ══════════════════════════════════
   MODAL ENHANCEMENTS & LEMBAR DISPOSISI
═══════════════════════════════════ */
.modal-box {
  max-width: 680px;
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
}

.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.modal-body {
  padding: 1.25rem 1.4rem;
  max-height: 80vh;
  overflow-y: auto;
}

.form-control {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.52rem 0.8rem;
  font-size: 0.82rem;
  color: #1e293b;
  transition: all 0.12s ease;
}

.form-control:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.15rem;
}

.form-label .req {
  color: #ef4444;
  margin-left: 2px;
}

.section-routing-header {
  grid-column: span 2;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.85rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #e5e7eb;
}

.disposisi-grid {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.disposisi-col-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.55rem;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.77rem;
  color: #334155;
  margin-bottom: 0.45rem;
  cursor: pointer;
  user-select: none;
  line-height: 1.35;
}

.checkbox-item input[type="checkbox"] {
  margin-top: 0.15rem;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-other-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.checkbox-other-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-other-row input[type="text"] {
  flex: 1;
  padding: 0.38rem 0.65rem;
  font-size: 0.76rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.dropzone-clean {
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.dropzone-clean:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.dropzone-clean .drop-icon {
  color: #94a3b8;
}

.dropzone-clean p {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
}

.dropzone-clean span.link {
  text-decoration: underline;
  color: #0f172a;
  font-weight: 600;
}

.modal-footer {
  padding: 0.9rem 1.4rem;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-pill-cancel {
  background: #f1f5f9;
  color: #334155;
  border: none;
  border-radius: 9999px;
  padding: 0.48rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}

.btn-pill-cancel:hover {
  background: #e2e8f0;
}

.btn-pill-save {
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 0.48rem 1.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: background 0.12s ease;
}

.btn-pill-save:hover {
  background: #1e293b;
}

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: #ffffff;
  padding: 1rem 2rem;
}

.footer-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   LAYOUT — Sidebar + Main
══════════════════════════════════════════════════ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════
   SIDEBAR (Desktop: fixed left panel)
══════════════════════════════════════════════════ */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--slate-900);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.15rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.brand-text .app-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

.brand-text .app-sub {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  padding: 0.5rem 0.5rem 0.2rem;
  margin-top: 0.25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
  color: #f1f5f9;
  background: rgba(255,255,255,0.07);
}

.sidebar-nav .nav-link.active {
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  font-weight: 700;
}

.sidebar-nav .ni {
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-nav .nb {
  margin-left: auto;
  background: #1e40af;
  color: #bfdbfe;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
}

/* Sidebar Footer — User Info */
.sidebar-footer {
  padding: 0.75rem 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.su-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e40af;
  color: #bfdbfe;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.su-detail { flex: 1; min-width: 0; }
.su-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.su-role {
  font-size: 0.62rem;
  color: #64748b;
  margin-top: 1px;
}

.su-logout {
  color: #64748b;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
}
.su-logout:hover { color: #f87171; background: rgba(239,68,68,0.15); }

.sidebar-ver {
  font-size: 0.62rem;
  color: #334155;
  padding-top: 0.35rem;
}

/* Close button — mobile only */
.sidebar-close-btn {
  display: none;
}

/* ══════════════════════════════════════════════════
   MAIN CONTENT AREA
══════════════════════════════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-page);
}

/* TOPBAR */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.page-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.breadcrumb {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

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

/* Hide short labels on desktop */
.btn-label-short { display: none; }
.btn-label-full  { display: inline; }

/* Hide on mobile */
.topbar-hide-mobile { display: inline-flex; }

.content {
  flex: 1;
  padding: 1.5rem;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════════
   HAMBURGER BUTTON (hidden on desktop)
══════════════════════════════════════════════════ */
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 4.5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: #f1f5f9; }
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--slate-800);
  border-radius: 2px;
  transition: all 0.2s;
}

/* ══════════════════════════════════════════════════
   SIDEBAR OVERLAY (mobile backdrop)
══════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* Lock body scroll when sidebar is open */
body.sidebar-body-lock { overflow: hidden; }

/* ══════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════════════ */

/* Tablet landscape */
@media (max-width: 1100px) {
  .sidebar { width: 210px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .content { padding: 1.25rem; }
}

/* Tablet portrait & small laptop */
@media (max-width: 900px) {
  .topbar { padding: 0 1rem; }
  .content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile — sidebar geser dari KANAN */
@media (max-width: 767px) {
  /* Hamburger visible, di kanan */
  .hamburger-btn { display: flex; }

  /* Sidebar geser dari kanan */
  .sidebar {
    position: fixed;
    right: 0;
    left: auto;
    top: 0;
    height: 100%;
    width: 270px;
    transform: translateX(100%); /* mulai di luar kanan */
    z-index: 200;
    box-shadow: -4px 0 24px rgba(0,0,0,0.25);
  }

  .sidebar.open {
    transform: translateX(0); /* geser masuk dari kanan */
  }

  /* Tombol tutup sidebar — di kiri atas sidebar */
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.75rem 0.75rem 0;
    border-radius: 8px;
    transition: color 0.15s;
  }
  .sidebar-close-btn:hover { color: #f1f5f9; }

  /* Main takes full width */
  .main { width: 100%; }

  /* Topbar adjustments */
  .topbar {
    padding: 0 0.85rem;
    height: 52px;
    gap: 0.5rem;
  }

  .page-title { font-size: 0.88rem; }
  .breadcrumb { display: none; }

  /* Sembunyikan tombol tambah surat di topbar — sudah ada di sidebar */
  .topbar-hide-mobile { display: none !important; }

  /* Content padding */
  .content { padding: 0.85rem; }

  /* Stats — 2 kolom */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }

  /* Charts — single column */
  .chart-grid { grid-template-columns: 1fr; }

  /* Filter — stack vertically */
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  /* Table — horizontal scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data-table { min-width: 600px; }
  table.data-table th, table.data-table td { padding: 0.7rem 0.9rem; }

  /* Modal — muncul dari bawah */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }
  .modal-box { max-width: 100%; border-radius: 18px 18px 0 0; }
  .modal-body { max-height: 70vh; }

  /* Form grid — single column on mobile */
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .form-section-title { grid-column: span 1; }
  .section-routing-header { grid-column: span 1; }
  .disposisi-grid { grid-column: span 1; grid-template-columns: 1fr; }

  /* Pagination — centered */
  .pagination-wrapper { justify-content: center; flex-wrap: wrap; }

  /* Card body padding */
  .card-body { padding: 1rem; }
  .card-header { padding: 0.8rem 1rem; }

  /* Page header */
  .page-header-bar { flex-direction: column; align-items: flex-start; gap: 0.65rem; }
  .header-actions { width: 100%; justify-content: flex-end; }
}

/* Extra small mobile */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.5rem; }
  .content { padding: 0.65rem; }
  .topbar { padding: 0 0.65rem; }
}

/* ════════════════════════════════════════════════════
   MOBILE TOPBAR + SIDEBAR (dari layout-open.ejs)
════════════════════════════════════════════════════ */

.mob-topbar { display: none; }
.mob-sidebar { display: none; }
.mob-overlay { display: none; }

@media (max-width: 767px) {

  /* Sembunyikan header desktop */
  .app-header { display: none !important; }
  .navbar-container { display: none !important; }

  /* Tampilkan topbar mobile */
  .mob-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 54px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 150;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }

  .mob-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
  }

  /* ☰ Tombol 3 garis — pojok KANAN */
  .mob-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-hamburger:active { background: #f1f5f9; }
  .mob-hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #0f172a;
    border-radius: 2px;
  }

  /* Overlay gelap */
  .mob-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 299;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .mob-overlay.show { display: block; }

  /* Sidebar panel geser dari KANAN */
  .mob-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 280px;
    background: #0f172a;
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: -4px 0 28px rgba(0,0,0,0.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mob-sidebar.open { transform: translateX(0); }

  .mob-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
  }
  .mob-sidebar-brand { display: flex; align-items: center; gap: 0.5rem; }

  .mob-sidebar-close {
    background: rgba(255,255,255,0.08);
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-sidebar-close:active { background: rgba(255,255,255,0.18); }

  .mob-sidebar-nav {
    flex: 1;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mob-nav-group {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #475569;
    padding: 0.55rem 0.5rem 0.2rem;
    margin-top: 0.15rem;
  }

  .mob-nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-link:active { background: rgba(255,255,255,0.1); }
  .mob-nav-link.active { background: rgba(37,99,235,0.25); color: #93c5fd; font-weight: 700; }
  .mob-nav-link span { font-size: 1.05rem; flex-shrink: 0; }
  .mob-nav-logout { color: #f87171 !important; margin-top: 0.4rem; }

  .mob-sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
  }
  .mob-user { display: flex; align-items: center; gap: 0.6rem; }
  .mob-user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: #1e40af; color: #bfdbfe;
    font-size: 0.88rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }

  /* Main wrapper */
  .main-wrapper { padding-top: 0.85rem; }
  .page-header-bar h1 { font-size: 1.1rem; }
}
