:root {
  --bg: #f4f7f9;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #667789;
  --line: #d8e0e7;
  --primary: #126e72;
  --primary-dark: #0b5559;
  --danger: #b42318;
  --warn: #8a5a00;
  --ok: #177245;
  --shadow: 0 18px 45px rgba(22, 33, 43, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}
aside {
  background: #16242d;
  color: #fff;
  padding: 24px 16px;
}
.brand {
  font-weight: 800;
  font-size: 20px;
  margin-bottom: 22px;
}
.side-help {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  color: #b8c9d1;
  font-size: 14px;
  line-height: 1.5;
}
.side-nav {
  display: grid;
  gap: 8px;
}
.side-nav a {
  color: #d9e5ea;
  padding: 11px 12px;
  border-radius: 8px;
}
.side-nav a:hover {
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}
main {
  padding: 28px;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.topbar.compact { margin-bottom: 14px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; margin-bottom: 8px; }
h2 { font-size: 20px; margin-bottom: 16px; }
p { color: var(--muted); line-height: 1.6; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metrics div, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metrics div {
  padding: 18px;
}
.metrics strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  margin-bottom: 10px;
}
.metrics span { color: var(--muted); }
.panel {
  padding: 20px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}
th {
  color: #405362;
  font-size: 14px;
  background: #f7fafb;
}
td { font-size: 14px; }
.muted { color: var(--muted); }
.truncate {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}
.actions form, .topbar form { margin: 0; }

.button, button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}
.button:hover { text-decoration: none; }
.primary {
  background: var(--primary);
  color: #fff;
}
.primary:hover { background: var(--primary-dark); }
.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
.danger { color: var(--danger); }
.large {
  min-height: 48px;
  padding-inline: 22px;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.quick-form {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}
.quick-form label:nth-of-type(5) {
  max-width: 220px;
}
.quick-panel {
  border-top: 4px solid var(--primary);
}
label {
  display: grid;
  gap: 7px;
  color: #405362;
  font-size: 14px;
  font-weight: 700;
}
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
.span-2, .form-actions { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.flash {
  padding: 12px 14px;
  background: #e9f6f3;
  color: #0b5559;
  border: 1px solid #b8ddd6;
  border-radius: 8px;
  margin-bottom: 14px;
}
.status, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 800;
  background: #eef3f6;
  color: #405362;
}
.status.active { background: #e8f6ee; color: var(--ok); }
.status.paused { background: #fff4db; color: var(--warn); }
.status.risk, .status.offline { background: #feeceb; color: var(--danger); }

.jump-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(140deg, rgba(18, 110, 114, 0.12), rgba(32, 50, 58, 0.03)),
    var(--bg);
}
.jump-card {
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.jump-kicker {
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 10px;
}
.jump-copy {
  font-size: 17px;
}
.target-box {
  display: grid;
  gap: 12px;
  margin: 22px 0;
  padding: 18px;
  background: #f7fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.target-box div {
  display: grid;
  gap: 4px;
}
dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
dd {
  margin: 0;
  word-break: break-all;
  font-weight: 700;
}
.jump-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; padding: 18px; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
