:root {
  color-scheme: light;
  --background: #eef2f7;
  --surface: #ffffff;
  --text: #142239;
  --border: #cbd5e1;
  --accent: #1545a6;
  --selection: #e3ecff;
  --error: #a52130;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #101827;
  --surface: #172235;
  --text: #edf4ff;
  --border: #3f506b;
  --accent: #a1beff;
  --selection: #243858;
  --error: #ff9caa;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font: 1rem/1.55 system-ui, sans-serif; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand, .actions { display: flex; align-items: center; gap: .65rem; }
.brand { font-weight: 750; font-size: 1.15rem; }
.mark { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: .6rem; background: var(--accent); color: var(--surface); }
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: calc(100vh - 4rem); }
nav { padding: 1rem; background: var(--surface); border-inline-end: 1px solid var(--border); }
nav a { display: block; color: var(--text); padding: .55rem .7rem; margin-bottom: .2rem; border-radius: .55rem; text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { background: var(--selection); color: var(--accent); }
.content { padding: clamp(1rem, 4vw, 3rem); width: 100%; max-width: 87rem; }
.login { max-width: 30rem; margin: clamp(2rem, 12vh, 8rem) auto; padding: 0 1rem; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: .95rem; padding: clamp(1rem, 3vw, 1.75rem); margin-bottom: 1rem; }
h1, h2, p { margin: 0 0 .8em; }
h1 { font-size: clamp(1.55rem, 4vw, 2.35rem); line-height: 1.15; }
h2 { font-size: 1.2rem; }
.panel > :last-child, .stack > p { margin-bottom: 0; }
a { color: var(--accent); }
.tile { display: block; text-decoration: none; font-weight: 650; }
.tile:hover { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.stack { display: grid; gap: .9rem; }
.form-row { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem; }
label { display: grid; gap: .35rem; font-weight: 600; }
input, select, button { border: 1px solid var(--border); border-radius: .55rem; padding: .55rem .75rem; font: inherit; }
input, select { max-width: 100%; min-width: 0; color: var(--text); background: var(--background); }
button { cursor: pointer; color: var(--surface); background: var(--accent); border-color: var(--accent); }
button.secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
button:hover { filter: brightness(.9); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.error { color: var(--error); }
code { overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: start; }
td, th { padding: .55rem; text-align: start; border-bottom: 1px solid var(--border); }
@media (max-width: 46rem) {
  .layout { display: block; }
  nav { display: flex; gap: .25rem; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--border); padding: .5rem; }
  nav a { flex: 0 0 auto; }
  .actions button { font-size: .875rem; }
}

.preview-inline { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-block: .65rem; }
.preview-inline label { margin: 0; }
.preview-inline input[type="checkbox"] { width: auto; }
.table-scroll { overflow-x: auto; }
.content article.panel { margin-block: .75rem; overflow-wrap: anywhere; }
.content textarea { display: block; width: 100%; min-height: 5rem; font: inherit; }
