:root {
  color-scheme: light;
  --color-primary-lighter: #ddfff9;
  --color-primary-light: #527f77;
  --color-primary-main: #1b4139;
  --color-primary-dark: #002623;
  --color-secondary-light: #edebe1;
  --color-secondary-main: #b6a87e;
  --color-secondary-dark: #958665;
  --color-umber-main: #44191f;
  --color-success-main: #33bd7f;
  --color-warning-main: #d29e36;
  --color-error-main: #cc2f41;
  --color-info-main: #3473c0;
  --color-stone-lighter: #f0eff0;
  --color-stone-light: #ededed;
  --color-stone-main: #969696;
  --color-stone-dark: #747474;
  --color-stone-darker: #171717;
  --color-white: #ffffff;
  --bg: var(--color-stone-lighter);
  --panel: var(--color-white);
  --panel-strong: #fbfbf8;
  --ink: var(--color-primary-dark);
  --muted: var(--color-stone-dark);
  --line: #dedbd0;
  --accent: var(--color-primary-main);
  --accent-soft: var(--color-primary-lighter);
  --accent-ink: var(--color-white);
  --warm: var(--color-secondary-main);
  --shadow: 0 18px 40px rgba(0, 38, 35, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

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

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.sidebar,
.details {
  background: var(--panel);
  border-color: var(--line);
  border-style: solid;
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.sidebar {
  border-width: 0 1px 0 0;
}

.details {
  border-width: 0 0 0 1px;
}

.brand {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 12px;
  margin-bottom: 26px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--color-primary-main);
  border-radius: 8px;
  color: var(--accent-ink);
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand strong,
.brand small,
.control-group > span,
.field span,
.variant-section > span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small,
.control-group > span,
.field span,
.variant-section > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.field {
  display: block;
  margin-bottom: 18px;
}

input,
textarea {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 65, 57, 0.16);
}

.search-field input {
  height: 44px;
  padding: 0 12px;
  width: 100%;
}

.control-group {
  margin-bottom: 18px;
}

.segmented,
.snippet-tabs,
.usage-list,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button,
.snippet-tabs button,
.usage-list button,
.icon-button,
.secondary-button,
.primary-button {
  align-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 36px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.segmented button,
.snippet-tabs button,
.usage-list button {
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
}

.segmented button.active,
.snippet-tabs button.active,
.usage-list button.active,
.secondary-button:hover {
  background: var(--accent-soft);
  border-color: var(--color-primary-light);
  color: var(--accent);
}

.control-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.control-row input {
  height: 38px;
  padding: 4px 8px;
  width: 100%;
}

.secondary-button,
.primary-button {
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 12px;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  width: 100%;
}

.icon-button {
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 24px;
  height: 38px;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 0 0 6px;
}

.topbar p,
.details p {
  color: var(--muted);
  margin: 0;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
}

.icon-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  min-height: 130px;
  padding: 14px;
  text-align: left;
}

.icon-card.active,
.icon-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.icon-art {
  align-items: center;
  display: flex;
  height: 52px;
  justify-content: center;
  margin-bottom: 12px;
}

.icon-art svg,
.selected-preview svg {
  display: block;
  overflow: visible;
}

.icon-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-variant {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 5px;
}

.preview-panel {
  align-items: center;
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.selected-preview {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #b9d6cf;
  border-radius: 8px;
  display: flex;
  height: 96px;
  justify-content: center;
  width: 96px;
}

.details h2 {
  font-size: 20px;
  line-height: 1.2;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.variant-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 22px;
}

.variant-button {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  min-height: 42px;
  padding: 8px;
}

.variant-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.snippet-tabs {
  margin-bottom: 10px;
}

textarea {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  height: 210px;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.toast {
  background: var(--color-primary-dark);
  border-radius: 8px;
  bottom: 20px;
  color: #fff;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  right: 20px;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.icon-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  max-width: min(760px, calc(100vw - 32px));
  padding: 0;
  width: 760px;
}

.setup-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  max-width: min(680px, calc(100vw - 32px));
  padding: 0;
  width: 680px;
}

.setup-dialog::backdrop {
  background: rgba(29, 36, 32, 0.42);
}

.icon-dialog::backdrop {
  background: rgba(29, 36, 32, 0.42);
}

.dialog-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px;
}

.dialog-title-group {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.dialog-preview {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #b9d6cf;
  border-radius: 8px;
  display: flex;
  height: 74px;
  justify-content: center;
  width: 74px;
}

.dialog-preview svg {
  display: block;
  overflow: visible;
}

.dialog-header h2 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.dialog-header p {
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
}

.dialog-body {
  padding: 18px;
}

.dialog-actions {
  margin-bottom: 14px;
}

.dialog-actions .primary-button,
.dialog-actions .secondary-button {
  width: auto;
}

.usage-list {
  margin-bottom: 10px;
}

#dialogSnippetOutput {
  height: 260px;
}

#setupSnippetOutput {
  height: 260px;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .details {
    border-width: 1px 0 0 0;
    grid-column: 1 / -1;
    height: auto;
    position: static;
  }
}

@media (max-width: 760px) {
  .shell {
    display: block;
  }

  .sidebar,
  .details {
    border-width: 0 0 1px 0;
    height: auto;
    position: static;
  }

  .content {
    padding: 20px;
  }

  .topbar {
    display: block;
  }

  .top-actions {
    margin-top: 14px;
  }

  .icon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dialog-actions .primary-button,
  .dialog-actions .secondary-button {
    width: 100%;
  }
}
