@import url("/standard-styles/css/legacy-tokens.css");
@import url("/standard-styles/css/legacy-themes.css");
@import url("/standard-styles/css/legacy-utilities.css");

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--x-bg);
  color: var(--x-text);
  font-family: var(--x-font-body);
  line-height: 1.5;
  accent-color: var(--x-primary);
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 20rem;
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--x-primary) 10%, transparent), transparent 32rem),
    var(--x-bg);
}

button,
input,
select,
textarea { margin: 0; font: inherit; color: var(--x-text); }

button,
[role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--x-control-height);
  padding: .5rem .75rem;
  border: 1px solid var(--x-primary);
  border-radius: var(--x-radius-sm);
  background: var(--x-primary);
  color: var(--x-primary-contrast);
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
}

button:hover,
[role="button"]:hover { background: var(--x-primary-hover); border-color: var(--x-primary-hover); }
button:disabled,
[role="button"][aria-disabled="true"] { cursor: not-allowed; opacity: .6; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-height: var(--x-control-height);
  padding: .5rem .65rem;
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-sm);
  background: var(--x-surface);
  color: var(--x-text);
}

textarea { min-height: 8rem; resize: vertical; }
input::placeholder,
textarea::placeholder { color: var(--x-muted); opacity: 1; }
input[type="checkbox"],
input[type="radio"] { accent-color: var(--x-primary); }
fieldset { min-width: 0; margin: 0; padding: var(--x-space-3); border: 1px solid var(--x-border); border-radius: var(--x-radius-sm); }
legend { padding-inline: var(--x-space-2); font-weight: 700; }
label { color: var(--x-text); }
img,
svg,
video { max-width: 100%; }
article { background: var(--x-surface); color: var(--x-text); }
table { width: 100%; border-collapse: collapse; }
th,
td { padding: .55rem .65rem; border-bottom: 1px solid var(--x-border); text-align: start; }
dialog { max-width: min(42rem, calc(100vw - 2rem)); border: 1px solid var(--x-border); border-radius: var(--x-radius-md); background: var(--x-surface); color: var(--x-text); box-shadow: var(--x-shadow-lg); }
dialog::backdrop { background: color-mix(in srgb, var(--x-text) 45%, transparent); }
[hidden] { display: none; }

h1,
h2,
h3,
h4 {
  color: var(--x-text);
  font-family: var(--x-font-heading);
  letter-spacing: -0.025em;
}

:focus-visible {
  outline: 3px solid var(--x-focus);
  outline-offset: 3px;
}

code,
kbd,
pre {
  font-family: var(--x-font-mono);
}

article {
  border: 1px solid var(--x-border);
  box-shadow: var(--x-shadow-sm);
}

.x-card {
  padding: var(--x-space-5);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-md);
  background: var(--x-surface);
  box-shadow: var(--x-shadow-sm);
}

.x-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  border-color: var(--x-info);
  background: color-mix(in srgb, var(--x-info) 10%, var(--x-surface));
  color: var(--x-text);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.x-badge[data-tone="success"] { border-color: var(--x-success); background: color-mix(in srgb, var(--x-success) 10%, var(--x-surface)); color: var(--x-text); }
.x-badge[data-tone="warning"] { border-color: var(--x-warning); background: color-mix(in srgb, var(--x-warning) 10%, var(--x-surface)); color: var(--x-text); }
.x-badge[data-tone="danger"] { border-color: var(--x-danger); background: color-mix(in srgb, var(--x-danger) 10%, var(--x-surface)); color: var(--x-text); }

.x-alert {
  padding: var(--x-space-4);
  border: 1px solid var(--x-info);
  border-left-width: 0.35rem;
  border-radius: var(--x-radius-sm);
  background: color-mix(in srgb, var(--x-info) 8%, var(--x-surface));
}

.x-alert[data-tone="success"] {
  border-color: var(--x-success);
  background: color-mix(in srgb, var(--x-success) 8%, var(--x-surface));
}

.x-alert[data-tone="warning"] {
  border-color: var(--x-warning);
  background: color-mix(in srgb, var(--x-warning) 8%, var(--x-surface));
}

.x-alert[data-tone="danger"] {
  border-color: var(--x-danger);
  background: color-mix(in srgb, var(--x-danger) 8%, var(--x-surface));
}

.x-skeleton {
  display: block;
  min-height: 1rem;
  border-radius: var(--x-radius-sm);
  background: linear-gradient(100deg, var(--x-border) 20%, var(--x-surface-raised) 45%, var(--x-border) 70%);
  background-size: 220% 100%;
  animation: x-skeleton 1.4s linear infinite;
}

.x-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--x-space-3);
}

.x-bulk-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--x-space-3);
  align-items: center;
  min-height: var(--x-control-height);
  padding: var(--x-space-3);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-md);
  background: var(--x-surface-raised);
}

.x-bulk-action-bar output { margin-inline-start: auto; color: var(--x-muted); }

@media (max-width: 32rem) {
  .x-bulk-action-bar > * { flex: 1 1 100%; }
  .x-bulk-action-bar output { margin-inline-start: 0; }
}

x-tree {
  display: block;
  padding: var(--x-space-3);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-md);
  background: var(--x-surface);
}

x-tree-item {
  display: block;
  position: relative;
  min-height: 1.625rem;
  margin-block: .125rem;
  padding: .2rem .5rem .2rem 1.5rem;
  border-radius: var(--x-radius-sm);
  color: var(--x-text);
  cursor: default;
}

x-tree-item:focus-visible { outline: 3px solid var(--x-focus); outline-offset: 1px; }
x-tree-item[selected] { background: color-mix(in srgb, var(--x-primary) 14%, transparent); color: var(--x-text); font-weight: 600; }
x-tree-item[aria-disabled="true"] { opacity: .55; }
x-tree-item > [role="group"] { display: grid; gap: .125rem; margin-top: .125rem; }
x-tree-item > [role="group"] > x-tree-item { margin-inline-start: 1rem; }

.x-tree-toggle {
  position: absolute;
  inset: .3125rem auto auto .3rem;
  display: inline-grid;
  box-sizing: border-box;
  width: .875rem;
  height: .875rem;
  min-width: .875rem;
  min-height: .875rem;
  max-width: .875rem;
  max-height: .875rem;
  aspect-ratio: 1;
  flex: 0 0 .875rem;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--x-border);
  border-radius: .25rem;
  background: var(--x-surface-raised);
  color: var(--x-text);
  appearance: none;
  overflow: hidden;
  line-height: 1;
  cursor: pointer;
}

.x-tree-toggle:hover { border-color: var(--x-primary); color: var(--x-primary); }
.x-tree-toggle:focus-visible { outline: 2px solid var(--x-focus); outline-offset: 2px; }
.x-tree-toggle span,
.x-tree-toggle span::after { display: block; width: .375rem; height: 1px; background: currentColor; content: ''; }
.x-tree-toggle span::after { transform: rotate(90deg); }
x-tree-item[expanded] > .x-tree-toggle span::after { display: none; }

.x-stat {
  padding: var(--x-space-4);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-md);
  background: var(--x-surface);
}

.x-stat strong {
  display: block;
  margin-top: var(--x-space-2);
  font-family: var(--x-font-heading);
  font-size: 2rem;
}

.x-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: var(--x-space-3);
}

.x-product-card {
  padding: var(--x-space-4);
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-md);
  background: var(--x-surface);
}

.x-product-card .media {
  min-height: 7rem;
  border-radius: var(--x-radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--x-primary) 22%, var(--x-surface)), var(--x-surface));
}

.x-admin-shell {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  min-height: 22rem;
  overflow: hidden;
  border: 1px solid var(--x-border);
  border-radius: var(--x-radius-lg);
}

.x-admin-shell > nav,
.x-admin-shell > section {
  padding: var(--x-space-4);
}

.x-admin-shell > nav {
  background: color-mix(in srgb, var(--x-primary) 9%, var(--x-surface));
}

@media (max-width: 42rem) {
  .x-admin-shell { grid-template-columns: 1fr; }
}

@keyframes x-skeleton {
  to { background-position-x: -220%; }
}

button,
[role="button"],
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: var(--x-control-height);
}

input[type="checkbox"],
input[type="radio"] {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  min-height: 1.125rem;
  margin-block: 0;
}

input[type="checkbox"][role="switch"] {
  width: 2.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
}

input[type="checkbox"]:is(:checked, :indeterminate),
input[type="radio"]:checked,
input[type="checkbox"]:is(:checked, :indeterminate):is(:active, :focus),
input[type="radio"]:checked:is(:active, :focus) {
  accent-color: var(--x-primary);
}

x-theme-probe:not(:defined),
x-dialog:not(:defined),
x-dropdown:not(:defined),
x-tabs:not(:defined),
x-combobox:not(:defined),
x-data-grid:not(:defined),
x-code-editor:not(:defined),
x-sql-editor:not(:defined),
x-python-editor:not(:defined),
x-js-editor:not(:defined),
x-web-editor:not(:defined) {
  display: block;
  min-height: var(--x-control-height);
}
