/* =========================================================
   Permana Inventory – Theme CSS (permana.net.id inspired)
   ========================================================= */
:root {
  --pm-blue:       #1a3c6e;
  --pm-blue-mid:   #1e5fa8;
  --pm-blue-light: #e8f1fb;
  --pm-accent:     #f5a623;
  --pm-red:        #d0021b;
  --pm-green:      #27ae60;
  --pm-gray:       #f4f6f9;
  --pm-border:     rgba(0,0,0,0.10);
  --pm-text:       #1a2533;
  --pm-muted:      #6b7a8d;
  --sidebar-w:     220px;
  --topnav-h:      52px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Tahoma, sans-serif; font-size: 14px; color: var(--pm-text); background: var(--pm-gray); }
a { color: var(--pm-blue-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

/* TOP NAV */
.topnav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--topnav-h); background: var(--pm-blue); color: white; display: flex; align-items: center; gap: 12px; padding: 0 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.topnav .logo { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; color: white; }
.topnav .logo:hover { text-decoration: none; }
.topnav .logo-box { width: 28px; height: 28px; background: var(--pm-accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.topnav .spacer { flex: 1; }
.topnav .nav-search { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2); color: white; border-radius: 6px; padding: 6px 12px; font-size: 13px; width: 260px; outline: none; }
.topnav .nav-search::placeholder { color: rgba(255,255,255,0.6); }
.topnav .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--pm-accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.topnav .user-name { font-size: 13px; color: rgba(255,255,255,0.9); }

/* SIDEBAR */
.sidebar { position: fixed; top: var(--topnav-h); left: 0; bottom: 0; width: var(--sidebar-w); background: white; border-right: 1px solid var(--pm-border); overflow-y: auto; z-index: 90; }
.sidebar-section { padding: 10px 0 4px; }
.sidebar-label { font-size: 10px; font-weight: 600; color: var(--pm-muted); text-transform: uppercase; letter-spacing: 1px; padding: 0 16px 4px; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13px; color: var(--pm-text); border-left: 3px solid transparent; transition: background .15s; text-decoration: none; }
.sidebar-item:hover { background: var(--pm-blue-light); text-decoration: none; }
.sidebar-item.active { background: var(--pm-blue-light); border-left-color: var(--pm-blue-mid); color: var(--pm-blue-mid); font-weight: 600; }
.sidebar-item .icon { width: 18px; text-align: center; }
.badge { font-size: 10px; background: var(--pm-red); color: white; border-radius: 10px; padding: 1px 7px; font-weight: 600; margin-left: auto; }
.badge.warn { background: var(--pm-accent); color: white; }

/* PAGE WRAPPER */
.page-wrapper { margin-left: var(--sidebar-w); margin-top: var(--topnav-h); padding: 24px; min-height: calc(100vh - var(--topnav-h)); }

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 600; color: var(--pm-blue); margin: 0; }
.page-subtitle { font-size: 13px; color: var(--pm-muted); margin: 2px 0 0; }
.page-header .spacer { flex: 1; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--pm-border); background: white; color: var(--pm-text); transition: all .15s; text-decoration: none; }
.btn:hover { background: var(--pm-gray); text-decoration: none; color: var(--pm-text); }
.btn-primary  { background: var(--pm-blue-mid); color: white; border-color: var(--pm-blue-mid); }
.btn-primary:hover { background: var(--pm-blue); color: white; }
.btn-danger   { background: var(--pm-red); color: white; border-color: var(--pm-red); }
.btn-danger:hover { background: #a30016; color: white; }
.btn-warning  { background: var(--pm-accent); color: white; border-color: var(--pm-accent); }
.btn-success  { background: var(--pm-green); color: white; border-color: var(--pm-green); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* STAT CARDS */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 10px; border: 1px solid var(--pm-border); padding: 16px 18px; }
.stat-card .sc-label { font-size: 12px; color: var(--pm-muted); margin-bottom: 6px; }
.stat-card .sc-val { font-size: 28px; font-weight: 700; color: var(--pm-blue); line-height: 1; }
.stat-card .sc-sub { font-size: 12px; color: var(--pm-muted); margin-top: 4px; }
.stat-card.green .sc-val { color: var(--pm-green); }
.stat-card.red   .sc-val { color: var(--pm-red); }
.stat-card.amber .sc-val { color: var(--pm-accent); }

/* CARDS */
.card { background: white; border-radius: 10px; border: 1px solid var(--pm-border); margin-bottom: 16px; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--pm-border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; color: var(--pm-blue); margin: 0; }
.card-body { padding: 18px; }

/* FILTERS */
.filter-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-select, .filter-input { font-size: 13px; padding: 7px 12px; border: 1px solid #d0d7e0; border-radius: 6px; background: white; color: var(--pm-text); outline: none; }
.filter-input { width: 220px; }

/* TABLE */
.table-wrap { background: white; border-radius: 10px; border: 1px solid var(--pm-border); overflow: hidden; }
.table-responsive { overflow-x: auto; }
table.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.inv-table thead { background: var(--pm-blue); color: white; }
table.inv-table th { padding: 11px 12px; text-align: left; font-weight: 500; font-size: 12px; letter-spacing: .3px; white-space: nowrap; }
table.inv-table tbody tr { border-bottom: 1px solid var(--pm-border); }
table.inv-table tbody tr:last-child { border-bottom: none; }
table.inv-table tbody tr:hover { background: var(--pm-blue-light); }
table.inv-table td { padding: 9px 12px; vertical-align: middle; }
.text-mono { font-family: 'Courier New', monospace; font-size: 11px; }

/* PILLS */
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.pill-success  { background: #e8f7ef; color: #1a7a45; }
.pill-danger   { background: #fce8eb; color: #a30016; }
.pill-warning  { background: #fff4e0; color: #7a5200; }
.pill-info     { background: var(--pm-blue-light); color: var(--pm-blue); }
.pill-secondary{ background: #f0f2f5; color: #4a5568; }

/* PAGINATION */
.pagination-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--pm-border); font-size: 13px; color: var(--pm-muted); }

/* FORMS */
.form-card { background: white; border-radius: 10px; border: 1px solid var(--pm-border); padding: 24px; max-width: 860px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1/-1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--pm-muted); }
.form-control { padding: 9px 12px; border: 1px solid #d0d7e0; border-radius: 6px; font-size: 13px; background: white; color: var(--pm-text); outline: none; width: 100%; transition: border-color .15s; }
.form-control:focus { border-color: var(--pm-blue-mid); box-shadow: 0 0 0 3px rgba(30,95,168,.1); }
.form-section-title { grid-column: 1/-1; font-size: 14px; font-weight: 600; color: var(--pm-blue); border-bottom: 2px solid var(--pm-blue-light); padding-bottom: 8px; margin-top: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--pm-border); }

/* DETAIL */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--pm-border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--pm-muted); min-width: 140px; }
.detail-val { font-weight: 500; text-align: right; max-width: 200px; word-break: break-word; }
.device-icon { width: 44px; height: 44px; background: var(--pm-blue-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; }

/* TIMELINE */
.timeline-item { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--pm-border); }
.timeline-item:last-child { border-bottom: none; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pm-blue-mid); margin-top: 4px; flex-shrink: 0; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; border-left: 4px solid; }
.alert-success { background: #e8f7ef; border-color: var(--pm-green); color: #1a7a45; }
.alert-danger  { background: #fce8eb; border-color: var(--pm-red); color: #a30016; }
.alert-warning { background: #fff4e0; border-color: var(--pm-accent); color: #7a5200; }

/* CMS */
.cms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-list-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--pm-border); font-size: 13px; }
.mini-list-item:last-child { border-bottom: none; }

/* LOGIN */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--pm-blue); }
.login-card { background: white; border-radius: 12px; padding: 40px 36px; width: 380px; box-shadow: 0 8px 40px rgba(0,0,0,0.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-big { width: 54px; height: 54px; background: var(--pm-blue); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: white; margin: 0 auto 12px; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .form-grid, .detail-grid, .cms-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .page-wrapper { margin-left: 0; }
  .stat-row { grid-template-columns: 1fr; }
}
