@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #0A1930;
  --ink-raised: #142c52;
  --bg: #F5F3ED;
  --surface: #FFFFFF;
  --border: #E5E1D6;
  --signal: #F2A93B;
  --signal-text: #7A5416;
  --warm: #E2653A;
  --text: #16223A;
  --text-muted: #6B7385;
  --success-bg: #E4F3EC;
  --success-text: #1D7A54;
  --danger-bg: #FBEAE8;
  --danger-text: #B23A2E;
  --radius: 10px;
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; }
button { font-family: var(--font-body); cursor: pointer; }
input, select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--signal); outline-offset: -1px; }
label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--signal); color: #3D2A08; }
.btn-primary:hover { background: #ffbb55; }
.btn-ghost { background: white; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #FAF9F5; }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); }
.btn-danger:hover { background: #f6dad6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* App shell */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--ink);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--signal); color: #3D2A08;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: rgba(242,169,59,0.14); color: var(--signal); }
.sidebar-footer { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.tenant-name { font-size: 12px; color: rgba(255,255,255,0.55); margin-bottom: 8px; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.topbar h1 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0; }
.wallet-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 999px; padding: 6px 14px; font-size: 13px;
}
.wallet-pill strong { font-family: var(--font-mono); }

.content { padding: 28px; max-width: 1080px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px;
}
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stat-label { font-size: 12px; color: var(--text-muted); margin: 0 0 6px; }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 0; }

.section-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0 0 14px; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.code-cell { font-family: var(--font-mono); }

.badge { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-generated { background: var(--bg); color: var(--text-muted); }
.badge-activated { background: var(--success-bg); color: var(--success-text); }
.badge-sold { background: rgba(242,169,59,0.15); color: var(--signal-text); }
.badge-revoked { background: var(--danger-bg); color: var(--danger-text); }
.badge-online { background: var(--success-bg); color: var(--success-text); }
.badge-offline { background: var(--danger-bg); color: var(--danger-text); }
.badge-unconfigured { background: var(--bg); color: var(--text-muted); }

.callout { background: rgba(242,169,59,0.1); border: 1px solid rgba(242,169,59,0.35); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; color: var(--signal-text); display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.error-text { color: var(--danger-text); font-size: 13px; margin-top: 8px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }

.form-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 160px; }

.codeblock {
  background: var(--ink); color: #EAE6D9; font-family: var(--font-mono); font-size: 12px;
  padding: 14px 16px; border-radius: var(--radius); white-space: pre-wrap; line-height: 1.6;
  position: relative;
}
.codeblock .copy-btn { position: absolute; top: 8px; right: 8px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg); font-family: var(--font-mono); font-size: 12px; padding: 4px 10px; border-radius: 6px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; font-size: 13px; border: none; background: none; color: var(--text-muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--signal); font-weight: 600; }

.wizard-steps { display: flex; gap: 6px; margin-bottom: 24px; }
.wizard-step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.wizard-step.done { background: var(--signal); }

/* Auth screen */
.auth-wrap { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.auth-card { background: white; border-radius: 14px; padding: 36px; width: 380px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 22px; background: var(--bg); border-radius: var(--radius); padding: 4px; }
.auth-tab { flex: 1; text-align: center; padding: 8px; border-radius: 8px; border: none; background: none; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.auth-tab.active { background: white; color: var(--text); }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
}
