:root {
  --bg: #080a0f;
  --sidebar: #0c0f16;
  --panel: #10141d;
  --panel-2: #151a25;
  --line: #242b39;
  --text: #f6f8fb;
  --muted: #8f99aa;
  --accent: #7d5cff;
  --accent-2: #22d3a6;
  --warn: #ffb547;
  --danger: #ff5d75;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 75% 5%, rgba(125, 92, 255, .12), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

button, textarea, select { font: inherit; }

button { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 24px 18px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(12, 15, 22, .88);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; font-family: Manrope; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #4ab7ff);
  box-shadow: 0 8px 30px rgba(125, 92, 255, .28);
}
.brand strong { display: block; font-family: Manrope; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }

.nav { display: grid; gap: 6px; margin-top: 42px; }
.nav-item {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: 11px; padding: 12px 13px;
  border-radius: 11px; text-align: left; transition: .2s ease;
}
.nav-item:hover, .nav-item.active { background: #171c28; color: var(--text); }
.nav-item.active { box-shadow: inset 3px 0 var(--accent); }
.nav-item span { width: 20px; text-align: center; }

.sidebar-bottom { margin-top: auto; }
.environment {
  display: flex; gap: 10px; align-items: center; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #10141d;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 181, 71, .1); }
.environment strong, .environment small { display: block; }
.environment strong { font-size: 12px; }
.environment small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.domain { text-align: center; color: #566075; font-size: 10px; margin-top: 14px; }

.main { min-width: 0; padding: 34px clamp(22px, 4vw, 54px) 64px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 30px; }
.eyebrow, .panel-kicker { font-size: 10px; letter-spacing: .16em; color: #7b8497; font-weight: 800; margin: 0 0 7px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Manrope, Inter, sans-serif; }
h1 { font-size: clamp(25px, 3vw, 34px); margin-bottom: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-status { color: #aab4c4; font-size: 12px; margin-right: 6px; }
.api-status i { display: inline-block; width: 7px; height: 7px; background: var(--accent-2); border-radius: 50%; margin-right: 6px; }

.button {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  background: #151a25; cursor: pointer; font-weight: 700; font-size: 12px;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 24px rgba(125, 92, 255, .22); }
.button.ghost { background: transparent; }
.button.small { padding: 8px 11px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.page-section { display: none; }
.page-section.active { display: block; animation: reveal .24s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero-panel {
  min-height: 250px; padding: 34px; border: 1px solid #2d3150;
  border-radius: 24px; position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.3fr .7fr; align-items: center;
  background:
    radial-gradient(circle at 80% 50%, rgba(125, 92, 255, .22), transparent 17rem),
    linear-gradient(135deg, #121623, #0d1018 60%);
}
.hero-panel:after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(to right, transparent, black); pointer-events: none; }
.hero-panel h2 { font-size: clamp(30px, 4vw, 48px); line-height: 1.03; max-width: 700px; margin: 17px 0 14px; letter-spacing: -.035em; }
.hero-panel p { color: #a8b0bf; line-height: 1.65; max-width: 680px; font-size: 14px; }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: 7px 9px; border: 1px solid #343a52; border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: .12em; color: #b9c1d0; background: rgba(255,255,255,.025); }

.hero-orbit { position: relative; width: 210px; height: 210px; margin-left: auto; }
.hero-orbit:before, .hero-orbit:after { content: ""; position: absolute; inset: 14%; border: 1px solid rgba(160, 147, 255, .22); border-radius: 50%; }
.hero-orbit:after { inset: 0; }
.core { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; background: linear-gradient(135deg, #7d5cff, #5140d9); font-family: Manrope; font-weight: 800; box-shadow: 0 0 60px rgba(125,92,255,.35); }
.satellite { position: absolute; width: 38px; height: 38px; display: grid; place-items: center; background: #151a25; border: 1px solid #343a52; border-radius: 12px; font-size: 10px; font-weight: 800; color: #cdd3df; }
.s1 { top: 0; left: 86px; } .s2 { right: 0; top: 86px; } .s3 { bottom: 0; left: 86px; } .s4 { left: 0; top: 86px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.metric {
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, #111620, #0e121a);
}
.metric small { color: var(--muted); font-size: 11px; }
.metric strong { display: block; font-family: Manrope; font-size: 28px; margin-top: 10px; }
.metric em { display: block; color: #697386; font-size: 10px; font-style: normal; margin-top: 5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #0e121a; padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.link-button { border: 0; background: transparent; color: #9885ff; cursor: pointer; font-size: 11px; }
.stack { display: grid; }
.list-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px 0; border-top: 1px solid #1c2330; }
.list-row:first-child { border-top: 0; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: #1a2030; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.list-row strong, .list-row small { display: block; }
.list-row strong { font-size: 12px; }
.list-row small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.badge { padding: 5px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; background: #191f2b; color: #8f99aa; border: 1px solid #2a3241; }
.badge.ok { color: #57e7bf; border-color: rgba(34,211,166,.22); background: rgba(34,211,166,.07); }
.badge.warn { color: #ffc972; border-color: rgba(255,181,71,.2); background: rgba(255,181,71,.06); }
.queue-panel { margin-top: 18px; }
.queue { display: grid; gap: 9px; }
.queue-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; align-items: center; padding: 13px; border: 1px solid #1f2634; border-radius: 12px; background: #111620; }
.queue-row p { margin: 0; font-size: 11px; color: #b8c0ce; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.section-intro { display: flex; justify-content: space-between; gap: 22px; align-items: end; margin: 8px 0 22px; }
.section-intro h2 { font-size: 28px; margin: 14px 0 6px; }
.section-intro p { color: var(--muted); margin-bottom: 0; max-width: 650px; font-size: 13px; }

.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.detail-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #0e121a; }
.detail-card .card-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.detail-card h3 { font-size: 14px; margin: 13px 0 4px; }
.detail-card p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
.meta span { font-size: 9px; padding: 5px 7px; border-radius: 7px; background: #171c27; color: #8d97a8; }

.content-list { display: grid; gap: 10px; }
.content-card { border: 1px solid var(--line); border-radius: 15px; padding: 18px; background: #0e121a; display: grid; grid-template-columns: 140px 1fr auto; gap: 16px; align-items: center; }
.content-card p { margin: 0; font-size: 12px; color: #c7ced9; line-height: 1.55; }

.empty-state { min-height: 460px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border: 1px dashed #2d3545; border-radius: 22px; background: rgba(15,19,27,.7); padding: 40px; }
.empty-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: #171d2a; border: 1px solid #2e374a; font-size: 22px; }
.empty-state h2 { margin: 20px 0 8px; }
.empty-state p { color: var(--muted); max-width: 600px; line-height: 1.6; }
.future-tags { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-top: 13px; }
.future-tags span { border: 1px solid #283144; border-radius: 999px; padding: 7px 10px; font-size: 10px; color: #8e98ab; }

dialog { border: 0; background: transparent; color: inherit; padding: 0; }
dialog::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(4px); }
.dialog-card { width: min(560px, calc(100vw - 30px)); padding: 22px; background: #10141d; border: 1px solid #303849; border-radius: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.dialog-head h3 { margin: 0; }
.icon-button { border: 0; background: transparent; font-size: 24px; cursor: pointer; color: #8f99aa; }
label { display: grid; gap: 7px; color: #a9b2c1; font-size: 11px; font-weight: 700; margin-top: 14px; }
select, textarea { width: 100%; border: 1px solid #2b3343; background: #0b0e14; color: var(--text); border-radius: 10px; padding: 11px; outline: none; }
textarea { resize: vertical; }
select:focus, textarea:focus { border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 15px; background: #171d28; border: 1px solid #333c4e; border-radius: 11px; color: #d8dde6; font-size: 11px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 82px 1fr; }
  .sidebar { padding-inline: 12px; }
  .brand span:last-child, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item span { font-size: 18px; }
  .environment div, .domain { display: none; }
  .environment { justify-content: center; }
  .grid-2, .cards-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; }
  .brand { flex: 0 0 auto; }
  .nav { display: flex; margin: 0 0 0 18px; }
  .sidebar-bottom { display: none; }
  .main { padding: 24px 16px 50px; }
  .topbar, .section-intro { align-items: flex-start; flex-direction: column; }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-orbit { display: none; }
  .metric-grid, .grid-2, .cards-grid { grid-template-columns: 1fr; }
  .queue-row, .content-card { grid-template-columns: 1fr; }
}


/* v0.2 — authentication and Cost Center */
.button.danger { background: rgba(255,93,117,.1); border-color: rgba(255,93,117,.35); color: #ff8093; }
.button.safe-action { background: rgba(34,211,166,.09); border-color: rgba(34,211,166,.28); color: #65e9c4; }
.badge.danger { color: #ff8093; border-color: rgba(255,93,117,.3); background: rgba(255,93,117,.08); }

.storage-status { margin-top: 10px; text-align: center; font-size: 9px; color: #727d90; }
.storage-status.connected { color: #57e7bf; }
.storage-status.warning { color: #ffc972; }
.storage-status.error { color: #ff8093; }

.cost-metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.cost-metric { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, #111620, #0e121a); }
.cost-metric > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cost-metric small { color: var(--muted); font-size: 11px; }
.cost-metric strong { display: block; font-family: Manrope; font-size: 29px; margin: 12px 0 5px; }
.cost-metric > span { color: #697386; font-size: 10px; }
.cost-grid { margin-top: 18px; }

.cost-chart { height: 220px; display: flex; align-items: flex-end; gap: 7px; padding: 20px 2px 0; border-bottom: 1px solid #242b39; }
.cost-bar-wrap { flex: 1; height: 100%; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.cost-bar { width: min(22px, 75%); min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #8e75ff, #5b46dd); box-shadow: 0 0 18px rgba(125,92,255,.15); }
.cost-bar-wrap small { color: #687286; font-size: 8px; }
.cost-bar-value { color: #919bad; font-size: 8px; min-height: 10px; white-space: nowrap; }

.budget-form { display: grid; gap: 17px; }
.budget-row label { display: grid; grid-template-columns: 1fr auto 110px; align-items: center; gap: 8px; margin: 0 0 8px; }
.budget-row label span { color: #5f697c; font-size: 9px; }
.budget-row input { margin: 0; }
.budget-progress { height: 7px; border-radius: 999px; overflow: hidden; background: #1a202c; }
.budget-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7054ef, #a48fff); border-radius: inherit; transition: width .25s ease; }

.safety-card { display: grid; gap: 2px; }
.safety-line { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid #1c2330; font-size: 11px; }
.safety-card p { color: var(--muted); font-size: 10px; line-height: 1.55; margin: 14px 0 0; }

.cost-events { display: grid; }
.cost-event { display: grid; grid-template-columns: 155px 90px 1fr auto; gap: 13px; align-items: center; padding: 12px 0; border-top: 1px solid #1c2330; font-size: 10px; }
.cost-event:first-child { border-top: 0; }
.cost-event time { color: #737d8f; }
.cost-event strong { font-size: 10px; }
.cost-event span { color: #a3adbd; }
.cost-event em { font-style: normal; font-family: Manrope; font-weight: 800; }
.zero-state { padding: 26px 10px; text-align: center; color: #697386; font-size: 10px; }

input { width: 100%; border: 1px solid #2b3343; background: #0b0e14; color: var(--text); border-radius: 10px; padding: 11px; outline: none; }
input:focus { border-color: var(--accent); }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(440px, 100%); }
.login-brand { display: flex; gap: 12px; align-items: center; justify-content: center; margin-bottom: 20px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-family: Manrope; }
.login-brand small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.login-card { padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: rgba(14,18,26,.96); box-shadow: 0 24px 90px rgba(0,0,0,.35); }
.login-card h1 { margin: 18px 0 10px; font-size: 28px; }
.login-card > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-submit { width: 100%; margin-top: 20px; padding-block: 12px; }
.form-error { min-height: 16px; color: #ff8093; font-size: 10px; margin: 10px 0 0; text-align: center; }
.login-foot { color: #566075; font-size: 9px; text-align: center; margin-top: 18px; }
.setup-notice { margin: 18px 0; padding: 12px; border: 1px solid rgba(255,181,71,.25); background: rgba(255,181,71,.06); border-radius: 11px; }
.setup-notice strong, .setup-notice span { display: block; }
.setup-notice strong { color: #ffc972; font-size: 11px; }
.setup-notice span { color: #a5adba; font-size: 10px; line-height: 1.5; margin-top: 4px; }
.hidden { display: none !important; }

@media (max-width: 1050px) {
  .cost-metric-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .cost-metric-grid { grid-template-columns: 1fr; }
  .cost-intro .button { width: 100%; }
  .cost-event { grid-template-columns: 1fr 1fr; }
  .cost-event span { grid-column: 1 / -1; }
  .budget-row label { grid-template-columns: 1fr auto 100px; }
}


/* v0.4 — OpenAI simulation generator */
.ai-generator-panel { margin-bottom: 18px; border-color: #302d55; background: linear-gradient(145deg, #101420, #0e121a); }
.ai-generator-status { display: flex; align-items: center; justify-content: flex-end; }
.ai-generator-form { display: grid; gap: 14px; }
.ai-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ai-generator-form label { margin-top: 0; }
.ai-generator-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 2px; }
.ai-generator-actions small { color: #788398; font-size: 10px; line-height: 1.55; max-width: 620px; }
.ai-generator-actions .button { flex: 0 0 auto; }
.ai-generator-panel textarea { min-height: 116px; }
.ai-generator-panel select { min-height: 42px; }

@media (max-width: 760px) {
  .ai-form-grid { grid-template-columns: 1fr; }
  .ai-generator-actions { align-items: stretch; flex-direction: column; }
  .ai-generator-actions .button { width: 100%; }
}


/* v0.4.1 — database-only empty states */
#accountsGrid > .zero-state,
#agentsGrid > .zero-state {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed #2d3545;
  border-radius: 16px;
  background: rgba(15, 19, 27, .5);
}
