:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --panel-alt: #f4f7fa;
  --line: #d9dee7;
  --line-strong: #b8c3d1;
  --text: #16202c;
  --muted: #64748b;
  --accent: #565f6b;
  --accent-strong: #3c434d;
  --sidebar: #20252c;
  --sidebar-panel: rgba(255, 255, 255, 0.08);
  --danger: #b14131;
  --warn: #b7791f;
  --ok: #1f8a5b;
  --unknown: #7b8794;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(86, 95, 107, 0.14), transparent 28%),
    linear-gradient(180deg, #f5f6f8, #e9edf1);
  color: var(--text);
}

.shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 24px 24px 0;
}

.hidden {
  display: none !important;
}

.auth-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.auth-stage {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(100%, 1040px);
  min-height: 640px;
  border: 1px solid #d8dce3;
  border-radius: 24px;
  background: linear-gradient(165deg, #ffffff, #f1f3f6 65%);
  box-shadow: 0 26px 68px rgba(35, 40, 52, 0.14);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.auth-panel {
  border-right: 1px solid #d8dce3;
  padding: 42px;
  background:
    radial-gradient(circle at 0% 0%, rgba(86, 95, 107, 0.18), transparent 42%),
    radial-gradient(circle at 85% 92%, rgba(148, 163, 184, 0.16), transparent 36%),
    linear-gradient(150deg, #fafbfd, #eff2f5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand-mark {
  margin-bottom: 10px;
}

.auth-brand-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  min-width: min(100%, 420px);
  border: 1px solid rgba(86, 95, 107, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.auth-brand-badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5d6672, #383f49);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
}

.auth-brand-placeholder strong,
.auth-brand-placeholder span {
  display: block;
}

.auth-brand-placeholder span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-panel h1 {
  margin: 0;
  font-size: 2rem;
}

.auth-panel p {
  margin: 0;
  color: #4d5561;
  max-width: 36ch;
}

.auth-card {
  padding: 42px;
  display: grid;
  align-content: center;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.65rem;
}

.auth-subtitle {
  margin: 8px 0 20px;
  color: #5f6773;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form .field span {
  font-size: 0.85rem;
  color: #4f5661;
}

.auth-form input {
  border: 1px solid #d6d9e1;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem;
  outline: none;
  background: #fff;
}

.auth-form input:focus {
  border-color: #707985;
  box-shadow: 0 0 0 3px rgba(86, 95, 107, 0.18);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
}

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

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

.form-grid {
  display: grid;
  gap: 16px;
}

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

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

input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: inherit;
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(86, 95, 107, 0.2);
  outline-offset: 1px;
}

.button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
}

.panel-ghost {
  background: #edf0f3;
  border: 1px solid var(--line);
  color: var(--text);
}

.button.danger {
  background: var(--danger);
}

.message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(86, 95, 107, 0.16);
  background: rgba(86, 95, 107, 0.08);
}

.message span {
  min-width: 0;
}

.message-close {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.message.error {
  border-color: rgba(177, 65, 49, 0.18);
  background: rgba(177, 65, 49, 0.08);
  color: var(--danger);
}

.app-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 48px);
  align-items: stretch;
}

.sidebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  padding: 18px 10px 18px 0;
  background: linear-gradient(180deg, #eceef2 0%, #e1e4ea 14%, #d0d4db 100%);
  border-right: 1px solid rgba(17, 24, 39, 0.12);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.36);
}

.sidebar-copy,
.identity-label {
  color: #596271;
}

.sidebar-brand {
  padding: 2px 8px 0 24px;
}

.sidebar-brand h2 {
  margin-bottom: 6px;
  font-size: 1.05rem;
  color: #3e4755;
}

.sidebar-eyebrow {
  margin-bottom: 8px;
  color: #6b7280;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  padding-left: 24px;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: #4b5563;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.45);
}

.nav-item.active {
  background: linear-gradient(135deg, #555e69, #3d454f);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: 44px;
  padding: 0 8px 0 24px;
  border-top: 1px solid rgba(17, 24, 39, 0.12);
  padding-top: 14px;
  flex: 0 0 auto;
}

.identity-chip {
  height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.28);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.identity-chip strong {
  display: block;
  margin-top: 2px;
  word-break: break-word;
  color: #3f4754;
  font-size: 0.92rem;
}

.sidebar-logout {
  min-height: 44px;
  width: 100%;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  background: #eef1f4 !important;
  color: #3e4755 !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 500;
}

.workspace {
  display: grid;
  gap: 18px;
  padding: 0 0 0 20px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 6px 4px 0;
}

.workspace-header h1 {
  margin-bottom: 8px;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-note {
  font-size: 0.88rem;
  color: var(--muted);
}

.view-stack {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 22px;
  background:
    linear-gradient(135deg, rgba(86, 95, 107, 0.12), rgba(60, 67, 77, 0.03)),
    #fff;
}

.hero-panel h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.traffic-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.traffic-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.traffic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.traffic-dot.green {
  background: var(--ok);
}

.traffic-dot.amber {
  background: var(--warn);
}

.traffic-dot.red {
  background: var(--danger);
}

.traffic-dot.gray {
  background: var(--unknown);
}

.hero-metrics,
.domain-grid,
.service-grid,
.insight-grid,
.system-status-list {
  display: grid;
  gap: 14px;
}

.hero-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.metric-card,
.domain-card,
.service-card,
.alert-item,
.log-file-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-alt);
}

.metric-card {
  padding: 16px;
}

.metric-card strong {
  display: block;
  font-size: 1.7rem;
  margin-bottom: 4px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.domain-card,
.service-card {
  padding: 18px;
}

.host-status-panel {
  background:
    linear-gradient(135deg, rgba(86, 95, 107, 0.08), rgba(60, 67, 77, 0.02)),
    #fff;
}

.host-status-header {
  align-items: center;
}

.host-status-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.host-status-controls {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.host-status-button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.host-toggle-button {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.host-refresh-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #edf0f3;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.system-status-list {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.system-status-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.system-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-alt);
}

.system-status-key {
  color: var(--muted);
}

.system-status-value {
  text-align: right;
}

.system-status-graph-slot {
  display: grid;
  gap: 12px;
}

.sparkline-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-alt);
  padding: 12px;
}

.sparkline-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sparkline {
  width: 100%;
  height: 72px;
}

.sparkline-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.domain-card-top,
.service-card-top,
.panel-header,
.toolbar,
.log-viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.subheading,
.service-card h3,
.domain-card h3 {
  margin-bottom: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-badge.healthy {
  background: rgba(31, 138, 91, 0.12);
  color: var(--ok);
  border-color: rgba(31, 138, 91, 0.16);
}

.status-badge.degraded {
  background: rgba(183, 121, 31, 0.12);
  color: var(--warn);
  border-color: rgba(183, 121, 31, 0.16);
}

.status-badge.critical {
  background: rgba(177, 65, 49, 0.12);
  color: var(--danger);
  border-color: rgba(177, 65, 49, 0.16);
}

.status-badge.unknown {
  background: rgba(123, 135, 148, 0.12);
  color: var(--unknown);
  border-color: rgba(123, 135, 148, 0.16);
}

.domain-stats,
.service-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.service-card p:last-child {
  margin-bottom: 0;
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-item {
  padding: 14px;
}

.alert-item.high {
  border-color: rgba(177, 65, 49, 0.22);
  background: rgba(177, 65, 49, 0.05);
}

.alert-item.medium {
  border-color: rgba(183, 121, 31, 0.22);
  background: rgba(183, 121, 31, 0.05);
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 10px;
}

.tab-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}

.tab-button {
  border: 1px solid #d5d8e0;
  border-radius: 999px;
  background: #f3f4f7;
  color: #2f343c;
  font-size: 0.88rem;
  padding: 8px 14px;
  cursor: pointer;
}

.tab-button.active {
  background: linear-gradient(135deg, #59616c, #3c434d);
  border-color: transparent;
  color: #f7f8fa;
}

.tabbed-pane-row {
  gap: 0;
  flex-wrap: nowrap;
  border-bottom: 1px solid #d5d8e0;
  align-items: flex-end;
}

.tabbed-pane-button {
  border-radius: 10px 10px 0 0;
  border: 1px solid #d5d8e0;
  border-bottom: 0;
  background: #e9edf1;
  margin-right: 6px;
  padding: 9px 16px;
  position: relative;
  top: 1px;
}

.tabbed-pane-button.active {
  background: linear-gradient(135deg, #59616c, #3c434d);
  color: #f7f8fa;
  border-color: #3c434d;
  z-index: 2;
}

.section-copy {
  margin-bottom: 12px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.role-chip {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f8fafb;
}

.role-chip input {
  width: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  background: #eef2f3;
  border-radius: 999px;
  margin-right: 6px;
  margin-bottom: 6px;
}

.log-panel {
  padding: 0;
  overflow: hidden;
}

.log-layout {
  display: block;
  min-height: 720px;
}

.compact {
  margin-bottom: 16px;
}

.log-viewer {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  padding: 20px;
}

.log-viewer-header {
  display: block;
}

.log-viewer-heading {
  text-align: left;
  margin-top: 12px;
}

.log-viewer-heading h2 {
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 600;
}

.log-viewer-heading p {
  margin-bottom: 0;
}

.log-service-field {
  min-width: min(100%, 420px);
  align-items: start;
  justify-self: start;
}

.log-service-field select {
  width: 30%;
  min-width: 0;
}

.log-level-controls {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.log-level-field {
  min-width: min(100%, 240px);
  align-items: start;
  width: 20%;
}

.log-level-field select {
  width: 100%;
}

.log-level-detail {
  margin: 0;
}

.log-service-label {
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 700;
  text-align: left;
  line-height: 1.15;
}

.log-service-selected {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: left;
}

.log-content {
  display: block;
  margin: 0;
  padding: 18px;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  height: calc(50 * 1.55em + 36px) !important;
  max-height: calc(50 * 1.55em + 36px) !important;
  border-radius: 18px;
  border: 1px solid #1f2937;
  background: #111827;
  color: #e5edf8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre;
}

@media (max-width: 1180px) {
  .app-layout,
  .hero-panel,
  .log-viewer-header {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .domain-grid,
  .service-grid,
  .system-status-list,
  .system-status-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 14px;
  }

  .split,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .auth-card {
    padding: 26px;
  }

  .workspace-header,
  .panel-header,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .tabbed-pane-row {
    flex-wrap: wrap;
    border-bottom: none;
  }

  .tabbed-pane-button {
    border-bottom: 1px solid #d5d8e0;
    border-radius: 10px;
    top: 0;
    margin-bottom: 6px;
  }
}
