:root {
  color-scheme: dark;
  background: #0a0f1a;
}

html[data-theme="light"] {
  color-scheme: light;
  background: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--app-bg, #0a0f1a);
}

html.modal-open,
html.modal-open body {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus, #fbbf24);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 760;
  transform: translateY(-160%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  --app-bg: #0a0f1a;
  --panel: #0e1524;
  --panel-strong: #070c16;
  --surface: #111a2d;
  --surface-strong: #0a1020;
  --surface-hover: #162239;
  --line: #243149;
  --line-soft: #1b263a;
  --text: #eef4ff;
  --muted: #94a3b8;
  --muted-strong: #64748b;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
  --accent-fill: #0369a1;
  --accent-soft: rgba(14, 165, 233, 0.16);
  --focus: #fbbf24;
  --green: #10b981;
  --green-fill: #047857;
  --green-soft: rgba(16, 185, 129, 0.14);
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 28px 80px rgba(2, 6, 23, 0.42);
  display: flex;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 88%, transparent), var(--app-bg)),
    var(--app-bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell.theme-light {
  --app-bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --surface: #ffffff;
  --surface-strong: #f1f5f9;
  --surface-hover: #eaf1fb;
  --line: #d7dfeb;
  --line-soft: #e6ebf3;
  --text: #102033;
  --muted: #56657a;
  --muted-strong: #718096;
  --accent: #006bb6;
  --accent-strong: #00518e;
  --accent-fill: #00518e;
  --accent-soft: rgba(0, 107, 182, 0.11);
  --focus: #7c3aed;
  --green: #00866a;
  --green-fill: #006b55;
  --green-soft: rgba(0, 134, 106, 0.12);
  --red: #d43f3a;
  --amber: #805000;
  --shadow: 0 24px 70px rgba(30, 45, 70, 0.18);
}

.top-band {
  display: flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 5px 18px;
}

.top-band-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.app-picker {
  position: relative;
  min-width: 0;
}

.app-picker h1 {
  margin: 0;
}

.app-picker-button {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  font-size: 14px;
  font-weight: 780;
  line-height: 1;
  cursor: pointer;
}

.app-picker-button:hover,
.app-picker-button:focus-visible {
  color: var(--accent);
}

.app-picker-button svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--muted);
}

.app-picker-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-band-title h1 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
  line-height: 1;
}

.top-band-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.app-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: 320px;
  max-width: calc(100vw - 28px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  padding: 8px;
}

.app-picker-option {
  display: block;
  border-radius: 8px;
  color: var(--text);
  padding: 10px;
  text-decoration: none;
}

.app-picker-option:hover,
.app-picker-option:focus-visible {
  background: var(--surface-hover);
}

.app-picker-option-current {
  background: var(--surface-hover);
}

.app-picker-option-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.app-picker-option-title svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.app-picker-option-current .app-picker-option-title {
  color: var(--accent);
}

.app-picker-option-description {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.top-band-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.design-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.design-actions-menu {
  display: contents;
}

.header-button.design-actions-menu-button {
  display: none;
}

.design-actions-popover {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.header-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.header-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.header-button input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.header-button svg,
.refresh-button svg,
.theme-toggle svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.header-button .chevron-icon {
  width: 14px;
  height: 14px;
}

.header-badge {
  display: inline-grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
}

.designs-menu {
  position: relative;
}

.designs-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 260px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  padding: 8px;
}

.designs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}

.designs-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.designs-apply {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.designs-apply:hover {
  background: var(--surface-hover);
}

.designs-list li > button:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 7px;
  cursor: pointer;
}

.designs-list li > button:last-child:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.designs-list li > button:last-child svg {
  width: 14px;
  height: 14px;
}

.designs-empty {
  margin: 4px 6px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.designs-note {
  margin: 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-strong);
  padding-top: 8px;
  font-size: 10px;
  line-height: 1.4;
}

.refresh-button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.refresh-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.refresh-button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.theme-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 3px;
}

.theme-toggle button {
  display: grid;
  width: 30px;
  height: 26px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.theme-toggle button.active {
  background: var(--accent-fill);
  color: #fff;
}

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

.sidebar {
  display: flex;
  width: 480px;
  height: 100%;
  flex: 0 0 auto;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel-strong);
}

.control-scrollbar {
  scrollbar-color: var(--muted-strong) var(--panel-strong);
  scrollbar-width: thin;
}

.control-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.control-scrollbar::-webkit-scrollbar-track {
  background: var(--panel-strong);
}

.control-scrollbar::-webkit-scrollbar-thumb {
  border: 2px solid var(--panel-strong);
  border-radius: 999px;
  background: var(--muted-strong);
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 24px 48px;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.section-title h2 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

.section-meta {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  padding: 3px 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.section-reset-button {
  cursor: pointer;
}

.section-reset-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
}

.status-dot-red {
  background: var(--red);
}

.status-dot-green {
  background: var(--green);
}

.status-dot-amber {
  background: var(--amber);
}

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

.preset-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
  text-align: left;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.preset-button:hover,
.preset-button.is-active {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.preset-button.is-active {
  background: var(--accent-soft);
}

.preset-button strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}

.preset-button span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

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

.type-button {
  min-width: 0;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 9px;
  text-align: left;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.type-button:hover,
.type-button.is-active {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.type-button.is-active {
  background: var(--accent-soft);
}

.type-button strong,
.type-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-button strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
}

.type-button span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.content-fields {
  display: grid;
  gap: 10px;
}

.field-group,
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field,
.swatches label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field span,
.swatches span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label-row output {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 2px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
}

.field textarea {
  min-height: 80px;
  padding: 10px;
  resize: vertical;
}

.field input[type="range"] {
  min-height: 28px;
  padding: 0;
  accent-color: var(--accent);
}

.field-error {
  display: none;
  margin: -2px 0 0;
  color: var(--red);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.field-error.is-visible {
  display: block;
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent);
}

.checkbox-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 650;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.field input[type="color"],
.swatches input[type="color"] {
  height: 36px;
  padding: 2px;
}

.swatches {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.central-logo-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.central-logo-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
}

.central-logo-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.central-logo-glyph {
  position: relative;
  display: flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface-strong);
  padding: 5px;
}

.central-logo-glyph svg {
  width: 100%;
  height: 100%;
}

.central-logo-glyph.is-empty::after {
  position: absolute;
  width: 26px;
  height: 2px;
  background: var(--muted);
  content: "";
  transform: rotate(-45deg);
}

.central-logo-select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 7px 10px;
}

.central-logo-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.central-logo-details > div {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--surface);
  padding: 6px 7px;
}

.central-logo-details dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.central-logo-details dd {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.central-logo-details code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.library-inline-button {
  display: flex;
  min-height: 38px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 720;
}

.library-inline-button:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.library-inline-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.library-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.66);
  padding: 18px;
}

.app-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.66);
  padding: 18px;
}

.app-dialog {
  width: min(420px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.app-dialog-form {
  display: grid;
  gap: 0;
}

.app-dialog-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 12px 14px;
}

.app-dialog-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
}

.app-dialog-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 12px 14px;
}

.library-dialog {
  display: flex;
  width: min(980px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  min-height: min(680px, calc(100dvh - 36px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.library-dialog-header {
  display: flex;
  min-height: 54px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 12px 14px;
}

.library-dialog-header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.library-dialog-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
  line-height: 1.2;
}

.library-dialog-header svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.library-close-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.library-close-button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.library-toolbar {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
}

.library-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 0 10px;
}

.library-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.library-search input {
  width: 100%;
  min-height: 40px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.library-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.library-filter-row button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
}

.library-filter-row button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.library-filter-row button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.library-filter-row b {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 0 5px;
  font-size: 10px;
}

.library-results-summary {
  display: flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  padding: 0 14px;
  font-size: 11px;
}

.library-results {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
}

.library-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.library-card-active {
  border-color: color-mix(in srgb, var(--green) 60%, var(--line));
  background: var(--green-soft);
}

.library-logo-glyph,
.library-logo-placeholder {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
}

.library-logo-glyph {
  padding: 7px;
}

.library-logo-glyph svg,
.library-logo-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.library-logo-placeholder {
  overflow: hidden;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 780;
  text-align: center;
}

.library-card-main {
  min-width: 0;
}

.library-card-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.library-card-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-title span {
  flex: 0 0 auto;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.library-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.library-card-meta a {
  color: var(--accent);
  text-decoration: none;
}

.library-card-meta a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.library-card-error {
  margin: 7px 0 0;
  color: var(--red);
  font-size: 10px;
  line-height: 1.35;
}

.library-card-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.library-card-actions button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 720;
}

.library-card-actions button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.library-card-actions svg {
  width: 14px;
  height: 14px;
}

.library-empty {
  grid-column: 1 / -1;
  margin: 18px 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.palette-panel {
  min-width: 0;
}

.compact-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.color-row button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  transition: transform 150ms ease;
}

.color-row button:hover,
.color-row button.active {
  transform: scale(1.12);
}

.color-row button.active {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.color-row input[type="color"] {
  width: 34px;
  height: 28px;
  margin-left: auto;
  border: 0;
  background: transparent;
  padding: 0;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-row > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.field-row select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 7px 10px;
}

.field-row--checkbox {
  min-height: 36px;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
}

.field-row--checkbox input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.workspace {
  display: flex;
  min-width: 0;
  height: 100%;
  flex: 1;
  flex-direction: column;
  background: var(--app-bg);
}

.workspace-toolbar {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 10px 24px;
}

.toolbar-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.target-url {
  display: block;
  max-width: min(60vw, 720px);
  overflow: hidden;
  margin-top: 4px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-meta {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  padding: 4px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.workspace-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

a.mobile-edit-link {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

a.mobile-edit-link:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.canvas-stage {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 34px;
}

.canvas-frame {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  width: min(560px, 100%, calc(100dvh - 300px));
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.16) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.16) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.16) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.16) 75%),
    var(--surface-strong);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 56px);
}

.qr-stage > svg {
  display: block;
  width: min(100%, var(--qr-preview-size, 512px));
  height: auto;
  max-height: 100%;
  filter: drop-shadow(0 18px 34px rgba(2, 6, 23, 0.34));
  transform: translateY(0);
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

.qr-stage:hover > svg {
  filter: drop-shadow(0 22px 44px rgba(2, 6, 23, 0.42));
  transform: translateY(-2px);
}

.qr-empty-state {
  display: grid;
  max-width: 280px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.qr-empty-state strong {
  color: var(--text);
  font-size: 13px;
}

.qr-empty-state span {
  font-size: 11px;
  line-height: 1.45;
}

.canvas-metadata {
  position: absolute;
  bottom: 18px;
  left: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.canvas-metadata span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  padding: 4px 7px;
}

.export-bar {
  display: grid;
  min-height: 0;
  grid-template-areas:
    "info actions"
    "bulk bulk";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 10px 24px;
}

.export-info {
  grid-area: info;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.export-icon {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  place-content: center;
  gap: 4px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent-fill) 10%, var(--surface));
  color: var(--accent);
}

.export-icon span {
  border: 2px solid currentColor;
  border-radius: 2px;
}

.export-icon span:nth-child(2),
.export-icon span:nth-child(3) {
  border-width: 0;
  background: currentColor;
}

.export-info-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.bulk-generator {
  grid-area: bulk;
  min-width: 0;
  width: 100%;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.bulk-generator-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 0;
}

.bulk-url-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.bulk-url-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.bulk-url-field textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  outline: none;
}

.bulk-url-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.bulk-actions {
  display: grid;
  min-width: 170px;
  gap: 8px;
  justify-items: end;
}

.bulk-status {
  min-height: 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

.bulk-status[data-tone="error"] {
  color: var(--red);
}

.bulk-status[data-tone="success"] {
  color: var(--green);
}

.advanced-bulk {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.advanced-bulk summary {
  display: flex;
  width: fit-content;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
  list-style: none;
}

.advanced-bulk summary::-webkit-details-marker {
  display: none;
}

.advanced-bulk summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.advanced-bulk[open] summary::before {
  transform: rotate(45deg);
}

.advanced-bulk summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.advanced-bulk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 12px;
  margin-top: 12px;
}

.advanced-bulk-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.advanced-bulk-file {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.advanced-bulk-file input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px;
  font-size: 11px;
}

.advanced-bulk-actions {
  display: grid;
  gap: 8px;
}

.advanced-bulk-progress {
  display: grid;
  gap: 7px;
}

.advanced-bulk-progress progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

.advanced-bulk-progress .bulk-status {
  max-height: 116px;
  overflow: auto;
  white-space: pre-line;
  text-align: left;
}

.export-info strong {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
}

.export-meta-summary {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.status-line {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.status-line[data-tone="error"] {
  color: var(--red);
}

.status-line[data-tone="success"] {
  color: var(--green);
}

.scan-guidance {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.scan-guidance li {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.scan-guidance li[data-tone="success"] {
  border-color: color-mix(in srgb, var(--green) 44%, var(--line));
  background: var(--green-soft);
  color: var(--green);
}

.scan-guidance li[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--amber) 52%, var(--line));
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  color: var(--amber);
}

.export-controls {
  display: grid;
  gap: 10px;
}

.export-bar .field-row {
  gap: 6px;
}

.export-size-control {
  display: grid;
  align-content: center;
  align-items: center;
  gap: 6px;
}

.export-bar .field-row select {
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
}

.export-size-control > span {
  font-size: 11px;
  line-height: 1;
}

.export-bar .field-row--checkbox {
  width: 100%;
  min-height: 34px;
  justify-content: space-between;
  padding: 0 10px;
}

.export-bar .field-row--checkbox input {
  width: 15px;
  height: 15px;
}

.export-size-summary {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.actions {
  grid-area: actions;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.icon-action {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0;
}

.icon-action:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-hover);
}

.icon-action svg {
  width: 18px;
  height: 18px;
}

.export-settings-menu {
  position: relative;
}

.export-settings-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 30;
  display: none;
  width: min(286px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  padding: 16px 18px;
}

.export-settings-menu.opens-up .export-settings-popover {
  top: auto;
  bottom: calc(100% + 12px);
}

.export-settings-menu.is-open .export-settings-popover {
  display: grid;
  gap: 12px;
}

.export-popover-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}

.export-popover-header strong {
  color: var(--text);
  font-size: 12px;
}

.export-popover-header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.export-controls .export-svg-action {
  width: 100%;
}

.export-png-action {
  min-width: 144px;
}

.primary-action {
  border: 1px solid var(--accent-strong);
  background: var(--accent-fill);
  color: #fff;
}

.primary-action:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.secondary-action:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.app-footer {
  display: flex;
  min-height: 24px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--muted);
  padding: 3px 18px;
  font-size: 10px;
  line-height: 1.3;
  text-align: center;
}

.app-footer a {
  color: var(--muted);
  text-decoration: none;
  text-underline-offset: 3px;
}

.app-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-sync {
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .app-body {
    display: flex;
    flex-direction: column;
  }

  .sidebar,
  .workspace {
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .sidebar {
    order: 2;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    order: 1;
  }

  .canvas-stage {
    min-height: 520px;
  }

  .canvas-frame {
    max-height: none;
  }

  .target-url {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  a.mobile-edit-link {
    display: inline-flex;
  }

}

@media (max-width: 640px) {
  .workspace-toolbar {
    padding-inline: 14px;
  }

  .export-bar {
    padding-inline: 14px;
    grid-template-areas:
      "info"
      "actions"
      "bulk";
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr) minmax(118px, 1.4fr);
    gap: 8px;
    justify-content: stretch;
  }

  .export-settings-menu,
  .export-copy-action,
  .bulk-toggle-button,
  .export-png-action {
    width: 100%;
  }

  .export-settings-popover {
    right: auto;
    left: 0;
  }

  .export-png-action {
    min-width: 0;
  }

  .workspace-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .top-band {
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
  }

  .top-band-title p {
    display: none;
  }

  .top-band-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .design-toolbar {
    gap: 6px;
  }

  .design-actions-menu {
    position: relative;
    display: block;
  }

  .header-button.design-actions-menu-button {
    display: inline-flex;
    padding: 8px 10px;
  }

  .design-actions-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 25;
    display: none;
    min-width: 180px;
    grid-template-columns: 1fr;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    padding: 8px;
  }

  .design-actions-menu.is-open .design-actions-popover {
    display: grid;
  }

  .design-actions-popover .header-button {
    width: 100%;
    justify-content: flex-start;
  }

  .designs-dropdown {
    width: min(280px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }

  .sidebar-body {
    padding: 18px 14px 32px;
  }

  .field-group,
  .options-grid,
  .preset-grid,
  .type-grid,
  .swatches,
  .central-logo-details {
    grid-template-columns: 1fr;
  }

  .central-logo-picker {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .central-logo-select {
    flex-basis: 100%;
  }

  .bulk-generator-body {
    grid-template-columns: 1fr;
  }

  .bulk-actions {
    justify-items: stretch;
  }

  .bulk-status {
    text-align: left;
  }

  .advanced-bulk-grid {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
    padding: 0 10px;
  }

  .library-dialog-backdrop {
    align-items: stretch;
    padding: 10px;
  }

  .app-dialog-backdrop {
    align-items: center;
    padding: 14px;
  }

  .app-dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .library-dialog {
    min-height: 0;
  }

  .library-results {
    grid-template-columns: 1fr;
  }

  .canvas-stage {
    flex-direction: column;
    min-height: 440px;
    align-items: center;
    gap: 12px;
    padding: 18px;
  }

  .canvas-frame {
    flex: 0 0 min(calc(100vw - 36px), 440px);
    width: min(calc(100vw - 36px), 440px);
    padding: 22px;
  }

  .canvas-metadata {
    position: static;
    align-self: stretch;
    justify-content: flex-start;
    margin: 0;
  }

  .app-footer {
    flex-wrap: wrap;
  }

  .preset-button:hover,
  .preset-button.is-active,
  .color-row button:hover,
  .color-row button.active {
    transform: none;
  }
}
