:root {
  --bg: #f8f5f0;
  --bg-deep: #f0ebe3;
  --surface: #fffcf8;
  --surface-input: #faf6f0;
  --surface-muted: #f5efe6;
  --border: #e8e0d4;
  --text: #2d2926;
  --text-muted: #7a7268;
  --primary: #2c4a6e;
  --primary-hover: #233d5c;
  --primary-light: #e8eef5;
  --accent: #d4a24e;
  --accent-hover: #bf8f3f;
  --accent-light: #faf3e4;
  --success: #2d6a4f;
  --danger: #b84a3a;
  --shadow: 0 4px 20px rgba(45, 41, 38, 0.07);
  --shadow-lg: 0 12px 36px rgba(45, 41, 38, 0.1);
  --shadow-hover: 0 8px 28px rgba(45, 41, 38, 0.12);
  --radius: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.28s;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 8px;
  text-align: left;
  transition: background 0.15s;
}

.app-header__brand:hover { background: var(--surface-muted); }

.app-header__logo-img {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform var(--duration) var(--ease-out);
}

.app-header__brand:hover .app-header__logo-img {
  transform: scale(1.04);
}

.app-header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.app-header p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-header__nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-group__label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.nav-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.app-header__account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header__user {
  font-size: 0.78rem;
  color: var(--primary);
  padding: 0.3rem 0.65rem;
  background: var(--primary-light);
  border-radius: 20px;
  font-weight: 500;
}

.autosave-indicator {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 500;
  animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--duration) var(--ease-smooth),
    color var(--duration) var(--ease-smooth),
    border-color var(--duration) var(--ease-smooth),
    transform var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-smooth);
  white-space: nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.97); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover:not(:disabled) { background: var(--accent-hover); }

.btn--secondary { background: var(--primary-light); color: var(--primary); }
.btn--secondary:hover:not(:disabled) { background: #d5e3f5; }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); }

.btn--sm { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
.btn--lg { padding: 0.7rem 1.4rem; font-size: 0.9rem; }
.btn--danger { color: var(--danger) !important; border-color: #f5c6cb !important; }

/* ── Dashboard ── */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.5rem;
}

.dashboard__hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.dashboard__hero h2 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.dashboard__hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

.stat-card--primary {
  border-color: rgba(212, 162, 78, 0.25);
  background: linear-gradient(145deg, var(--surface) 0%, var(--accent-light) 100%);
}

.stat-card__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

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

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

.panel--wide { grid-column: 1 / -1; }

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.panel h3 {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.panel__header h3 { margin: 0; }

.panel__desc {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.panel__desc code {
  font-size: 0.72rem;
  background: #eef2f6;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.panel--berkas-list { margin-bottom: 1.25rem; }

/* BPR Berkas Grid */
.bpr-berkas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.bpr-berkas-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-muted) 100%);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease-smooth),
    box-shadow var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

.bpr-berkas-card:hover {
  border-color: rgba(212, 162, 78, 0.45);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.bpr-berkas-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.bpr-berkas-card__code {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.bpr-berkas-card__folder {
  font-size: 1.4rem;
  line-height: 1;
}

.bpr-berkas-card__name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.bpr-berkas-card__contact {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.bpr-berkas-card__meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.bpr-berkas-card__meta strong {
  display: block;
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 700;
}

/* Berkas Detail View */
.berkas-view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
}

.berkas-view__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.berkas-view__title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.berkas-view__code {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #2d6cb5);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 12px;
  letter-spacing: 0.05em;
}

.berkas-view__title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.berkas-view__path {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

.berkas-view__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 700px) {
  .berkas-view__stats { grid-template-columns: repeat(2, 1fr); }
}

.erkas-stat,
.berkas-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  text-align: center;
}

.berkas-stat__val {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.berkas-stat__lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.berkas-view__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}

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

.report-cards--berkas {
  max-height: 480px;
  overflow-y: auto;
}

/* BPR Chart */
.bpr-chart { display: flex; flex-direction: column; gap: 0.65rem; }

.bpr-chart__item { display: flex; align-items: center; gap: 0.65rem; }

.bpr-chart__label {
  width: 110px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bpr-chart__bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--surface-muted);
  border-radius: 4px;
  overflow: hidden;
}

.bpr-chart__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4a6f94);
  border-radius: 4px;
  transition: width 0.55s var(--ease-out);
}

.bpr-chart__count {
  width: 28px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

/* Draft card */
.draft-card {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-input);
}

.draft-card--empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.draft-card--active {
  border-style: solid;
  border-color: rgba(201, 162, 39, 0.4);
  background: var(--accent-light);
}

.draft-card strong { display: block; margin-bottom: 0.25rem; }
.draft-card span { font-size: 0.8rem; color: var(--text-muted); }

/* Report cards */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.report-cards--modal {
  max-height: 360px;
  overflow-y: auto;
  grid-template-columns: 1fr;
}

.report-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--surface-input);
  transition: border-color var(--duration) var(--ease-smooth),
    box-shadow var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

.report-card:hover {
  border-color: rgba(212, 162, 78, 0.35);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.report-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.report-card__ba {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
}

.report-card__bpr {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.report-card__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.report-card__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* ── Editor Layout ── */
.app-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: calc(100vh - 65px);
}

@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 1fr; }
  .app-header__nav .nav-group__label { display: none; }
  .nav-divider { display: none; }
}

.mobile-tabs {
  display: none;
  grid-column: 1 / -1;
  padding: 0.5rem 1rem 0;
  gap: 0.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 1024px) {
  .mobile-tabs { display: flex; }
  .form-panel.is-hidden-mobile,
  .preview-panel.is-hidden-mobile { display: none; }
}

.mobile-tabs__btn {
  flex: 1;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-input);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
}

.mobile-tabs__btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Step nav */
.step-nav {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.step-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-input);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.step-nav__item span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--border);
  font-size: 0.65rem;
  font-weight: 700;
}

.step-nav__item.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.step-nav__item.is-active span {
  background: var(--primary);
  color: #fff;
}

/* Form */
.form-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(100vh - 65px);
}

.form-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child { border-bottom: none; }

.form-section h2, .mt-sub {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.mt-sub { margin-top: 1rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-header h2 { margin: 0; }

.field { margin-bottom: 0.75rem; }

.field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.field--required label::after {
  content: ' *';
  color: var(--danger);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--surface-input);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.12);
  background: #fff;
}

.field--error input,
.field--error select,
.field--error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: flex; gap: 0.5rem; }
.field-row input { flex: 1; }

.hasil-list { display: flex; flex-direction: column; gap: 0.5rem; }

.hasil-item { display: flex; gap: 0.5rem; align-items: flex-start; }

.hasil-item__num {
  width: 22px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hasil-item textarea {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.84rem;
  resize: vertical;
  min-height: 52px;
  background: var(--surface-input);
}

.hasil-item__remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.5;
}

.hasil-item__remove:hover { opacity: 1; }

.form-section--actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Preview */
.preview-panel {
  padding: 1.25rem 1.5rem 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 65px);
  background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
}

.preview-toolbar {
  max-width: 210mm;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.preview-toolbar__badges {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.preview-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.72rem;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge--draft { background: #fff3cd; color: #856404; }
.status-badge--final { background: #d4edda; color: var(--success); }

.document-wrap {
  display: flex;
  justify-content: center;
}

.document {
  position: relative;
  width: 100%;
  max-width: 210mm;
  min-height: 297mm;
  background: #fff;
  padding: 18mm 20mm 22mm;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-serif);
  font-size: 11pt;
  line-height: 1.65;
  color: #111;
  overflow: hidden;
}

.doc-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-size: 5rem;
  font-weight: 800;
  color: rgba(201, 162, 39, 0.12);
  letter-spacing: 0.2em;
  pointer-events: none;
  transform: rotate(-35deg);
  user-select: none;
}

.document.is-final .doc-watermark { display: none; }

.doc-header { margin-bottom: 1.5rem; }

.doc-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.doc-header__left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.doc-logo {
  height: 52px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  flex-shrink: 0;
}

.doc-header__bpr {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
  max-width: 200px;
  margin-left: auto;
}

.doc-bpr-logo {
  height: 56px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 0.25rem;
}

.doc-bpr-name {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.doc-header__company { flex: 1; min-width: 0; }

.doc-company {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.doc-tagline {
  margin: 0.15rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.doc-header__rule {
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, var(--primary) 100%);
  border-radius: 2px;
  margin-bottom: 0.85rem;
}

.doc-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc-meta {
  margin: 0 0 1.25rem;
  padding: 0.75rem 0;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  display: grid;
  gap: 0.3rem;
}

.doc-meta__row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.5rem;
  font-size: 10.5pt;
}

.doc-meta dt { font-weight: 700; margin: 0; }
.doc-meta dd { margin: 0; }

.doc-section { margin-bottom: 1.1rem; }

.doc-section h2 {
  margin: 0 0 0.4rem;
  font-size: 10.5pt;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  font-family: var(--font-sans);
}

.doc-text { margin: 0; text-align: justify; }
.doc-list { margin: 0; padding-left: 1.2rem; }
.doc-list li { margin-bottom: 0.3rem; text-align: justify; }

.doc-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2.5rem;
  text-align: center;
}

.signature-label { margin: 0; font-weight: 600; }
.signature-space { height: 65px; }
.signature-name { margin: 0; font-size: 10pt; }

.doc-footer {
  margin-top: 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 8pt;
  color: #888;
}

/* Modals */
.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(45, 41, 38, 0.45);
  animation: fadeIn 0.25s var(--ease-smooth) both;
}

.modal[open] .modal__content {
  animation: modalIn 0.32s var(--ease-out) both;
}

.modal--wide { max-width: 960px; }
.modal__content { display: flex; flex-direction: column; }

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

.modal__header h2 { margin: 0; font-size: 1rem; }

.modal__close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal__body { padding: 1.25rem 1.35rem; }
.modal__hint { margin: 0 0 0.85rem; font-size: 0.82rem; color: var(--text-muted); }
.modal__footer { padding: 0.85rem 1.35rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.chip {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-input);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.chip.is-active,
.chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.reports-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reports-filters select,
.reports-filters input {
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  background: var(--surface-input);
}

.reports-filters input { flex: 1; min-width: 140px; }

.reports-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
}

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

.reports-panel h3 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--primary);
}

.bpr-add {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.bpr-add input {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
}

.bpr-add input:first-child,
.bpr-add input:nth-child(3),
.bpr-add .btn { grid-column: 1 / -1; }

.bpr-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }

.bpr-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.45rem;
  background: var(--surface-input);
}

.bpr-list__info strong { display: block; font-size: 0.85rem; }
.bpr-list__info span { font-size: 0.74rem; color: var(--text-muted); }

.bpr-list__actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.bpr-list__btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  font-family: inherit;
}

.bpr-list__btn--edit { color: var(--primary); }
.bpr-list__btn--delete { color: var(--danger); border-color: #f5c6cb; }
.bpr-list__btn--reactivate { color: var(--success); border-color: #c3e6cb; }

.bpr-list__item--inactive {
  opacity: 0.65;
  background: #f5f5f5;
}

.bpr-list__badge {
  font-size: 0.65rem;
  background: #eee;
  color: #666;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  margin-left: 0.35rem;
}

.berkas-view__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn--danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f5c6cb;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.btn--danger-outline:hover {
  background: #fdecea;
}

.edit-bpr-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.edit-bpr-grid .field:first-child { grid-column: 1 / -1; }
.edit-bpr-grid .field:nth-child(3) { grid-column: 1 / -1; }

.edit-bpr-templates h3 {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--primary);
}

.edit-bpr-templates .admin-only {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.edit-bpr-templates.is-readonly {
  opacity: 0.55;
  pointer-events: none;
}

.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.field-hint--warn { color: #856404; }

.file-tree {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--surface-input);
  font-size: 0.78rem;
}

.file-tree-empty { margin: 0; color: var(--text-muted); }
.file-tree__year { margin-bottom: 0.65rem; }
.file-tree__year-label { font-weight: 700; color: var(--primary); margin-bottom: 0.3rem; }
.file-tree__folder { font-weight: 600; margin: 0.3rem 0 0.15rem 0.5rem; }
.file-tree__folder span { color: var(--text-muted); font-weight: 400; }
.file-tree__files { margin: 0 0 0 1rem; padding: 0; list-style: none; }
.file-tree__file { color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 0.7rem; }

/* Loading & Toast */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 300;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  font-size: 0.84rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.95);
  opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-smooth);
  z-index: 200;
  max-width: 360px;
}

.toast.show { transform: translateY(0) scale(1); opacity: 1; }
.toast--success { background: var(--success); }

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #2c4a6e 0%, #3d5f7a 35%, var(--bg) 70%);
}

.login-aurora__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: auroraFloat 18s ease-in-out infinite;
}

.login-aurora__blob--1 {
  width: 420px;
  height: 420px;
  background: rgba(212, 162, 78, 0.35);
  top: -10%;
  left: -5%;
  animation-delay: 0s;
}

.login-aurora__blob--2 {
  width: 360px;
  height: 360px;
  background: rgba(44, 74, 110, 0.4);
  bottom: 10%;
  right: -8%;
  animation-delay: -6s;
}

.login-aurora__blob--3 {
  width: 280px;
  height: 280px;
  background: rgba(198, 123, 92, 0.25);
  top: 40%;
  left: 50%;
  animation-delay: -12s;
}

.login-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.1s both;
}

.login-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

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

.login-logo-img {
  height: 72px;
  width: auto;
  max-width: 220px;
  margin: 0 auto 1rem;
  display: block;
  object-fit: contain;
}

.login-brand h1 { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.login-brand .login-tagline { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.login-brand .login-sub { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--accent); font-weight: 500; }

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.login-field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.login-field input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface-input);
}

.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.12);
}

.login-password-wrap { display: flex; gap: 0.35rem; }
.login-password-wrap input { flex: 1; }

.login-toggle-pass {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 0.7rem;
  cursor: pointer;
}

.login-error {
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: #fdecea;
  color: var(--danger);
  border-radius: 8px;
  font-size: 0.82rem;
}

.login-error.hidden { display: none; }
.btn--full { width: 100%; padding: 0.7rem; }

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

/* ── Animations ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes auroraFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

@keyframes autosavePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Skeleton loading */
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  display: inline-block;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--bg-deep) 45%,
    var(--surface-muted) 90%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s var(--ease-smooth) infinite;
  border-radius: 6px;
  min-height: 0.85em;
  vertical-align: middle;
}

.skeleton-text--stat {
  width: 3.5rem;
  height: 1.75rem;
  min-height: 1.75rem;
  border-radius: 8px;
}

.skeleton-text--short { width: 42%; min-height: 0.75em; }
.skeleton-text--badge { width: 2.8rem; height: 1.25rem; border-radius: 6px; }
.skeleton-text--xs { width: 2.5rem; height: 0.7rem; border-radius: 4px; }
.skeleton-text--chart-label { width: 2.2rem; height: 0.75rem; flex-shrink: 0; }
.skeleton-text--chart-count { width: 1.2rem; height: 0.75rem; flex-shrink: 0; }

.skeleton-bpr-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--surface);
}

.skeleton-meta-row {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.skeleton-chart-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.skeleton-chart-bar {
  flex: 1;
  height: 0.55rem;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--bg-deep) 45%,
    var(--surface-muted) 90%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s var(--ease-smooth) infinite;
}

.skeleton-draft { min-height: 5.5rem; }

.skeleton-report-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stat-card__value--counting {
  transition: transform 0.15s var(--ease-out);
}

.view-enter {
  animation: fadeSlideUp 0.32s var(--ease-out) both;
}

.stagger-in {
  animation: fadeSlideUp 0.4s var(--ease-out) both;
}

.autosave-indicator:not([hidden]) {
  animation: autosavePulse 1.4s ease-in-out infinite;
}

.panel,
.stat-card {
  transition: box-shadow var(--duration) var(--ease-smooth);
}

.panel:hover,
.stat-card:hover {
  box-shadow: var(--shadow-hover);
}

.loading-overlay:not(.hidden) {
  animation: fadeIn 0.2s var(--ease-smooth) both;
}

.chip {
  transition: background var(--duration) var(--ease-smooth),
    color var(--duration) var(--ease-smooth),
    border-color var(--duration) var(--ease-smooth),
    transform var(--duration) var(--ease-out);
}

.chip:active { transform: scale(0.96); }

.step-nav__item {
  transition: background var(--duration) var(--ease-smooth),
    border-color var(--duration) var(--ease-smooth),
    color var(--duration) var(--ease-smooth),
    transform var(--duration) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .login-aurora__blob { animation: none; }
  .view-enter, .stagger-in { animation: none; }
  .skeleton-text, .skeleton-chart-bar { animation: none; }
  .bpr-chart__bar { transition: none; }
}

/* Setup */
.setup-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
}

.setup__hero {
  margin-bottom: 1.25rem;
}

.setup__hero h2 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.35rem;
  color: var(--primary);
}

.setup__hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.setup-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setup-tabs__btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--duration) var(--ease-smooth), color var(--duration) var(--ease-smooth);
}

.setup-tabs__btn:hover { background: var(--surface-muted); color: var(--text); }

.setup-tabs__btn.is-active {
  background: var(--primary);
  color: #fff;
}

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

.setup-card--wide { grid-column: 1 / -1; }

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

.setup-card h3 { margin: 0 0 1rem; font-size: 0.9rem; color: var(--primary); }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.toggle-row input { width: 1rem; height: 1rem; accent-color: var(--accent); }

.backup-status {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.logo-upload {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo-upload__preview {
  height: 80px;
  width: auto;
  max-width: 200px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#f0f2f5 0% 25%, #fff 0% 50%) 50% / 12px 12px;
  object-fit: contain;
}

.logo-upload__actions { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }

.logo-upload__placeholder {
  display: grid;
  place-items: center;
  min-width: 120px;
  height: 80px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.edit-bpr-logo {
  margin: 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.edit-bpr-logo h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.access-matrix {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.access-matrix__row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}

.access-matrix__row:last-child { border-bottom: none; }
.access-matrix__head { background: var(--surface-muted); font-weight: 600; color: var(--primary); }
.access-matrix__row span:not(:first-child) { text-align: center; }

.setup-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.setup-table th,
.setup-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.setup-table th {
  background: var(--surface-muted);
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

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

.setup-table__actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.log-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.log-badge--ok { background: #e8f5ee; color: var(--success); }
.log-badge--fail { background: #fdecea; color: var(--danger); }

.field--checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--surface-input);
}

/* Print */
@media print {
  body { background: #fff; }

  .app-header,
  .form-panel,
  .preview-toolbar,
  .mobile-tabs,
  .toast,
  .loading-overlay,
  .doc-watermark { display: none !important; }

  .app-layout { display: block; min-height: auto; }

  .preview-panel {
    padding: 0;
    max-height: none;
    overflow: visible;
    background: #fff;
  }

  .document {
    box-shadow: none;
    max-width: none;
    width: 100%;
    min-height: auto;
    padding: 15mm 18mm;
  }

  .document.is-final .doc-watermark { display: none; }

  @page { size: A4; margin: 0; }
}