:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-soft: #0a1525;
  --surface: #0d1929;
  --surface-2: #112137;
  --surface-3: #172b43;
  --surface-glass: rgba(13, 25, 41, 0.88);
  --text: #eef5fb;
  --text-soft: #c7d3df;
  --muted: #8192a7;
  --line: #20344c;
  --line-strong: #315170;
  --primary: #4d9df8;
  --primary-soft: rgba(77, 157, 248, 0.14);
  --accent: #5ad5c7;
  --success: #4eca8b;
  --warning: #f6b84b;
  --danger: #f06d7a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.23);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 260px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fa;
  --bg-soft: #edf2f7;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf2f7;
  --surface-glass: rgba(255, 255, 255, 0.91);
  --text: #142235;
  --text-soft: #34485f;
  --muted: #708196;
  --line: #dde5ed;
  --line-strong: #c4d0dc;
  --primary: #237bd8;
  --primary-soft: rgba(35, 123, 216, 0.11);
  --accent: #148f87;
  --success: #238a59;
  --warning: #a96b08;
  --danger: #c74555;
  --shadow: 0 18px 48px rgba(31, 55, 79, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 78% -10%, rgba(77, 157, 248, 0.11), transparent 31rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 65%, transparent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(390px, 0.65fr);
  min-height: 100vh;
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  min-height: 650px;
  padding: clamp(40px, 8vw, 120px);
  background:
    linear-gradient(145deg, rgba(8, 20, 36, 0.88), rgba(10, 31, 52, 0.96)),
    var(--bg);
  isolation: isolate;
}

.login-visual::before,
.login-visual::after {
  position: absolute;
  z-index: -1;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  content: "";
  filter: blur(80px);
}

.login-visual::before {
  top: 8%;
  right: 10%;
  background: rgba(77, 157, 248, 0.26);
}

.login-visual::after {
  bottom: 4%;
  left: 8%;
  background: rgba(90, 213, 199, 0.13);
}

.login-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 750;
}

.login-brand {
  position: absolute;
  top: 44px;
  left: clamp(40px, 8vw, 120px);
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(116, 186, 255, 0.4);
  border-radius: 12px;
  background: linear-gradient(145deg, #387fd4, #5cb4ff);
  box-shadow: 0 10px 24px rgba(39, 112, 192, 0.28);
  color: #fff;
  font-size: 17px;
  font-weight: 850;
}

.login-visual h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(54px, 7vw, 104px);
  font-weight: 720;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

.login-visual p {
  max-width: 520px;
  margin: 32px 0 0;
  color: #a9bdd0;
  font-size: clamp(16px, 2vw, 21px);
}

.orbit {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(105, 169, 229, 0.13);
  border-radius: 50%;
}

.orbit-a {
  top: -32%;
  right: -14%;
  width: 58vw;
  height: 58vw;
}

.orbit-b {
  top: -14%;
  right: 2%;
  width: 38vw;
  height: 38vw;
}

.login-card {
  align-self: center;
  width: min(420px, calc(100% - 48px));
  margin: auto;
  padding: 48px 42px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card h2 {
  margin: 10px 0 8px;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin: 0 0 30px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  padding: 9px 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.login-card label + label {
  margin-top: 16px;
}

.form-error {
  min-height: 21px;
  margin: 12px 0 !important;
  color: var(--danger);
  font-size: 12px;
}

.button,
.icon-button,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 680;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button.primary {
  border-color: color-mix(in srgb, var(--primary) 70%, transparent);
  background: var(--primary);
  color: white;
  box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 25%, transparent);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
}

.button.danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.drawer-backdrop {
  display: none;
}

.brand {
  min-height: 92px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy small,
.account small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.navigation {
  display: grid;
  gap: 5px;
  padding: 22px 14px;
}

.navigation a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

.navigation a:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.navigation a.active {
  border-color: color-mix(in srgb, var(--primary) 26%, var(--line));
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-icon {
  display: inline-grid;
  width: 24px;
  place-items: center;
  font-size: 17px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 18px 14px;
  border-top: 1px solid var(--line);
}

.account {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.account-actions .icon-button {
  width: 36px;
  height: 36px;
}

.account > span:last-child {
  display: grid;
  min-width: 0;
}

.account strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 18px clamp(20px, 3.5vw, 50px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(17px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mobile-menu {
  display: none;
}

.page {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 28px clamp(20px, 3.5vw, 50px) 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-head h2 {
  margin: 0;
  font-size: 19px;
}

.page-head p {
  margin: 5px 0 0;
}

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

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

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

.grid.map-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 35px color-mix(in srgb, var(--bg) 35%, transparent);
}

.card.pad {
  padding: 20px;
}

.kpi {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 20px;
}

.kpi::after {
  position: absolute;
  right: -28px;
  bottom: -52px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary-soft);
  content: "";
}

.kpi .kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.kpi strong {
  display: block;
  margin-top: 12px;
  font-size: 32px;
  font-weight: 720;
  letter-spacing: -0.04em;
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.bar-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(115px, 1fr) minmax(100px, 2fr) 36px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.bar-value {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color, var(--primary));
}

.bar-count {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.table-card {
  overflow: hidden;
}

.table-toolbar,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.filters {
  flex-wrap: wrap;
  justify-content: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filters input,
.filters select {
  width: auto;
  min-width: 160px;
}

.filters .search {
  min-width: min(360px, 100%);
  flex: 1;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.user-cell {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 10px;
}

.user-cell > span:last-child {
  display: grid;
  gap: 1px;
}

.user-cell small {
  color: var(--muted);
}

.small-avatar {
  width: 32px;
  height: 32px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.role-superadmin {
  border-color: color-mix(in srgb, var(--warning) 38%, var(--line));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: var(--warning);
}

.role-admin {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line));
  background: var(--primary-soft);
  color: var(--primary);
}

.role-user {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--accent);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.role-card {
  padding: 18px;
}

.role-card h3 {
  margin: 18px 0 6px;
  font-size: 15px;
}

.role-card p {
  margin: 0;
  font-size: 12px;
}

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

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: var(--primary-soft);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: var(--text);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.chip,
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 650;
}

.chip::before,
.status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chip-color, var(--muted));
  content: "";
}

.chip input {
  width: 14px;
  min-height: 14px;
  margin: 0;
}

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

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

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

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.pagination > div {
  display: flex;
  gap: 6px;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.graph-card {
  position: relative;
  overflow: hidden;
  min-height: 680px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--surface);
  background-size: 36px 36px;
}

.graph-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  gap: 6px;
}

.graph-toolbar .icon-button {
  width: 34px;
  height: 34px;
  background: var(--surface-glass);
  font-size: 14px;
}

.graph-stage {
  width: 100%;
  height: 680px;
  cursor: grab;
  touch-action: none;
}

.graph-stage:active {
  cursor: grabbing;
}

.graph-edge {
  fill: none;
  stroke: color-mix(in srgb, var(--muted) 48%, transparent);
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
}

.graph-edge.with-objects {
  stroke: color-mix(in srgb, var(--primary) 62%, transparent);
  stroke-width: 1.8;
}

.graph-edge.bidirectional {
  stroke-dasharray: 5 4;
}

.graph-node {
  cursor: pointer;
}

.graph-node circle {
  stroke: color-mix(in srgb, var(--surface) 50%, #fff);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.graph-node:hover circle,
.graph-node.selected circle,
.graph-node:focus-visible circle {
  stroke: var(--text);
  stroke-width: 3;
}

.graph-node text {
  fill: var(--text);
  font-family: var(--font);
  font-size: 11px;
  paint-order: stroke;
  pointer-events: none;
  stroke: var(--surface);
  stroke-width: 3px;
  stroke-linejoin: round;
  text-anchor: middle;
}

.graph-layer-label {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-panel {
  position: sticky;
  top: 120px;
  align-self: start;
  min-height: 420px;
  padding: 20px;
}

.detail-panel h2 {
  margin: 8px 0 2px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.detail-panel .meta-grid {
  margin-top: 18px;
}

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

.meta {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.meta small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.meta strong {
  display: block;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
}

.flow-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.flow-lane {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(280px, 2fr) minmax(160px, 0.8fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.system-endpoint {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  background: var(--surface-2);
}

.system-endpoint strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
}

.system-endpoint small {
  margin-top: 4px;
  color: var(--muted);
}

.flow-composition {
  position: relative;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 16px 26px;
}

.flow-composition::before,
.flow-composition::after {
  position: absolute;
  top: 50%;
  width: 18px;
  border-top: 1px solid var(--primary);
  content: "";
}

.flow-composition::before {
  left: 0;
}

.flow-composition::after {
  right: 0;
}

.flow-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.object-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.object-card {
  max-width: 260px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--primary) 23%, var(--line));
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--text-soft);
  padding: 6px 9px;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-card.classified {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.object-empty {
  color: var(--warning);
  font-size: 11px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tabs button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 650;
}

.tabs button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.modal {
  width: min(880px, calc(100vw - 28px));
  max-height: min(880px, calc(100vh - 28px));
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(1, 7, 14, 0.72);
  backdrop-filter: blur(5px);
}

.modal-frame {
  display: grid;
  max-height: calc(100vh - 30px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal header,
.modal footer {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 18px 22px;
}

.modal header {
  border-bottom: 1px solid var(--line);
}

.modal footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.modal h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.modal-body {
  overflow: auto;
  padding: 22px;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 170px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
}

.checkbox-grid input {
  width: 15px;
  min-height: 15px;
  margin: 0;
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
}

.toast {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-glass);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--text-soft);
  font-size: 12px;
  backdrop-filter: blur(14px);
}

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

.skeleton {
  min-height: 100px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 45%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@media (max-width: 1180px) {
  :root { --sidebar: 230px; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.map-layout { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
  .flow-lane { grid-template-columns: 160px minmax(280px, 1fr) 160px; }
}

@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-card { padding: 38px 30px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    width: min(290px, 88vw);
    box-shadow: var(--shadow);
    transition: transform 180ms ease;
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    border: 0;
    background: rgba(2, 10, 20, 0.55);
    cursor: pointer;
  }
  .drawer-backdrop.open { display: block; }
  .mobile-menu { display: inline-flex; }
  .topbar { min-height: 78px; }
  .grid.two { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; }
  .flow-lane { grid-template-columns: 1fr; }
  .flow-composition::before,
  .flow-composition::after { display: none; }
  .system-endpoint:last-child { border-top: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .grid.kpis { grid-template-columns: 1fr; }
  .top-actions .button { display: none; }
  .page { padding: 20px 14px 44px; }
  .topbar { padding: 14px; }
  .filters input,
  .filters select { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .password-row { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .graph-card,
  .graph-stage { min-height: 560px; height: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
