/* SIMCRM - Lembar gaya utama */
:root{
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 68px;
  --brand: #1f4e79;
  --brand-dark: #163a5a;
  --brand-light: #2f6da4;
  --topbar-h: 58px;
  --body-bg: #f4f6f9;
  --border: #e3e7ed;
}

body{
  background: var(--body-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #2c3340;
}

/* ---------------- Sidebar ---------------- */
.sidebar{
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #dbe4ee; z-index: 1040; display: flex; flex-direction: column;
  transition: width .2s ease, transform .2s ease;
}
.sidebar-brand{
  height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.12); flex-shrink: 0;
}
.sidebar-brand .logo-box{
  width: 34px; height: 34px; background: #fff; color: var(--brand); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.sidebar-brand .brand-text{ color: #fff; font-weight: 600; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.sidebar-brand .brand-text small{ display: block; font-size: 10px; font-weight: 400; color: rgba(255,255,255,.65); }
.sidebar-menu{ overflow-y: auto; overflow-x: hidden; padding: 10px 0 24px; flex: 1; }
.sidebar-menu::-webkit-scrollbar{ width: 5px; }
.sidebar-menu::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.22); border-radius: 3px; }
.menu-title{
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: rgba(255,255,255,.45); padding: 14px 18px 6px; font-weight: 600; white-space: nowrap;
}
.sidebar-menu a{
  display: flex; align-items: center; gap: 11px; padding: 9px 18px;
  color: #dbe4ee; text-decoration: none; font-size: 13.5px; border-left: 3px solid transparent; white-space: nowrap;
}
.sidebar-menu a:hover{ background: rgba(255,255,255,.09); color: #fff; }
.sidebar-menu a.active{ background: rgba(255,255,255,.15); color: #fff; border-left-color: #ffc107; font-weight: 500; }
.sidebar-menu a i{ font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-menu a .badge{ margin-left: auto; font-size: 10px; }

/* ---------------- Topbar & konten ---------------- */
.topbar{
  position: fixed; top: 0; right: 0; left: var(--sidebar-w); height: var(--topbar-h);
  background: #fff; border-bottom: 1px solid var(--border); z-index: 1030;
  display: flex; align-items: center; gap: 12px; padding: 0 18px; transition: left .2s ease;
}
.main-content{ margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 18px) 18px 40px; transition: margin-left .2s ease; min-height: 100vh; }
body.sidebar-collapsed .sidebar{ width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .menu-title,
body.sidebar-collapsed .sidebar-menu a span{ display: none; }
body.sidebar-collapsed .sidebar-menu a{ justify-content: center; padding: 11px 0; }
body.sidebar-collapsed .topbar{ left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .main-content{ margin-left: var(--sidebar-w-collapsed); }

@media (max-width: 991.98px){
  .sidebar{ transform: translateX(-100%); }
  body.sidebar-open .sidebar{ transform: translateX(0); width: var(--sidebar-w); }
  body.sidebar-open .sidebar .brand-text,
  body.sidebar-open .sidebar .menu-title,
  body.sidebar-open .sidebar-menu a span{ display: initial; }
  .topbar{ left: 0; }
  .main-content{ margin-left: 0; padding-left: 12px; padding-right: 12px; }
  .sidebar-backdrop{ position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
}

/* ---------------- Komponen ---------------- */
.page-head{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.page-head h1{ font-size: 20px; font-weight: 600; margin: 0; }
.page-head .breadcrumb{ margin: 2px 0 0; font-size: 12px; }

.card{ border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header{ background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; padding: 12px 16px; border-radius: 10px 10px 0 0 !important; }

.stat-card{ border-radius: 10px; border: 1px solid var(--border); background: #fff; padding: 16px; height: 100%; }
.stat-card .stat-icon{ width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-card .stat-value{ font-size: 22px; font-weight: 700; line-height: 1.2; margin: 6px 0 2px; }
.stat-card .stat-label{ font-size: 12px; color: #6b7684; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .stat-trend{ font-size: 12px; }

.table{ font-size: 13.5px; margin-bottom: 0; }
.table > thead th{ background: #f7f9fc; font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; color: #59636f; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table > tbody > tr:hover{ background: #f8fbff; }
.table td, .table th{ vertical-align: middle; padding: 9px 12px; }
.table-actions{ white-space: nowrap; text-align: right; }
.table-actions .btn{ padding: 2px 7px; font-size: 12px; }

.badge-soft-primary{ background: #e7f0fb; color: #1f4e79; }
.badge{ font-weight: 500; }
.avatar-sm{ width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar-initials{
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-light); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.avatar-lg{ width: 72px; height: 72px; font-size: 26px; }

.form-label{ font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.form-label .req{ color: #dc3545; }
.form-control, .form-select{ font-size: 13.5px; }
.form-text{ font-size: 11.5px; }
.required-note{ font-size: 11.5px; color: #6b7684; }

.filter-bar{ background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }

.empty-state{ text-align: center; padding: 44px 16px; color: #8a94a2; }
.empty-state i{ font-size: 44px; opacity: .35; display: block; margin-bottom: 10px; }

/* Papan kanban pipeline */
.kanban{ display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col{ min-width: 272px; max-width: 272px; background: #eef1f6; border-radius: 10px; display: flex; flex-direction: column; }
.kanban-col-head{ padding: 10px 12px; font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; }
.kanban-col-body{ padding: 8px; min-height: 120px; flex: 1; overflow-y: auto; max-height: 66vh; }
.kanban-card{ background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--border); cursor: grab; font-size: 13px; }
.kanban-card:hover{ box-shadow: 0 2px 8px rgba(16,24,40,.1); }
.kanban-card.dragging{ opacity: .45; }
.kanban-col.drop-target .kanban-col-body{ background: #dde8f5; border-radius: 8px; }

/* Lini masa aktivitas */
.timeline{ position: relative; padding-left: 26px; list-style: none; margin: 0; }
.timeline::before{ content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item{ position: relative; padding-bottom: 16px; }
.timeline-item .timeline-dot{
  position: absolute; left: -26px; top: 1px; width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border);
}
.timeline-item:not(:has(.timeline-dot))::before{
  content: ""; position: absolute; left: -21px; top: 4px; width: 11px; height: 11px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand-light);
}
.timeline-item .t-time{ font-size: 11.5px; color: #8a94a2; }

.nav-tabs .nav-link{ font-size: 13.5px; color: #59636f; }
.nav-tabs .nav-link.active{ font-weight: 600; color: var(--brand); }

.notif-item{ padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif-item.unread{ background: #f0f7ff; }
.dropdown-menu{ font-size: 13.5px; }

.login-wrapper{ min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); }
.login-card{ width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 30px 28px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-logo{ width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin: 0 auto 12px; }

.password-meter{ height: 5px; border-radius: 3px; background: #e9ecef; overflow: hidden; margin-top: 6px; }
.password-meter div{ height: 100%; width: 0; transition: width .25s ease, background .25s ease; }

.help-box{ background: #f0f7ff; border-left: 3px solid var(--brand-light); padding: 10px 14px; border-radius: 6px; font-size: 12.5px; }
.iso-tag{ font-size: 10.5px; background: #e9f7ef; color: #146c43; padding: 2px 7px; border-radius: 10px; font-weight: 600; }

@media print{
  .sidebar, .topbar, .no-print, .btn{ display: none !important; }
  .main-content{ margin: 0; padding: 0; }
  .card{ border: none; box-shadow: none; }
}
