/* =====================================================================
   Hardian Client Infrastructure Portal — Design System
   Premium, clean, Apple-inspired. Plus Jakarta Sans.
   ===================================================================== */

:root {
  --navy: #0B2545;
  --navy-700: #13315C;
  --navy-600: #1B3A66;
  --accent: #F0A500;
  --accent-600: #d8940a;
  --bg: #FFFFFF;
  --bg-soft: #F5F7FA;
  --bg-softer: #EDF1F6;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-soft: #475569;
  --text-muted: #94A3B8;
  --success: #16A34A;
  --success-bg: #DCFCE7;
  --info: #2563EB;
  --info-bg: #DBEAFE;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow: 0 4px 16px rgba(15,23,42,.08);
  --shadow-lg: 0 16px 48px rgba(11,37,69,.16);
  --maxw: 1200px;
  --nav-h: 70px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------------------------- Typography --------------------------- */
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; color: var(--navy); }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--accent-600); }
.lead { font-size: 1.12rem; color: var(--text-soft); }
.text-soft { color: var(--text-soft); }
.text-muted { color: var(--text-muted); }

/* ----------------------------- Buttons ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; transition: all .18s ease; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent { background: var(--accent); color: var(--navy); }
.btn-accent:hover { background: var(--accent-600); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--navy); }
.btn-light { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-light:hover { background: var(--bg-soft); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ----------------------------- Cards ------------------------------- */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease;
}
.card-pad { padding: 24px; }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

/* ----------------------------- Badges ------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.4;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--bg-softer); color: var(--text-soft); }

/* ----------------------------- Forms ------------------------------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 7px; color: var(--text); }
.field .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: .95rem; color: var(--text); background: #fff; transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,37,69,.1);
}
.textarea { resize: vertical; min-height: 110px; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: 6px; }
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--danger); }
.help-text { font-size: .82rem; color: var(--text-muted); margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ----------------------------- Tables ------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { background: var(--bg-soft); font-weight: 600; color: var(--text-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-soft); }

/* --------------------------- Flash/Toast --------------------------- */
.toast-stack { position: fixed; top: 86px; right: 20px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  background: #fff; border-left: 4px solid var(--info); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 14px 18px; font-size: .9rem; display: flex; gap: 10px;
  animation: toastIn .3s ease; align-items: flex-start;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast svg { width: 20px; height: 20px; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* --------------------------- Empty/Error --------------------------- */
.empty-state, .error-state { text-align: center; padding: 56px 24px; color: var(--text-soft); }
.empty-state svg, .error-state svg { width: 56px; height: 56px; color: var(--text-muted); margin: 0 auto 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* --------------------------- Skeleton ------------------------------ */
.skeleton { background: linear-gradient(90deg, var(--bg-softer) 25%, #f8fafc 50%, var(--bg-softer) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --------------------------- Sections ------------------------------ */
.section { padding: 80px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section-head .lead { margin-top: 12px; }

/* ============================ PUBLIC NAV =========================== */
.pubnav {
  position: sticky; top: 0; z-index: 1000; height: var(--nav-h);
  background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.pubnav .inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--navy); font-size: 1.1rem; letter-spacing: -.02em; }
.brand svg { width: 34px; height: 34px; }
.navlinks { display: flex; align-items: center; gap: 4px; }
.navlinks a { padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: .92rem; color: var(--text-soft); transition: all .15s; }
.navlinks a:hover, .navlinks a.active { color: var(--navy); background: var(--bg-soft); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; background: none; border: none; padding: 6px; }
.nav-toggle svg { width: 26px; height: 26px; color: var(--navy); }

@media (max-width: 900px) {
  .navlinks, .nav-actions .btn { display: none; }
  .nav-toggle { display: block; }
  .pubnav.open .navlinks {
    display: flex; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border); padding: 12px; gap: 2px; box-shadow: var(--shadow);
  }
  .pubnav.open .navlinks a { padding: 12px 14px; }
  .pubnav.open .nav-actions .btn { display: inline-flex; }
  .pubnav.open .nav-actions { position: absolute; top: calc(var(--nav-h) + 100%); }
}

/* ============================== HERO ============================== */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 600px at 80% -10%, var(--navy-600), transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--navy-700) 100%);
  padding: 92px 0 100px;
}
.hero::after {
  content: ''; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(800px 500px at 70% 0%, #000, transparent 70%);
}
.hero .inner { position: relative; z-index: 2; max-width: 760px; }
.hero h1 { color: #fff; margin-bottom: 18px; }
.hero p { color: rgba(255,255,255,.82); font-size: 1.18rem; max-width: 620px; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600; margin-bottom: 24px; }
.hero-badge svg { width: 16px; height: 16px; color: var(--accent); }

/* =========================== Counters ============================= */
.counters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.counter { text-align: center; }
.counter .num { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; color: var(--navy); letter-spacing: -.03em; }
.counter .label { color: var(--text-soft); font-size: .9rem; margin-top: 4px; }
@media (max-width: 760px) { .counters { grid-template-columns: repeat(2, 1fr); } }

/* =========================== Feature grid ========================= */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  padding: 26px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; transition: all .2s;
}
.feature:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: #d2dce8; }
.feature .ico { width: 50px; height: 50px; border-radius: 12px; background: var(--navy); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.feature .ico svg { width: 26px; height: 26px; color: var(--accent); }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--text-soft); font-size: .92rem; }

/* =========================== Article cards ======================== */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .article-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .article-grid { grid-template-columns: 1fr; } }
.article-card { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; transition: all .2s; display: flex; flex-direction: column; }
.article-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.article-card .thumb { aspect-ratio: 16/9; background: var(--bg-softer); overflow: hidden; }
.article-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-card .body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.article-card h3 { font-size: 1.08rem; margin: 10px 0 8px; }
.article-card p { color: var(--text-soft); font-size: .9rem; flex: 1; }
.article-card .meta { font-size: .8rem; color: var(--text-muted); margin-top: 14px; }

/* ============================== Footer ============================ */
.footer { background: var(--navy); color: rgba(255,255,255,.78); padding: 56px 0 28px; margin-top: 0; }
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
@media (max-width: 760px) { .footer .cols { grid-template-columns: 1fr; gap: 28px; } }
.footer h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; }
.footer a { color: rgba(255,255,255,.78); font-size: .9rem; display: block; padding: 4px 0; transition: color .15s; }
.footer a:hover { color: var(--accent); }
.footer .brand { color: #fff; margin-bottom: 14px; }
.footer .copyright { border-top: 1px solid rgba(255,255,255,.12); padding-top: 22px; font-size: .85rem; color: rgba(255,255,255,.55); text-align: center; }

/* ======================== Floating WhatsApp ====================== */
.fab-wa {
  position: fixed; right: 22px; bottom: 22px; z-index: 1100;
  width: 58px; height: 58px; border-radius: 50%; background: #25D366;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(37,211,102,.4); transition: transform .2s;
}
.fab-wa:hover { transform: scale(1.08); }
.fab-wa svg { width: 30px; height: 30px; color: #fff; }
.fab-wa::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%; background: #25D366; opacity: .5;
  animation: pulse 2.2s infinite; z-index: -1;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.8); opacity: 0; } }

/* ============================ Map page =========================== */
.map-layout { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - var(--nav-h)); overflow: hidden; }
.map-sidebar { border-right: 1px solid var(--border); overflow-y: auto; padding: 22px; background: var(--bg-soft); height: 100%; }
#map { width: 100%; height: 100%; z-index: 0; }

/* Penting: reset global box-sizing portal merusak tile Leaflet.
   Kembalikan elemen internal peta ke content-box agar tile menyatu rapi. */
.leaflet-container,
.leaflet-container * {
  box-sizing: content-box;
}
.leaflet-container img.leaflet-tile { max-width: none !important; }
.map-filter { margin-bottom: 16px; }
.proj-list-item { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 10px; cursor: pointer; transition: all .15s; }
.proj-list-item:hover { border-color: var(--navy); box-shadow: var(--shadow-sm); }
.proj-list-item h4 { font-size: .95rem; color: var(--navy); margin-bottom: 3px; }
.proj-list-item .sub { font-size: .8rem; color: var(--text-muted); }
@media (max-width: 860px) {
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-sidebar { max-height: 320px; border-right: none; border-bottom: 1px solid var(--border); }
  #map { height: 60vh; min-height: 380px; }
}
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); }
.map-popup h4 { color: var(--navy); font-size: 1rem; margin-bottom: 4px; }
.map-popup .pp-meta { font-size: .82rem; color: var(--text-soft); margin-bottom: 8px; }
.map-popup img { border-radius: 8px; margin: 8px 0; aspect-ratio: 16/9; object-fit: cover; }

/* ============================= ADMIN ============================= */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 256px; background: var(--navy); color: rgba(255,255,255,.8); flex-shrink: 0;
  position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 900; transition: transform .25s;
}
.admin-sidebar .brand { color: #fff; padding: 22px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 9px; color: rgba(255,255,255,.72); font-size: .92rem; font-weight: 500; transition: all .15s; }
.admin-nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.active { background: var(--accent); color: var(--navy); font-weight: 600; }
.admin-main { flex: 1; margin-left: 256px; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 800; }
.admin-content { padding: 28px; flex: 1; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.sidebar-toggle { display: none; background: none; border: none; padding: 4px; }
.sidebar-toggle svg { width: 26px; height: 26px; color: var(--navy); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 850; }
@media (max-width: 980px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .sidebar-backdrop.show { display: block; }
}

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
@media (max-width: 980px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stat-grid { grid-template-columns: 1fr; } }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; }
.stat .ico svg { width: 22px; height: 22px; color: var(--navy); }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--navy); margin-top: 12px; letter-spacing: -.03em; }
.stat .label { color: var(--text-soft); font-size: .88rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; }

/* ============================ CLIENT ============================= */
.client-shell { min-height: 100vh; background: var(--bg-soft); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.qa {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; transition: all .18s;
}
.qa:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--navy); }
.qa .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--navy); display: flex; align-items: center; justify-content: center; }
.qa .ico svg { width: 22px; height: 22px; color: var(--accent); }
.qa span { font-weight: 600; font-size: .92rem; color: var(--navy); }

/* timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 26px; }
.tl-item::before { content: ''; position: absolute; left: -25px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--border); }
.progress-bar { height: 8px; background: var(--bg-softer); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }

/* modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(11,37,69,.5); z-index: 1300; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg); max-width: 440px; width: 100%; padding: 28px; box-shadow: var(--shadow-lg); animation: modalIn .22s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--text-soft); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* utilities */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.flex{display:flex}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-1{gap:8px}.gap-2{gap:16px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:20px}
@media(max-width:640px){.grid-2{grid-template-columns:1fr}}
.text-center{text-align:center}.hidden{display:none}
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 160px; flex: 0 1 auto; }
.toolbar .search { flex: 1; min-width: 200px; }
