:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --bg-accent: var(--bg);
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: #ffffff;
  --surface-muted: rgba(241, 245, 249, 0.95);
  --text: #0d1b2a;
  --text-soft: #64748b;
  --border: rgba(13, 27, 42, 0.12);
  --border-strong: rgba(200, 155, 94, 0.35);
  --primary: #c89b5e;
  --primary-soft: rgba(200, 155, 94, 0.14);
  --success: #047857;
  --success-soft: rgba(16, 185, 129, 0.16);
  --danger: #be123c;
  --danger-soft: rgba(244, 63, 94, 0.14);
  --warning-soft: rgba(245, 158, 11, 0.16);
  --shadow: 0 24px 60px rgba(13, 27, 42, 0.12);
  --shadow-soft: 0 10px 30px rgba(13, 27, 42, 0.08);
  --graph-grid: rgba(13, 27, 42, 0.08);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d1b2a;
  --bg-accent: var(--bg);
  --surface: rgba(27, 40, 56, 0.92);
  --surface-strong: #1b2838;
  --surface-muted: rgba(41, 55, 73, 0.9);
  --text: #e2e8f0;
  --text-soft: #94a3b8;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(200, 155, 94, 0.32);
  --primary: #d4a76a;
  --primary-soft: rgba(200, 155, 94, 0.16);
  --success: #34d399;
  --success-soft: rgba(16, 185, 129, 0.16);
  --danger: #fb7185;
  --danger-soft: rgba(244, 63, 94, 0.18);
  --warning-soft: rgba(245, 158, 11, 0.18);
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
  --shadow-soft: 0 10px 30px rgba(2, 6, 23, 0.35);
  --graph-grid: rgba(200, 155, 94, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-accent);
  color: var(--text);
}

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

textarea[name="xmlContent"] {
  min-height: 300px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  resize: vertical;
}

.card {
  border-radius: 12px;
}

.card .card-header:first-child {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.card .card-footer:last-child {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.45rem;
  background: var(--surface-muted);
}

#app {
  min-height: 100vh;
}

.loading-screen,
.auth-page,
.dashboard-page {
  min-height: 100vh;
}

.loading-screen {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.loading-card {
  width: min(520px, 100%);
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 2rem 0;
}

.cpc-topbar {
  min-height: 58px;
  background: linear-gradient(100deg, #0d1b2a 0%, #142d4a 60%, #1e3a8a 140%);
  border-bottom: 1px solid rgba(200, 155, 94, 0.35);
  color: #fff;
}

.cpc-topbar .navbar-nav .nav-link,
.cpc-topbar .navbar-text,
.cpc-topbar .text-body {
  color: #fff !important;
}

.cpc-topbar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.35);
}

.cpc-topbar .btn-outline-light:hover {
  background: rgba(200, 155, 94, 0.12);
  border-color: #c89b5e;
  color: #fff;
}

.dashboard-header--auth {
  padding-bottom: 1rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-brand__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--primary), #0d1b2a);
  color: white;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-soft);
}

.app-brand h1,
.panel h2,
.panel h3,
.modal h2,
.modal h3,
.flow-card h3,
.hero-panel h2 {
  margin: 0;
}

.app-brand p,
.panel p,
.modal p,
.hero-panel p,
.loading-card p,
.auth-card p,
.empty-state p,
.graph-empty p,
.flow-card__body,
.flow-card__subtitle {
  margin: 0;
  color: var(--text-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-actions--wrap {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill,
.eyebrow,
.stat-chip span,
.flow-card__type,
.flow-card__status {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: var(--primary-soft);
  color: var(--primary);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 440px);
  gap: 1.5rem;
  padding: 1.5rem 2rem 2rem;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(320px, var(--workspace-sidebar-width, 400px)) 14px minmax(0, 1fr);
  column-gap: 0.85rem;
  row-gap: 1.5rem;
  padding: 1rem 2rem 2rem;
  align-items: stretch;
}

.sidebar {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 1rem;
  min-width: 0;
  position: relative;
}

.admin-users {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.workspace-resizer {
  position: relative;
  border: 0;
  padding: 0;
  width: 100%;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}

.workspace-resizer::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--border-strong), var(--border));
  opacity: 0.9;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.workspace-resizer:hover::before,
.workspace-resizer:focus-visible::before {
  transform: translateX(-50%) scaleX(1.25);
  background: linear-gradient(180deg, var(--primary), var(--border-strong));
  box-shadow: 0 0 0 4px var(--primary-soft);
}

body.is-resizing-sidebar,
body.is-resizing-sidebar * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sidebar__toggle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar__toggle:hover {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border-strong);
}

.sidebar__toggle-icon {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.workspace-layout.is-sidebar-collapsed {
  grid-template-columns: 1fr !important;
  column-gap: 0;
  position: relative;
}

.workspace-layout.is-sidebar-collapsed .sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 44px;
  padding: 0.6rem 0.35rem;
  overflow: hidden;
  z-index: 10;
  min-width: 44px;
  max-width: 44px;
}

.workspace-layout.is-sidebar-collapsed .sidebar__toggle {
  position: relative;
  top: auto;
  right: auto;
  margin: 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.workspace-layout.is-sidebar-collapsed .sidebar__toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.workspace-layout.is-sidebar-collapsed .sidebar-section {
  display: none;
}

.workspace-layout.is-sidebar-collapsed .workspace-resizer {
  display: none;
}

.workspace-layout.is-sidebar-collapsed .main-panel {
  padding-left: 44px;
}

.main-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  min-width: 0;
}

.panel,
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 1.25rem;
}

.panel--subtle {
  background: var(--surface-strong);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header--wide {
  flex-wrap: wrap;
}

.sidebar-section__footer {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.hero-panel {
  padding: 2rem;
  display: grid;
  gap: 1rem;
}

.feature-list {
  display: grid;
  gap: 0.9rem;
}

.feature-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.panel-note,
.password-rules {
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: var(--surface-muted);
  color: var(--text-soft);
}

.auth-card {
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
  align-self: start;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.4rem;
  border-radius: 1rem;
  background: var(--surface-muted);
}

.tabs__button {
  border: 0;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
  cursor: pointer;
}

.tabs__button.is-active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.form-stack,
.inline-form,
.form-grid,
.checkbox-grid,
.meta-row,
.stats-row,
.button-row,
.admin-layout {
  display: grid;
  gap: 1rem;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

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

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

.field {
  display: grid;
  gap: 0.45rem;
}

.field--grow {
  min-width: 0;
}

.field span {
  font-weight: 600;
  color: var(--text-soft);
}

input,
select {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 0.95rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

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

input:disabled,
select:disabled,
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: var(--surface-strong);
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 0.95rem;
  padding: 0.9rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(135deg, var(--primary), #8f6d3f);
  color: white;
  box-shadow: var(--shadow-soft);
}

.button--ghost {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--text);
}

.button--danger {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.25);
  background: var(--danger-soft);
}

.button--block {
  width: 100%;
}

.button--small {
  padding: 0.62rem 0.85rem;
  font-size: 0.9rem;
}

.alert {
  margin: 1rem 2rem 0;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}

.alert--success {
  background: var(--success-soft);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.alert--error {
  background: var(--danger-soft);
  border-color: rgba(244, 63, 94, 0.22);
  color: var(--danger);
}

.alert--info {
  background: var(--primary-soft);
  border-color: var(--border-strong);
  color: var(--primary);
}

.meta-row,
.stat-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.file-list-shell {
  display: grid;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  overflow: hidden;
}

.file-list__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.file-list {
  display: grid;
  max-height: 340px;
  overflow: auto;
}

.file-list__controls {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.file-list__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.file-list__row:first-child {
  border-top: 0;
}

.file-list__row.is-active {
  background: color-mix(in srgb, var(--primary-soft) 65%, var(--surface-strong) 35%);
}

.file-list__checkbox {
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.file-list__checkbox input[type="checkbox"] {
  margin: 0;
}

.file-list__details {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.file-list__details strong,
.file-list__summary span {
  overflow-wrap: anywhere;
}

.file-list__summary span {
  text-align: right;
}

.file-list__bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.file-list__bulk-summary span {
  color: var(--text-soft);
  font-size: 0.875rem;
}

.file-list__summary span,
.file-list__details span,
.file-list__meta span,
.meta-row span,
.stat-chip span {
  color: var(--text-soft);
}

.stat-chip {
  min-width: 140px;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  background: var(--surface-muted);
  min-height: 2.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-chip strong {
  display: block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-panel {
  min-height: calc(100vh - 10rem);
  display: flex;
  flex: 1;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.graph-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: nowrap;
}

.graph-panel__title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}

.graph-panel__title {
  min-width: 0;
}

.graph-panel__title h2 {
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
}

.graph-panel__title p {
  font-size: 0.875rem;
  color: var(--text-soft);
  margin: 0.15rem 0 0;
  white-space: nowrap;
}

.graph-panel__export-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  min-width: 0;
  height: 2.6rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface-muted);
}

.graph-panel__export-label {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.graph-panel__export-actions .button {
  height: 2rem;
  padding: 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.graph-panel__stats {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: 0;
  flex: 0 0 auto;
}

.graph-panel__stats .stat-chip {
  min-width: 0;
  flex: 0 0 auto;
  min-width: 110px;
  padding: 0.3rem 0.65rem;
  border-radius: 0.85rem;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.graph-panel__stats .stat-chip span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.graph-panel__stats .stat-chip:first-child {
  flex: 0 1 18rem;
  min-width: 14rem;
}

.graph-panel__stats .stat-chip strong {
  font-size: 0.9rem;
  white-space: nowrap;
}

.stats-row--horizontal {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.pill--muted {
  background: var(--surface-muted);
  color: var(--text-soft);
}

.graph-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.graph-toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  min-width: 0;
  height: 2.6rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface-muted);
}

.graph-toolbar__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 0.35rem;
}

.graph-toolbar__searchbar {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 0 1 auto;
  min-width: 30rem;
  max-width: 18rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
}

.graph-toolbar__searchbar span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.graph-toolbar__searchbar input {
  min-width: 0;
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
}

.graph-toolbar__searchbar input:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}

.graph-toolbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.graph-toolbar__toggle input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
}

.graph-toolbar__zoom-label {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
}

.graph-toolbar__group .button {
  height: 2rem;
  padding: 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.graph-toolbar__select-inline {
  min-width: 11rem;
  max-width: 14rem;
  height: 2rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.graph-toolbar__select-inline:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.graph-hint {
  margin-bottom: 0.65rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

@media (max-width: 1200px) {
  .graph-toolbar__group {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .graph-panel__export-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .graph-panel__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .graph-panel__title-row {
    width: 100%;
    justify-content: space-between;
  }

  .graph-panel__stats {
    width: 100%;
  }

  .graph-panel__stats .stat-chip,
  .graph-panel__stats .stat-chip:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.graph-container {
  min-height: 640px;
  flex: 1;
  overflow: hidden;
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent), var(--surface-muted);
}

.graph-stage {
  position: relative;
  min-height: 640px;
  height: 100%;
  background-image: linear-gradient(var(--graph-grid) 1px, transparent 1px), linear-gradient(90deg, var(--graph-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  cursor: grab;
}

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

.graph-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 640px;
}

.graph-panzoom {
  transform-origin: 0 0;
}

.graph-edge > path:not(.graph-edge__arrow) {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 16px rgba(200, 155, 94, 0.18));
}

.graph-edge__arrow {
  pointer-events: none;
}

.graph-edge.is-dimmed path {
  opacity: 0.22;
}

.graph-edge text {
  fill: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--surface-muted);
  stroke-width: 6px;
  stroke-linejoin: round;
}

.graph-input-port {
  fill: var(--text-soft);
  stroke: var(--surface-muted);
  stroke-width: 2;
  pointer-events: none;
}

.graph-output-port {
  stroke: var(--surface-muted);
  stroke-width: 2;
  pointer-events: none;
}

.graph-node-card {
  display: grid;
  gap: 0.65rem;
  width: 100%;
  height: 100%;
  position: relative;
  padding: 1rem;
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  cursor: grab;
  color: var(--text);
  user-select: none;
}

.graph-node-card.project {
  border-color: rgba(30, 58, 138, 0.28);
}

.graph-node-card.module {
  border-color: rgba(200, 155, 94, 0.28);
}

.graph-node-card.missing {
  border-color: rgba(244, 63, 94, 0.28);
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface-strong) 30%);
}

.graph-node-card--matched {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent), var(--shadow-soft);
}

.graph-node-card--dimmed {
  opacity: 0.38;
}

.graph-node-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.graph-node-card h3,
.graph-node-card__subtitle,
.graph-node-card__body {
  margin: 0;
  line-height: 1.45;
}

.graph-node-card__type,
.graph-node-card__status {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.graph-node-card__type {
  color: var(--primary);
}

.graph-node-card__status {
  color: var(--text-soft);
}

.graph-node-card__subtitle {
  font-size: 0.92rem;
}

.graph-node-card__body {
  line-height: 1.45;
}

.graph-node-card__actions {
  display: grid;
  gap: 0.45rem;
}

.graph-node-card__code-actions {
  margin-top: 0.25rem;
  pointer-events: auto;
}

.graph-node-card__actions select,
.graph-node-card__actions button {
  min-height: 2rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.35rem 0.55rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  pointer-events: auto;
}

.graph-node-card__actions button {
  cursor: pointer;
  font-weight: 700;
}

.graph-node-card__actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.graph-node-card__quick-actions {
  position: relative;
  display: flex;
  justify-self: end;
  justify-content: flex-end;
  margin-top: auto;
  pointer-events: auto;
}

.graph-node-card__quick-actions-trigger {
  width: 2.2rem;
  height: 2.2rem;
  border: 1px dashed color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: 999px;
  padding: 0;
  background: color-mix(in srgb, var(--primary-soft) 32%, var(--surface));
  color: var(--primary);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.graph-node-card__quick-actions-trigger:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 52%, var(--surface));
}

.graph-node-card__quick-actions-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  z-index: 2;
  display: grid;
  gap: 0.35rem;
  min-width: 9rem;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--surface) 96%, white 4%);
  box-shadow: var(--shadow-soft);
}

.graph-node-card__quick-actions-menu button {
  min-height: 1.95rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.35rem 0.6rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.graph-node-card__quick-actions-menu button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.graph-node-card__note {
  display: grid;
  gap: 0.45rem;
  pointer-events: auto;
  user-select: text;
}

.graph-node-card__note span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
}

.graph-node-card__note textarea {
  width: 100%;
  min-height: 5.75rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.6rem 0.7rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.4;
  resize: none;
  pointer-events: auto;
  user-select: text;
}

.graph-node-card__note textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

.pill--success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.25);
}

.pill--warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.25);
}

.setup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.graph-empty,
.empty-state {
  display: grid;
  gap: 0.75rem;
  place-items: center;
  text-align: center;
  min-height: 100%;
  padding: 3rem 1.5rem;
}

.empty-state.compact {
  min-height: 0;
  padding: 1rem 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  z-index: 40;
}

.modal-backdrop--wide {
  padding: 1rem;
}

.modal {
  max-width: 460px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  width: min(100%, 460px);
  max-width: 680px;
  width: 90vw;
  padding: 1.5rem;
}

.modal--large {
  max-width: 680px;
  width: 90vw;
}

.modal--wide {
  width: min(1180px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: #0d1b2a;
  color: #fff;
  border-bottom: 1px solid rgba(200, 155, 94, 0.35);
  padding: 1rem 1.25rem;
}

.modal-header .modal-title,
.modal-header .text-body,
.modal-header p,
.modal-header .small,
.modal-header .text-muted {
  color: #fff !important;
}

.modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.admin-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}

.admin-user-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.meta-row {
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.busy-indicator {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 60;
}

.busy-indicator__spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .auth-layout,
  .workspace-layout,
  .admin-layout,
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .workspace-resizer {
    display: none;
  }

  .graph-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .graph-toolbar__section {
    justify-content: flex-start;
  }

  .graph-toolbar__searchbar {
    max-width: none;
  }

  .graph-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .dashboard-header,
  .auth-layout,
  .workspace-layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .inline-form,
  .button-row,
  .meta-row,
  .file-list__row,
  .admin-user-card__header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .modal-backdrop {
    padding: 0.75rem;
  }

  .modal {
    max-height: calc(100vh - 1.5rem);
  }

  .file-list__summary,
  .file-list__bulk-actions,
  .stats-row--horizontal {
    justify-content: flex-start;
  }

  .graph-toolbar__searchbar {
    flex-wrap: wrap;
  }

  .file-list__summary span {
    text-align: left;
  }
}

.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tabs--pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  grid-template-columns: none;
  width: fit-content;
}

.tabs--pills .tabs__button {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
}

.admin-page__content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-section-header h2 {
  margin: 0;
}

.admin-section-header p {
  margin: 0.25rem 0 0;
  color: var(--text-soft);
}

.admin-settings-section {
  max-width: 720px;
}

.text-gold { color: #c89b5e !important; }
.text-slate-300 { color: #cbd5e1 !important; }
.text-slate-400 { color: #94a3b8 !important; }

.btn-gold {
  background: #c89b5e;
  color: #0d1b2a;
  border: none;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-gold:hover, .btn-gold:focus {
  background: #d2aa74;
  color: #0d1b2a;
}

.btn-outline-gold {
  color: #c89b5e;
  border: 1px solid #c89b5e;
  background: transparent;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-outline-gold:hover, .btn-outline-gold:focus {
  background: #c89b5e;
  color: #0d1b2a;
}

.hero-gradient {
  background: linear-gradient(135deg, #0d1b2a 0%, #1e3a8a 55%, #0d1b2a 100%);
}

.shadow-soft { box-shadow: 0 20px 60px rgba(13, 27, 42, 0.08); }
.rounded-4xl { border-radius: 1.75rem; }
.tracking-widest { letter-spacing: 0.2em; }

.feature-icon {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  color: #c89b5e;
}
