:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --info: #0891b2;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-light: #64748b;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Login (desain split-screen) ---------- */
.login-page-v2 { margin: 0; min-height: 100vh; }
.login-split {
  display: flex;
  min-height: 100vh;
}

/* --- Panel kiri: gelap, branding + hero --- */
.login-split-left {
  flex: 1.1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 48px;
  background:
    radial-gradient(ellipse 900px 500px at 30% 30%, rgba(96,165,250,0.18), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #1e3a8a 55%, #1d4ed8 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.login-left-topbar { display: flex; align-items: center; gap: 12px; }
.login-left-logo-sm { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.login-left-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.login-left-brand-title { font-weight: 700; font-size: 15px; }
.login-left-brand-subtitle { font-size: 12px; color: rgba(255,255,255,0.65); font-weight: 600; }

.login-left-hero { text-align: center; max-width: 460px; margin: 0 auto; }
.login-left-logo-lg {
  width: 110px; height: 110px; border-radius: 24px; object-fit: cover;
  margin-bottom: 22px; box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.login-wordmark {
  font-size: 34px; font-weight: 800; letter-spacing: 0.02em; color: #fff; line-height: 1.15;
}
.login-wordmark .accent {
  background: linear-gradient(90deg, #f472b6, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-left-tagline {
  margin: 18px auto 0; color: rgba(255,255,255,0.75); font-size: 14px; line-height: 1.65; max-width: 420px;
}
.login-left-tagline strong { color: #fff; }
.login-left-footer { font-size: 12px; color: rgba(255,255,255,0.45); }

/* --- Panel kanan: terang, form login --- */
.login-split-right {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: linear-gradient(160deg, #eff6ff 0%, #f8fafc 100%);
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 380px;
  padding: 40px 36px 32px;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15,23,42,0.12);
  text-align: center;
}
.login-card-logo { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; margin-bottom: 12px; }
.login-wordmark-sm {
  font-size: 20px;
  margin-bottom: 22px;
  color: var(--text);
}
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 13px; margin: 14px 0 6px; font-weight: 600; color: var(--text); }
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
}
.login-card input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.login-card .alert { text-align: left; margin-top: 16px; }
.login-card .btn-block { margin-top: 22px; }
.login-card-footer { margin: 22px 0 0; font-size: 11.5px; color: var(--text-light); }

@media (max-width: 880px) {
  .login-split-left { display: none; }
  .login-split-right { flex: 1; }
}

/* ---------- Layout ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-title { font-weight: 700; font-size: 16px; color: var(--primary-dark); }
.brand-subtitle { font-size: 12px; color: var(--text-light); font-weight: 600; }
.topbar .user-info { font-size: 13px; color: var(--text-light); display: flex; align-items: center; gap: 14px; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px; width: 100%; flex: 1 0 auto; }
.container-fluid { max-width: 1600px; }

.app-footer {
  text-align: center;
  padding: 20px 24px 26px;
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* ---------- Cards / Table ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 17px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-light); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: #fff;
}
.badge-warning { background: var(--warning); }
.badge-danger { background: var(--danger); }
.badge-success { background: var(--success); }
.badge-info { background: var(--info); }
.badge-secondary { background: #64748b; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 7px;
  border: none; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; color: #fff; background: var(--primary);
}
.btn:hover { background: var(--primary-dark); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-secondary { background: #64748b; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info { background: #e0f2fe; color: #075985; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 14px;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1 1 220px; }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.empty-state { text-align: center; padding: 40px; color: var(--text-light); }

/* ---------- Viewer ---------- */
.viewer-wrap { display: flex; gap: 16px; align-items: flex-start; }
.viewer-main { flex: 1; min-width: 0; }
.viewer-sidebar { width: 320px; flex-shrink: 0; }
.toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px;
  flex-wrap: wrap;
}
.toolbar button {
  padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; font-weight: 600;
}
.toolbar button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.toolbar .sep { width: 1px; background: var(--border); align-self: stretch; margin: 0 4px; }
.color-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border); cursor: pointer;
}
.color-dot.active { box-shadow: 0 0 0 2px var(--text); }

#pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.page-wrap { position: relative; box-shadow: 0 2px 10px rgba(0,0,0,0.1); background: #fff; }
.page-wrap canvas.pdf-canvas { display: block; }
.page-wrap canvas.annot-canvas { position: absolute; top: 0; left: 0; }
.page-number-tag {
  position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.6);
  color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px;
}

.annot-list { max-height: 500px; overflow-y: auto; }
.annot-item {
  padding: 10px; border: 1px solid var(--border); border-radius: 7px; margin-bottom: 8px; font-size: 13px;
}
.annot-item .meta { color: var(--text-light); font-size: 11px; margin-bottom: 4px; }
.annot-item .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

.stage-track { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.stage-step {
  padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: #e2e8f0; color: var(--text-light);
}
.stage-step.done { background: var(--success); color: #fff; }
.stage-step.current { background: var(--primary); color: #fff; }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  align-items: center; justify-content: center; z-index: 1000;
  padding: 16px; overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: 10px; padding: 20px; width: 100%; max-width: 420px; }
.modal-box h3 { margin-top: 0; }

/* ---------- Combobox pencarian pegawai (Dalnis/Daltu/Kepala Perwakilan) ---------- */
.emp-picker {
  position: relative;
}
.emp-picker-input-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding-right: 6px;
}
.emp-picker-input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.emp-picker-search {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
  background: transparent;
}
.emp-picker-clear {
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}
.emp-picker-clear:hover { color: var(--danger); }
.emp-picker-dropdown {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.emp-picker-dropdown.open { display: block; }
.emp-picker-item {
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
}
.emp-picker-item:hover { background: var(--bg); }
.emp-picker-nip { color: var(--text-light); font-size: 12px; }
.emp-picker-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-light);
}

/* ---------- Dashboard baru: sidebar + filter atas + baris dokumen ---------- */
.dashboard-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}
.dashboard-sidebar {
  width: 230px;
  flex-shrink: 0;
  position: sticky;
  top: 16px;
}
.dashboard-main {
  flex: 1;
  min-width: 0;
}
.sidebar-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-top: 14px;
}
.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  padding: 4px 8px 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
}
.sidebar-link:hover { background: var(--bg); }
.sidebar-link.active { background: var(--primary); color: #fff; }
.sidebar-link.active .sidebar-count { background: rgba(255,255,255,0.25); color: #fff; }
.sidebar-count {
  background: var(--bg);
  color: var(--text-light);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  min-width: 20px;
  text-align: center;
}
.sidebar-link-inbox { font-weight: 600; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.filter-search { flex: 1; min-width: 200px; }
.filter-sd { color: var(--text-light); font-size: 13px; }

.doc-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.doc-row-main { flex: 1; min-width: 260px; }
.doc-title { font-weight: 700; font-size: 15px; }
.doc-title-link { color: var(--text); text-decoration: none; }
.doc-title-link:hover { color: var(--primary); text-decoration: underline; }
.doc-nomor { color: var(--text-light); font-weight: 500; font-size: 13px; }
.doc-sub { color: var(--text-light); font-size: 13px; margin-top: 2px; }
.doc-meta-cols {
  display: flex;
  gap: 32px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.doc-meta-label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}
.doc-row-actions {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.doc-action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.status-btn { border: none; color: #fff; cursor: pointer; }
.status-btn.badge-warning { background: var(--warning); }
.status-btn.badge-danger { background: var(--danger); }
.status-btn.badge-success { background: var(--success); }
.status-btn.badge-secondary { background: var(--text-light); }

/* ---------- Modal PDF (full-page) & Timeline ---------- */
.modal-overlay#pdf-modal,
.modal-overlay#timeline-modal { padding: 0; }

/* Modal PDF dibuat hampir penuh layar - tetap ada margin tipis + tombol close jelas */
.modal-box-lg {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.modal-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { color: #fff; background: var(--danger); }

#pdf-modal-frame { flex: 1; width: 100%; border: 0; }

/* Panel aksi Setujui/Kembalikan langsung di dalam modal pratinjau PDF */
.modal-review-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.modal-review-stage {
  width: 100%;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 2px;
}
.modal-review-nomor-wrap { flex: 1; min-width: 220px; }
.modal-review-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
}
.modal-review-textarea {
  flex: 2;
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  resize: vertical;
  min-height: 40px;
  max-height: 100px;
  font-family: inherit;
}
.modal-review-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.modal-review-buttons .btn { white-space: nowrap; }

/* ---------- Modal Timeline (Alur Reviu Berjenjang) ---------- */
#timeline-modal .modal-box {
  width: 94vw;
  max-width: 660px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
#timeline-modal .modal-pdf-header { padding: 18px 24px; }
#timeline-body { padding: 6px 24px 22px !important; }

.timeline { position: relative; display: flex; flex-direction: column; }
.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
}
.timeline-item::before {
  /* garis penghubung vertikal antar tahap */
  content: '';
  position: absolute;
  left: 14px;
  top: 36px;
  bottom: -14px;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  margin-top: 2px;
  z-index: 1;
  box-shadow: 0 0 0 4px #fff;
}
.timeline-dot.action-kembalikan { background: var(--danger); }
.timeline-dot.action-upload { background: var(--text-light); }
.timeline-dot.action-penomoran { background: var(--info); }
.timeline-content {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
}
.timeline-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.timeline-who { min-width: 0; }
.timeline-name { font-weight: 700; font-size: 14px; color: var(--text); }
.timeline-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.timeline-meta-sep { color: var(--border); }
.timeline-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.timeline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.timeline-time { font-size: 11.5px; color: var(--text-light); }
.timeline-note {
  margin-top: 10px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

/* ---------- Modal lebar (Edit Dokumen / Upload Dokumen) ---------- */
.modal-box-md { width: 100%; max-width: 720px; }
.modal-box-xl { width: 100%; max-width: 960px; }
#edit-modal .modal-box,
#upload-modal .modal-box {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#edit-modal-body,
#upload-modal-body { overflow-y: auto; }

.upload-form-grid { display: flex; gap: 28px; flex-wrap: wrap; }
.upload-form-col { flex: 1; min-width: 240px; }

/* ---------- Redesign dashboard: sidebar & kartu dokumen ---------- */
.sidebar-icon { margin-right: 2px; }

/* ---------- Dropdown menu nama pengguna (avatar + nama + Keluar) di topbar ---------- */
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; cursor: pointer;
  padding: 5px 8px 5px 5px; border-radius: 999px;
  font: inherit; font-size: 13px; color: var(--text);
}
.user-menu-trigger:hover { background: var(--bg); }
.user-menu-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-caret { color: var(--text-light); font-size: 11px; }
.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15,23,42,0.14);
  min-width: 220px;
  overflow: hidden;
  z-index: 60;
}
.user-menu-dropdown.show { display: block; }
.user-menu-info { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.user-menu-info-name { font-weight: 700; font-size: 13px; color: var(--text); }
.user-menu-info-role { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.user-menu-item {
  display: block; padding: 10px 14px; font-size: 13px;
  color: var(--text); text-decoration: none;
}
.user-menu-item:hover { background: var(--bg); }

/* ---------- Modal konfirmasi generik (pengganti confirm() bawaan browser) ---------- */
/* Modal konfirmasi harus SELALU tampil di atas modal lain (mis. saat modal Upload/Edit
   sedang terbuka lalu memicu konfirmasi) - kalau z-index-nya sama, modal yang ditulis
   belakangan di HTML (Upload/Edit) akan menutupi modal konfirmasi ini sehingga tombol
   "Ya, Lanjutkan" tidak kelihatan/tidak bisa diklik dan proses terasa macet total. */
#confirm-modal { z-index: 2100; }
.confirm-modal-box { max-width: 380px; text-align: center; padding: 30px 26px 24px; }
.confirm-modal-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(37,99,235,0.1); color: var(--primary);
  font-size: 22px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.confirm-modal-icon-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.confirm-modal-message { font-size: 14.5px; color: var(--text); line-height: 1.55; margin-bottom: 22px; }
.confirm-modal-buttons { display: flex; gap: 10px; justify-content: center; }
.confirm-modal-buttons .btn { flex: 1; margin-top: 0; }

/* ---------- Toast notifikasi (mis. konfirmasi berhasil logout) ---------- */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.16);
  padding: 14px 40px 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text);
  min-width: 260px;
  max-width: 360px;
  z-index: 2000;
  overflow: hidden;
}
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close {
  position: absolute; top: 8px; right: 8px;
  border: none; background: transparent; color: var(--text-light);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 3px 7px; border-radius: 6px;
}
.toast-close:hover { background: var(--bg); color: var(--danger); }
.toast-progress {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: var(--success); width: 100%;
  animation: toast-progress-shrink 4s linear forwards;
}
@keyframes toast-progress-shrink {
  from { width: 100%; }
  to { width: 0%; }
}

.btn-upload-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
  border: none;
  width: 100%;
  cursor: pointer;
}
.btn-upload-cta:hover { background: linear-gradient(135deg, var(--primary-dark), #1e40af); }

.doc-row {
  border-left: 4px solid var(--border);
  transition: box-shadow .15s ease, transform .15s ease;
}
.doc-row:hover { box-shadow: 0 8px 22px rgba(15,23,42,0.09); transform: translateY(-1px); }
.doc-row.doc-status-diajukan { border-left-color: var(--primary); }
.doc-row.doc-status-selesai { border-left-color: var(--success); }
.doc-row.doc-status-revisi { border-left-color: var(--danger); }

.topbar { box-shadow: 0 1px 3px rgba(15,23,42,0.05); }
.topbar .brand { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* =========================================================================
   RESPONSIVE - Tablet & Mobile
   Semua halaman didesain awal untuk layar desktop. Blok di bawah ini
   menyesuaikan tata letak untuk tablet (mis. iPad) dan HP tanpa mengubah
   apapun untuk tampilan desktop yang sudah ada.
   ========================================================================= */

/* ---------- Tablet (mis. iPad potret, layar <=1024px) ---------- */
@media (max-width: 1024px) {
  /* Dashboard: sidebar filter jadi baris horizontal di atas, bukan kolom
     tetap 230px di samping yang bikin konten utama sempit di tablet. */
  .dashboard-layout { flex-direction: column; gap: 14px; }
  .dashboard-sidebar {
    width: 100%;
    position: static;
    top: auto;
  }
  .dashboard-sidebar .btn-upload-cta { width: 100%; }
  .sidebar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
  }
  .sidebar-group-title { width: 100%; }
  .sidebar-link { flex: 1 1 auto; white-space: nowrap; }

  /* Viewer PDF + panel Riwayat Versi: jadi tumpuk vertikal supaya PDF
     tetap dapat lebar penuh, bukan diimpit sidebar 320px. */
  .viewer-wrap { flex-direction: column; }
  .viewer-sidebar { width: 100%; }

  .dashboard-main .filter-bar .filter-search { flex-basis: 100%; }
}

/* ---------- Mobile (HP, layar <=640px) ---------- */
@media (max-width: 640px) {
  .container, .container-fluid { padding: 14px; }

  .topbar { padding: 10px 14px; flex-wrap: wrap; row-gap: 8px; }
  .brand-logo { width: 38px; height: 38px; }
  .brand-title { font-size: 14px; }
  .brand-subtitle { display: none; }
  .topbar .user-info { gap: 8px; }
  .user-menu-name { max-width: 100px; }

  .card { padding: 14px; }

  /* Tabel (mis. daftar pengguna di halaman admin) - geser ke samping
     lewat scroll horizontal daripada kolomnya diimpit/berantakan. */
  table { font-size: 12.5px; }
  th, td { padding: 8px; }

  .filter-bar { gap: 8px; }
  .filter-bar input[type="text"],
  .filter-bar input[type="date"],
  .filter-bar select { flex: 1 1 auto; }
  .filter-search { flex-basis: 100%; }

  .doc-row { gap: 12px; padding: 14px; }
  .doc-meta-cols { gap: 16px; }
  .doc-row-actions { gap: 14px; }

  .modal-box,
  .modal-box-md,
  .modal-box-xl { max-width: 100%; }

  .upload-form-grid { gap: 14px; }

  .modal-review-footer { padding: 10px 14px; }
  .modal-review-nomor-wrap,
  .modal-review-textarea { flex-basis: 100%; }
  .modal-review-buttons { width: 100%; }
  .modal-review-buttons .btn { flex: 1; }

  /* Login: kurangi padding kartu supaya tidak terlalu sempit di layar kecil */
  .login-card { padding: 30px 22px 24px; }
  .login-split-right { padding: 18px; }

  .timeline-badges { justify-content: flex-start; }
}
