/* ============================================================
   LSIT Admin Backend — extends styles.css tokens
   ============================================================ */

body.admin { overflow-x: hidden; }

/* ---------------- Operator gate ---------------- */
.gate {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(242,169,59,0.07), transparent 60%),
    var(--void);
}
.gate[hidden] { display: none; }
.gate-card {
  width: min(380px, 92vw);
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center;
  background: var(--panel);
  border: 1px solid var(--line-hi);
  border-radius: var(--r);
  padding: 40px 32px;
}
.gate-logo { height: 60px; width: auto; margin-bottom: 10px; filter: drop-shadow(0 0 10px rgba(45,120,230,0.3)); }
.side-brand .brand-logo { height: 34px; width: auto; display: block; }
.gate-card h1 { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 2px; }
.gate-card p { color: var(--haze); font-size: 13px; line-height: 1.5; }
.gate-card input {
  width: 100%;
  background: var(--void); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text);
  padding: 12px 14px; font-size: 14px; text-align: center;
  letter-spacing: 2px; font-family: var(--font-mono);
}
.gate-card input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(242,169,59,0.12); }
.gate-card .btn-add { width: 100%; justify-content: center; padding: 12px; }

/* ---------------- Shell ---------------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.side {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(16,21,31,0.6));
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.side-brand h1 { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: 3px; }
.side-brand p { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1.5px; color: var(--haze); text-transform: uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; border-radius: var(--r);
  color: var(--haze);
  padding: 11px 12px;
  font-family: var(--font-body); font-size: 14px; text-align: left;
  cursor: pointer; transition: all .15s;
}
.nav-item .ni { font-size: 15px; width: 18px; text-align: center; color: var(--line-hi); }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: rgba(242,169,59,0.1); color: var(--signal); }
.nav-item.active .ni { color: var(--signal); }
.nav-badge {
  margin-left: auto;
  background: var(--live); color: #fff;
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 7px; border-radius: 10px;
}
.nav-badge[hidden] { display: none; }

.side-back {
  color: var(--haze); text-decoration: none;
  font-family: var(--font-mono); font-size: 12px;
  padding: 10px 12px; border-top: 1px solid var(--line); margin-top: 8px;
  transition: color .15s;
}
.side-back:hover { color: var(--signal); }

/* ---------------- Content ---------------- */
.content { padding: 26px 30px 60px; min-width: 0; }
.view[hidden] { display: none; }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.view-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: 0.5px; margin-top: 4px; }
.view-head-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.summary-pills { display: flex; gap: 8px; }
.spill {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--line); border-radius: 20px;
  padding: 5px 12px; color: var(--haze);
}
.spill b { color: var(--text); font-weight: 600; }
.spill .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.up { background: var(--online); box-shadow: 0 0 6px var(--online); }
.dot.down { background: var(--live); box-shadow: 0 0 6px var(--live); }
.dot.warn { background: var(--signal); box-shadow: 0 0 6px var(--signal); }

/* type filter chips */
.type-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.chip {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--haze); border-radius: 20px;
  padding: 6px 13px; font-size: 12px; cursor: pointer;
  font-family: var(--font-mono); letter-spacing: 0.3px;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip.active { background: rgba(242,169,59,0.12); color: var(--signal); border-color: var(--signal-dim); }

/* ---------------- Monitor cards ---------------- */
.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.mon-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-hi);
  border-radius: var(--r);
  padding: 15px 16px;
  display: flex; flex-direction: column; gap: 12px;
  animation: tileIn .35s cubic-bezier(.2,.8,.2,1) both;
}
.mon-card.s-up { border-left-color: var(--online); }
.mon-card.s-down { border-left-color: var(--live); }
.mon-card.s-warn { border-left-color: var(--signal); }
.mon-card.s-unknown { border-left-color: var(--line-hi); }
.mon-card.disabled { opacity: 0.55; }

.mc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mc-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mc-name { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-type {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px;
  color: var(--haze); text-transform: uppercase;
}
.status-pill {
  flex-shrink: 0;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 1px; padding: 4px 9px; border-radius: 20px;
  border: 1px solid;
}
.status-pill.up { color: var(--online); border-color: rgba(79,209,165,0.4); background: rgba(79,209,165,0.08); }
.status-pill.down { color: var(--live); border-color: rgba(255,77,77,0.4); background: rgba(255,77,77,0.08); }
.status-pill.warn { color: var(--signal); border-color: var(--signal-dim); background: rgba(242,169,59,0.08); }
.status-pill.unknown { color: var(--haze); border-color: var(--line); }

.mc-value { display: flex; align-items: baseline; gap: 8px; }
.mc-num { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; color: var(--text); }
.mc-unit { font-family: var(--font-mono); font-size: 11px; color: var(--haze); }
.mc-msg { font-size: 12px; color: var(--haze); line-height: 1.4; min-height: 16px; }

.spark { height: 30px; width: 100%; display: block; }

.mc-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); padding-top: 10px;
}
.mc-time { font-family: var(--font-mono); font-size: 10px; color: var(--haze); }
.mc-actions { display: flex; gap: 5px; }
.iconbtn {
  background: transparent; border: 1px solid var(--line);
  color: var(--haze); width: 28px; height: 28px; border-radius: var(--r);
  cursor: pointer; font-size: 12px; transition: all .15s;
}
.iconbtn:hover { color: var(--text); border-color: var(--line-hi); }
.iconbtn.danger:hover { color: var(--live); border-color: var(--live); }

.empty-lite { color: var(--haze); font-size: 14px; padding: 40px 0; text-align: center; }

/* ---------------- Events ---------------- */
.events { display: flex; flex-direction: column; gap: 7px; }
.evt {
  display: grid; grid-template-columns: 92px 130px 1fr; gap: 14px; align-items: baseline;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--line-hi);
  border-radius: var(--r); padding: 10px 14px;
}
.evt.l-critical { border-left-color: var(--live); }
.evt.l-warn { border-left-color: var(--signal); }
.evt.l-ok { border-left-color: var(--online); }
.evt.l-info { border-left-color: var(--line-hi); }
.evt-level { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 1px; }
.l-critical .evt-level { color: var(--live); }
.l-warn .evt-level { color: var(--signal); }
.l-ok .evt-level { color: var(--online); }
.l-info .evt-level { color: var(--haze); }
.evt-time { font-family: var(--font-mono); font-size: 11px; color: var(--haze); }
.evt-msg { font-size: 13px; line-height: 1.4; }
.evt-msg b { font-weight: 600; }

/* ---------------- Live map ---------------- */
.map-hint { font-size: 11px; color: var(--haze); }
.map-stage {
  position: relative;
  height: calc(100vh - 170px);
  min-height: 420px;
  background:
    radial-gradient(1000px 600px at 30% 20%, rgba(79,209,165,0.05), transparent 60%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.map-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.25;
}
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: grab; user-select: none;
  z-index: 2;
}
.pin:active { cursor: grabbing; }
.pin-eye {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1.5px solid var(--signal);
  box-shadow: 0 0 0 4px rgba(242,169,59,0.08), 0 6px 18px rgba(0,0,0,0.5);
  color: var(--signal); font-size: 18px;
  transition: transform .15s;
}
.pin:hover .pin-eye { transform: scale(1.08); }
.pin.live .pin-eye { border-color: var(--online); color: var(--online); box-shadow: 0 0 0 4px rgba(79,209,165,0.1), 0 6px 18px rgba(0,0,0,0.5); }
.pin-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.5px;
  background: rgba(10,13,19,0.85); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 3px; white-space: nowrap;
  color: var(--text);
}
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--haze); font-size: 14px; text-align: center; padding: 20px; }

/* ---------------- Settings ---------------- */
.settings-card {
  max-width: 640px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 24px 26px;
  display: flex; flex-direction: column; gap: 16px;
}
.settings-card h3 {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  letter-spacing: 0.5px; color: var(--signal);
  padding-top: 8px; border-top: 1px solid var(--line);
}
.settings-card h3:first-child { border-top: 0; padding-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.short { max-width: 220px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--haze); font-size: 13px; cursor: pointer; }
.check.inline { align-self: center; }
.check input { width: 16px; height: 16px; accent-color: var(--signal); }
.settings-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* reused field styles (mirror styles.css drawer) */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.2px; color: var(--haze); text-transform: uppercase; }
.field input, .field select {
  background: var(--void); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); padding: 11px 13px; font-size: 14px; font-family: var(--font-body);
  transition: border-color .15s, box-shadow .15s;
}
.field select { appearance: none; cursor: pointer; }
.field input:focus, .field select:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(242,169,59,0.12); }
.field .hint { font-size: 10px; color: var(--haze); letter-spacing: 0.3px; text-transform: none; }

#typeFields { display: flex; flex-direction: column; gap: 16px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 8px; padding: 12px 14px;
  }
  .side-brand { padding: 0 8px 0 0; }
  .side-nav { flex-direction: row; flex: 1; flex-wrap: wrap; }
  .side-back { border-top: 0; margin: 0; }
  .content { padding: 18px 16px 50px; }
  .grid2 { grid-template-columns: 1fr; }
}
