*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-family-sans);
}

body {
  background: var(--color-background);
  color: var(--color-text);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

button,
input,
select {
  font-size: inherit;
}

button {
  color: inherit;
}

button,
input,
select {
  border-radius: var(--radius-control);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 1px solid var(--color-focus-ring);
  outline-offset: 1px;
}

::selection {
  background: var(--color-selection);
  color: var(--color-selection-text);
}

input,
select {
  width: 100%;
  height: var(--height-control-comfortable);
  padding: 0 var(--space-2);
  border: var(--border-control);
  background: var(--color-surface-inset);
  color: var(--color-text-strong);
  caret-color: var(--color-teal);
}

input:hover,
select:hover {
  border-color: var(--color-slate);
}

input:focus,
select:focus {
  border-color: var(--color-teal);
}

input:disabled,
select:disabled {
  background: var(--color-surface-subtle);
  color: var(--color-text-disabled);
}

select {
  padding-right: var(--space-5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

option {
  padding: 0 var(--space-2);
}

.button {
  min-height: var(--height-titlebar);
  padding: 0 var(--space-3);
  border: var(--border-control);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}

.button:hover {
  border-color: var(--color-slate);
  background: var(--color-surface-highlight);
}

.button:active {
  background: var(--color-surface-active);
}

.button:disabled {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-subtle);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.button--primary {
  border-color: var(--color-teal-pressed);
  background: var(--color-action-primary);
  color: var(--color-action-primary-text);
}

.button--primary:hover {
  border-color: var(--color-teal-pressed);
  background: var(--color-action-primary-hover);
}

.button--primary:active {
  background: var(--color-action-primary-pressed);
}

.button--secondary {
  background: var(--color-surface-subtle);
}

.button--danger {
  border-color: var(--color-danger);
  background: var(--color-surface-subtle);
  color: var(--color-danger);
}

.button--danger:hover {
  border-color: var(--color-danger);
  background: var(--color-danger-tint);
}

.button--compact {
  min-height: var(--height-control);
  padding: 0 var(--space-2);
  font-size: var(--font-size-label);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--height-control-compact);
  height: var(--height-control-compact);
  padding: 0;
  border: var(--border-control);
  border-radius: var(--radius-control);
  background: var(--color-surface-raised);
  color: var(--color-text);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--color-slate);
  background: var(--color-surface-highlight);
}

.icon-button:active {
  background: var(--color-surface-active);
}

.icon-button:disabled {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-subtle);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.icon-button svg {
  width: 14px;
  height: 14px;
}

.text-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-teal);
  font-size: var(--font-size-label);
  line-height: var(--line-height-label);
  cursor: pointer;
}

.text-action:hover {
  color: var(--color-text-strong);
  text-decoration: underline;
  text-underline-offset: var(--space-0-5);
}

.eyebrow {
  margin: 0;
  color: var(--color-teal);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
  line-height: var(--line-height-caption);
}

.metadata {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
}

.mono {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-mono);
  letter-spacing: var(--letter-spacing-mono);
  line-height: var(--line-height-mono);
}

.chrome-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  background: var(--color-chrome);
  color: var(--color-chrome-text);
  font-size: var(--font-size-caption);
  letter-spacing: var(--letter-spacing-label);
  user-select: none;
}

.chrome-bar--titlebar {
  justify-content: space-between;
  border-bottom: var(--border-chrome);
}

.chrome-bar--statusbar {
  border-top: var(--border-chrome);
}

.chrome-bar__fill {
  flex: 1;
}

.chrome-bar__separator {
  width: var(--width-rule);
  height: 12px;
  background: var(--color-chrome-divider);
}

.chrome-bar__item {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  white-space: nowrap;
}

.chrome-bar__item .status-dot,
.chrome-bar__item .chrome-icon-button {
  align-self: center;
}

.chrome-bar__item--strong {
  color: var(--color-chrome-text-strong);
  font-weight: var(--font-weight-semibold);
}

.chrome-bar__value {
  color: var(--color-chrome-text-strong);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-mono-small);
  letter-spacing: var(--letter-spacing-mono);
}

.chrome-link {
  color: var(--color-chrome-text);
  text-decoration: none;
}

.chrome-link:hover {
  color: var(--color-chrome-text-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chrome-link + .chrome-link {
  padding-left: var(--space-3);
  border-left: var(--width-rule) solid var(--color-chrome-divider);
}

.chrome-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--height-control);
  padding: 0 var(--space-2-5);
  border: 1px solid var(--color-chrome-divider);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-chrome-text);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-label);
  cursor: pointer;
}

.chrome-button:hover {
  border-color: var(--color-teal-hover);
  background: var(--color-chrome-wash);
  color: var(--color-chrome-text-strong);
}

.chrome-button:active {
  background: var(--color-chrome-wash-strong);
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-round);
  background: var(--color-connection-idle);
}

.status-dot--online {
  background: var(--color-connection-online);
}

.status-dot--degraded {
  background: var(--color-connection-degraded);
}

.status-dot--offline {
  background: var(--color-connection-offline);
}

.status-dot--brand {
  background: var(--color-teal);
}

.terminal-surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  background: var(--color-panel-background);
}

.terminal-surface__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
  background: var(--color-surface-raised);
}

.terminal-path {
  margin: 0 0 var(--space-1);
  color: var(--color-text-muted);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-mono-small);
  letter-spacing: var(--letter-spacing-metadata);
}

.terminal-surface h1 {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-title);
  line-height: var(--line-height-title);
}

.terminal-surface__state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.terminal-surface__clock {
  color: var(--color-text-secondary);
}

.refresh-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.refresh-control__stamp {
  min-width: 17ch;
}

.terminal-surface__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--width-inspector);
  gap: var(--space-2);
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: var(--space-2);
  background: var(--color-surface-sunken);
}

.terminal-surface__column,
.terminal-surface__rail {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-width: 0;
}

@media (max-width: 1080px) {
  .terminal-surface__body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .terminal-surface__header {
    flex-direction: column;
    gap: var(--space-2);
  }
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: var(--border-panel);
  background: var(--color-panel-background);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--height-table-header);
  padding: 0 var(--space-3);
  border-bottom: var(--border-subtle);
  background: var(--color-panel-header);
}

.panel__title {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
}

.panel__meta {
  color: var(--color-text-muted);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-mono-small);
  letter-spacing: var(--letter-spacing-mono);
}

.panel__body {
  min-width: 0;
  padding: var(--space-3);
}

.panel__body--flush {
  padding: 0;
}

.panel__body--scroll {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-label);
  line-height: var(--line-height-label);
  table-layout: fixed;
}

.data-table th,
.data-table td {
  overflow: hidden;
  padding: 0 var(--space-3);
  border-right: var(--border-grid);
  border-bottom: var(--border-grid);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table thead th {
  height: var(--height-table-header);
  border-bottom: var(--border-subtle);
  background: var(--color-table-header);
  color: var(--color-ink-soft);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
}

.data-table tbody tr {
  background: var(--color-table-row);
}

.data-table tbody tr:nth-child(even) {
  background: var(--color-table-row-alt);
}

.data-table tbody td {
  height: var(--height-table-row);
  color: var(--color-text);
}

.data-table tbody tr:hover {
  background: var(--color-table-row-hover);
}

.data-table tbody tr[aria-selected="true"] {
  background: var(--color-table-row-selected);
  color: var(--color-selection-text);
}

.data-table tbody tr[aria-selected="true"] td {
  color: var(--color-selection-text);
}

.data-table td.is-numeric,
.data-table th.is-numeric {
  text-align: right;
}

.data-table td.is-mono {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-mono);
  letter-spacing: var(--letter-spacing-mono);
}

.data-table td.is-strong {
  color: var(--color-text-strong);
  font-weight: var(--font-weight-semibold);
}

.data-table td.is-muted {
  color: var(--color-text-muted);
}

.data-table tr.is-unavailable td {
  color: var(--color-text-disabled);
}

.field-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.field-list__row {
  display: grid;
  grid-template-columns: minmax(88px, 180px) minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: center;
  min-height: var(--height-table-row);
  border-bottom: var(--border-grid);
}

.field-list__row:has(.icon-button) {
  padding: var(--space-1-5) 0;
}

.field-list__row:last-child {
  border-bottom: 0;
}

.field-list--compact .field-list__row {
  grid-template-columns: minmax(64px, 92px) minmax(0, 1fr);
}

.field-list__label {
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
}

.field-list__value {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-strong);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-mono);
  letter-spacing: var(--letter-spacing-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-grid:not([hidden]) {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.form-grid--inline {
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}

.form-field:not([hidden]) {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.form-field__label {
  color: var(--color-ink-soft);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-label);
}

.form-field__label--optional {
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-grid--inline .form-actions {
  align-self: end;
}

.form-empty:not([hidden]) {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
  text-align: center;
}

.form-empty__title {
  margin: 0;
  color: var(--color-text-strong);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
}

.form-empty__detail {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-label);
  line-height: var(--line-height-label);
}

.form-errors:not([hidden]) {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.form-errors .status-flag {
  color: var(--color-danger);
}

.form-errors .status-flag__mark {
  border-color: var(--color-danger);
  background: var(--color-danger-strong);
}

.notice:not([hidden]) {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--color-border);
  background: var(--color-surface-subtle);
}

.notice__mark {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-raised);
}

.notice__text {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-size-label);
  line-height: var(--line-height-label);
}

.notice--info {
  border-left-color: var(--color-info);
  background: var(--color-info-tint);
}

.notice--info .notice__mark {
  border-color: var(--color-info);
  background: var(--color-info-strong);
}

.notice--warning {
  border-left-color: var(--color-warning);
  background: var(--color-warning-tint);
}

.notice--warning .notice__mark {
  border-color: var(--color-warning);
  background: var(--color-warning-strong);
}

.status-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.status-flag__mark {
  flex: none;
  width: 7px;
  height: 7px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-raised);
}

.status-flag--active {
  color: var(--color-teal-deep);
}

.status-flag--active .status-flag__mark {
  border-color: var(--color-teal-pressed);
  background: var(--color-teal);
}

.status-flag--success {
  color: var(--color-success);
}

.status-flag--success .status-flag__mark {
  border-color: var(--color-success);
  background: var(--color-success-strong);
}

.status-flag--warning {
  color: var(--color-warning);
}

.status-flag--warning .status-flag__mark {
  border-color: var(--color-warning);
  background: var(--color-warning-strong);
}

.status-flag--danger {
  color: var(--color-danger);
}

.status-flag--danger .status-flag__mark {
  border-color: var(--color-danger);
  background: var(--color-danger-strong);
}

.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 var(--space-1-5);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-control);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.console {
  overflow: auto;
  background: var(--color-console-background);
  color: var(--color-console-text);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-mono);
  letter-spacing: var(--letter-spacing-mono);
  line-height: var(--line-height-mono);
}

.console__row {
  display: grid;
  grid-template-columns: 76px 84px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-bottom: var(--width-rule) solid var(--color-console-rule);
}

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

.console__time {
  color: var(--color-console-muted);
}

.console__channel {
  color: var(--color-console-prompt);
  font-weight: var(--font-weight-semibold);
}

.console__message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console__row--warning .console__channel {
  color: var(--color-warning);
}

.console__row--danger .console__channel {
  color: var(--color-danger);
}

.glyph {
  position: relative;
  flex: none;
  display: inline-block;
}

.glyph--window {
  width: 14px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 1px;
}

.glyph--window::before,
.glyph--window::after {
  position: absolute;
  left: 3px;
  width: 6px;
  height: 1px;
  background: currentColor;
  content: "";
}

.glyph--window::before {
  top: 3px;
}

.glyph--window::after {
  top: 7px;
}

.glyph--envelope {
  width: 14px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.9;
}

.glyph--envelope::after {
  position: absolute;
  right: 1px;
  bottom: -4px;
  width: 5px;
  height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
  transform: skewY(35deg);
}

.glyph--copy {
  width: 12px;
  height: 12px;
}

.glyph--copy::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 1px;
  content: "";
}

.glyph--copy::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 1px;
  background: var(--color-chrome);
  content: "";
}

.chrome-icon-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-chrome-text);
  cursor: pointer;
}

.chrome-icon-button:hover {
  color: var(--color-chrome-text-strong);
}

.glyph--chevron {
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.glyph--caret {
  width: 0;
  height: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4px solid currentColor;
}

.glyph--caret-open {
  transform: rotate(90deg);
}

.segmented {
  display: flex;
  align-items: stretch;
  gap: var(--space-4);
  min-height: var(--height-tab);
  padding: 0 var(--space-3);
  border: var(--border-panel);
  background: var(--color-surface-raised);
  overflow-x: auto;
}

.segmented__cluster {
  display: flex;
  align-items: stretch;
  gap: var(--space-0-5);
}

.segmented__label {
  display: inline-flex;
  align-items: center;
  padding-right: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
  white-space: nowrap;
}

.segmented__item {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-text-secondary);
  font-family: inherit;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

.segmented__item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-strong);
}

.segmented__item:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
}

.segmented__item[aria-selected="true"] {
  border-bottom-color: var(--color-teal);
  color: var(--color-teal-deep);
  font-weight: var(--font-weight-semibold);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: var(--border-width);
  border: var(--border-panel);
  background: var(--color-border-subtle);
}

.stat-tile {
  display: grid;
  align-content: start;
  gap: var(--space-1);
  padding: var(--space-2-5) var(--space-3);
  background: var(--color-panel-background);
}

.stat-tile__label {
  color: var(--color-text-muted);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
}

.stat-tile__value {
  color: var(--color-text-strong);
  font-size: var(--font-size-stat);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-stat);
  line-height: var(--line-height-stat);
}

.stat-tile__detail {
  color: var(--color-text-secondary);
  font-size: var(--font-size-caption);
  line-height: var(--line-height-caption);
}

.stat-tile--positive .stat-tile__value {
  color: var(--color-data-positive);
}

.stat-tile--negative .stat-tile__value {
  color: var(--color-data-negative);
}

.stat-tile--brand .stat-tile__value {
  color: var(--color-teal-deep);
}

.field-group {
  display: grid;
  gap: 0;
}

.field-group + .field-group {
  margin-top: var(--space-3);
}

.field-group__title {
  margin: 0 0 var(--space-1);
  padding-bottom: var(--space-1);
  border-bottom: var(--border-subtle);
  color: var(--color-ink-soft);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-metadata);
}
