/* ===== Base ===== */
*{ box-sizing:border-box; }
body{
  font-family: Arial, sans-serif;
  background:#f5f6fa;
  margin:0;
  color:#111;
  overflow-x:hidden;
}
a{ text-decoration:none; color:var(--primary-color); }
a:hover{ text-decoration:underline; }

/* ===== Card ===== */
.card{
  background:#fff;
  border:1px solid #e8e8e8;
  border-radius:12px;
  padding:18px;
}

/* ===== Headings ===== */
h1,h2,h3{ margin:0 0 12px 0; }
h2{ font-size:22px; }
small{ color:#777; }

/* ===== Forms ===== */
.form{
  max-width:560px;
}
.form-group{
  margin-bottom:14px;
}
label{
  display:block;
  font-size:13px;
  margin-bottom:6px;
  color:#222;
  font-weight:bold;
}
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid #d9d9d9;
  border-radius:8px;
  background:#fff;
  font-size:14px;
  outline:none;
}
textarea{ min-height:90px; resize:vertical; }
input:focus, select:focus, textarea:focus{
  border-color:var(--primary-color);
  box-shadow:0 0 0 3px rgba(0,0,0,0.08);
}

/* ===== Buttons ===== */
.btn{
  display:inline-block;
  padding:10px 14px;
  border-radius:10px;
  border:1px solid transparent;
  font-size:14px;
  cursor:pointer;
}
.btn-primary{
  background:var(--primary-color);
  color:#fff;
}
.btn-primary:hover{ filter:brightness(0.92); }
.btn-light{
  background:#f2f4ff;
  border-color:#d7dcff;
  color:var(--primary-color);
}
.btn-light:hover{ background:#e9ecff; }
.btn-link{
  padding:10px 0;
  border:none;
  background:transparent;
  color:var(--primary-color);
}

/* ===== Dropdown (details/summary) ===== */
.dropdown{ position:relative; }
.dropdown > summary{ list-style:none; }
.dropdown > summary::-webkit-details-marker{ display:none; }
.dropdown-menu{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:180px;
  background:#fff;
  border:1px solid #e8e8e8;
  border-radius:12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  padding:8px;
  z-index:50;
}
.dropdown-menu a{
  display:block;
  padding:10px 10px;
  border-radius:10px;
  color:#111;
}
.dropdown-menu a:hover{ background:#f5f6fa; text-decoration:none; }

/* ===== Alerts ===== */
.alert{
  padding:10px 12px;
  border-radius:10px;
  margin:10px 0;
  font-size:14px;
}
.alert-success{ background:#e8fff1; border:1px solid #b8f5cf; color:#0b6b2a; }
.alert-error{ background:#ffecec; border:1px solid #ffbcbc; color:#a30000; }

/* ===== Tables ===== */
.table{
  width:100%;
  border-collapse:collapse;
  margin-top:12px;
}
.table th, .table td{
  padding:10px 12px;
  border-bottom:1px solid #eee;
  font-size:14px;
}
.table th{
  text-align:left;
  background:#f5f6fa;
  font-weight:bold;
  color:#222;
}
.table tr:hover td{ background:#fafbff; }

/* Utility */
.flex{ display:flex; gap:10px; align-items:center; }
.flex-between{ display:flex; justify-content:space-between; align-items:center; }

/* Avatar (thumbnail) */
.avatar-sm{
  width:34px;
  height:34px;
  border-radius:999px;
  overflow:hidden;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#eef1f6;
  border:1px solid #e2e6ef;
  color:#8a97b1;
}
.avatar-sm img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.avatar-sm svg{ opacity:.9; }

.badge{
  display:inline-block;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:bold;
  border:1px solid transparent;
}

.badge-paid{
  background:#e8fff1;
  color:#0b6b2a;
  border-color:#b8f5cf;
}

.badge-dp{
  background:#fff6e5;
  color:#8a5a00;
  border-color:#ffd79a;
}

.badge-unpaid{
  background:#ffecec;
  color:#a30000;
  border-color:#ffbcbc;
}

.row-paid td{ background:#fbfffd; }
.row-dp td{ background:#fffdf7; }
.row-unpaid td{ background:#fffafa; }

.sidebar .brand {
  text-align: center;
  padding: 18px 10px;
}

.sidebar .brand .logo-sidebar {
  max-width: 160px;
  height: auto;
}

.sidebar .userbox {
  padding: 12px 10px;
}


/* Statistik card dashboard */
.stat-card{
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
  transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(0,0,0,.12);
}

.stat-card .label{
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #6c757d;
  margin-bottom: 6px;
}

.stat-card .value{
  font-size: 22px;
  font-weight: 800;
  color: #0b1f3a; /* navy */
}

.grid-4{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:14px;
}

.stat{
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 16px;
  padding: 16px 18px;
  background:#fff;

  /* efek mengembang + shadow */
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.stat:hover{
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,.12);
  border-color: rgba(0,0,0,.08);
}

.stat-title{
  font-size: 12px;
  color:#6b7280;
  letter-spacing: .5px;
}

.stat-value{
  font-size: 22px;
  font-weight: 800;
  margin-top: 8px;
  color:#0b1f3a; /* navy */
}

@media(max-width:1100px){ .grid-4{ grid-template-columns:repeat(2,1fr);} }
@media(max-width:600px){ .grid-4{ grid-template-columns:1fr;} }


.grid-4 .stat{
  box-shadow: 0 10px 25px rgba(0,0,0,.12) !important;
  border: 1px solid rgba(0,0,0,.06) !important;
  border-radius: 16px !important;
}

.modal-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.45);
  display:flex; align-items:center; justify-content:center;
  z-index:9999;
}
.modal-box{
  width:520px; max-width:92vw;
  background:#fff;
  border-radius:14px;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
  padding:16px;
}
.modal-header{
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:10px;
}
.modal-close{
  border:none; background:transparent;
  font-size:28px; line-height:1; cursor:pointer;
}
.form-group{ margin-bottom:10px; }
.form-group input{
  width:100%; padding:10px; border:1px solid #ddd; border-radius:10px;
}


.order-customer-row{
  display:flex;
  gap:12px;
  align-items:flex-end;
}

.order-customer-row .customer-select{
  flex: 1;
}

.order-customer-row .btn-add-customer{
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
}

.order-customer-row{
  display:flex;
  gap:12px;
  align-items:flex-end;
}

.order-customer-row .customer-select{
  flex:1;
  height:42px;
}

.order-customer-row .btn-add-customer{
  height:42px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid #d7d7d7;
  background:#f3f3f3;
  cursor:pointer;
  white-space:nowrap;
}

.info { border: 2px solid #111; }
.info .c { border-left: 1px solid #111; }
.info .c:first-child { border-left: 0; }
.lines-placeholder { display:none !important; }


/* ===== PDF (DOMPDF) OVERRIDES ===== */
body.pdf .row{ display: table !important; width:100% !important; }
body.pdf .logo{ display: table-cell !important; width:70% !important; vertical-align: top !important; }
body.pdf .title-box{ display: table-cell !important; width:30% !important; text-align:right !important; vertical-align: top !important; }

body.pdf .info-wrap{ display:block !important; margin-top:10px !important; }
body.pdf .info{ width:100% !important; }

body.pdf .info .r{ display: table !important; width:100% !important; table-layout: fixed !important; }
body.pdf .info .c{ display: table-cell !important; float:none !important; }

/* Items table lebih stabil */
body.pdf table.items{ table-layout: fixed !important; }
body.pdf table.items th,
body.pdf table.items td{ word-wrap: break-word !important; }

/* HILANGKAN garis abu-abu saat PDF biar gak jadi 2 halaman */
body.pdf .grayline{ display:none !important; }

/* BOTTOM (bank + note) jangan flex */
body.pdf .bottom{ display: table !important; width:100% !important; }
body.pdf .bank, body.pdf .note{ display: table-cell !important; width:50% !important; vertical-align: top !important; }

/* cegah box pecah halaman */
body.pdf .box{ page-break-inside: avoid !important; }
body.pdf table.items tr{ page-break-inside: avoid !important; }

body.pdf .box{ min-height: 80px !important; padding:8px !important; }
body.pdf table.items td{ padding:5px 6px !important; }
body.pdf table.items th{ padding:6px 6px !important; }


/* PDF only */
.grayline{ display:none !important; } /* hilangkan baris kosong */
.bottom{ display: table; width:100%; }
.bank{ display: table-cell; width:55%; vertical-align: top; }
.summary{ display: table-cell; width:45%; vertical-align: top; margin-left:0; }
.row{ display: table; width:100%; }
.logo{ display: table-cell; width:70%; vertical-align: top; }
.title-box{ display: table-cell; width:30%; text-align:right; vertical-align: top; }

/* baris To + info box sejajar */
.top-row{ display: table; width:100%; margin-top:10px; }
.top-row .to{ display: table-cell; width:60%; vertical-align: top; }
.top-row .info-wrap{ display: table-cell; width:40%; vertical-align: top; text-align:right; }

/* kotak info kecil */
.info-box{ display:inline-block; width:320px; } /* sesuaikan 300-340 */
table.info{ width:100%; }
table.info th, table.info td{ padding:6px 6px; font-size:11px; }


/* ===== Mobile responsiveness / touch targets ===== */
html, body{ max-width:100%; }

@media(max-width: 980px){
  .content, .page-inner{ max-width:100%; }
  .card{ padding:16px; }
  .btn, button, input, select{ min-height:44px; } /* better touch target */
  .btn{ padding:10px 12px; }
}

/* Prevent tables / long content from pushing layout to the right */
.table, table{
  max-width:100%;
}
@media(max-width: 980px){
  .table, table{
    display:block;
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    white-space:nowrap;
  }
  /* button rows should wrap instead of overflow */
  .toolbar, .actions, .btn-group, .button-group{
    flex-wrap:wrap;
    gap:10px;
  }
}

.topbar-icon-btn{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 6px !important;
  border-radius: 10px; /* optional biar halus */
  color: rgba(255,255,255,.85); /* ikut topbar gelap */
  cursor: pointer;
}

.topbar-icon-btn:hover{
  background: rgba(255,255,255,.10) !important; /* hover simple */
}

.topbar-icon-btn:active{
  background: rgba(255,255,255,.16) !important;
}

.product-filters{
  display: grid;
  /* search dipendekin */
  grid-template-columns: 520px 220px 220px 220px;
  gap: 12px;
  align-items: center;
  margin: 12px 0 8px;
}

/* tombol jadi baris bawah dan rata kiri */
.product-filters .filter-actions{
  justify-content: center;
  align-items: center;
  margin-top: 6px;
}


/* input/select */
.product-filters input,
.product-filters select{
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  outline: none;
}

/* tombol tinggi sama */
.product-filters .filter-actions .btn{
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
}

/* Responsif */
@media (max-width: 992px){
  .product-filters{
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 576px){
  .product-filters{
    grid-template-columns: 1fr;
  }
  .product-filters .filter-actions .btn,
  .product-filters .filter-actions a.btn{
    flex: 1;
    text-align: center;
  }
}

/* Mobile: kasih jarak antar filter biar nggak mepet */
@media (max-width: 576px){
  .product-filters{
    gap: 12px;              /* jarak antar item */
    margin-top: 12px;
  }

  .product-filters input,
  .product-filters select{
    margin-bottom: 4px;     /* tambahan jarak kecil */
  }

  .product-filters .filter-actions{
    margin-top: 10px;       /* jarak tombol dari dropdown terakhir */
    gap: 12px;              /* jarak Filter vs Reset */
  }
}


  /* Backdrop */
  .modal{
    position: fixed;
    inset: 0;
    display: none;           /* default hidden */
    background: rgba(0,0,0,.45);
    z-index: 9999;
    overflow: auto;
    padding: 30px 12px;
  }

  .modal.show{ display:block; }

  .modal-dialog{
    margin: 0 auto;
    width: 100%;
    max-width: 760px;
  }

  .modal-content{
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    margin-top:10%;
  }

  .modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom: 10px;
  }

  .modal-close{
    border:0;
    background: transparent;
    font-size: 26px;
    cursor:pointer;
    line-height: 1;
  }