:root {
  --bg: #0c0d10;
  --bg-elev: #14161c;
  --bg-panel: #1a1d26;
  --line: rgba(232, 228, 220, 0.1);
  --text: #ece8e0;
  --muted: #9a958a;
  --steel: #c4ccd8;
  --amber: #e8a838;
  --amber-dim: rgba(232, 168, 56, 0.16);
  --danger: #e85d4c;
  --ok: #5cb88a;
  --vault: #3d8bfd;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --radius: 10px;
  --nav-w: 220px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(232, 168, 56, 0.12), transparent 55%),
    radial-gradient(900px 500px at -10% 40%, rgba(61, 139, 253, 0.08), transparent 50%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--amber);
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

/* —— Auth gate —— */
.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}

.gate-hero {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background: #050607 center/cover no-repeat;
}

.gate-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 30%, rgba(12, 13, 16, 0.55) 70%, var(--bg) 100%),
    linear-gradient(180deg, rgba(12, 13, 16, 0.15), rgba(12, 13, 16, 0.75));
}

.gate-brand {
  position: absolute;
  z-index: 2;
  left: clamp(24px, 4vw, 56px);
  bottom: clamp(28px, 5vw, 64px);
  max-width: 28rem;
  animation: rise 0.8s ease both;
}

.gate-brand .logo {
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vw, 7rem);
  letter-spacing: 0.04em;
  line-height: 0.9;
  margin: 0;
}

.gate-brand p {
  margin: 0.75rem 0 0;
  color: var(--steel);
  font-size: 1.05rem;
  max-width: 22rem;
}

.gate-panel {
  display: grid;
  place-items: center;
  padding: 2rem;
  animation: fade 0.7s ease 0.15s both;
}

.gate-card {
  width: min(100%, 380px);
}

.gate-card h2 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.35rem;
}

.gate-card .sub {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.pin-row {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.pin-row input {
  width: 100%;
  letter-spacing: 0.45em;
  text-align: center;
  font-size: 1.35rem;
  padding: 0.9rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
}

.gate-card .err {
  color: var(--danger);
  min-height: 1.25rem;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

/* —— Shell —— */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
}

.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 0.9rem;
  border-right: 1px solid var(--line);
  background: rgba(12, 13, 16, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav .brand {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.65rem 1rem;
}

.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 0.75rem;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.nav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav button.active {
  color: var(--bg);
  background: var(--amber);
  font-weight: 600;
}

.nav .spacer {
  flex: 1;
}

.main {
  padding: 1.5rem clamp(1rem, 2.5vw, 2.25rem) 3rem;
  min-width: 0;
}

.view-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.view-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3rem);
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 1;
}

.view-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* —— Hero / dashboard —— */
.hero {
  position: relative;
  min-height: min(52vh, 480px);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: center 40% / cover no-repeat;
  transform: scale(1.04);
  animation: drift 18s ease-in-out infinite alternate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(8, 9, 12, 0.88) 0%, rgba(8, 9, 12, 0.55) 45%, rgba(8, 9, 12, 0.15) 100%),
    linear-gradient(0deg, rgba(8, 9, 12, 0.85), transparent 50%);
}

.hero-content {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: inherit;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.85rem;
  max-width: 36rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--amber);
  margin: 0;
}

.hero h2 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  letter-spacing: 0.03em;
  margin: 0;
  line-height: 0.95;
}

.hero .goal-line {
  margin: 0;
  color: var(--steel);
  font-size: 1.05rem;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--amber), #f0c56d);
  border-radius: inherit;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.92rem;
  color: var(--steel);
}

.hero-meta strong {
  color: var(--text);
  font-weight: 600;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.stat {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.03em;
  margin: 0;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--amber-dim);
  color: var(--amber);
}

.pill.vault {
  background: rgba(61, 139, 253, 0.15);
  color: #8cbcff;
}

.pill.source {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.pill.danger {
  background: rgba(232, 93, 76, 0.15);
  color: var(--danger);
}

/* —— Forms —— */
.form {
  display: grid;
  gap: 0.85rem;
  max-width: 560px;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 0.75rem 1.1rem;
  background: var(--amber);
  color: #1a1205;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(1px);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 560;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.suggest {
  border: 1px solid rgba(232, 168, 56, 0.35);
  background: linear-gradient(160deg, rgba(232, 168, 56, 0.12), rgba(26, 29, 38, 0.9));
  border-radius: 14px;
  padding: 1rem 1.1rem;
  animation: pop 0.35s ease both;
}

.suggest strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  display: block;
  margin-bottom: 0.35rem;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}

.account {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
  transition: border-color 0.2s, transform 0.2s;
}

.account.vault {
  border-color: rgba(61, 139, 253, 0.35);
  background:
    linear-gradient(160deg, rgba(61, 139, 253, 0.1), transparent 55%),
    var(--bg-elev);
}

.account .name {
  font-weight: 650;
}

.account .bal {
  font-family: var(--font-display);
  font-size: 1.9rem;
  letter-spacing: 0.03em;
}

.chat {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 55vh;
  gap: 0.75rem;
}

.chat-log {
  overflow: auto;
  display: grid;
  gap: 0.65rem;
  align-content: start;
  padding: 0.25rem;
}

.bubble {
  max-width: 70ch;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  white-space: pre-wrap;
}

.bubble.user {
  justify-self: end;
  background: var(--amber-dim);
  border-color: rgba(232, 168, 56, 0.25);
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: pop 0.25s ease both;
  max-width: min(90vw, 360px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
  animation: fade 0.2s ease both;
}

.modal {
  width: min(100%, 420px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.modal h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.04em;
}

.level-bar {
  display: grid;
  gap: 0.35rem;
}

.list-empty {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.5rem 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.08) translate3d(-1.5%, -1%, 0);
  }
}

@media (max-width: 960px) {
  .gate {
    grid-template-columns: 1fr;
  }
  .gate-hero {
    min-height: 42vh;
  }
  .gate-hero::after {
    background: linear-gradient(180deg, transparent 20%, var(--bg) 95%);
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .nav {
    position: sticky;
    top: 0;
    height: auto;
    z-index: 20;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.65rem;
  }
  .nav .brand {
    width: 100%;
    padding-bottom: 0.35rem;
    font-size: 1.6rem;
  }
  .nav .spacer {
    display: none;
  }
  .nav button {
    padding: 0.5rem 0.65rem;
    font-size: 0.86rem;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .bubble {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
