:root{
  --bg:#f4fbfa;
  --surface:#ffffff;
  --surface-2:#f7fffe;
  --border:#e3e8ef;
  --text:#0f172a;
  --muted:#667085;
  --muted-2:#98a2b3;
  --primary:#0f766e;
  --primary-2:#0f5f59;
  --ring:rgba(15,118,110,.16);
  --success:#067647;
  --danger:#b42318;
  --warn:#b54708;
  --shadow:0 10px 28px rgba(2,8,23,.07);
  --radius:12px;
  --radius-sm:10px;
  --text-xs:12px;
  --text-sm:13px;
  --text-md:14px;
  --line:1.35;
  --gap:12px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  font-size:var(--text-sm);
  line-height:var(--line);
  color:var(--text);
  background:var(--bg);
}

a{color:inherit;text-decoration:none}

.app-shell{
  min-height:100%;
  display:grid;
  grid-template-columns:270px 1fr;
}

.sidebar{
  background:var(--surface);
  border-right:1px solid var(--border);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:14px;
  position:sticky;
  top:0;
  height:100vh;
}

.sidebar-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.brand-mark{
  width:34px;
  height:34px;
  border-radius:11px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#0f766e,#0f172a);
  color:#fff;
  font-weight:700;
  letter-spacing:.2px;
}

.brand-title{font-weight:650;font-size:14px}
.brand-subtitle{font-size:12px;color:var(--muted);margin-top:2px}

.nav{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.nav-item{
  padding:10px 10px;
  border-radius:12px;
  border:1px solid transparent;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:transparent;
}
.nav-item:hover{background:var(--surface-2);border-color:var(--border)}
.nav-item.is-active{
  background:rgba(15,118,110,.08);
  border-color:rgba(15,118,110,.18);
}
.nav-label{font-weight:600;font-size:13px}

.sidebar-footer{margin-top:auto;display:flex;flex-direction:column;gap:8px}
.chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:max-content;
  padding:5px 10px;
  border-radius:999px;
  background:rgba(15,118,110,.08);
  border:1px solid rgba(15,118,110,.18);
  font-size:12px;
  color:#0f5f59;
}
.muted{color:var(--muted);font-size:12px}

.app-main{display:flex;flex-direction:column;min-width:0}

.topbar{
  position:sticky;
  top:0;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
  background:rgba(244,251,250,.86);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}

.topbar-left{display:flex;align-items:center;gap:10px;min-width:0}
.page-title{font-size:14px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.topbar-right{display:flex;align-items:center;gap:10px}
.search{width:320px;max-width:44vw}

.input{
  width:100%;
  appearance:none;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface);
  padding:9px 10px;
  font-size:13px;
  outline:none;
  box-shadow:0 0 0 0 var(--ring);
}
.input:focus{border-color:rgba(15,118,110,.38);box-shadow:0 0 0 4px var(--ring)}

.icon-btn{
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--surface);
  cursor:pointer;
}
.icon{font-size:14px;color:#344054}
.sidebar-close{display:none}
.sidebar-open{display:none}

.user{display:flex;align-items:center;gap:10px;padding-left:6px}
.avatar{
  width:30px;height:30px;border-radius:10px;
  background:linear-gradient(135deg,#0f766e,#0f172a);
  color:#fff;
  display:grid;place-items:center;
  font-weight:700;font-size:12px;
}
.user-name{font-weight:650;font-size:13px}
.user-role{font-size:12px;color:var(--muted);margin-top:2px}

.app-content{padding:16px;display:flex;flex-direction:column;gap:14px;min-width:0}

.grid{
  display:grid;
  gap:12px;
}
.grid.cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}

.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
  min-width:0;
}
.card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:10px}
.card-title{font-weight:650}
.card-subtitle{font-size:12px;color:var(--muted);margin-top:4px}

.kpi{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.kpi-value{font-size:18px;font-weight:750;letter-spacing:-.3px}
.kpi-label{font-size:12px;color:var(--muted)}

.toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.toolbar-left{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.toolbar-right{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

.btn{
  border:1px solid var(--border);
  background:var(--surface);
  padding:9px 10px;
  border-radius:12px;
  font-size:13px;
  font-weight:650;
  cursor:pointer;
}
.btn:hover{background:var(--surface-2);border-color:rgba(15,118,110,.22)}
.btn.primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}
.btn.primary:hover{background:var(--primary-2)}
.btn.danger{
  background:rgba(180,35,24,.08);
  border-color:rgba(180,35,24,.18);
  color:var(--danger);
}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface);
}
.table th,.table td{
  padding:10px 10px;
  border-bottom:1px solid var(--border);
  font-size:13px;
  text-align:left;
  vertical-align:top;
}
.table th{
  font-size:12px;
  color:#475467;
  font-weight:650;
  background:#f6fffe;
}
.table tbody tr:hover td{background:rgba(15,118,110,.04)}
.table tr:last-child td{border-bottom:none}
.table td .sub{font-size:12px;color:var(--muted);margin-top:2px}

.badge{
  display:inline-flex;
  align-items:center;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:12px;
  color:#344054;
  background:#fff;
}
.badge.success{background:rgba(5,122,85,.08);border-color:rgba(5,122,85,.15);color:var(--success)}
.badge.warn{background:rgba(181,71,8,.08);border-color:rgba(181,71,8,.15);color:var(--warn)}
.badge.danger{background:rgba(180,35,24,.08);border-color:rgba(180,35,24,.15);color:var(--danger)}
.badge.muted{background:#f2f4f7;border-color:#e4e7ec;color:#475467}

.alert{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--surface);
  font-size:13px;
  font-weight:600;
}
.alert.success{background:rgba(5,122,85,.08);border-color:rgba(5,122,85,.15);color:var(--success)}
.alert.danger{background:rgba(180,35,24,.08);border-color:rgba(180,35,24,.18);color:var(--danger)}

.split{
  display:grid;
  grid-template-columns:1.25fr .75fr;
  gap:12px;
}

.field{display:flex;flex-direction:column;gap:6px}
.label{font-size:12px;color:#475467;font-weight:650}
.help{font-size:12px;color:var(--muted)}
.row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}

.hr{height:1px;background:var(--border);margin:10px 0}

.receipt{
  max-width:720px;
  margin:0 auto;
}
.receipt-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.receipt-title{font-size:16px;font-weight:750}
.mono{font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1}

.invoice-page{padding:18px}
.invoice-paper{
  max-width:820px;
  margin:0 auto;
  background:#fff;
}
.invoice-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.invoice-head-left{width:160px}
.invoice-logo{
  width:160px;
  height:64px;
  object-fit:contain;
}
.invoice-logo.placeholder{
  width:160px;
  height:64px;
  border:1px dashed var(--border);
  border-radius:10px;
}
.invoice-head-right{text-align:right}
.invoice-company{font-size:16px;font-weight:800;letter-spacing:.2px}
.invoice-meta{font-size:12px;color:var(--muted);margin-top:4px;line-height:1.35}
.invoice-divider{height:1px;background:var(--border);margin:12px 0}
.invoice-top{display:flex;justify-content:space-between;gap:12px}
.invoice-title{font-size:14px;font-weight:850;letter-spacing:.8px}
.invoice-no{margin-top:4px;font-size:13px}
.invoice-kv{min-width:260px}
.invoice-kv .row{grid-template-columns:120px 1fr;gap:10px}
.invoice-bill{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.invoice-bill-card{border:1px solid var(--border);border-radius:12px;padding:12px}
.invoice-strong{font-weight:750}
.invoice-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:12px;
}
.invoice-table th,.invoice-table td{padding:9px 10px;border-bottom:1px solid var(--border)}
.invoice-table thead th{font-weight:750;color:#344054;background:#f8fafc}
.invoice-table.small th,.invoice-table.small td{padding:8px 10px}
.invoice-totals{display:grid;grid-template-columns:1fr 320px;gap:12px;margin-top:12px}
.invoice-totals-box{border:1px solid var(--border);border-radius:12px;padding:12px}
.invoice-totals-row{display:flex;justify-content:space-between;gap:10px;margin-top:6px}
.invoice-totals-row:first-child{margin-top:0}
.invoice-totals-row.grand{font-weight:800;margin-top:10px}
.invoice-section-title{font-size:13px;font-weight:800;margin:10px 0}
.invoice-foot{display:flex;justify-content:space-between;gap:16px;align-items:flex-end}
.invoice-sign{width:240px}
.invoice-sign-line{height:38px;border-bottom:1px solid var(--border);margin-top:10px}
.invoice-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:14px}
.no-print{}

.kuitansi-page{padding:18px}
.kuitansi-a5{
  width:148mm;
  min-height:210mm;
  margin:0 auto;
  background:#fff;
}
.kuitansi-sheet{
  padding:10mm;
  box-sizing:border-box;
}
.kuitansi-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.kuitansi-head-left{width:150px}
.kuitansi-logo{
  width:150px;
  height:54px;
  object-fit:contain;
}
.kuitansi-logo.placeholder{
  width:150px;
  height:54px;
  border:1px dashed var(--border);
  border-radius:10px;
}
.kuitansi-head-right{text-align:right}
.kuitansi-company{font-size:14px;font-weight:850;letter-spacing:.2px}
.kuitansi-meta{font-size:11px;color:var(--muted);margin-top:3px;line-height:1.35}
.kuitansi-divider{height:1px;background:var(--border);margin:9px 0}
.kuitansi-top{display:flex;justify-content:space-between;gap:12px}
.kuitansi-title{font-size:13px;font-weight:900;letter-spacing:.6px}
.kuitansi-strong{font-weight:800}
.kuitansi-kv{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.kuitansi-kv-row{display:flex;gap:10px}
.kuitansi-kv-row .label{min-width:72px}
.kuitansi-amount{display:flex;justify-content:space-between;align-items:flex-end;gap:12px}
.kuitansi-amount-value{font-size:14px;font-weight:900}
.kuitansi-table{width:100%;border-collapse:collapse;font-size:11px}
.kuitansi-table td{padding:6px 0;border-bottom:1px solid var(--border)}
.kuitansi-foot{display:flex;justify-content:space-between;gap:12px;align-items:flex-end;margin-top:10px}
.kuitansi-sign{width:220px}
.kuitansi-sign-line{height:34px;border-bottom:1px solid var(--border);margin-top:8px}
.kuitansi-actions{display:flex;gap:8px;justify-content:flex-end;margin:12px 0}

@media (max-width: 980px){
  .search{display:none}
  .grid.cols-3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .split{grid-template-columns:1fr}
}

@media (max-width: 820px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;
    left:0;
    top:0;
    width:290px;
    transform:translateX(-105%);
    transition:transform .18s ease;
    z-index:30;
    box-shadow:var(--shadow);
  }
  .sidebar.is-open{transform:translateX(0)}
  .sidebar-close{display:grid}
  .sidebar-open{display:grid}
}

@media print{
  .sidebar,.topbar{display:none !important}
  .invoice-actions,.no-print{display:none !important}
  .invoice-page{padding:0}
  .invoice-paper{max-width:none}
  @page{size:A4 portrait;margin:10mm}
  .kuitansi-page{padding:0}
  .kuitansi-actions,.no-print{display:none !important}
  .kuitansi-a5{width:auto;min-height:auto}
  .app-shell{grid-template-columns:1fr}
  body{background:#fff}
  .card{box-shadow:none}
}
