:root{
  --bg:#f6f8fc;
  --panel:#ffffff;
  --panel2:#f3f6fb;
  --text:#0f172a;
  --muted:#475569;
  --border:#dbe3ef;
  --accent:#2563eb;

  --shadow: 0 10px 30px rgba(15,23,42,.08);
}

/* ===============================
   BASE
================================= */
*{ box-sizing:border-box; }

html,body{
  margin:0;
  padding:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background: linear-gradient(180deg, #fbfdff 0%, var(--bg) 55%, #eef3fb 100%);
}

a{ color:inherit; }

/* ===============================
   START PAGE LAYOUT
================================= */
.shell{
  max-width:1200px;
  margin:0 auto;
  padding:18px 14px 28px;
}

.hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--panel);
  box-shadow:var(--shadow);
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}

.brandMark{
  width:52px;
  height:52px;
  display:grid;
  place-items:center;
  border-radius:14px;
  font-weight:900;
  letter-spacing:1px;
  color:#fff;
  background:linear-gradient(135deg, #1d4ed8, #60a5fa);
  border:1px solid rgba(37,99,235,.25);
}

.brandTitle .t1{
  font-size:18px;
  font-weight:900;
}

.brandTitle .t2{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

.ghost{
  color:var(--muted);
  text-decoration:none;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
}

.ghost:hover{
  border-color:#c7d3e6;
}

.gridSingle{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
  margin-top:14px;
}

.card{
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--panel);
  padding:16px;
  box-shadow:var(--shadow);
}

.card h2{
  margin:0 0 6px;
  font-size:16px;
  font-weight:900;
}

.muted{ color:var(--muted); }
.small{ font-size:12px; }

/* ===============================
   FORM
================================= */
.form2{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.row2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.field label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin:0 0 6px;
  font-weight:700;
}

.field input,
.field select{
  width:100%;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  outline:none;
}

.field input::placeholder{
  color:#94a3b8;
}

.field input:focus,
.field select:focus,
.remarksInput:focus{
  border-color:rgba(37,99,235,.6);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

/* ===============================
   QTY BOX
================================= */
.qtyCard{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--panel2);
}

.qtyLabel{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

.qtyBig{
  font-size:22px;
  font-weight:950;
  color:var(--accent);
}

/* ===============================
   ACTIONS
================================= */
.actions2{
  display:flex;
  gap:10px;
  margin-top:4px;
}

.primary{
  flex:1;
  padding:14px 14px;
  border-radius:14px;
  border:1px solid rgba(37,99,235,.35);
  background:rgba(37,99,235,.12);
  color:var(--text);
  font-weight:950;
  cursor:pointer;
  transition:.12s;
}

.primary:hover{
  background:rgba(37,99,235,.18);
  transform:translateY(-1px);
}

.danger{
  display:grid;
  place-items:center;
  min-width:110px;
  border-radius:14px;
  border:1px solid rgba(220,38,38,.35);
  background:rgba(220,38,38,.10);
  color:var(--text);
  font-weight:950;
  text-decoration:none;
  transition:.12s;
}

.danger:hover{
  background:rgba(220,38,38,.14);
  transform:translateY(-1px);
}

/* ===============================
   SHARED BUTTON LOOK
================================= */
.btn{
  display:inline-block;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  text-decoration:none;
  color:var(--text);
  font-weight:900;
  cursor:pointer;
}

.btn:hover{
  border-color:#c7d3e6;
}

.btn:disabled{
  opacity:.5;
  cursor:not-allowed;
}

/* ===============================
   MAP PAGE TOP BAR
================================= */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  background:var(--panel);
  border-bottom:1px solid var(--border);
  box-shadow:0 6px 18px rgba(15,23,42,.06);
}

.header{
  font-weight:900;
  font-size:13px;
  color:var(--text);
  letter-spacing:.2px;
  min-width:0;
  flex:1;
  word-break:break-word;
}

.toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

/* ===============================
   MAP LAYOUT
================================= */
.mapwrap{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 300px;
  gap:12px;
  padding:12px;
  align-items:start;
}

.mapMain{
  min-width:0;
}

.remarksPanel{
  min-width:0;
  align-self:start;
}

/* ===============================
   SVG HOST
================================= */
.svghost{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
  height:calc(100vh - 170px);
  min-height:520px;
  overflow:hidden;
  display:grid;
  place-items:center;
  box-shadow:var(--shadow);
}

.bladeSvg{
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  display:block;
}

/* ===============================
   STATUS BUTTONS
================================= */
.statusbar{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.st{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel);
  font-weight:900;
  cursor:pointer;
}

.st:hover{
  border-color:#c7d3e6;
}

.st.active{
  border-color:rgba(37,99,235,.55);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

/* ===============================
   REMARKS SIDE PANEL
================================= */
.remarksCard{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  box-shadow:var(--shadow);
  position:sticky;
  top:12px;
}

.remarksCard h3{
  margin:0 0 10px;
  font-size:16px;
  font-weight:900;
}

.remarksInfo{
  font-weight:800;
  color:var(--text);
  margin-bottom:10px;
}

.remarksLabel{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin:0 0 6px;
  font-weight:700;
}

.remarksInput{
  width:100%;
  resize:vertical;
  min-height:160px;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  outline:none;
  font-family:inherit;
  font-size:14px;
}

.remarksActions{
  display:flex;
  gap:8px;
  margin-top:10px;
}

.remarksActions .btn{
  flex:1;
  text-align:center;
}

/* ===============================
   LEGEND
================================= */
.legend{
  margin:0 12px 12px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
  box-shadow:var(--shadow);
}

.legend .legrow{
  display:grid;
  grid-template-columns:18px 1fr 46px;
  gap:10px;
  padding:6px 0;
  align-items:start;
}

.legend .box{
  width:14px;
  height:14px;
  border:1px solid rgba(15,23,42,.35);
  border-radius:3px;
  display:inline-block;
  margin-top:2px;
}

.legend .labwrap{
  min-width:0;
}

.legend .lab{
  display:block;
  font-weight:800;
  color:var(--text);
  line-height:1.25;
}

.legend .idxlist{
  display:block;
  margin-top:3px;
  font-weight:700;
  color:#475569;
  line-height:1.25;
  word-break:break-word;
}

.legend .val{
  width:46px;
  text-align:right;
  font-weight:900;
  color:var(--text);
  white-space:nowrap;
}

/* ===============================
   REMARKS LIST UNDER MAP
================================= */
.remarksListWrap{
  padding:0 12px 12px;
}

.remarksListCard{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  box-shadow:var(--shadow);
}

.remarksListCard h3{
  margin:0 0 12px;
  font-size:16px;
  font-weight:900;
}

.remarksList{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.remarkRow{
  display:grid;
  grid-template-columns:40px 1fr;
  gap:8px;
  align-items:start;
  padding:4px 0;
  border-bottom:1px dashed #e2e8f0;
}

.remarkRow:last-child{
  border-bottom:none;
}

.remarkIdx{
  font-weight:900;
  color:var(--text);
}

.remarkText{
  white-space:pre-wrap;
  word-break:break-word;
  color:var(--muted);
}

/* ===============================
   PRINT HELPERS
================================= */
.remarksColumns{
  column-count:2;
  column-gap:40px;
  font-size:12px;
  line-height:1.15;
}

.remarkLine{
  break-inside:avoid;
  padding:1px 0;
}

.rnum{
  font-weight:800;
}

/* ===============================
   RESPONSIVE
================================= */
@media (max-width: 980px){
  .row2{
    grid-template-columns:1fr;
  }

  .hero{
    flex-direction:column;
    align-items:flex-start;
  }

  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }

  .toolbar{
    width:100%;
  }
}

@media (max-width: 900px){
  .mapwrap{
    grid-template-columns:1fr;
  }

  .remarksCard{
    position:static;
  }

  .svghost{
    height:auto;
    min-height:420px;
  }
}

@media (max-width: 640px){
  .actions2{
    flex-direction:column;
  }

  .remarksActions{
    flex-direction:column;
  }

  .legend .legrow{
    grid-template-columns:18px 1fr 38px;
  }

  .legend .val{
    width:38px;
  }

  .remarksColumns{
    column-count:1;
  }
}

.errorBox{
  margin:10px 0 14px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(220,38,38,.25);
  background:rgba(220,38,38,.08);
  color:#991b1b;
  font-weight:800;
}

.jobsTableWrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:14px;
}

.jobsTable{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

.jobsTable th,
.jobsTable td{
  padding:10px 12px;
  border-bottom:1px solid #e5e7eb;
  text-align:left;
  font-size:13px;
  vertical-align:top;
}

.jobsTable th{
  background:var(--panel2);
  font-weight:900;
  color:var(--text);
  white-space:nowrap;
}

.jobsTable td{
  color:var(--text);
}

.jobsTable tbody tr:hover{
  background:#f8fbff;
}

.tableOpenBtn{
  display:inline-block;
  padding:8px 12px;
  border-radius:10px;
  border:1px solid rgba(37,99,235,.35);
  background:rgba(37,99,235,.10);
  color:var(--text);
  text-decoration:none;
  font-weight:900;
  white-space:nowrap;
}

.tableOpenBtn:hover{
  background:rgba(37,99,235,.16);
}

@media (max-width: 900px){
  .jobsTable th,
  .jobsTable td{
    font-size:12px;
    padding:8px 10px;
  }
}