/* =====================================================
   SINERGI INSPEKTUR TAMBANG — Stylesheet
   Tema: pengawasan tambang (coal / safety amber / steel blue)
   ===================================================== */

:root {
  --coal: #16181D;
  --coal-2: #21252D;
  --coal-3: #2C313B;
  --paper: #F5F4F0;
  --card: #FFFFFF;
  --line: #E4E2DA;
  --ink: #1F2328;
  --muted: #6B7280;
  --amber: #E8930C;
  --amber-2: #C77C06;
  --amber-soft: #FDF3E1;
  --blue: #2563EB;
  --blue-soft: #E7EEFD;
  --green: #16803C;
  --green-soft: #E4F4E9;
  --red: #C0392B;
  --red-soft: #FBE9E7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(22, 24, 29, .08), 0 4px 14px rgba(22, 24, 29, .05);
  --font-d: 'Barlow Semi Condensed', 'Inter', sans-serif;
  --font-b: 'Inter', system-ui, sans-serif;
  --font-m: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-b); font-size: 14.5px; color: var(--ink); background: var(--paper); line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.ic { flex-shrink: 0; vertical-align: -3px; }
.mono { font-family: var(--font-m); font-size: .92em; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ta-r { text-align: right; }
.inline { display: inline; }
.prewrap { white-space: pre-wrap; }
.w-180 { min-width: 150px; }

/* ---------- Shell layout ---------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 22px 26px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---------- Sidebar ---------- */
.side {
  width: 252px; flex-shrink: 0; background: var(--coal); color: #C9CDD4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; border-bottom: 1px solid var(--coal-3); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px; background: var(--amber); color: var(--coal);
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-family: var(--font-d); font-weight: 700; font-size: 18px; letter-spacing: .06em; color: #fff; }
.brand-sub { font-size: 10.5px; color: #8B9099; letter-spacing: .02em; }
.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  font-weight: 500; font-size: 14px; color: #AEB4BD; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--coal-2); color: #fff; }
.nav-item.on { background: var(--coal-3); color: #fff; box-shadow: inset 3px 0 0 var(--amber); }
.side-foot { padding: 14px; border-top: 1px solid var(--coal-3); }
.side-user { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--amber); color: var(--coal);
  font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.side-user-t { min-width: 0; }
.side-user-t strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-t span { font-size: 11.5px; color: #8B9099; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.page-title { font-family: var(--font-d); font-size: 21px; font-weight: 600; letter-spacing: .02em; flex: 1; }
.menu-btn { display: none; }
.chip-role { background: var(--amber-soft); color: var(--amber-2); border: 1px solid #F2DBB4; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; transition: filter .15s, background .15s;
}
.btn-primary { background: var(--amber); color: var(--coal); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.side .btn-ghost { border-color: var(--coal-3); color: #AEB4BD; }
.side .btn-ghost:hover { background: var(--coal-2); color: #fff; }
.btn-ghost:hover { background: rgba(0,0,0,.04); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); cursor: pointer; transition: all .15s;
}
.iconbtn:hover { border-color: var(--amber); color: var(--amber-2); }
.iconbtn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.row-actions { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-family: var(--font-d); font-size: 16.5px; font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 9px; color: var(--ink); }
.card-head h3 .ic { color: var(--amber-2); }
.card > .table-wrap, .card > form, .card > .detail-grid, .card > .lap-body, .card > .empty, .card > .nilai-view, .card > .nilai-form, .card > .lamp-sect, .card > .cal, .card > .cal-legend, .card > .cal-cta, .card > .map-flex { padding: 18px 20px; }
.card > .table-wrap { padding: 0; }

/* ---------- Hero ---------- */
.hero-card {
  background: linear-gradient(135deg, var(--coal) 0%, var(--coal-2) 100%);
  color: #fff; border-radius: var(--radius); padding: 24px 26px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.hero-card::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 7px;
  background: repeating-linear-gradient(45deg, var(--amber) 0 10px, var(--coal) 10px 20px);
}
.hero-card.compact { padding: 18px 24px; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--amber); font-weight: 600; margin-bottom: 4px; }
.hero-name { font-family: var(--font-d); font-size: 24px; font-weight: 600; letter-spacing: .02em; margin-bottom: 8px; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-card .chip { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.14); color: #DDE0E5; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
  display: flex; align-items: center; gap: 15px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
a.stat-card:hover { transform: translateY(-2px); border-color: var(--amber); }
.stat-ic { width: 46px; height: 46px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.ic-blue { background: var(--blue-soft); color: var(--blue); }
.ic-amber { background: var(--amber-soft); color: var(--amber-2); }
.ic-slate { background: #EAECEF; color: var(--coal-3); }
.stat-num { font-family: var(--font-d); font-size: 27px; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 12.5px; color: var(--muted); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #EEEDE8; border: 1px solid var(--line); color: var(--ink);
}
.chip-done, .chip-diatas { background: var(--blue-soft); border-color: #C4D4F8; color: var(--blue); }
.chip-warn { background: var(--amber-soft); border-color: #F2DBB4; color: var(--amber-2); }
.chip-sesuai { background: var(--green-soft); border-color: #C4E4CE; color: var(--green); }
.chip-dibawah { background: var(--red-soft); border-color: #F0C6C0; color: var(--red); }
.chip-pred { background: var(--coal); border-color: var(--coal); color: var(--amber); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { font-family: var(--font-d); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; text-align: left; padding: 12px 16px; background: #FAF9F6; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FBFAF7; }
.empty { color: var(--muted); text-align: center; padding: 30px 16px !important; }

/* ---------- Progress bar ---------- */
.bar { height: 7px; background: #EAE8E1; border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--amber), var(--blue)); border-radius: 99px; }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; gap: 9px; margin: 16px 26px 0; padding: 12px 16px; border-radius: 10px; font-weight: 500; font-size: 13.5px; max-width: 1188px; }
.flash-ok { background: var(--green-soft); color: var(--green); border: 1px solid #C4E4CE; }
.flash-err { background: var(--red-soft); color: var(--red); border: 1px solid #F0C6C0; }
.login-card .flash { margin: 0 0 16px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea {
  font-family: var(--font-b); font-size: 14px; color: var(--ink);
  padding: 10px 12px; border: 1px solid #D8D5CC; border-radius: 9px; background: #fff;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232, 147, 12, .16);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input[readonly] { background: #F2F1EC; color: var(--muted); }
.field input[type="file"] { padding: 8px; background: #FAF9F6; }

/* Autosuggest provinsi */
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 9px; margin-top: 4px;
  box-shadow: 0 8px 24px rgba(22,24,29,.14); max-height: 210px; overflow-y: auto;
}
.suggest button { display: block; width: 100%; text-align: left; padding: 9px 13px; border: 0; background: none; font-size: 13.5px; cursor: pointer; }
.suggest button:hover, .suggest button.hl { background: var(--amber-soft); }

/* ---------- Modal ---------- */
.modal { display: none; position: fixed; inset: 0; z-index: 100; background: rgba(22, 24, 29, .55); padding: 20px; overflow-y: auto; }
.modal.open { display: flex; align-items: flex-start; justify-content: center; }
.modal-box {
  background: var(--card); border-radius: 14px; width: 100%; max-width: 620px;
  margin: 4vh auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .18s ease-out;
}
.modal-lg { max-width: 760px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-d); font-size: 17px; font-weight: 600; }
.modal-box form { padding: 20px 22px; }

/* ---------- Kalender ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-h { font-family: var(--font-d); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 600; }
.cal-d {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink);
  background: #F1F0EA; border: 1px solid transparent;
}
.cal-d.off { background: transparent; }
.cal-d.inbatch { background: #fff; border-color: var(--line); }
.cal-d.today { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(232,147,12,.25); font-weight: 700; }
.cal-d.done { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
a.cal-d.done:hover { filter: brightness(1.12); }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding-top: 0 !important; }
.lg { display: inline-block; width: 13px; height: 13px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }
.lg-done { background: var(--blue); }
.lg-batch { background: #fff; border: 1px solid var(--line); }
.lg-today { background: #fff; border: 2px solid var(--amber); }
.cal-cta { padding-top: 0 !important; }

/* ---------- Detail laporan ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 22px; border-bottom: 1px solid var(--line); }
.dt-l { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.dt-v { font-size: 14px; }
.lap-body h4 { font-family: var(--font-d); font-size: 17px; margin-bottom: 10px; }
.lap-body p { line-height: 1.75; text-align: justify; }
.sect-t { font-family: var(--font-d); font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--ink); }
.sect-t .ic { color: var(--amber-2); }
.lamp-sect { border-top: 1px solid var(--line); }
.lamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lamp-item { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #FAF9F6; }
.lamp-item img { width: 100%; height: 120px; object-fit: cover; display: block; }
.lamp-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 120px; padding: 10px; color: var(--muted); font-size: 11.5px; text-align: center; word-break: break-all; }
.lamp-del {
  position: absolute; top: 6px; right: 6px; width: 27px; height: 27px; border-radius: 7px;
  border: 0; background: rgba(22,24,29,.72); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lamp-del:hover { background: var(--red); }

/* ---------- Penilaian ---------- */
.nilai-badges { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 14px; }
.nilai-note { background: #FAF9F6; border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 8px; padding: 12px 15px; margin-bottom: 10px; line-height: 1.7; }
.nilai-form { border-top: 1px solid var(--line); }

/* ---------- Peta ---------- */
.map-flex { display: flex; gap: 20px; align-items: stretch; }
.map-box { flex: 1.7; min-width: 0; }
.map-box svg { width: 100%; height: auto; display: block; }
.map-side { flex: 1; min-width: 250px; border-left: 1px solid var(--line); padding-left: 20px; max-height: 460px; overflow-y: auto; }
.map-side-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 12px; }
.map-side-empty .ic { color: var(--amber); margin-bottom: 8px; }
.map-side h4 { font-family: var(--font-d); font-size: 16px; margin-bottom: 3px; }
.map-side .map-count { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.mp-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; background: #FBFAF7; }
.mp-item strong { display: block; font-size: 13.5px; }
.mp-item .mono { font-size: 11px; color: var(--muted); }
.mp-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.prov-path { fill: #DEDCD2; stroke: #FFFFFF; stroke-width: .7; cursor: pointer; transition: fill .15s; }
.prov-path.has { fill: #E9B45C; }
.prov-path:hover { fill: var(--amber); }
.prov-path.sel { fill: var(--blue); }
.map-tip {
  position: fixed; z-index: 200; pointer-events: none; background: var(--coal); color: #fff;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 7px; display: none;
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--coal);
  background-image: radial-gradient(ellipse at 20% 10%, #262B34 0%, transparent 55%),
                    radial-gradient(ellipse at 85% 90%, #23272F 0%, transparent 50%);
  padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card { background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.hazard { height: 9px; background: repeating-linear-gradient(45deg, var(--amber) 0 14px, var(--coal) 14px 28px); }
.login-inner { padding: 34px 34px 30px; }
.login-mark {
  width: 58px; height: 58px; border-radius: 14px; background: var(--amber); color: var(--coal);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.login-title { font-family: var(--font-d); font-size: 23px; font-weight: 700; text-align: center; letter-spacing: .02em; }
.login-sub { text-align: center; font-size: 12.5px; color: var(--muted); margin: 6px 0 22px; line-height: 1.6; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-foot { text-align: center; color: #6B7280; font-size: 12px; margin-top: 18px; }

/* ---------- Grid 2 kolom ---------- */
.grid-2col { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: 22px; align-items: start; }

/* ---------- Responsif ---------- */
.scrim { display: none; }
@media (max-width: 1020px) {
  .grid-2col { grid-template-columns: 1fr; }
  .map-flex { flex-direction: column; }
  .map-side { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; max-height: none; }
}
@media (max-width: 820px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 120;
    transform: translateX(-100%); transition: transform .22s ease; height: 100dvh;
  }
  .side.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(22,24,29,.5); z-index: 110; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 42px; }
  .flash { margin: 12px 16px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .hero-card { padding: 20px; }
  .hero-name { font-size: 20px; }
  .page-title { font-size: 18px; }
  .modal { padding: 10px; }
  .modal-box { margin: 2vh auto; }
  td, th { padding: 10px 12px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .cal { gap: 4px; }
  .cal-d { font-size: 12px; border-radius: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
