:root {
  --blue: #16314f;
  --blue-2: #21496f;
  --gold: #b9904a;
  --ivory: #f7f2e9;
  --white: #ffffff;
  --soft: #f0eadf;
  --border: #ded2bf;
  --muted: #6e7480;
  --danger: #9f2f2f;
  --success: #1f7a4d;
  --shadow: 0 18px 50px rgba(22, 49, 79, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ivory); color: var(--blue); }
button, input, select { font: inherit; }
button { border: 0; border-radius: 12px; padding: 11px 15px; background: var(--blue); color: var(--ivory); font-weight: 800; cursor: pointer; }
button:hover { filter: brightness(1.04); }
button.secondary { background: var(--white); color: var(--blue); border: 1px solid var(--border); }
button.danger { background: var(--danger); color: var(--white); }
code { background: var(--soft); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 292px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--blue); color: var(--ivory); padding: 22px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px; background: var(--gold); color: var(--blue); display: grid; place-items: center; font-weight: 900; }
.brand h1 { margin: 0; font-size: 22px; }
.brand p { margin: 2px 0 0; color: rgba(247,242,233,.72); font-size: 13px; }
.nav { display: grid; gap: 9px; }
.nav-item { width: 100%; text-align: left; background: transparent; color: var(--ivory); border: 1px solid rgba(247,242,233,.18); }
.nav-item.active, .nav-item:hover { background: rgba(247,242,233,.12); border-color: rgba(247,242,233,.34); }
.session-card { margin-top: auto; border: 1px solid rgba(247,242,233,.18); border-radius: 16px; padding: 13px; display: flex; gap: 10px; align-items: center; background: rgba(247,242,233,.08); }
.session-card strong, .session-card small { display: block; }
.session-card small { color: rgba(247,242,233,.72); word-break: break-word; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); flex: 0 0 auto; }
.status-dot.ok { background: #56c281; }

.main { padding: 24px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; color: var(--gold); font-size: 12px; letter-spacing: .08em; font-weight: 900; text-transform: uppercase; }
.topbar h2 { margin: 0; font-size: 31px; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notice { margin-bottom: 16px; background: var(--white); border: 1px solid var(--border); border-left: 5px solid var(--gold); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow); white-space: pre-wrap; }
.notice.error { border-left-color: var(--danger); color: var(--danger); }
.notice.success { border-left-color: var(--success); color: var(--success); }

.view { display: none; }
.view.active { display: grid; gap: 18px; }
.grid { display: grid; gap: 18px; }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--white); border: 1px solid var(--border); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 20px; }
.card p { color: var(--muted); line-height: 1.55; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 7px 0 4px; font-size: 30px; line-height: 1.1; word-break: break-word; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.7; }

.form { display: grid; gap: 13px; }
.form label { display: grid; gap: 7px; color: var(--blue); font-size: 13px; font-weight: 800; }
.form input, .form select { width: 100%; border: 1px solid var(--border); background: var(--soft); border-radius: 12px; padding: 11px 12px; color: var(--blue); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.simulation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full-row { grid-column: 1 / -1; }
.help { margin: 0; font-size: 13px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.section-head h3, .section-head p { margin: 0; }
.section-head p { color: var(--muted); font-size: 13px; }
.list { display: grid; gap: 10px; }
.list.empty { color: var(--muted); background: var(--soft); border-radius: 14px; padding: 14px; }
.item { border: 1px solid var(--border); border-radius: 15px; padding: 13px; background: #fffdfa; }
.item strong { display: block; font-size: 15px; }
.item small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.item .amount { color: var(--gold); font-weight: 900; margin-top: 8px; }

.estimate-box { background: var(--soft); border: 1px solid var(--border); border-radius: 16px; padding: 14px; color: var(--muted); line-height: 1.6; }
.estimate-box strong { color: var(--blue); font-size: 24px; }
.json-output { min-height: 120px; max-height: 420px; overflow: auto; margin: 0; background: #12253b; color: #e7eef7; border-radius: 16px; padding: 14px; font-size: 12px; line-height: 1.55; }

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards-4, .two-cols, .simulation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { grid-template-columns: 1fr; }
}
