/* Layout */

.app {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 40px 36px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
}

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1600px) {
  .app {
    max-width: 1600px;
    padding: 44px 56px 88px;
  }
}

/* Header */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand__mark {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(201, 168, 76, 0.12);
  animation: markSpin 1.2s ease both;
}

.brand__mark::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(201, 168, 76, 0.6);
  transform: rotate(45deg);
}

.brand__mark::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--gold);
  border-radius: 50%;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.muted {
  color: var(--muted-color);
  margin: 2px 0 0;
  font-size: 14px;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Chips & Tags */

.chip {
  background: rgba(201, 168, 76, 0.06);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted-color);
  letter-spacing: 0.02em;
}

/* Navigation */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 20px;
  color: var(--muted-color);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

html[data-active-tab="prices"] .tab[data-tab="summary"],
html[data-active-tab="accounts"] .tab[data-tab="summary"],
html[data-active-tab="shares"] .tab[data-tab="summary"],
html[data-active-tab="history"] .tab[data-tab="summary"] {
  color: var(--muted-color);
  border-bottom-color: transparent;
}

html[data-active-tab="prices"] .tab[data-tab="prices"],
html[data-active-tab="accounts"] .tab[data-tab="accounts"],
html[data-active-tab="shares"] .tab[data-tab="shares"],
html[data-active-tab="history"] .tab[data-tab="history"] {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Panels */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
}

html:not(.is-booted) .panel {
  animation: panelReveal 0.45s ease both;
}

html[data-active-tab="prices"] [data-panel="summary"],
html[data-active-tab="accounts"] [data-panel="summary"],
html[data-active-tab="shares"] [data-panel="summary"],
html[data-active-tab="history"] [data-panel="summary"] {
  display: none;
}

html[data-active-tab="prices"] [data-panel="prices"],
html[data-active-tab="accounts"] [data-panel="accounts"],
html[data-active-tab="shares"] [data-panel="shares"],
html[data-active-tab="history"] [data-panel="history"] {
  display: block;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.2;
  border-radius: 1px;
}

.panel__header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.panel__header h2 {
  margin: 0 0 2px;
  font-size: 24px;
  font-weight: 500;
}

.panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.panel__subsection {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.panel__subsection h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
}

/* Footer */

.site-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.site-footer__brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
}

.site-footer__brand span {
  color: var(--gold);
}

.site-footer__desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted-color);
}

.site-footer__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-footer__stamp {
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(201, 168, 76, 0.07);
  border-color: rgba(201, 168, 76, 0.18);
  font-size: 13px;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 9, 7, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 1;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.modal.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
}

.modal__content {
  position: relative;
  max-width: 420px;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.modal__content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.3;
}

.modal__content h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}


/* Explainer */

.explainer {
  margin: -8px 0 16px;
  color: var(--muted-color);
  font-size: 14px;
}

.explainer summary {
  cursor: pointer;
  width: fit-content;
  color: var(--muted-color);
}

.explainer summary:hover {
  color: var(--gold);
}

.explainer p {
  max-width: 72ch;
  margin: 8px 0 0;
}

/* Toasts */

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toastIn 0.2s ease both;
}

.toast--error {
  border-color: rgba(194, 82, 74, 0.5);
}

.toast__message {
  flex: 1;
}

.toast__action {
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font: inherit;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
}

.toast__action:hover {
  background: var(--gold-soft);
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.toast__close:hover {
  color: var(--text);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.panel:focus-visible {
  outline-offset: 4px;
}
