@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;800&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg0: #05070f;
  --bg1: #0a1020;
  --panel: rgba(8, 14, 28, 0.82);
  --line: rgba(0, 240, 255, 0.18);
  --line2: rgba(168, 85, 247, 0.22);
  --cyan: #00f0ff;
  --magenta: #d946ef;
  --amber: #f5c15d;
  --lime: #a3e635;
  --text: #e8eef8;
  --muted: #8fa0b8;
  --user-bubble: rgba(0, 240, 255, 0.12);
  --bot-bubble: rgba(168, 85, 247, 0.10);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  --top-h: 58px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Orbitron", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(0,240,255,.14), transparent 55%),
    radial-gradient(800px 420px at 88% 0%, rgba(217,70,239,.12), transparent 50%),
    radial-gradient(700px 500px at 50% 100%, rgba(163,230,53,.06), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 55%, #070b16);
}
a { color: var(--cyan); text-decoration: none; }
button, textarea, input, select { font: inherit; color: inherit; }

.mc-app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

.mc-top {
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 18, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.mc-brand {
  display: flex; align-items: center; gap: 10px; color: var(--text);
}
.mc-brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid rgba(0,240,255,.45);
  box-shadow: 0 0 18px rgba(0,240,255,.25);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 14px; color: var(--cyan);
}
.mc-brand strong {
  display: block; font-family: var(--display); font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase;
}
.mc-brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .04em; }

.mc-top-tools { display: flex; align-items: center; gap: 8px; }
.mc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 11px; background: rgba(0,0,0,.35); font-size: 12px; color: var(--muted);
}
.mc-chip b { color: var(--amber); font-weight: 700; }
.mc-icon {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(0,0,0,.35);
  display: grid; place-items: center; color: var(--text); cursor: pointer;
}
.mc-icon:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(0,240,255,.18); }
.mc-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(217,70,239,.45);
  background: linear-gradient(135deg, rgba(0,240,255,.25), rgba(217,70,239,.35));
  display: grid; place-items: center;
  font-family: var(--display); font-size: 11px; font-weight: 700; color: #fff;
}

.mc-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  min-height: calc(100dvh - var(--top-h) - var(--nav-h) - var(--safe-bottom));
}
@media (max-width: 860px) {
  .mc-main { grid-template-columns: 1fr; }
  .mc-side { display: none; }
  .mc-side.is-open {
    display: flex; position: fixed; inset: var(--top-h) 0 var(--nav-h) 0;
    z-index: 25; background: rgba(5,8,18,.96);
  }
}

.mc-side, .mc-stage {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid rgba(255,255,255,.05);
}
.mc-stage { border-right: 0; }

.mc-side-h, .mc-stage-h {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.mc-side-h h1, .mc-stage-h h2 {
  margin: 0; font-family: var(--display); font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--cyan);
  text-shadow: 0 0 18px rgba(0,240,255,.25);
}
.mc-btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px;
  padding: 9px 12px; font-weight: 700; letter-spacing: .04em;
}
.mc-btn-primary {
  background: linear-gradient(135deg, rgba(0,240,255,.95), rgba(56,189,248,.85));
  color: #041018; box-shadow: 0 0 20px rgba(0,240,255,.25);
}
.mc-btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line);
}

.mc-thread-list { overflow: auto; flex: 1; padding: 8px; }
.mc-thread {
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 14px;
  padding: 12px; margin-bottom: 6px; color: var(--text);
}
.mc-thread:hover, .mc-thread.active {
  border-color: var(--line); background: rgba(0,240,255,.06);
  box-shadow: inset 0 0 0 1px rgba(0,240,255,.08);
}
.mc-thread strong { display: block; font-size: 14px; margin-bottom: 4px; }
.mc-thread span { display: block; color: var(--muted); font-size: 12px; }

.mc-persona {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.mc-persona-avatar {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(0,240,255,.45), transparent 45%),
    linear-gradient(145deg, #1a1040, #0a2a40);
  border: 1px solid rgba(0,240,255,.4);
  box-shadow: 0 0 22px rgba(0,240,255,.2);
  display: grid; place-items: center;
  font-family: var(--display); font-size: 13px; color: #fff;
}
.mc-persona strong {
  display: block; font-family: var(--display); font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase;
}
.mc-persona small { color: var(--muted); font-size: 12px; }
.mc-ready {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--lime); font-size: 12px; white-space: nowrap;
}
.mc-ready i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 10px rgba(163,230,53,.8); display: inline-block;
}

.mc-meta-row {
  display: grid; grid-template-columns: 1.4fr 1fr .8fr; gap: 8px;
  padding: 10px 16px 0;
}
@media (max-width: 720px) { .mc-meta-row { grid-template-columns: 1fr; } }
.mc-field label {
  display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
.mc-field input {
  width: 100%; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0,0,0,.35); padding: 10px 12px; outline: none;
}
.mc-field input:focus { border-color: rgba(0,240,255,.55); box-shadow: 0 0 0 3px rgba(0,240,255,.08); }
.mc-ids {
  padding: 8px 16px 0; color: var(--muted); font-size: 11px; letter-spacing: .02em;
}

.mc-chat {
  flex: 1; overflow: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.mc-bubble {
  max-width: min(760px, 92%);
  padding: 12px 14px; border-radius: 16px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.mc-bubble.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border: 1px solid rgba(0,240,255,.22);
}
.mc-bubble.assistant {
  align-self: flex-start;
  background: var(--bot-bubble);
  border: 1px solid rgba(168,85,247,.25);
}
.mc-bubble .who {
  display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}

.mc-composer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 8px;
  background: rgba(5,8,18,.75);
}
.mc-composer-row { display: flex; gap: 8px; align-items: flex-end; }
.mc-composer textarea {
  flex: 1; min-height: 56px; max-height: 160px; resize: vertical;
  border-radius: 16px; border: 1px solid var(--line);
  background: rgba(0,0,0,.4); padding: 12px 14px; outline: none;
}
.mc-composer textarea:focus { border-color: rgba(0,240,255,.5); }
.mc-send {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(145deg, var(--cyan), #38bdf8);
  color: #041018; display: grid; place-items: center;
  box-shadow: 0 0 22px rgba(0,240,255,.35);
}
.mc-send:disabled { opacity: .5; cursor: not-allowed; }
.mc-hint { color: var(--muted); font-size: 12px; }

.mc-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 0 8px var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(4, 8, 18, 0.94);
  backdrop-filter: blur(16px);
}
.mc-bottom a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--muted); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; text-decoration: none; min-height: var(--nav-h);
}
.mc-bottom a svg { opacity: .85; }
.mc-bottom a.active, .mc-bottom a:hover {
  color: var(--cyan); text-shadow: 0 0 12px rgba(0,240,255,.35);
}
.mc-bottom a.active svg, .mc-bottom a:hover svg {
  filter: drop-shadow(0 0 6px rgba(0,240,255,.55));
}

.mc-toast {
  position: fixed; right: 14px; bottom: calc(var(--nav-h) + 18px + var(--safe-bottom));
  background: #0b1220; border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 12px; max-width: 300px; display: none; z-index: 50;
}
.mc-toast.show { display: block; }

.mc-landing {
  max-width: 880px; margin: 0 auto; padding: 48px 18px 100px;
}
.mc-landing h1 {
  font-family: var(--display); font-size: clamp(28px, 5vw, 44px);
  letter-spacing: .04em; margin: 0 0 12px;
  color: var(--cyan); text-shadow: 0 0 28px rgba(0,240,255,.28);
}
.mc-landing p { color: var(--muted); line-height: 1.65; max-width: 40rem; }
.mc-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.mc-form-page { max-width: 980px; margin: 0 auto; padding: 18px 14px 100px; }
.mc-grid-forms {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 860px) { .mc-grid-forms { grid-template-columns: 1fr; } }
.mc-card {
  border: 1px solid var(--line); border-radius: 20px; background: var(--panel);
  overflow: hidden;
}
.mc-card-h {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  font-family: var(--display); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--cyan);
}
.mc-form { display: grid; gap: 12px; padding: 16px; }
.mc-form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.mc-form input, .mc-form select, .mc-form textarea {
  border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35);
  padding: 11px 12px;
}
.mc-form textarea { min-height: 140px; resize: vertical; }
.mc-check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
.mc-cards { display: grid; gap: 10px; padding: 14px; }
.mc-mini {
  border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 12px;
  background: rgba(0,0,0,.22);
}
.mc-mini h3 { margin: 0 0 6px; font-size: 15px; }
.mc-mini p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.mc-ops pre {
  margin: 0; padding: 16px; overflow: auto; color: #9fb3cc;
  font-size: 12px; line-height: 1.45; max-height: 60vh;
}


.mc-title-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 0;
}
.mc-title-input {
  flex: 1; border-radius: 12px; border: 1px solid transparent;
  background: transparent; padding: 8px 10px; outline: none;
  font-family: var(--display); font-size: 13px; letter-spacing: .04em;
  color: var(--text);
}
.mc-title-input:not(:disabled) {
  border-color: var(--line); background: rgba(0,0,0,.35);
}
.mc-title-input:focus {
  border-color: rgba(0,240,255,.55); box-shadow: 0 0 0 3px rgba(0,240,255,.08);
}
.mc-title-input:disabled { opacity: .85; cursor: default; }
.mc-title-input::placeholder { color: var(--muted); font-family: var(--font); letter-spacing: 0; font-size: 13px; }
.mc-title-edit { padding: 8px 10px; min-width: 40px; }
.mc-title-edit.is-editing {
  border-color: var(--cyan); color: var(--cyan);
}
.mc-meta-row { display: none !important; }

/* MetaCore-style topbar */
.mc-top {
  height: auto;
  min-height: var(--top-h);
  flex-wrap: wrap;
  padding: 8px 12px;
  gap: 8px;
}
.mc-top-tools {
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.mc-top-pills {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.mc-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(0,0,0,.35);
  color: var(--text);
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
}
.mc-pill:hover { border-color: var(--cyan); text-decoration: none; color: var(--cyan); }
.mc-pill.is-guest { opacity: .85; }
.mc-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 8px rgba(163,230,53,.7);
  display: inline-block;
}
.mc-pill .dot.off { background: #64748b; box-shadow: none; }
.mc-wallet-combo {
  display: inline-flex; align-items: stretch;
  border: 1px solid rgba(0,240,255,.35);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0,20,30,.45);
  box-shadow: 0 0 16px rgba(0,240,255,.12);
}
.mc-wallet-combo a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px; color: var(--text); text-decoration: none; font-size: 12px;
}
.mc-wallet-combo a:hover { background: rgba(0,240,255,.08); }
.mc-wallet-combo strong { color: var(--cyan); font-weight: 700; }
.mc-wallet-combo .sep {
  align-self: center; color: var(--muted); padding: 0 2px; font-size: 12px;
}
.mc-ico-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(0,0,0,.35);
  display: grid; place-items: center; color: var(--text); text-decoration: none;
  font-size: 14px;
}
.mc-ico-btn:hover { border-color: var(--cyan); color: var(--cyan); text-decoration: none; }
.mc-avatar.is-user {
  border-color: rgba(0,240,255,.55);
  box-shadow: 0 0 14px rgba(0,240,255,.25);
}
.mc-top-local {
  display: inline-flex; gap: 6px; align-items: center;
}
@media (max-width: 720px) {
  .mc-top-pills .mc-pill em-hide, .mc-pill .hide-sm { display: none; }
  .mc-brand small { display: none; }
}

/* Topbar MetaCore parity polish */
.mc-wallet-combo strong { color: var(--amber); font-variant-numeric: tabular-nums; }
.mc-wallet-combo #topEur, .mc-wallet-combo a#walletEur strong { color: var(--cyan); }
.mc-pill.is-guest { border-color: rgba(100,116,139,.45); }
.mc-pill:not(.is-guest) { border-color: rgba(0,240,255,.35); }
.mc-top-local .mc-m-sep {
  color: rgba(148,163,184,.45); font-size: 14px; padding: 0 2px; user-select: none;
}
.mc-avatar { text-decoration: none; }
.mc-avatar.is-user {
  border-color: rgba(217,70,239,.55);
  background: linear-gradient(135deg, #1e1b4b, #a21caf 70%);
}
@media (max-width: 640px) {
  .mc-top-pills { display: none; }
  .mc-wallet-combo a { padding: 6px 8px; font-size: 11px; }
}
