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

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}

ol, ul {
  list-style: none;
}

html {
  font-size: 100%;
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-fg);
}

body {
  margin: 0;
  padding: var(--space-4);
  min-height: 100vh;
  line-height: var(--leading-base);
  font-size: var(--text-base);
  background: var(--color-bg);
  color: var(--color-fg);
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-3);
}

p {
  margin-bottom: var(--space-4);
}

.hint {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

a {
  color: var(--color-link);
  text-decoration: underline;
}

a:hover {
  color: var(--color-link-hover);
}

a:visited {
  color: var(--color-link-visited);
}

form {
  margin-bottom: var(--space-4);
}

.form-group {
  margin-bottom: var(--space-4);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea {
  display: block;
  width: 100%;
  padding: 0.5em 0.75em;
  font-size: var(--text-base);
  font-family: var(--font-base);
  line-height: var(--leading-base);
  color: var(--color-fg);
  background: var(--color-input-bg);
  border: 2px solid var(--color-input-border);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 0;
  border-color: var(--color-input-focus);
  box-shadow: inset 0 0 0 2px var(--color-focus-ring-text);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  accent-color: var(--color-button-active-bg);
  cursor: pointer;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625em 1.25em;
  min-height: 44px;
  min-width: 44px;
  font-size: var(--text-base);
  font-family: var(--font-base);
  font-weight: 600;
  line-height: 1;
  color: var(--color-button-fg);
  background: var(--color-button-bg);
  border: 2px solid var(--color-button-border);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: var(--color-button-hover-bg);
}

button:active:not(:disabled) {
  background: var(--color-button-active-bg);
  border-color: var(--color-button-active-border);
  color: var(--color-button-active-fg);
}

button:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--color-focus-ring-text);
}

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

a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--color-focus-ring-text);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25em 0.75em;
  min-height: 36px;
  border: 1px solid var(--color-tag-border);
  border-radius: var(--radius-pill);
  background: var(--color-tag-bg);
  color: var(--color-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  user-select: none;
}

.tag-chip.selected {
  background: var(--color-tag-selected-bg);
  border-color: var(--color-tag-selected-border);
  color: var(--color-tag-selected-fg);
}

.tag-chip input {
  display: none;
}

input[type="text"],
code,
.handle {
  font-variant-numeric: slashed-zero;
}

.error,
#totals.over-limit {
  color: var(--color-error);
  font-weight: 600;
}

.success {
  color: var(--color-success);
  font-weight: 600;
}

details {
  margin-bottom: var(--space-4);
}

summary {
  cursor: pointer;
  font-weight: 600;
}

pre {
  font-size: var(--text-xs);
  white-space: pre-wrap;
  max-height: 200px;
  overflow: auto;
  background: var(--color-diagnostics-bg);
  border: 1px solid var(--color-diagnostics-border);
  padding: var(--space-3);
  font-family: var(--font-mono);
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}
