:root {
  --bg: #aeb6bb;
  --panel: #e7eaec;
  --panel-2: #d9dee1;
  --line: #c6ccd0;
  --line-dark: #99a3aa;
  --title: #c7e0f3;
  --active: #dcedf9;
  --text: #081018;
  --muted: #4f5b63;
  --green: #008a5c;
  --red: #c92535;
  --blue: #0078d4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  background: var(--bg);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.desktop {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 210px;
  background: #eff2f4;
  border-right: 1px solid #8d989f;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: white;
  background: #176c95;
  border-radius: 4px;
  font-weight: 700;
}

.brand div {
  display: grid;
}

.brand span:last-child,
.topbar span,
.router-card small {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  height: 32px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: 4px;
}

.nav-item span {
  width: 24px;
  color: #176c95;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: white;
  border-color: var(--line);
}

.router-card {
  margin-top: auto;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  position: relative;
}

.router-card label {
  color: var(--muted);
}

.status-dot {
  position: absolute;
  right: 10px;
  top: 37px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
}

.workspace {
  position: relative;
  flex: 1;
  min-width: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
}

.topbar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 42px;
  padding: 6px 12px;
  background: rgba(232, 236, 238, 0.86);
  border-bottom: 1px solid #98a2a9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar > div:first-child {
  display: grid;
}

.topbar-actions {
  display: flex;
  gap: 6px;
}

.icon-button {
  width: 28px;
  height: 26px;
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  background: white;
  font-weight: 700;
}

.window {
  position: absolute;
  background: var(--panel);
  border: 1px solid #9ca8af;
  box-shadow: 0 8px 18px rgba(20, 27, 31, 0.28);
  min-width: 280px;
}

.window.large {
  width: 780px;
  height: 390px;
}

.window.editor {
  width: 640px;
  min-height: 590px;
  z-index: 5;
}

.window.small {
  width: 340px;
}

.window.terminal {
  width: 430px;
  background: #111b22;
  color: #d6f2df;
}

.window-title {
  height: 31px;
  padding: 0 8px;
  background: var(--title);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.window-title > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.window-icon {
  color: #176c95;
  font-weight: 800;
}

.window-controls {
  display: flex;
  gap: 2px;
}

.window-controls button {
  width: 24px;
  height: 22px;
  border: 0;
  background: transparent;
  font-weight: 700;
  color: #35424a;
}

.window-controls button:hover {
  background: rgba(255, 255, 255, 0.65);
}

.tabs {
  display: flex;
  gap: 1px;
  padding: 0 8px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.tabs button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  background: transparent;
  font-weight: 600;
}

.tabs button.active {
  background: white;
  border-color: var(--line);
}

.tabs.compact button {
  height: 27px;
}

.toolbar {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
}

.toolbar button {
  height: 24px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 3px;
}

.toolbar button:hover {
  border-color: var(--line-dark);
  background: white;
}

.toolbar-spacer {
  flex: 1;
}

.toolbar input {
  height: 24px;
  width: 150px;
  border: 1px solid var(--line-dark);
  border-radius: 3px;
  padding: 0 8px;
}

.table-wrap {
  height: 267px;
  overflow: auto;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  height: 28px;
  border-right: 1px solid #d1d7db;
  border-bottom: 1px solid #d7dde1;
  padding: 0 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

th {
  background: #e3e7ea;
  text-align: left;
  font-weight: 600;
}

tbody tr {
  cursor: default;
}

tbody tr.selected {
  background: #d9eefb;
}

tbody tr:hover {
  background: #edf7fc;
}

.check-col {
  width: 27px;
}

.iface-icon {
  color: var(--green);
  font-weight: 800;
}

.flag {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #edf2f4;
  color: #1d5a7a;
  font-weight: 700;
}

.disabled-row {
  color: #69757c;
}

.window-footer {
  height: 29px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eef1f3;
}

#rowCount {
  min-width: 30px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  background: white;
  border-radius: 4px;
  font-weight: 700;
}

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 150px;
  min-height: 482px;
}

.form-grid {
  padding: 12px 24px 10px 22px;
  display: grid;
  gap: 7px;
  align-content: start;
}

.form-grid label {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 8px;
}

.form-grid label > span {
  text-align: right;
  font-weight: 600;
}

.form-grid input,
.form-grid select {
  height: 22px;
  border: 1px solid #bfc8cd;
  border-radius: 5px;
  background: white;
  padding: 0 7px;
}

.form-grid input:disabled {
  background: #dfe4e7;
}

.checkbox-row input {
  width: 15px;
  justify-self: start;
}

.divider {
  margin-top: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.actions-panel {
  border-left: 1px solid var(--line);
  background: #e1e5e8;
  padding: 8px;
  display: grid;
  gap: 5px;
  align-content: start;
}

.actions-panel button {
  min-height: 24px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  white-space: normal;
}

.actions-panel button:hover {
  background: white;
  border-color: var(--line);
}

.actions-panel strong {
  margin-top: 6px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.dialog-footer {
  height: 33px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-top: 1px solid var(--line);
  background: #eef1f3;
}

.dialog-footer button {
  min-width: 64px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f8f9;
  font-weight: 700;
}

.dialog-footer .primary {
  background: white;
}

.dialog-footer button:disabled {
  color: #9da6ac;
}

.running {
  margin-right: auto;
  color: white;
  background: var(--green);
  border-radius: 3px;
  padding: 2px 6px;
  font-weight: 800;
  font-size: 11px;
}

.traffic-box {
  padding: 10px;
}

#trafficCanvas {
  width: 100%;
  height: 130px;
  background: white;
  border: 1px solid var(--line);
}

.traffic-stats {
  display: flex;
  justify-content: space-between;
  padding-top: 7px;
}

.terminal .window-title {
  background: #24323a;
  color: white;
}

.terminal .window-icon,
.terminal .window-controls button {
  color: #d6f2df;
}

.terminal pre {
  margin: 0;
  padding: 10px;
  height: 160px;
  overflow: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.terminal-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #2d3c45;
}

.terminal-input input {
  flex: 1;
  height: 24px;
  color: #d6f2df;
  background: #0d151a;
  border: 1px solid #3c4d57;
  border-radius: 3px;
  padding: 0 6px;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .desktop {
    min-width: 720px;
  }

  .sidebar {
    width: 170px;
  }
}
