@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { min-height: 100vh; }
  img, svg { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  p, h1, h2, h3, h4 { overflow-wrap: break-word; }
  ul, ol { padding: 0; list-style: none; }
  table { border-collapse: collapse; }
}

@layer base {
  body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
  }

  h1 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
  h2 { font-size: var(--text-md); font-weight: 600; line-height: 1.4; }
  h3 { font-size: var(--text-base); font-weight: 600; }

  a { color: var(--color-accent); text-decoration: none; }
  a:hover { color: var(--color-accent-hover); text-decoration: underline; }

  small { font-size: var(--text-sm); color: var(--color-text-tertiary); }
  code { font-family: var(--font-mono); font-size: 0.92em; }
  strong { font-weight: 600; }

  :focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

  ::selection { background: var(--color-accent-soft); }

  /* Default controls, so markup without component classes still looks right. */
  input:not([type="checkbox"], [type="radio"], [type="submit"], [type="hidden"]),
  select,
  textarea {
    min-height: var(--control-height);
    padding: 4px var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: var(--text-base);
    transition: border-color 0.12s, box-shadow 0.12s;
  }

  input::placeholder, textarea::placeholder { color: var(--color-text-tertiary); }

  input:not([type="checkbox"], [type="radio"], [type="submit"]):focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-focus);
  }

  select {
    appearance: none;
    padding-right: 26px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6f78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 14px;
  }

  textarea { resize: vertical; line-height: 1.5; }

  input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--color-accent); }

  label { font-weight: 500; color: var(--color-text-secondary); }

  /* Buttons: <button> and submit inputs default to the secondary style; see .button--* */
  button, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-height);
    padding: 0 var(--space-3);
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: var(--text-base);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
  }

  button:hover, input[type="submit"]:hover { background: var(--color-hover); }

  table { width: 100%; font-size: var(--text-base); }
  th {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-tertiary);
    border-bottom: 1px solid var(--color-border);
  }
  td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover { background: var(--color-hover); }
}
