:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #eef3fa;
  --line: #dbe3ee;
  --muted: #68778c;
  --text: #17202e;
  --blue: #2563eb;
  --blue-2: #16b4c4;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --violet: #6d5dfc;
  --rose: #e85d75;
  --mint: #10b981;
  --code: #0b1220;
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, transparent 34%),
    linear-gradient(225deg, rgba(16, 185, 129, 0.07) 0%, transparent 31%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 36rem);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 16px;
  padding: 4px 0 14px;
  border-bottom: 1px solid rgba(111, 125, 148, 0.18);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(37, 99, 235, 0.88)),
    #2563eb;
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.14);
}

.brand-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions,
.row-actions,
.tabs,
.os-tabs,
.model-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button,
.icon-button,
.tab,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  gap: 8px;
  border: 1px solid rgba(76, 93, 121, 0.34);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #ffffff, #eef3fb);
  color: var(--text);
  text-decoration: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98) inset,
    0 6px 16px rgba(28, 43, 70, 0.08);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.button {
  padding: 0 13px;
  font-weight: 650;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.button:hover,
.icon-button:hover,
.tab:hover,
.pill:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background:
    linear-gradient(180deg, #ffffff, #e8f0ff);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98) inset,
    0 10px 24px rgba(37, 99, 235, 0.13);
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button.primary,
.pill.active {
  border-color: rgba(29, 78, 216, 0.72);
  background:
    linear-gradient(135deg, #1d4ed8, #0f9f6e);
  color: white;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
}

.button.success {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.09);
  color: #15803d;
}

.button.danger {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.button.ghost {
  background: transparent;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 20px 0;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
}

.panel {
  border: 1px solid rgba(119, 134, 156, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), transparent 48px),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(27, 39, 65, 0.08);
  overflow: hidden;
}

.panel-body {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(119, 134, 156, 0.16);
  background: rgba(247, 249, 253, 0.76);
}

.connect-panel {
  border-color: rgba(119, 134, 156, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), transparent 120px),
    #eef3f8;
  color: var(--text);
  box-shadow: 0 18px 46px rgba(27, 39, 65, 0.11);
}

.connect-panel .panel-header {
  border-bottom-color: rgba(119, 134, 156, 0.18);
  background: rgba(248, 250, 252, 0.78);
}

.connect-panel .section-title {
  color: var(--text);
}

.connect-panel .select {
  border-color: rgba(119, 134, 156, 0.28);
  background: #ffffff;
  color: var(--text);
}

.connect-panel .select option {
  color: #111827;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 16px;
}

.section-title .badge {
  margin-left: 0;
}

.metric {
  min-height: 118px;
  padding: 18px;
  border: 1px solid rgba(119, 134, 156, 0.17);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), transparent),
    #ffffff;
  box-shadow: 0 14px 42px rgba(27, 39, 65, 0.07);
}

.metric.blue {
  border-color: rgba(37, 99, 235, 0.22);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), #ffffff 58%),
    #ffffff;
}

.metric.amber {
  border-color: rgba(217, 119, 6, 0.24);
  background:
    linear-gradient(135deg, rgba(217, 119, 6, 0.1), #ffffff 58%),
    #ffffff;
}

.metric.green {
  border-color: rgba(22, 163, 74, 0.24);
  background:
    linear-gradient(135deg, rgba(22, 163, 74, 0.1), #ffffff 58%),
    #ffffff;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 820;
  letter-spacing: 0;
}

.metric.blue .metric-value {
  color: var(--blue);
}

.metric.amber .metric-value {
  color: var(--amber);
}

.metric.green .metric-value {
  color: var(--green);
}

.metric-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.progress {
  height: 8px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, var(--green));
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), transparent),
    #ffffff;
  color: var(--text);
  outline: none;
}

.input,
.select {
  padding: 0 11px;
}

.textarea {
  min-height: 76px;
  padding: 10px 11px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    #05070c;
  color: #f8fafc;
  font-size: 13px;
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.18);
}

.status-line span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
}

.status-line code {
  margin-left: 4px;
  color: #ffffff;
}

.status-line .icon-button {
  min-height: 28px;
  width: 32px;
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  box-shadow: none;
}

.status-line .icon-button:hover {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.18);
}

.connect-panel .status-line {
  border-color: rgba(119, 134, 156, 0.2);
  background: rgba(255, 255, 255, 0.72);
  color: #34445c;
  box-shadow: 0 8px 18px rgba(28, 43, 70, 0.06);
}

.connect-panel .status-line span {
  border-color: rgba(119, 134, 156, 0.18);
  background: rgba(238, 243, 250, 0.9);
  color: #44546a;
}

.connect-panel .status-line code {
  color: #17202e;
}

.connect-panel .status-line .icon-button {
  border-color: rgba(119, 134, 156, 0.22);
  background: #ffffff;
  color: #17202e;
}

.connect-panel .status-line .icon-button:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background: #eef5ff;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  padding: 0 8px;
  border: 1px solid rgba(119, 134, 156, 0.22);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), transparent),
    var(--surface-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.badge.green {
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(22, 163, 74, 0.08);
  color: #15803d;
}

.badge.red {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.badge.amber {
  border-color: rgba(217, 119, 6, 0.24);
  background: rgba(217, 119, 6, 0.09);
  color: #b45309;
}

.chart {
  display: grid;
  align-items: end;
  grid-auto-flow: column;
  grid-auto-columns: minmax(22px, 1fr);
  height: 220px;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(119, 134, 156, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.03), transparent),
    #f8fafc;
}

.bar {
  display: grid;
  align-content: end;
  gap: 7px;
  height: 100%;
  min-width: 0;
}

.bar-fill {
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #60a5fa, var(--blue));
}

.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-switcher {
  display: grid;
  gap: 11px;
  margin-top: 14px;
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 9px;
}

.tool-tab {
  justify-content: flex-start;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
  border-color: rgba(76, 93, 121, 0.28);
  background:
    linear-gradient(180deg, #ffffff, #f0f5fc);
  box-shadow: 0 8px 20px rgba(28, 43, 70, 0.08);
}

.tool-tab.active {
  border-color: rgba(29, 78, 216, 0.58);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(16, 185, 129, 0.12)),
    #ffffff;
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.08),
    0 14px 30px rgba(37, 99, 235, 0.16);
}

.tab-mark {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 7px;
  background: #e8f0ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 850;
}

.tool-tab.active .tab-mark {
  border-color: rgba(29, 78, 216, 0.42);
  background: linear-gradient(135deg, #1d4ed8, #0f9f6e);
  color: white;
}

.connect-panel .tool-tab {
  border-color: rgba(76, 93, 121, 0.24);
  background:
    linear-gradient(180deg, #ffffff, #edf3fb);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(28, 43, 70, 0.07);
}

.connect-panel .tool-tab:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background:
    linear-gradient(180deg, #ffffff, #e7f0ff);
}

.connect-panel .tool-tab.active {
  border-color: rgba(29, 78, 216, 0.58);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(16, 185, 129, 0.12)),
    #ffffff;
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.08),
    0 12px 26px rgba(37, 99, 235, 0.13);
}

.connect-panel .tab-label {
  color: var(--text);
}

.connect-panel .tab-meta {
  color: var(--muted);
}

.connect-panel .tool-tab.active .tab-meta {
  color: #047857;
}

.tab-content {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tab-label,
.tab-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 820;
}

.tab-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.tool-tab.active .tab-meta {
  color: #047857;
}

.os-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(76, 93, 121, 0.24);
  border-radius: var(--radius);
  background: rgba(238, 243, 250, 0.88);
  box-shadow: 0 8px 18px rgba(28, 43, 70, 0.06) inset;
}

.os-tab {
  min-height: 30px;
  padding: 0 11px;
  border-color: rgba(76, 93, 121, 0.2);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: none;
  color: #34445c;
  font-size: 12px;
  font-weight: 800;
  opacity: 1;
}

.os-tab:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.1);
}

.os-tab.active {
  border-color: rgba(29, 78, 216, 0.68);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.connect-panel .os-tabs {
  border-color: rgba(76, 93, 121, 0.22);
  background: rgba(226, 232, 240, 0.82);
  box-shadow: 0 8px 18px rgba(28, 43, 70, 0.05) inset;
}

.connect-panel .os-tab {
  border-color: rgba(76, 93, 121, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: #34445c;
}

.connect-panel .os-tab:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background: #ffffff;
}

.connect-panel .os-tab.active {
  border-color: rgba(37, 99, 235, 0.7);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
}

.os-mark {
  color: inherit;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  font-weight: 850;
  opacity: 0.86;
}

.donut {
  display: grid;
  width: min(220px, 100%);
  aspect-ratio: 1;
  margin: 6px auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--blue) var(--donut, 0deg), #e6edf6 0);
}

.donut::after {
  content: "";
  display: block;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(119, 134, 156, 0.16);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #607089;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  background: rgba(247, 249, 253, 0.76);
}

td {
  font-size: 13px;
}

.mono,
code,
pre {
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

.codebox {
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.85);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.08), transparent 38px),
    var(--code);
  box-shadow: 0 18px 48px rgba(27, 39, 65, 0.14);
}

.codebox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #aebbd0;
  font-size: 12px;
}

.codebox-head .button {
  min-height: 30px;
  padding: 0 10px;
}

.codebox-title {
  color: #e5efff;
  font-weight: 800;
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  color: #bbf7d0;
  font-size: 13px;
  line-height: 1.55;
}

.pill,
.tab {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 750;
}

.pill {
  border-radius: 999px;
  border-color: rgba(76, 93, 121, 0.28);
  background: linear-gradient(180deg, #ffffff, #eef3fb);
}

.pill.active {
  color: white;
  border-color: rgba(29, 78, 216, 0.68);
  background: linear-gradient(135deg, #1d4ed8, #0f9f6e);
}

.layout-admin {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.side-nav {
  align-self: start;
  border: 1px solid rgba(119, 134, 156, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  padding: 8px;
}

.side-nav button {
  justify-content: flex-start;
  width: 100%;
  margin: 3px 0;
}

.login-box {
  width: min(420px, 100%);
  margin: 72px auto 0;
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 18px 60px rgba(27, 39, 65, 0.16);
}

.toast.show {
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
  }

  .grid.metrics,
  .grid.two,
  .form-grid,
  .layout-admin {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 14px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button {
    flex: 1 1 auto;
  }

  .metric-value {
    font-size: 25px;
  }

  .tool-tabs {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .os-tabs {
    width: fit-content;
  }

  .os-tab {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0 8px;
  }
}

@media (max-width: 520px) {
  .tool-tabs {
    grid-template-columns: 1fr;
  }

  .tool-tab {
    min-height: 52px;
  }

  .os-tabs {
    display: inline-flex;
    max-width: 100%;
  }

  .os-tab {
    justify-content: center;
  }

  .codebox-head {
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }

  .codebox-head .button {
    width: 100%;
  }
}
