/* PhoneInfoTrack — SunCore-inspired light command surface */
:root {
  --bg: #f8fcff;
  --bg-deep: #eef7ff;
  --ink: #001a4d;
  --ink-soft: #45597e;
  --muted: #6a7a99;
  --line: rgba(0, 26, 77, .10);
  --line-strong: rgba(0, 26, 77, .18);
  --panel: rgba(255, 255, 255, .76);
  --panel-strong: rgba(255, 255, 255, .92);
  --navy: #001a4d;
  --blue: #00417f;
  --violet: #8a6fe6;
  --teal: #00c2c2;
  --ok: #0b6a68;
  --warn: #8a5a00;
  --danger: #b42318;
  --shadow: 0 22px 70px rgba(0, 26, 77, .12);
  --shadow-soft: 0 10px 30px rgba(0, 26, 77, .08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Roboto", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 300;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 12% -8%, rgba(138, 111, 230, .22), transparent 34%),
    radial-gradient(circle at 88% 4%, rgba(0, 194, 194, .16), transparent 30%),
    radial-gradient(circle at 58% 112%, rgba(0, 65, 127, .16), transparent 46%),
    linear-gradient(180deg, #fbfdff 0%, #f6fbff 48%, #edf7ff 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .34;
  background-image: radial-gradient(rgba(0, 26, 77, .20) .55px, transparent .55px);
  background-size: 17px 17px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .65), transparent 62%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .65), transparent 62%);
}

::selection { background: rgba(138, 111, 230, .22); color: var(--ink); }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid transparent; background: transparent; color: var(--ink); }
button:disabled { cursor: default; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(0, 65, 127, .48);
  outline-offset: 2px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 26, 77, .16);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 26, 77, .28); background-clip: content-box; }

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------ topbar */
.topbar {
  height: 74px;
  flex: 0 0 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
  background: rgba(248, 252, 255, .74);
  border-bottom: 1px solid rgba(0, 26, 77, .08);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  user-select: none;
  position: relative;
  z-index: 1300;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}

.brand img {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  filter: drop-shadow(0 5px 12px rgba(0, 65, 127, .16));
}

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.25;
}
.brand-sub {
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}
.brand .addon-badge {
  margin-left: 6px;
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 10px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tb-btn {
  height: 38px;
  padding: 0 17px;
  border-radius: 999px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .54);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .15em;
  text-transform: uppercase;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.tb-btn svg { width: 15px; height: 15px; flex: 0 0 15px; }
.tb-btn:hover {
  background: #fff;
  border-color: rgba(0, 26, 77, .32);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 26, 77, .09);
}
.tb-btn.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 26, 77, .20);
}
.tb-btn.primary:hover { background: #062a6b; border-color: #062a6b; }
.tb-btn.icon { width: 38px; padding: 0; }
.tb-btn.icon svg { width: 16px; height: 16px; }

.conn {
  height: 32px;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ok);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 4px;
  padding: 0 12px;
  border: 1px solid rgba(0, 194, 194, .28);
  border-radius: 999px;
  background: rgba(0, 194, 194, .07);
  white-space: nowrap;
}
.conn.offline {
  color: var(--danger);
  border-color: rgba(180, 35, 24, .20);
  background: rgba(180, 35, 24, .06);
}
.conn .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(0, 194, 194, .12);
}
.conn.offline .dot { box-shadow: 0 0 0 4px rgba(180, 35, 24, .10); }

/* ------------------------------------------------------------------- shell */
.shell {
  flex: 1 1 auto;
  display: flex;
  gap: 16px;
  min-height: 0;
  padding: 16px 24px 20px;
}

.sidebar {
  width: 304px;
  flex: 0 0 304px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: var(--radius-xl);
  background: linear-gradient(165deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .58));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  user-select: none;
}

.sidebar-head { padding: 22px 22px 13px; }
.eyebrow {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .24em;
  line-height: 1.4;
  text-transform: uppercase;
}
.explorer-title {
  margin-top: 5px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -.035em;
  line-height: 1.15;
}

.tree {
  flex: 1;
  overflow: auto;
  padding: 2px 12px 12px;
}

.tree-empty {
  margin: 8px 4px;
  padding: 20px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  line-height: 1.7;
  font-size: 11.5px;
  background: rgba(255, 255, 255, .38);
}
.tree-empty b { color: var(--ink); font-weight: 500; }

.device-node { margin-bottom: 6px; border-radius: var(--radius-md); }

.device-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--ink-soft);
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.device-row:hover {
  background: rgba(255, 255, 255, .74);
  border-color: var(--line);
  color: var(--ink);
}
.device-node.selected > .device-row {
  background: linear-gradient(135deg, #001a4d 0%, #003a73 72%, #004f86 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(0, 26, 77, .22);
}

.chevron {
  width: 18px;
  height: 26px;
  padding: 0;
  flex: 0 0 18px;
  color: var(--muted);
  font-size: 10px;
  line-height: 26px;
  text-align: center;
}
.device-node.selected .chevron { color: rgba(255, 255, 255, .66); }

.device-row .status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-left: 1px;
  border-radius: 50%;
  background: #8a97b4;
  transition: background .18s ease, box-shadow .18s ease;
}
.device-row .status-dot.online {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 194, 194, .15);
}

.device-row .device-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 400;
}

.device-row .gear {
  width: 27px;
  height: 27px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: inherit;
  opacity: .45;
  transition: opacity .16s ease, background .16s ease;
}
.device-row .gear svg { width: 14px; height: 14px; }
.device-row:hover .gear, .device-node.selected .gear { opacity: .9; }
.device-row .gear:hover { background: rgba(255, 255, 255, .14); }
.device-node.selected .gear:hover { background: rgba(255, 255, 255, .14); }

.device-children {
  margin: 5px 0 8px 20px;
  padding: 3px 0 3px 10px;
  border-left: 1px solid var(--line);
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 33px;
  padding: 0 9px;
  border-radius: 10px;
  text-align: left;
  color: var(--ink-soft);
  font-size: 11.5px;
  transition: background .16s ease, color .16s ease;
}
.tree-item:hover { background: rgba(0, 26, 77, .055); color: var(--ink); }
.tree-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
}
.tree-icon svg { width: 14px; height: 14px; }
.tree-item .count {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 26, 77, .06);
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}
.tree-item.warn { color: var(--warn); }
.tree-item.warn .tree-icon { color: var(--warn); }

.sidebar-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sidebar-footer .link {
  padding: 0 0 2px;
  color: var(--ink);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(0, 26, 77, .28);
}
.sidebar-footer .link:hover { text-decoration: none; border-color: var(--ink); }

/* --------------------------------------------------------------- workspace */
.workspace {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: var(--radius-xl);
  background: #eaf4ff;
  box-shadow: var(--shadow);
}

#map {
  flex: 1;
  min-height: 0;
  background: #eaf4ff;
}

.empty-overlay {
  position: absolute;
  inset: 0;
  z-index: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 30px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 34%, rgba(138, 111, 230, .16), transparent 31%),
    radial-gradient(circle at 58% 48%, rgba(0, 194, 194, .12), transparent 40%),
    linear-gradient(180deg, rgba(248, 252, 255, .96), rgba(238, 247, 255, .94));
}
.empty-overlay::before,
.empty-overlay::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}
.empty-overlay::before {
  width: 420px;
  height: 420px;
  border: 1px solid rgba(0, 65, 127, .10);
  box-shadow: 0 0 0 56px rgba(0, 65, 127, .025), 0 0 0 112px rgba(0, 65, 127, .018);
}
.empty-overlay::after {
  width: 170px;
  height: 170px;
  background: radial-gradient(circle, rgba(0, 194, 194, .10), transparent 68%);
}
.empty-overlay > * { position: relative; z-index: 1; }

.empty-mark {
  width: 76px;
  height: 76px;
  margin-bottom: 6px;
  filter: drop-shadow(0 12px 26px rgba(0, 65, 127, .18));
}
.empty-overlay .eyebrow { color: var(--ink-soft); }
.empty-overlay h1 {
  margin: 0;
  max-width: 760px;
  color: var(--ink);
  font-size: clamp(38px, 5vw, 72px);
  font-weight: 200;
  letter-spacing: -.055em;
  line-height: .96;
  text-transform: uppercase;
}
.empty-overlay p {
  margin: 3px 0 16px;
  max-width: 490px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.8;
}
.empty-overlay button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .17em;
  text-transform: uppercase;
  box-shadow: 0 14px 34px rgba(0, 26, 77, .22);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.empty-overlay button svg { width: 14px; height: 14px; }
.empty-overlay button:hover {
  background: #062a6b;
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(0, 26, 77, .26);
}

.map-card {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1100;
  width: min(372px, calc(100% - 40px));
  padding: 21px;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 22px 58px rgba(0, 26, 77, .17);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}

.map-card .mc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.map-card .mc-name {
  color: var(--ink);
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -.035em;
  line-height: 1.15;
}
.map-card .mc-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .12em;
  line-height: 1.5;
  text-transform: uppercase;
}
.map-card .mc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 14px;
  margin: 19px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.map-card .mc-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.map-card .mc-value {
  margin-top: 5px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.45;
}
.map-card .mc-value a { color: var(--blue); border-bottom: 1px solid rgba(0, 65, 127, .2); }
.map-card .mc-value a:hover { text-decoration: none; border-color: var(--blue); }
.map-card .mc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-card .mc-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, .56);
  color: var(--ink);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .10em;
  text-transform: uppercase;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.map-card .mc-actions button svg { width: 13px; height: 13px; }
.map-card .mc-actions button:hover {
  background: #fff;
  border-color: rgba(0, 26, 77, .32);
  transform: translateY(-1px);
}
.map-card .mc-actions button.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.map-card .mc-actions button.primary:hover { background: #062a6b; border-color: #062a6b; }

.statusbar {
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 17px;
  border-top: 1px solid rgba(0, 26, 77, .08);
  background: rgba(248, 252, 255, .88);
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .10em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.statusbar .left { display: inline-flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; }
.statusbar .left::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 194, 194, .13);
}
.statusbar .right { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ modals */
#loginModal { z-index: 4000; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 16% 12%, rgba(138, 111, 230, .18), transparent 34%),
    radial-gradient(circle at 88% 20%, rgba(0, 194, 194, .14), transparent 30%),
    rgba(232, 243, 255, .68);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.modal {
  width: 580px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(248, 252, 255, .94));
  box-shadow: 0 42px 130px rgba(0, 26, 77, .24);
}
.modal.wide { width: 880px; }
.modal.narrow { width: 440px; }

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 25px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.modal-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 27px;
  font-weight: 300;
  letter-spacing: -.04em;
  line-height: 1.15;
}
.modal-head .modal-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .18em;
  line-height: 1.5;
  text-transform: uppercase;
}
.modal-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: rgba(0, 26, 77, .05);
  color: var(--ink-soft);
  font-size: 21px;
  font-weight: 300;
  line-height: 1;
  transition: background .16s ease, color .16s ease;
}
.modal-close:hover { background: rgba(0, 26, 77, .09); color: var(--ink); }

.modal-body { padding: 23px 28px; }
.modal-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 9px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.modal-foot .left { margin-right: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 17px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, .66);
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: background .17s ease, border-color .17s ease, transform .17s ease, box-shadow .17s ease;
}
.btn:hover {
  background: #fff;
  border-color: rgba(0, 26, 77, .30);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 26, 77, .08);
}
.btn.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 9px 24px rgba(0, 26, 77, .18);
}
.btn.primary:hover { background: #062a6b; border-color: #062a6b; }
.btn.danger {
  background: rgba(180, 35, 24, .055);
  border-color: rgba(180, 35, 24, .22);
  color: var(--danger);
}
.btn.danger:hover { background: rgba(180, 35, 24, .09); border-color: rgba(180, 35, 24, .34); }
.btn:disabled { opacity: .5; transform: none; box-shadow: none; }

.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.form-row .hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}
.form-row input[type=text],
.form-row input[type=password],
.form-row input[type=number],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .78);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 300;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: border-color .17s ease, box-shadow .17s ease, background .17s ease;
}
.form-row textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: rgba(0, 65, 127, .42);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(138, 111, 230, .11);
  outline: none;
}
.form-row input:disabled, .form-row select:disabled {
  color: var(--muted);
  background: rgba(238, 247, 255, .65);
  cursor: not-allowed;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 13px; }
.form-check input[type=checkbox] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 1px;
  accent-color: var(--blue);
}
.form-check label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 300;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
}
.form-check .hint { margin-top: 3px; font-size: 10px; }

.section-label {
  margin: 20px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.section-label:first-child,
.modal-body > .warning-box + .section-label { margin-top: 0; padding-top: 0; border-top: 0; }

.pair-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }

.qr-box {
  min-height: 278px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: inset 0 0 0 8px #f8fcff, var(--shadow-soft);
}
.qr-box img { display: block; width: 100%; max-width: 260px; height: auto; }
.qr-placeholder { max-width: 220px; color: var(--muted); font-size: 11.5px; line-height: 1.65; text-align: center; }

.pair-info .info-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11.5px;
}
.pair-info .info-line .k { color: var(--muted); }
.pair-info .info-line .v { color: var(--ink); text-align: right; word-break: break-all; }
.pair-info code, .token {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(238, 247, 255, .9);
  color: var(--blue);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  word-break: break-all;
}

.pair-status {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid rgba(11, 106, 104, .20);
  border-radius: var(--radius-md);
  background: rgba(0, 194, 194, .06);
  color: var(--ok);
  font-size: 11px;
  line-height: 1.6;
}
.pair-status.waiting {
  border-color: rgba(138, 90, 0, .20);
  background: rgba(255, 193, 7, .08);
  color: var(--warn);
}
.pair-status.error {
  border-color: rgba(180, 35, 24, .20);
  background: rgba(180, 35, 24, .06);
  color: var(--danger);
}

.code-big {
  margin: 5px 0 13px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(238, 247, 255, .7);
  color: var(--ink);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 5px;
  text-align: center;
}

.table-wrap {
  max-height: 54vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .6);
}
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(248, 252, 255, .97);
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
}
td { color: var(--ink-soft); }
tbody tr:hover { background: rgba(0, 65, 127, .035); }
tbody tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
td.muted, .muted { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.ok {
  border-color: rgba(0, 194, 194, .28);
  background: rgba(0, 194, 194, .08);
  color: var(--ok);
}
.badge.warn {
  border-color: rgba(138, 90, 0, .22);
  background: rgba(255, 193, 7, .09);
  color: var(--warn);
}
.badge.err {
  border-color: rgba(180, 35, 24, .22);
  background: rgba(180, 35, 24, .06);
  color: var(--danger);
}

.warning-box {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(138, 90, 0, .18);
  border-radius: var(--radius-md);
  background: rgba(255, 193, 7, .08);
  color: #7a4f00;
  font-size: 10.5px;
  line-height: 1.65;
}
.warning-box code { color: #5c3b00; background: rgba(255, 255, 255, .55); }

#toast {
  position: fixed;
  left: 50%;
  top: 90px;
  z-index: 5000;
  max-width: 80vw;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(0, 26, 77, .94);
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 26, 77, .28);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .04em;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-10px);
  transition: opacity .2s ease, transform .2s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { box-shadow: 0 18px 50px rgba(180, 35, 24, .24), inset 0 0 0 1px rgba(255, 128, 128, .24); }
#toast.success { box-shadow: 0 18px 50px rgba(0, 194, 194, .20), inset 0 0 0 1px rgba(0, 194, 194, .24); }

/* ------------------------------------------------------------------- maps */
.leaflet-container {
  font-family: inherit;
  background: #eaf4ff;
}
.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .92) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 30px rgba(0, 26, 77, .13) !important;
}
.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  border-bottom: 1px solid var(--line) !important;
  background: rgba(255, 255, 255, .9) !important;
  color: var(--ink) !important;
  font-size: 17px !important;
  transition: background .16s ease;
}
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }
.leaflet-control-zoom a:hover { background: #fff !important; }
.leaflet-control-attribution {
  padding: 3px 8px !important;
  border-radius: 8px 0 0 0;
  background: rgba(255, 255, 255, .78) !important;
  color: var(--muted) !important;
  font-size: 8.5px !important;
  backdrop-filter: blur(8px);
}
.leaflet-control-attribution a { color: var(--ink-soft) !important; }
.leaflet-popup-content-wrapper {
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 26, 77, .16);
  backdrop-filter: blur(12px);
}
.leaflet-popup-tip { background: rgba(255, 255, 255, .94); }
.leaflet-popup-content { font-family: inherit; font-size: 11px; }
.pit-pin {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  transform: rotate(-45deg);
  box-shadow: 0 5px 14px rgba(0, 26, 77, .35);
}
.pit-pin.selected {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 5px 18px rgba(0, 65, 127, .42), 0 0 0 4px rgba(0, 194, 194, .16);
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .sidebar { width: 270px; flex-basis: 270px; }
  .map-card { width: 330px; }
  .brand .addon-badge { display: none; }
}

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .shell { gap: 12px; padding: 12px 16px 16px; }
  .sidebar { width: 236px; flex-basis: 236px; }
  .sidebar-head { padding: 18px 16px 10px; }
  .explorer-title { font-size: 19px; }
  .tree { padding: 2px 8px 10px; }
  .sidebar-footer { padding: 12px 16px; }
  .map-card { width: 300px; }
  .form-grid { grid-template-columns: 1fr; }
  .conn { padding: 0 9px; }
  .conn #connText { display: none; }
}

@media (max-width: 720px) {
  html, body { overflow: hidden; }
  #app { height: 100vh; height: 100dvh; min-height: 0; }
  .topbar {
    height: auto;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
  }
  .toolbar-actions { width: 100%; }
  .tb-btn { flex: 1; }
  .conn { margin-left: 0; }
  .shell { flex-direction: column; padding: 12px; overflow: hidden; }
  .sidebar { width: 100%; flex: 0 0 auto; max-height: 38vh; }
  .workspace { flex: 1 1 0; min-height: 0; }
  .empty-overlay h1 { font-size: 38px; }
  .map-card {
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    max-height: calc(100% - 24px);
    overflow: auto;
  }
  .statusbar { height: auto; min-height: 36px; padding: 9px 14px; white-space: normal; }
  .statusbar .right { display: none; }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100vh - 24px); }
  .modal-head { padding: 20px 20px 15px; }
  .modal-body { padding: 19px 20px; }
  .modal-foot { padding: 13px 20px; flex-wrap: wrap; }
  .modal-head h2 { font-size: 23px; }
  .pair-layout { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .map-card .mc-name { font-size: 20px; }
}

@media (max-width: 460px) {
  .brand-name { font-size: 10.5px; }
  .tb-btn > span { display: none; }
  .tb-btn { gap: 0; padding: 0 12px; }
  .tb-btn.icon { flex: 0 0 38px; }
  .conn { flex: 1; justify-content: center; }
  .conn #connText { display: inline; }
  .empty-overlay { padding: 24px 18px; }
  .empty-overlay h1 { font-size: 32px; }
  .empty-overlay p { font-size: 12px; }
  .empty-mark { width: 58px; height: 58px; }
  .form-grid { grid-template-columns: 1fr; }
}
