:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --active: #22c55e;
  --pending: #f59e0b;
  --inactive: #ef4444;
  --font-mono: "SF Mono", "Fira Code", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }

.nav-address {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card.active { border-color: var(--active); }
.stat-card.pending { border-color: var(--pending); }
.stat-card.inactive { border-color: var(--inactive); }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th.text-right, td.text-right { text-align: right !important; }
th.text-center, td.text-center { text-align: center !important; }
th.text-left, td.text-left { text-align: left !important; }
}

th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--active); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--pending); }
.badge-inactive { background: rgba(239, 68, 68, 0.15); color: var(--inactive); }

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font-mono);
}

.form-group input[type="file"] {
  font-family: var(--font-sans);
  padding: 0.5rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 150px; }

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-wide { width: 100%; padding: 0.75rem; font-size: 1rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover { color: var(--text); }

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.hint-text {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  margin-top: 1rem !important;
}

.error-text {
  color: var(--inactive);
  font-size: 0.875rem;
}

h2 { margin: 1rem 0 0.5rem; }
h3 { margin: 1.5rem 0 0.5rem; color: var(--text-muted); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; }

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-top: 1rem;
}

.empty-state p { margin-bottom: 0.75rem; }

/* Deploy steps */
.deploy-step {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-left: 3px solid var(--border);
  margin-bottom: 0.25rem;
}

.deploy-step-active {
  color: var(--text);
  border-left-color: var(--primary);
}

.deploy-step-done {
  color: var(--active);
  border-left-color: var(--active);
}

.deploy-step-done::before { content: "\2713 "; }

.deploy-step-error {
  color: var(--inactive);
  border-left-color: var(--inactive);
}

.deploy-step-error::before { content: "\2717 "; }

.version-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  vertical-align: middle;
}

/* Jurisdiction picker */
.jurisdiction-picker {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.jurisdiction-list { padding: 0.25rem 0; }

.jurisdiction-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}

.jurisdiction-option:hover { background: var(--surface); }

.jurisdiction-option input[type="checkbox"] { accent-color: var(--primary); }

.jurisdiction-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.jurisdiction-tag {
  display: inline-flex;
  align-items: center;
  background: var(--border);
  color: var(--text);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* Asset badges */
.asset-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.asset-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  border-radius: 50%;
}

.asset-remove:hover { color: var(--inactive); }

/* Inline edit */
.inline-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  border-radius: 4px;
  position: relative;
}

.inline-edit[data-field="description"] {
  display: flex;
  width: 100%;
}

.inline-edit .edit-icon {
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.inline-edit:hover .edit-icon { opacity: 1; }

.inline-edit-input {
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-sans);
  padding: 0.2rem 0.4rem;
  outline: none;
}

.inline-edit-input.edit-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.inline-edit-input.edit-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.inline-edit-input.edit-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 100%;
}

/* List items */
.list-item {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 1rem;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 460px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Jurisdiction map */
.jurisdiction-map {
  margin: 1rem 0;
  border-radius: 8px;
  height: 400px;
  overflow: hidden;
}

.jurisdiction-map svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Page header */
.page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

/* Council detail header */
.council-header {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  align-items: baseline;
  gap: 0.75rem;
}

.council-header h2 {
  margin: 0;
  white-space: nowrap;
}

.council-header .header-icons {
  display: flex;
  gap: 0.25rem;
  justify-self: end;
}

/* Icon buttons */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-btn[title="Remove from console"]:hover { color: var(--inactive); }

/* Balance warning */
.balance-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--pending);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 1.5rem;
}

/* Onboarding stepper */
.onboarding-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 1.5rem 0 0;
}

.onboarding-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 80px;
}

.step-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.onboarding-step.active .step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.onboarding-step.done .step-dot {
  border-color: var(--active);
  background: var(--active);
  color: white;
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.onboarding-step.active .step-label { color: var(--text); font-weight: 600; }
.onboarding-step.done .step-label { color: var(--active); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 40px;
  margin: 0 0.25rem;
  margin-bottom: 1.4rem;
}

.step-line.done { background: var(--active); }

.onboarding-content {
  max-width: 600px;
  margin: 0 auto;
}
