/* ---------- Base polish ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: #c7c4d8 transparent;
}

body {
  background:
    radial-gradient(1100px 620px at 8% -10%, rgba(77, 68, 227, 0.12), transparent 60%),
    radial-gradient(900px 560px at 100% 0%, rgba(255, 182, 149, 0.14), transparent 55%),
    radial-gradient(1200px 800px at 50% 110%, rgba(53, 37, 205, 0.08), transparent 60%),
    #f4f4fb;
  background-attachment: fixed;
  /* Fallback for any element without an explicit Tailwind font-* class —
     e.g. Chrome's translate feature wraps translated text in bare <font>
     tags that don't carry our utility classes, so without this they fall
     back to the browser's own default (often a serif), which reads as a
     jarring font swap. */
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7c4d8; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #a5a2ba; }

a, button, input, select, textarea {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

/* ---------- macOS-style sidebar ---------- */
.macos-sidebar {
  background: rgba(244, 244, 248, 0.78);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-right: 1px solid rgba(20, 27, 43, 0.08);
}
.sidebar-brand-icon {
  background: linear-gradient(155deg, #4d44e3 0%, #3525cd 60%, #2a1cb0 100%);
  box-shadow: 0 2px 6px rgba(53, 37, 205, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #45445a;
}
.nav-link .material-symbols-outlined {
  font-size: 19px;
  color: #6b6a80;
}
.nav-link:hover:not(.active) {
  background: rgba(20, 27, 43, 0.055);
}
.nav-link.active {
  background: #3525cd;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(53, 37, 205, 0.4);
}
.nav-link.active .material-symbols-outlined {
  color: #ffffff;
}

.nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b6a80;
}
.nav-group-toggle:hover {
  background: rgba(20, 27, 43, 0.055);
  color: #45445a;
}
.nav-group-toggle .chevron {
  font-size: 18px;
  transition: transform 0.15s ease;
}
.nav-group-toggle.expanded .chevron {
  transform: rotate(180deg);
}

/* ---------- Topbar ---------- */
.app-topbar {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid rgba(20, 27, 43, 0.08);
}

/* ---------- Cards (macOS-style frosted glass) ---------- */
.card {
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(20, 27, 43, 0.05), 0 12px 28px rgba(20, 27, 43, 0.06);
}
.stagger-in > * {
  animation: fade-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  color: #464555;
  background: #f1f3ff;
  padding: 8px 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.data-table td {
  padding: 7px 12px;
  border-top: 1px solid rgba(20, 27, 43, 0.06);
  white-space: nowrap;
}
.data-table tr:hover td {
  background: rgba(53, 37, 205, 0.03);
}
.data-table tfoot td {
  font-weight: 700;
  background: #e9edff;
  border-top: 2px solid rgba(53, 37, 205, 0.25);
}

/* ---------- Topbar / row actions ---------- */
.topbar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.topbar-action:hover {
  background: rgba(20, 27, 43, 0.055);
  color: #141b2b;
}
.topbar-action.danger:hover {
  background: rgba(186, 26, 26, 0.08);
  color: #ba1a1a;
}

/* ---------- Card entrance + hover lift ---------- */
.card-lift {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 27, 43, 0.08);
}

/* ---------- Glass surfaces ---------- */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.glass-strong {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
}

/* ---------- Upload dropzone ---------- */
.dropzone {
  border: 2px dashed rgba(53, 37, 205, 0.3);
  border-radius: 0.75rem;
  background: rgba(53, 37, 205, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.dragover {
  border-color: #3525cd;
  background: rgba(53, 37, 205, 0.08);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-done { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.badge-processing { background: rgba(245, 158, 11, 0.12); color: #F59E0B; }
.badge-failed { background: rgba(239, 68, 68, 0.12); color: #EF4444; }

/* ---------- Slide-in drawer (project switcher) ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(20, 27, 43, 0.28);
  backdrop-filter: blur(2px);
  animation: fade-in 0.16s ease both;
}
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 380px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -12px 0 40px rgba(20, 27, 43, 0.18);
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
}

/* ---------- Draggable chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f3ff;
  color: #3525cd;
  font-size: 12.5px;
  font-weight: 500;
  cursor: grab;
  border: 1px solid rgba(53, 37, 205, 0.15);
}
.chip[draggable="true"]:active { cursor: grabbing; opacity: 0.6; }
.chip-remove {
  cursor: pointer;
  opacity: 0.6;
}
.chip-remove:hover { opacity: 1; }

.dropzone-task {
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.dropzone-task.drag-over {
  background: rgba(53, 37, 205, 0.06);
  box-shadow: inset 0 0 0 2px rgba(53, 37, 205, 0.35);
}

.task-card {
  border: 1px solid rgba(20, 27, 43, 0.08);
  border-radius: 0.75rem;
  background: #fff;
  padding: 12px;
}
.task-card.done {
  opacity: 0.65;
}
.task-drag-handle {
  cursor: grab;
  color: #9ca3af;
}
.task-drag-handle:active { cursor: grabbing; }
.sortable-ghost {
  opacity: 0.35;
}

/* ---------- Diff preview (confirm-before-save) ---------- */
.diff-row {
  display: grid;
  grid-template-columns: 100px 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 4px 0;
}
.diff-old { color: #9ca3af; text-decoration: line-through; }
.diff-new { color: #141b2b; font-weight: 600; }

/* ---------- Modal system + toast stack + searchable select (ui-kit.js) ----------
   ui-kit.js (used on every JS-driven page: users/tim/index/settings/laporan/
   arsip) creates elements with these class names — without this block every
   modal/confirm/prompt/toast renders unstyled (position:static, no overlay,
   no centering) instead of as an overlay. */

@keyframes theme-fade-in {
  from { opacity: 0; transform: translateY(4px); }
}
@keyframes theme-fade-out {
  to { opacity: 0; }
}

.ui-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 27, 43, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: theme-fade-in 0.18s ease both;
}
.ui-modal-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(199, 196, 216, 0.6);
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(20, 27, 43, 0.22);
  animation: ui-pop-in 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ui-modal-card.leaving {
  animation: ui-pop-out 0.16s cubic-bezier(0.4, 0, 1, 1) both;
}
@keyframes ui-pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
}
@keyframes ui-pop-out {
  to { opacity: 0; transform: scale(0.96) translateY(4px); }
}

#ui-toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.ui-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid rgba(199, 196, 216, 0.6);
  box-shadow: 0 12px 32px rgba(20, 27, 43, 0.18);
  font-size: 0.85rem;
  color: #141b2b;
  animation: ui-toast-in 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ui-toast.leaving {
  animation: ui-toast-out 0.18s cubic-bezier(0.4, 0, 1, 1) both;
}
@keyframes ui-toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
}
@keyframes ui-toast-out {
  to { opacity: 0; transform: translateX(12px); }
}
.ui-toast-icon { flex-shrink: 0; margin-top: 1px; }
.ui-toast.success .ui-toast-icon { color: #10B981; }
.ui-toast.error .ui-toast-icon { color: #EF4444; }
.ui-toast.info .ui-toast-icon { color: #3525cd; }

.uisel {
  position: relative;
}
.uisel-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.uisel-panel {
  position: absolute;
  z-index: 300;
  margin-top: 6px;
  min-width: 100%;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid rgba(199, 196, 216, 0.7);
  border-radius: 0.75rem;
  box-shadow: 0 16px 40px rgba(20, 27, 43, 0.16);
  overflow: hidden;
  animation: ui-pop-in 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.uisel-search {
  padding: 8px;
  border-bottom: 1px solid rgba(199, 196, 216, 0.5);
}
.uisel-search input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.85rem;
  padding: 4px 6px;
}
.uisel-options {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}
.uisel-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: #141b2b;
}
.uisel-option:hover,
.uisel-option.highlighted {
  background: rgba(53, 37, 205, 0.08);
}
.uisel-option.selected {
  background: rgba(53, 37, 205, 0.12);
  color: #3525cd;
  font-weight: 600;
}
.uisel-empty {
  padding: 14px 10px;
  text-align: center;
  font-size: 0.8rem;
  color: #5c5f60;
}
