@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/Manrope-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/IBMPlexMono-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #eef6ef;
  --surface: #ffffffd9;
  --surface-soft: #f4faf4;
  --line: #cfe1d0;
  --line-strong: #b8d0ba;
  --text: #203427;
  --muted: #55705c;
  --accent: #35a35a;
  --accent-strong: #2b8b4b;
  --danger: #cf5f74;
  --warning: #c59a45;
  --page-grad-1: #edf7ef;
  --page-grad-2: #f5fbf5;
  --page-grad-3: #e6f1e8;
  --toast-bg: #eff8ef;
  --toast-text: #214a2d;
  --toast-border: #b6d8be;
  --input-bg: #f6fbf7;
}

html[data-theme="dark"] {
  --bg: #101712;
  --surface: #16231acc;
  --surface-soft: #1b2a20ea;
  --line: #2d4734;
  --line-strong: #3a5f43;
  --text: #e9f5eb;
  --muted: #a9c8af;
  --accent: #58c47a;
  --accent-strong: #43a463;
  --danger: #ff7991;
  --warning: #e6b661;
  --page-grad-1: #0e1712;
  --page-grad-2: #122019;
  --page-grad-3: #0f1a14;
  --toast-bg: #1f3527;
  --toast-text: #d6f0db;
  --toast-border: #3f6b4b;
  --input-bg: #1b2d22;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 92% -10%, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 46%),
    radial-gradient(circle at -12% 95%, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 52%),
    linear-gradient(160deg, var(--page-grad-1) 0%, var(--page-grad-2) 55%, var(--page-grad-3) 100%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, #8cab9133 1px, transparent 1px),
    linear-gradient(to bottom, #8cab9133 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, #000 44%, transparent 100%);
  pointer-events: none;
}

.bg-blur {
  position: fixed;
  border-radius: 50%;
  filter: blur(64px);
  pointer-events: none;
}

.blur-a {
  width: 420px;
  height: 420px;
  right: -160px;
  top: -180px;
  background: #77d38f57;
}

.blur-b {
  width: 320px;
  height: 320px;
  left: -110px;
  bottom: -150px;
  background: #98d9a95c;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: calc(100vh - 20px);
}

.glass {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px #18274418;
}

.sidebar {
  margin: 10px;
  margin-right: 6px;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 10px;
  height: calc(100vh - 20px);
  overflow: auto;
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #f5fff7;
  background: linear-gradient(140deg, var(--accent), #6ac287);
}

.brand-logo svg {
  width: 22px;
  height: 22px;
}

.ui-icon {
  --icon-size: 18px;
  display: inline-grid;
  place-items: center;
  width: var(--icon-size);
  height: var(--icon-size);
  line-height: 1;
}

.ui-icon svg {
  width: 100%;
  height: 100%;
}

.brand-icon {
  --icon-size: 20px;
}

.menu-icon {
  --icon-size: 16px;
}

.ui-icon-missing {
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.68rem;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  color: color-mix(in srgb, var(--text) 72%, var(--muted) 28%);
  text-decoration: none;
  transition: 0.2s ease;
}

.menu-item svg {
  width: 100%;
  height: 100%;
}

.menu-item:hover,
.menu-item.active {
  color: var(--text);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface-soft) 75%, var(--accent) 25%);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.75rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-soft) 85%, var(--accent) 15%);
}

.chip.ok {
  color: #2a7a45;
  border-color: #93c6a0;
  animation: pulse-ok 1.7s ease-in-out infinite;
}

.chip.error {
  color: #9f3e3e;
  border-color: #d5a3a3;
  animation: pulse-bad 1.7s ease-in-out infinite;
}

.chip.loading {
  animation: pulse-warn 1.4s ease-in-out infinite;
}

.content {
  padding: 10px 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar h2 {
  margin: 0;
  font-size: 1.2rem;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.top-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 8px;
}

.top-stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-soft);
}

.top-stat span {
  color: var(--muted);
  font-size: 0.72rem;
}

.top-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  grid-auto-rows: 1fr;
}

.summary-grid > .card {
  min-height: 300px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.shell-card-body {
  display: grid;
  gap: 8px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--surface);
}

.card h3,
.card h4 {
  margin: 0 0 10px;
}

.metric-grid,
.status-grid,
.service-grid {
  margin-top: 10px;
}

.row {
  display: flex;
  gap: 8px;
}

.row.wrap {
  flex-wrap: wrap;
}

.row.center {
  align-items: center;
}

.actions-row {
  align-items: flex-start;
  justify-content: space-between;
}

.actions-row button,
.actions-row .inline-action {
  transform: translateY(-2px);
}

.row.between {
  justify-content: space-between;
}

button,
select,
.text-input {
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  padding: 8px 11px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.84rem;
  font-family: inherit;
}

button {
  cursor: pointer;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #a7c9ff 30%));
  color: color-mix(in srgb, var(--text) 10%, white 90%);
  font-weight: 700;
  border-color: #4ea66b;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 8px 18px #4ea66b25;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:active {
  transform: translateY(0);
}

.btn-secondary {
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: none;
}

.btn-warning {
  background: color-mix(in srgb, var(--warning) 26%, var(--surface-soft) 74%);
  color: color-mix(in srgb, var(--warning) 70%, var(--text) 30%);
  border-color: color-mix(in srgb, var(--warning) 45%, var(--line) 55%);
  box-shadow: none;
}

.btn-danger {
  background: color-mix(in srgb, var(--danger) 22%, var(--surface-soft) 78%);
  color: color-mix(in srgb, var(--danger) 72%, var(--text) 28%);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line) 55%);
  box-shadow: none;
}

.hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.inline-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

.inline-action:hover {
  background: color-mix(in srgb, var(--surface-soft) 68%, var(--accent) 32%);
}

.sidebar-user {
  font-size: 0.8rem;
  color: #3f5f4d;
  font-weight: 600;
  padding: 0 2px;
}

.zone-stats {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zone-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #cfe2d3;
  border-radius: 999px;
  background: #f6fbf6;
  font-size: 0.76rem;
  color: #2f4f3d;
}

.zone-stat svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zone-stat-icon {
  width: 13px;
  height: 13px;
  display: inline-block;
  object-fit: contain;
}

.zone-stat-dev {
  border-color: #9ec5ff;
  background: #eff6ff;
  color: #2d63a8;
}

.zone-stat-dev .zone-stat-icon {
  filter: invert(36%) sepia(58%) saturate(1218%) hue-rotate(186deg) brightness(95%) contrast(88%);
}

.zone-stat-sns {
  border-color: #9fe5b4;
  background: #ecfbf1;
  color: #2f8650;
}

.zone-stat-sns .zone-stat-icon {
  filter: invert(38%) sepia(74%) saturate(511%) hue-rotate(93deg) brightness(92%) contrast(89%);
}

.zone-stat-exe {
  border-color: #f6d190;
  background: #fff8ea;
  color: #8a6220;
}

.zone-stat-exe .zone-stat-icon {
  filter: invert(60%) sepia(64%) saturate(568%) hue-rotate(358deg) brightness(93%) contrast(89%);
}

.zone-stat-rul {
  border-color: #cfb6ef;
  background: #f7efff;
  color: #6e48a4;
}

.zone-stat-rul .zone-stat-icon {
  filter: invert(38%) sepia(42%) saturate(992%) hue-rotate(235deg) brightness(90%) contrast(89%);
}

.auth-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

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

.auth-field span {
  font-size: 0.8rem;
  color: #4a6657;
}

.status-tag {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--muted);
  background: #f1f9f2;
}

.status-tag.ok {
  border-color: #98c9a6;
  color: #2a7a45;
  animation: pulse-ok 1.7s ease-in-out infinite;
}

.status-tag.error {
  border-color: #d5a3a3;
  color: #9f3e3e;
  animation: pulse-bad 1.7s ease-in-out infinite;
}

.status-tag.loading {
  border-color: #d8c28f;
  color: #8a6a2f;
  animation: pulse-warn 1.4s ease-in-out infinite;
}

.code-editor {
  width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 10px;
  overflow: hidden;
  background: #fbfefb;
}

.code-editor-lg {
  height: 480px;
}

.ace_editor {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 13px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.file-list {
  display: grid;
  gap: 6px;
}

.file-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-soft);
  color: #466452;
  font-size: 0.82rem;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-soft);
}

.spacer-top {
  margin-top: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  color: #456453;
  font-weight: 600;
  background: #eaf5ec;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 85%, var(--surface-soft) 15%);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.table-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9db8a4;
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.table-status.ok {
  color: #2f7a49;
}

.table-status.ok::before {
  background: #4caf6b;
}

.table-status.warn {
  color: #8a6a2f;
}

.table-status.warn::before {
  background: #c8a15a;
}

.table-status.bad {
  color: #964343;
}

.table-status.bad::before {
  background: #c35a5a;
}

.service-actions {
  display: inline-flex;
  gap: 6px;
}

.service-actions button {
  padding: 6px 8px;
  font-size: 0.74rem;
  border-radius: 8px;
}

.build-info {
  display: grid;
  gap: 8px;
}

.build-info span {
  color: var(--muted);
  font-size: 0.75rem;
}

.build-info strong {
  display: block;
  margin-top: 2px;
}

.zone-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.zone-block,
.action-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-soft);
}

.zone-head,
.action-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.zone-title,
.action-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.telemetry-micro-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.telemetry-micro {
  border: 1px solid #d6e7d9;
  background: #f8fdf9;
  border-radius: 10px;
  padding: 9px 10px;
}

.telemetry-micro .k {
  display: block;
  max-width: 100%;
  font-size: 0.72rem;
  color: #537162;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-sensor-list {
  display: grid;
  gap: 4px;
}

.telemetry-sensor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.telemetry-sensor-name {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid #d0e3d4;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.76rem;
  color: #4f6e5e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #f3faf4;
}

.telemetry-sensor-value {
  font-size: 0.86rem;
  font-weight: 700;
  color: #1f4230;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-sensor-value .state-value-on {
  color: #2f7a49;
}

.telemetry-sensor-value .state-value-off {
  color: #a64a4a;
}

.telemetry-micro-empty {
  border-color: #e6c1c1;
  background: #fff6f6;
}

.telemetry-micro-empty .k {
  color: #a64a4a;
}

.telemetry-micro-empty .telemetry-sensor-name,
.telemetry-micro-empty .telemetry-sensor-value {
  color: #a64a4a;
}

.telemetry-micro-empty .telemetry-sensor-name {
  border-color: #e2bcbc;
  background: #fff1f1;
}

.telemetry-sensor-empty .telemetry-sensor-name {
  color: #9a7b2a;
  border-color: #e2c98c;
  background: #fff9eb;
}

.world-time-value {
  white-space: normal;
  line-height: 1.2;
}

.world-time {
  display: inline-grid;
  justify-items: end;
  gap: 1px;
}

.world-time .d,
.world-time .t {
  display: block;
  white-space: nowrap;
}

.device-list,
.action-list {
  display: grid;
  gap: 8px;
}

.device-card,
.action-card {
  border: 1px solid #d9e9dd;
  border-radius: 12px;
  padding: 8px 10px;
  background: #f8fdf8;
}

.device-card .row,
.action-card .row {
  justify-content: space-between;
}

.device-card strong,
.action-card strong {
  font-size: 0.82rem;
}

.state-ok {
  color: #2f7a49;
}

.state-warn {
  color: #8a6a2f;
}

.state-bad {
  color: #964343;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  border-radius: 16px;
  padding: 20px;
}

.login-card h1 {
  margin: 0;
  font-size: 1rem;
}

.login-brand {
  margin-bottom: 14px;
}

.actions-more-wrap {
  margin-top: 10px;
  text-align: center;
}

.link-action {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  color: #4f7160;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-action:hover {
  transform: none;
  filter: none;
  color: #2f4d3d;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-error {
  margin: 0 0 10px;
  color: #9f3e3e;
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  border-radius: 10px;
  border: 1px solid var(--toast-border);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 10px 12px;
  transform: translateY(15px);
  opacity: 0;
  transition: 0.2s ease;
  box-shadow: 0 10px 24px #43645121;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.ok {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line) 55%);
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line) 55%);
}

.theme-toggle {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
  color: var(--text);
  cursor: pointer;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes pulse-ok {
  0%, 100% { box-shadow: 0 0 0 0 #4caf6b22; }
  50% { box-shadow: 0 0 0 7px #4caf6b0f; }
}

@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 #c8a15a22; }
  50% { box-shadow: 0 0 0 7px #c8a15a10; }
}

@keyframes pulse-bad {
  0%, 100% { box-shadow: 0 0 0 0 #c35a5a22; }
  50% { box-shadow: 0 0 0 7px #c35a5a10; }
}

html[data-theme="dark"] .bg-grid {
  background-image:
    linear-gradient(to right, #5f749633 1px, transparent 1px),
    linear-gradient(to bottom, #5f749633 1px, transparent 1px);
}

html[data-theme="dark"] .brand-logo {
  color: #e8f8ec;
  background: linear-gradient(140deg, #2b8b4b, #47b86c);
}

html[data-theme="dark"] .menu-item {
  color: #c7dfcd;
}

html[data-theme="dark"] .sidebar-user {
  color: #c9dfcf;
}

html[data-theme="dark"] .zone-stat {
  background: color-mix(in srgb, var(--surface-soft) 76%, var(--accent) 24%);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .data-table th {
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--accent) 28%);
  color: #cde3d2;
}

html[data-theme="dark"] .table-status.ok {
  color: #7be0ae;
}

html[data-theme="dark"] .table-status.warn {
  color: #ffd07a;
}

html[data-theme="dark"] .table-status.bad {
  color: #ff99a8;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    margin-right: 12px;
    position: static;
    height: auto;
    overflow: visible;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .telemetry-micro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .telemetry-micro-grid {
    grid-template-columns: 1fr;
  }
}


/* Cloud bridge layer over core style */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn {
  border-radius: 10px;
  border: 1px solid #4ea66b;
  padding: 8px 11px;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #a7c9ff 30%));
  color: color-mix(in srgb, var(--text) 10%, white 90%);
  font-size: 0.84rem;
  font-family: inherit;
  font-weight: 700;
  box-shadow: 0 8px 18px #4ea66b25;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
.btn:active {
  transform: translateY(0);
}
.btn-primary { }
.btn.btn-primary { color: color-mix(in srgb, var(--text) 10%, white 90%); }
.btn.btn-secondary {
  background: color-mix(in srgb, var(--surface-soft) 78%, var(--accent) 22%);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: none;
}
.btn.btn-warning {
  background: color-mix(in srgb, var(--warning) 26%, var(--surface-soft) 74%);
  color: color-mix(in srgb, var(--warning) 70%, var(--text) 30%);
  border-color: color-mix(in srgb, var(--warning) 45%, var(--line) 55%);
  box-shadow: none;
}
.btn.btn-danger {
  background: color-mix(in srgb, var(--danger) 22%, var(--surface-soft) 78%);
  color: color-mix(in srgb, var(--danger) 72%, var(--text) 28%);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line) 55%);
  box-shadow: none;
}
.btn-success { background: color-mix(in srgb, var(--accent) 36%, var(--surface-soft) 64%); color: var(--text); border-color: var(--line-strong); box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.badge, .status-pill, .chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--surface-soft) 85%, var(--accent) 15%);
  color: var(--muted);
}
.badge-neutral { background: var(--surface-soft); }
.status-pill-ok { color: #2a7a45; border-color: #93c6a0; }
.status-pill-warn { color: #9d711f; border-color: #d9be83; }
.status-pill-bad { color: #9f3e3e; border-color: #d5a3a3; }
.text-area { width: 100%; min-height: 120px; resize: vertical; }
.form-grid, .controls-grid, .indicator-grid, .ring-grid, .charts-grid, .ui-showcase-grid { display: grid; gap: 12px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.controls-grid, .indicator-grid, .ring-grid, .charts-grid, .ui-showcase-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.progress-block { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-soft); }
.progress-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.progress-line { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--line) 75%, transparent); overflow: hidden; }
.progress-line-fill { height: 100%; border-radius: inherit; background: linear-gradient(140deg, var(--accent), #7fd498); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { position: relative; width: 40px; height: 22px; display: inline-flex; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; border-radius: 999px; background: color-mix(in srgb, var(--line) 85%, transparent); transition: .2s; }
.switch-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .switch-slider { background: color-mix(in srgb, var(--accent) 55%, var(--surface-soft) 45%); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.tabs-head { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs-panel { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-soft); }
.chart-card { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--surface-soft); }
.chart-canvas { width: 100%; height: 100% !important; display: block; }
.chart-fixed { position: relative; height: 220px; min-height: 220px; max-height: 220px; }
.metric-item { min-height: 54px; }

.health-item {
  margin-bottom: 6px;
}

.health-item:last-child {
  margin-bottom: 0;
}
.metric-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.metric-icon svg { width: 100%; height: 100%; }
.spacer-top { margin-top: 10px; }
@media (max-width: 1024px) { .form-grid { grid-template-columns: 1fr; } }
