/* ===========================
   RESET & BASE
=========================== */
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;font-size:16px}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#F0F4F8;color:#1A202C;overscroll-behavior:none}

/* ===========================
   LOGIN
=========================== */
.login-body{background:linear-gradient(160deg,#0284C7 0%,#075985 100%);min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.login-wrap{width:100%;max-width:400px}
.login-logo{text-align:center;margin-bottom:32px;color:#fff}
.login-icon{font-size:52px;display:block;margin-bottom:8px}
.login-logo h1{font-size:26px;font-weight:700;margin-bottom:4px}
.login-logo p{font-size:14px;opacity:.8}
.login-card{background:#fff;border-radius:20px;padding:28px;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.login-hint{text-align:center;font-size:12px;color:#94A3B8;margin-top:14px}

/* ===========================
   APP SHELL
=========================== */
.app-header{position:fixed;top:0;left:0;right:0;height:60px;background:#0284C7;color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 16px;z-index:100;box-shadow:0 2px 8px rgba(0,0,0,.15)}
.header-left{display:flex;align-items:center;gap:10px}
.header-logo{font-size:24px}
.header-title{font-size:16px;font-weight:700;line-height:1.2}
.header-sub{font-size:11px;opacity:.8}
.header-right{display:flex;align-items:center;gap:8px}
.role-badge{font-size:11px;font-weight:600;padding:3px 10px;border-radius:20px;background:rgba(255,255,255,.2);color:#fff}
.role-badge.role-admin{background:#FEF3C7;color:#92400E}
.role-badge.role-operator{background:#DCFCE7;color:#166534}
.role-badge.role-owner{background:#EDE9FE;color:#4C1D95}
.btn-icon{background:rgba(255,255,255,.15);border:none;color:#fff;width:34px;height:34px;border-radius:50%;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center}

.app-main{margin-top:60px;padding-bottom:80px;min-height:calc(100vh - 60px)}

/* ===========================
   BOTTOM NAV
=========================== */
.bottom-nav{position:fixed;bottom:0;left:0;right:0;background:#fff;border-top:1px solid #E2E8F0;display:flex;z-index:100;box-shadow:0 -2px 12px rgba(0,0,0,.08)}
.nav-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 4px 12px;border:none;background:none;cursor:pointer;color:#94A3B8;font-size:10px;font-family:inherit;transition:color .2s}
.nav-item.active{color:#0284C7}
.nav-icon{font-size:22px;line-height:1}
.nav-label{font-size:10px;font-weight:500}

/* ===========================
   PAGES
=========================== */
.page{display:none;padding:16px}
.page.active{display:block}
.page-header{margin-bottom:12px}
.date-label{font-size:13px;color:#64748B;font-weight:500}

/* ===========================
   CARDS & FORMS
=========================== */
.card{background:#fff;border-radius:14px;padding:16px;box-shadow:0 1px 4px rgba(0,0,0,.06);margin-bottom:12px}
.form-card{margin-bottom:0}

.section-title{font-size:12px;font-weight:700;color:#94A3B8;text-transform:uppercase;letter-spacing:.6px;margin:20px 0 10px}

.form-group{margin-bottom:14px}
.form-group:last-child{margin-bottom:0}
label{display:block;font-size:13px;font-weight:600;color:#475569;margin-bottom:6px}
.required{color:#EF4444;font-size:11px;font-weight:400}
input[type="text"],input[type="number"],input[type="date"],input[type="month"],input[type="password"],select,textarea{
  width:100%;padding:11px 14px;border:1.5px solid #E2E8F0;border-radius:10px;font-size:15px;font-family:inherit;
  background:#fff;color:#1A202C;appearance:none;-webkit-appearance:none;transition:border-color .2s}
input:focus,select:focus,textarea:focus{outline:none;border-color:#0284C7;box-shadow:0 0 0 3px rgba(2,132,199,.12)}
textarea{resize:vertical;min-height:60px}
select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center}
input[type="number"]::-webkit-outer-spin-button,input[type="number"]::-webkit-inner-spin-button{-webkit-appearance:none}

.input-row{display:flex;gap:8px}
.input-row input{flex:1}

/* ===========================
   CHIPS
=========================== */
.chip-group{display:flex;flex-wrap:wrap;gap:6px}
.chip{padding:7px 14px;border:1.5px solid #E2E8F0;border-radius:20px;font-size:13px;font-weight:500;cursor:pointer;background:#fff;color:#64748B;font-family:inherit;transition:all .2s}
.chip.active{background:#0284C7;color:#fff;border-color:#0284C7}
.chip:active{transform:scale(.96)}

/* ===========================
   BUTTONS
=========================== */
.btn{padding:11px 18px;border-radius:10px;font-size:14px;font-weight:600;border:none;cursor:pointer;font-family:inherit;transition:all .15s;display:inline-flex;align-items:center;gap:6px}
.btn:active{transform:scale(.97)}
.btn-primary{background:#0284C7;color:#fff}
.btn-primary:hover{background:#0369A1}
.btn-danger{background:#EF4444;color:#fff}
.btn-outline{background:#fff;color:#475569;border:1.5px solid #E2E8F0}
.btn-block{width:100%;justify-content:center;padding:13px;font-size:15px;border-radius:12px;margin-top:4px}
.btn-sm{padding:8px 12px;font-size:13px;border-radius:8px;background:#fff;border:1.5px solid #E2E8F0;color:#475569}
.btn-sm:hover{background:#F8FAFC}

/* ===========================
   STATS
=========================== */
.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:4px}
.stat-card{background:#fff;border-radius:14px;padding:14px;display:flex;align-items:center;gap:12px;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.stat-icon{font-size:28px;width:48px;height:48px;border-radius:12px;display:flex;align-items:center;justify-content:center}
.stat-blue{background:#DBEAFE}
.stat-green{background:#DCFCE7}
.stat-ice{background:#E0F2FE}
.stat-yellow{background:#FEF3C7}
.stat-val{font-size:22px;font-weight:800;color:#1A202C;line-height:1}
.stat-label{font-size:12px;font-weight:600;color:#64748B;margin-top:3px}
.stat-sub{font-size:11px;color:#94A3B8}

/* ===========================
   STOK BARS
=========================== */
.stok-item{margin-bottom:14px}
.stok-item:last-child{margin-bottom:0}
.stok-label-row{display:flex;justify-content:space-between;font-size:13px;font-weight:500;margin-bottom:5px}
.stok-count{color:#0284C7;font-weight:700}
.stok-bar{background:#E0F2FE;border-radius:6px;height:9px;overflow:hidden}
.stok-bar-fill{background:linear-gradient(90deg,#38BDF8,#0284C7);height:100%;border-radius:6px;transition:width .6s ease}

/* ===========================
   LIST ITEMS
=========================== */
.list-item{background:#fff;border-radius:12px;padding:13px 14px;margin-bottom:8px;display:flex;justify-content:space-between;align-items:flex-start;box-shadow:0 1px 3px rgba(0,0,0,.05);cursor:pointer;transition:background .15s}
.list-item:active{background:#F8FAFC}
.list-item-left{flex:1;min-width:0}
.list-item-title{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.list-item-sub{font-size:12px;color:#64748B;margin-top:2px}
.list-item-right{text-align:right;flex-shrink:0;margin-left:12px}
.list-item-val{font-weight:700;font-size:15px;color:#0284C7}
.list-item-amount{font-size:12px;color:#64748B;margin-top:2px}

/* ===========================
   BADGES
=========================== */
.badge{display:inline-block;font-size:11px;font-weight:600;padding:2px 8px;border-radius:20px;margin-top:4px}
.badge-cash{background:#DCFCE7;color:#166534}
.badge-kredit{background:#FEF3C7;color:#92400E}
.badge-lunas{background:#DCFCE7;color:#166534}
.badge-belum{background:#FEE2E2;color:#991B1B}
.badge-masuk{background:#DCFCE7;color:#166534}
.badge-keluar{background:#FEE2E2;color:#991B1B}
.badge-pindah{background:#FEF3C7;color:#92400E}

/* ===========================
   TABS
=========================== */
.tabs{display:flex;background:#E2E8F0;border-radius:12px;padding:3px;margin-bottom:14px;gap:2px}
.tab{flex:1;padding:8px 4px;text-align:center;border-radius:9px;cursor:pointer;font-size:12px;font-weight:600;color:#64748B;border:none;background:none;font-family:inherit;transition:all .2s;white-space:nowrap}
.tab.active{background:#fff;color:#0284C7;box-shadow:0 1px 4px rgba(0,0,0,.1)}
.tab-content{display:none}
.tab-content.active{display:block}

/* ===========================
   ALERTS
=========================== */
.alert{border-radius:10px;padding:11px 14px;font-size:13px;margin-bottom:12px;line-height:1.5}
.alert-info{background:#E0F2FE;color:#0369A1;border:1px solid #BAE6FD}
.alert-danger{background:#FEE2E2;color:#991B1B;border:1px solid #FECACA}
.alert-success{background:#DCFCE7;color:#166534;border:1px solid #BBF7D0}
.alert-warning{background:#FEF3C7;color:#92400E;border:1px solid #FDE68A}

/* ===========================
   FILTER BAR
=========================== */
.filter-bar{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.filter-bar input{flex:1;min-width:100px;padding:9px 12px;font-size:13px;border:1.5px solid #E2E8F0;border-radius:9px;background:#fff;font-family:inherit}

/* ===========================
   SALARY CARDS
=========================== */
.salary-row{background:#fff;border-radius:12px;padding:13px 14px;margin-bottom:8px;display:flex;align-items:center;gap:12px;box-shadow:0 1px 3px rgba(0,0,0,.05)}
.avatar{width:40px;height:40px;border-radius:50%;background:#DBEAFE;color:#1D4ED8;font-weight:800;font-size:15px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.salary-name{font-weight:700;font-size:14px}
.salary-detail{font-size:12px;color:#64748B;margin-top:2px}
.salary-amount{font-weight:800;font-size:16px;color:#16A34A;margin-left:auto}

/* ===========================
   TARIF INFO
=========================== */
.tarif-info{background:#F0FDF4;border:1px solid #BBF7D0;border-radius:10px;padding:10px 14px;font-size:13px;color:#166534;margin-bottom:12px;font-weight:600}

/* ===========================
   TOTAL BOX
=========================== */
.total-box{background:#F0F9FF;border:1.5px solid #BAE6FD;border-radius:10px;padding:12px 14px;display:flex;justify-content:space-between;align-items:center;margin:4px 0 8px;font-size:14px;color:#0369A1}
.total-box strong{font-size:18px;font-weight:800}

/* ===========================
   STOK PAGE
=========================== */
.stok-card{background:#fff;border-radius:14px;padding:16px;margin-bottom:10px;display:flex;align-items:center;gap:14px;box-shadow:0 1px 4px rgba(0,0,0,.06)}
.stok-icon{font-size:36px;width:56px;height:56px;background:#E0F2FE;border-radius:14px;display:flex;align-items:center;justify-content:center}
.stok-name{font-weight:700;font-size:15px}
.stok-number{font-size:28px;font-weight:800;color:#0284C7;line-height:1}
.stok-unit{font-size:13px;color:#94A3B8;font-weight:400}

/* ===========================
   KARYAWAN LIST (ADMIN)
=========================== */
.karyawan-row{background:#fff;border-radius:10px;padding:12px 14px;margin-bottom:8px;display:flex;align-items:center;gap:12px;box-shadow:0 1px 3px rgba(0,0,0,.05)}
.user-row{background:#fff;border-radius:10px;padding:12px 14px;margin-bottom:8px;display:flex;align-items:center;gap:12px;box-shadow:0 1px 3px rgba(0,0,0,.05)}

/* ===========================
   MODAL
=========================== */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:200;display:flex;align-items:flex-end;justify-content:center;padding:16px}
.modal-box{background:#fff;border-radius:20px;padding:24px;width:100%;max-width:420px;max-height:80vh;overflow-y:auto}
.modal-title{font-size:17px;font-weight:700;margin-bottom:12px}
.modal-body{font-size:14px;color:#475569;margin-bottom:20px;line-height:1.6}
.modal-actions{display:flex;gap:10px}
.modal-actions .btn{flex:1;justify-content:center}
.detail-row{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #F1F5F9;font-size:13px}
.detail-row:last-child{border-bottom:none}
.detail-label{color:#64748B}
.detail-val{font-weight:600;text-align:right}

/* ===========================
   TOAST
=========================== */
.toast{position:fixed;top:68px;left:50%;transform:translateX(-50%);background:#1E293B;color:#fff;padding:10px 20px;border-radius:24px;font-size:13px;font-weight:600;z-index:300;opacity:0;transition:opacity .3s;pointer-events:none;white-space:nowrap;max-width:90vw;text-align:center}
.toast.show{opacity:1}
.toast.success{background:#16A34A}
.toast.error{background:#DC2626}

/* ===========================
   LOADING
=========================== */
.loading-overlay{position:fixed;inset:0;background:rgba(255,255,255,.7);z-index:250;display:flex;align-items:center;justify-content:center}
.spinner{width:40px;height:40px;border:3px solid #E2E8F0;border-top-color:#0284C7;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ===========================
   EMPTY & SKELETON
=========================== */
.empty-state{text-align:center;padding:40px 20px;color:#94A3B8;font-size:14px}
.skeleton-bar{background:#E2E8F0;border-radius:6px;height:14px;margin-bottom:12px;animation:pulse 1.2s ease infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}

/* ===========================
   PRINT
=========================== */
@media print{
  .app-header,.bottom-nav,.filter-bar,.btn,.tabs{display:none!important}
  .app-main{margin:0;padding:0}
  .page{display:block!important}
  body{background:#fff}
}

/* ===========================
   SCROLLBAR
=========================== */
::-webkit-scrollbar{width:4px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#CBD5E1;border-radius:4px}
