:root {
  --demo-sidebar-width: 260px;
  --demo-topbar-height: 64px;
  --demo-bg: #fafafa;
  --demo-surface: #fff;
  --demo-border: rgba(0, 0, 0, 0.12);
  --demo-text: rgba(0, 0, 0, 0.87);
  --demo-text-secondary: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] {
  --demo-bg: #121212;
  --demo-surface: #1e1e1e;
  --demo-border: rgba(255, 255, 255, 0.12);
  --demo-text: rgba(255, 255, 255, 0.87);
  --demo-text-secondary: rgba(255, 255, 255, 0.6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  background: var(--demo-bg);
  color: var(--demo-text);
}

/* ── Topbar ── */
.me-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--demo-topbar-height);
  background: #1976d2;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px 0 24px;
  box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),
              0px 4px 5px 0px rgba(0,0,0,0.14),
              0px 1px 10px 0px rgba(0,0,0,0.12);
  z-index: 1100;
}

.me-topbar__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.me-topbar__logo {
  display: block;
  height: 36px;
  width: auto;
}

.me-topbar__alpha-badge {
  margin-left: 10px;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1976d2;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  line-height: 1.6;
  align-self: center;
}

.me-topbar__spacer { flex: 1; }

.me-topbar__icon-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 150ms, background-color 150ms;
}
.me-topbar__icon-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.12);
}

/* ── Sidebar ── */
.me-sidebar {
  position: fixed;
  top: var(--demo-topbar-height);
  left: 0;
  bottom: 0;
  width: var(--demo-sidebar-width);
  background: var(--demo-surface);
  border-right: 1px solid var(--demo-border);
  overflow-y: auto;
  padding: 8px 0 24px;
}

.me-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.me-sidebar__section {
  padding: 16px 24px 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--demo-text-secondary);
}

.me-sidebar__link {
  display: block;
  padding: 7px 24px;
  font-size: 0.875rem;
  color: var(--demo-text);
  text-decoration: none;
  border-radius: 0 24px 24px 0;
  margin-right: 8px;
  transition: background-color 150ms;
}

.me-sidebar__link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.me-sidebar__link--active {
  background: rgba(25, 118, 210, 0.12);
  color: #1976d2;
  font-weight: 500;
}

/* ── Main content ── */
.me-main {
  margin-left: var(--demo-sidebar-width);
  padding-top: calc(var(--demo-topbar-height) + 40px);
  padding-inline: 40px;
  padding-bottom: 80px;
  max-width: calc(var(--demo-sidebar-width) + 900px);
}

h1 {
  font-size: 2.125rem;
  font-weight: 400;
  letter-spacing: 0.00735em;
  margin: 0 0 12px;
}

.me-subtitle {
  font-size: 1.125rem;
  color: var(--demo-text-secondary);
  margin: 0 0 32px;
  line-height: 1.6;
}

h2 {
  font-size: 1.5rem;
  font-weight: 400;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--demo-border);
}

/* ── Demo sections ── */
.demo-section {
  background: var(--demo-surface);
  border: 1px solid var(--demo-border);
  border-radius: 8px;
  padding: 24px;
  margin-block: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

/* ── API tables ── */
table.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-block: 16px;
}

table.api-table th,
table.api-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--demo-border);
  vertical-align: top;
}

table.api-table th {
  font-weight: 500;
  color: var(--demo-text-secondary);
  font-size: 0.8125rem;
}

/* ── Inline code ── */
code {
  font-family: "Roboto Mono", "Consolas", monospace;
  font-size: 0.8125rem;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Icons page ── */
.icons-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.icons-search {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  font-size: 0.9375rem;
  border: 1px solid var(--demo-border);
  border-radius: 8px;
  background: var(--demo-surface);
  color: var(--demo-text);
  outline: none;
  transition: border-color 150ms;
}
.icons-search:focus { border-color: #1976d2; }

.icons-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.icon-cat-btn {
  padding: 4px 12px;
  font-size: 0.8125rem;
  border: 1px solid var(--demo-border);
  border-radius: 16px;
  background: var(--demo-surface);
  color: var(--demo-text-secondary);
  cursor: pointer;
  text-transform: capitalize;
  transition: background 150ms, color 150ms, border-color 150ms;
  white-space: nowrap;
}
.icon-cat-btn:hover { background: rgba(25, 118, 210, 0.08); color: #1976d2; border-color: #1976d2; }
.icon-cat-btn--active { background: #1976d2; color: #fff; border-color: #1976d2; }

.icons-count {
  font-size: 0.8125rem;
  color: var(--demo-text-secondary);
  margin: 0 0 12px;
}

.icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 4px;
}

.icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--demo-text);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  text-align: center;
}
.icon-card:hover {
  background: rgba(25, 118, 210, 0.08);
  border-color: rgba(25, 118, 210, 0.2);
}
.icon-card__name {
  font-size: 0.6875rem;
  line-height: 1.3;
  color: var(--demo-text-secondary);
  word-break: break-word;
  max-width: 88px;
}

.icons-empty {
  text-align: center;
  color: var(--demo-text-secondary);
  padding: 48px 0;
}

.icons-placeholder {
  padding: 24px;
  border: 1px dashed var(--demo-border);
  border-radius: 8px;
  color: var(--demo-text-secondary);
}

.icon-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #323232;
  color: #fff;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.875rem;
  opacity: 0;
  transition: transform 200ms, opacity 200ms;
  pointer-events: none;
  z-index: 2000;
  white-space: nowrap;
}
.icon-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.icon-sample {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--demo-text-secondary);
}
.icon-sample__preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-section--gap { gap: 24px; flex-wrap: wrap; }
