:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --ink: #17212f;
  --muted: #657386;
  --line: #d7dee6;
  --line-strong: #b9c4cf;
  --brand: #123d5a;
  --brand-2: #176b87;
  --accent: #2f7d5c;
  --warning: #946200;
  --danger: #a83f3f;
  --shadow: 0 1px 2px rgba(23, 33, 47, 0.06), 0 8px 24px rgba(23, 33, 47, 0.06);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 clamp(18px, 3vw, 34px);
  border-bottom: 1px solid #0d2d43;
  background: var(--brand);
  color: #fff;
}

.brand,
.topActions,
.panelHeader,
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brandMark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1px;
  font-size: 18px;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 800;
}

.topbar p {
  margin-bottom: 0;
  color: #c9d6df;
  font-size: 12px;
}

main {
  width: min(1440px, calc(100% - 28px));
  margin: 18px auto 36px;
}

.loginCard,
.panel,
.heroPanel,
.emptyState,
.overviewBar {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.loginCard {
  display: grid;
  gap: 18px;
  max-width: 430px;
  margin: 74px auto;
  padding: 26px;
}

.loginHeader {
  display: grid;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.overviewBar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span,
.sectionLabel {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  font-size: 22px;
  line-height: 1;
}

.sidebar {
  display: grid;
  gap: 16px;
}

.panel,
.heroPanel,
.emptyState {
  padding: 18px;
}

.emptyState {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.content {
  min-width: 0;
}

.panelHeader {
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar {
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tabButton {
  min-height: 38px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #516071;
  white-space: nowrap;
}

.tabButton:hover,
.tabButton.active {
  background: #edf2f5;
  color: var(--brand);
}

.tabButton.active {
  border-bottom-color: var(--brand-2);
}

.tabPanel {
  display: block;
}

.stack {
  display: grid;
  gap: 13px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(310px, 0.72fr);
  gap: 16px;
}

.formGrid,
.commandGrid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.formGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.commandGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: #4e5c6c;
  font-size: 12px;
  font-weight: 750;
}

.inline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

input:disabled {
  background: #eef2f5;
  color: #526274;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(23, 107, 135, 0.16);
  border-color: var(--brand-2);
}

textarea {
  min-height: 74px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}

.envBox {
  min-height: 118px;
}

button {
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 5px;
  padding: 8px 13px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: #0d3046;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.topbar button {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.topbar button:hover {
  background: rgba(255, 255, 255, 0.16);
}

button.ghost,
button.secondary,
.iconButton {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
}

button.ghost:hover,
button.secondary:hover,
.iconButton:hover {
  border-color: #8997a6;
  background: #f2f5f7;
}

button.danger {
  margin-left: auto;
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

button.danger:hover {
  background: #853030;
}

.smallButton {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}

.iconButton {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.muted,
.statusText,
.stepText {
  color: var(--muted);
}

.statusText {
  min-height: 20px;
  margin-bottom: 0;
  font-size: 12px;
}

.compact {
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}

.projectPanel {
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.projectList {
  display: grid;
  gap: 8px;
}

.projectItem {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}

.projectItem.active {
  border-color: #a8b5c1;
  border-left-color: var(--brand-2);
  box-shadow: inset 0 0 0 1px rgba(23, 107, 135, 0.08);
}

.projectMain {
  min-width: 0;
}

.projectMain strong,
.projectMain small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projectMain small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.heroPanel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-top: 3px solid var(--brand);
}

.heroPanel h2 {
  margin: 5px 0 6px;
  font-size: 24px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.statusBlock {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 190px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #c8d0d8;
  border-radius: 999px;
  padding: 3px 10px;
  background: #eef2f4;
  color: #4d5b69;
  font-size: 12px;
  font-weight: 850;
}

.pill.good {
  border-color: #bbd8ca;
  background: #e8f5ee;
  color: var(--accent);
}

.pill.bad {
  border-color: #e4c2c2;
  background: #f8ebeb;
  color: var(--danger);
}

.pill.busy {
  border-color: #ead59e;
  background: #fff7df;
  color: var(--warning);
}

.pill.stop {
  background: #edf1f4;
  color: #506070;
}

.warnings {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.warnings div {
  border: 1px solid #ead59e;
  border-left: 3px solid var(--warning);
  border-radius: 5px;
  padding: 10px 12px;
  background: #fff9e8;
  color: #654800;
  font-size: 13px;
}

.panelSubheader {
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #344456;
  font-size: 13px;
  font-weight: 850;
}

.summaryGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summaryItem {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
}

.summaryItem span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.summaryItem strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

pre {
  overflow: auto;
  border: 1px solid #2b3645;
  border-radius: 5px;
  padding: 14px;
  background: #111827;
  color: #d7e2ee;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.detectBox {
  max-height: 292px;
}

.logsPanel {
  margin-top: 16px;
}

.domainList,
.timeline,
.securityList {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.domainItem,
.timelineItem,
.securityItem {
  display: grid;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px;
  background: var(--surface-muted);
}

.domainItem {
  grid-template-columns: minmax(190px, 1fr) minmax(0, 1fr) auto;
}

.timelineItem {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.securityItem {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.domainItem strong,
.timelineItem strong,
.securityItem strong,
.domainItem small,
.timelineItem small,
.securityItem small {
  display: block;
}

.domainItem small,
.timelineItem small,
.securityItem small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.timelineItem p {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.terminal {
  min-height: 360px;
  max-height: 58vh;
  margin-bottom: 0;
  white-space: pre-wrap;
}

a {
  color: var(--brand-2);
  font-weight: 650;
}

@media (max-width: 1040px) {
  .workspace,
  .split {
    grid-template-columns: 1fr;
  }

  .projectPanel {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar,
  .heroPanel,
  .panelHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .overviewBar,
  .formGrid,
  .commandGrid,
  .summaryGrid {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .topActions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .domainItem,
  .securityItem {
    grid-template-columns: 1fr;
  }

  button.danger {
    margin-left: 0;
  }

  .statusBlock {
    justify-items: start;
  }
}
