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

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
  padding: 0.5rem 1.25rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.header-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.sidebar-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color-muted);
}

.body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 1rem;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}

.sidebar h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.view-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.view-btn {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
}

.view-btn.active {
  border-color: var(--color-primary);
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 500;
}

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

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem;
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--color-muted);
  font-size: 1rem;
}

.loading,
.error {
  padding: 2rem;
  text-align: center;
}

.error {
  color: var(--color-danger);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--footer-height);
  padding: 0 1.25rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
  .body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .view-toggle {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
