/* Palette and typography from the AutoCardCreater tenant interface. */
:root {
  --z-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --z-font-mono: 'JetBrains Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;
  --z-surface: hsl(0, 0%, 98.4%);
  --z-surface-raised: hsl(0, 0%, 100%);
  --z-border: hsla(0, 0%, 0%, 12%);
  --z-border-strong: hsla(0, 0%, 0%, 20%);
  --z-hover-bg: hsla(0, 0%, 0%, 4%);
  --z-text: hsl(0, 0%, 14%);
  --z-muted: hsl(0, 0%, 42%);
  --z-primary: hsl(0, 0%, 14%);
  --z-primary-fg: hsl(0, 0%, 100%);
  --z-primary-hover: hsl(0, 0%, 22%);
  --z-signal: hsl(235, 62%, 47%);
  --z-signal-soft: hsla(235, 62%, 47%, 14%);
  --z-signal-ink: hsl(235, 62%, 47%);
  --z-success-soft: hsla(160, 72%, 28%, 12%);
  --z-success-ink: hsl(160, 72%, 24%);
  --z-warn-soft: hsla(38, 92%, 42%, 14%);
  --z-warn-ink: hsl(32, 95%, 30%);
  --z-danger-soft: hsla(0, 72%, 45%, 12%);
  --z-danger-ink: hsl(0, 72%, 38%);
  --z-info-soft: hsla(200, 90%, 36%, 12%);
  --z-info-ink: hsl(205, 90%, 30%);
  --z-scrim: rgba(0, 0, 0, 0.5);
}
.dark {
  --z-surface: hsl(0, 0%, 10%);
  --z-surface-raised: hsl(0, 0%, 14%);
  --z-border: hsla(0, 0%, 100%, 10%);
  --z-border-strong: hsla(0, 0%, 100%, 18%);
  --z-hover-bg: hsla(0, 0%, 100%, 7%);
  --z-text: hsl(0, 0%, 93%);
  --z-muted: hsl(0, 0%, 62%);
  --z-primary: hsl(0, 0%, 93%);
  --z-primary-fg: hsl(0, 0%, 10%);
  --z-primary-hover: hsl(0, 0%, 85%);
  --z-signal: hsl(235, 80%, 72%);
  --z-signal-soft: hsla(235, 80%, 72%, 18%);
  --z-signal-ink: hsl(235, 85%, 80%);
  --z-success-soft: hsla(158, 64%, 52%, 16%);
  --z-success-ink: hsl(158, 64%, 62%);
  --z-warn-soft: hsla(38, 92%, 62%, 16%);
  --z-warn-ink: hsl(38, 92%, 72%);
  --z-danger-soft: hsla(0, 78%, 68%, 18%);
  --z-danger-ink: hsl(0, 78%, 76%);
  --z-info-soft: hsla(199, 89%, 60%, 16%);
  --z-info-ink: hsl(199, 89%, 68%);
  --z-scrim: rgba(0, 0, 0, 0.62);
}
:root {
  color-scheme: light;
  font: 14px/1.5 var(--z-font-sans);
  color: var(--z-text);
  background: var(--z-surface);
  scrollbar-gutter: stable;
}
:root.dark {
  color-scheme: dark;
}
*,
*:before,
*:after {
  box-sizing: border-box;
}
body,
h1,
h2,
p {
  margin: 0;
}
body {
  font-feature-settings: 'cv05', 'ss01';
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
summary {
  cursor: pointer;
}
button {
  background: var(--z-surface-raised);
  border: 1px solid var(--z-border-strong);
  border-radius: 6px;
  min-height: 40px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}
button:hover:enabled {
  background: var(--z-hover-bg);
}
button.primary {
  background: var(--z-primary);
  border-color: var(--z-primary);
  color: var(--z-primary-fg);
}
button.primary:hover:enabled {
  background: var(--z-primary-hover);
}
button:disabled,
button.primary:disabled {
  background: var(--z-surface);
  border-color: var(--z-border);
  color: var(--z-muted);
  cursor: default;
}
:focus-visible {
  outline: 2px solid var(--z-signal);
  outline-offset: 3px;
}
a {
  color: var(--z-signal);
}
.skip {
  position: fixed;
  left: 8px;
  top: -100px;
  background: var(--z-surface-raised);
  z-index: 50;
  padding: 8px;
}
.skip:focus {
  top: 8px;
}
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}
#rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
}
#rail-inner {
  padding: 16px 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  min-height: 40px;
  margin-bottom: 16px;
}
.brand strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.sections {
  display: grid;
  gap: 2px;
}
.sections a {
  min-height: 40px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--z-muted);
  text-align: left;
  font-weight: 400;
}
.sections a[aria-current='page'],
.sections a:hover {
  background: var(--z-hover-bg);
  color: var(--z-text);
}
.sections a[aria-current='page'] {
  font-weight: 500;
}
.nav-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: none;
}
.icon-catalog:before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  border-radius: 1px;
  box-shadow: 8px 0, 0 8px, 8px 8px;
}
.icon-shops:before,
.icon-shops:after {
  content: '';
  position: absolute;
  border: 1.5px solid currentColor;
}
.icon-shops:before {
  inset: 1px 0 auto;
  height: 5px;
  border-radius: 3px 3px 1px 1px;
}
.icon-shops:after {
  inset: 7px 2px 0;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}
.icon-history:before {
  content: '⇄';
  position: absolute;
  inset: -4px 0;
  font: 20px/1.15 var(--z-font-sans);
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  background: var(--z-surface);
  padding: 0 16px;
  flex: none;
}
.crumb {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  color: var(--z-muted);
}
.crumb strong {
  font-weight: 600;
  color: var(--z-text);
}
.account-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.topbar button {
  min-height: 32px;
  padding: 5px 10px;
}
.topbar .theme,
#open-menu,
#close-menu {
  background: transparent;
  border: 0;
}
.theme {
  font-size: 20px;
  min-width: 32px;
}
#open-menu {
  display: none;
}
#mobile-menu {
  padding: 0;
  border-radius: 0;
  margin: 0;
  inset: 0 auto 0 0;
  width: min(288px, 90vw);
  height: 100dvh;
  max-height: none;
  border: 0;
  border-right: 1px solid var(--z-border);
  background: var(--z-surface);
}
#close-menu {
  position: absolute;
  top: 12px;
  right: 8px;
  font-size: 22px;
}
.workspace main {
  min-width: 0;
  flex: 1;
  margin: 0 8px 8px;
  padding: 24px;
  background: var(--z-surface-raised);
  border: 1px solid var(--z-border);
  border-radius: 8px;
}
.heading,
.summary,
.pager,
.actions,
.shop {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.heading {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--z-border);
}
h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h2,
.catalog-start h2,
.empty-state h2 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}
.actions {
  justify-content: flex-start;
  gap: 8px;
}
.add:before {
  content: '+';
  margin-right: 6px;
}
.box,
.filters,
.tablebox,
.catalog-start {
  border: 1px solid var(--z-border);
  border-radius: 6px;
  background: var(--z-surface-raised);
}
.box,
.catalog-start {
  padding: 16px;
}
.box {
  margin: 12px 0;
}
.box h2 {
  margin-bottom: 10px;
}
.catalog-start p {
  color: var(--z-muted);
  margin: 6px 0 16px;
}
.catalog-start details {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--z-border);
}
.catalog-start summary {
  color: var(--z-signal);
  width: fit-content;
}
.catalog-start ol {
  padding-left: 22px;
  margin: 10px 0 0;
  line-height: 1.65;
}
.filters {
  overflow: hidden;
}
.filter-grid {
  display: grid;
  grid-template-columns: minmax(12rem,2fr) minmax(10rem,1fr);
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
}
label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
}
input:not([type='checkbox']),
select,
textarea {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--z-border-strong);
  border-radius: 6px;
  background: var(--z-surface-raised);
  font-size: 14px;
  font-weight: 400;
  padding: 8px 10px;
}
input::placeholder {
  color: var(--z-muted);
}
input[type='checkbox'] {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  accent-color: var(--z-signal);
  cursor: pointer;
}
#selection {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 16px 0 10px;
}
.summary {
  margin: 12px 0;
}
#selection .summary {
  margin: 0;
  gap: 8px 12px;
}
#selection button,
td button,
.pager button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 13px;
}
#selection .columns-gear {
  display: inline-grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
}
.tablebox {
  overflow: auto;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--z-border);
}
th {
  background: var(--z-surface);
  color: var(--z-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
td {
  font-size: 13px;
}
tr:last-child td {
  border: 0;
}
tbody tr:hover {
  background: var(--z-hover-bg);
}
tbody tr:has(input:checked) {
  background: var(--z-signal-soft);
}
small,
.muted {
  display: block;
  color: var(--z-muted);
}
td small,
.status,
.pager span,
#selection b,
code,
textarea {
  font-family: var(--z-font-mono);
  font-variant-numeric: tabular-nums;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--z-muted);
  background: var(--z-hover-bg);
  border: 1px solid var(--z-border);
}
.status:before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status:is([data-state='done'], [data-state='draft'], [data-state='available']) {
  background: var(--z-success-soft);
  color: var(--z-success-ink);
}
.status:is([data-state='edit'], [data-state='occupied'], [data-state='duplicates']) {
  background: var(--z-warn-soft);
  color: var(--z-warn-ink);
}
.status:is([data-state='failed'], [data-state='media_error']) {
  background: var(--z-danger-soft);
  color: var(--z-danger-ink);
}
.status:is([data-state='waiting'], [data-state='checking'], [data-state='queued'], [data-state='media'], [data-state='media_check']) {
  background: var(--z-info-soft);
  color: var(--z-info-ink);
}
.pager {
  margin: 14px 0;
  color: var(--z-muted);
  font-size: 12px;
}
.shop {
  padding: 12px 0;
  border-bottom: 1px solid var(--z-border);
}
.shop:first-child {
  padding-top: 0;
}
.shop:last-child {
  padding-bottom: 0;
  border: 0;
}
.shop strong {
  font-size: 15px;
}
.empty,
.empty-state {
  text-align: center;
  padding: 30px 12px;
  color: var(--z-muted);
}
.empty-state h2 {
  color: var(--z-text);
  margin: 0;
}
.empty-state p {
  margin: 6px 0 12px;
}
.empty-icon {
  display: none;
}
dialog {
  width: min(520px, calc(100% - 32px));
  max-height: 85dvh;
  overflow: auto;
  padding: 24px;
  color: var(--z-text);
  background: var(--z-surface-raised);
  border: 1px solid var(--z-border);
  border-radius: 8px;
}
dialog::backdrop {
  background: var(--z-scrim);
}
dialog h2 {
  margin-bottom: 16px;
}
dialog label {
  margin: 12px 0;
}
.dialog-intro {
  color: var(--z-muted);
}
dialog .actions {
  justify-content: flex-end;
  border-top: 1px solid var(--z-border);
  padding-top: 14px;
  margin-top: 16px;
}
dialog details {
  border-top: 1px solid var(--z-border);
  padding: 8px 0;
}
textarea {
  min-height: 110px;
}
#alert,
#form-error:not(:empty),
#login-error:not(:empty) {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--z-danger-soft);
  color: var(--z-danger-ink);
  border-radius: 4px;
}
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-main {
  width: min(400px, 100%);
}
.login-box {
  margin: 0;
  padding: 24px;
}
.login-box h1 {
  margin: 4px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--z-border);
}
.kicker {
  font: 500 11px/1.4 var(--z-font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--z-signal);
}
.login-box label {
  margin: 14px 0;
}
.login-box [hidden] {
  display: none;
}
.login-box p:not(.kicker) {
  color: var(--z-muted);
}
.login-box .primary {
  width: 100%;
}
@media (max-width: 1023px) {
  .shell {
    display: block;
  }
  #rail {
    display: none;
  }
  #open-menu {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .topbar {
    padding: 0 12px;
  }
  .sections a {
    min-height: 44px;
  }
  #close-menu {
    width: 44px;
    height: 44px;
  }
}
@media (max-width: 768px) {
  .workspace main {
    margin: 0;
    padding: 16px;
    border-radius: 0;
    border-inline: 0;
  }
  .filter-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }
  .shop {
    align-items: flex-start;
    flex-direction: column;
  }
  td,
  th {
    padding: 8px;
  }
  .catalog-start {
    padding: 14px;
  }
  button,
  #selection button,
  .pager button,
  td button,
  input:not([type='checkbox']),
  select,
  .topbar button {
    min-height: 44px;
  }
}
@media (max-width: 639px) {
  .crumb span {
    display: none;
  }
  .topbar {
    gap: 6px;
  }
  .account-tools {
    gap: 4px;
  }
}

.wb-cell { min-width: 9rem; overflow-wrap: anywhere; }
.wb-cell details { min-width: 14rem; max-width: 28rem; }
#dialog:has(#wb-picker) {
  height: min(610px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
#dialog:has(#wb-picker) #form,
#wb-picker, #wb-fields, #wb-layout {
  height: 100%; min-height: 0; display: flex; flex-direction: column;
}
#dialog:has(#wb-picker) #dialog-body { flex: 1; min-height: 0; }
#dialog:has(#wb-picker) #form-error:empty, #wb-picker [hidden] { display: none; }
#wb-picker section { flex: 1; }
.picker-modes { display: flex; gap: 4px; border-bottom: 1px solid var(--z-border); padding-bottom: 8px; }
.picker-modes button { background: transparent; border-color: transparent; }
.picker-modes button[aria-pressed=true] { color: var(--z-signal-ink); background: var(--z-signal-soft); }
.picker-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#wb-clear { align-self: flex-start; margin-top: 8px; }
#wb-order-help { margin: 10px 0; color: var(--z-muted); font-size: 13px; }
.column-order { margin: 0; padding: 2px; list-style: none; }
.column-order li, .order-ghost { padding: 2px 8px; min-height: 40px; display: flex; align-items: center; gap: 8px; }
.column-order li[data-key] { position: relative; cursor: grab; border-bottom: 1px solid var(--z-border); user-select: none; }
.order-label { overflow-wrap: anywhere; }
.column-order .order-grip { width: 34px; min-height: 36px; flex: none; padding: 0; background: transparent; border-color: transparent; color: var(--z-muted); font-size: 20px; cursor: grab; touch-action: none; }
.column-order li.moving { opacity: .35; }
.column-order li[data-drop]::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--z-signal); }
.column-order li[data-drop=before]::after { top: 0; }
.column-order li[data-drop=after]::after { bottom: 0; }
.order-ghost { position: fixed; z-index: 1; pointer-events: none; border: 1px solid var(--z-signal); border-radius: 5px; background: var(--z-surface-raised); padding-left: 50px; overflow-wrap: anywhere; }
.order-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-height: 500px) {
  #dialog:has(#wb-picker) { padding: 12px; }
  #dialog:has(#wb-picker) h2, #wb-fields label { margin: 4px 0; }
  #dialog:has(#wb-picker) .actions { margin-top: 6px; padding-top: 6px; }
}
.column-list h3 { margin: 12px 0 4px; font-size: 13px; }
.column-list label { display: flex; gap: 8px; align-items: center; margin: 0; padding: 5px 2px; }
#wb-load:empty { display: none; }
.catalog-search {display:flex;gap:6px;}
.catalog-search input {min-width:0;flex:1;}
th .facet-trigger {display:inline-flex;align-items:center;gap:6px;color:inherit;font:inherit;border:0;background:transparent;padding:4px;min-height:28px;}
.facet-trigger svg {fill:none;stroke:currentColor;stroke-width:1.4;}
.facet-trigger[data-active=true] {color:var(--z-signal);background:var(--z-signal-soft);}
.facet-trigger[data-active=true] svg {fill:currentColor;}
.facet-panel {position:fixed;inset:auto;margin:0;width:min(330px,calc(100vw - 12px));max-height:calc(100dvh - 12px);padding:16px;}
.facet-panel::backdrop {background:transparent;}
.facet-panel h2 {font-size:16px;margin:0 0 10px;}
.facet-panel input[type=search] {width:100%;}
.facet-tools,.facet-footer {display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;}
.facet-tools button,.facet-retry {min-height:28px;padding:4px 8px;}
.facet-list {max-height:35dvh;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;overflow-anchor:none;margin-top:8px;}
.facet-list label {display:flex;align-items:center;gap:8px;margin:0;padding:4px;overflow-wrap:anywhere;}
.facet-list input {flex:none;}
.facet-message {min-height:1.5em;line-height:1.5;}
@media(max-width:639px){ .facet-list label {min-height:36px;}}

.facet-text-button { width: 100%; margin-bottom: 12px; }
.text-conditions { width: min(580px, calc(100vw - 24px)); }
.condition-row { padding-bottom: 10px; }
.condition-fields { display:grid; grid-template-columns:minmax(8rem, 1fr) minmax(8rem, 1.4fr) auto; align-items:end; gap:8px; }
.condition-fields label, .condition-join { margin:0; }
.condition-join { width:6rem; margin-bottom:8px; }
.condition-join[hidden], .condition-order[hidden] { display:none; }
.condition-order { color:var(--z-muted); }
@media(max-width:540px) {
  .condition-fields { grid-template-columns:minmax(0,1fr) auto; }
  .condition-fields label:first-child { grid-column:1/-1; }
}
