.app {
  position: relative;
  z-index: 1;
  width: min(calc(100vw - 2rem), 96rem);
  height: calc(100vh - 2rem);
  margin: 1rem auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 0.0625rem solid rgba(255, 255, 255, 0.45);
}

body[data-theme="dark"] .app {
  border-color: rgba(42, 57, 66, 0.9);
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: var(--header);
  color: var(--ink);
  border-bottom: 0.0625rem solid var(--stroke);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}

.brand-dot {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #25d366);
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 800;
}

.brand-sub {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1 1 24rem;
  justify-content: center;
  min-width: 0;
  padding: 0.25rem;
  border-radius: 0.875rem;
  background: rgba(255, 255, 255, 0.6);
  border: 0.0625rem solid var(--stroke);
  overflow-x: auto;
}

body[data-theme="dark"] .top-nav {
  background: rgba(11, 20, 26, 0.45);
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border: 0.0625rem solid transparent;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(17, 27, 33, 0.06);
  color: var(--ink);
}

.nav-btn.active {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--stroke);
}

body[data-theme="dark"] .nav-btn:hover {
  background: rgba(233, 237, 239, 0.06);
}

body[data-theme="dark"] .nav-btn.active {
  background: #111b21;
}

.nav-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: currentColor;
}

.nav-icon svg {
  width: 1rem;
  height: 1rem;
}

.nav-btn.active .nav-icon {
  background: rgba(0, 168, 132, 0.12);
  color: var(--accent-dark);
}

.nav-label {
  letter-spacing: 0.01em;
}

.views {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
}

.view-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.view-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(21rem, 24rem) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
}

.panel-left,
.panel-right {
  display: flex;
  flex-direction: column;
}

.panel-left {
  background: var(--panel);
  min-height: 0;
  overflow: hidden;
  border-right: 0.0625rem solid var(--stroke);
}

.panel-center {
  background: var(--panel);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-right {
  background: var(--panel);
}

.panel-header {
  padding: 1rem 1rem 0.75rem;
}

.panel-header h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 800;
}

.internal-shell {
  display: grid;
  grid-template-columns: minmax(21rem, 24rem) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 0.0625rem solid var(--stroke);
  background: var(--panel);
}

.panel,
.metric-card {
  animation: floatIn 0.45s ease both;
}

.panel-center {
  animation-delay: 0.08s;
}
