/* Base comes from your design; we append only missing blocks. */

.panel-shell {
  /* Override template "main-container" (which is a flex row) into a proper app shell. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(1760px, 100%);
  max-width: 1760px;
  height: calc(100vh - 40px);
  max-height: 1120px;
  min-height: 720px;
}

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-0);
  background: rgba(0, 0, 0, 0.12);
  flex: 0 0 auto;
}

.panel-content {
  padding: 22px;
  width: 100%;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--accent-0), var(--accent-1));
}
.brand-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-0);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  cursor: pointer;
  text-decoration: none;
}
.icon-pill:hover {
  border-color: rgba(99, 102, 241, 0.35);
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.muted {
  color: var(--text-2);
  margin-top: 6px;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-0);
  border-radius: 16px;
  padding: 16px;
}
.card-title {
  font-weight: 700;
  margin-bottom: 12px;
}

.auth-shell {
  min-height: 60vh;
  display: grid;
  place-items: center;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface-1);
  border: 1px solid var(--border-0);
  border-radius: 18px;
  padding: 22px;
}
.auth-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-gap {
  margin-top: 12px;
}
.field > span {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-0);
  color: var(--text-0);
  outline: none;
}
.field input:focus,
.field textarea:focus {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-0), var(--accent-1));
  color: #fff;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-0);
  color: var(--text-0);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fff;
}

.error {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
}

.exchange-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .exchange-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .exchange-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.exchange-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border-0);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.exchange-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}
.exchange-card .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  border: 1px solid var(--border-0);
  background: rgba(255, 255, 255, 0.04);
}
.pill.ok { border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.10); }
.pill.warn { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.10); }
.pill.info { border-color: rgba(56,189,248,0.35); background: rgba(56,189,248,0.10); }
.pill.danger { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.10); }

.exchange-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 1200px) {
  .exchange-layout {
    grid-template-columns: 380px 1fr;
    align-items: start;
  }
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-0);
}
.kv > div:last-child { border-bottom: 0; }
.kv .k { color: var(--text-2); font-weight: 700; }
.kv .v { color: var(--text-0); font-weight: 700; text-align: right; }

.page-head h1 {
  font-weight: 700;
}

.exchange-card .row > div:first-child {
  font-weight: 700 !important;
}

.toast-stack {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  position: relative;
  padding: 12px 12px 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-0);
  background: rgba(15, 15, 30, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.55);
  overflow: hidden;
}

.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-0), var(--accent-1));
}

.toast-title {
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-right: 34px;
}

.toast-text {
  margin-top: 6px;
  color: var(--text-2);
  line-height: 1.35;
  padding-right: 34px;
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  border: 1px solid var(--border-0);
  background: rgba(255,255,255,0.04);
  color: var(--text-1);
  cursor: pointer;
}
.toast-close:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

.toast a {
  color: inherit;
  text-decoration: none;
}

.toast-enter {
  animation: toastIn 220ms ease-out both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-exit {
  animation: toastOut 180ms ease-in both;
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

.chat-card { height: min(72vh, 760px); display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow: auto; padding: 6px 2px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-0);
  background: rgba(255, 255, 255, 0.05);
}
.chat-bubble.alert {
  background: #b21d2d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
}
.chat-bubble.alert .chat-meta {
  color: rgba(255, 255, 255, 0.85);
}
.chat-bubble.me { margin-left: auto; background: rgba(99, 102, 241, 0.12); border-color: rgba(99, 102, 241, 0.28); }
.chat-meta { color: var(--text-3); font-size: 0.78rem; margin-top: 6px; }
.chat-form { display: flex; gap: 10px; margin-top: 12px; }
.chat-form input { flex: 1; padding: 12px 12px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--border-0); color: var(--text-0); outline: none; }
.chat-form input:focus { border-color: rgba(99, 102, 241, 0.45); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14); }
