/* =========================================================
   Review & RTL Terintegrasi 2027 — Style
   ========================================================= */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e4e8f1;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --accent: #0891b2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* Background orbs */
.bg-orb { position: fixed; border-radius: 50%; filter: blur(80px); opacity: .35; z-index: -1; pointer-events: none; animation: float 18s ease-in-out infinite alternate; }
.orb-1 { width: 420px; height: 420px; background: #c7d2fe; top: -120px; right: -80px; }
.orb-2 { width: 360px; height: 360px; background: #a5f3fc; bottom: -140px; left: -100px; animation-delay: -6s; }
@keyframes float { to { transform: translate(40px, 30px) scale(1.08); } }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 28px; position: sticky; top: 0; z-index: 20;
  background: rgba(244, 246, 251, .82); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(228, 232, 241, .7);
  animation: slideDown .6s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .7);
}
.brand h1 { font-size: 1.15rem; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 0; font-size: .8rem; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }


/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .month-toggle:focus-visible, .tab:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, var(--primary), #6366f1); color: #fff; box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .8); }
.btn.primary:hover { box-shadow: 0 12px 24px -10px rgba(79, 70, 229, .9); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: #334155; }
.btn.ghost:hover { border-color: #cbd5e1; background: #fff; }
.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-soft); border-color: #fecaca; }
.btn.danger-solid { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 8px 18px -8px rgba(220, 38, 38, .8); }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, .55); animation: ripple .6s linear; pointer-events: none; }
.btn.ghost .ripple { background: rgba(79, 70, 229, .18); }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--muted);
  transition: background .18s, color .18s, transform .18s var(--spring);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); transform: scale(1.08); }
.icon-btn.del:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tabs ---------- */
.tabs {
  position: relative; display: flex; gap: 4px; padding: 0 28px; margin-top: 18px;
  border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
  animation: fadeIn .7s .1s var(--ease) both;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; background: none; border: 0;
  cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); white-space: nowrap;
  transition: color .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); }
.tab-no {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: .72rem;
  background: var(--surface); border: 1px solid var(--border); transition: all .25s var(--ease);
}
.tab.active .tab-no { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-indicator {
  position: absolute; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: left .4s var(--ease), width .4s var(--ease);
}

/* ---------- Panels ---------- */
main { padding: 24px 28px 12px; max-width: 1440px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: panelIn .5s var(--ease) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head h2 { margin: 6px 0 4px; font-size: 1.45rem; letter-spacing: -.02em; }
.panel-head p { margin: 0; color: var(--muted); max-width: 760px; font-size: .9rem; }
.agenda-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft); padding: 4px 10px; border-radius: 999px;
}

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search {
  position: relative; flex: 1 1 260px; max-width: 380px;
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.search input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.toolbar select {
  padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.toolbar .count { margin-left: auto; font-size: .82rem; color: var(--muted); }

/* ---------- Cards / stats ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); transition: transform .25s var(--ease), box-shadow .25s; }
.stat:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -16px rgba(15, 23, 42, .25); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.stat-sub { font-size: .76rem; color: var(--muted); }
.ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--success) calc(var(--p) * 1%), #e2e8f0 0); transition: --p 1s var(--ease); }
.ring span { width: 36px; height: 36px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; }
.section-title h3 { margin: 0; font-size: 1.02rem; }

.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 24px; }
.index-card { padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
  animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); transition: transform .25s var(--ease), box-shadow .25s; }
.index-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--status-color, #cbd5e1); }
.index-card:hover { transform: translateY(-4px); box-shadow: 0 18px 36px -18px rgba(15, 23, 42, .3); }
.index-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kode { font-size: .72rem; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.index-card h4 { margin: 6px 0 2px; font-size: .98rem; }
.index-card .lead { font-size: .78rem; color: var(--muted); }
.card-actions { display: flex; gap: 2px; opacity: .55; transition: opacity .2s; }
.index-card:hover .card-actions { opacity: 1; }
.big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big .num { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.big .of { font-size: .8rem; color: var(--muted); }
.big .lbl { font-size: .72rem; color: var(--muted); width: 100%; }
.delta { font-size: .75rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.delta.up { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: #f1f5f9; color: var(--muted); }
.bar { position: relative; height: 8px; background: #edf0f6; border-radius: 99px; overflow: visible; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 1.1s var(--ease); }
.bar-target { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--text); border-radius: 2px; opacity: 0; transition: opacity .5s .8s; }
.bar-target.show { opacity: .7; }
.bar-target::after { content: attr(data-label); position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .64rem; color: var(--muted); white-space: nowrap; }
.triple { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 8px; }
.triple div { text-align: center; }
.triple small { display: block; font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.triple b { font-size: .9rem; }
.critical { font-size: .8rem; color: #475569; background: var(--warning-soft); border-left: 3px solid var(--warning); padding: 6px 10px; border-radius: 6px; }
.add-card {
  border: 2px dashed #cbd5e1; background: transparent; border-radius: var(--radius); min-height: 180px; cursor: pointer;
  display: grid; place-items: center; color: var(--muted); font-weight: 600; transition: all .25s var(--ease);
  animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.add-card:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-3px); }
.add-card span { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.add-card svg { width: 28px; height: 28px; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.two-col .card { padding: 16px 18px; animation: rise .55s var(--ease) both; animation-delay: .25s; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 28px; gap: 10px; align-items: center; margin: 9px 0; font-size: .84rem; }
.hbar-row .bar { height: 10px; }
.hbar-row b { text-align: right; }
.month-load { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; align-items: end; height: 120px; margin-top: 10px; }
.month-load .col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.month-load .pillar { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--accent), var(--primary)); height: 0; transition: height 1s var(--ease); min-height: 2px; }
.month-load small { font-size: .66rem; color: var(--muted); }
.month-load .v { font-size: .68rem; font-weight: 700; }

@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warning { background: var(--warning-soft); color: var(--warning); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-muted { background: #f1f5f9; color: var(--muted); }
button.badge { border: 0; cursor: pointer; transition: transform .2s var(--spring), box-shadow .2s; }
button.badge:hover { transform: scale(1.06); box-shadow: 0 4px 10px -4px currentColor; }
.tag { display: inline-block; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .72rem; padding: 2px 7px; border-radius: 6px; background: #eef2ff; color: #4338ca; margin: 2px 4px 2px 0; border: 1px solid #e0e7ff; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
.row-anim { animation: rowIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.row-out { animation: rowOut .35s var(--ease) forwards !important; }
@keyframes rowOut { to { opacity: 0; transform: translateX(30px) scale(.98); } }
.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 30% { background: #e0e7ff; } 100% { background: transparent; } }
td.no { color: var(--muted); font-weight: 700; width: 40px; }
td.code { font-weight: 800; color: var(--primary); white-space: nowrap; }
td.strong { font-weight: 600; }
td .muted, .muted { color: var(--muted); }
.col-actions { width: 84px; white-space: nowrap; text-align: right; }
.col-wide { min-width: 200px; }
.col-mid { min-width: 150px; }
.empty { text-align: center; padding: 48px 16px !important; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 8px; opacity: .45; }

/* Timeline grid */
.tl th.m, .tl td.m { text-align: center; padding: 8px 3px; width: 44px; }
.month-cell {
  width: 34px; height: 26px; border-radius: 7px; border: 1px dashed #d5dbe7; background: transparent; cursor: pointer;
  transition: background .25s var(--ease), transform .2s var(--spring), border-color .2s;
}
.month-cell:hover { border-color: var(--primary); transform: scale(1.1); }
.month-cell.on { background: linear-gradient(135deg, var(--primary), var(--accent)); border: 1px solid transparent; box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .7); }
.month-cell.pop { animation: pop .35s var(--spring); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
tfoot td { padding: 10px 3px; background: var(--surface-2); font-size: .78rem; font-weight: 700; border-top: 1px solid var(--border); }
.heat { display: inline-grid; place-items: center; width: 30px; height: 22px; border-radius: 6px; font-size: .74rem; transition: background .3s; }

/* ---------- Overlay / modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px);
  animation: fadeIn .22s var(--ease) both;
}
.overlay.closing { animation: fadeOut .22s var(--ease) forwards; }
.overlay.closing .modal { animation: modalOut .22s var(--ease) forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: modalIn .38s var(--spring) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
.modal.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.modal-form { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.12rem; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.modal form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.form-body { padding: 18px 22px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.field.span-2 { grid-column: 1 / -1; }
.field label { font-size: .8rem; font-weight: 700; color: #334155; }
.req { color: var(--danger); margin-left: 3px; }
.field input, .field select, .field textarea {
  padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.field .hint { color: var(--muted); font-size: .74rem; }
.field .err { color: var(--danger); font-size: .74rem; min-height: 0; display: none; }
.field.invalid .err { display: block; animation: fadeIn .2s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: all .2s var(--ease);
}
.chip:hover { border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(1.03); }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; }
.month-toggle { padding: 8px 0; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: .76rem; font-weight: 700; cursor: pointer; transition: all .2s var(--ease); }
.month-toggle.on { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-color: transparent; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }

/* Alert (sweet-alert style) */
.modal-alert { max-width: 420px; padding: 28px 26px 22px; text-align: center; align-items: center; }
.modal-alert h3 { margin: 14px 0 6px; font-size: 1.25rem; }
.swal-text { color: #475569; font-size: .9rem; }
.swal-text ul { text-align: left; margin: 10px 0 0; padding-left: 18px; }
.swal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.swal-actions .btn { min-width: 110px; padding: 10px 18px; }
.swal-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; animation: iconIn .5s var(--spring) both; }
.swal-icon svg { width: 76px; height: 76px; }
@keyframes iconIn { from { transform: scale(.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
.swal-icon .circle { stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw .6s .1s var(--ease) forwards; }
.swal-icon .mark { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .4s .55s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.swal-success { color: var(--success); background: var(--success-soft); }
.swal-warning { color: var(--warning); background: var(--warning-soft); }
.swal-error { color: var(--danger); background: var(--danger-soft); }
.swal-info, .swal-question { color: var(--info); background: var(--info-soft); }
.swal-timer { height: 3px; border-radius: 3px; background: var(--success); margin-top: 18px; width: 100%; transform-origin: left; animation: timer linear forwards; }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; right: 20px; top: 84px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden; min-width: 280px; max-width: 380px;
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px 14px; border-radius: 12px; background: #fff;
  box-shadow: 0 16px 36px -16px rgba(15, 23, 42, .4); border: 1px solid var(--border); cursor: pointer;
  animation: toastIn .45s var(--spring) both;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }
.toast .ti { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast .ti svg { width: 16px; height: 16px; }
.toast b { display: block; font-size: .86rem; }
.toast span { font-size: .8rem; color: var(--muted); }
.toast .tbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; animation: timer linear forwards; }
.t-success .ti { background: var(--success-soft); color: var(--success); } .t-success .tbar { background: var(--success); }
.t-error .ti { background: var(--danger-soft); color: var(--danger); } .t-error .tbar { background: var(--danger); }
.t-warning .ti { background: var(--warning-soft); color: var(--warning); } .t-warning .tbar { background: var(--warning); }
.t-info .ti { background: var(--info-soft); color: var(--info); } .t-info .tbar { background: var(--info); }

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 10px 20px 30px; }
.note { font-size: .8rem; color: var(--muted); margin: 10px 2px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { position: static; }
  .topbar, .tabs, main { padding-left: 16px; padding-right: 16px; }
  .form-body { grid-template-columns: 1fr; }
  .months { grid-template-columns: repeat(6, 1fr); }
  .toast-wrap { left: 16px; right: 16px; }
  .toast { max-width: none; }
}

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

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .bg-orb, .top-actions, .tabs, .toolbar, .col-actions, .card-actions, .add-card, .toast-wrap, .foot, .panel-head .btn { display: none !important; }
  .topbar { position: static; background: none; border: 0; padding: 0 0 10px; }
  main { padding: 0; }
  .card, .stat, .index-card { box-shadow: none; break-inside: avoid; }
  * { animation: none !important; }
  .bar-fill { transition: none; }
  table { font-size: 10pt; }
  thead th { position: static; }
}

/* =========================================================
   Tambahan versi LIVE (Firebase)
   ========================================================= */
body.locked .topbar, body.locked .tabs, body.locked main, body.locked .foot { visibility: hidden; }

/* Layar masuk */
.gate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.gate[hidden] { display: none; }
.gate-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 30px 28px 26px; display: flex; flex-direction: column; gap: 14px; animation: modalIn .5s var(--spring) both;
}
.gate-card.shake { animation: shake .4s ease; }
.gate-card h2 { margin: 6px 0 0; font-size: 1.3rem; letter-spacing: -.02em; }
.gate-card p { margin: 0 0 4px; font-size: .86rem; }
.big-logo { width: 54px; height: 54px; font-size: 1.15rem; border-radius: 15px; animation: iconIn .6s var(--spring) both; }
.gate .field input { width: 100%; }
.gate .field.invalid input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.pw-wrap .icon-btn:hover { transform: translateY(-50%) scale(1.08); }
.gate-btn { padding: 11px; font-size: .92rem; margin-top: 4px; }
.btn[disabled] { opacity: .7; pointer-events: none; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loader data */
.loader { display: none; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 80px 0; font-weight: 600; }
.loader.show { display: flex; animation: fadeIn .3s; }
.loader .spinner { width: 20px; height: 20px; color: var(--primary); }

/* Status sinkron */
.sync-status {
  display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); transition: all .3s;
}
.sync-status .dot { width: 8px; height: 8px; border-radius: 50%; position: relative; }
.sync-status.ok .dot { background: var(--success); animation: live 2s ease-out infinite; }
.sync-status.busy .dot { background: var(--warning); animation: blink 1s ease-in-out infinite; }
.sync-status.off .dot { background: var(--danger); }
.sync-status.off { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); } }
@keyframes blink { 50% { opacity: .35; } }

.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); max-width: 260px; }
.user-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
.role.editor { background: var(--primary-soft); color: var(--primary); }
.role.viewer { background: #ecfeff; color: var(--accent); }

.by { display: block; font-size: .7rem; color: var(--muted); font-weight: 500; margin-top: 3px; }

/* Mode pimpinan (lihat saja) */
body.viewer [data-action="add"], body.viewer [data-action="edit"], body.viewer [data-action="delete"],
body.viewer .add-card, body.viewer .editor-only, body.viewer .card-actions, body.viewer .col-actions { display: none !important; }
body.viewer .month-cell, body.viewer button.badge { pointer-events: none; }
body.viewer .month-cell:not(.on) { border-color: #eef1f6; }

/* ---------- Dropdown instansi (custom select) ---------- */
.select { position: relative; }
.select-trigger {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
  cursor: pointer; text-align: left; transition: border-color .2s, box-shadow .2s, background .2s;
}
.select-trigger:hover { border-color: #cbd5e1; background: #fcfcff; }
.select.open .select-trigger, .select-trigger:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.field.invalid .select-trigger { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(220, 38, 38, .1); }
.select-value { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.select-value.placeholder { color: #94a3b8; font-weight: 400; }
.select-value .opt-icon { width: 28px; height: 28px; border-radius: 8px; }
.select-value .opt-icon svg { width: 15px; height: 15px; }
.select-value .swap { display: inline-flex; align-items: center; gap: 10px; animation: valueIn .3s var(--ease); }
@keyframes valueIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.select-chev { width: 18px; height: 18px; color: var(--muted); flex: none; transition: transform .35s var(--spring), color .2s; }
.select.open .select-chev { transform: rotate(180deg); color: var(--primary); }

.select-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none;
  background: #fff;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 48px -18px rgba(15, 23, 42, .38);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-8px) scale(.97); transform-origin: top center;
  transition: opacity .18s var(--ease), transform .2s var(--ease), visibility 0s .2s;
}
.select.open .select-menu {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .2s var(--ease), transform .32s var(--spring), visibility 0s;
}
.select-menu:focus { outline: none; }
.opt { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; transition: background .15s, transform .15s; }
.select.open .opt { animation: optIn .32s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + 40ms); }
@keyframes optIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.opt.active { background: var(--primary-soft); }
.opt:active { transform: scale(.98); }
.opt-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; transition: transform .25s var(--spring); }
.opt-icon svg { width: 18px; height: 18px; }
.opt.active .opt-icon { transform: scale(1.08) rotate(-4deg); }
.opt-text { min-width: 0; }
.opt-text b { display: block; font-size: .86rem; letter-spacing: .01em; }
.opt-text small { display: block; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-check { margin-left: auto; width: 18px; height: 18px; flex: none; color: var(--primary); opacity: 0; transform: scale(.3); transition: opacity .2s, transform .3s var(--spring); }
.opt[aria-selected="true"] .opt-check { opacity: 1; transform: scale(1); }
.opt[aria-selected="true"] .opt-text b { color: var(--primary); }
.opt-sep { height: 1px; background: var(--border); margin: 5px 8px; }

.other-wrap { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s var(--ease), opacity .25s, margin .35s var(--ease); }
.other-wrap > div { overflow: hidden; padding: 0 2px; }
.other-wrap.show { grid-template-rows: 1fr; opacity: 1; margin-top: 8px; }
.other-wrap > div > input { margin: 2px 0 4px; }
.gate .field[data-key="instansi"] { position: relative; z-index: 6; }
