:root {
  color-scheme: light;
  --page: #edf7ff;
  --page-2: #f4f9ff;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --line: #e5edf7;
  --line-strong: #d7e4f4;
  --text: #17143f;
  --muted: #5f6f86;
  --muted-2: #8393a8;
  --blue: #0078d4;
  --blue-2: #0f9ee8;
  --purple: #7965f2;
  --violet: #8b7cf6;
  --pink: #eb2ef6;
  --cyan: #2bd5e8;
  --green: #13b981;
  --red: #ef4565;
  --shadow: 0 14px 36px rgba(50, 76, 130, .11);
  --shadow-soft: 0 8px 22px rgba(50, 76, 130, .08);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef8ff 0%, #eaf5ff 42%, #f6fbff 100%);
  color: var(--text);
  font-family: "Segoe UI", SegoeUI, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 14px;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
code { color: #1456b8; font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; }

.clarity-header {
  height: 58px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(17, 20, 63, .03);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
}

.brand-zone { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ms-mark { display: grid; grid-template-columns: repeat(2, 10px); grid-template-rows: repeat(2, 10px); gap: 2px; flex: 0 0 auto; }
.ms-mark i:nth-child(1) { background: #f35325; }
.ms-mark i:nth-child(2) { background: #81bc06; }
.ms-mark i:nth-child(3) { background: #05a6f0; }
.ms-mark i:nth-child(4) { background: #ffba08; }
.divider { width: 1px; height: 24px; background: #a7b4c4; opacity: .7; }
.brand-zone strong { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.project-name { margin-left: 18px; color: #1f284d; white-space: nowrap; }
.chevron { color: var(--muted); transform: translateY(-1px); }

.main-nav { display: flex; align-items: stretch; gap: 10px; height: 58px; }
.main-nav a {
  min-width: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #202744;
  text-decoration: none;
  font-size: 12px;
  border-bottom: 2px solid transparent;
}
.main-nav a span { font-size: 18px; line-height: 1; color: #0d1b38; }
.main-nav a.active { border-bottom-color: var(--text); font-weight: 600; }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.icon-btn, .avatar-btn, .plain-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: #182039;
  border-radius: 6px;
}
.icon-btn:hover, .avatar-btn:hover, .plain-icon:hover { background: #eef5ff; }
.avatar-btn { color: #1a2142; font-size: 14px; }

.sub-nav {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 34px;
  background: rgba(238, 247, 255, .9);
  border-bottom: 1px solid #dceaf8;
}
.sub-nav a {
  height: 42px;
  display: inline-flex;
  align-items: center;
  color: #1f2d4b;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
}
.sub-nav a.selected { border-bottom-color: #172048; font-weight: 600; }

.page { max-width: 1420px; margin: 0 auto; padding: 16px 24px 36px; }
.hero-strip { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 18px; }
.filters, .hero-actions, .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-primary, .chip, .link-action, .icon-text, .primary, .secondary {
  min-height: 36px;
  border-radius: 4px;
  border: 1px solid #afd8f5;
  background: #fff;
  color: #173052;
  padding: 0 14px;
  font-weight: 600;
}
.filter-primary {
  color: white;
  border-color: transparent;
  background: linear-gradient(90deg, #7768f0, #0087d5);
  box-shadow: 0 5px 14px rgba(60, 113, 220, .24);
}
.filter-primary span { margin-right: 7px; }
.chip.blue { background: #d9edff; border-color: #b7d8ef; }
.link-action { border-color: transparent; background: transparent; color: #263553; }
.icon-text { background: #fff; border-color: #d9e6f2; color: #283a57; }
.icon-text:hover, .chip:hover, .secondary:hover { border-color: #83c3ee; background: #f8fcff; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin: 0 0 30px;
}
.metric-card {
  min-height: 78px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 14px 22px 12px;
}
.metric-label { font-size: 13px; font-weight: 600; color: #253254; display: flex; align-items: center; gap: 6px; }
.info-dot { width: 15px; height: 15px; display: inline-grid; place-items: center; border-radius: 50%; background: #5d6575; color: #fff; font-size: 10px; font-style: normal; }
.metric-value { margin-top: 6px; font-size: 28px; line-height: 1; font-weight: 700; letter-spacing: -.04em; color: #13094f; }
.metric-value.compact { font-size: 22px; letter-spacing: -.02em; max-width: calc(100% - 26px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-note { margin-top: 6px; color: #160b4e; font-style: italic; font-size: 12px; }
.metric-icon { position: absolute; right: 18px; top: 34px; color: #3b4b63; font-size: 17px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(360px, 1fr) minmax(320px, .96fr);
  gap: 22px;
  align-items: start;
}
.dashboard-card {
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.card-title-row.slim { align-items: center; margin-bottom: 14px; }
h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; color: #1b2544; }
p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.soft-badge, .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3ff;
  color: #31519a;
  border: 1px solid #dbe5ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.count-badge { min-width: 34px; background: #f0f5ff; }

.settings-panel { margin-bottom: 20px; }
.settings-panel[hidden] { display: none; }
.settings-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.right { justify-content: flex-end; margin-top: 14px; }

.bot-form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #263553; font-size: 13px; font-weight: 650; }
small { color: var(--muted-2); font-size: 12px; line-height: 1.35; font-weight: 400; }
input, textarea {
  width: 100%;
  border: 1px solid #dce7f4;
  background: #fbfdff;
  color: var(--text);
  border-radius: 7px;
  padding: 10px 12px;
  outline: none;
  transition: box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
textarea { resize: vertical; min-height: 92px; }
input:focus, textarea:focus { border-color: #62b7ea; box-shadow: 0 0 0 3px rgba(0, 120, 212, .12); background: #fff; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cpu-field { max-width: 200px; }
.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(90deg, #7965f2, #0086d6);
  box-shadow: 0 7px 16px rgba(43, 91, 210, .24);
}
.secondary { background: #f6f9fd; border-color: #dbe7f3; }
.full { width: 100%; justify-content: center; }
.primary:hover { filter: brightness(1.03); }
button:disabled, input:disabled, textarea:disabled { opacity: .58; cursor: wait; }

.card-tabs { display: flex; align-items: stretch; margin: -20px -20px 18px; border-bottom: 1px solid var(--line); }
.tab {
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: #33425e;
  border-right: 1px solid var(--line);
}
.tab.active { background: #fff; font-weight: 650; color: #1d2849; box-shadow: inset 0 -2px 0 #fff; }
.tab-arrow { display: inline-grid; place-items: center; padding: 0 16px; color: #4d5d75; font-size: 22px; }
.mini-summary { display: grid; gap: 12px; margin-bottom: 16px; }
.summary-item {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  background: #fff;
}
.round-icon { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; background: #e8fbfb; color: #11a9ba; font-weight: 800; }
.summary-item.unique .round-icon { background: #f0edff; color: #7664e8; }
.summary-item strong { font-size: 28px; line-height: 1; color: #1a4770; letter-spacing: -.04em; }
.summary-item em { color: #35435b; font-style: normal; font-weight: 650; font-size: 13px; }
.progress-stack { height: 20px; border-radius: 4px; background: #7664e8; overflow: hidden; display: flex; margin-bottom: 18px; }
.progress-stack span { display: block; background: linear-gradient(90deg, #ee2bed, #f039e6); transition: width .25s ease; }
.progress-stack i { flex: 1; background: #7865e8; }

.containers { display: grid; gap: 12px; }
.container-card {
  border: 1px solid #e7eef7;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(34, 68, 120, .04);
}
.container-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.container-name { font-weight: 750; color: #1b2745; word-break: break-word; }
.meta { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.state { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 999px; background: #edf2fa; color: #52647c; }
.state.running { background: #e9fbf4; color: #07875f; }
.state.exited, .state.created, .state.dead { background: #fff0f3; color: #c82d4c; }
.actions { gap: 8px; }
.small {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid #d9e6f2;
  background: #f9fcff;
  color: #22324e;
  font-weight: 650;
}
.small:hover { background: #eef7ff; border-color: #a8d4f2; }
.danger { color: #b4233d; border-color: #f4c7d0; background: #fff6f8; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 9px 10px; border: 1px solid #edf2f7; background: #fafdff; border-radius: 8px; }
.stat span { display: block; color: #7a8ca3; font-size: 11px; }
.stat strong { display: block; margin-top: 3px; color: #21304b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.insight-list { display: grid; gap: 14px; }
.insight-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: 44px 1fr 22px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #edf2f8;
  border-radius: 9px;
  background: #fff;
}
.insight-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 18px; }
.insight-icon.violet { background: #f0edff; color: #7664e8; }
.insight-icon.blue { background: #eaf5ff; color: #0078d4; }
.insight-icon.cyan { background: #e8fbfb; color: #0aa7b9; }
.insight-icon.rose { background: #fff0fb; color: #d72fde; }
.insight-row strong { display: block; color: #1e4a70; font-size: 22px; line-height: 1.05; letter-spacing: -.03em; }
.insight-row small { display: block; margin-top: 4px; }
.insight-row b { color: #0078d4; font-size: 15px; }

.logs-card { grid-column: span 2; }
pre {
  margin: 0;
  min-height: 260px;
  max-height: 440px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0d1b2f;
  color: #d8f3ff;
  border-radius: 10px;
  border: 1px solid #172b49;
  padding: 16px;
  font: 12.5px/1.55 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.toast {
  margin: 0 0 18px;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.toast.ok { background: #edfdf7; border-color: #b7efdc; color: #087354; }
.toast.error { background: #fff3f5; border-color: #ffc7d2; color: #b4233d; }
.empty {
  color: #6c7d94;
  border: 1px dashed #cfdeef;
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  background: #fbfdff;
}

@media (max-width: 1180px) {
  .clarity-header { grid-template-columns: 1fr auto; }
  .main-nav { display: none; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .create-card { grid-column: span 2; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .clarity-header { height: auto; min-height: 58px; padding: 12px 16px; gap: 12px; }
  .brand-zone strong { font-size: 18px; }
  .project-name { display: none; }
  .sub-nav { overflow-x: auto; padding: 0 16px; gap: 20px; }
  .page { padding: 14px 12px 28px; }
  .hero-strip { align-items: flex-start; flex-direction: column; }
  .metrics-grid, .dashboard-grid, .two-col { grid-template-columns: 1fr; }
  .create-card, .logs-card { grid-column: auto; }
  .metric-card { padding: 14px 16px; }
  .summary-item { grid-template-columns: 42px auto; }
  .summary-item em { grid-column: 2; }
}
