:root {
  --bg: #121620;
  --panel: rgba(37, 45, 58, 0.88);
  --card: rgba(42, 50, 64, 0.94);
  --border: rgba(148, 163, 184, 0.24);
  --text: #e6ebf3;
  --muted: #b3bdd0;
  --accent: #7aa2ff;
  --accent-soft: rgba(122, 162, 255, 0.16);
  --warning: #dbc173;
  --danger: #f08a86;
  --shadow: 0 6px 18px rgba(8, 12, 20, 0.3);
}

body[data-theme="light"] {
  --bg: #85dcb8;
  --panel: rgba(245, 255, 252, 0.34);
  --card: rgba(245, 255, 252, 0.7);
  --border: rgba(31, 79, 73, 0.36);
  --text: #1f4f49;
  --muted: rgba(31, 79, 73, 0.78);
  --accent: #e27d60;
  --accent-soft: rgba(226, 125, 96, 0.16);
  --warning: #e8a87c;
  --danger: #c95d45;
  --shadow: 0 10px 26px rgba(19, 53, 48, 0.2);
}

body[data-theme="sand"] {
  --bg: #eae7dc;
  --panel: rgba(255, 252, 246, 0.58);
  --card: rgba(255, 250, 242, 0.78);
  --border: rgba(123, 106, 94, 0.36);
  --text: #564941;
  --muted: rgba(86, 73, 65, 0.76);
  --accent: #e98074;
  --accent-soft: rgba(233, 128, 116, 0.18);
  --warning: #d8c3a5;
  --danger: #e85a4f;
  --shadow: 0 10px 26px rgba(86, 73, 65, 0.16);
}

body[data-theme="bright"] {
  --bg: #5a5560;
  --panel: rgba(70, 52, 78, 0.8);
  --card: rgba(90, 85, 96, 0.86);
  --border: rgba(157, 141, 143, 0.52);
  --text: #f5f2dc;
  --muted: rgba(234, 231, 220, 0.72);
  --accent: #faed26;
  --accent-soft: rgba(250, 237, 38, 0.22);
  --warning: #9b786f;
  --danger: #e85a4f;
  --shadow: 0 10px 24px rgba(25, 18, 29, 0.34);
}

body[data-theme="icons"] {
  --bg: #0f292f;
  --panel: rgba(20, 160, 152, 0.16);
  --card: rgba(80, 31, 58, 0.78);
  --border: rgba(203, 45, 111, 0.44);
  --text: #f2f2f2;
  --muted: rgba(204, 204, 204, 0.8);
  --accent: #14a098;
  --accent-soft: rgba(20, 160, 152, 0.2);
  --warning: #cb2d6f;
  --danger: #cb2d6f;
  --shadow: 0 10px 24px rgba(5, 14, 17, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-shell {
  display: flex;
  height: 100%;
}

.sidebar {
  display: none;
}

h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.subtitle {
  margin: 2px 0 10px;
  font-size: 11px;
  color: #bcc6d8;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.panel:hover {
  border-color: rgba(148, 163, 184, 0.34);
}

.panel h2 {
  font-size: 12px;
  margin: 0 0 5px;
  letter-spacing: 0.02em;
  color: #d6deeb;
}

.hidden {
  display: none;
}

.seo-crawl-content {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

input,
select,
button {
  font: inherit;
}

input:not([type="checkbox"]),
select {
  margin-top: 2px;
  width: 100%;
  border-radius: 8px;
  border: 1.5px solid rgba(122, 138, 162, 0.75);
  background: rgba(22, 28, 38, 0.9);
  color: #e7edf8;
  padding: 7px 9px;
  min-height: 31px;
  font-size: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea {
  margin-top: 2px;
  width: 100%;
  border-radius: 8px;
  border: 1.5px solid rgba(122, 138, 162, 0.75);
  background: rgba(22, 28, 38, 0.9);
  color: #e7edf8;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.35;
  resize: vertical;
  min-height: 74px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(122, 162, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.14);
}

select {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  height: 34px;
  min-height: 34px;
  border-radius: 10px;
  border-color: rgba(132, 148, 173, 0.82);
  background: rgba(27, 35, 48, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(194, 208, 228, 0.08),
    0 1px 1px rgba(0, 0, 0, 0.16);
  padding: 0 10px 0 12px;
  text-indent: 1px;
  line-height: 34px;
  vertical-align: middle;
  text-align: left;
  text-align-last: left;
  font-weight: 500;
}

#selected-panel select {
  padding-left: 12px;
  text-indent: 1px;
}

select:hover {
  border-color: rgba(147, 168, 201, 0.9);
}

select:focus {
  border-color: rgba(122, 162, 255, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(194, 208, 228, 0.12),
    0 0 0 3px rgba(122, 162, 255, 0.16);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 14px;
  height: 14px;
  margin: 0;
  border-radius: 4px;
  border: 1.5px solid rgba(122, 138, 162, 0.8);
  background: rgba(22, 28, 38, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

input[type="checkbox"]::before {
  content: "";
  width: 4px;
  height: 8px;
  border-right: 1.8px solid #f2f7ff;
  border-bottom: 1.8px solid #f2f7ff;
  transform: rotate(45deg) scale(0);
  transform-origin: center;
  transition: transform 120ms ease;
}

input[type="checkbox"]:checked {
  border-color: rgba(122, 162, 255, 0.95);
  background: rgba(78, 131, 221, 0.95);
}

input[type="checkbox"]:checked::before {
  transform: rotate(45deg) scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(122, 162, 255, 0.24);
}

#metric-cohorts-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

#selected-create-cohorts {
  margin-right: 7px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: box-shadow 120ms ease, background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.78;
  color: #9ca7bb;
}

.zoom-btn:disabled,
.ghost-btn:disabled,
.primary-btn:disabled {
  box-shadow: none;
  border-color: rgba(120, 134, 156, 0.45);
  background: rgba(46, 56, 72, 0.76);
  color: #9ca7bb;
}

.primary-btn {
  background: linear-gradient(135deg, #4e83dd 0%, #3f70c7 100%);
  color: #f8fafc;
  width: 100%;
  box-shadow: 0 5px 12px rgba(63, 112, 199, 0.24);
}

.ghost-btn {
  width: 100%;
  background: rgba(24, 31, 43, 0.8);
  border: 1px solid rgba(122, 138, 162, 0.6);
  color: #d4dde9;
}

.hint {
  color: var(--muted);
  margin: 4px 0 6px;
  line-height: 1.3;
  font-size: 11px;
}

.hint.error {
  color: var(--danger);
}

.storage-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.canvas-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.canvas-toolbar {
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 6px 14px;
  font-weight: 600;
  background: rgba(22, 28, 38, 0.95);
  backdrop-filter: blur(6px);
}

#stats {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  white-space: nowrap;
}

.canvas-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.toolbar-brand {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(122, 138, 162, 0.5);
  background: rgba(15, 23, 42, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toolbar-logo {
  width: 22px;
  height: 22px;
  display: block;
}

.sim-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sim-controls .zoom-btn {
  width: auto;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  font-size: 10px;
}

.sim-speed-btn {
  min-width: 48px;
  padding: 0 5px;
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sim-speed-btn span {
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.01em;
}

.sim-undo-btn {
  min-width: 44px;
  padding: 0 6px;
  font-size: 9px;
}

.zoom-btn.is-active {
  background: rgba(78, 131, 221, 0.92);
  border-color: rgba(122, 162, 255, 0.66);
  color: #f3f8ff;
}

.zoom-btn.sim-play-active {
  background: rgba(36, 175, 101, 0.95);
  border-color: rgba(74, 222, 128, 0.72);
  color: #f4fff8;
}

.zoom-btn.sim-pause-active {
  background: rgba(234, 138, 46, 0.95);
  border-color: rgba(251, 191, 114, 0.74);
  color: #fff8ed;
}

.zoom-btn.sim-stop-active {
  background: rgba(218, 79, 79, 0.95);
  border-color: rgba(248, 136, 136, 0.72);
  color: #fff3f3;
}

.zoom-btn.sim-play-active:disabled,
.zoom-btn.sim-pause-active:disabled,
.zoom-btn.sim-stop-active:disabled {
  opacity: 1;
}

.sim-counter {
  margin-left: 2px;
  font-size: 10px;
  color: #c7d2e3;
  white-space: nowrap;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.01em;
}

.sim-btn-label {
  display: none;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-theme-select {
  margin-top: 0;
  width: auto;
  min-width: 82px;
  height: 26px;
  min-height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(122, 138, 162, 0.6);
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  background: rgba(24, 31, 43, 0.9);
  color: var(--text);
  box-shadow: none;
  padding: 0 8px;
  line-height: 26px;
  font-size: 10px;
  font-weight: 600;
}

.toolbar-template-select {
  margin-top: 0;
  width: auto;
  min-width: 126px;
  height: 26px;
  min-height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(122, 138, 162, 0.6);
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  background: rgba(24, 31, 43, 0.9);
  color: var(--text);
  box-shadow: none;
  padding: 0 8px;
  line-height: 26px;
  font-size: 10px;
  font-weight: 600;
}

.toolbar-storage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 3px;
}

.toolbar-template-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  margin-right: 8px;
}

.toolbar-project-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.toolbar-right-controls {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-storage-btn {
  height: 26px;
  min-width: 38px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(122, 138, 162, 0.58);
  background: rgba(24, 31, 43, 0.86);
  color: #d6dfeb;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-storage-btn--icon {
  width: 26px;
  min-width: 26px;
  padding: 0;
}

.toolbar-storage-btn--icon .lucide {
  width: 14px;
  height: 14px;
}

.toolbar-storage-btn--primary {
  background: rgba(78, 131, 221, 0.95);
  border-color: rgba(122, 162, 255, 0.66);
  color: #f7fbff;
}

.toolbar-storage-btn:disabled {
  background: rgba(46, 56, 72, 0.76);
  border-color: rgba(120, 134, 156, 0.45);
  color: #9ca7bb;
}

.toolbar-admin-badge {
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(110, 214, 166, 0.45);
  background: rgba(27, 54, 43, 0.9);
  color: #93f2c2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}


.toolbar-storage-status {
  display: none;
  font-size: 10px;
  color: #b8c4d8;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-storage-status.error {
  color: #f0a19d;
}

.zoom-btn {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(122, 138, 162, 0.6);
  border-radius: 6px;
  background: rgba(24, 31, 43, 0.88);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
}

.zoom-level {
  min-width: 42px;
  text-align: center;
  font-size: 11px;
  color: #c5d0e1;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.app-toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  max-width: 280px;
  border-radius: 10px;
  border: 1px solid rgba(122, 138, 162, 0.56);
  background: rgba(24, 31, 43, 0.94);
  color: #e9f1fb;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  padding: 8px 10px;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.35);
}

.app-toast-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.app-toast-text {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.app-toast-copy {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(122, 138, 162, 0.46);
  background: rgba(255, 255, 255, 0.04);
  color: currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

.app-toast-copy .lucide {
  width: 12px;
  height: 12px;
}

.app-toast-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(122, 162, 255, 0.56);
}

.app-toast-copy.is-copied {
  border-color: rgba(52, 211, 153, 0.62);
  background: rgba(52, 211, 153, 0.12);
}

.app-toast.error {
  border-color: rgba(240, 138, 134, 0.62);
  color: #ffd8d5;
}

.app-version {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 30;
  pointer-events: none;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: rgba(201, 214, 233, 0.82);
  border: 1px solid rgba(122, 138, 162, 0.36);
  background: rgba(15, 23, 42, 0.56);
  border-radius: 8px;
  padding: 3px 7px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(2px);
}

.auth-modal-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 24px));
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px;
}

.settings-modal-card {
  width: min(400px, calc(100vw - 24px));
}

.ai-modal-card {
  width: min(680px, calc(100vw - 24px));
}

.ai-chat-log {
  margin: 0 0 10px;
  max-height: min(34vh, 300px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.22);
  display: grid;
  gap: 8px;
}

.ai-chat-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.ai-chat-message {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.3);
}

.ai-chat-message header {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-chat-message p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.ai-chat-message--assistant {
  border-color: rgba(122, 162, 255, 0.34);
  background: rgba(24, 42, 74, 0.3);
}

.ai-chat-message--user {
  border-color: rgba(45, 212, 191, 0.34);
  background: rgba(15, 57, 50, 0.26);
}

.ai-prompt-input {
  width: 100%;
  resize: vertical;
  min-height: 100px;
}

.ai-modal-actions {
  grid-template-columns: 1.1fr 1fr;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.auth-modal-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.auth-modal-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

#auth-modal .auth-modal-header {
  position: relative;
  justify-content: center;
  margin-bottom: 10px;
  padding-top: 2px;
}

#auth-modal .auth-modal-brand {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

#auth-modal .auth-modal-logo {
  width: 60px;
  height: 60px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(28, 41, 62, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.34);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
}

#auth-modal .auth-modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#auth-modal .auth-modal-close {
  position: absolute;
  top: 0;
  right: 0;
}

.auth-modal-close {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(20, 27, 38, 0.82);
  color: var(--text);
  padding: 0;
  line-height: 1;
  font-size: 14px;
}

.auth-modal-hint {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
}

.auth-modal-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-modal-actions .primary-btn,
.auth-modal-actions .ghost-btn {
  min-height: 44px;
  font-size: 15px;
  border-radius: 12px;
  padding: 0 12px;
}

.auth-google-btn {
  margin-top: 8px;
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  background: rgba(20, 27, 38, 0.14);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.auth-google-btn:hover {
  background: rgba(20, 27, 38, 0.22);
}

.auth-reset-btn {
  margin-top: 8px;
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: rgba(20, 27, 38, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.auth-reset-btn:hover {
  border-color: rgba(122, 162, 255, 0.45);
  color: var(--text);
}

body[data-theme="light"] .app-toast {
  border-color: rgba(31, 79, 73, 0.42);
  background: rgba(232, 247, 241, 0.96);
  color: #1f4f49;
}

body[data-theme="light"] .app-toast.error {
  border-color: rgba(201, 93, 69, 0.56);
  color: #7a2a1f;
}

body[data-theme="light"] .app-version {
  color: rgba(31, 79, 73, 0.86);
  border-color: rgba(31, 79, 73, 0.3);
  background: rgba(240, 252, 247, 0.82);
}

body[data-theme="sand"] .app-toast {
  border-color: rgba(123, 106, 94, 0.42);
  background: rgba(250, 242, 229, 0.97);
  color: #564941;
}

body[data-theme="sand"] .app-toast.error {
  border-color: rgba(216, 95, 85, 0.52);
  color: #7a2f28;
}

body[data-theme="sand"] .app-version {
  color: rgba(86, 73, 65, 0.9);
  border-color: rgba(123, 106, 94, 0.3);
  background: rgba(254, 248, 240, 0.84);
}

body[data-theme="bright"] .app-toast {
  border-color: rgba(157, 141, 143, 0.48);
  background: rgba(72, 60, 82, 0.97);
  color: #f5f2dc;
}

body[data-theme="bright"] .app-toast.error {
  border-color: rgba(232, 90, 79, 0.62);
  color: #ffd9d5;
}

body[data-theme="bright"] .app-version {
  color: rgba(245, 242, 220, 0.92);
  border-color: rgba(157, 141, 143, 0.34);
  background: rgba(70, 52, 78, 0.72);
}

body[data-theme="icons"] .app-toast {
  border-color: rgba(20, 160, 152, 0.48);
  background: rgba(18, 54, 61, 0.97);
  color: #f2f2f2;
}

body[data-theme="icons"] .app-toast.error {
  border-color: rgba(203, 45, 111, 0.62);
  color: #ffd8e9;
}

body[data-theme="icons"] .app-version {
  color: rgba(242, 242, 242, 0.92);
  border-color: rgba(20, 160, 152, 0.36);
  background: rgba(15, 41, 47, 0.74);
}

.workspace {
  position: relative;
  flex: 1;
  overflow: hidden;
  cursor: grab;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #171c27;
}

.workspace.panning {
  cursor: grabbing;
}

.canvas-zoom-dock {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(5px);
}

.canvas-sim-dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(5px);
}

.canvas-sim-dock .sim-speed-btn {
  min-width: 52px;
}

.canvas-sim-dock .sim-counter {
  margin-left: 0;
}

.canvas-sim-dock .sim-date-btn {
  min-width: 36px;
  padding: 0;
}

.sim-date-label {
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
}

.floating-window {
  position: absolute;
  left: 10px;
  width: 297px;
  max-height: calc(100% - 84px);
  overflow: auto;
  z-index: 20;
}

.floating-window.panel {
  background: rgba(28, 35, 47, 0.85);
}

.floating-window-metric {
  top: 8px;
}

.floating-window-dependency {
  top: 8px;
}

.floating-window-selected {
  top: 8px;
}

.floating-window-selected > h2 {
  margin: -9px -9px 8px;
  padding: 8px 34px 8px 10px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(82, 109, 167, 0.18) 0%, rgba(62, 84, 133, 0.1) 100%);
}

.selected-panel-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 999px;
  background: rgba(20, 27, 38, 0.88);
  color: #d6e0ed;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.selected-panel-close:hover {
  background: rgba(26, 34, 46, 0.95);
  border-color: rgba(148, 163, 184, 0.54);
  transform: translateY(-0.5px);
}

.selected-panel-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(122, 162, 255, 0.32);
}

.floating-window-selected[data-metric-tone="manual"] > h2 {
  background: linear-gradient(180deg, rgba(199, 166, 83, 0.22) 0%, rgba(168, 137, 66, 0.12) 100%);
}

.floating-window-selected[data-metric-tone="ratio"] > h2 {
  background: linear-gradient(180deg, rgba(123, 164, 236, 0.28) 0%, rgba(93, 134, 210, 0.16) 100%);
}

.floating-window-selected[data-metric-tone="retention"] > h2 {
  background: linear-gradient(180deg, rgba(126, 145, 239, 0.36) 0%, rgba(101, 121, 215, 0.22) 100%);
}

.floating-window-selected[data-metric-tone="cumulative"] > h2 {
  background: linear-gradient(180deg, rgba(226, 185, 99, 0.36) 0%, rgba(198, 157, 76, 0.22) 100%);
}

.floating-window-selected[data-metric-tone="metric"] {
  background: linear-gradient(180deg, rgba(40, 48, 62, 0.98) 0%, rgba(36, 44, 58, 0.98) 100%);
}

.floating-window-selected[data-metric-tone="manual"] {
  background: linear-gradient(180deg, rgba(60, 52, 68, 0.98) 0%, rgba(48, 42, 57, 0.98) 100%);
}

.floating-window-selected[data-metric-tone="ratio"] {
  background: linear-gradient(180deg, rgba(44, 53, 88, 0.98) 0%, rgba(36, 45, 75, 0.98) 100%);
}

.floating-window-selected[data-metric-tone="retention"] {
  background: linear-gradient(180deg, rgba(57, 66, 102, 0.98) 0%, rgba(43, 53, 86, 0.98) 100%);
}

.floating-window-selected[data-metric-tone="cumulative"] {
  background: linear-gradient(180deg, rgba(70, 63, 47, 0.98) 0%, rgba(56, 50, 38, 0.98) 100%);
}

.add-sticker-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  right: auto;
  z-index: 25;
  pointer-events: auto;
}

.metric-chart-panel {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 352px;
  min-width: 300px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(28, 35, 47, 0.96);
  box-shadow: var(--shadow);
  z-index: 3;
  backdrop-filter: blur(1px);
  pointer-events: auto;
  cursor: grab;
}

.metric-chart-panel.dragging {
  cursor: grabbing;
}

.metric-chart-panel.is-collapsed {
  width: 210px;
}

.metric-chart-panel.is-collapsed .metric-chart-header {
  margin-bottom: 0;
}

.metric-chart-panel.is-collapsed .chart-settings {
  display: none;
}

.metric-chart-panel.is-collapsed #metric-chart {
  display: none;
}

.metric-chart-panel.is-collapsed .chart-panel-resize-handle {
  display: none;
}

.metric-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
  user-select: none;
}

.metric-chart-panel.dragging .metric-chart-header {
  cursor: grabbing;
}

.metric-chart-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.metric-chart-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chart-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  margin-top: 8px;
  align-items: center;
}

.chart-settings-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9fb0c7;
  font-size: 10px;
  min-width: 0;
}

.chart-settings-item > span {
  white-space: nowrap;
}

.chart-settings-item--checkbox {
  grid-column: span 1;
  gap: 6px;
  white-space: nowrap;
}

select.chart-settings-select {
  height: 28px;
  min-height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(20, 26, 36, 0.92);
  color: #d5deea;
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  min-width: 112px;
  line-height: 28px;
  box-shadow: none;
  width: 100%;
}

.chart-settings-number {
  height: 28px;
  min-height: 28px;
  width: 100%;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(20, 26, 36, 0.92);
  color: #d5deea;
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  line-height: 28px;
  box-shadow: none;
}

.chart-settings-number::-webkit-outer-spin-button,
.chart-settings-number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.chart-settings-number {
  -moz-appearance: textfield;
}

.chart-settings-item input[type="checkbox"] {
  width: 12px;
  height: 12px;
}

.chart-control-btn {
  width: auto;
  min-width: 72px;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  background: rgba(20, 26, 36, 0.92);
  color: #d5deea;
  font-size: 11px;
  line-height: 1;
  padding: 0 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

#metric-chart-title {
  font-size: 11px;
  color: #e2e8f0;
}

#metric-chart-meta {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#metric-chart {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 130px;
  height: 100%;
}

.chart-panel-resize-handle {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background:
    linear-gradient(135deg, transparent 38%, rgba(148, 163, 184, 0.3) 38%, rgba(148, 163, 184, 0.3) 52%, transparent 52%),
    linear-gradient(135deg, transparent 58%, rgba(148, 163, 184, 0.56) 58%, rgba(148, 163, 184, 0.56) 72%, transparent 72%);
  cursor: nwse-resize;
  opacity: 0.82;
}

.metric-chart-panel.resizing {
  cursor: nwse-resize;
}

.show-chart-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 38, 50, 0.96);
  color: #e2e8f0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
}

.show-chart-btn.new-metric-canvas-btn {
  right: 10px;
  top: 10px;
}

.show-chart-btn.add-sticker-btn {
  left: auto;
  right: 10px;
  top: 50px;
  width: auto;
  max-width: max-content;
}

.show-chart-btn.show-chart-btn--dock {
  right: 14px;
  top: auto;
  bottom: 58px;
  z-index: 19;
}

body[data-theme="light"] {
  background: #85dcb8;
  color: #1f4f49;
}

body[data-theme="light"] .sidebar {
  border-right-color: rgba(31, 79, 73, 0.36);
  background: linear-gradient(180deg, rgba(133, 220, 184, 0.94) 0%, rgba(65, 179, 163, 0.92) 100%);
}

body[data-theme="light"] h1 {
  color: #1f4f49;
}

body[data-theme="light"] .subtitle {
  color: rgba(31, 79, 73, 0.84);
}

body[data-theme="light"] .panel {
  background: rgba(245, 255, 252, 0.34);
  border-color: rgba(31, 79, 73, 0.34);
}

body[data-theme="light"] .floating-window.panel {
  background: rgba(245, 255, 252, 0.85);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="metric"] {
  background: linear-gradient(180deg, rgba(245, 255, 252, 1) 0%, rgba(219, 244, 236, 1) 100%);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="manual"] {
  background: linear-gradient(180deg, rgba(243, 214, 223, 1) 0%, rgba(231, 191, 204, 1) 100%);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="ratio"] {
  background: linear-gradient(180deg, #d6f0ff 0%, #b9e3ff 100%);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="retention"] {
  background: linear-gradient(180deg, #d9dfff 0%, #c3cdf7 100%);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="cumulative"] {
  background: linear-gradient(180deg, #f3e4b7 0%, #e9d39d 100%);
}

body[data-theme="light"] .floating-window-selected > h2 {
  background: linear-gradient(180deg, rgba(65, 179, 163, 1) 0%, rgba(48, 154, 139, 1) 100%);
  border-bottom-color: rgba(31, 79, 73, 0.34);
  color: #1f4f49;
}

body[data-theme="light"] .selected-panel-close {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.92);
  color: #1f4f49;
}

body[data-theme="light"] .selected-panel-close:hover {
  background: rgba(231, 248, 242, 0.98);
  border-color: rgba(31, 79, 73, 0.5);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="manual"] > h2 {
  background: linear-gradient(180deg, rgba(226, 125, 96, 1) 0%, rgba(207, 103, 74, 1) 100%);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="ratio"] > h2 {
  background: linear-gradient(180deg, #6fb5e8 0%, #4d98d2 100%);
  border-bottom-color: rgba(57, 112, 156, 0.46);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="retention"] > h2 {
  background: linear-gradient(180deg, #8c98d8 0%, #7280c5 100%);
  border-bottom-color: rgba(79, 91, 148, 0.46);
}

body[data-theme="light"] .floating-window-selected[data-metric-tone="cumulative"] > h2 {
  background: linear-gradient(180deg, #e2b370 0%, #cf9958 100%);
  border-bottom-color: rgba(141, 104, 50, 0.46);
}

body[data-theme="light"] .panel h2 {
  color: #1f4f49;
}

body[data-theme="light"] label {
  color: rgba(31, 79, 73, 0.88);
}

body[data-theme="light"] input:not([type="checkbox"]),
body[data-theme="light"] select {
  border-color: rgba(31, 79, 73, 0.46);
  background: rgba(232, 247, 241, 0.92);
  color: #1f4f49;
}

body[data-theme="light"] input[type="checkbox"] {
  border-color: rgba(31, 79, 73, 0.56);
  background: rgba(245, 255, 252, 0.6);
}

body[data-theme="light"] .primary-btn {
  background: linear-gradient(135deg, #e27d60 0%, #cf6e54 100%);
  box-shadow: 0 5px 12px rgba(226, 125, 96, 0.32);
}

body[data-theme="light"] .ghost-btn {
  background: rgba(245, 255, 252, 0.3);
  border-color: rgba(31, 79, 73, 0.44);
  color: #1f4f49;
}

body[data-theme="light"] .hint {
  color: rgba(31, 79, 73, 0.76);
}

body[data-theme="light"] .canvas-wrap {
  background: #79d0ba;
}

body[data-theme="light"] .canvas-toolbar {
  border-bottom-color: rgba(31, 79, 73, 0.34);
  background: rgba(65, 179, 163, 0.32);
}

body[data-theme="light"] .toolbar-brand {
  border-color: rgba(31, 79, 73, 0.4);
  background: rgba(240, 252, 247, 0.82);
}

body[data-theme="light"] .canvas-toolbar > span {
  color: #1f4f49;
}

body[data-theme="light"] #stats {
  color: rgba(31, 79, 73, 0.8);
}

body[data-theme="light"] .toolbar-storage-status {
  color: rgba(31, 79, 73, 0.82);
}

body[data-theme="light"] .zoom-btn,
body[data-theme="light"] .toolbar-storage-btn,
body[data-theme="light"] .toolbar-template-select,
body[data-theme="light"] .chart-control-btn,
body[data-theme="light"] .chart-settings-select,
body[data-theme="light"] .chart-settings-number,
body[data-theme="light"] .show-chart-btn {
  border-color: rgba(31, 79, 73, 0.46);
  background: rgba(245, 255, 252, 0.36);
  color: #1f4f49;
}

body[data-theme="light"] .toolbar-admin-badge {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(65, 179, 163, 0.2);
  color: #1f4f49;
}

body[data-theme="light"] .chart-settings-item {
  color: rgba(31, 79, 73, 0.8);
}

body[data-theme="light"] .toolbar-theme-select {
  border-color: rgba(31, 79, 73, 0.46);
  color: #1f4f49;
  background: rgba(232, 247, 241, 0.95);
}

body[data-theme="light"] .toolbar-storage-btn--primary,
body[data-theme="light"] .zoom-btn.is-active {
  background: rgba(226, 125, 96, 0.96);
  border-color: rgba(226, 125, 96, 0.8);
  color: #fff9f6;
}

body[data-theme="light"] .zoom-level,
body[data-theme="light"] .sim-counter {
  color: rgba(31, 79, 73, 0.9);
}

body[data-theme="light"] .workspace {
  background-color: #85dcb8;
  background-image:
    linear-gradient(rgba(31, 79, 73, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 79, 73, 0.13) 1px, transparent 1px);
}

body[data-theme="light"] .metric-chart-panel {
  border-color: rgba(31, 79, 73, 0.42);
  background: rgba(245, 255, 252, 0.4);
}

body[data-theme="light"] #metric-chart-title {
  color: #1f4f49;
}

body[data-theme="light"] #metric-chart-meta {
  color: rgba(31, 79, 73, 0.76);
}

body[data-theme="light"] .metric-node {
  background: linear-gradient(180deg, rgba(245, 255, 252, 1) 0%, rgba(219, 244, 236, 1) 100%);
  border-color: rgba(31, 79, 73, 0.42);
}

body[data-theme="light"] .metric-node.source-node {
  background: linear-gradient(180deg, #9ce8df 0%, #7ad8cd 100%);
  border-color: rgba(25, 110, 101, 0.56);
}

body[data-theme="light"] .metric-node.retention-node {
  background: linear-gradient(180deg, #d9dfff 0%, #c3cdf7 100%);
  border-color: rgba(102, 116, 182, 0.58);
}

body[data-theme="light"] .metric-node.cumulative-node {
  background: linear-gradient(180deg, #f3e4b7 0%, #e9d39d 100%);
  border-color: rgba(154, 120, 52, 0.58);
}

body[data-theme="light"] .metric-node.note-node {
  background: linear-gradient(180deg, #fff1b8 0%, #f4d779 100%);
  border-color: rgba(170, 124, 37, 0.62);
}

body[data-theme="light"] .metric-node.manual-node {
  background: linear-gradient(180deg, rgba(243, 214, 223, 1) 0%, rgba(231, 191, 204, 1) 100%);
  border-color: rgba(172, 124, 140, 0.56);
}

body[data-theme="light"] .metric-node.ratio-node {
  background: linear-gradient(180deg, #d6f0ff 0%, #b9e3ff 100%);
  border-color: rgba(82, 132, 178, 0.56);
}

body[data-theme="light"] .metric-node.disabled-node {
  background: rgba(195, 141, 158, 1);
  border-color: rgba(126, 86, 102, 0.5);
}

body[data-theme="light"] .metric-node-header {
  background: linear-gradient(180deg, rgba(65, 179, 163, 1) 0%, rgba(48, 154, 139, 1) 100%);
  border-bottom-color: rgba(31, 79, 73, 0.34);
}

body[data-theme="light"] .metric-node.source-node .metric-node-header {
  background: linear-gradient(180deg, #41b3a3 0%, #2d9f90 100%);
  border-bottom-color: rgba(24, 96, 88, 0.44);
}

body[data-theme="light"] .metric-node.retention-node .metric-node-header {
  background: linear-gradient(180deg, #8c98d8 0%, #7280c5 100%);
  border-bottom-color: rgba(79, 91, 148, 0.46);
}

body[data-theme="light"] .metric-node.cumulative-node .metric-node-header {
  background: linear-gradient(180deg, #e2b370 0%, #cf9958 100%);
  border-bottom-color: rgba(141, 104, 50, 0.46);
}

body[data-theme="light"] .metric-node.note-node .metric-node-header {
  background: linear-gradient(180deg, #ffe78a 0%, #f2cb5e 100%);
  border-bottom-color: rgba(146, 103, 21, 0.46);
}

body[data-theme="light"] .metric-node.manual-node .metric-node-header {
  background: linear-gradient(180deg, rgba(226, 125, 96, 1) 0%, rgba(207, 103, 74, 1) 100%);
}

body[data-theme="light"] .metric-node.ratio-node .metric-node-header {
  background: linear-gradient(180deg, #6fb5e8 0%, #4d98d2 100%);
  border-bottom-color: rgba(57, 112, 156, 0.46);
}

body[data-theme="light"] .metric-node.disabled-node .metric-node-header {
  background: linear-gradient(180deg, rgba(195, 141, 158, 1) 0%, rgba(171, 117, 134, 1) 100%);
}

body[data-theme="light"] .metric-node-title {
  color: #1f4f49;
}

body[data-theme="light"] .metric-node-type,
body[data-theme="light"] .metric-formula {
  color: rgba(31, 79, 73, 0.74);
}

body[data-theme="light"] .metric-value {
  color: #214843;
}

body[data-theme="light"] .node-delete,
body[data-theme="light"] .node-toggle,
body[data-theme="light"] .node-action-trigger,
body[data-theme="light"] .node-chart,
body[data-theme="light"] .node-duplicate {
  border-color: rgba(31, 79, 73, 0.36);
  background: rgba(245, 255, 252, 0.9);
}

body[data-theme="light"] .node-delete {
  color: #c95d45;
}

body[data-theme="light"] .node-toggle {
  color: #2f7f73;
}

body[data-theme="light"] .node-duplicate {
  color: #7c4e63;
}

body[data-theme="light"] .value-adjust {
  border-color: rgba(31, 79, 73, 0.4);
  background: rgba(245, 255, 252, 0.42);
  color: #1f4f49;
}

body[data-theme="light"] .port {
  border-color: rgba(31, 143, 130, 0.88);
  background: #41b3a3;
  box-shadow: 0 0 0 1px rgba(65, 179, 163, 0.4);
}

body[data-theme="light"] .edge-label-bg {
  fill: rgba(245, 255, 252, 0.62);
  stroke: rgba(31, 79, 73, 0.42);
}

body[data-theme="light"] .edge-label {
  fill: #1f4f49;
  stroke: rgba(245, 255, 252, 0.62);
}

body[data-theme="light"] .edge-delete-circle {
  fill: #fff7f4;
  stroke: #c95d45;
}

body[data-theme="light"] .selected-metric-grid dt,
body[data-theme="light"] .selected-section-title,
body[data-theme="light"] .dependency-list,
body[data-theme="light"] .cohort-table th,
body[data-theme="light"] .cohort-table td {
  color: #1f4f49;
}

body[data-theme="light"] .sensitivity-driver-name,
body[data-theme="light"] .sensitivity-heat-head,
body[data-theme="light"] .sensitivity-impact,
body[data-theme="light"] .sensitivity-top-list {
  color: #1f4f49;
}

body[data-theme="light"] .sensitivity-cell {
  border-color: rgba(31, 79, 73, 0.32);
  color: #173d38;
}

body[data-theme="light"] .goal-seek-run-btn {
  border-color: rgba(31, 79, 73, 0.38);
  background: rgba(65, 179, 163, 0.2);
  color: #1f4f49;
}

body[data-theme="light"] .goal-seek-list {
  color: #1f4f49;
}

body[data-theme="light"] .selected-metric-grid dd {
  color: #214843;
}

body[data-theme="light"] .selected-section {
  border-top-color: rgba(31, 79, 73, 0.24);
}

body[data-theme="light"] .selected-section-card {
  border-color: rgba(31, 79, 73, 0.3);
  background: rgba(245, 255, 252, 0.26);
}

body[data-theme="light"] .summary-row {
  border-color: rgba(31, 79, 73, 0.24);
  background: rgba(245, 255, 252, 0.3);
}

body[data-theme="light"] .summary-label,
body[data-theme="light"] .driver-explain-name,
body[data-theme="light"] .driver-explain-share {
  color: #1f4f49;
}

body[data-theme="light"] .summary-value,
body[data-theme="light"] .summary-formula,
body[data-theme="light"] .summary-inline-value {
  color: #214843;
}

body[data-theme="light"] .summary-inline-meta,
body[data-theme="light"] .summary-inline-label {
  color: #1f4f49;
}

body[data-theme="light"] .validation-ok-hint {
  color: #2f7f73;
}

body[data-theme="light"] .cohort-breakdown {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.34);
}

body[data-theme="light"] .cohort-table th {
  background: rgba(65, 179, 163, 0.26);
}

body[data-theme="light"] .cohort-table th,
body[data-theme="light"] .cohort-table td {
  border-bottom-color: rgba(31, 79, 73, 0.24);
}

body[data-theme="light"] .retention-editor-wrap {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.3);
}

body[data-theme="sand"] {
  background: #eae7dc;
  color: #564941;
}

body[data-theme="sand"] .sidebar {
  border-right-color: rgba(123, 106, 94, 0.34);
  background: linear-gradient(180deg, rgba(238, 233, 218, 0.97) 0%, rgba(226, 214, 193, 0.97) 100%);
}

body[data-theme="sand"] h1 {
  color: #564941;
}

body[data-theme="sand"] .subtitle {
  color: rgba(86, 73, 65, 0.8);
}

body[data-theme="sand"] .panel {
  background: rgba(255, 252, 246, 0.54);
  border-color: rgba(123, 106, 94, 0.34);
}

body[data-theme="sand"] .floating-window.panel {
  background: rgba(255, 252, 246, 0.85);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="metric"] {
  background: linear-gradient(180deg, rgba(255, 252, 246, 1) 0%, rgba(246, 236, 220, 1) 100%);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="manual"] {
  background: linear-gradient(180deg, rgba(232, 217, 212, 1) 0%, rgba(217, 195, 188, 1) 100%);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="ratio"] {
  background: linear-gradient(180deg, #e3edf9 0%, #cfdff0 100%);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="retention"] {
  background: linear-gradient(180deg, #ece6f4 0%, #d6cde5 100%);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="cumulative"] {
  background: linear-gradient(180deg, #eadab8 0%, #d8c39a 100%);
}

body[data-theme="sand"] .floating-window-selected > h2 {
  background: linear-gradient(180deg, rgba(233, 128, 116, 1) 0%, rgba(218, 110, 97, 1) 100%);
  border-bottom-color: rgba(123, 106, 94, 0.3);
  color: #564941;
}

body[data-theme="sand"] .selected-panel-close {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.92);
  color: #564941;
}

body[data-theme="sand"] .selected-panel-close:hover {
  background: rgba(250, 242, 232, 0.98);
  border-color: rgba(123, 106, 94, 0.5);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="manual"] > h2 {
  background: linear-gradient(180deg, rgba(216, 195, 165, 1) 0%, rgba(194, 171, 139, 1) 100%);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="ratio"] > h2 {
  background: linear-gradient(180deg, #9db4cf 0%, #84a0c0 100%);
  border-bottom-color: rgba(98, 117, 146, 0.44);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="retention"] > h2 {
  background: linear-gradient(180deg, #b49cc9 0%, #9e86b5 100%);
  border-bottom-color: rgba(109, 91, 124, 0.46);
}

body[data-theme="sand"] .floating-window-selected[data-metric-tone="cumulative"] > h2 {
  background: linear-gradient(180deg, #cfab72 0%, #bb935f 100%);
  border-bottom-color: rgba(132, 103, 61, 0.48);
}

body[data-theme="sand"] .panel h2 {
  color: #5f5047;
}

body[data-theme="sand"] label {
  color: rgba(86, 73, 65, 0.86);
}

body[data-theme="sand"] input:not([type="checkbox"]),
body[data-theme="sand"] select {
  border-color: rgba(123, 106, 94, 0.5);
  background: rgba(250, 242, 229, 0.95);
  color: #564941;
}

body[data-theme="sand"] input[type="checkbox"] {
  border-color: rgba(123, 106, 94, 0.54);
  background: rgba(255, 252, 246, 0.66);
}

body[data-theme="sand"] .primary-btn {
  background: linear-gradient(135deg, #e98074 0%, #e85a4f 100%);
  box-shadow: 0 5px 12px rgba(232, 90, 79, 0.28);
}

body[data-theme="sand"] .ghost-btn {
  background: rgba(255, 252, 246, 0.44);
  border-color: rgba(123, 106, 94, 0.44);
  color: #564941;
}

body[data-theme="sand"] .hint {
  color: rgba(86, 73, 65, 0.74);
}

body[data-theme="sand"] .canvas-wrap {
  background: #e4dfd1;
}

body[data-theme="sand"] .canvas-toolbar {
  border-bottom-color: rgba(123, 106, 94, 0.34);
  background: rgba(232, 225, 209, 0.78);
}

body[data-theme="sand"] .toolbar-brand {
  border-color: rgba(123, 106, 94, 0.36);
  background: rgba(255, 252, 246, 0.86);
}

body[data-theme="sand"] .canvas-toolbar > span {
  color: #564941;
}

body[data-theme="sand"] #stats {
  color: rgba(86, 73, 65, 0.8);
}

body[data-theme="sand"] .toolbar-storage-status {
  color: rgba(86, 73, 65, 0.78);
}

body[data-theme="sand"] .zoom-btn,
body[data-theme="sand"] .toolbar-storage-btn,
body[data-theme="sand"] .toolbar-template-select,
body[data-theme="sand"] .chart-control-btn,
body[data-theme="sand"] .chart-settings-select,
body[data-theme="sand"] .chart-settings-number,
body[data-theme="sand"] .show-chart-btn {
  border-color: rgba(123, 106, 94, 0.44);
  background: rgba(255, 252, 246, 0.54);
  color: #564941;
}

body[data-theme="sand"] .toolbar-admin-badge {
  border-color: rgba(124, 100, 79, 0.32);
  background: rgba(216, 195, 165, 0.25);
  color: #5d4b3f;
}

body[data-theme="sand"] .chart-settings-item {
  color: rgba(86, 73, 65, 0.82);
}

body[data-theme="sand"] .toolbar-theme-select {
  border-color: rgba(123, 106, 94, 0.46);
  color: #564941;
  background: rgba(250, 242, 229, 0.97);
}

body[data-theme="sand"] .toolbar-storage-btn--primary,
body[data-theme="sand"] .zoom-btn.is-active {
  background: rgba(233, 128, 116, 0.96);
  border-color: rgba(233, 128, 116, 0.84);
  color: #fff8f5;
}

body[data-theme="sand"] .zoom-level,
body[data-theme="sand"] .sim-counter {
  color: rgba(86, 73, 65, 0.9);
}

body[data-theme="sand"] .workspace {
  background-color: #eae7dc;
  background-image:
    linear-gradient(rgba(141, 141, 138, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 141, 138, 0.24) 1px, transparent 1px);
}

body[data-theme="sand"] .metric-chart-panel {
  border-color: rgba(123, 106, 94, 0.38);
  background: rgba(255, 252, 246, 0.6);
}

body[data-theme="sand"] #metric-chart-title {
  color: #5f5047;
}

body[data-theme="sand"] #metric-chart-meta {
  color: rgba(86, 73, 65, 0.74);
}

body[data-theme="sand"] .metric-node {
  background: linear-gradient(180deg, rgba(255, 252, 246, 1) 0%, rgba(246, 236, 220, 1) 100%);
  border-color: rgba(123, 106, 94, 0.44);
}

body[data-theme="sand"] .metric-node.source-node {
  background: linear-gradient(180deg, #d7ebe6 0%, #bfded6 100%);
  border-color: rgba(92, 122, 116, 0.58);
}

body[data-theme="sand"] .metric-node.retention-node {
  background: linear-gradient(180deg, #ece6f4 0%, #d6cde5 100%);
  border-color: rgba(120, 102, 136, 0.58);
}

body[data-theme="sand"] .metric-node.cumulative-node {
  background: linear-gradient(180deg, #eadab8 0%, #d8c39a 100%);
  border-color: rgba(146, 118, 74, 0.6);
}

body[data-theme="sand"] .metric-node.note-node {
  background: linear-gradient(180deg, #f5e8bc 0%, #e7d292 100%);
  border-color: rgba(146, 116, 66, 0.62);
}

body[data-theme="sand"] .metric-node.manual-node {
  background: linear-gradient(180deg, rgba(232, 217, 212, 1) 0%, rgba(217, 195, 188, 1) 100%);
  border-color: rgba(165, 137, 126, 0.62);
}

body[data-theme="sand"] .metric-node.ratio-node {
  background: linear-gradient(180deg, #e3edf9 0%, #cfdff0 100%);
  border-color: rgba(113, 135, 166, 0.62);
}

body[data-theme="sand"] .metric-node.disabled-node {
  background: rgba(142, 141, 138, 1);
  border-color: rgba(123, 106, 94, 0.48);
}

body[data-theme="sand"] .metric-node-header {
  background: linear-gradient(180deg, rgba(233, 128, 116, 1) 0%, rgba(218, 110, 97, 1) 100%);
  border-bottom-color: rgba(123, 106, 94, 0.3);
}

body[data-theme="sand"] .metric-node.source-node .metric-node-header {
  background: linear-gradient(180deg, #7fb8ad 0%, #6aa99d 100%);
  border-bottom-color: rgba(78, 106, 101, 0.46);
}

body[data-theme="sand"] .metric-node.retention-node .metric-node-header {
  background: linear-gradient(180deg, #b49cc9 0%, #9e86b5 100%);
  border-bottom-color: rgba(109, 91, 124, 0.46);
}

body[data-theme="sand"] .metric-node.cumulative-node .metric-node-header {
  background: linear-gradient(180deg, #cfab72 0%, #bb935f 100%);
  border-bottom-color: rgba(132, 103, 61, 0.48);
}

body[data-theme="sand"] .metric-node.note-node .metric-node-header {
  background: linear-gradient(180deg, #ecd487 0%, #d9bd67 100%);
  border-bottom-color: rgba(129, 96, 48, 0.46);
}

body[data-theme="sand"] .metric-node.manual-node .metric-node-header {
  background: linear-gradient(180deg, rgba(216, 195, 165, 1) 0%, rgba(194, 171, 139, 1) 100%);
}

body[data-theme="sand"] .metric-node.ratio-node .metric-node-header {
  background: linear-gradient(180deg, #9db4cf 0%, #84a0c0 100%);
  border-bottom-color: rgba(98, 117, 146, 0.46);
}

body[data-theme="sand"] .metric-node.disabled-node .metric-node-header {
  background: linear-gradient(180deg, rgba(142, 141, 138, 1) 0%, rgba(118, 117, 114, 1) 100%);
}

body[data-theme="sand"] .metric-node-title {
  color: #564941;
}

body[data-theme="sand"] .metric-node-type,
body[data-theme="sand"] .metric-formula {
  color: rgba(86, 73, 65, 0.74);
}

body[data-theme="sand"] .metric-value {
  color: #564941;
}

body[data-theme="sand"] .node-delete,
body[data-theme="sand"] .node-toggle,
body[data-theme="sand"] .node-action-trigger,
body[data-theme="sand"] .node-chart,
body[data-theme="sand"] .node-duplicate {
  border-color: rgba(123, 106, 94, 0.42);
  background: rgba(255, 252, 246, 0.9);
}

body[data-theme="sand"] .node-delete {
  color: #d65f55;
}

body[data-theme="sand"] .node-toggle {
  color: #8e8d8a;
}

body[data-theme="sand"] .node-duplicate {
  color: #bf7a73;
}

body[data-theme="sand"] .value-adjust {
  border-color: rgba(123, 106, 94, 0.46);
  background: rgba(255, 252, 246, 0.58);
  color: #564941;
}

body[data-theme="sand"] .port {
  border-color: rgba(232, 90, 79, 0.84);
  background: #e98074;
  box-shadow: 0 0 0 1px rgba(233, 128, 116, 0.35);
}

body[data-theme="sand"] .edge-label-bg {
  fill: rgba(255, 252, 246, 0.82);
  stroke: rgba(123, 106, 94, 0.42);
}

body[data-theme="sand"] .edge-label {
  fill: #564941;
  stroke: rgba(255, 252, 246, 0.84);
}

body[data-theme="sand"] .edge-delete-circle {
  fill: #fff7f4;
  stroke: #e85a4f;
}

body[data-theme="sand"] .selected-metric-grid dt,
body[data-theme="sand"] .selected-section-title,
body[data-theme="sand"] .dependency-list,
body[data-theme="sand"] .cohort-table th,
body[data-theme="sand"] .cohort-table td {
  color: #564941;
}

body[data-theme="sand"] .sensitivity-driver-name,
body[data-theme="sand"] .sensitivity-heat-head,
body[data-theme="sand"] .sensitivity-impact,
body[data-theme="sand"] .sensitivity-top-list {
  color: #564941;
}

body[data-theme="sand"] .sensitivity-cell {
  border-color: rgba(123, 106, 94, 0.36);
  color: #493d36;
}

body[data-theme="sand"] .goal-seek-run-btn {
  border-color: rgba(123, 106, 94, 0.4);
  background: rgba(216, 195, 165, 0.34);
  color: #564941;
}

body[data-theme="sand"] .goal-seek-list {
  color: #564941;
}

body[data-theme="sand"] .selected-metric-grid dd {
  color: #4b413a;
}

body[data-theme="sand"] .selected-section {
  border-top-color: rgba(123, 106, 94, 0.26);
}

body[data-theme="sand"] .selected-section-card {
  border-color: rgba(123, 106, 94, 0.28);
  background: rgba(255, 252, 246, 0.34);
}

body[data-theme="sand"] .summary-row {
  border-color: rgba(123, 106, 94, 0.25);
  background: rgba(255, 252, 246, 0.38);
}

body[data-theme="sand"] .summary-label,
body[data-theme="sand"] .driver-explain-name,
body[data-theme="sand"] .driver-explain-share {
  color: #564941;
}

body[data-theme="sand"] .summary-value,
body[data-theme="sand"] .summary-formula,
body[data-theme="sand"] .summary-inline-value {
  color: #4b413a;
}

body[data-theme="sand"] .summary-inline-meta,
body[data-theme="sand"] .summary-inline-label {
  color: #564941;
}

body[data-theme="sand"] .validation-ok-hint {
  color: #7b6a5e;
}

body[data-theme="sand"] .cohort-breakdown {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.46);
}

body[data-theme="sand"] .cohort-table th {
  background: rgba(216, 195, 165, 0.46);
}

body[data-theme="sand"] .cohort-table th,
body[data-theme="sand"] .cohort-table td {
  border-bottom-color: rgba(123, 106, 94, 0.24);
}

body[data-theme="sand"] .retention-editor-wrap {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.48);
}

body[data-theme="bright"] {
  background: #5a5560;
  color: #f5f2dc;
}

body[data-theme="bright"] .sidebar {
  border-right-color: rgba(157, 141, 143, 0.46);
  background: linear-gradient(180deg, rgba(70, 52, 78, 0.95) 0%, rgba(90, 85, 96, 0.95) 100%);
}

body[data-theme="bright"] h1 {
  color: #faed26;
}

body[data-theme="bright"] .subtitle {
  color: rgba(234, 231, 220, 0.74);
}

body[data-theme="bright"] .panel {
  background: rgba(70, 52, 78, 0.62);
  border-color: rgba(157, 141, 143, 0.42);
}

body[data-theme="bright"] .floating-window.panel {
  background: rgba(70, 52, 78, 0.85);
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="metric"] {
  background: linear-gradient(180deg, rgba(90, 85, 96, 1) 0%, rgba(70, 52, 78, 1) 100%);
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="manual"] {
  background: linear-gradient(180deg, rgba(138, 114, 143, 1) 0%, rgba(111, 92, 118, 1) 100%);
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="ratio"] {
  background: linear-gradient(180deg, #5a6788 0%, #475575 100%);
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="retention"] {
  background: linear-gradient(180deg, #5f5377 0%, #4c4362 100%);
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="cumulative"] {
  background: linear-gradient(180deg, #8f7254 0%, #735b44 100%);
}

body[data-theme="bright"] .floating-window-selected > h2 {
  background: linear-gradient(180deg, rgba(250, 237, 38, 1) 0%, rgba(228, 214, 31, 1) 100%);
  border-bottom-color: rgba(157, 141, 143, 0.34);
  color: #322a1a;
}

body[data-theme="bright"] .selected-panel-close {
  border-color: rgba(157, 141, 143, 0.42);
  background: rgba(70, 52, 78, 0.9);
  color: #f5f2dc;
}

body[data-theme="bright"] .selected-panel-close:hover {
  background: rgba(79, 58, 89, 0.96);
  border-color: rgba(216, 195, 165, 0.56);
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="manual"] > h2 {
  background: linear-gradient(180deg, rgba(232, 90, 79, 1) 0%, rgba(208, 71, 61, 1) 100%);
  color: #f8f6e6;
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="ratio"] > h2 {
  background: linear-gradient(180deg, #8db2ff 0%, #6f95e6 100%);
  border-bottom-color: rgba(122, 151, 214, 0.48);
  color: #f8f6e6;
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="retention"] > h2 {
  background: linear-gradient(180deg, #8b76b3 0%, #735f98 100%);
  border-bottom-color: rgba(152, 133, 199, 0.48);
  color: #f8f6e6;
}

body[data-theme="bright"] .floating-window-selected[data-metric-tone="cumulative"] > h2 {
  background: linear-gradient(180deg, #ddb35c 0%, #c89643 100%);
  border-bottom-color: rgba(214, 176, 97, 0.5);
  color: #322a1a;
}

body[data-theme="bright"] .panel h2 {
  color: #faed26;
}

body[data-theme="bright"] label {
  color: rgba(234, 231, 220, 0.84);
}

body[data-theme="bright"] input:not([type="checkbox"]),
body[data-theme="bright"] select {
  border-color: rgba(157, 141, 143, 0.52);
  background: rgba(72, 60, 82, 0.95);
  color: #f5f2dc;
}

body[data-theme="bright"] input[type="checkbox"] {
  border-color: rgba(157, 141, 143, 0.54);
  background: rgba(70, 52, 78, 0.68);
}

body[data-theme="bright"] .primary-btn {
  background: linear-gradient(135deg, #faed26 0%, #d5c819 100%);
  color: #46344e;
  box-shadow: 0 5px 12px rgba(250, 237, 38, 0.28);
}

body[data-theme="bright"] .ghost-btn {
  background: rgba(70, 52, 78, 0.56);
  border-color: rgba(157, 141, 143, 0.46);
  color: #f5f2dc;
}

body[data-theme="bright"] .hint {
  color: rgba(234, 231, 220, 0.7);
}

body[data-theme="bright"] .canvas-wrap {
  background: #534f5b;
}

body[data-theme="bright"] .canvas-toolbar {
  border-bottom-color: rgba(157, 141, 143, 0.34);
  background: rgba(70, 52, 78, 0.7);
}

body[data-theme="bright"] .toolbar-brand {
  border-color: rgba(157, 141, 143, 0.44);
  background: rgba(70, 52, 78, 0.78);
}

body[data-theme="bright"] .canvas-toolbar > span {
  color: #faed26;
}

body[data-theme="bright"] #stats {
  color: rgba(234, 231, 220, 0.74);
}

body[data-theme="bright"] .toolbar-storage-status {
  color: rgba(234, 231, 220, 0.74);
}

body[data-theme="bright"] .zoom-btn,
body[data-theme="bright"] .toolbar-storage-btn,
body[data-theme="bright"] .toolbar-template-select,
body[data-theme="bright"] .chart-control-btn,
body[data-theme="bright"] .chart-settings-select,
body[data-theme="bright"] .chart-settings-number,
body[data-theme="bright"] .show-chart-btn {
  border-color: rgba(157, 141, 143, 0.5);
  background: rgba(70, 52, 78, 0.58);
  color: #f5f2dc;
}

body[data-theme="bright"] .toolbar-admin-badge {
  border-color: rgba(250, 237, 38, 0.42);
  background: rgba(70, 52, 78, 0.76);
  color: #faed26;
}

body[data-theme="bright"] .chart-settings-item {
  color: rgba(234, 231, 220, 0.8);
}

body[data-theme="bright"] .toolbar-theme-select {
  border-color: rgba(157, 141, 143, 0.5);
  color: #f5f2dc;
  background: rgba(72, 60, 82, 0.97);
}

body[data-theme="bright"] .toolbar-storage-btn--primary,
body[data-theme="bright"] .zoom-btn.is-active {
  background: rgba(250, 237, 38, 0.94);
  border-color: rgba(250, 237, 38, 0.86);
  color: #46344e;
}

body[data-theme="bright"] .zoom-level,
body[data-theme="bright"] .sim-counter {
  color: #faed26;
}

body[data-theme="bright"] .workspace {
  background-color: #5a5560;
  background-image:
    linear-gradient(rgba(157, 141, 143, 0.23) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 141, 143, 0.23) 1px, transparent 1px);
}

body[data-theme="bright"] .metric-chart-panel {
  border-color: rgba(157, 141, 143, 0.44);
  background: rgba(70, 52, 78, 0.64);
}

body[data-theme="bright"] #metric-chart-title {
  color: #faed26;
}

body[data-theme="bright"] #metric-chart-meta {
  color: rgba(234, 231, 220, 0.7);
}

body[data-theme="bright"] .metric-node {
  background: linear-gradient(180deg, rgba(90, 85, 96, 1) 0%, rgba(70, 52, 78, 1) 100%);
  border-color: rgba(157, 141, 143, 0.46);
}

body[data-theme="bright"] .metric-node.source-node {
  background: linear-gradient(180deg, #3f8d96 0%, #2f6f78 100%);
  border-color: rgba(111, 197, 207, 0.52);
}

body[data-theme="bright"] .metric-node.retention-node {
  background: linear-gradient(180deg, #5f5377 0%, #4c4362 100%);
  border-color: rgba(179, 160, 219, 0.6);
}

body[data-theme="bright"] .metric-node.cumulative-node {
  background: linear-gradient(180deg, #8f7254 0%, #735b44 100%);
  border-color: rgba(230, 201, 132, 0.62);
}

body[data-theme="bright"] .metric-node.note-node {
  background: linear-gradient(180deg, #fff07f 0%, #e5d955 100%);
  border-color: rgba(229, 214, 86, 0.74);
}

body[data-theme="bright"] .metric-node.manual-node {
  background: linear-gradient(180deg, rgba(138, 114, 143, 1) 0%, rgba(111, 92, 118, 1) 100%);
  border-color: rgba(194, 164, 201, 0.58);
}

body[data-theme="bright"] .metric-node.ratio-node {
  background: linear-gradient(180deg, #5a6788 0%, #475575 100%);
  border-color: rgba(146, 170, 222, 0.6);
}

body[data-theme="bright"] .metric-node.disabled-node {
  background: rgba(78, 73, 85, 1);
  border-color: rgba(157, 141, 143, 0.44);
}

body[data-theme="bright"] .metric-node-header {
  background: linear-gradient(180deg, rgba(250, 237, 38, 1) 0%, rgba(228, 214, 31, 1) 100%);
  border-bottom-color: rgba(157, 141, 143, 0.34);
}

body[data-theme="bright"] .metric-node-header .metric-node-title {
  color: #322a1a;
}

body[data-theme="bright"] .metric-node-header .metric-node-type {
  color: rgba(50, 42, 26, 0.78);
}

body[data-theme="bright"] .metric-node.source-node .metric-node-header {
  background: linear-gradient(180deg, #14a098 0%, #0f7f78 100%);
  border-bottom-color: rgba(93, 175, 183, 0.46);
}

body[data-theme="bright"] .metric-node.retention-node .metric-node-header {
  background: linear-gradient(180deg, #8b76b3 0%, #735f98 100%);
  border-bottom-color: rgba(152, 133, 199, 0.48);
}

body[data-theme="bright"] .metric-node.cumulative-node .metric-node-header {
  background: linear-gradient(180deg, #ddb35c 0%, #c89643 100%);
  border-bottom-color: rgba(214, 176, 97, 0.5);
}

body[data-theme="bright"] .metric-node.note-node .metric-node-header {
  background: linear-gradient(180deg, #f9eb3a 0%, #e7da2b 100%);
  border-bottom-color: rgba(179, 167, 48, 0.52);
}

body[data-theme="bright"] .metric-node.manual-node .metric-node-header {
  background: linear-gradient(180deg, rgba(232, 90, 79, 1) 0%, rgba(208, 71, 61, 1) 100%);
}

body[data-theme="bright"] .metric-node.ratio-node .metric-node-header {
  background: linear-gradient(180deg, #8db2ff 0%, #6f95e6 100%);
  border-bottom-color: rgba(122, 151, 214, 0.48);
}

body[data-theme="bright"] .metric-node.disabled-node .metric-node-header {
  background: linear-gradient(180deg, rgba(157, 141, 143, 1) 0%, rgba(132, 117, 119, 1) 100%);
}

body[data-theme="bright"] .metric-node-title {
  color: #f6f1d4;
}

body[data-theme="bright"] .metric-node-type,
body[data-theme="bright"] .metric-formula {
  color: rgba(234, 231, 220, 0.7);
}

body[data-theme="bright"] .metric-value {
  color: #f8f6e6;
}

body[data-theme="bright"] .node-delete,
body[data-theme="bright"] .node-toggle,
body[data-theme="bright"] .node-action-trigger,
body[data-theme="bright"] .node-chart,
body[data-theme="bright"] .node-duplicate {
  border-color: rgba(157, 141, 143, 0.42);
  background: rgba(70, 52, 78, 0.9);
}

body[data-theme="bright"] .node-delete {
  color: #e98074;
}

body[data-theme="bright"] .node-toggle {
  color: #faed26;
}

body[data-theme="bright"] .node-duplicate {
  color: #d8c3a5;
}

body[data-theme="bright"] .value-adjust {
  border-color: rgba(157, 141, 143, 0.46);
  background: rgba(70, 52, 78, 0.56);
  color: #f5f2dc;
}

body[data-theme="bright"] .port {
  border-color: rgba(250, 237, 38, 0.86);
  background: #faed26;
  box-shadow: 0 0 0 1px rgba(250, 237, 38, 0.34);
}

body[data-theme="bright"] .edge-label-bg {
  fill: rgba(70, 52, 78, 0.74);
  stroke: rgba(157, 141, 143, 0.46);
}

body[data-theme="bright"] .edge-label {
  fill: #f5f2dc;
  stroke: rgba(70, 52, 78, 0.88);
}

body[data-theme="bright"] .edge-delete-circle {
  fill: #fff8e0;
  stroke: #e85a4f;
}

body[data-theme="bright"] .selected-metric-grid dt,
body[data-theme="bright"] .selected-section-title,
body[data-theme="bright"] .dependency-list,
body[data-theme="bright"] .cohort-table th,
body[data-theme="bright"] .cohort-table td {
  color: #f5f2dc;
}

body[data-theme="bright"] .sensitivity-driver-name,
body[data-theme="bright"] .sensitivity-heat-head,
body[data-theme="bright"] .sensitivity-impact,
body[data-theme="bright"] .sensitivity-top-list {
  color: #f5f2dc;
}

body[data-theme="bright"] .sensitivity-cell {
  border-color: rgba(157, 141, 143, 0.38);
  color: #fffbe8;
}

body[data-theme="bright"] .goal-seek-run-btn {
  border-color: rgba(157, 141, 143, 0.46);
  background: rgba(250, 237, 38, 0.2);
  color: #f5f2dc;
}

body[data-theme="bright"] .goal-seek-list {
  color: #f5f2dc;
}

body[data-theme="bright"] .selected-metric-grid dd {
  color: #fffbe8;
}

body[data-theme="bright"] .selected-section {
  border-top-color: rgba(157, 141, 143, 0.3);
}

body[data-theme="bright"] .selected-section-card {
  border-color: rgba(157, 141, 143, 0.34);
  background: rgba(70, 52, 78, 0.5);
}

body[data-theme="bright"] .summary-row {
  border-color: rgba(157, 141, 143, 0.3);
  background: rgba(70, 52, 78, 0.56);
}

body[data-theme="bright"] .summary-label,
body[data-theme="bright"] .driver-explain-name,
body[data-theme="bright"] .driver-explain-share {
  color: #f5f2dc;
}

body[data-theme="bright"] .summary-value,
body[data-theme="bright"] .summary-formula,
body[data-theme="bright"] .summary-inline-value {
  color: #fffbe8;
}

body[data-theme="bright"] .summary-inline-meta,
body[data-theme="bright"] .summary-inline-label {
  color: #f5f2dc;
}

body[data-theme="bright"] .validation-ok-hint {
  color: #e6dbcb;
}

body[data-theme="bright"] .cohort-breakdown {
  border-color: rgba(157, 141, 143, 0.4);
  background: rgba(70, 52, 78, 0.54);
}

body[data-theme="bright"] .cohort-table th {
  background: rgba(250, 237, 38, 0.16);
}

body[data-theme="bright"] .cohort-table th,
body[data-theme="bright"] .cohort-table td {
  border-bottom-color: rgba(157, 141, 143, 0.24);
}

body[data-theme="bright"] .retention-editor-wrap {
  border-color: rgba(157, 141, 143, 0.38);
  background: rgba(70, 52, 78, 0.54);
}

body[data-theme="icons"] {
  background: #0f292f;
  color: #f2f2f2;
}

body[data-theme="icons"] .sidebar {
  border-right-color: rgba(20, 160, 152, 0.42);
  background: linear-gradient(180deg, rgba(15, 41, 47, 0.97) 0%, rgba(18, 63, 72, 0.97) 100%);
}

body[data-theme="icons"] h1 {
  color: #14a098;
}

body[data-theme="icons"] .subtitle {
  color: rgba(204, 204, 204, 0.74);
}

body[data-theme="icons"] .panel {
  background: rgba(80, 31, 58, 0.5);
  border-color: rgba(203, 45, 111, 0.42);
}

body[data-theme="icons"] .auth-modal-card {
  background: rgba(80, 31, 58, 0.88);
}

body[data-theme="icons"] .floating-window.panel {
  background: rgba(80, 31, 58, 0.85);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="metric"] {
  background: linear-gradient(180deg, rgba(80, 31, 58, 1) 0%, rgba(56, 23, 42, 1) 100%);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="manual"] {
  background: linear-gradient(180deg, rgba(160, 92, 92, 1) 0%, rgba(127, 72, 72, 1) 100%);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="ratio"] {
  background: linear-gradient(180deg, #2e4a6d 0%, #243a56 100%);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="retention"] {
  background: linear-gradient(180deg, #6f3d83 0%, #582f69 100%);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="cumulative"] {
  background: linear-gradient(180deg, #806e2f 0%, #675924 100%);
}

body[data-theme="icons"] .floating-window-selected > h2 {
  background: linear-gradient(180deg, rgba(203, 45, 111, 1) 0%, rgba(176, 31, 96, 1) 100%);
  border-bottom-color: rgba(203, 45, 111, 0.34);
  color: #f2f2f2;
}

body[data-theme="icons"] .selected-panel-close {
  border-color: rgba(20, 160, 152, 0.42);
  background: rgba(15, 41, 47, 0.92);
  color: #f2f2f2;
}

body[data-theme="icons"] .selected-panel-close:hover {
  background: rgba(19, 52, 58, 0.98);
  border-color: rgba(20, 160, 152, 0.56);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="manual"] > h2 {
  background: linear-gradient(180deg, rgba(20, 160, 152, 1) 0%, rgba(15, 136, 129, 1) 100%);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="ratio"] > h2 {
  background: linear-gradient(180deg, #63b2ff 0%, #418ddb 100%);
  border-bottom-color: rgba(92, 154, 220, 0.5);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="retention"] > h2 {
  background: linear-gradient(180deg, #cb2d6f 0%, #a9245a 100%);
  border-bottom-color: rgba(238, 121, 185, 0.5);
}

body[data-theme="icons"] .floating-window-selected[data-metric-tone="cumulative"] > h2 {
  background: linear-gradient(180deg, #faed26 0%, #d6ca1f 100%);
  border-bottom-color: rgba(250, 221, 103, 0.54);
  color: #2f2810;
}

body[data-theme="icons"] .panel h2 {
  color: #cb2d6f;
}

body[data-theme="icons"] label {
  color: rgba(204, 204, 204, 0.88);
}

body[data-theme="icons"] input:not([type="checkbox"]),
body[data-theme="icons"] select {
  border-color: rgba(20, 160, 152, 0.52);
  background: rgba(18, 54, 61, 0.95);
  color: #f2f2f2;
}

body[data-theme="icons"] input[type="checkbox"] {
  border-color: rgba(20, 160, 152, 0.56);
  background: rgba(15, 41, 47, 0.72);
}

body[data-theme="icons"] .primary-btn {
  background: linear-gradient(135deg, #cb2d6f 0%, #a82459 100%);
  box-shadow: 0 5px 12px rgba(203, 45, 111, 0.3);
}

body[data-theme="icons"] .ghost-btn {
  background: rgba(15, 41, 47, 0.58);
  border-color: rgba(20, 160, 152, 0.48);
  color: #e9f1f0;
}

body[data-theme="icons"] .hint {
  color: rgba(204, 204, 204, 0.72);
}

body[data-theme="icons"] .canvas-wrap {
  background: #0f292f;
}

body[data-theme="icons"] .canvas-toolbar {
  border-bottom-color: rgba(20, 160, 152, 0.3);
  background: rgba(15, 41, 47, 0.88);
}

body[data-theme="icons"] .toolbar-brand {
  border-color: rgba(20, 160, 152, 0.44);
  background: rgba(15, 41, 47, 0.8);
}

body[data-theme="icons"] .canvas-toolbar > span {
  color: #14a098;
}

body[data-theme="icons"] #stats {
  color: rgba(204, 204, 204, 0.74);
}

body[data-theme="icons"] .toolbar-storage-status {
  color: rgba(204, 204, 204, 0.74);
}

body[data-theme="icons"] .zoom-btn,
body[data-theme="icons"] .toolbar-storage-btn,
body[data-theme="icons"] .toolbar-template-select,
body[data-theme="icons"] .chart-control-btn,
body[data-theme="icons"] .chart-settings-select,
body[data-theme="icons"] .chart-settings-number,
body[data-theme="icons"] .show-chart-btn {
  border-color: rgba(20, 160, 152, 0.48);
  background: rgba(15, 41, 47, 0.64);
  color: #f0f5f5;
}

body[data-theme="icons"] .toolbar-admin-badge {
  border-color: rgba(203, 45, 111, 0.44);
  background: rgba(80, 31, 58, 0.82);
  color: #ff8bc2;
}

body[data-theme="icons"] .chart-settings-item {
  color: rgba(204, 204, 204, 0.84);
}

body[data-theme="icons"] .toolbar-theme-select {
  border-color: rgba(20, 160, 152, 0.5);
  color: #f2f2f2;
  background: rgba(18, 54, 61, 0.97);
}

body[data-theme="icons"] .toolbar-storage-btn--primary,
body[data-theme="icons"] .zoom-btn.is-active {
  background: rgba(20, 160, 152, 0.96);
  border-color: rgba(20, 160, 152, 0.86);
  color: #0f292f;
}

body[data-theme="dark"] .show-chart-btn {
  background: rgba(22, 30, 43, 0.99);
}

body[data-theme="light"] .show-chart-btn {
  background: rgba(245, 255, 252, 0.98);
}

body[data-theme="sand"] .show-chart-btn {
  background: rgba(255, 252, 246, 0.98);
}

body[data-theme="bright"] .show-chart-btn {
  background: rgba(70, 52, 78, 0.96);
}

body[data-theme="icons"] .show-chart-btn {
  background: rgba(15, 41, 47, 0.96);
}

body[data-theme="icons"] .zoom-level,
body[data-theme="icons"] .sim-counter {
  color: #cccccc;
}

body[data-theme="icons"] .workspace {
  background-color: #0f292f;
  background-image:
    linear-gradient(rgba(20, 160, 152, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 160, 152, 0.2) 1px, transparent 1px);
}

body[data-theme="icons"] .metric-chart-panel {
  border-color: rgba(203, 45, 111, 0.44);
  background: rgba(80, 31, 58, 0.6);
}

body[data-theme="icons"] #metric-chart-title {
  color: #14a098;
}

body[data-theme="icons"] #metric-chart-meta {
  color: rgba(204, 204, 204, 0.72);
}

body[data-theme="icons"] .metric-node {
  background: linear-gradient(180deg, rgba(80, 31, 58, 1) 0%, rgba(56, 23, 42, 1) 100%);
  border-color: rgba(203, 45, 111, 0.46);
}

body[data-theme="icons"] .metric-node.source-node {
  background: linear-gradient(180deg, #1cb7ad 0%, #138f87 100%);
  border-color: rgba(127, 238, 229, 0.54);
}

body[data-theme="icons"] .metric-node.retention-node {
  background: linear-gradient(180deg, #6f3d83 0%, #582f69 100%);
  border-color: rgba(232, 125, 208, 0.58);
}

body[data-theme="icons"] .metric-node.cumulative-node {
  background: linear-gradient(180deg, #806e2f 0%, #675924 100%);
  border-color: rgba(250, 221, 103, 0.64);
}

body[data-theme="icons"] .metric-node.note-node {
  background: linear-gradient(180deg, #ffe36f 0%, #f2d043 100%);
  border-color: rgba(232, 206, 80, 0.72);
}

body[data-theme="icons"] .metric-node.manual-node {
  background: linear-gradient(180deg, rgba(160, 92, 92, 1) 0%, rgba(127, 72, 72, 1) 100%);
  border-color: rgba(227, 142, 142, 0.54);
}

body[data-theme="icons"] .metric-node.ratio-node {
  background: linear-gradient(180deg, #2e4a6d 0%, #243a56 100%);
  border-color: rgba(125, 185, 255, 0.6);
}

body[data-theme="icons"] .metric-node.disabled-node {
  background: rgba(64, 64, 64, 1);
  border-color: rgba(140, 140, 140, 0.42);
}

body[data-theme="icons"] .metric-node-header {
  background: linear-gradient(180deg, rgba(203, 45, 111, 1) 0%, rgba(176, 31, 96, 1) 100%);
  border-bottom-color: rgba(203, 45, 111, 0.34);
}

body[data-theme="icons"] .metric-node.source-node .metric-node-header {
  background: linear-gradient(180deg, #0f292f 0%, #0b2025 100%);
  border-bottom-color: rgba(103, 214, 205, 0.44);
}

body[data-theme="icons"] .metric-node.retention-node .metric-node-header {
  background: linear-gradient(180deg, #cb2d6f 0%, #a9245a 100%);
  border-bottom-color: rgba(238, 121, 185, 0.5);
}

body[data-theme="icons"] .metric-node.cumulative-node .metric-node-header {
  background: linear-gradient(180deg, #faed26 0%, #d6ca1f 100%);
  border-bottom-color: rgba(250, 221, 103, 0.54);
}

body[data-theme="icons"] .metric-node.note-node .metric-node-header {
  background: linear-gradient(180deg, #ffe652 0%, #f4d134 100%);
  border-bottom-color: rgba(204, 177, 52, 0.54);
}

body[data-theme="icons"] .metric-node.cumulative-node .metric-node-title {
  color: #2f2810;
}

body[data-theme="icons"] .metric-node.cumulative-node .metric-node-type {
  color: rgba(47, 40, 16, 0.78);
}

body[data-theme="icons"] .metric-node.manual-node .metric-node-header {
  background: linear-gradient(180deg, rgba(20, 160, 152, 1) 0%, rgba(15, 136, 129, 1) 100%);
}

body[data-theme="icons"] .metric-node.ratio-node .metric-node-header {
  background: linear-gradient(180deg, #63b2ff 0%, #418ddb 100%);
  border-bottom-color: rgba(92, 154, 220, 0.5);
}

body[data-theme="icons"] .metric-node.disabled-node .metric-node-header {
  background: linear-gradient(180deg, rgba(120, 120, 120, 1) 0%, rgba(94, 94, 94, 1) 100%);
}

body[data-theme="icons"] .metric-node-title {
  color: #f2f2f2;
}

body[data-theme="icons"] .metric-node-type,
body[data-theme="icons"] .metric-formula {
  color: rgba(204, 204, 204, 0.72);
}

body[data-theme="icons"] .metric-value {
  color: #ffffff;
}

body[data-theme="icons"] .node-delete,
body[data-theme="icons"] .node-toggle,
body[data-theme="icons"] .node-action-trigger,
body[data-theme="icons"] .node-chart,
body[data-theme="icons"] .node-duplicate {
  border-color: rgba(20, 160, 152, 0.4);
  background: rgba(15, 41, 47, 0.9);
}

body[data-theme="icons"] .node-delete {
  color: #cb2d6f;
}

body[data-theme="icons"] .node-toggle {
  color: #14a098;
}

body[data-theme="icons"] .node-duplicate {
  color: #cccccc;
}

body[data-theme="icons"] .value-adjust {
  border-color: rgba(20, 160, 152, 0.44);
  background: rgba(15, 41, 47, 0.58);
  color: #f2f2f2;
}

body[data-theme="icons"] .port {
  border-color: rgba(20, 160, 152, 0.9);
  background: #14a098;
  box-shadow: 0 0 0 1px rgba(20, 160, 152, 0.38);
}

body[data-theme="icons"] .edge-label-bg {
  fill: rgba(15, 41, 47, 0.8);
  stroke: rgba(20, 160, 152, 0.46);
}

body[data-theme="dark"] .zoom-btn.sim-play-active,
body[data-theme="light"] .zoom-btn.sim-play-active,
body[data-theme="sand"] .zoom-btn.sim-play-active,
body[data-theme="bright"] .zoom-btn.sim-play-active,
body[data-theme="icons"] .zoom-btn.sim-play-active {
  background: rgba(36, 175, 101, 0.95);
  border-color: rgba(74, 222, 128, 0.72);
  color: #f4fff8;
}

body[data-theme="dark"] .zoom-btn.sim-pause-active,
body[data-theme="light"] .zoom-btn.sim-pause-active,
body[data-theme="sand"] .zoom-btn.sim-pause-active,
body[data-theme="bright"] .zoom-btn.sim-pause-active,
body[data-theme="icons"] .zoom-btn.sim-pause-active {
  background: rgba(234, 138, 46, 0.95);
  border-color: rgba(251, 191, 114, 0.74);
  color: #fff8ed;
}

body[data-theme="dark"] .zoom-btn.sim-stop-active,
body[data-theme="light"] .zoom-btn.sim-stop-active,
body[data-theme="sand"] .zoom-btn.sim-stop-active,
body[data-theme="bright"] .zoom-btn.sim-stop-active,
body[data-theme="icons"] .zoom-btn.sim-stop-active {
  background: rgba(218, 79, 79, 0.95);
  border-color: rgba(248, 136, 136, 0.72);
  color: #fff3f3;
}

body[data-theme="dark"] .zoom-btn.sim-play-active:disabled,
body[data-theme="light"] .zoom-btn.sim-play-active:disabled,
body[data-theme="sand"] .zoom-btn.sim-play-active:disabled,
body[data-theme="bright"] .zoom-btn.sim-play-active:disabled,
body[data-theme="icons"] .zoom-btn.sim-play-active:disabled,
body[data-theme="dark"] .zoom-btn.sim-pause-active:disabled,
body[data-theme="light"] .zoom-btn.sim-pause-active:disabled,
body[data-theme="sand"] .zoom-btn.sim-pause-active:disabled,
body[data-theme="bright"] .zoom-btn.sim-pause-active:disabled,
body[data-theme="icons"] .zoom-btn.sim-pause-active:disabled,
body[data-theme="dark"] .zoom-btn.sim-stop-active:disabled,
body[data-theme="light"] .zoom-btn.sim-stop-active:disabled,
body[data-theme="sand"] .zoom-btn.sim-stop-active:disabled,
body[data-theme="bright"] .zoom-btn.sim-stop-active:disabled,
body[data-theme="icons"] .zoom-btn.sim-stop-active:disabled {
  opacity: 1;
}

body[data-theme="icons"] .edge-label {
  fill: #f2f2f2;
  stroke: rgba(15, 41, 47, 0.86);
}

body[data-theme="icons"] .edge-delete-circle {
  fill: #ffe6f0;
  stroke: #cb2d6f;
}

body[data-theme="icons"] .selected-metric-grid dt,
body[data-theme="icons"] .selected-section-title,
body[data-theme="icons"] .dependency-list,
body[data-theme="icons"] .cohort-table th,
body[data-theme="icons"] .cohort-table td {
  color: #f2f2f2;
}

body[data-theme="icons"] .sensitivity-driver-name,
body[data-theme="icons"] .sensitivity-heat-head,
body[data-theme="icons"] .sensitivity-impact,
body[data-theme="icons"] .sensitivity-top-list {
  color: #f2f2f2;
}

body[data-theme="icons"] .sensitivity-cell {
  border-color: rgba(20, 160, 152, 0.4);
  color: #ffffff;
}

body[data-theme="icons"] .goal-seek-run-btn {
  border-color: rgba(20, 160, 152, 0.42);
  background: rgba(20, 160, 152, 0.2);
  color: #f2f2f2;
}

body[data-theme="icons"] .goal-seek-list {
  color: #f2f2f2;
}

body[data-theme="icons"] .selected-metric-grid dd {
  color: #ffffff;
}

body[data-theme="icons"] .selected-section {
  border-top-color: rgba(20, 160, 152, 0.3);
}

body[data-theme="icons"] .selected-section-card {
  border-color: rgba(20, 160, 152, 0.34);
  background: rgba(15, 41, 47, 0.52);
}

body[data-theme="icons"] .summary-row {
  border-color: rgba(20, 160, 152, 0.32);
  background: rgba(15, 41, 47, 0.58);
}

body[data-theme="icons"] .summary-label,
body[data-theme="icons"] .driver-explain-name,
body[data-theme="icons"] .driver-explain-share {
  color: #f2f2f2;
}

body[data-theme="icons"] .summary-value,
body[data-theme="icons"] .summary-formula,
body[data-theme="icons"] .summary-inline-value {
  color: #ffffff;
}

body[data-theme="icons"] .summary-inline-meta,
body[data-theme="icons"] .summary-inline-label {
  color: #f2f2f2;
}

body[data-theme="icons"] .validation-ok-hint {
  color: #9ddfdb;
}

body[data-theme="icons"] .cohort-breakdown {
  border-color: rgba(20, 160, 152, 0.38);
  background: rgba(15, 41, 47, 0.56);
}

body[data-theme="icons"] .cohort-table th {
  background: rgba(203, 45, 111, 0.28);
}

body[data-theme="icons"] .cohort-table th,
body[data-theme="icons"] .cohort-table td {
  border-bottom-color: rgba(20, 160, 152, 0.24);
}

body[data-theme="icons"] .retention-editor-wrap {
  border-color: rgba(20, 160, 152, 0.36);
  background: rgba(15, 41, 47, 0.56);
}

.edges-layer,
.nodes-layer {
  position: absolute;
  inset: 0;
}

.nodes-layer {
  pointer-events: none;
  transform-origin: 0 0;
}

.sticky-note {
  position: absolute;
  width: 152px;
  min-height: 106px;
  border-radius: 6px;
  border: 1px solid rgba(189, 142, 27, 0.6);
  background: #f6d66d;
  box-shadow:
    0 10px 24px rgba(27, 21, 7, 0.24),
    inset 0 -8px 18px rgba(200, 149, 36, 0.2);
  pointer-events: auto;
  cursor: grab;
  padding: 10px 10px 9px;
}

.sticky-note.selected {
  box-shadow:
    0 0 0 2px rgba(255, 226, 135, 0.8),
    0 10px 24px rgba(27, 21, 7, 0.24),
    inset 0 -8px 18px rgba(200, 149, 36, 0.2);
}

.sticky-note:active {
  cursor: grabbing;
}

.sticky-note-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(81, 52, 7, 0.14);
  color: rgba(81, 52, 7, 0.9);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 120ms ease;
}

.sticky-note:hover .sticky-note-delete,
.sticky-note.selected .sticky-note-delete {
  opacity: 1;
}


.sticky-note-content {
  font-size: 12px;
  line-height: 1.38;
  color: #4f3c11;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 84px;
  padding-right: 16px;
  user-select: none;
}

.sticky-note.is-editing-note {
  cursor: text;
}

.sticky-note.is-editing-note .sticky-note-content {
  outline: 1px dashed rgba(95, 74, 18, 0.4);
  border-radius: 4px;
  padding: 3px 4px;
  background: rgba(255, 247, 205, 0.45);
  user-select: text;
  cursor: text;
}

.metric-node {
  position: absolute;
  width: 148px;
  min-height: 72px;
  background: linear-gradient(180deg, rgba(40, 48, 62, 0.98) 0%, rgba(36, 44, 58, 0.98) 100%);
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: var(--shadow);
  user-select: none;
  pointer-events: auto;
  cursor: grab;
}

.metric-node.manual-node {
  background: linear-gradient(180deg, rgba(60, 52, 68, 0.98) 0%, rgba(48, 42, 57, 0.98) 100%);
  border-color: rgba(201, 139, 168, 0.42);
  box-shadow: inset 0 0 0 1px rgba(201, 139, 168, 0.11), var(--shadow);
}

.metric-node.ratio-node {
  background: linear-gradient(180deg, rgba(44, 53, 88, 0.98) 0%, rgba(36, 45, 75, 0.98) 100%);
  border-color: rgba(126, 154, 236, 0.46);
  box-shadow: inset 0 0 0 1px rgba(126, 154, 236, 0.13), var(--shadow);
}

.metric-node.source-node {
  background: linear-gradient(180deg, rgba(38, 76, 87, 0.98) 0%, rgba(30, 62, 72, 0.98) 100%);
  border-color: rgba(84, 180, 190, 0.42);
  box-shadow: inset 0 0 0 1px rgba(84, 180, 190, 0.12), var(--shadow);
}

.metric-node.retention-node {
  background: linear-gradient(180deg, rgba(57, 66, 102, 0.98) 0%, rgba(43, 53, 86, 0.98) 100%);
  border-color: rgba(138, 156, 244, 0.5);
  box-shadow: inset 0 0 0 1px rgba(138, 156, 244, 0.14), var(--shadow);
}

.metric-node.cumulative-node {
  background: linear-gradient(180deg, rgba(70, 63, 47, 0.98) 0%, rgba(56, 50, 38, 0.98) 100%);
  border-color: rgba(231, 192, 110, 0.5);
  box-shadow: inset 0 0 0 1px rgba(231, 192, 110, 0.14), var(--shadow);
}

.metric-node.note-node {
  background: linear-gradient(180deg, rgba(255, 235, 170, 0.98) 0%, rgba(248, 218, 122, 0.98) 100%);
  border-color: rgba(206, 152, 36, 0.64);
  box-shadow: inset 0 0 0 1px rgba(206, 152, 36, 0.24), var(--shadow);
}

.metric-node.disabled-node {
  background: rgba(51, 65, 85, 0.72);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 6px 14px rgba(2, 6, 23, 0.28);
}

.metric-node.disabled-node .metric-node-title,
.metric-node.disabled-node .metric-value,
.metric-node.disabled-node .metric-formula,
.metric-node.disabled-node .metric-node-type {
  color: #9ca3af;
}

.metric-node.disabled-node .port {
  opacity: 0 !important;
  pointer-events: none !important;
}

.metric-node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow);
}

.metric-node.linking-source {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(219, 193, 115, 0.28), var(--shadow);
}

.metric-node.linking-target {
  cursor: pointer;
}

.metric-node.benchmark-over {
  border-color: rgba(52, 211, 153, 0.72) !important;
  animation: benchmarkPulseOver 1.6s ease-in-out infinite;
}

.metric-node.benchmark-under {
  border-color: rgba(248, 113, 113, 0.72) !important;
  animation: benchmarkPulseUnder 1.6s ease-in-out infinite;
}

@keyframes benchmarkPulseOver {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(52, 211, 153, 0.1),
      var(--shadow);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(52, 211, 153, 0.22),
      var(--shadow);
  }
}

@keyframes benchmarkPulseUnder {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(248, 113, 113, 0.1),
      var(--shadow);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(248, 113, 113, 0.2),
      var(--shadow);
  }
}

.metric-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  padding: 6px 8px;
  padding-right: 30px;
  position: relative;
  background: linear-gradient(180deg, rgba(82, 109, 167, 0.18) 0%, rgba(62, 84, 133, 0.1) 100%);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  cursor: inherit;
}

.metric-node:active {
  cursor: grabbing;
}

.metric-node.manual-node .metric-node-header {
  background: linear-gradient(180deg, rgba(199, 166, 83, 0.22) 0%, rgba(168, 137, 66, 0.12) 100%);
}

.metric-node.ratio-node .metric-node-header {
  background: linear-gradient(180deg, rgba(123, 164, 236, 0.36) 0%, rgba(93, 134, 210, 0.22) 100%);
  border-bottom-color: rgba(126, 154, 236, 0.34);
}

.metric-node.source-node .metric-node-header {
  background: linear-gradient(180deg, rgba(36, 133, 146, 0.34) 0%, rgba(28, 110, 121, 0.2) 100%);
  border-bottom-color: rgba(84, 180, 190, 0.3);
}

.metric-node.retention-node .metric-node-header {
  background: linear-gradient(180deg, rgba(126, 145, 239, 0.36) 0%, rgba(101, 121, 215, 0.22) 100%);
  border-bottom-color: rgba(138, 156, 244, 0.34);
}

.metric-node.cumulative-node .metric-node-header {
  background: linear-gradient(180deg, rgba(226, 185, 99, 0.36) 0%, rgba(198, 157, 76, 0.22) 100%);
  border-bottom-color: rgba(231, 192, 110, 0.34);
}

.metric-node.note-node .metric-node-header {
  background: linear-gradient(180deg, rgba(255, 242, 190, 0.95) 0%, rgba(243, 210, 104, 0.86) 100%);
  border-bottom-color: rgba(179, 126, 25, 0.34);
}

.metric-node.disabled-node .metric-node-header {
  background: linear-gradient(180deg, rgba(116, 127, 144, 0.18) 0%, rgba(97, 109, 126, 0.1) 100%);
}

.node-header-actions {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.node-action-trigger {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(20, 27, 38, 0.9);
  color: #d6e0ed;
  line-height: 0;
}

.node-action-trigger .lucide,
.node-action-item .lucide {
  display: block;
}

.node-action-items {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.node-action-item {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0;
  transition:
    transform 180ms ease,
    opacity 140ms ease;
}

.metric-node.action-menu-open .node-action-item {
  display: inline-flex;
  opacity: 1;
  pointer-events: auto;
}

.node-action-item.hidden {
  display: none !important;
}

.metric-node.action-menu-open .node-action-item-toggle {
  transform: translate(-50%, -50%) translate(-34px, -10px) scale(1);
}

.metric-node.action-menu-open .node-action-item-duplicate {
  transform: translate(-50%, -50%) translate(18px, -30px) scale(1);
}

.metric-node.action-menu-open .node-action-item-delete {
  transform: translate(-50%, -50%) translate(34px, -10px) scale(1);
}

.metric-node.action-menu-open .node-action-item-chart {
  transform: translate(-50%, -50%) translate(-18px, -30px) scale(1);
}

.metric-node.action-menu-open .node-action-item-cohorts {
  transform: translate(-50%, -50%) translate(0, -36px) scale(1);
}

.metric-node-title {
  margin: 0;
  font-size: 11px;
  letter-spacing: -0.2px;
  line-height: 1.1;
}

.metric-node-type {
  margin: 2px 0 0;
  font-size: 8.5px;
  color: #b5c1d3;
  line-height: 1.2;
}

.metric-node.note-node .metric-node-title,
.metric-node.note-node .metric-node-type,
.metric-node.note-node .metric-value,
.metric-node.note-node .metric-formula {
  color: #4a370f;
}

.node-delete {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(20, 27, 38, 0.9);
  color: #eea49f;
  line-height: 0;
}

.node-toggle {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(20, 27, 38, 0.9);
  color: #d6e0ed;
  line-height: 0;
}

.node-toggle.active {
  background: rgba(240, 138, 134, 0.12);
  border-color: rgba(240, 138, 134, 0.34);
  color: #f7b0ad;
}

.node-duplicate {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(20, 27, 38, 0.9);
  color: #c4d3f1;
  line-height: 0;
}

.metric-node-body {
  padding: 7px 8px 8px;
  cursor: inherit;
}

.metric-value-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.metric-value-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.metric-value {
  order: 2;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.01em;
  color: #e8eef8;
}

.metric-delta {
  order: 1;
  font-size: 7px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  font-family: "Inter", "Segoe UI", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  opacity: 0.95;
  min-height: 8px;
}

.metric-delta.hidden {
  display: block;
  visibility: hidden;
}

.metric-delta-positive {
  color: #6ee7b7;
}

body[data-theme="light"] .metric-delta-positive {
  color: #176b4f;
}

body[data-theme="sand"] .metric-delta-positive {
  color: #2f6b3e;
}

.metric-delta-negative {
  color: #fca5a5;
}

.metric-node.note-node .metric-value.note-content {
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 40px;
}

.metric-step-controls {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.metric-step-controls.hidden {
  display: none;
}

.value-adjust {
  width: 14px;
  height: 12px;
  border: 1px solid rgba(122, 138, 162, 0.42);
  border-radius: 4px;
  background: rgba(20, 27, 38, 0.68);
  color: #d9e2ef;
  font-size: 7px;
  line-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.value-adjust .lucide {
  width: 8px;
  height: 8px;
  display: block;
}

.value-adjust:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.metric-formula {
  margin-top: 6px;
  color: #d2dceb;
  font-size: 8.8px;
  line-height: 1.32;
}

.metric-node.note-node .metric-formula.note-formula {
  color: rgba(74, 55, 15, 0.72);
}

.metric-node.note-node .metric-step-controls,
.metric-node.note-node .port,
.metric-node.note-node .node-toggle {
  display: none !important;
}

.metric-node.note-node.is-editing-note {
  cursor: text;
}

.metric-node.note-node.is-editing-note .metric-value.note-content {
  cursor: text;
  user-select: text;
  outline: 1px dashed rgba(95, 74, 18, 0.35);
  border-radius: 6px;
  padding: 2px 4px;
}

.port {
  position: absolute;
  width: 9px;
  height: 9px;
  min-width: 9px;
  min-height: 9px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(191, 211, 255, 0.9);
  background: #7aa2ff;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 0 1px rgba(122, 162, 255, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  overflow: visible;
}

.port::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px solid rgba(122, 162, 255, 0.18);
  opacity: 1;
}

.port:hover {
  transform: translateY(-50%) scale(1.06);
}

.port:focus,
.port:focus-visible {
  outline: none;
}

.metric-node:hover .port {
  opacity: 1;
  pointer-events: auto;
}

.metric-node.edge-selected-node .port {
  opacity: 1;
  pointer-events: auto;
}


.port-selected-edge {
  background: #9ec0ff;
  border-color: rgba(205, 223, 255, 0.95);
  box-shadow: 0 0 0 2px rgba(122, 162, 255, 0.28);
}

.port-reconnect-candidate {
  background: #4de0cc;
  border-color: rgba(178, 246, 238, 0.95);
  box-shadow: 0 0 0 2px rgba(77, 224, 204, 0.24);
}

.in-port {
  left: -5px;
}

.out-port {
  right: -5px;
}

.top-port {
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
}

.top-port:hover {
  transform: translateX(-50%) scale(1.06);
}

.bottom-port {
  top: auto;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
}

.bottom-port:hover {
  transform: translateX(-50%) scale(1.06);
}

.edge-path {
  fill: none;
  stroke: #95a3b8;
  stroke-width: 2.2;
}

.edge-path--selected {
  stroke-width: 2.8;
}

.edge-path--disabled {
  stroke: #bdbdbd !important;
  opacity: 0.45;
}

.edge-hit-path {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  cursor: pointer;
}

.edge-label-bg {
  fill: rgba(16, 22, 32, 0.78);
  stroke: rgba(140, 155, 178, 0.32);
  stroke-width: 0.7;
}

.edge-path--numerator {
  stroke: #4f8d56;
}

.edge-path--denominator {
  stroke: #cc6f6a;
}

.edge-path--multiplier {
  stroke: #8b72bd;
}

.edge-path--inverse {
  stroke-dasharray: 7 5;
  stroke: #c58b5f;
}

.edge-path--source {
  stroke: #5f86cc;
  stroke-dasharray: 5 4;
}

.edge-flow-dot {
  pointer-events: none;
}

.edge-flow-dot-core {
  fill: #8bb4ff;
}

.edge-flow-dot-glow {
  fill: rgba(139, 180, 255, 0.28);
}

.edge-path--churn {
  stroke: #b96a8f;
  stroke-dasharray: 2 4;
}

.edge-label {
  fill: #d7e2f3;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  paint-order: stroke fill;
  stroke: rgba(8, 12, 20, 0.45);
  stroke-width: 0.6;
}

.edge-delete-button {
  cursor: pointer;
}

.edge-delete-circle {
  fill: #f9efef;
  stroke: #d93025;
  stroke-width: 1;
}

.edge-delete-text {
  fill: #d93025;
  font-size: 11px;
  font-weight: 700;
  user-select: none;
  pointer-events: none;
}

.selected-metric-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  font-size: 12px;
}

.selected-metric-grid dt {
  color: #afbad0;
}

.selected-metric-grid dd {
  margin: 0;
  color: #e2e9f5;
}

.selected-formula-value {
  line-height: 1.35;
}

.selected-section {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.selected-section-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 9px;
  padding: 8px;
  margin-top: 7px;
  background: rgba(18, 25, 36, 0.22);
}

.selected-section--form {
  border-top: 0;
  margin-top: 2px;
  padding-top: 0;
}

.benchmark-inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.benchmark-inline-field {
  margin-bottom: 0;
}

.connector-inline-wrap {
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.connector-inline-row {
  margin-top: 0;
}

.connector-inline-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.connector-sync-btn {
  width: auto;
  min-width: 86px;
  flex: 0 0 auto;
  padding: 6px 9px;
}

.connector-status-text {
  margin: 0;
  flex: 1 1 auto;
  min-height: 20px;
}

.selected-section-title {
  margin: 0 0 5px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c8d2e4;
}

.summary-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 7px;
  padding: 5px 7px;
  background: rgba(15, 21, 30, 0.2);
}

.summary-label {
  font-size: 10px;
  color: #afbad0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-value {
  font-size: 11px;
  color: #e2e9f5;
}

.summary-row-formula {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-formula {
  font-size: 10.5px;
  color: #d7e2f2;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selected-inline-summary {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.summary-inline-meta {
  font-size: 10px;
  color: #afbad0;
}

.summary-inline-formula {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-inline-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #afbad0;
}

.summary-inline-value {
  font-size: 10.5px;
  line-height: 1.35;
  color: #d7e2f2;
  overflow-wrap: anywhere;
}

.sensitivity-base-line {
  margin-bottom: 5px;
}

.sensitivity-heatmap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sensitivity-heat-head,
.sensitivity-heat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px 68px 66px;
  gap: 5px;
  align-items: center;
}

.sensitivity-heat-head {
  color: #afbad0;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sensitivity-driver-name {
  min-width: 0;
  font-size: 10px;
  color: #d7e2f2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sensitivity-cell {
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 9.5px;
  line-height: 1.2;
  text-align: center;
  padding: 2px 3px;
  color: #eff5ff;
}

.sensitivity-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: calc(0.08 + (var(--heat, 0) * 0.7));
}

.sensitivity-cell > span {
  position: relative;
  z-index: 1;
}

.sensitivity-cell--up::before {
  background: rgba(34, 197, 94, 0.9);
}

.sensitivity-cell--down::before {
  background: rgba(239, 68, 68, 0.9);
}

.sensitivity-impact {
  font-size: 9.5px;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
  color: #e4eefc;
  white-space: nowrap;
}

.sensitivity-top-list {
  margin: 6px 0 0;
  padding-left: 15px;
  color: #d7e2f2;
  font-size: 10px;
  line-height: 1.35;
}

.sensitivity-top-list li + li {
  margin-top: 2px;
}

.driver-explain-base-line {
  margin-bottom: 6px;
  font-size: 10.5px;
}

.driver-explain-heatmap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.driver-explain-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.driver-explain-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.driver-explain-name {
  min-width: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: #d7e2f2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-explain-impact {
  min-height: 18px;
  border-radius: 8px;
}

.driver-explain-share {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  color: #d7e2f2;
}

.driver-explain-share--up {
  color: #8ce2b6;
}

.driver-explain-share--down {
  color: #f5abab;
}

.validation-ok-hint {
  font-size: 10.5px;
  color: #b8d5c1;
}

.goal-seek-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 4px;
}

.goal-seek-controls input {
  width: 100%;
  min-width: 0;
}

.goal-seek-run-btn {
  border: 1px solid rgba(122, 162, 255, 0.5);
  background: rgba(122, 162, 255, 0.18);
  color: #dce8ff;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0 10px;
  height: 28px;
}

.goal-seek-run-btn:hover {
  background: rgba(122, 162, 255, 0.28);
}

.goal-seek-list {
  margin: 6px 0 0;
  padding-left: 15px;
  color: #d7e2f2;
  font-size: 10px;
  line-height: 1.35;
}

.goal-seek-list li + li {
  margin-top: 4px;
}

.goal-seek-list li span {
  display: block;
}

.validation-hint-list {
  margin: 4px 0 0;
  padding-left: 16px;
  color: #ffd7d7;
  font-size: 11px;
  line-height: 1.35;
}

.validation-hint-list li + li {
  margin-top: 3px;
}

.selected-dependencies-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.dependency-column .hint {
  margin-bottom: 3px;
}

.dependency-list {
  margin: 4px 0 0;
  padding-left: 16px;
  color: #d5ddeb;
  font-size: 11px;
}

.dependency-list--compact li + li {
  margin-top: 2px;
}

.cohort-breakdown {
  margin-top: 6px;
  border: 1px solid rgba(100, 116, 139, 0.55);
  border-radius: 8px;
  overflow: auto;
  background: rgba(35, 43, 56, 0.9);
}

.cohort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #e3ecf8;
}

.cohort-table th,
.cohort-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.3);
  text-align: left;
  white-space: nowrap;
}

.cohort-table th {
  color: #d2dbea;
  font-weight: 600;
  background: rgba(38, 47, 61, 0.96);
  position: sticky;
  top: 0;
}

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

.retention-editor-wrap {
  margin-top: 6px;
  border: 1px solid rgba(100, 116, 139, 0.55);
  border-radius: 8px;
  background: rgba(24, 31, 43, 0.86);
  padding: 6px;
}

.lucide {
  width: 12px;
  height: 12px;
  stroke-width: 2.1;
}

.sim-controls .zoom-btn .lucide,
.chart-control-btn .lucide,
.show-chart-btn .lucide {
  width: 11px;
  height: 11px;
  display: block;
  flex-shrink: 0;
}

.zoom-btn .lucide,
.chart-control-btn .lucide,
.show-chart-btn .lucide,
.zoom-btn span,
.chart-control-btn span,
.show-chart-btn span {
  pointer-events: none;
  user-select: none;
}

.node-header-actions .lucide {
  width: 10px;
  height: 10px;
  stroke-width: 2.2;
  display: block;
}

.node-delete:hover,
.node-toggle:hover,
.node-action-trigger:hover,
.node-chart:hover,
.node-duplicate:hover {
  background: rgba(26, 34, 46, 0.9);
  filter: none;
}

.node-chart {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(20, 27, 38, 0.9);
  color: #9fc5ff;
  line-height: 0;
}

.metric-chart-tile {
  position: absolute;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  background: rgba(20, 27, 38, 0.94);
  box-shadow: var(--shadow);
  padding: 6px 7px 7px;
  min-width: 170px;
  min-height: 120px;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  z-index: 6;
}

.metric-chart-tile:active {
  cursor: grabbing;
}

.metric-cohort-tile {
  position: absolute;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  background: rgba(20, 27, 38, 0.94);
  box-shadow: var(--shadow);
  padding: 6px 7px 7px;
  min-width: 250px;
  min-height: 160px;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  z-index: 6;
}

.metric-cohort-tile:active {
  cursor: grabbing;
}

.cohort-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 6px;
}

.cohort-tile-title {
  font-size: 10px;
  color: #e2e8f0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cohort-tile-actions {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.cohort-tile-action-trigger,
.cohort-tile-delete-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(20, 27, 38, 0.9);
  color: #d6e0ed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cohort-tile-action-trigger:hover,
.cohort-tile-delete-btn:hover {
  background: rgba(26, 34, 46, 0.9);
}

.cohort-tile-delete-btn {
  position: absolute;
  top: -20px;
  left: 0;
  color: #eea49f;
}

.cohort-tile-body {
  height: calc(100% - 22px);
}

.metric-cohort-tile .cohort-breakdown {
  margin-top: 0;
  height: 100%;
}

.cohort-tile-resize {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  background: rgba(20, 27, 38, 0.95);
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.metric-cohort-tile.is-selected .cohort-tile-resize {
  opacity: 1;
  pointer-events: auto;
}

.cohort-tile-resize-nw {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}

.cohort-tile-resize-ne {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}

.cohort-tile-resize-sw {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}

.cohort-tile-resize-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.chart-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
  gap: 6px;
}

.chart-tile-title {
  font-size: 10px;
  color: #e2e8f0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-tile-actions {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.chart-tile-action-trigger,
.chart-tile-delete-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(20, 27, 38, 0.9);
  color: #d6e0ed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chart-tile-action-trigger:hover,
.chart-tile-delete-btn:hover {
  background: rgba(26, 34, 46, 0.9);
}

.chart-tile-delete-btn {
  position: absolute;
  top: -20px;
  left: 0;
  color: #eea49f;
}

.chart-tile-delete-btn.hidden,
.cohort-tile-delete-btn.hidden {
  display: none !important;
}

.chart-tile-meta {
  font-size: 9px;
  color: #9fb0c7;
  line-height: 1.2;
  margin-bottom: 2px;
}

.chart-tile-canvas {
  width: 100%;
  height: calc(100% - 26px);
  display: block;
}

.chart-tile-resize {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  background: rgba(20, 27, 38, 0.95);
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.metric-chart-tile.is-selected .chart-tile-resize {
  opacity: 1;
  pointer-events: auto;
}


body[data-theme="light"] .metric-chart-tile {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.92);
}

body[data-theme="light"] .metric-cohort-tile {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.92);
}

body[data-theme="light"] .chart-tile-title,
body[data-theme="light"] .chart-tile-meta {
  color: #1f4f49;
}

body[data-theme="light"] .cohort-tile-title {
  color: #1f4f49;
}

body[data-theme="light"] .chart-tile-action-trigger,
body[data-theme="light"] .chart-tile-delete-btn {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.9);
  color: #1f4f49;
}

body[data-theme="light"] .cohort-tile-action-trigger,
body[data-theme="light"] .cohort-tile-delete-btn {
  border-color: rgba(31, 79, 73, 0.34);
  background: rgba(245, 255, 252, 0.9);
  color: #1f4f49;
}

body[data-theme="light"] .chart-tile-delete-btn {
  color: #c95d45;
}

body[data-theme="light"] .cohort-tile-delete-btn {
  color: #c95d45;
}

body[data-theme="light"] .chart-tile-resize {
  border-color: rgba(31, 79, 73, 0.4);
  background: rgba(245, 255, 252, 0.95);
}

body[data-theme="sand"] .metric-chart-tile {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.94);
}

body[data-theme="sand"] .metric-cohort-tile {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.94);
}

body[data-theme="sand"] .chart-tile-title,
body[data-theme="sand"] .chart-tile-meta {
  color: #564941;
}

body[data-theme="sand"] .cohort-tile-title {
  color: #564941;
}

body[data-theme="sand"] .chart-tile-action-trigger,
body[data-theme="sand"] .chart-tile-delete-btn {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.92);
  color: #564941;
}

body[data-theme="sand"] .cohort-tile-action-trigger,
body[data-theme="sand"] .cohort-tile-delete-btn {
  border-color: rgba(123, 106, 94, 0.34);
  background: rgba(255, 252, 246, 0.92);
  color: #564941;
}

body[data-theme="sand"] .chart-tile-delete-btn {
  color: #e85a4f;
}

body[data-theme="sand"] .cohort-tile-delete-btn {
  color: #e85a4f;
}

body[data-theme="sand"] .chart-tile-resize {
  border-color: rgba(123, 106, 94, 0.4);
  background: rgba(255, 252, 246, 0.94);
}

body[data-theme="bright"] .metric-chart-tile {
  border-color: rgba(157, 141, 143, 0.46);
  background: rgba(70, 52, 78, 0.9);
}

body[data-theme="bright"] .metric-cohort-tile {
  border-color: rgba(157, 141, 143, 0.46);
  background: rgba(70, 52, 78, 0.9);
}

body[data-theme="bright"] .chart-tile-title,
body[data-theme="bright"] .chart-tile-meta {
  color: #f5f2dc;
}

body[data-theme="bright"] .cohort-tile-title {
  color: #f5f2dc;
}

body[data-theme="bright"] .chart-tile-action-trigger,
body[data-theme="bright"] .chart-tile-delete-btn {
  border-color: rgba(157, 141, 143, 0.42);
  background: rgba(70, 52, 78, 0.92);
  color: #f5f2dc;
}

body[data-theme="bright"] .cohort-tile-action-trigger,
body[data-theme="bright"] .cohort-tile-delete-btn {
  border-color: rgba(157, 141, 143, 0.42);
  background: rgba(70, 52, 78, 0.92);
  color: #f5f2dc;
}

body[data-theme="bright"] .chart-tile-delete-btn {
  color: #e98074;
}

body[data-theme="bright"] .cohort-tile-delete-btn {
  color: #e98074;
}

body[data-theme="bright"] .chart-tile-resize {
  border-color: rgba(157, 141, 143, 0.5);
  background: rgba(70, 52, 78, 0.96);
}

body[data-theme="icons"] .metric-chart-tile {
  border-color: rgba(20, 160, 152, 0.46);
  background: rgba(15, 41, 47, 0.9);
}

body[data-theme="icons"] .metric-cohort-tile {
  border-color: rgba(20, 160, 152, 0.46);
  background: rgba(15, 41, 47, 0.9);
}

body[data-theme="icons"] .chart-tile-title,
body[data-theme="icons"] .chart-tile-meta {
  color: #f2f2f2;
}

body[data-theme="icons"] .cohort-tile-title {
  color: #f2f2f2;
}

body[data-theme="icons"] .chart-tile-action-trigger,
body[data-theme="icons"] .chart-tile-delete-btn {
  border-color: rgba(20, 160, 152, 0.42);
  background: rgba(15, 41, 47, 0.92);
  color: #f2f2f2;
}

body[data-theme="icons"] .cohort-tile-action-trigger,
body[data-theme="icons"] .cohort-tile-delete-btn {
  border-color: rgba(20, 160, 152, 0.42);
  background: rgba(15, 41, 47, 0.92);
  color: #f2f2f2;
}

body[data-theme="icons"] .chart-tile-delete-btn {
  color: #cb2d6f;
}

body[data-theme="icons"] .cohort-tile-delete-btn {
  color: #cb2d6f;
}

body[data-theme="icons"] .chart-tile-resize {
  border-color: rgba(20, 160, 152, 0.52);
  background: rgba(15, 41, 47, 0.96);
}

.chart-tile-resize-nw {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}

.chart-tile-resize-ne {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}

.chart-tile-resize-sw {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}

.chart-tile-resize-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

@keyframes port-ping {
  0% {
    transform: scale(0.9);
    opacity: 0.75;
  }
  70% {
    transform: scale(1.9);
    opacity: 0;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

#retention-editor-canvas {
  display: block;
  width: 100%;
  height: 150px;
  cursor: crosshair;
}

@media (max-width: 1024px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 300px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .metric-chart-panel {
    width: 240px;
  }
}

@media (max-width: 1400px) {
  .toolbar-storage-status {
    display: none;
  }

  #stats {
    font-size: 10px;
  }
}
