*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; background: #f0f4f8; color: #1e293b; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* LAYOUT */
.admin-layout { display: flex; min-height: 100dvh; }

/* SIDEBAR */
.aside {
  width: 220px; background: #1a3a6b; flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.aside-mobile-head { display: none; }
.sidebar-overlay { display: none; }
.aside-brand { padding: 18px 14px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.aside-brand-logo { display:block; width:150px; height:70px; object-fit:contain; margin:0 auto 4px; }
.aside-brand-name { font-size: 13px; font-weight: 700; color: #fff; }
.aside-brand-sub  { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 2px; }
.aside-nav { flex: 1; padding: 6px 0; overflow-y: auto; }
.aside-section { padding: 10px 8px 2px; }
.aside-section-lbl { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.3); text-transform: uppercase; letter-spacing: .6px; padding: 0 6px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 7px;
  cursor: pointer; color: rgba(255,255,255,.55);
  font-size: 12px; font-weight: 500;
  transition: all .15s; margin-bottom: 1px;
  background: none; border: none; width: 100%; text-align: left;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.18); color: #fff; }
.nav-link i { font-size: 15px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: #f97316; color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 10px; }
.aside-user { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 8px; }
.aside-avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; }
.aside-uname { font-size: 11px; color: #fff; font-weight: 500; }
.aside-urole { font-size: 10px; color: rgba(255,255,255,.4); }
.aside-logout { margin-left: auto; background: none; border: none; color: rgba(255,255,255,.4); cursor: pointer; font-size: 16px; }
.aside-logout:hover { color: #fff; }

/* MAIN CONTENT */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* TOPBAR */
.admin-topbar {
  background: #fff; padding: 10px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.admin-topbar-title { font-size: 14px; font-weight: 600; color: #1e293b; flex: 1; }
.mobile-menu-toggle { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; border: 1px solid #e2e8f0; border-radius: 9px; color: #1a3a6b; background: #fff; font-size: 20px; }
.admin-search { display: flex; align-items: center; background: #f1f5f9; border-radius: 7px; padding: 5px 10px; gap: 6px; border: 1px solid #e2e8f0; }
.admin-search input { border: none; background: transparent; font-size: 12px; color: #1e293b; outline: none; width: 160px; }
.admin-search input::placeholder { color: #94a3b8; }
.admin-search i { color: #94a3b8; font-size: 14px; }

.admin-content { flex: 1; padding: 20px; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 18px; font-weight: 700; color: #1e293b; }
.page-sub { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* CARDS */
.card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 16px 18px; }
.card-title { font-size: 12px; font-weight: 700; color: #1e293b; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* KPI GRID */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 14px 16px; }
.kpi-lbl { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.kpi-val { font-size: 22px; font-weight: 700; color: #1e293b; line-height: 1; }
.kpi-sub { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.badge-up { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: #dcfce7; color: #166534; }
.badge-dn { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: #fee2e2; color: #991b1b; }
.kpi-period { font-size: 10px; color: #94a3b8; }

/* GRID LAYOUTS */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .4px; padding: 0 10px 10px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.data-table td { font-size: 12px; color: #1e293b; padding: 10px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
.data-table tr:last-child td { border: none; }
.data-table tr:hover td { background: #f8fafc; }

/* BADGES */
.badge { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 10px; font-weight: 600; }
.badge-done    { background: #dcfce7; color: #166534; }
.badge-void    { background: #fee2e2; color: #991b1b; }
.badge-refund  { background: #fef9c3; color: #854d0e; }
.badge-di      { background: #E6F1FB; color: #0C447C; }
.badge-to      { background: #fff7ed; color: #c2410c; }
.badge-active  { background: #dcfce7; color: #166534; }
.badge-inactive{ background: #f1f5f9; color: #64748b; }
.badge-admin   { background: #E6F1FB; color: #1a3a6b; }
.badge-kasir   { background: #f1f5f9; color: #64748b; }
.badge-supervisor { background: #fef9c3; color: #854d0e; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; }
.btn-primary   { background: #1a3a6b; color: #fff; }
.btn-primary:hover { background: #0f2d56; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: #fff; color: #dc2626; border: 1.5px solid #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; cursor: pointer; font-size: 15px; }
.btn-icon:hover { background: #e2e8f0; }

/* FORM */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 11px; font-weight: 600; color: #475569; margin-bottom: 4px; display: block; }
.form-input {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; color: #1e293b;
  background: #f8fafc; outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: #1a3a6b; background: #fff; }
.form-input::placeholder { color: #94a3b8; }
.form-select { width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #1e293b; background: #f8fafc; outline: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,45,86,.5); display: flex; align-items: center; justify-content: center; z-index: 500; animation: fadeIn .2s ease; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: 90%; max-width: 480px; border: 1px solid #e2e8f0; box-shadow: 0 20px 60px rgba(0,0,0,.15); animation: slideUp .25s ease; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 15px; font-weight: 700; color: #1e293b; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; }
.modal-footer { display: flex; gap: 8px; margin-top: 20px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* TOAST */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 12px; font-weight: 500; max-width: 300px; animation: slideInR .3s ease, fadeOut .3s ease 2.7s forwards; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
.toast.info    { background: #1a3a6b; }
@keyframes slideInR { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut  { to { opacity: 0; transform: translateX(110%); } }

/* PERIOD DROPDOWN */
.period-dd { position: relative; display: inline-block; }
.period-trigger { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font-size: 12px; font-weight: 500; color: #1e293b; cursor: pointer; }
.period-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; box-shadow: 0 4px 16px rgba(0,0,0,.1); z-index: 50; min-width: 150px; overflow: hidden; }
.period-menu.open { display: block; }
.pm-item { padding: 8px 14px; font-size: 12px; color: #475569; cursor: pointer; }
.pm-item:hover { background: #f1f5f9; }
.pm-item.sel { color: #1a3a6b; font-weight: 600; background: #E6F1FB; }

/* TOGGLE SWITCH */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle { width: 36px; height: 20px; border-radius: 10px; border: none; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle.on  { background: #1a3a6b; }
.toggle.off { background: #cbd5e1; }
.toggle::after { content: ''; position: absolute; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle.on::after  { left: 18px; }
.toggle.off::after { left: 2px; }

/* SPINNER */
.spinner { width: 28px; height: 28px; border: 3px solid #e2e8f0; border-top-color: #1a3a6b; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 60px 0; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 40px 0; color: #94a3b8; }
.empty-state i { font-size: 32px; display: block; margin-bottom: 10px; opacity: .4; }
.empty-state p { font-size: 13px; }

/* HOURLY CHART */
.chart-note { font-size: 11px; color: #64748b; margin: -5px 0 8px; }
.peak-hours { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.peak-label { font-size: 11px; font-weight: 700; color: #475569; margin-right: 2px; }
.peak-chip { font-size: 11px; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 999px; padding: 4px 8px; }

/* DEMO BARS */
.demo-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.demo-bar-name { font-size: 11px; color: #475569; width: 70px; flex-shrink: 0; }
.demo-track { flex: 1; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.demo-fill { height: 100%; border-radius: 3px; }
.demo-pct { font-size: 10px; color: #94a3b8; width: 30px; text-align: right; flex-shrink: 0; }

/* SECTION MARGIN */
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-16 { margin-top: 16px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.report-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.finance-kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.finance-columns { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; align-items: start; }
.finance-expense-row { display: grid; grid-template-columns: minmax(170px, 1fr) 110px 78px 76px 32px; gap: 8px; align-items: center; border-bottom: 1px solid #f1f5f9; padding: 9px 0; font-size: 12px; }
.finance-created-by { grid-column: 1 / -1; color: #94a3b8; font-size: 10px; }

/* RESPONSIVE ADMIN */
@media (max-width: 900px) {
  .aside { width: 200px; }
  .admin-content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .finance-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .finance-columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { overflow-x: hidden; }
  .admin-layout { display: block; }
  .aside { position: fixed; inset: 0 auto 0 0; width: min(290px, 84vw); height: 100dvh; z-index: 1000; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(15,45,86,.2); }
  .aside.mobile-open { transform: translateX(0); }
  .aside-mobile-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 0; color: rgba(255,255,255,.75); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
  .aside-mobile-close { width: 40px; height: 40px; border: 0; border-radius: 9px; color: #fff; background: rgba(255,255,255,.12); font-size: 19px; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 999; background: rgba(15,23,42,.48); opacity: 0; pointer-events: none; transition: opacity .2s ease; display: block; }
  .sidebar-overlay.visible { opacity: 1; pointer-events: auto; }
  .admin-topbar { padding: 8px 12px; gap: 8px; }
  .mobile-menu-toggle { display: inline-flex; flex-shrink: 0; }
  .admin-topbar-title { font-size: 13px; }
  .admin-search { flex: 0 0 auto; padding: 5px 8px; }
  .admin-search input { width: min(30vw, 120px); }
  .admin-topbar > #live-date { display: none; }
  .admin-content { padding: 14px 12px 24px; }
  .page-header { align-items: flex-start; gap: 10px; margin-bottom: 14px; }
  .page-title { font-size: 17px; }
  .page-sub { font-size: 11px; }
  .period-trigger { min-height: 40px; padding: 6px 9px; font-size: 11px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .finance-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { min-width: 0; padding: 12px 11px; }
  .kpi-lbl { font-size: 9px; line-height: 1.25; min-height: 23px; }
  .kpi-val { font-size: clamp(17px, 5.6vw, 23px); line-height: 1.1; overflow-wrap: anywhere; }
  .kpi-sub { gap: 4px; flex-wrap: wrap; margin-top: 7px; }
  .badge-up, .badge-dn, .kpi-period { font-size: 9px; }
  .card { border-radius: 11px; padding: 14px 12px; }
  .grid-2-1, .grid-1-2 { gap: 12px; }
  .mb-20 { margin-bottom: 14px; }
  .data-table { min-width: 430px; }
  .card:has(.data-table) { overflow-x: auto; }
  .peak-chip { font-size: 10px; }
  .attendance-report-modal { padding: 18px !important; }
  .report-detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .finance-expense-row { grid-template-columns: minmax(130px, 1fr) 95px 58px 58px 32px; gap: 5px; font-size: 11px; }
}

@media (max-width: 390px) {
  .admin-search input { width: 86px; }
  .period-trigger span { max-width: 76px; white-space: normal; line-height: 1.15; }
  .kpi-card { padding: 11px 9px; }
  .kpi-val { font-size: 16px; }
}
