/* Gaya aplikasi tambahan di atas utility Tailwind. */
:root {
  --focus-ring: 0 0 0 3px rgba(16, 185, 129, 0.28);
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  overflow-x: auto;
}

body {
  min-height: 100vh;
  margin: 0;
  padding-bottom: 16px;
  overflow-x: visible;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

#pageHorizontalScroll {
  position: fixed;
  z-index: 80;
  right: 0;
  bottom: 0;
  left: 0;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
  scrollbar-width: auto;
  scrollbar-color: #64748b #e2e8f0;
}

#pageHorizontalScrollContent {
  height: 1px;
  pointer-events: none;
}

#pageHorizontalScroll::-webkit-scrollbar {
  height: 15px;
}

#pageHorizontalScroll::-webkit-scrollbar-track {
  background: #e2e8f0;
}

#pageHorizontalScroll::-webkit-scrollbar-thumb {
  background: #64748b;
  border: 3px solid #e2e8f0;
  border-radius: 999px;
}

@media print {
  #pageHorizontalScroll { display: none !important; }
}

button, input, select, textarea {
  font: inherit;
}

button, label, select, input[type="file"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.custom-scroll {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}

.custom-scroll::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

input[type="file"]::file-selector-button {
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

td, th {
  vertical-align: middle;
  overflow-wrap: anywhere;
}

/* Mencegah dialog melampaui layar pada perangkat kecil. */
[role="dialog"] > div {
  max-height: calc(100vh - 2rem);
}

/* Kontrol pengguna pada topbar dan dialog akun. */
#btnServerUsers,
#modalProfile,
#modalUserManagement {
  transition: opacity 160ms ease, transform 160ms ease;
}

#toastContainer > div {
  animation: toast-in 180ms ease-out both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-0.5rem) translateX(0.5rem); }
  to { opacity: 1; transform: translateY(0) translateX(0); }
}

#modalProfile input,
#modalUserManagement input,
#modalUserManagement select {
  min-height: 2.25rem;
}

#userManagementTableBody td {
  white-space: nowrap;
}

@media (max-width: 768px) {
  #appContainer header .flex.items-center.justify-between {
    height: auto;
    min-height: 4rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    align-items: flex-start;
  }

  #appContainer header .flex.items-center.justify-between > div:last-child {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  #modalUserManagement > div {
    max-height: calc(100vh - 1rem);
  }
}

@media (max-width: 640px) {
  #appContainer header .max-w-7xl {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  #printableReportSection {
    padding: 1rem;
  }

  #dynamicKopContainer .flex {
    align-items: flex-start;
  }
}

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

/* Tema dashboard Ar-Romli Center: krem hangat, hijau forest, dan kartu putih. */
:root {
  --theme-cream: #f5f0df;
  --theme-forest: #123b2d;
  --theme-forest-deep: #0b2a20;
  --theme-mint: #dcefe4;
  --theme-gold: #e8b94f;
  --theme-border: #d8d4c5;
}

body {
  background: var(--theme-cream) !important;
  color: #17201c;
}

#appContainer { background: var(--theme-cream); }
#appContainer > header {
  margin-left: 15rem;
  background: rgba(245, 240, 223, 0.94) !important;
  color: #17201c !important;
  border-bottom: 1px solid var(--theme-border) !important;
  box-shadow: none !important;
  backdrop-filter: blur(12px);
}
#appContainer > header #topbarAppName,
#appContainer > header .text-white { color: #17201c !important; }
#appContainer > header .bg-slate-800 { background: #fffdf7 !important; border-color: var(--theme-border) !important; }
#appContainer > header .text-slate-400 { color: #6c756e !important; }
#appContainer > .bg-slate-800 { margin-left: 15rem; background: var(--theme-forest) !important; border-color: #315644 !important; }
#appContainer > main { margin-left: 15rem; }

.theme-sidebar {
  position: fixed;
  z-index: 45;
  inset: 0 auto 0 0;
  width: 15rem;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem 1rem;
  color: #f5f8f2;
  background: linear-gradient(180deg, var(--theme-forest) 0%, var(--theme-forest-deep) 100%);
  box-shadow: 8px 0 28px rgba(11, 42, 32, .12);
}
.theme-sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: .35rem .5rem 1.75rem; }
.sidebar-auto-hide-toggle { display: grid; place-items: center; margin-left: auto; width: 1.8rem; height: 1.8rem; flex: 0 0 auto; color: #a8c9b1; background: transparent; border: 1px solid transparent; border-radius: .45rem; cursor: pointer; transition: .2s ease; }
.sidebar-auto-hide-toggle:hover, .sidebar-auto-hide-toggle:focus-visible { color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); outline: none; }
.sidebar-auto-hide-toggle.is-active { color: var(--theme-gold); }
.theme-sidebar-brand strong { display: block; font-size: 1.05rem; letter-spacing: -.02em; }
.theme-sidebar-brand span { display: block; color: #a8c9b1; font-size: .65rem; margin-top: .2rem; }
.theme-sidebar-logo { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: .8rem; color: var(--theme-gold); background: rgba(255,255,255,.1); font-size: 1.35rem; }
.theme-sidebar-logo img { width: 2.2rem; height: 2.2rem; object-fit: contain; }
.theme-sidebar-nav { display: flex; flex-direction: column; gap: .35rem; }
.theme-sidebar-nav a, .theme-nav-section { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .72rem .75rem; color: #e1eee3; background: transparent; border: 0; border-radius: .7rem; text-align: left; font-size: .78rem; font-weight: 600; text-decoration: none; transition: .2s ease; }
.theme-sidebar-nav a:hover, .theme-nav-section:hover, .theme-sidebar-nav a.active { color: #fff; background: rgba(255,255,255,.13); }
.theme-sidebar-nav a i, .theme-nav-section > i:first-child { width: 1.1rem; color: #9fd0a9; text-align: center; }
.theme-nav-section .caret { margin-left: auto; font-size: .65rem; color: #a8c9b1; }
.theme-sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding: 1rem .5rem .25rem; border-top: 1px solid rgba(255,255,255,.15); color: #c3d8c8; font-size: .72rem; }
.theme-sidebar-footer button { color: #d8e8db; background: transparent; border: 0; padding: .4rem; }

@media (min-width: 901px) {
  #appContainer.sidebar-auto-hide > header,
  #appContainer.sidebar-auto-hide > .bg-slate-800,
  #appContainer.sidebar-auto-hide > main { margin-left: 4.5rem; }
  #appContainer.sidebar-auto-hide .theme-sidebar { width: 4.5rem; padding-left: .65rem; padding-right: .65rem; transition: width .22s ease, box-shadow .22s ease; }
  #appContainer.sidebar-auto-hide .theme-sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  #appContainer.sidebar-auto-hide .theme-sidebar-brand > div:nth-child(2),
  #appContainer.sidebar-auto-hide .theme-sidebar-nav span,
  #appContainer.sidebar-auto-hide .theme-sidebar-footer span { display: none; }
  #appContainer.sidebar-auto-hide .theme-sidebar-nav a,
  #appContainer.sidebar-auto-hide .theme-nav-section { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
  #appContainer.sidebar-auto-hide .theme-nav-section .caret { display: none; }
  #appContainer.sidebar-auto-hide .theme-sidebar:hover,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within { width: 15rem; box-shadow: 8px 0 28px rgba(11, 42, 32, .28); }
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-sidebar-brand,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-sidebar-brand { justify-content: flex-start; padding-left: .5rem; padding-right: .5rem; }
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-sidebar-brand > div:nth-child(2),
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-sidebar-nav span,
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-sidebar-footer span,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-sidebar-brand > div:nth-child(2),
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-sidebar-nav span,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-sidebar-footer span { display: block; }
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-sidebar-nav a,
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-nav-section,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-sidebar-nav a,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-nav-section { justify-content: flex-start; }
  #appContainer.sidebar-auto-hide .theme-sidebar:hover .theme-nav-section .caret,
  #appContainer.sidebar-auto-hide .theme-sidebar:focus-within .theme-nav-section .caret { display: block; }
}

.theme-main .bg-white, #printableReportSection, .frontend-enhancement-panel { border-color: var(--theme-border) !important; box-shadow: 0 4px 14px rgba(57, 66, 51, .08) !important; }
.theme-main .bg-white { border-radius: 1rem !important; }
.theme-main .bg-slate-900 { background: var(--theme-forest) !important; }
.theme-main .text-emerald-800, .theme-main .text-emerald-700 { color: #17664d !important; }
.theme-main .bg-emerald-600 { background: #17664d !important; }
.theme-main .bg-emerald-600:hover { background: #0e513c !important; }

@media (max-width: 900px) {
  .sidebar-auto-hide-toggle { display: none; }
  .theme-sidebar { width: 4.5rem; padding: 1rem .65rem; }
  .theme-sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .theme-sidebar-brand > div:last-child, .theme-sidebar-nav span, .theme-sidebar-footer span { display: none; }
  .theme-sidebar-nav a, .theme-nav-section { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
  .theme-nav-section .caret { display: none; }
  #appContainer > header, #appContainer > .bg-slate-800, #appContainer > main { margin-left: 4.5rem; }
}

@media (max-width: 640px) {
  .theme-sidebar { width: 3.75rem; }
  #appContainer > header, #appContainer > .bg-slate-800, #appContainer > main { margin-left: 3.75rem; }
}

/* Panel penyempurnaan workflow transaksi. */
.frontend-enhancement-panel {
  border: 1px solid #dbe4ee;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}
.workflow-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}
.activity-timeline { position: relative; }
.activity-timeline::before {
  content: '';
  position: absolute;
  left: 0.38rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: #dbe4ee;
}
.activity-item { position: relative; padding-left: 1.35rem; }
.activity-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.28rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: #10b981;
  border: 3px solid #ecfdf5;
  box-shadow: 0 0 0 1px #a7f3d0;
}
@media print {
  body {
    background: #fff !important;
    color: #111827 !important;
  }

  .no-print,
  #loginScreen,
  button,
  [role="dialog"] {
    display: none !important;
  }

  #appContainer,
  main {
    display: block !important;
    max-width: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #appContainer > header,
  #appContainer > .bg-slate-800,
  #appContainer > main {
    margin-left: 0 !important;
  }

  #printableReportSection {
    border: 0 !important;
    box-shadow: none !important;
  }
}
