/* =========================================================
   CRM Sederhana — Custom theme (Metronic-inspired, flat burgundy)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@600;700&display=swap');

:root{
  /* Brand — flat burgundy */
  --primary:        #7B1E3D;
  --primary-dark:   #5C162E;
  --primary-light:  #9C3A5A;
  --primary-tint:   #F7E9EE;

  /* Neutrals */
  --bg:             #F3F4F9;
  --card-bg:        #FFFFFF;
  --border:         #E7E7F0;
  --text:           #2B2B36;
  --text-muted:     #8B8CA3;
  --sidebar-w:      264px;
  --topbar-h:       72px;

  /* Status colors (kept distinct from brand red so pipeline stages read clearly) */
  --st-new:         #3699FF;
  --st-contacted:   #8950FC;
  --st-qualified:   #FFA800;
  --st-proposal:    #00B0C7;
  --st-negotiation: #6C7293;
  --st-won:         #17C653;
  --st-lost:        #7E8299;

  --radius:         12px;
  --shadow:         0 2px 10px rgba(43,20,30,.06);
  --shadow-lg:      0 10px 30px rgba(43,20,30,.10);
}

*{ box-sizing: border-box; }

body{
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14.5px;
  margin: 0;
}

a{ text-decoration: none; }
.text-primary-c{ color: var(--primary) !important; }

/* ---------------- Auth / Login page ---------------- */
.auth-wrap{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--primary-light) 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--primary-dark) 0%, transparent 55%),
    var(--primary);
  padding: 20px;
}
.auth-card{
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 40px 34px;
}
.auth-logo{
  width: 54px; height: 54px;
  border-radius: 14px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 22px;
  margin: 0 auto 18px;
}
/* Uploaded brand logo: no background/shape, auto-scaled so any source image
   size still fits neatly above the login card heading. */
.auth-logo-img{
  display: block !important;
  max-height: 56px !important;
  max-width: 200px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  margin: 0 auto 18px;
}
.auth-card h1{
  font-family: 'Poppins', sans-serif;
  font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px;
}
.auth-card p.sub{ text-align: center; color: var(--text-muted); margin-bottom: 26px; font-size: 13.5px; }

.form-control, .form-select{
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  background: #fbfbfe;
}
.form-control:focus, .form-select:focus{
  border-color: var(--primary-light);
  box-shadow: 0 0 0 .18rem var(--primary-tint);
  background: #fff;
}
label.form-label{ font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 6px; }

.btn-primary-c{
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
  transition: background .15s ease, transform .05s ease;
}
.btn-primary-c:hover{ background: var(--primary-dark); border-color: var(--primary-dark); color:#fff; }
.btn-primary-c:active{ transform: translateY(1px); }

.btn-outline-c{
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 18px;
}
.btn-outline-c:hover{ background: #f7f7fb; }

.btn-danger-soft{
  background: #FDEDF1; color:#B5194A; border: 1px solid #FBD6E1; font-weight:600; border-radius:10px; padding:9px 16px;
}
.btn-danger-soft:hover{ background:#FBD6E1; color:#8f0f38; }

/* ---------------- App shell ---------------- */
.app-shell{ display: flex; min-height: 100vh; }

.sidebar{
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .2s ease;
}
.sidebar-brand{
  display:flex; align-items:center; gap:12px;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand .mark{
  width:36px; height:36px; border-radius:10px; background: rgba(255,255,255,.16);
  display:flex; align-items:center; justify-content:center; font-family:'Poppins',sans-serif; font-weight:700;
}
.sidebar-brand .name{ font-family:'Poppins', sans-serif; font-weight:700; font-size:16.5px; line-height:1.1; }
.sidebar-brand .name small{ display:block; font-family:'Inter',sans-serif; font-weight:400; font-size:11px; color: rgba(255,255,255,.65); }

.sidebar-nav{ padding: 16px 12px; flex: 1; overflow-y:auto; }
.sidebar-nav .nav-label{
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: rgba(255,255,255,.5); padding: 14px 12px 6px;
}
.sidebar-nav a{
  display:flex; align-items:center; gap:12px;
  color: rgba(255,255,255,.82);
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 500; font-size: 14px;
  margin-bottom: 3px;
  border-left: 3px solid transparent;
}
.sidebar-nav a i{ font-size: 17px; width: 20px; text-align:center; }
.sidebar-nav a:hover{ background: rgba(255,255,255,.08); color:#fff; }
.sidebar-nav a.active{
  background: rgba(255,255,255,.14);
  color:#fff;
  border-left-color:#fff;
}
.sidebar-foot{
  padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.12);
  font-size:12px; color: rgba(255,255,255,.55);
}

.main{
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar{
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display:flex; align-items:center; justify-content: space-between;
  padding: 0 26px;
  position: sticky; top:0; z-index: 900;
}
.topbar .page-title{ font-family:'Poppins', sans-serif; font-weight:700; font-size:19px; }
.topbar .page-title span{ display:block; font-family:'Inter',sans-serif; font-weight:400; font-size:12px; color: var(--text-muted); }

.sidebar-toggle{
  display:none; border:none; background:transparent; font-size:22px; color: var(--text); cursor:pointer;
}

.user-chip{
  display:flex; align-items:center; gap:10px; cursor:pointer; padding:6px 10px; border-radius:10px;
}
.user-chip:hover{ background: #f7f7fb; }
.avatar{
  width:38px; height:38px; border-radius:50%;
  background: var(--primary-tint); color: var(--primary);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:14px;
}
.avatar-lg{ width:84px; height:84px; font-size:28px; }

.content{ padding: 26px; flex:1; }

/* ---------------- Cards / stats ---------------- */
.card-c{
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-c .card-c-head{
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
}
.card-c .card-c-head h6{ margin:0; font-weight:700; font-size:14.5px; }
.card-c .card-c-body{ padding: 20px; }

.stat-card{
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display:flex; align-items:center; gap:16px;
}
.stat-icon{
  width:50px; height:50px; border-radius: 12px;
  display:flex; align-items:center; justify-content:center; font-size:21px; flex-shrink:0;
}
.stat-card h3{ font-family:'Poppins',sans-serif; font-weight:700; font-size:24px; margin:0; }
.stat-card p{ margin:0; color: var(--text-muted); font-size:13px; }

/* Pipeline funnel — signature dashboard element */
.pipeline{
  display:flex; border-radius: 10px; overflow:hidden; height:14px; width:100%;
}
.pipeline span{ height:100%; }
.pipeline-legend{ display:flex; flex-wrap:wrap; gap: 14px 20px; margin-top:16px; }
.pipeline-legend .item{ display:flex; align-items:center; gap:8px; font-size:12.5px; color: var(--text-muted); }
.pipeline-legend .dot{ width:9px; height:9px; border-radius:50%; }

/* ---------------- Badges ---------------- */
.badge-status{
  display:inline-flex; align-items:center; gap:6px;
  padding: 4px 11px; border-radius: 20px; font-size:12px; font-weight:600;
}
.badge-status::before{ content:''; width:6px; height:6px; border-radius:50%; background: currentColor; }
.badge-status-new{         background:#EAF4FF; color:#1B6FE0; }
.badge-status-contacted{   background:#F1EBFE; color:#6E1FE0; }
.badge-status-qualified{   background:#FFF6E5; color:#C77E00; }
.badge-status-proposal{    background:#E6F8FA; color:#00889C; }
.badge-status-negotiation{ background:#EEEEF3; color:#565A75; }
.badge-status-won{         background:#E7FBF0; color:#0E9F44; }
.badge-status-lost{        background:#F1F1F5; color:#5B5E70; }

/* ---------------- Tables ---------------- */
.table-c{ width:100%; border-collapse: separate; border-spacing:0; }
.table-c thead th{
  text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.04em;
  color: var(--text-muted); font-weight:700;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: #FAFAFD;
}
.table-c tbody td{ padding: 14px; border-bottom: 1px solid var(--border); font-size:14px; vertical-align:middle; }
.table-c tbody tr:last-child td{ border-bottom:none; }
.table-c tbody tr:hover{ background: #FCFAFB; }

.lead-name{ font-weight:600; color: var(--text); }
.lead-sub{ color: var(--text-muted); font-size:12.5px; }

.icon-btn{
  width:32px; height:32px; border-radius:8px; border:1px solid var(--border); background:#fff;
  display:inline-flex; align-items:center; justify-content:center; color: var(--text-muted); cursor:pointer;
}
.icon-btn:hover{ background: var(--primary-tint); color: var(--primary); border-color: var(--primary-tint); }

/* ---------------- Filters / toolbar ---------------- */
.toolbar{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content: space-between; margin-bottom: 18px; }
.toolbar .filters{ display:flex; flex-wrap:wrap; gap:10px; }
.search-box{ position:relative; }
.search-box i{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color: var(--text-muted); font-size:14px; }
.search-box input{ padding-left:34px; min-width: 240px; }

/* ---------------- Timeline (lead detail activity) ---------------- */
.timeline{ list-style:none; margin:0; padding:0; }
.timeline li{ display:flex; gap:14px; padding-bottom:20px; position:relative; }
.timeline li:not(:last-child)::before{
  content:''; position:absolute; left:9px; top:22px; bottom:0; width:2px; background: var(--border);
}
.timeline .dot-wrap{ width:20px; height:20px; border-radius:50%; background: var(--primary-tint); color: var(--primary);
  display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:2px; }
.timeline .dot-wrap i{ font-size:11px; }
.timeline .note{ font-size:13.5px; }
.timeline .meta{ font-size:12px; color: var(--text-muted); margin-top:2px; }

/* ---------------- Login flash / alerts ---------------- */
.alert-c{ border-radius:10px; padding:12px 16px; font-size:13.5px; font-weight:500; margin-bottom:18px; border:1px solid transparent; }
.alert-c.success{ background:#E7FBF0; color:#0E9F44; border-color:#CBF3DA; }
.alert-c.error{ background:#FDEDF1; color:#B5194A; border-color:#FBD6E1; }

/* ---------------- Service multi-select (checkbox pills) ---------------- */
.service-check-group{ display:flex; flex-wrap:wrap; gap:9px; }
.service-pill{
  display:inline-flex; align-items:center; gap:7px;
  padding: 8px 14px; border:1px solid var(--border); border-radius:20px;
  font-size:13px; cursor:pointer; background:#fff; user-select:none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.service-pill input{ accent-color: var(--primary); margin:0; }
.service-pill input:checked ~ span{ color: var(--primary-dark); font-weight:600; }
.service-pill:has(input:checked),
.service-pill.is-checked{ background: var(--primary-tint); border-color: var(--primary-light); }

/* Read-only service tags shown on lead list / detail */
.svc-tag{
  display:inline-block; padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:600;
  background: var(--primary-tint); color: var(--primary-dark); margin:2px 4px 2px 0;
}

/* ---------------- Currency (Rp) input — prefix sits INSIDE the input box ---------------- */
.rp-input-wrap{ position:relative; }
.rp-input-wrap .rp-prefix-inline{
  position:absolute; left:14px; top:50%; transform:translateY(-50%);
  font-weight:700; color:var(--text-muted); font-size:14px; pointer-events:none;
}
.rp-input-wrap input{ padding-left:38px; }

/* Legacy two-box variant kept for anything still referencing it */
.rp-input-group{ display:flex; align-items:stretch; }
.rp-input-group .rp-prefix{
  display:flex; align-items:center; padding: 0 14px;
  background:#F3F1F4; border:1px solid var(--border); border-right:none;
  border-radius: 10px 0 0 10px; font-weight:700; color: var(--text-muted); font-size:14px;
}
.rp-input-group input{ border-radius: 0 10px 10px 0 !important; }

/* ---------------- Role badge (user management) ---------------- */
.badge-role{ display:inline-flex; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:700; }
.badge-role-admin{ background:#FDEDF1; color:#B5194A; }
.badge-role-marketing{ background:#EAF4FF; color:#1B6FE0; }

/* Empty state */
.empty-state{ text-align:center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i{ font-size:40px; color: var(--primary-light); opacity:.5; margin-bottom:12px; display:block; }

/* ---------------- Topbar: search, quick-add, notifications ---------------- */
.topbar-actions{ display:flex; align-items:center; gap:10px; }
.topbar-search{ display:none; }
@media (min-width: 768px){ .topbar-search{ display:block; } }
.topbar-search input{ min-width: 220px; }

.btn-quick-add{ padding:9px 14px; font-size:13.5px; white-space:nowrap; }

.notif-bell{ position:relative; }
.notif-badge{
  position:absolute; top:-5px; right:-5px; background:var(--primary); color:#fff;
  font-size:10px; font-weight:700; min-width:17px; height:17px; border-radius:9px;
  display:flex; align-items:center; justify-content:center; padding:0 4px; line-height:1;
}
.notif-dropdown{ width: 340px; max-width: 90vw; overflow:hidden; }
.notif-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 16px; border-bottom:1px solid var(--border); font-weight:700; font-size:13.5px;
}
.notif-head a{ font-size:11.5px; font-weight:600; color: var(--primary); }
.notif-list{ max-height: 340px; overflow-y:auto; }
.notif-item{ display:block; padding:12px 16px; border-bottom:1px solid var(--border); color:var(--text); }
.notif-item:last-child{ border-bottom:none; }
.notif-item:hover{ background:#FAFAFD; }
.notif-item.unread{ background: var(--primary-tint); }
.notif-item .notif-msg{ font-size:13px; line-height:1.4; }
.notif-item .notif-time{ font-size:11px; color: var(--text-muted); margin-top:3px; }
.notif-empty{ padding: 30px 16px; text-align:center; color: var(--text-muted); font-size:13px; }

/* ---------------- Services multi-select (native <select multiple>) ---------------- */
select[multiple].form-select{
  height: auto;
  min-height: 130px;
  padding: 8px;
  background-image: none;
}
select[multiple].form-select option{
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
}
select[multiple].form-select option:checked{
  background: var(--primary) linear-gradient(0deg, var(--primary) 0%, var(--primary) 100%);
  color: #fff;
}

/* ---------------- Lead / Payout unique code chip ---------------- */
.code-chip{
  display:inline-flex; align-items:center; font-family: 'Poppins', monospace, sans-serif;
  font-size:12px; font-weight:700; color: var(--primary); background: var(--primary-tint);
  padding:3px 9px; border-radius:8px; letter-spacing:.02em;
}
a.code-chip{ text-decoration:none; }
a.code-chip:hover{ background: var(--primary-light); color:#fff; }

/* ---------------- Payout status badges ---------------- */
.badge-payout-pending{ background:#FFF6E5; color:#C77E00; }
.badge-payout-processing{ background:#EAF4FF; color:#1B6FE0; }
.badge-payout-success{ background:#E7FBF0; color:#0E9F44; }
.badge-payout-pending, .badge-payout-processing, .badge-payout-success{
  display:inline-flex; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:700;
}

/* ---------------- Payout / claim UI ---------------- */
.payout-hero{
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius); padding:22px 24px; color:#fff;
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
}
.payout-hero .amount{ font-family:'Poppins',sans-serif; font-weight:700; font-size:26px; }
.payout-hero .label{ font-size:12.5px; opacity:.85; }
.payout-hero .btn-claim{
  background:#fff; color: var(--primary); border:none; font-weight:700; border-radius:10px;
  padding:11px 22px; white-space:nowrap;
}
.payout-hero .btn-claim:disabled{ background: rgba(255,255,255,.35); color: rgba(255,255,255,.8); cursor:not-allowed; }
.payout-hero .btn-claim:hover:not(:disabled){ background:#f3f3f3; }

.claim-warning{
  display:flex; gap:10px; align-items:flex-start; background:#FFF6E5; color:#8a5a00;
  border:1px solid #FBE8B8; border-radius:10px; padding:12px 14px; font-size:12.5px; margin-top:14px;
}
.claim-warning i{ font-size:16px; margin-top:1px; }

/* Small metric card used beside "Aksi Cepat" on the dashboard */
.mini-metric{
  background: var(--card-bg); border:1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; height:100%;
  display:flex; flex-direction:column; justify-content:space-between;
}
.mini-metric .top{ display:flex; align-items:center; justify-content:space-between; }
.mini-metric h4{ font-family:'Poppins',sans-serif; font-weight:700; font-size:20px; margin:8px 0 2px; }
.mini-metric p{ margin:0; color:var(--text-muted); font-size:12.5px; }

/* Responsive */
@media (max-width: 991px){
  .sidebar{ transform: translateX(-100%); }
  .sidebar.open{ transform: translateX(0); }
  .main{ margin-left: 0; }
  .sidebar-toggle{ display:inline-flex; align-items:center; justify-content:center; }
  .search-box input{ min-width: 140px; }
}
