:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --sidebar-bg: #1e1b3a;
  --sidebar-active: #4f46e5;
  --bg-soft: #f4f5fb;
}

* { box-sizing: border-box; }

body {
  background: var(--bg-soft);
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  color: #1f2333;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: #fff;
  border: none;
}
.sidebar-body { display: flex; flex-direction: column; padding: 0; }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; font-size: 1.15rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.5rem; color: #a5b4fc; }
.sidebar-nav { padding: 12px; gap: 2px; }
.sidebar-nav .nav-link {
  color: #c7c9e8; padding: 10px 14px; border-radius: 8px;
  font-size: .93rem; display: flex; align-items: center; gap: 10px;
  transition: background .15s;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; }

@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; }
}

/* ---------------- Main content ---------------- */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-navbar {
  background: var(--sidebar-bg);
  padding: 14px 20px;
}
.navbar-title { color: #fff; font-weight: 600; }

.page-content { padding: 22px; }

/* ---------------- Cards ---------------- */
.content-card { border: none; border-radius: 14px; box-shadow: 0 2px 10px rgba(30,27,58,.06); }
.content-card .card-header {
  background: #fff; border-bottom: 1px solid #eef0f7;
  font-weight: 600; border-radius: 14px 14px 0 0 !important;
  padding: 16px 20px;
}
.content-card .card-body { padding: 20px; }

/* ---------------- Stat Cards ---------------- */
.stat-card {
  background: #fff; border-radius: 14px; padding: 18px;
  box-shadow: 0 2px 10px rgba(30,27,58,.06);
  position: relative; overflow: hidden;
}
.stat-icon { font-size: 1.5rem; opacity: .85; margin-bottom: 6px; }
.stat-value { font-size: 1.7rem; font-weight: 700; }
.stat-label { font-size: .74rem; letter-spacing: .04em; color: #7a7f99; font-weight: 600; margin-top: 2px; }
.stat-primary .stat-icon, .stat-primary .stat-value { color: var(--primary); }
.stat-success .stat-icon, .stat-success .stat-value { color: #16a34a; }
.stat-info .stat-icon, .stat-info .stat-value { color: #0891b2; }
.stat-warning .stat-icon, .stat-warning .stat-value { color: #d97706; }

/* ---------------- Login ---------------- */
.login-body {
  background: linear-gradient(135deg, #4f46e5, #1e1b3a);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 18px; padding: 40px 32px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--primary); color: #fff; font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}

/* ---------------- Buttons ---------------- */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ---------------- Label preview (on screen) ---------------- */
.print-page.preview-mode {
  background: #fff;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 24px;
  box-shadow: 0 2px 14px rgba(30,27,58,.15);
  position: relative;
}

.label-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--lw));
  grid-template-rows: repeat(4, var(--lh));
  column-gap: var(--gx);
  row-gap: var(--gy);
  position: absolute;
  left: var(--lm);
  top: var(--tm);
}

.label {
  width: var(--lw);
  height: var(--lh);
  overflow: hidden;
  box-sizing: border-box;
}

.label-grid.show-border .label {
  border: 1px dashed #9aa0c3;
}

.label-inner {
  padding: 2mm 3mm;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.label-yth { font-size: 7pt; color: #444; margin-bottom: 1mm; }
.label-nama { font-size: 12pt; font-weight: 700; line-height: 1.15; margin-bottom: 1mm; }
.label-alamat { font-size: 8.5pt; line-height: 1.25; word-wrap: break-word; }

.preview-scroll { overflow-x: auto; padding-bottom: 8px; }

/* Responsive */
@media (max-width: 991px) {
  .page-content { padding: 14px; }
  .print-page.preview-mode { transform-origin: top left; }
}
