﻿:root {
  --bg: #f3f2f1;
  --panel: #ffffff;
  --text: #201f1e;
  --muted: #605e5c;
  --border: #e1dfdd;
  --accent: #0078d4;
  --accent-strong: #005a9e;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-strong: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
  --bg: #11100f;
  --panel: #1b1a19;
  --text: #f3f2f1;
  --muted: #c8c6c4;
  --border: #323130;
  --accent: #2899f5;
  --accent-strong: #3aa0f3;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-strong: 0 8px 24px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

a { color: inherit; }

.app-shell {
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 0.55rem;
}

.app-shell.app-shell-admin {
  padding-top: 1.65rem;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 52px;
  height: auto;
  padding: 0 1.2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1 1 auto;
  min-width: 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  height: 32px;
}

.topbar-link {
  text-decoration: none;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0.25rem 0.7rem;
  line-height: 1;
  border-radius: 999px;
  position: relative;
}

.topbar-link.active {
  color: var(--text);
  font-weight: 600;
}

.topbar-link.active::after {
  content: "";
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.app-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1.2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.app-topbar .app-nav-bar {
  padding: 0;
  background: transparent;
  border-bottom: none;
  flex: 1 1 auto;
  min-width: 0;
}

.nav-extra {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 1 auto;
  justify-content: flex-start;
}

.nav-tabs {
  margin: 0;
}

.app-nav-bar .tabs {
  margin: 0;
  flex: 1 1 auto;
  justify-content: flex-start;
}

.client-menu { position: relative; }

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.fi {
  width: 16px;
  height: 16px;
  display: inline-block;
}

.client-menu-panel {
  position: absolute;
  top: 110%;
  left: 0;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  box-shadow: var(--shadow-strong);
  display: none;
  z-index: 20;
}

.client-menu-panel.open { display: block; }

.client-mini-list {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.client-mini-list a {
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.client-mini-list a:hover { background: rgba(0, 120, 212, 0.1); }

.client-search {
  position: relative;
  flex: 0 1 420px;
  max-width: 420px;
}

.client-search input {
  width: 100%;
  min-width: 180px;
  padding: 0.55rem 0.9rem 0.55rem 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.client-search input::placeholder { color: var(--muted); }

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
  display: none;
  z-index: 15;
  max-height: 280px;
  overflow-y: auto;
}

.search-dropdown.open { display: block; }

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.search-item:last-child { border-bottom: none; }

.page {
  padding: 1.2rem 1.6rem 2rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}


.page.page-schema {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 0.2rem;
  padding-bottom: 1.2rem;
}

.auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.6rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.auth { max-width: 520px; margin: 2rem auto; }

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 1.1rem; }

.client-header { display: flex; justify-content: space-between; align-items: center; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.65rem;
  margin: 0 0 0.4rem;
  color: var(--muted);
}

h1, h2 { margin: 0.2rem 0 0.6rem; }

.muted { color: var(--muted); }
.is-hidden { display: none !important; }

.form { display: grid; gap: 0.7rem; }
.form.compact { gap: 0.55rem; }
.form.inline { grid-template-columns: 1fr auto; align-items: end; }

.form label { font-weight: 600; }

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.input-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-group input {
  flex: 1;
}

.input-group .icon-button {
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
}

.interface-editor {
  display: grid;
  gap: 0.45rem;
}

.interface-row {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.interface-row .button {
  min-width: 32px;
  padding-inline: 0.55rem;
}

.icon-library {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.icon-preview {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  object-fit: contain;
}

.icon-upload {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.form textarea { resize: vertical; }
.form input[readonly],
.form textarea[readonly] {
  color: var(--muted);
}


.button,
button {
  border: none;
  border-radius: 7px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}

.button:disabled,
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.button.primary { background: var(--accent-strong); }
.button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.button.danger { background: #d13438; }
.button.success { background: #107c10; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  height: 32px;
  padding: 0.25rem 0.7rem;
  line-height: 1;
  border-radius: 999px;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
}

.grid.two > .card + .card,
.grid.two > .panel + .panel,
.grid.two > .card + .panel,
.grid.two > .panel + .card {
  margin-top: 0;
}

.tabs { display: flex; gap: 0.4rem; margin: 0.2rem 0 0.4rem; align-items: center; }
.tab { border: 1px solid var(--border); background: var(--panel); padding: 0.35rem 0.85rem; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.tab:not(.active) { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-action { margin-left: auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.settings-sidebar {
  height: fit-content;
  position: sticky;
  top: 0.4rem;
  align-self: start;
}

.settings-nav {
  display: grid;
  gap: 0.55rem;
}

.settings-tab-button {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-weight: 600;
  box-shadow: none;
}

.settings-tab-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.settings-main {
  min-width: 0;
}

.settings-main .grid.two {
  align-items: start;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-card-head {
  display: grid;
  gap: 0.1rem;
  margin-bottom: 0.7rem;
  min-height: 5.7rem;
}

.settings-card-head .eyebrow {
  margin: 0;
}

.settings-card-head h2 {
  margin: 0.1rem 0;
}

.settings-card-subtitle {
  margin: 0;
  line-height: 1.3;
}

.settings-card-subtitle-placeholder {
  visibility: hidden;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.settings-inline-grid {
  gap: 0.7rem;
}

.settings-collapse-item {
  padding: 0.8rem 0.95rem;
}

.settings-collapse-toggle {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  box-shadow: none;
}

.settings-collapse-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

.settings-collapse-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  transition: max-height 0.24s ease, opacity 0.18s ease, padding-top 0.18s ease;
}

.settings-collapse-item.is-expanded .settings-collapse-content {
  max-height: 2400px;
  opacity: 1;
  padding-top: 0.8rem;
}

.smtp-mode-block {
  display: grid;
  gap: 0.55rem;
}

.page.page-schema .tab-panel {
  flex: 1;
  min-height: 0;
}

.page.page-schema .tab-panel.active {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.page.page-schema #tab-services.active {
  display: block;
}

.page.page-schema #tab-schema.active {
  overflow: hidden;
}

.services-layout {
  display: grid;
  gap: 1rem;
}

.service-form-card {
  overflow: hidden;
}

.service-list-card {
  width: 100%;
  min-width: 0;
}

.service-url-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.service-url-button {
  padding: 0.3rem 0.6rem;
  line-height: 1.15;
  white-space: nowrap;
}

.service-url-button.icon-only {
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.service-url-text {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schema-context-menu {
  position: fixed;
  z-index: 1400;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 0.3rem;
  display: none;
}

.schema-context-menu.is-open {
  display: block;
}

.schema-context-menu-list {
  display: grid;
  gap: 0.2rem;
}

.schema-context-menu-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  box-shadow: none;
  padding: 0.45rem 0.55rem;
  font-weight: 600;
}

.schema-context-menu-item:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
}

.schema-context-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.schema-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(220px, 280px);
  gap: 1rem;
  height: 100%;
  min-height: 0;
  flex: 1;
}

.schema-layout:not(.editing) { grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); }
.schema-layout:not(.editing) .side-panel[data-panel="palette"] { display: none; }

.canvas-panel {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.schema-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.schema-arrow-btn {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}

.schema-search-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.schema-search-inline input {
  width: 280px;
  max-width: 42vw;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0 0.65rem;
}

.schema-search-inline input::placeholder {
  color: var(--muted);
}

.schema-search-inline .muted {
  min-width: 40px;
  text-align: center;
}

.toolbar-spacer {
  flex: 1;
}

.inline-form {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.inline-form input[type="file"] {
  max-width: 200px;
}

.canvas-scroll {
  width: 100%;
  flex: 1;
  height: auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.02);
}

.canvas-scroll.panning {
  cursor: grabbing;
}

.canvas {
  position: relative;
  width: 1600px;
  height: 1000px;
  transform-origin: top left;
  isolation: isolate;
}

.group-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.group-frame {
  position: absolute;
  border: 2px solid var(--group-border-color, var(--accent));
  border-radius: 4px;
  background: var(--group-bg-color, rgba(0, 120, 212, 0.08));
  pointer-events: none;
  overflow: visible;
  transition: border-color 0.12s ease;
}

.group-frame::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 6px;
  border: 1px solid rgba(var(--group-halo-rgb, 0, 120, 212), 0.56);
  box-shadow:
    0 0 10px rgba(var(--group-halo-rgb, 0, 120, 212), 0.38),
    0 0 18px rgba(var(--group-halo-rgb, 0, 120, 212), 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.group-frame.collapsed {
  border-style: dashed;
}

.group-frame.drop-target-halo {
  border-color: var(--group-border-color, var(--accent));
}

.group-frame.drop-target-halo::after {
  opacity: 1;
  animation: group-halo-pulse 1.25s ease-in-out infinite;
}

.group-frame.hidden-by-parent {
  display: none;
}

.group-frame-label {
  position: absolute;
  top: 6px;
  left: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--group-label-color, var(--accent));
  background: var(--panel);
  border: 1px solid var(--group-border-color, var(--border));
  border-radius: 999px;
  pointer-events: auto;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: calc(100% - 20px);
}

.group-frame-label.dragging {
  cursor: grabbing;
}

.group-frame-label.drop-target {
  border-color: var(--group-border-color, var(--accent));
  box-shadow:
    0 0 0 1px rgba(var(--group-halo-rgb, 0, 120, 212), 0.42),
    0 0 10px rgba(var(--group-halo-rgb, 0, 120, 212), 0.22);
}

@keyframes group-halo-pulse {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

.group-frame-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-frame-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.15rem;
}

.group-tool {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.group-tool:hover {
  border-color: var(--accent);
}

.group-tool.active {
  border-color: var(--accent);
  background: rgba(0, 120, 212, 0.14);
}

.group-frame-input {
  width: 140px;
  max-width: 220px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
}

.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: auto; z-index: 0; }
.link-labels { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 45; }

.link-label {
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.node {
  position: absolute;
  min-width: 150px;
  padding: 0 0.5rem 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow-strong);
  cursor: grab;
  display: grid;
  gap: 0.05rem;
  user-select: none;
  z-index: 2;
}

.node-icon { font-size: 1rem; line-height: 0; }
.node-service-badges {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
  z-index: 8;
}

.node-service-trigger,
.node-service-item {
  --svc-color: #52525b;
}

.node-service-trigger.service-kind-mail,
.node-service-item.service-kind-mail {
  --svc-color: #2563eb;
}

.node-service-trigger.service-kind-backup,
.node-service-item.service-kind-backup {
  --svc-color: #14b8a6;
}

.node-service-trigger.service-kind-database,
.node-service-item.service-kind-database {
  --svc-color: #f59e0b;
}

.node-service-trigger.service-kind-web,
.node-service-item.service-kind-web {
  --svc-color: #22c55e;
}

.node-service-trigger.service-kind-media,
.node-service-item.service-kind-media {
  --svc-color: #f97316;
}

.node-service-trigger.service-kind-vpn,
.node-service-item.service-kind-vpn {
  --svc-color: #7c3aed;
}

.node-service-trigger.service-kind-monitoring,
.node-service-item.service-kind-monitoring {
  --svc-color: #0ea5e9;
}

.node-service-trigger.service-kind-storage,
.node-service-item.service-kind-storage {
  --svc-color: #0891b2;
}

.node-service-trigger.service-kind-security,
.node-service-item.service-kind-security {
  --svc-color: #ef4444;
}

.node-service-trigger.service-kind-other,
.node-service-item.service-kind-other {
  --svc-color: #6b7280;
}

.node-service-trigger.service-kind-application,
.node-service-item.service-kind-application {
  --svc-color: #52525b;
}

.node-service-trigger {
  height: 22px;
  min-width: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(19, 22, 30, 0.98), rgba(30, 34, 42, 0.95));
  color: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  padding: 0 0.34rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.node-service-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

.node-service-trigger-icon {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: var(--svc-color);
}

.node-service-trigger-count {
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--svc-color);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.node-service-popover {
  position: absolute;
  top: 0;
  left: calc(100% + 10px);
  right: auto;
  min-width: 170px;
  max-width: 240px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(19, 22, 30, 0.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
  padding: 0.3rem;
  display: grid;
  gap: 0.22rem;
  opacity: 0;
  transform: translateX(-8px) scale(0.98);
  transform-origin: top left;
  pointer-events: none;
  overflow: hidden;
  max-height: 0;
  transition: opacity 0.18s ease, transform 0.18s ease, max-height 0.22s ease;
}

.node-service-badges.is-open .node-service-popover {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  max-height: 240px;
}

.node-service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.28rem;
  align-items: center;
}

.node-service-item {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: #f3f4f6;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.33rem 0.45rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.node-service-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.node-service-url {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.84rem;
  line-height: 1;
  padding: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.node-service-url:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.34);
}

.node-service-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--svc-color);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.node-service-item-name {
  font-size: 0.73rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node.dragging { cursor: grabbing; opacity: 0.85; }
.node.selected { outline: 2px solid var(--node-selection-color, var(--accent)); }
.node.link-from { outline: 2px dashed var(--accent-strong); }
.node.hidden-by-group { display: none; }
.node-meta,
.node-ip {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

.equip-icon { width: 18px; height: 18px; }
.node-icon img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
}

.palette { display: grid; gap: 0.5rem; }
.palette-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: transparent; cursor: grab; }
.palette-item:hover { background: rgba(0, 120, 212, 0.08); }
.icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }

.link-palette {
  display: grid;
  gap: 0.5rem;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
}

.link-item:hover {
  background: rgba(0, 120, 212, 0.08);
}

.link-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.link-sample {
  width: 32px;
  height: 8px;
  border-radius: 4px;
  background: currentColor;
  display: inline-block;
  position: relative;
}

.report-filters {
  margin: 0.6rem 0 0.9rem;
}

.report-filter-list {
  display: grid;
  grid-auto-rows: min-content;
  gap: 0.35rem;
}

.report-toolbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.6rem 0 0.9rem;
}

.report-toolbar-group {
  display: inline-flex;
  gap: 0.5rem;
}

.report-filter-button {
  padding: 0.35rem 0.65rem;
  font-size: 0.9rem;
  gap: 0.35rem;
}

.report-filter-button .caret {
  font-size: 0.7rem;
  opacity: 0.7;
}

.report-filter-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  max-width: 240px;
  max-height: 260px;
  overflow: auto;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  z-index: 15;
}

.report-filter-menu .checkbox-row {
  font-weight: 500;
  font-size: 0.88rem;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 0.65rem; text-align: left; }
.table code { white-space: pre-wrap; word-break: break-word; font-size: 0.76rem; }
.table tr.service-row-focus {
  background: rgba(0, 120, 212, 0.16);
}

.service-details-panel {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

.service-details-panel h4 {
  margin: 0.1rem 0 0.4rem;
  font-size: 1rem;
}

.service-details-panel.is-hidden {
  display: none;
}

.service-password-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.service-password-line .muted {
  margin: 0;
  min-width: 0;
  flex: 1;
}

.service-password-line .icon-button {
  padding: 0.32rem 0.5rem;
  flex: 0 0 auto;
}

.service-details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.service-details-actions .button {
  min-width: 0;
  flex: 1 1 auto;
  padding: 0.42rem 0.62rem;
  font-size: 0.82rem;
}

#service-details-back {
  flex: 1 1 100%;
}

.audit-details {
  min-width: 220px;
}

.audit-details summary {
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.timeline-list li {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.client-list {
  display: grid;
  gap: 0.6rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  background: var(--panel);
}

.client-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
  flex: 1;
}

.client-link-disabled {
  cursor: default;
}

.tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.client-actions {
  display: flex;
  gap: 0.4rem;
}

.client-actions .button {
  min-width: 90px;
  padding: 0.45rem 0.75rem;
  justify-content: center;
}

.flash-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.5rem; }
.flash {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}
.flash.flash-leaving {
  opacity: 0;
  transform: translateY(-4px);
}
.flash-success { background: rgba(16, 185, 129, 0.15); border-color: #10b981; }
.flash-warning { background: rgba(245, 158, 11, 0.2); border-color: #f59e0b; }
.flash-danger { background: rgba(239, 68, 68, 0.2); border-color: #ef4444; }
.flash-info { background: rgba(56, 189, 248, 0.2); border-color: #38bdf8; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 50;
}

.modal-overlay.is-hidden {
  display: none;
}

.modal-sheet {
  width: min(1100px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-strong);
  padding: 1.5rem;
  color: var(--text);
}

.modal-sheet.modal-narrow {
  width: min(520px, 92vw);
}

.confirm-overlay {
  z-index: 80;
}

.confirm-dialog {
  display: grid;
  gap: 0.9rem;
}

.confirm-message {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.minimap {
  position: relative;
  width: 100%;
  min-height: 160px;
  height: 170px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.minimap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.schema-nav-panel {
  margin-top: 0;
  display: grid;
  gap: 0.6rem;
}

.schema-nav-panel h3 {
  margin: 0 0 0.6rem;
}

.schema-nav-panel .minimap {
  width: 100%;
}

.details-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.details-stack .side-panel[data-panel="details"] {
  flex: 1;
  min-height: 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.page.page-schema #tab-services {
  overflow: auto;
}

.side-panel {
  overflow: auto;
  max-height: 100%;
}

.side-panel h3 {
  margin: 0 0 0.6rem;
}

@media (max-width: 1100px) {
  .schema-layout.editing {
    grid-template-columns: minmax(160px, 200px) minmax(0, 1fr) minmax(200px, 240px);
  }
  .schema-layout:not(.editing) { grid-template-columns: minmax(0, 1fr) minmax(200px, 240px); }
}

@media (max-width: 880px) {
  .app-nav-bar { flex-direction: column; align-items: stretch; }
  .client-search input { width: 100%; }
  .page { padding: 1.2rem; }
  .modal-overlay { padding: 1rem; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-sidebar { position: static; }
}
