* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: linear-gradient(135deg, #d7d4f3 0%, #e6e4f9 50%, #d2cff0 100%);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s ease;
}

html.dark body {
  background: linear-gradient(135deg, #0b0c14 0%, #121424 50%, #090a10 100%);
}

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

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

@keyframes pulseRing {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes dashDraw {
  from { stroke-dashoffset: 240; }
}

.animate-stagger-1 { animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.03s both; }
.animate-stagger-2 { animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.10s both; }
.animate-stagger-3 { animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.17s both; }
.animate-stagger-4 { animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both; }

.float-illustration {
  animation: none; /* ilustrasi tak terapung-apung */
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(101, 88, 245, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(101, 88, 245, 0.45);
}

/* Curved Left Purple Sidebar Shape matching reference image */
.curved-sidebar-wrapper {
  position: absolute;
  left: 0;
  top: 155px;
  bottom: 85px;
  width: 68px;
  z-index: 30;
  pointer-events: none;
}

/* SVG organic curves top & bottom */
.sidebar-body {
  pointer-events: auto;
  background: #6558f5;
  width: 66px;
  height: 100%;
  border-top-right-radius: 34px;
  border-bottom-right-radius: 34px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0;
  box-shadow: 8px 0 28px -6px rgba(101, 88, 245, 0.45);
}

/* Top concave curve connector */
.sidebar-curve-top {
  position: absolute;
  top: -48px;
  left: 0;
  width: 38px;
  height: 48px;
  pointer-events: none;
}

/* Bottom concave curve connector */
.sidebar-curve-bottom {
  position: absolute;
  bottom: -48px;
  left: 0;
  width: 38px;
  height: 48px;
  pointer-events: none;
}

/* Card interactive transitions */
.widget-card {
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Ring Gauge animation */
.progress-ring-circle {
  transition: stroke-dashoffset 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Custom dashed border for Quick Add card */
.dashed-lavender-box {
  background-color: #efeffb;
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='24' ry='24' stroke='%23CAC6F5' stroke-width='2' stroke-dasharray='5%2c 5' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
  border-radius: 24px;
}
html.dark .dashed-lavender-box {
  background-color: rgba(101, 88, 245, 0.12);
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='24' ry='24' stroke='%236558f5' stroke-width='2' stroke-dasharray='5%2c 5' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
}

.dashed-assignment-btn {
  background-color: #efeffb;
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='16' ry='16' stroke='%23D2CFF7' stroke-width='1.5' stroke-dasharray='4%2c 4' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
  border-radius: 16px;
}
html.dark .dashed-assignment-btn {
  background-color: rgba(101, 88, 245, 0.14);
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='16' ry='16' stroke='%236558f5' stroke-width='1.5' stroke-dasharray='4%2c 4' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
}

/* Tooltip styling for sidebar */
.sidebar-tooltip {
  position: absolute;
  left: 76px;
  background: #181b2c;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  z-index: 60;
}
.sidebar-btn:hover .sidebar-tooltip,
.sidebar-btn:focus-visible .sidebar-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* =========================================================
   TAMBAHAN STAFF PORTAL PTMO (preview)
   ========================================================= */

/* Sidebar: butang asas (aktif ditanda oleh router.js) */
.sidebar-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.15); }
.sidebar-btn.bg-white:hover { background: #fff; }
.sidebar-btn.hidden { display: none; }

/* Navigasi bawah telefon */
.mnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 14px;
  font-size: 9.5px;
  font-weight: 700;
  transition: background 0.2s ease;
}
.mnav-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* Butang */
.btn-primary, .btn-dark, .btn-soft, .btn-danger, .btn-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 12px;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 9999px;
  white-space: nowrap;
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}
.btn-primary:active, .btn-dark:active, .btn-soft:active, .btn-danger:active, .btn-ok:active { transform: scale(0.97); }
.btn-primary { background: #6558f5; color: #fff; box-shadow: 0 8px 18px -8px rgba(101, 88, 245, 0.7); }
.btn-primary:hover { background: #5446e8; }
.btn-dark { background: #181b2c; color: #fff; }
.btn-dark:hover { background: #272b42; }
html.dark .btn-dark { background: #6558f5; }
html.dark .btn-dark:hover { background: #5446e8; }
.btn-soft { background: #efeffb; color: #5446e8; }
.btn-soft:hover { background: #e2e0fa; }
html.dark .btn-soft { background: rgba(101, 88, 245, 0.16); color: #b3acfb; }
html.dark .btn-soft:hover { background: rgba(101, 88, 245, 0.26); }
.btn-danger { background: #fce8ec; color: #d23f5a; }
.btn-danger:hover { background: #f9d5dd; }
html.dark .btn-danger { background: rgba(224, 83, 108, 0.16); color: #f08a9c; }
.btn-ok { background: #2fb57c; color: #fff; }
.btn-ok:hover { background: #28a06d; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: #efeffb; color: #6558f5; }
html.dark .icon-btn:hover { background: rgba(101, 88, 245, 0.16); color: #b3acfb; }
.icon-btn:disabled { opacity: 0.35; pointer-events: none; }

/* Borang */
.field { display: block; }
.field > span { display: block; font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 0.35rem; }
html.dark .field > span { color: #94a3b8; }
.input {
  width: 100%;
  background: #f7f7fb;
  border: 1px solid #e6e5f3;
  border-radius: 14px;
  padding: 0.6rem 0.8rem;
  font-size: 12.5px;
  font-weight: 500;
  color: #181b2c;
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.input:focus { border-color: #6558f5; box-shadow: 0 0 0 3px rgba(101, 88, 245, 0.18); }
html.dark .input { background: #23273e; border-color: #2d3250; color: #e2e8f0; color-scheme: dark; }
input[type=file].input { padding: 0.45rem 0.6rem; font-size: 11.5px; }
input[type=number]::-webkit-inner-spin-button { opacity: 0.4; }

/* Cip kecil di kepala halaman */
.chip-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  background: #fff;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  box-shadow: 0 6px 16px -8px rgba(35, 32, 85, 0.15);
}
.chip-stat b { color: #181b2c; }
html.dark .chip-stat { background: #1b1e30; color: #94a3b8; }
html.dark .chip-stat b { color: #fff; }

/* Panel tepi */
.sheet-h { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; margin-bottom: 0.6rem; }
.sheet-meta { background: #f7f7fb; border-radius: 14px; padding: 0.6rem 0.75rem; }
html.dark .sheet-meta { background: #23273e; }
.sheet-meta dt { font-size: 10.5px; font-weight: 700; color: #94a3b8; margin-bottom: 0.25rem; }
.sheet-meta dd { font-size: 12px; font-weight: 700; color: #181b2c; display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
html.dark .sheet-meta dd { color: #fff; }

/* Papan & kalendar */
.board-col.drop-hover { box-shadow: 0 0 0 2px rgba(101, 88, 245, 0.45), 0 10px 30px -8px rgba(35, 32, 85, 0.08); }
.board-card { transition: box-shadow 0.15s ease; }
.board-card:hover { box-shadow: 0 0 0 2px rgba(24, 27, 44, 0.14); }
html.dark .board-card:hover { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18); }
.icon-btn.on-fill { color: rgba(24, 27, 44, 0.55); }
.icon-btn.on-fill:hover { background: rgba(255, 255, 255, 0.7); color: #181b2c; }
html.dark .icon-btn.on-fill { color: rgba(255, 255, 255, 0.6); }
html.dark .icon-btn.on-fill:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.cal-cell { min-height: 92px; border-radius: 14px; padding: 6px; text-align: left; overflow: hidden; }
.cal-chip { display: block; width: 100%; text-align: left; font-size: 9.5px; font-weight: 700; padding: 2px 5px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-chip { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  .cal-chip i { display: none; }
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

.mm-slide { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

button:focus-visible, [role=button]:focus-visible, a:focus-visible { outline: 2px solid #6558f5; outline-offset: 2px; }

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

/* Kandungan halaman muncul terus — tiada fade-in hiasan pada setiap blok. */
main [class*="animate-stagger-"] { animation: none; }

/* Kotak "Permohonan baharu": isi lavender padu, tiada garis putus-putus. */
.dashed-lavender-box, html.dark .dashed-lavender-box { background-image: none; transition: background-color 0.15s ease; }
.dashed-lavender-box:hover { background-color: #e4e2fa; }
html.dark .dashed-lavender-box:hover { background-color: rgba(101, 88, 245, 0.2); }

/* Tindakan kecil pada mesej chat */
.msg-act { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #5446e8; padding: 3px 9px; border-radius: 999px; transition: background-color .15s ease; }
.msg-act:hover { background: #efeffb; }
html.dark .msg-act { color: #b3acfb; }
html.dark .msg-act:hover { background: rgba(101, 88, 245, .18); }

/* ---------- Kehadiran: butang timbul (pilihan Boss 11 Nov, contoh 1) ----------
   Bulat dan tebal macam butang lif: tepi atas cerah, dinding bawah gelap, bayang di lantai. Tiada gradien.
   Setiap gerak tunjuk satu keadaan (data-state pada .att-zone):
   idle    butang terapung sedikit + satu gelang keluar dari cincin: sedia semak lokasi
   holding butang tenggelam ke dalam dindingnya, cincin terisi dalam sesaat
   missed  lepas terlalu awal: butang geleng sekali
   gps     butang kekal tenggelam, lengkok cincin berpusing sementara lokasi dibaca
   done    hijau, timbul semula dengan lantunan, tanda betul dilukis, satu gelang lepas keluar */
.att-zone { --att-tone: #6558f5; --att-deep: #4638c9; --att-on: #ffffff; --att-wall: 12px; }
.att-zone[data-size="besar"] { --att-wall: 14px; }
.att-zone[data-size="mini"] { --att-wall: 6px; }
.att-zone[data-size="mini"] .att-ping, .att-zone[data-size="mini"] .att-burst { inset: 2px; }
.att-zone[data-mode="keluar"] { --att-tone: #181b2c; --att-deep: #000000; }
html.dark .att-zone[data-mode="keluar"] { --att-tone: #ffffff; --att-deep: #aab2c8; --att-on: #181b2c; }
.att-zone[data-state="done"], html.dark .att-zone[data-state="done"] { --att-tone: #2fb57c; --att-deep: #1e875b; --att-on: #ffffff; }

.att-ring { transform: rotate(-90deg); }
.att-prog { stroke: var(--att-tone); }
.att-btn {
  background-color: var(--att-tone); color: var(--att-on);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .24), 0 var(--att-wall) 0 var(--att-deep), 0 calc(var(--att-wall) + 12px) 22px rgba(24, 27, 44, .24);
  transform: translateY(calc(var(--att-wall) / -2));
  transition: transform .18s cubic-bezier(.3, 1.5, .5, 1), box-shadow .18s ease, background-color .25s ease, color .25s ease;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
html.dark .att-btn { box-shadow: inset 0 3px 0 rgba(255, 255, 255, .2), 0 var(--att-wall) 0 var(--att-deep), 0 calc(var(--att-wall) + 12px) 22px rgba(0, 0, 0, .5); }
.att-zone[data-state="holding"] .att-btn, .att-zone[data-state="gps"] .att-btn,
html.dark .att-zone[data-state="holding"] .att-btn, html.dark .att-zone[data-state="gps"] .att-btn {
  transform: translateY(calc(var(--att-wall) / 2 - 2px));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .16), 0 2px 0 var(--att-deep), 0 6px 8px rgba(24, 27, 44, .22);
}
.att-ping, .att-burst { position: absolute; inset: 4px; border-radius: 9999px; border: 2px solid var(--att-tone); opacity: 0; pointer-events: none; }
.att-burst { border-color: #2fb57c; }

.att-zone[data-state="idle"] .att-btn { animation: attFloat 3.2s ease-in-out infinite; }
.att-zone[data-state="idle"] .att-ping { animation: attPing 3.2s cubic-bezier(.2, .6, .3, 1) infinite; }
.att-zone[data-state="missed"] .att-btn { animation: attShake .34s cubic-bezier(.36, .07, .19, .97); }
.att-zone[data-state="gps"] .att-ring { animation: attSpin .9s linear infinite; }
.att-zone[data-state="gps"] .att-face i { animation: attBob .9s ease-in-out infinite; }
.att-zone[data-state="done"] .att-btn { animation: attPop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.att-zone[data-state="done"] .att-burst { animation: attBurst .7s cubic-bezier(.2, .7, .2, 1) both; }
.att-check path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: attDraw .36s .14s cubic-bezier(.4, 0, .2, 1) forwards; }
.att-bar { transition: width .6s ease; }

@keyframes attFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@keyframes attPing { 0% { transform: scale(1); opacity: .4; } 70%, 100% { transform: scale(1.16); opacity: 0; } }
@keyframes attShake { 20% { translate: -6px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 2px 0; } }
@keyframes attSpin { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
@keyframes attBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes attPop {
  0% { transform: translateY(calc(var(--att-wall) / 2 - 2px)); }
  60% { transform: translateY(calc(var(--att-wall) / -2 - 5px)); }
  100% { transform: translateY(calc(var(--att-wall) / -2)); }
}
@keyframes attBurst { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes attDraw { to { stroke-dashoffset: 0; } }

/* Staf yang minta kurang gerak: tiada apungan, ping, geleng atau putaran. Keadaan masih jelas melalui warna, tenggelam dan teks. */
@media (prefers-reduced-motion: reduce) {
  .att-zone .att-btn, .att-zone .att-ping, .att-zone .att-burst, .att-zone .att-ring, .att-zone .att-face i { animation: none !important; }
  .att-check path { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Telefon: tiada zoom tersendiri, borang rasa iOS (Boss 11 Nov) ----------
   iPhone zoom masuk sendiri bila medan isian guna fon lebih kecil daripada 16px, dan bila butang
   diketik dua kali. Dua-dua dihentikan di sini. Zoom dua jari masih dibenarkan (untuk staf rabun). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
a, button, [role="button"], label, summary, select { -webkit-tap-highlight-color: transparent; }
.sheet-grab { display: none; }
@media (pointer: coarse), (max-width: 767px) {
  /* :not(#_) menaikkan keutamaan supaya kelas saiz kecil pada medan (contoh !text-[12px]) tak menang. */
  input:not(#_), select:not(#_), textarea:not(#_) { font-size: 16px !important; }
}

@media (max-width: 767px) {
  /* Medan: tinggi sentuhan 50px, isi kelabu lembut tanpa garis, fokus jadi putih bergaris. */
  .input { min-height: 50px; padding: 12px 14px; border-radius: 13px; border-color: transparent; background: #f1f1f8; }
  textarea.input { min-height: 108px; line-height: 1.4; }
  .input:focus { border-color: #6558f5; box-shadow: none; background: #ffffff; }
  html.dark .input { background: #23273e; border-color: transparent; }
  html.dark .input:focus { border-color: #6558f5; background: #1b1e30; }
  .field > span { font-size: 13px; margin-bottom: 0.45rem; }
  .btn-primary, .btn-dark, .btn-soft, .btn-danger, .btn-ok { min-height: 44px; font-size: 14px; }

  /* Modal jadi helaian bawah: naik dari bawah, bucu atas bulat, pemegang kecil, latar malap tanpa kabur. */
  body.modal-open { overflow: hidden; }
  #modal-backdrop { align-items: flex-end; padding: 0 0 var(--kb, 0px); -webkit-backdrop-filter: none; backdrop-filter: none; animation: sheetDim .25s ease both; }
  #modal-box {
    max-width: none !important; max-height: calc(92dvh - var(--kb, 0px));
    border: 0; border-radius: 26px 26px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    animation: sheetUp .34s cubic-bezier(.32, .72, 0, 1) both;
  }
  #modal-backdrop.closing { animation: sheetDimOut .22s ease both; }
  #modal-backdrop.closing #modal-box { animation: sheetDown .22s cubic-bezier(.4, 0, 1, 1) both; }
  .sheet-grab { display: block; width: 38px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: #d7d7e4; }
  html.dark .sheet-grab { background: #3a3f5c; }
  #modal-title { font-size: 19px; }
  .modal-x { width: 36px; height: 36px; }
  /* Butang tindakan helaian: lebar penuh, yang utama di atas, Batal di bawah. */
  #modal-body .justify-end { flex-direction: column-reverse; align-items: stretch; gap: 8px; margin-top: 6px; }
  #modal-body .justify-end > button, #modal-body .justify-end > a { width: 100%; min-height: 50px; font-size: 16px; border-radius: 14px; }

  /* Bar navigasi bawah naik atas garis "home" iPhone. */
  nav[aria-label="Navigasi telefon"] { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetDown { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes sheetDim { from { background-color: rgba(2, 6, 23, 0); } to { background-color: rgba(2, 6, 23, .4); } }
@keyframes sheetDimOut { from { background-color: rgba(2, 6, 23, .4); } to { background-color: rgba(2, 6, 23, 0); } }
