:root {
  --ink: #1c2321;          /* hampir hitam kehijauan */
  --pine: #1f4d3a;         /* hijau hutan - identitas */
  --pine-2: #2a6b50;
  --amber: #d99a2b;        /* amber serbuk kayu - aksen */
  --bark: #6b5138;
  --paper: #f4f3ee;        /* latar kertas hangat */
  --card: #ffffff;
  --line: #ddd9cf;
  --mut: #77796f;
  --red: #c0392b;
  --blue: #2563eb;
  --ok: #1e824c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--paper); color: var(--ink); font-size: 13.5px; }
a { color: var(--pine-2); }

/* ---------- shell ---------- */
.topbar { display: flex; align-items: center; gap: 12px; background: var(--pine); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 50; }
.topbar .brand { font-weight: 800; letter-spacing: .4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.topbar .brand b { color: var(--amber); }
.topbar .sp { flex: 1; }
.topbar .who { font-size: 12px; color: #d9e6df; text-align: right; line-height: 1.3; }
.topbar button { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 7px; padding: 7px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.topbar button:hover { background: rgba(255,255,255,.22); }
#btnInstall { background: var(--amber); border-color: var(--amber); color: #2c1f06; display: none; }
.layout { display: flex; min-height: calc(100vh - 49px); }
.sidebar { width: 218px; flex: 0 0 218px; background: #fff; border-right: 1px solid var(--line); padding: 10px 8px 40px; }
.sidebar .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--mut); margin: 14px 8px 4px; font-weight: 700; }
.sidebar a.nav { display: block; padding: 8px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; margin-bottom: 1px; }
.sidebar a.nav:hover { background: #f0efe8; }
.sidebar a.nav.on { background: var(--pine); color: #fff; }
.content { flex: 1; padding: 16px 18px 60px; min-width: 0; }
.page-title { font-size: 19px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title small { color: var(--mut); font-weight: 600; font-size: 12px; }
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; display: flex; overflow-x: auto; gap: 4px; padding: 8px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .grp { display: none; }
  .sidebar a.nav { white-space: nowrap; }
}

/* ---------- cards & tables ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--pine); border-radius: 8px; padding: 12px 14px; }
.kcard .t { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--mut); font-weight: 700; }
.kcard .v { font-size: 21px; font-weight: 800; margin-top: 3px; }
.kcard.amber { border-left-color: var(--amber); }
.kcard.red { border-left-color: var(--red); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 16px; overflow-x: auto; }
.panel h3 { font-size: 13px; margin-bottom: 8px; color: var(--pine); }
table.dataTable { width: 100% !important; border-collapse: collapse; font-size: 12.5px; }
table.dataTable thead th { background: #eceadf; color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--line); padding: 7px 8px; white-space: nowrap; }
table.dataTable tbody td { padding: 6px 8px; border-bottom: 1px solid #eeece4; vertical-align: middle; }
table.dataTable tbody tr:hover { background: #faf9f3; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.inline-edit { cursor: pointer; }
td.inline-edit:hover { outline: 2px dashed var(--amber); outline-offset: -2px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.b-ok { background: #def3e6; color: var(--ok); } .b-warn { background: #fdf0d5; color: #9a6b00; }
.b-red { background: #fde3df; color: var(--red); } .b-mut { background: #ececec; color: #555; }
.b-blue { background: #dfeafd; color: var(--blue); }
.rowbtn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12px; margin-right: 3px; }
.rowbtn:hover { background: #f0efe8; }
.rowbtn.danger { color: var(--red); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.btn { border: none; border-radius: 7px; padding: 9px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.btn-p { background: var(--pine); color: #fff; } .btn-p:hover { background: var(--pine-2); }
.btn-a { background: var(--amber); color: #2c1f06; }
.btn-g { background: #e8e6dc; color: var(--ink); }
.btn-r { background: var(--red); color: #fff; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ---------- modal ---------- */
.m-ov { position: fixed; inset: 0; background: rgba(28,35,33,.55); display: none; align-items: flex-start; justify-content: center; z-index: 200; padding: 24px 12px; overflow: auto; }
.m-ov.show { display: flex; }
.m-box { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; }
.m-box .m-h { background: var(--pine); color: #fff; padding: 13px 16px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.m-box .m-h button { background: rgba(255,255,255,.18); border: none; color: #fff; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.m-box .m-b { padding: 16px; max-height: 72vh; overflow: auto; }
.m-box .m-f { padding: 12px 16px; border-top: 1px solid var(--line); text-align: right; background: #faf9f4; }
.fg { margin-bottom: 11px; }
.fg label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.fg input[type=text], .fg input[type=number], .fg input[type=date], .fg input[type=time], .fg input[type=datetime-local], .fg input[type=password], .fg select, .fg textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; background: #fff; }
.fg textarea { min-height: 64px; resize: vertical; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--pine-2); box-shadow: 0 0 0 3px rgba(42,107,80,.14); }
.fg .withplus { display: flex; gap: 6px; }
.fg .withplus select { flex: 1; }
.fg .plus { flex: 0 0 auto; width: 38px; border: 1px solid var(--line); border-radius: 7px; background: #eceadf; font-size: 17px; font-weight: 800; cursor: pointer; }
.fg .chk { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.fg .chk input { width: 18px; height: 18px; accent-color: var(--pine); }
.ckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.ckgrid label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; background: #f6f5ef; padding: 6px 8px; border-radius: 6px; cursor: pointer; }

/* ---------- lapangan ---------- */
.lp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.lp-btn { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 22px 12px; text-align: center; cursor: pointer; font-weight: 800; font-size: 15px; transition: .12s; }
.lp-btn:hover { border-color: var(--pine); transform: translateY(-2px); }
.lp-btn .em { font-size: 34px; display: block; margin-bottom: 8px; }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.eq-btn { border: none; border-radius: 12px; padding: 18px 12px; font-size: 14.5px; font-weight: 800; cursor: pointer; color: #fff; }
.eq-idle { background: var(--pine-2); }
.eq-dipakai { background: var(--amber); color: #2c1f06; }
.eq-maintenance { background: #8a8a8a; cursor: not-allowed; }
.eq-rusak { background: var(--red); cursor: not-allowed; }
.eq-btn small { display: block; font-weight: 600; font-size: 11.5px; margin-top: 5px; opacity: .9; }

/* ---------- denah ---------- */
.dn-wrap { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; }
.dn-stage { position: relative; border: 2px solid var(--ink); background: #fdfdfb; margin: 0 auto; }
.dn-box { position: absolute; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.dn-box .lb { font-size: 10px; font-weight: 800; color: var(--ink); background: rgba(255,255,255,.75); border-radius: 3px; padding: 0 4px; text-align: center; pointer-events: none; }
.dn-box.linked { box-shadow: 0 0 0 2px var(--amber) inset; }
.dn-pop { position: absolute; z-index: 90; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.2); padding: 11px 12px; min-width: 210px; max-width: 300px; font-size: 12.5px; }
.dn-pop h4 { font-size: 13px; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 10px; }
.dn-pop .x { background: #eee; border: none; border-radius: 5px; width: 22px; height: 22px; cursor: pointer; font-weight: 800; }
.dn-pop .kv { color: var(--mut); white-space: pre-line; user-select: text; }
.dn-pop .go { margin-top: 8px; display: inline-block; background: var(--pine); color: #fff; border-radius: 6px; padding: 6px 10px; text-decoration: none; font-weight: 700; font-size: 12px; }
.dn-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }

/* ---------- misc ---------- */
.section-note { background: #fbf7ea; border-left: 4px solid var(--amber); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 12.5px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 13px; z-index: 400; opacity: 0; transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; }
@media print { .topbar, .sidebar, .toolbar, .dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info, .rowbtn { display: none !important; } .content { padding: 0; } }

/* ===================== DENAH v2 (live dashboard + full editor) ===================== */
.dn-root { min-width: 0; }
.dn-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.dn-lay { display: flex; gap: 14px; align-items: flex-start; }
@media (max-width: 1000px) { .dn-lay { flex-direction: column; } .dn-panel { width: 100% !important; flex: none !important; } }
.dn-wrap2 { position: relative; flex: 1; overflow: auto; background: #ece9df; border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-height: 280px; }
.dn-canvas { display: inline-grid; grid-template-columns: auto auto auto; grid-template-rows: auto auto auto; }
.dn-cor { background: transparent; }
.dn-rul { position: relative; background: #f1efe6; color: #77796f; font-size: 9px; overflow: hidden; }
.dn-rt, .dn-rb { height: 17px; } .dn-rt { border-bottom: 1px solid var(--line); } .dn-rb { border-top: 1px solid var(--line); }
.dn-rl, .dn-rr { width: 30px; } .dn-rl { border-right: 1px solid var(--line); } .dn-rr { border-left: 1px solid var(--line); }
.dn-tick { position: absolute; white-space: nowrap; }
.dn-rt .dn-tick, .dn-rb .dn-tick { top: 3px; padding-left: 2px; border-left: 1px solid #cfccc0; height: 11px; }
.dn-rl .dn-tick, .dn-rr .dn-tick { left: 2px; border-top: 1px solid #cfccc0; width: 26px; }
.dn-stg { position: relative; background: #fdfdfa; border: 2px solid var(--ink); }
.dn-box { position: absolute; box-sizing: border-box; border-radius: 4px; overflow: hidden; user-select: none; touch-action: none; }
.dn-box.sel { outline: 2px dashed var(--ink); outline-offset: 1px; }
.dn-box.bound { box-shadow: 0 0 0 2px rgba(217,154,43,.55) inset; }
.dn-lb { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: calc(100% - 6px); font-size: 10px; font-weight: 800; color: var(--ink); background: rgba(255,255,255,.78); padding: 0 4px; border-radius: 3px; text-align: center; pointer-events: none; line-height: 1.25; z-index: 3; }
.dn-lb small { display: block; font-weight: 600; opacity: .8; font-size: 9px; }
.dn-lb.corner { left: 3px; top: 2px; transform: none; text-align: left; }
.dn-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; transition: height .6s ease; z-index: 1; pointer-events: none; }
.dn-live-badge { position: absolute; right: 3px; bottom: 2px; z-index: 4; font-size: 9.5px; font-weight: 800; background: rgba(255,255,255,.9); border-radius: 4px; padding: 0 4px; pointer-events: none; max-width: calc(100% - 6px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn-box.dn-run { animation: dnrun 1.6s infinite; }
@keyframes dnrun { 0%,100% { box-shadow: 0 0 0 2px rgba(30,130,76,.9) inset, 0 0 0 0 rgba(30,130,76,.5); } 50% { box-shadow: 0 0 0 2px rgba(30,130,76,.9) inset, 0 0 0 7px rgba(30,130,76,0); } }
.dn-box.dn-st-dipakai { box-shadow: 0 0 0 2px var(--amber) inset; }
.dn-box.dn-st-maintenance { filter: grayscale(.7); }
.dn-box.dn-st-rusak { box-shadow: 0 0 0 2px var(--red) inset; }
.dn-lock { position: absolute; top: 1px; right: 2px; font-size: 10px; z-index: 4; pointer-events: none; }
.dn-rz { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; background: var(--ink); border: 2px solid #fff; border-radius: 4px 0 3px 0; cursor: nwse-resize; z-index: 5; touch-action: none; }
.dn-txt { position: absolute; font-weight: 800; white-space: nowrap; text-shadow: 0 1px 2px rgba(255,255,255,.85); padding: 1px 3px; user-select: none; touch-action: none; }
.dn-txt.sel { background: rgba(255,255,255,.65); border-radius: 3px; }
.dn-ah { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; cursor: grab; pointer-events: auto; touch-action: none; }
.dn-ctx { position: fixed; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(28,35,33,.2); z-index: 500; min-width: 200px; padding: 4px; display: none; }
.dn-ctx.show { display: block; }
.dn-ctx button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; background: none; text-align: left; cursor: pointer; font-size: 12.5px; border-radius: 5px; }
.dn-ctx button:hover { background: #f0efe8; }
.dn-ctx .sep { height: 1px; background: var(--line); margin: 4px 6px; }
.dn-panel { width: 360px; flex: 0 0 360px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 640px; overflow: auto; }
.dn-ghead { display: flex; align-items: center; gap: 6px; background: #f0efe8; border-radius: 6px; padding: 6px 8px; margin: 8px 0 4px; font-weight: 800; font-size: 12px; cursor: pointer; user-select: none; }
.dn-ghead .cnt { color: var(--mut); font-weight: 600; }
.dn-ghead .car { display: inline-block; transition: transform .15s; }
.dn-ghead.closed .car { transform: rotate(-90deg); }
.dn-li { display: flex; align-items: center; gap: 5px; padding: 6px 4px; border-bottom: 1px solid #efede4; font-size: 12px; flex-wrap: wrap; }
.dn-li.sel { background: #f2f7f0; border-radius: 6px; }
.dn-li.dragging { opacity: .4; }
.dn-li.tgt { box-shadow: inset 0 3px 0 -1px var(--pine-2); }
.dn-li .drg { cursor: grab; color: #a3a094; font-size: 15px; user-select: none; }
.dn-li .drg:hover { color: var(--pine-2); }
.dn-li .ico { font-size: 12px; }
.dn-li input[type=color] { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.dn-li .nm { flex: 1; min-width: 90px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
.dn-li .wh { width: 52px; padding: 5px 4px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; text-align: center; }
.dn-li .ib { background: #eceadf; border: none; border-radius: 4px; padding: 4px 7px; cursor: pointer; font-size: 11.5px; }
.dn-li .ib.lk { background: #fde9bd; }
.dn-li .ib.on { background: #fde9bd; }
.dn-li .ib.rd { background: var(--red); color: #fff; }
.dn-inf { margin-top: 8px; font-size: 12px; color: var(--mut); }
@media print { .dn-tools, .dn-panel, .dn-rz, .dn-ah, .dn-ctx { display: none !important; } .dn-wrap2 { overflow: visible; background: #fff; border: none; } }
