/* ============================================================
   PortalAkasia— ADMIN PANEL CSS (FULL)
   Adopted from prototype index.html
   ============================================================ */

:root{
  --bg:#f6f7fb; --surface:#ffffff; --surface-2:#f1f3f9; --surface-3:#e8ebf3;
  --text:#0f172a; --text-muted:#64748b; --border:#e2e8f0;
  --primary:#6366f1; --primary-600:#4f46e5; --primary-50:#eef2ff;
  --success:#10b981; --success-50:#ecfdf5;
  --warning:#f59e0b; --warning-50:#fffbeb;
  --danger:#ef4444; --danger-50:#fef2f2;
  --info:#0ea5e9; --info-50:#f0f9ff;
  --shadow-sm:0 1px 2px rgba(15,23,42,.04);
  --shadow:0 4px 16px rgba(15,23,42,.06);
  --shadow-lg:0 12px 32px rgba(15,23,42,.08);
  --radius:14px; --radius-sm:10px; --radius-lg:20px;
  --gradient:linear-gradient(135deg,#6366f1 0%,#8b5cf6 100%);
  --sidebar-w:260px;
}
[data-theme="dark"]{
  --bg:#0b1020; --surface:#121831; --surface-2:#1a2142; --surface-3:#232b52;
  --text:#e6e9f5; --text-muted:#8a93b8; --border:#232b52;
  --primary:#818cf8; --primary-600:#6366f1; --primary-50:#1e1b4b;
  --success:#34d399; --success-50:#064e3b;
  --warning:#fbbf24; --warning-50:#451a03;
  --danger:#f87171; --danger-50:#450a0a;
  --info:#38bdf8; --info-50:#0c4a6e;
  --shadow-sm:0 1px 2px rgba(0,0,0,.3);
  --shadow:0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:0 12px 32px rgba(0,0,0,.5);
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:'Roboto','Inter',system-ui,-apple-system,sans-serif;
  background:var(--bg);color:var(--text);
  -webkit-font-smoothing:antialiased;overflow-x:hidden;font-size:14px;
  transition:background .3s ease, color .3s ease;
}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
input,select,textarea{font-family:inherit;outline:none}
a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app{display:none;min-height:100vh}
#app.active{display:flex}

/* ============================================================
   PAGE LOADER
   ============================================================ */
.page-loader{
  display:none;position:fixed;top:0;left:0;right:0;height:3px;z-index:1000;
  background:var(--surface-3);
}
.page-loader.active{display:block}
.page-loader::after{
  content:'';display:block;height:100%;
  background:var(--gradient);
  animation:loadBar 1s ease-in-out infinite;
}
@keyframes loadBar{
  0%{width:0;margin-left:0}
  50%{width:50%}
  100%{width:0;margin-left:100%}
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar{
  width:var(--sidebar-w);background:var(--surface);
  border-right:1px solid var(--border);
  position:fixed;top:0;left:0;bottom:0;
  display:flex;flex-direction:column;z-index:50;
  transition:transform .3s ease;
}
.sidebar-header{
  padding:18px;border-bottom:1px solid var(--border);
  display:flex;align-items:center;gap:12px;
}
.sidebar-header .logo{flex-shrink:0}
.sidebar-header .logo img{width:32px;height:32px;object-fit:contain;border-radius:8px}
.logo-box{
  width:32px;height:32px;border-radius:8px;
  background:var(--gradient);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:16px;
}
.brand{min-width:0}
.brand h3{font-size:14px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand p{font-size:11px;color:var(--text-muted)}

.sidebar-nav{flex:1;overflow-y:auto;padding:12px 10px}
.sidebar-nav::-webkit-scrollbar{width:4px}
.nav-group{margin-bottom:12px}
.nav-group-title{
  font-size:10px;font-weight:700;color:var(--text-muted);
  text-transform:uppercase;letter-spacing:.5px;padding:8px 10px 6px;
}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:9px 10px;border-radius:8px;
  font-size:13px;font-weight:500;color:var(--text-muted);
  cursor:pointer;transition:all .2s;margin-bottom:2px;position:relative;
}
.nav-item:hover{background:var(--surface-2);color:var(--text)}
.nav-item.active{background:var(--primary-50);color:var(--primary);font-weight:600}
.nav-item i{width:18px;height:18px;flex-shrink:0}
.nav-item.disabled{opacity:.5;cursor:not-allowed}
.nav-item.disabled:hover{background:transparent;color:var(--text-muted)}
.soon-badge{
  font-size:9px;padding:2px 6px;border-radius:6px;
  background:var(--surface-3);color:var(--text-muted);
  font-weight:600;letter-spacing:.3px;margin-left:auto;flex-shrink:0;
}
.sidebar-footer{
  padding:14px;border-top:1px solid var(--border);
  display:flex;align-items:center;gap:10px;
}
.avatar{
  width:36px;height:36px;border-radius:50%;
  background:var(--gradient);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:13px;flex-shrink:0;
}
.sidebar-footer .info{flex:1;min-width:0}
.sidebar-footer .info .n{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-footer .info .r{font-size:11px;color:var(--text-muted)}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:49}
.sidebar-overlay.active{display:block}

/* ============================================================
   MAIN WRAP & TOPBAR
   ============================================================ */
.main-wrap{margin-left:var(--sidebar-w);flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{
  position:sticky;top:0;z-index:40;
  background:var(--surface);border-bottom:1px solid var(--border);
  padding:12px 20px;display:flex;align-items:center;justify-content:space-between;
  gap:12px;backdrop-filter:blur(12px);
}
.topbar-left{display:flex;align-items:center;gap:12px;min-width:0;flex:1}
.menu-toggle{display:none;width:38px;height:38px;border-radius:10px;background:var(--surface-2);align-items:center;justify-content:center}
.page-title{font-size:18px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-right{display:flex;align-items:center;gap:8px}
.icon-btn{
  width:38px;height:38px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  background:var(--surface-2);color:var(--text);
  position:relative;transition:all .2s;
}
.icon-btn:hover{background:var(--surface-3);transform:translateY(-1px)}
.icon-btn .badge{
  position:absolute;top:4px;right:4px;min-width:16px;height:16px;padding:0 4px;
  background:var(--danger);color:#fff;border-radius:8px;font-size:10px;font-weight:700;
  display:flex;align-items:center;justify-content:center;
}

/* ============================================================
   CONTENT
   ============================================================ */
.content{padding:20px;flex:1;position:relative}

/* ============================================================
   STAT GRID
   ============================================================ */
.stat-grid{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:14px;margin-bottom:20px;
}
.stat-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:18px;transition:all .25s ease;
}
.stat-card:hover{box-shadow:var(--shadow);transform:translateY(-2px)}
.stat-card .head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.stat-card .ic{
  width:40px;height:40px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
}
.stat-card .ic.primary{background:var(--primary-50);color:var(--primary)}
.stat-card .ic.success{background:var(--success-50);color:var(--success)}
.stat-card .ic.warning{background:var(--warning-50);color:var(--warning)}
.stat-card .ic.danger{background:var(--danger-50);color:var(--danger)}
.stat-card .ic.info{background:var(--info-50);color:var(--info)}
.stat-card .lbl{font-size:12px;color:var(--text-muted);font-weight:500}
.stat-card .val{font-size:24px;font-weight:800;margin-top:4px;letter-spacing:-.3px}
.stat-card .delta{font-size:11px;color:var(--success);margin-top:4px;font-weight:600}
.stat-card .delta.down{color:var(--danger)}
.stat-card .delta.neutral{color:var(--text-muted)}

/* ============================================================
   CARD
   ============================================================ */
.card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:18px;
  box-shadow:var(--shadow-sm);margin-bottom:16px;transition:box-shadow .2s;
}
.card:hover{box-shadow:var(--shadow)}
.card-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px;flex-wrap:wrap}
.card-head h3{font-size:15px;font-weight:700}
.card-head .actions{display:flex;gap:8px;flex-wrap:wrap}

.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}

.chart-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px;margin-bottom:16px}
.chart-card h3{font-size:15px;font-weight:700;margin-bottom:14px}
.chart-wrap{position:relative;height:280px}

/* ============================================================
   BUTTON
   ============================================================ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 16px;border-radius:var(--radius-sm);
  font-weight:600;font-size:13px;transition:all .2s;white-space:nowrap;
  border:none;cursor:pointer;font-family:inherit;
}
.btn-primary{background:var(--gradient);color:#fff}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(99,102,241,.3)}
.btn-ghost{background:var(--surface-2);color:var(--text)}
.btn-ghost:hover{background:var(--surface-3)}
.btn-outline{background:transparent;border:1px solid var(--border);color:var(--text)}
.btn-outline:hover{background:var(--surface-2)}
.btn-success{background:var(--success);color:#fff}
.btn-danger{background:var(--danger);color:#fff}
.btn-danger:hover{background:#dc2626}
.btn-warning{background:var(--warning);color:#fff}
.btn-sm{padding:7px 12px;font-size:12px;border-radius:8px}
.btn-xs{padding:4px 8px;font-size:11px;border-radius:6px}
.btn-block{width:100%}

/* ============================================================
   FORM
   ============================================================ */
.form-group{margin-bottom:14px}
.form-group label{display:block;font-size:13px;font-weight:500;margin-bottom:6px;color:var(--text-muted)}
.form-group input,.form-group select,.form-group textarea{
  width:100%;padding:11px 14px;background:var(--surface-2);
  border:1px solid var(--border);border-radius:var(--radius-sm);
  color:var(--text);font-size:14px;transition:all .2s;
}
.form-group input:focus,.form-group select:focus,.form-group textarea:focus{
  border-color:var(--primary);background:var(--surface);
  box-shadow:0 0 0 3px rgba(99,102,241,.1);
}
.form-group textarea{min-height:100px;resize:vertical}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;padding-top:16px;border-top:1px solid var(--border)}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px;align-items:center}
.search-box{
  flex:1;min-width:200px;display:flex;align-items:center;gap:8px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-sm);padding:9px 12px;transition:border-color .2s;
}
.search-box:focus-within{border-color:var(--primary)}
.search-box input{flex:1;background:transparent;border:none;color:var(--text);font-size:13px;min-width:80px}
.filter-select{
  padding:9px 12px;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-sm);font-size:13px;color:var(--text);min-width:120px;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.table-scroll{overflow:auto;max-height:min(68vh,760px);position:relative}
table{width:100%;border-collapse:separate;border-spacing:0;font-size:13px}
thead{background:var(--surface-2)}
thead th{
  position:sticky;top:0;z-index:10;background:var(--surface-2);
  text-align:left;padding:12px;font-weight:600;font-size:12px;
  color:var(--text-muted);text-transform:uppercase;letter-spacing:.3px;
  white-space:nowrap;border-bottom:1px solid var(--border);
}
td{padding:12px;border-bottom:1px solid var(--border);vertical-align:middle}
tbody tr{transition:background .15s}
tbody tr:hover{background:var(--surface-2)}
tbody tr:last-child td{border-bottom:none}

/* ============================================================
   BADGE
   ============================================================ */
.badge{
  display:inline-flex;align-items:center;gap:4px;
  padding:3px 9px;border-radius:20px;font-size:11px;font-weight:600;white-space:nowrap;
}
.badge.success{background:var(--success-50);color:var(--success)}
.badge.danger{background:var(--danger-50);color:var(--danger)}
.badge.warning{background:var(--warning-50);color:var(--warning)}
.badge.info{background:var(--info-50);color:var(--info)}
.badge.primary{background:var(--primary-50);color:var(--primary)}
.badge.neutral{background:var(--surface-2);color:var(--text-muted)}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination{
  display:flex;justify-content:space-between;align-items:center;
  padding:12px;border-top:1px solid var(--border);gap:10px;flex-wrap:wrap;
}
.pagination .info{font-size:12px;color:var(--text-muted)}
.pagination .pages{display:flex;gap:4px;flex-wrap:wrap}
.page-btn{
  min-width:32px;height:32px;padding:0 8px;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--surface-2);border-radius:8px;
  font-size:12px;font-weight:600;color:var(--text);transition:all .2s;
}
.page-btn:hover{background:var(--surface-3)}
.page-btn.active{background:var(--primary);color:#fff}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress-bar{height:8px;background:var(--surface-3);border-radius:4px;overflow:hidden}
.progress-bar .fill{height:100%;background:var(--gradient);border-radius:4px;transition:width .6s ease}

/* ============================================================
   MINI MONTH GRID
   ============================================================ */
.mini-month-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:3px;max-width:160px}
.mini-month-cell{
  width:20px;height:20px;border-radius:4px;
  display:flex;align-items:center;justify-content:center;
  font-size:8px;font-weight:700;color:#fff;
  transition:all .2s;cursor:default;border:1px solid transparent;
}
.mini-month-cell.paid{background:var(--success);color:#fff}
.mini-month-cell.unpaid{background:var(--danger);color:#fff}
.mini-month-cell.future{background:var(--surface-3);color:var(--text-muted);border:1px solid var(--border)}

/* ============================================================
   DETAIL CARD
   ============================================================ */
.detail-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:12px}
.detail-card .header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;flex-wrap:wrap;gap:6px}
.detail-card .header h3{font-size:14px;font-weight:700}
.detail-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin-bottom:12px}
.detail-grid .item{background:var(--surface-2);padding:10px;border-radius:8px;text-align:center}
.detail-grid .item .label{font-size:10px;color:var(--text-muted)}
.detail-grid .item .value{font-size:16px;font-weight:700;margin-top:2px}
.month-invoice-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:4px;margin-top:10px}
.month-invoice-btn{
  padding:5px 3px;border-radius:5px;font-size:10px;font-weight:600;
  text-align:center;cursor:pointer;border:1px solid var(--border);
  background:var(--surface-2);transition:all .2s;
}
.month-invoice-btn:hover{transform:scale(1.04)}
.month-invoice-btn.paid{background:var(--success);color:#fff;border-color:var(--success)}
.month-invoice-btn.unpaid{background:var(--danger);color:#fff;border-color:var(--danger)}
.month-invoice-btn.future{background:var(--surface-3);color:var(--text-muted);cursor:default}
.month-invoice-btn .label{font-size:8px;opacity:.8}
.month-invoice-btn .amount{font-size:8px}

/* ============================================================
   FAMILY / LOG
   ============================================================ */
.family-item{display:flex;gap:12px;padding:10px 0;border-bottom:1px solid var(--border);align-items:center}
.family-item:last-child{border-bottom:none}
.family-avatar{
  width:40px;height:40px;border-radius:50%;
  background:var(--primary-50);color:var(--primary);
  display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:13px;flex-shrink:0;
}
.family-info{flex:1;min-width:0}
.family-name{font-size:13px;font-weight:600}
.family-meta{font-size:11px;color:var(--text-muted);margin-top:2px}

.log-item{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--border);align-items:center}
.log-item:last-child{border-bottom:none}
.log-badge{
  font-size:10px;font-weight:700;padding:3px 8px;border-radius:6px;
  background:var(--surface-2);color:var(--text-muted);text-transform:uppercase;
  white-space:nowrap;flex-shrink:0;
}
.log-badge.login{background:var(--primary-50);color:var(--primary)}
.log-badge.create{background:var(--success-50);color:var(--success)}
.log-badge.update{background:var(--info-50);color:var(--info)}
.log-badge.delete{background:var(--danger-50);color:var(--danger)}
.log-badge.setting{background:var(--warning-50);color:var(--warning)}
.log-body{flex:1;min-width:0}
.log-title{font-size:13px;font-weight:500}
.log-meta{font-size:11px;color:var(--text-muted);margin-top:2px}

/* ============================================================
   QUICK GRID
   ============================================================ */
.quick-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
.quick-card{
  padding:18px;background:var(--surface-2);border-radius:12px;
  display:flex;flex-direction:column;align-items:center;gap:8px;
  font-size:13px;font-weight:600;color:var(--text);
  transition:all .2s;cursor:pointer;text-align:center;
}
.quick-card:hover{background:var(--primary-50);color:var(--primary);transform:translateY(-2px)}
.quick-card i{color:var(--primary)}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state{text-align:center;padding:30px 16px;color:var(--text-muted)}
.empty-state .ic{
  width:50px;height:50px;border-radius:50%;background:var(--surface-2);
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 10px;font-size:24px;
}
.empty-state h4{font-size:14px;font-weight:600;color:var(--text);margin-bottom:4px}
.empty-state p{font-size:12px}

/* ============================================================
   ACTION BUTTONS
   ============================================================ */
.action-btns{display:flex;gap:3px;flex-wrap:wrap}
.action-btns button,.action-btns a{padding:4px 7px;font-size:10px;border-radius:5px}

/* ============================================================
   MODAL
   ============================================================ */

.month-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:6px}
.month-cell{
  padding:8px 4px;text-align:center;background:var(--surface-2);
  border-radius:8px;cursor:pointer;transition:all .2s;
  border:1px solid transparent;font-size:11px;
}
.month-cell:hover{border-color:var(--primary);transform:translateY(-2px)}
.month-cell .m{font-size:10px;font-weight:600;color:var(--text-muted)}
.month-cell .s{font-size:14px;margin-top:2px}
.month-cell.paid{background:var(--success-50);color:var(--success)}
.month-cell.paid .m{color:var(--success)}
.month-cell.unpaid{background:var(--danger-50);color:var(--danger)}
.month-cell.unpaid .m{color:var(--danger)}
.month-cell.partial{background:var(--warning-50);color:var(--warning)}
.month-cell.partial .m{color:var(--warning)}
.month-cell.future{background:var(--surface-2);color:var(--text-muted);opacity:.5}
.month-cell.overdue{background:var(--danger-50);color:var(--danger);border-color:var(--danger)}

@media (max-width:640px){
  .month-grid{grid-template-columns:repeat(3,1fr)}
}

.modal-backdrop{
  position:fixed;inset:0;z-index:200;
  background:rgba(15,23,42,.6);backdrop-filter:blur(4px);
  display:none;align-items:center;justify-content:center;padding:20px;
  animation:fadeIn .2s ease;
}
.modal-backdrop.active{display:flex}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.modal{
  background:var(--surface);border-radius:var(--radius-lg);
  width:100%;max-width:600px;max-height:90vh;overflow-y:auto;
  padding:24px;animation:slideUpModal .3s ease;
}
.modal.lg{max-width:900px}
@keyframes slideUpModal{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
.modal h3{font-size:18px;font-weight:700;margin-bottom:4px}
.modal .sub{font-size:13px;color:var(--text-muted);margin-bottom:16px}
.modal-actions{display:flex;gap:10px;margin-top:20px;justify-content:flex-end;flex-wrap:wrap}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container{
  position:fixed;top:20px;right:20px;z-index:500;
  display:flex;flex-direction:column;gap:8px;pointer-events:none;max-width:380px;
}
.toast{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius);padding:12px 14px;
  box-shadow:var(--shadow-lg);
  display:flex;align-items:center;gap:10px;
  animation:toastIn .3s ease;pointer-events:auto;
}
@keyframes toastIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}
.toast.success{border-left:3px solid var(--success)}
.toast.error{border-left:3px solid var(--danger)}
.toast.info{border-left:3px solid var(--info)}
.toast.warning{border-left:3px solid var(--warning)}
.toast .msg{font-size:13px;font-weight:500;flex:1}

/* ============================================================
   NOTIF PANEL
   ============================================================ */
.notif-panel{
  position:fixed;top:0;right:0;bottom:0;
  width:380px;max-width:100%;
  background:var(--surface);border-left:1px solid var(--border);
  z-index:250;transform:translateX(100%);
  transition:transform .3s ease;display:flex;flex-direction:column;
  box-shadow:-8px 0 32px rgba(15,23,42,.1);
}
.notif-panel.active{transform:translateX(0)}
.notif-panel-head{
  padding:16px 20px;border-bottom:1px solid var(--border);
  display:flex;justify-content:space-between;align-items:center;
}
.notif-panel-head h3{font-size:15px;font-weight:700}
.notif-panel-body{flex:1;overflow-y:auto;padding:12px}

/* ============================================================
   FAMILY ROW (dynamic form)
   ============================================================ */
.family-row{display:grid;grid-template-columns:2fr 1fr 80px 1fr auto;gap:6px;margin-bottom:6px;align-items:end}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:1024px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:translateX(0)}
  .sidebar-overlay.active{display:block}
  .main-wrap{margin-left:0}
  .menu-toggle{display:flex}
  .grid-2,.grid-3{grid-template-columns:1fr}
  .form-row{grid-template-columns:1fr}
  .page-title{font-size:15px}
  .detail-grid{grid-template-columns:1fr 1fr}
  .month-invoice-grid{grid-template-columns:repeat(3,1fr)}
  .modal{padding:16px;max-width:100%;margin:10px}
  .family-row{grid-template-columns:1fr 1fr;gap:4px}
}
@media (max-width:640px){
  .content{padding:14px}
  .stat-grid{grid-template-columns:1fr 1fr;gap:8px}
  .stat-card{padding:12px}
  .stat-card .val{font-size:18px}
  .stat-card .lbl{font-size:10px}
  .topbar{padding:8px 12px}
  .topbar h2{font-size:15px}
  .icon-btn{width:32px;height:32px}
  .notif-panel{width:100%}
  .modal-actions .btn{padding:8px 14px;font-size:12px}
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}

/* ============================================================
   UTILITY
   ============================================================ */
.text-center{text-align:center}
.text-right{text-align:right}
.text-muted{color:var(--text-muted)}
.mt-1{margin-top:8px}
.mt-2{margin-top:16px}
.mb-1{margin-bottom:8px}
.mb-2{margin-bottom:16px}

/* ============================================================
   PROGRESS BAR SHINE (realtime indicator)
   ============================================================ */
.progress-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* ============================================================
   PRINT HELPER — untuk halaman print standalone
   ============================================================ */
@media print {
  body { background: #fff !important; }
  .no-print { display: none !important; }
}

/* ============================================================
   DASHBOARD — Activity Feed
   ============================================================ */

.activity-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 8px;
}

.activity-tab {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.activity-tab:hover {
  color: var(--text);
}

.activity-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.activity-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: var(--surface-3);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.activity-tab.active .activity-tab-count {
  background: var(--primary);
  color: #fff;
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 62px;
  text-align: center;
}

/* Warna per type */
.activity-badge.payment  { background: var(--success-50); color: var(--success); }
.activity-badge.create   { background: var(--info-50);    color: var(--info); }
.activity-badge.update   { background: var(--primary-50); color: var(--primary); }
.activity-badge.delete   { background: var(--danger-50);  color: var(--danger); }
.activity-badge.login    { background: var(--surface-2);  color: var(--text-muted); }
.activity-badge.logout   { background: var(--surface-2);  color: var(--text-muted); }
.activity-badge.setting  { background: var(--warning-50); color: var(--warning); }
.activity-badge.payroll  { background: var(--info-50);    color: var(--info); }

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.activity-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  flex-wrap: wrap;
}