* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #090c0d;
  --surface: #111619;
  --surface-raised: #171e22;
  --surface-muted: #0d1214;
  --surface-soft: #141a1d;
  --line: #2a3439;
  --line-soft: #20292d;
  --text: #f4f7f2;
  --text-soft: #d8dfda;
  --muted: #91a09a;
  --muted-2: #687771;
  --lime: #b7ff3c;
  --lime-strong: #9deb21;
  --teal: #45d7c2;
  --blue: #6694ff;
  --amber: #f4b84a;
  --coral: #ff7869;
  --danger: #ff6e72;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 280px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  background: #0c1012;
  content: "";
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
select,
input[type="checkbox"],
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input,
textarea {
  outline: none;
}

svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 5px;
  font-size: 32px;
  line-height: 1.12;
  font-weight: 760;
}

h2 {
  font-size: 21px;
  line-height: 1.25;
  font-weight: 740;
}

h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 720;
}

p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 102px;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 15px;
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #d0ff7e;
  border-radius: 8px;
  background: var(--lime);
  color: #0b1207;
  box-shadow: 0 0 0 5px rgba(183, 255, 60, 0.06);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.admin-mark {
  border-color: #ffd691;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(244, 184, 74, 0.07);
}

.brand-copy {
  min-width: 0;
}

.brand-copy p {
  max-width: 620px;
  margin-top: 7px;
}

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

.brand-name,
.system-tag,
.eyebrow {
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  text-transform: uppercase;
}

.brand-name,
.eyebrow {
  color: var(--teal);
}

.system-tag {
  border: 1px solid rgba(183, 255, 60, 0.28);
  border-radius: 4px;
  background: rgba(183, 255, 60, 0.07);
  color: var(--lime);
  padding: 4px 7px;
}

.admin-tag {
  border-color: rgba(244, 184, 74, 0.32);
  background: rgba(244, 184, 74, 0.08);
  color: var(--amber);
}

.eyebrow {
  margin-bottom: 7px;
}

.wallet-actions {
  display: grid;
  grid-template-columns: minmax(122px, 150px) auto 42px auto;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

button.icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
}

button.icon-button svg {
  width: 17px;
  height: 17px;
}

button,
.quick-nav a,
.file-select span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--lime);
  color: #0a1008;
  cursor: pointer;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.2;
  padding: 10px 15px;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled),
.file-select span:hover {
  background: #cbff72;
  transform: translateY(-1px);
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(102, 148, 255, 0.22);
}

button.secondary {
  border-color: #35464a;
  background: #1a2929;
  color: #d9ebe6;
}

button.secondary:hover:not(:disabled) {
  border-color: #52706f;
  background: #223534;
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1012;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

textarea {
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #3a484e;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #0e1417;
  box-shadow: 0 0 0 3px rgba(102, 148, 255, 0.09);
}

input::placeholder,
textarea::placeholder {
  color: #61706b;
  opacity: 1;
}

input:disabled {
  color: #73817c;
  background: #101517;
}

select {
  cursor: pointer;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--lime);
}

input[type="range"] {
  min-height: 20px;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: var(--lime);
}

.quick-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -10px;
  padding: 11px 10px;
  background: rgba(9, 12, 13, 0.94);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}

.quick-nav::-webkit-scrollbar {
  display: none;
}

.quick-nav a {
  flex: 0 0 auto;
  min-height: 38px;
  border-color: var(--line);
  background: #0e1315;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 13px;
}

.quick-nav a:hover {
  border-color: #4b5d61;
  background: #161d20;
  color: var(--text);
}

.quick-nav a:first-child {
  border-color: rgba(183, 255, 60, 0.34);
  color: var(--lime);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 8px 0 14px;
}

.admin-page .status-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.status-card {
  position: relative;
  min-width: 0;
  min-height: 94px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 15px 16px;
}

.status-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--lime);
  content: "";
}

.status-card:nth-child(2)::before {
  background: var(--blue);
}

.status-card:nth-child(3)::before {
  background: var(--amber);
}

.status-card:nth-child(4)::before {
  background: var(--teal);
}

.status-card:nth-child(5)::before {
  background: var(--coral);
}

.status-card span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-card span svg {
  width: 14px;
  height: 14px;
  color: var(--muted-2);
}

.status-card strong {
  display: block;
  min-width: 0;
  margin-top: 11px;
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  min-width: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 19px;
}

.launch-panel {
  border-color: #34403d;
  background: #101618;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  gap: 16px;
  margin-bottom: 18px;
}

.badge,
.context-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 29px;
  border: 1px solid rgba(69, 215, 194, 0.28);
  border-radius: 5px;
  background: rgba(69, 215, 194, 0.07);
  color: var(--teal);
  font-size: 11px;
  font-weight: 750;
  padding: 6px 9px;
  white-space: nowrap;
}

.badge svg {
  width: 14px;
  height: 14px;
}

.badge.warning {
  border-color: rgba(244, 184, 74, 0.34);
  background: rgba(244, 184, 74, 0.08);
  color: var(--amber);
}

.form-block {
  border-top: 1px solid var(--line-soft);
  padding: 20px 0;
}

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

.span-2 {
  grid-column: 1 / -1;
}

.compact-textarea {
  min-height: 84px;
}

.metadata-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px dashed #39474b;
  border-radius: 7px;
  background: #0d1315;
  padding: 12px;
}

.metadata-file-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 5px 10px;
}

.metadata-file-controls strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metadata-file-controls small {
  grid-column: 2;
  color: var(--muted-2);
  font-size: 11px;
}

.file-select span {
  min-height: 36px;
  border-color: #3b494e;
  background: #1a2528;
  color: var(--text-soft);
  font-size: 12px;
  padding: 8px 11px;
}

.file-select input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.metadata-status {
  min-width: 0;
}

.advanced-block {
  border-top: 1px solid var(--line-soft);
  padding: 0;
}

.advanced-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: 12px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 740;
  list-style: none;
}

.advanced-block summary::-webkit-details-marker {
  display: none;
}

.advanced-block summary > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.advanced-block summary svg {
  color: var(--muted);
}

.summary-chevron {
  transition: transform 160ms ease;
}

.advanced-block[open] .summary-chevron {
  transform: rotate(180deg);
}

.advanced-block > .form-grid,
.advanced-block > .switch-row,
.advanced-block > .preview-line,
.advanced-block > .slider-grid {
  margin-bottom: 14px;
}

.switch-row,
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.switch-row label,
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.slider-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  overflow: hidden;
}

.slider-row {
  display: grid;
  grid-template-columns: 180px minmax(120px, 1fr) 78px 18px;
  align-items: center;
  min-height: 58px;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #0f1517;
  padding: 8px 12px;
}

.slider-row:last-child {
  border-bottom: 0;
}

.slider-row > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 680;
}

.slider-row b {
  color: var(--muted);
  font-size: 12px;
}

.percent-input {
  min-height: 38px;
  text-align: right;
}

.preview-line,
.mono,
.status {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.preview-line {
  border-left: 2px solid var(--lime);
  color: #c9e8a0;
  padding: 8px 10px;
}

.rule-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}

.rule-strip > div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #0d1315;
  padding: 11px;
}

.rule-strip span,
.rule-strip strong {
  display: block;
}

.rule-strip span {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
}

.rule-strip strong {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.35;
}

.actions,
.row,
.inline-controls,
.context-strip,
.project-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions,
.row {
  margin-top: 10px;
}

.actions {
  flex-wrap: wrap;
}

.actions button {
  flex: 0 0 auto;
}

.row > input,
.row > select {
  flex: 1 1 180px;
}

.row > button {
  flex: 0 0 auto;
}

.create-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}

.create-actions button {
  min-width: 220px;
}

.inline-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-controls input:not([type="checkbox"]) {
  width: 196px;
}

.project-list {
  display: grid;
  gap: 8px;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  gap: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #0d1315;
  padding: 14px;
}

.project-row:hover {
  border-color: #3a484e;
  background: #101719;
}

.project-row strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 12px;
  margin-top: 11px;
}

.project-meta span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-progress {
  width: 100%;
  height: 5px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 3px;
  background: #20292d;
}

.project-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
}

.project-row-actions {
  flex-direction: column;
}

.project-row-actions button {
  width: 90px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 10px;
}

.stats {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line-soft);
}

.stats > div {
  display: grid;
  grid-template-columns: minmax(112px, 0.42fr) minmax(0, 1fr);
  align-items: start;
  min-height: 43px;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 0;
}

.stats dt {
  color: var(--muted);
  font-size: 12px;
}

.stats dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.stats.compact > div {
  min-height: 39px;
  padding: 9px 0;
}

.action-row {
  align-items: stretch;
}

.action-row button {
  min-width: 116px;
}

.ops-context {
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #0d1315;
  padding: 12px;
}

.context-strip {
  justify-content: space-between;
  padding-bottom: 9px;
}

.role-warn {
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
}

.status-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  width: min(480px, calc(100% - 36px));
  max-height: min(38vh, 260px);
  overflow-y: auto;
  border: 1px solid #44545a;
  border-radius: 8px;
  background: #151c1f;
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 13px 13px 13px 15px;
}

.status-toast.success {
  border-color: rgba(183, 255, 60, 0.56);
}

.status-toast.error {
  border-color: rgba(255, 110, 114, 0.7);
}

.status-toast.pending {
  border-color: rgba(102, 148, 255, 0.65);
}

#statusToastText {
  min-width: 0;
  overflow-wrap: anywhere;
  color: inherit;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.5;
}

.status-toast-close {
  width: 30px;
  min-height: 30px;
  border-color: var(--line);
  background: #222c2f;
  color: var(--text);
  padding: 0;
}

.status {
  margin-top: 14px;
  color: var(--lime);
}

.admin-page .eyebrow,
.admin-page .brand-name {
  color: var(--amber);
}

.admin-page .panel {
  border-color: #343c3f;
}

.admin-page #adminTools,
.admin-page #moduleTools,
.admin-page #bindingTools {
  position: relative;
}

.admin-page #adminTools::before,
.admin-page #moduleTools::before,
.admin-page #bindingTools::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  border-radius: 8px 0 0 8px;
  background: var(--blue);
  content: "";
}

.admin-page #moduleTools::before {
  background: var(--teal);
}

.admin-page #bindingTools::before {
  background: var(--amber);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .wallet-actions {
    width: 100%;
    grid-template-columns: minmax(120px, 1fr) auto 42px auto;
    justify-content: stretch;
  }

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

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

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

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

@media (max-width: 720px) {
  body::before {
    height: 220px;
  }

  .shell {
    width: min(100% - 24px, 1240px);
    padding-top: 13px;
  }

  .topbar {
    min-height: auto;
    gap: 18px;
    padding: 7px 0 17px;
  }

  .brand-lockup {
    align-items: flex-start;
    gap: 11px;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }

  .brand-mark svg {
    width: 21px;
    height: 21px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 19px;
  }

  .brand-copy p {
    font-size: 12px;
  }

  .wallet-actions {
    grid-template-columns: 1fr 42px 1fr;
  }

  .wallet-actions select {
    grid-column: 1 / -1;
  }

  .wallet-actions button {
    width: 100%;
  }

  .quick-nav {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .quick-nav a {
    min-height: 40px;
  }

  .status-grid,
  .admin-page .status-grid {
    gap: 7px;
  }

  .status-card {
    min-height: 84px;
    padding: 13px;
  }

  .status-card strong {
    font-size: 13px;
  }

  .panel {
    margin-top: 8px;
    padding: 14px;
  }

  .section-title {
    align-items: flex-start;
    margin-bottom: 15px;
  }

  .badge {
    max-width: 48%;
    white-space: normal;
  }

  .form-grid,
  .tax-extra {
    grid-template-columns: 1fr;
  }

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

  .metadata-upload {
    grid-template-columns: 1fr;
  }

  .metadata-upload button {
    width: 100%;
  }

  .metadata-file-controls {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 70px 16px;
    gap: 8px;
    padding: 11px;
  }

  .slider-row > span {
    grid-column: 1 / -1;
  }

  .slider-row input[type="range"] {
    grid-column: 1;
  }

  .rule-strip {
    grid-template-columns: 1fr;
  }

  .inline-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .inline-controls input:not([type="checkbox"]) {
    width: 100%;
  }

  .project-row {
    grid-template-columns: 1fr;
    gap: 13px;
  }

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

  .project-row-actions {
    flex-direction: row;
  }

  .project-row-actions button {
    flex: 1 1 0;
    width: auto;
  }

  .row,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .row > button,
  .actions > button,
  .action-row button,
  .create-actions button {
    width: 100%;
    min-width: 0;
  }

  .row > input,
  .row > select {
    flex-basis: auto;
  }

  .stats > div {
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
  }

  .status-toast {
    top: 10px;
    right: 10px;
    width: calc(100% - 20px);
  }
}

@media (max-width: 420px) {
  .shell {
    width: min(100% - 24px, 1240px);
  }

  .brand-mark {
    display: none;
  }

  .brand-line {
    flex-wrap: wrap;
  }

  .system-tag {
    font-size: 9px;
  }

  .status-grid,
  .admin-page .status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .status-card {
    padding: 11px;
  }

  .project-meta {
    grid-template-columns: 1fr;
  }

  .project-meta span {
    white-space: normal;
  }

  .section-title {
    flex-direction: column;
    gap: 9px;
  }

  .badge {
    max-width: 100%;
  }
}

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