/* threads-agent: companion layer for vendored Tailwind (static/vendor/).
   Only what the generated build cannot provide goes here:
   (1) component classes mirroring TailAdmin demo aesthetics (.btn etc.),
   (2) arbitrary utilities the scanner misses,
   (3) app-specific needs. Everything else comes from the build. */

/* Preflight reset missing from vendored build: without border-box,
   padded/fixed-width elements (sidebar w-72.5, w-full inputs) compute
   wider than declared and break collapse math. */
*, ::before, ::after { box-sizing: border-box; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html.dark {
  color-scheme: dark;
}
html.dark,
html.dark body {
  background-color: #0b1120 !important;
  color: #f8fafc !important;
}
html.dark main,
html.dark #isi {
  background-color: #0b1120 !important;
}
html.dark .bg-gray-50 {
  background-color: #0b1120 !important;
}

#sidebar {
  z-index: 99999;
}
#nav-overlay {
  z-index: 9999;
}
@media (max-width: 1279px) {
  #sidebar.translate-x-0 {
    transform: translateX(0) !important;
  }
}
@media (min-width: 1280px) {
  #nav-overlay { display: none !important; }
}

/* Arbitrary utilities missed by the content scanner. */
.max-w-\(--breakpoint-2xl\) { max-width: 1536px; }
.min-w-\[36rem\] { min-width: 36rem; }
.min-w-\[44rem\] { min-width: 44rem; }
.min-w-\[52rem\] { min-width: 52rem; }
.w-72\.5 { width: 18.125rem; }
.z-999 { z-index: 999; }

/* Buttons: mirror TailAdmin demo (bg-brand-500, rounded-lg). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 120ms ease;
}
.btn-primary {
  background-color: #465fff;
  border-color: #465fff;
  color: #fff;
  box-shadow: 0 1px 2px 0 rgb(16 24 40 / 0.05);
}
.btn-primary:hover { background-color: #3641f5; border-color: #3641f5; color: #fff; }

.btn-secondary {
  background-color: #fff;
  border-color: #e5e7eb;
  color: #374151;
}
.btn-secondary:hover { background-color: #f9fafb; border-color: #d1d5db; color: #111827; }
.dark .btn-secondary {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
.dark .btn-secondary:hover { background-color: #374151; color: #fff; }

.btn-danger {
  background-color: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.btn-danger:hover { background-color: #dc2626; border-color: #dc2626; }

.btn-sm {
  min-height: 34px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 0.375rem;
}

/* Sidebar navigation item active styling */
.menu-item-active {
  background-color: #f2f4ff !important;
  color: #465fff !important;
  font-weight: 600 !important;
}
.dark .menu-item-active {
  background-color: rgba(70, 95, 255, 0.15) !important;
  color: #8da4ff !important;
}
.menu-item-active svg {
  color: #465fff !important;
}
.dark .menu-item-active svg {
  color: #8da4ff !important;
}

/* Scrollbar polish */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Search field widths: responsive width utilities (w-64, lg:w-96,
   sm:w-72) are absent from the vendored TailAdmin build, so explicit
   widths keep both search fields stable instead of collapsing. */
.search-header { width: 16rem; }
@media (min-width: 1024px) { .search-header { width: 24rem; } }
.search-table-field { width: 100%; }
@media (min-width: 640px) { .search-table-field { width: 18rem; } }

/* Scale & grid shims absent from the vendored build (verified missing
   via grep): space-y-4 for form rhythm, xl: 12/4-col grids for
   dashboard 2-col layouts, tracking-wider for table headers/labels. */
.space-y-4 > :not([hidden]) ~ :not([hidden]) {
  --tw-space-y-reverse: 0;
  margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));
  margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));
}
.tracking-wider { letter-spacing: 0.05em; }
/* Responsive variant shims (sm/md/lg/xl) absent from the vendored
   TailAdmin build — full template audit. Breakpoints = Tailwind
   defaults. Unlayered author CSS beats layered vendor utilities. */
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:items-center { align-items: center; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:p-6 { padding: 1.5rem; }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
  .sm\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
}
@media (min-width: 768px) {
  .md\:gap-6 { gap: 1.5rem; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:p-6 { padding: 1.5rem; }
}
@media (min-width: 1024px) {
  .lg\:gap-4 { gap: 1rem; }
}
@media (min-width: 1280px) {
  .xl\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xl\:col-span-8 { grid-column: span 8 / span 8; }
  .xl\:col-span-4 { grid-column: span 4 / span 4; }
  .xl\:static { position: static; }
  .xl\:hidden { display: none; }
  .xl\:flex { display: flex; }
  .xl\:translate-x-0 {
    --tw-translate-x: 0px;
    translate: var(--tw-translate-x) var(--tw-translate-y);
  }
  /* Desktop collapse jadi rail icon 90px: teks hilang, icon tengah. */
  #sidebar.sidebar-collapsed { width: 5.625rem; padding-left: 0.75rem; padding-right: 0.75rem; }
  #sidebar.sidebar-collapsed .menu-item-text,
  #sidebar.sidebar-collapsed .sidebar-header div,
  #sidebar.sidebar-collapsed nav h3 { display: none; }
  #sidebar.sidebar-collapsed .menu-item { justify-content: center; padding-left: 0; padding-right: 0; }
  #sidebar.sidebar-collapsed .sidebar-header { justify-content: center; }
}

/* Shims untuk eye-toggle login (absen di build vendor). */
.pr-12 { padding-right: calc(var(--spacing) * 12); }
.top-1\/2 { top: calc(1 / 2 * 100%); }
.-translate-y-1\/2 {
  --tw-translate-y: calc(calc(1 / 2 * 100%) * -1);
  translate: var(--tw-translate-x) var(--tw-translate-y);
}

/* Toggle switch untuk status Aktif/Nonaktif (checkbox + onchange submit). */
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 2.5rem; height: 1.375rem; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #d0d5dd; transition: background 150ms ease; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.375rem - 4px); height: calc(1.375rem - 4px); border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(16 24 40 / 0.3); transition: transform 150ms ease; }
.switch input:checked + span { background: #465fff; }
.switch input:checked + span::after { transform: translateX(calc(2.5rem - 1.375rem)); }
.switch input:focus-visible + span { outline: 3px solid #465fff; outline-offset: 2px; }
.dark .switch span { background: #374151; }
.dark .switch input:checked + span { background: #465fff; }

/* App-specific needs. */
.draft-body { white-space: pre-line; }
.kpi-num { font-variant-numeric: tabular-nums; }
form.inline { display: inline; }

/* Icon-only action buttons: square, label pindah ke tooltip data-tip. */
.btn-icon { width: 2.125rem; padding-left: 0; padding-right: 0; }

/* Hover tooltip: teks penjelasan via [data-tip], tanpa JS. */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #101828;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgb(16 24 40 / 0.25);
  pointer-events: none;
  z-index: 60;
}
/* Varian rata kanan: jangkar di tepi kanan pemicu, tumbuh ke kiri.
   Untuk aksi di kolom paling kanan agar tidak melewati tepi tabel
   (pembungkus overflow-x-auto) dan memicu scroll. */
[data-tip-align="right"]:hover::after, [data-tip-align="right"]:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1080;
  background: #181d27;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 0.5rem 0;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #465fff;
  outline-offset: 2px;
}
/* Popup <option> native mengikuti dark mode (tanpa ini daftar pilihan
   selalu terang walau halaman gelap). */
html.dark select option {
  background-color: #111827;
  color: #d1d5db;
}
