:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --surface-3: #fafbfc;
  --border: #e4e9ec;
  --border-strong: #d6dee3;
  --text: #17212b;
  --text-2: #53606b;
  --text-3: #7c8792;
  --muted: #9aa4ad;
  --sidebar-bg: #0f3f46;
  --sidebar-bg-2: #0b3036;
  --sidebar-text: #cbd5df;
  --accent: #4faaa0;
  --accent-strong: #327c75;
  --accent-soft: #d7efec;
  --accent-faint: #eef8f6;
  --accent-2: #6f8eb8;
  --success: #5aa783;
  --warning: #d89b3d;
  --danger: #d76b61;
  --info: #6f8eb8;
  --shadow-sm: 0 1px 2px rgba(23, 33, 43, .04), 0 6px 16px rgba(23, 33, 43, .04);
  --shadow-md: 0 8px 24px rgba(23, 33, 43, .07);
  --shadow-lg: 0 14px 36px rgba(23, 33, 43, .09);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --sidebar-width: 188px;
  --sidebar-closed: 58px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="forest"] {
  --bg: #f5f8f5;
  --surface-2: #edf4ef;
  --surface-3: #f8fbf8;
  --border: #dfe9e2;
  --border-strong: #cfdcd3;
  --text-2: #52645e;
  --text-3: #7b8b84;
  --muted: #9aa8a2;
  --accent: #5f9a7e;
  --accent-strong: #3f7059;
  --accent-soft: #dfefe7;
  --accent-faint: #f2f8f5;
  --accent-2: #849e78;
  --sidebar-bg: #143f33;
  --sidebar-bg-2: #0e3027;
  --success: #5f9a7e;
  --warning: #d49b45;
  --danger: #cc6d61;
  --info: #7f9f87;
}

[data-theme="coral"] {
  --bg: #f9f6f4;
  --surface-2: #f4eeee;
  --surface-3: #fcf9f8;
  --border: #eadfdd;
  --border-strong: #dccdca;
  --text-2: #625b58;
  --text-3: #8d817d;
  --muted: #aa9e9a;
  --accent: #cf7a69;
  --accent-strong: #a75748;
  --accent-soft: #f5e1dc;
  --accent-faint: #fbf3f1;
  --accent-2: #d99a61;
  --sidebar-bg: #3f3431;
  --sidebar-bg-2: #302623;
  --success: #68a17d;
  --warning: #d79a48;
  --danger: #cf7165;
  --info: #8b9eb8;
}

[data-theme="violet"] {
  --bg: #f7f6fa;
  --surface-2: #f0eef5;
  --surface-3: #fbf9fd;
  --border: #e5e0ed;
  --border-strong: #d6cee3;
  --text-2: #5d5968;
  --text-3: #868192;
  --muted: #a39dac;
  --accent: #8c7ab8;
  --accent-strong: #655493;
  --accent-soft: #ebe6f5;
  --accent-faint: #f7f4fb;
  --accent-2: #b48bbb;
  --sidebar-bg: #30344f;
  --sidebar-bg-2: #24283e;
  --success: #6a9c82;
  --warning: #d39a45;
  --danger: #cf6d68;
  --info: #8297c0;
}

[data-theme="cobalt"] {
  --bg: #f5f7fa;
  --surface-2: #edf2f7;
  --surface-3: #f9fbfd;
  --border: #dde6f0;
  --border-strong: #ccd8e6;
  --text-2: #526174;
  --text-3: #7b8899;
  --muted: #99a5b3;
  --accent: #6f8eb8;
  --accent-strong: #4e6f9d;
  --accent-soft: #e2eaf5;
  --accent-faint: #f3f6fa;
  --accent-2: #5faaa2;
  --sidebar-bg: #203b5b;
  --sidebar-bg-2: #162d48;
  --success: #61a184;
  --warning: #d69b43;
  --danger: #d06c63;
  --info: #6f8eb8;
}

[data-theme="turquoise"] {
  --bg: #f4f9fa;
  --surface-2: #ebf4f5;
  --surface-3: #f8fcfc;
  --border: #d9e9eb;
  --border-strong: #c8dcdf;
  --text-2: #52656a;
  --text-3: #7b8d92;
  --muted: #99a9ad;
  --accent: #55aeb4;
  --accent-strong: #367d84;
  --accent-soft: #dff2f3;
  --accent-faint: #f1f9fa;
  --accent-2: #7da8cf;
  --sidebar-bg: #0e4648;
  --sidebar-bg-2: #0a3436;
  --success: #5aa78c;
  --warning: #d49b3f;
  --danger: #d36d63;
  --info: #7da8cf;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

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

svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: 0 0 auto;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .18s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-closed) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 14px 10px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  z-index: 20;
}

.brand {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 2px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.brand-copy,
.user-card div,
.nav-link span,
.nav-title {
  min-width: 0;
  transition: opacity .15s ease, width .15s ease;
}

.brand-copy strong,
.user-card strong {
  display: block;
  color: #fff;
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-copy span,
.user-card span {
  display: block;
  margin-top: 2px;
  color: rgba(203, 213, 223, .62);
  font-size: 10px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar-toggle {
  position: absolute;
  top: 18px;
  right: -13px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s ease, color .18s ease, border-color .18s ease;
}

.sidebar-toggle:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.sidebar-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform .18s ease;
}

.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.nav-group {
  display: grid;
  gap: 4px;
  margin-top: 28px;
}

.nav-title {
  margin: 0 0 5px 2px;
  color: rgba(203, 213, 223, .5);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.nav-link {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 8px 0 6px;
  border-radius: var(--radius-sm);
  color: rgba(203, 213, 223, .78);
  font-size: 12px;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.nav-link.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.user-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 9px 2px 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #6f8eb8;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.sidebar-collapsed .brand,
.sidebar-collapsed .nav-link,
.sidebar-collapsed .user-card {
  grid-template-columns: 30px;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .nav-link span,
.sidebar-collapsed .nav-title,
.sidebar-collapsed .nav-link b,
.sidebar-collapsed .user-card div {
  width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.page {
  min-width: 0;
  padding-bottom: 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.mobile-menu {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.theme-picker select,
input,
textarea,
select {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.theme-picker select {
  min-width: 190px;
  padding: 0 30px 0 10px;
}

input,
textarea,
select {
  width: 100%;
  padding: 7px 9px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero,
.section {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding-inline: 22px;
}

.hero {
  padding-top: 34px;
  padding-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero h1 {
  max-width: 720px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 750;
}

.hero p:not(.eyebrow) {
  max-width: 760px;
  margin-top: 12px;
  color: var(--text-2);
  font-size: 14px;
}

.section {
  margin-top: 18px;
}

.section > h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 720;
}

.panel,
.work-card,
.list-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 18px 18px 20px;
}

.panel h3,
.work-card h3,
.list-panel h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 750;
}

.panel h3:not(:first-child) {
  margin-top: 22px;
}

.muted,
.hint {
  color: var(--text-2);
  font-size: 12px;
}

code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.token {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.token i {
  display: block;
  height: 56px;
  background: var(--swatch);
  border-bottom: 1px solid var(--border);
}

.token .accent-swatch {
  background: var(--accent);
}

.token .bg-swatch {
  background: var(--bg);
}

.token .surface-swatch {
  background: var(--surface);
}

.token .surface2-swatch {
  background: var(--surface-2);
}

.token .border-swatch {
  background: var(--border);
}

.token .text-swatch {
  background: var(--text);
}

.token .text2-swatch {
  background: var(--text-2);
}

.token .text3-swatch {
  background: var(--text-3);
}

.token .muted-swatch {
  background: var(--muted);
}

.token .soft-swatch {
  background: var(--accent-soft);
}

.token .accent2-swatch {
  background: var(--accent-2);
}

.token .sidebar-swatch {
  background: var(--sidebar-bg);
}

.token .success-swatch {
  background: var(--success);
}

.token .warning-swatch {
  background: var(--warning);
}

.token .danger-swatch {
  background: var(--danger);
}

.token .info-swatch {
  background: var(--info);
}

.token span,
.token b {
  display: inline-block;
  padding: 7px 8px 8px;
  font-size: 11px;
}

.token span {
  color: var(--text);
  font-weight: 750;
}

.token b {
  float: right;
  color: var(--muted);
  font-weight: 700;
}

.semantic-grid .token i {
  height: 70px;
}

.chip-row,
.sample-row,
.shadow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.chip-row {
  margin-top: 14px;
}

.chip,
.tag,
.badge,
.radius-sample {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip.teal { background: #d7efec; color: #327c75; }
.chip.forest { background: #dfefe7; color: #3f7059; }
.chip.coral { background: #f5e1dc; color: #a75748; }
.chip.violet { background: #ebe6f5; color: #655493; }
.chip.cobalt { background: #e2eaf5; color: #4e6f9d; }
.chip.turquoise { background: #dff2f3; color: #367d84; }

.type-panel {
  display: grid;
  gap: 9px;
}

.type-panel h1 {
  font-size: 26px;
  line-height: 1.18;
}

.type-panel h2 {
  font-size: 20px;
}

.type-panel h3 {
  margin: 0;
  font-size: 16px;
}

.type-panel small {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
}

.radius-sample {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.radius-sample.sm { border-radius: var(--radius-sm); }
.radius-sample.md { border-radius: var(--radius-md); }
.radius-sample.lg { border-radius: var(--radius-lg); }
.radius-sample.xl { border-radius: var(--radius-xl); }

.shadow-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shadow-card {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-3);
  font-size: 11px;
}

.shadow-card.sm { box-shadow: var(--shadow-sm); }
.shadow-card.md { box-shadow: var(--shadow-md); }
.shadow-card.lg { box-shadow: var(--shadow-lg); }

.btn,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}

.btn:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn.ghost {
  background: transparent;
  color: var(--text-2);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn:disabled {
  background: #9aa6b4;
  color: #fff;
  cursor: not-allowed;
  opacity: .8;
}

.btn.sm {
  min-height: 28px;
  padding-inline: 10px;
  font-size: 11px;
}

.btn.lg {
  min-height: 38px;
  padding-inline: 15px;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.icon-button {
  width: 32px;
  padding: 0;
  border-color: var(--border);
  background: var(--surface);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .8fr);
  gap: 24px;
}

.form-column {
  display: grid;
  align-content: start;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.hint,
.error {
  margin-top: -6px;
  font-size: 11px;
}

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

.has-error input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(215, 107, 97, .14);
}

.checks {
  gap: 12px;
}

.check,
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-weight: 600;
}

.check input {
  width: 15px;
  height: 15px;
  min-height: 0;
  accent-color: var(--accent);
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background .15s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 33, 43, .18);
  transition: transform .15s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.badge {
  min-height: 22px;
  padding-inline: 8px;
}

.badge.success { background: rgba(90, 167, 131, .16); color: #438065; }
.badge.warning { background: rgba(216, 155, 61, .18); color: #9a6c24; }
.badge.danger { background: rgba(215, 107, 97, .16); color: #ad5149; }
.badge.info { background: var(--accent-soft); color: var(--accent-strong); }

.tag.email { background: #def3f0; color: #347d75; }
.tag.announce { background: #f2e8c9; color: #8a6a24; }
.tag.note { background: #f1e6d2; color: #8a673d; }
.tag.landing { background: #efe4f3; color: #77558a; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.work-card,
.list-panel {
  padding: 16px;
}

.work-card {
  display: grid;
  gap: 10px;
}

.work-card h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.work-card p {
  color: var(--text-2);
  font-size: 12px;
}

.work-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}

.work-card footer strong {
  color: var(--accent-strong);
}

.list-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-panel li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
}

.list-panel li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-panel li span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.list-panel li b {
  color: var(--text-3);
  font-size: 11px;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(23, 33, 43, .34);
}

@media (max-width: 980px) {
  .token-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .list-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 240px);
    transform: translateX(-104%);
    transition: transform .18s ease;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-collapsed .brand,
  .sidebar-collapsed .nav-link,
  .sidebar-collapsed .user-card {
    grid-template-columns: 30px minmax(0, 1fr);
    justify-content: stretch;
    padding-left: 6px;
    padding-right: 8px;
  }

  .sidebar-collapsed .brand-copy,
  .sidebar-collapsed .nav-link span,
  .sidebar-collapsed .nav-title,
  .sidebar-collapsed .nav-link b,
  .sidebar-collapsed .user-card div {
    width: auto;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
  }

  .sidebar-toggle {
    right: 10px;
    border-color: rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    box-shadow: none;
  }

  .sidebar-toggle svg {
    transform: rotate(0);
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    padding-inline: 14px;
  }

  .theme-picker span {
    display: none;
  }

  .theme-picker select {
    min-width: 156px;
  }

  .hero,
  .section {
    padding-inline: 14px;
  }

  .hero {
    padding-top: 24px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .section > h2 {
    font-size: 18px;
  }

  .panel {
    padding: 14px;
  }

  .token-grid,
  .form-grid,
  .cards-grid,
  .shadow-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 13px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding-block: 10px;
  }

  .theme-picker,
  .theme-picker select {
    width: 100%;
  }

  .token i {
    height: 48px;
  }
}
