:root {
  --bg: #FBF8F2;
  --bg-card: rgba(255, 255, 255, 0.55);
  --bg-elevated: rgba(255, 255, 255, 0.8);
  --border: rgba(231, 215, 182, 0.7);
  --border-strong: rgba(212, 191, 150, 0.9);
  --text: #1a1410;
  --text-muted: #6b5d4a;
  --text-subtle: #9a8e78;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-bg: rgba(249, 115, 22, 0.08);
  --accent-bg-hover: rgba(249, 115, 22, 0.14);
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(60, 40, 10, 0.04);
  --shadow: 0 4px 16px rgba(60, 40, 10, 0.06);
  --shadow-lg: 0 12px 40px rgba(60, 40, 10, 0.08);
}

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

body {
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 800px 400px at 10% 0%, rgba(249, 168, 115, 0.12), transparent),
    radial-gradient(ellipse 600px 300px at 95% 10%, rgba(251, 191, 134, 0.1), transparent);
  background-attachment: fixed;
  min-height: 100vh;
}

.app { display: flex; min-height: 100vh; }

/* ─── Sidebar ─────────────────────────── */
.sidebar {
  width: 64px;
  flex-shrink: 0;
  background: rgba(255, 252, 244, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar .brand {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.sidebar .brand img { width: 28px; height: 28px; object-fit: contain; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: 10px;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar nav a:hover { background: rgba(249, 115, 22, 0.08); color: var(--accent); }
.sidebar nav a.active { background: var(--accent-bg); color: var(--accent); }
.sidebar nav a.active::before {
  content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px;
  width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.sidebar nav a svg { width: 20px; height: 20px; }
.sidebar .spacer { flex: 1; }
.sidebar .tooltip {
  position: absolute; left: 54px; top: 50%; transform: translateY(-50%);
  background: #1a1410; color: #fff; padding: 6px 10px;
  border-radius: 6px; font-size: 12px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
  box-shadow: var(--shadow); z-index: 100;
}
.sidebar nav a:hover .tooltip { opacity: 1; }
.sidebar nav a.soon { opacity: 0.45; cursor: not-allowed; }
.sidebar nav a.soon:hover { background: transparent; color: var(--text-muted); }
.sidebar nav a.soon::after {
  content: ""; position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 2px #fff;
}

/* ─── Main ─────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 252, 244, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title {
  font-size: 15px; font-weight: 600; color: var(--text);
}
.topbar .search {
  flex: 1; max-width: 420px; position: relative;
}
.topbar .search input {
  width: 100%; height: 36px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, background .15s;
}
.topbar .search input:focus { border-color: var(--accent); background: #fff; }
.topbar .search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-subtle);
}
.topbar .right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar .icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.5);
  color: var(--text-muted); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.topbar .icon-btn:hover { background: #fff; color: var(--accent); border-color: var(--accent); }
.topbar .icon-btn svg { width: 16px; height: 16px; }
.topbar .user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.5);
  cursor: pointer;
}
.topbar .user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff; font-weight: 600; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.topbar .user .email { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.content { padding: 28px 32px 48px; flex: 1; }
.page-header {
  margin-bottom: 24px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.page-header h1 {
  font-size: 32px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 6px; color: var(--text);
}
.page-header .sub { color: var(--text-muted); font-size: 13.5px; margin: 0; }
.page-header .actions { display: flex; gap: 8px; }

/* ─── Buttons ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  font-size: 13px; font-weight: 500;
  border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: all .15s;
  text-decoration: none;
  font-family: inherit;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(249, 115, 22, 0.25), inset 0 -1px 0 rgba(0,0,0,0.08);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: rgba(255,255,255,0.7); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: #fff; border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: rgba(0,0,0,0.04); color: var(--text); }

/* ─── Cards ─────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }

.stat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 24px;
}
.stat {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat .label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-subtle); font-weight: 600;
}
.stat .label svg { width: 13px; height: 13px; }
.stat .value {
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text);
}
.stat .trend { font-size: 12px; color: var(--text-muted); }
.stat .trend.up { color: var(--success); }
.stat .trend.down { color: var(--danger); }
.stat .trend.warn { color: var(--warning); }

/* ─── Tables / Lists ─────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.section-header h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.section-header .meta { font-size: 12px; color: var(--text-subtle); }

.list-row {
  display: grid; align-items: center; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(249, 115, 22, 0.03); }

.agent-row { grid-template-columns: 1fr 120px 180px 100px 40px; }
.tx-row { grid-template-columns: 40px 1fr 120px 120px 100px 40px; }

.agent-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--accent-bg);
}

.addr-mono {
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; color: var(--text-muted);
}

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.05); color: var(--text-muted);
}
.tag-armed { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.tag-warning { background: rgba(245, 158, 11, 0.14); color: var(--warning); }
.tag-tripped { background: rgba(220, 38, 38, 0.12); color: var(--danger); }
.tag-watch { background: rgba(100, 116, 139, 0.14); color: #64748b; }

.tag svg { width: 11px; height: 11px; }

.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.progress-wrap {
  height: 6px; background: rgba(0,0,0,0.06);
  border-radius: 999px; overflow: hidden; position: relative;
}
.progress-bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #fb923c, var(--accent));
  transition: width .3s;
}
.progress-bar.warn { background: linear-gradient(90deg, #fbbf24, var(--warning)); }
.progress-bar.danger { background: linear-gradient(90deg, #f87171, var(--danger)); }

/* ─── Forms ─────────────────────────── */
label { font-size: 13px; color: var(--text); font-weight: 500; margin-bottom: 6px; display: block; }
label .hint { color: var(--text-subtle); font-weight: 400; font-size: 12px; margin-left: 4px; }
.field { margin-bottom: 16px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.7);
  font-size: 13.5px; color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}
input::placeholder { color: var(--text-subtle); }

/* ─── Auth page centered layout ─────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background-image:
    radial-gradient(ellipse 800px 400px at 20% 10%, rgba(249, 168, 115, 0.18), transparent),
    radial-gradient(ellipse 700px 350px at 80% 90%, rgba(251, 191, 134, 0.15), transparent);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 22px;
}
.auth-card .brand-row img { width: 26px; height: 26px; }
.auth-card .brand-row span {
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--text);
}
.auth-card h1 {
  font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 6px; color: var(--text);
}
.auth-card .sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 22px; }
.auth-card .foot {
  margin-top: 18px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}
.auth-card .foot a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-card .foot a:hover { text-decoration: underline; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-subtle); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; margin: 18px 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.btn-oauth {
  width: 100%; height: 42px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--border); background: #fff;
  border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s;
  font-family: inherit;
  opacity: 0.55;
}
.btn-oauth:not(:disabled):hover { background: #fafafa; border-color: var(--border-strong); }
.btn-oauth svg { width: 18px; height: 18px; }

/* ─── Empty states ─────────────────────────── */
.empty {
  padding: 60px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty svg { width: 40px; height: 40px; color: var(--text-subtle); }
.empty h3 { margin: 0; font-size: 16px; font-weight: 600; }
.empty p { margin: 0; color: var(--text-muted); max-width: 360px; }

/* ─── Utilities ─────────────────────────── */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 4px; }
.mono { font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.text-right { text-align: right; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }

/* ─── Responsive ─────────────────────────── */
@media (max-width: 720px) {
  .sidebar { display: none; }
  .content { padding: 20px 16px 36px; }
  .topbar { padding: 0 16px; }
  .page-header h1 { font-size: 24px; }
  .agent-row { grid-template-columns: 1fr auto auto; }
  .agent-row .col-budget, .agent-row .col-addr { display: none; }
  .tx-row { grid-template-columns: 32px 1fr auto; }
  .tx-row .col-amount-usd, .tx-row .col-time { display: none; }
}
