:root {
  color-scheme: light;
  --page: #f5f6fb;
  --panel: #fff;
  --soft: #f0f1f8;
  --text: #202036;
  --muted: #5f6178;
  --line: #e0e2ee;
  --control: #85869d;
  --accent: #5242c0;
  --accent-bg: #edeaff;
  --primary: #5a49cb;
  --primary-hover: #4937b5;
  --on-primary: #fff;
  --good: #256452;
  --good-bg: #e3f4ec;
  --warn: #925425;
  --warn-bg: #fff0dd;
  --bad: #a73055;
  --bad-bg: #fce8ef;
  --shadow: 0 9px 25px #22254909;
  --radius: .95rem;
  --sidebar: 14.5rem;
  --topbar: 4.35rem;
  font-family: "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #141522;
  --panel: #1c1d2f;
  --soft: #25263b;
  --text: #f0eff9;
  --muted: #b8b8d1;
  --line: #393a52;
  --control: #82829f;
  --accent: #b6a7ff;
  --accent-bg: #322a54;
  --primary: #ad99ff;
  --primary-hover: #c1b0ff;
  --on-primary: #1c1435;
  --good: #9be0c4;
  --good-bg: #253d39;
  --warn: #ffd097;
  --warn-bg: #463623;
  --bad: #ffacc1;
  --bad-bg: #462737;
  --shadow: 0 12px 26px #0a0b141f;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--topbar) + .6rem); }
body { margin: 0; background: var(--page); color: var(--text); font-size: 1rem; line-height: 1.52; }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.2; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 4vw, 2.65rem); letter-spacing: -.052em; }
h2 { font-size: 1.22rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: .6rem; left: .6rem; z-index: 10; padding: .5rem .9rem; border-radius: .5rem; background: var(--panel); }
.icon { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.7rem; padding: .55rem .82rem;
  border: 1px solid transparent; border-radius: .58rem; font-size: .89rem; font-weight: 680; line-height: 1.25;
  text-align: center; text-decoration: none; transition: color .17s, background .17s, border-color .17s;
}
.secondary { color: var(--text); background: var(--panel); border-color: var(--line); }
.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--soft); }
.primary { color: var(--on-primary); background: var(--primary); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.danger { color: #fff; background: #a12d4f; }
.danger:hover:not(:disabled) { background: #851f3e; }
.icon-button { width: 2.7rem; padding: 0; background: transparent; color: var(--muted); border-color: var(--line); flex: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.workspace { margin-left: var(--sidebar); min-width: 0; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 4; width: var(--sidebar); display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .9rem; overflow: auto;
}
.brand { display: flex; align-items: center; gap: .68rem; padding: .25rem .25rem .85rem; color: var(--text); font-weight: 760; line-height: 1.05; text-decoration: none; }
.brand img { flex: none; }
.brand strong { display: block; margin-top: .18rem; color: var(--muted); font-size: .82rem; font-weight: 600; }
.nav-label { margin: .6rem .68rem .32rem; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .105em; }
.nav-tools { margin-top: .95rem; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .63rem; min-height: 2.56rem; border-radius: .55rem; color: var(--muted); text-decoration: none; font-weight: 620; font-size: .91rem; }
.sidebar nav a:hover { color: var(--text); background: var(--soft); }
.sidebar nav a[aria-current] { color: var(--accent); background: var(--accent-bg); }
.sidebar-foot { display: flex; align-items: center; gap: .65rem; margin-top: auto; padding: .75rem .46rem .25rem; color: var(--accent); }
.sidebar-foot div { display: grid; color: var(--text); font-size: .82rem; }
.sidebar-foot small { color: var(--muted); font-size: .77rem; }
.topbar {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: .75rem; z-index: 3;
  min-height: var(--topbar); padding: .5rem clamp(1rem, 3vw, 2.5rem); background: var(--panel); border-bottom: 1px solid var(--line);
}
.breadcrumb { display: flex; align-items: center; gap: .54rem; color: var(--muted); font-size: .85rem; min-width: 0; }
.breadcrumb strong { color: var(--text); overflow-wrap: anywhere; }
.header-actions { flex-wrap: nowrap; }
#nav-toggle { display: none; }
main { width: min(100%, 96rem); margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); }
.heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: 1.3rem; }
.heading p { color: var(--muted); max-width: 48rem; margin-top: .32rem; overflow-wrap: anywhere; }
.local-badge { display: inline-flex; gap: .38rem; align-items: center; padding: .28rem .58rem; border-radius: 99px; color: var(--good); background: var(--good-bg); font-weight: 660; font-size: .8rem; }
.local-badge .icon { width: .95rem; height: .95rem; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: center; gap: 1rem;
  background: radial-gradient(ellipse at 85% 26%, #342c61, #211d45 48%, #211b3e); color: #f9f6ff;
  border: 1px solid #554b77; border-radius: 1.2rem; padding: clamp(1.25rem, 3vw, 2.1rem); box-shadow: 0 12px 30px #2620411b;
}
.hero h2 { max-width: 17ch; font-size: clamp(1.65rem, 3.3vw, 2.65rem); letter-spacing: -.045em; }
.hero p { color: #ddd5f4; max-width: 34rem; margin-top: .6rem; }
.hero img { display: block; width: 100%; max-height: 17rem; justify-self: center; }
.hero .actions { margin-top: 1rem; }
.hero .primary { background: #b7a5ff; color: #251a45; }
.hero .primary:hover { background: #cbbbff; }
.hero .secondary { color: #f7f1ff; border-color: #8172af; background: #362c57; }
.hero .secondary:hover { background: #48406a; }
.hero :focus-visible { outline-color: #c9baff; }
.dropzone { display: flex; align-items: center; gap: .85rem; padding: 1rem; margin-block: 1rem; border-style: dashed; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-bg); }
.drop-icon, .tile-icon { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; color: var(--accent); background: var(--accent-bg); border-radius: .66rem; }
.dropzone .button { margin-left: auto; }
.dropzone p, .demo-card p, .tool-card p, .fine, .muted { color: var(--muted); }
.demo-grid, .quick-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.demo-card, .tool-card { display: flex; align-items: flex-start; gap: .7rem; padding: .85rem; text-align: left; }
.demo-card { width: 100%; cursor: pointer; }
.demo-card:hover, .tool-card:hover { border-color: var(--accent); }
.demo-card strong, .tool-card strong { display: block; color: var(--text); }
.demo-card p, .tool-card p { margin-top: .12rem; font-size: .84rem; }
.tool-card { text-decoration: none; }
.block-heading { margin-block: 1.45rem .65rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .7rem; margin-block: 1rem; }
.metric { display: grid; gap: .38rem; padding: .85rem; color: var(--muted); font-size: .88rem; }
.metric strong { color: var(--text); font-size: 1.55rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.form-panel, .analysis-panel, .plain-panel { padding: clamp(.8rem, 2vw, 1.25rem); }
.section-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .9rem; align-items: start; }
.section-grid > * { min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem .75rem; margin-block: .65rem; }
.form-grid > * { min-width: 0; }
.form-panel > .actions, .plain-panel > .actions { margin-top: .85rem; }
.form-panel h2 + p, .plain-panel h2 + p, .analysis-panel h2 + p { margin-block: .36rem .65rem; }
.field { display: grid; align-content: start; gap: .28rem; font-size: .89rem; font-weight: 660; }
.field :is(input, textarea, select) { font-weight: 400; }
input:not([type="checkbox"], [type="radio"]), textarea, select {
  width: 100%; min-width: 0; min-height: 2.65rem; border: 1px solid var(--control); border-radius: .53rem;
  padding: .46rem .6rem; background: var(--panel); color: var(--text); font-size: 1rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }
input[type="checkbox"] { width: 1.06rem; height: 1.06rem; margin: 0; flex: none; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: .52rem; min-height: 2.2rem; padding-inline: .12rem; cursor: pointer; font-size: .9rem; overflow-wrap: anywhere; }
.column-picks { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 9rem),1fr)); max-height: 11rem; overflow: auto; gap: .06rem .45rem; }
fieldset { min-width: 0; border: 1px solid var(--line); margin: .72rem 0; padding: .45rem .6rem; border-radius: .58rem; }
legend { font-size: .88rem; font-weight: 660; }
.notice, .error-box { padding: .72rem .8rem; margin-block: .65rem; border-radius: .55rem; overflow-wrap: anywhere; }
.notice { background: var(--accent-bg); color: var(--accent); }
.error-box { background: var(--bad-bg); color: var(--bad); }
progress { accent-color: var(--primary); width: min(100%, 28rem); }
.data-panel { overflow: hidden; }
.data-tools, .pagination { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; padding: .75rem; color: var(--muted); }
.data-tools { border-bottom: 1px solid var(--line); }
.search-box { position: relative; flex: 1 1 13rem; min-width: 0; }
.search-box .icon { position: absolute; color: var(--muted); left: .65rem; top: .72rem; pointer-events: none; }
.search-box input { padding-left: 2.3rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: .42rem; margin-bottom: .65rem; }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .46rem; background: var(--accent-bg); color: var(--accent); border-radius: .4rem; font-size: .78rem; overflow-wrap: anywhere; }
.table-scroll { overflow: auto; max-height: 62vh; }
.table-scroll.compact { max-height: 15rem; border: 1px solid var(--line); border-radius: .55rem; margin-top: .5rem; }
table { border-collapse: separate; border-spacing: 0; min-width: 100%; text-align: left; font-size: .87rem; }
th, td { border-bottom: 1px solid var(--line); padding: .48rem .63rem; vertical-align: middle; text-align: left; }
thead { position: sticky; top: 0; z-index: 1; }
th { background: var(--soft); color: var(--muted); }
td { min-width: 8rem; max-width: 19rem; overflow-wrap: anywhere; }
.compact td { min-width: 4rem; white-space: pre-wrap; }
.data-table td { padding: .22rem .55rem; }
.data-table :is(th,td):first-child { min-width: 2.7rem; width: 2.7rem; }
.data-table :is(th,td):nth-child(2) { min-width: 3.45rem; width: 3.45rem; }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--soft), var(--panel) 53%); }
.data-table tbody tr.invalid td:first-child { box-shadow: inset 3px 0 var(--bad); }
.data-table tr.selected { background: var(--accent-bg) !important; }
.col-head { display: flex; align-items: center; gap: .32rem; min-width: 8rem; }
.col-head button, .cell-button { background: none; border: 0; text-align: left; color: inherit; }
.col-head button { font-weight: 700; padding: .25rem .12rem; }
.col-type { color: var(--muted); display: block; font-size: .73rem; font-weight: 400; }
.cell-button {
  width: 100%; min-height: 2.45rem; min-width: 0; padding: .24rem .12rem; border-radius: .25rem;
  display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cell-button:hover { background: var(--accent-bg); color: var(--accent); }
.empty-value { color: var(--muted); }
.pagination { justify-content: space-between; border-top: 1px solid var(--line); font-size: .84rem; }
.pagination .button { min-height: 2.5rem; }
.list { padding-left: 1.15rem; }
.rule-list { display: grid; gap: .42rem; margin-top: .65rem; }
.rule-item { display: flex; align-items: center; gap: .45rem; justify-content: space-between; border: 1px solid var(--line); border-radius: .52rem; padding: .34rem .48rem; overflow-wrap: anywhere; }
.rule-item .button { min-height: 2.3rem; }
.chart { display: grid; gap: .5rem; margin-block: .7rem; }
.chart-row { display: grid; grid-template-columns: minmax(4.4rem, 30%) minmax(1.1rem, 1fr) auto; gap: .5rem; align-items: center; font-size: .84rem; }
.chart-label { overflow-wrap: anywhere; }
.chart-row svg { width: 100%; height: .56rem; display: block; }
dialog { width: min(49rem, 100% - 1.5rem); max-height: calc(100dvh - 1.4rem); padding: clamp(.85rem, 2vw, 1.25rem); overflow: auto; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); color: var(--text); box-shadow: 0 24px 64px #17152955; }
dialog::backdrop { background: #16132c9d; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.modal-head h2 { overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 5; width: min(24rem, calc(100% - 2rem)); padding: .65rem .8rem; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: .65rem; box-shadow: var(--shadow); }
.toast:empty { position: absolute; padding: 0; margin: -1px; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 67rem) { .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 58rem) {
  :root { --sidebar: 13.5rem; }
  .hero { grid-template-columns: minmax(0,1.25fr) minmax(0,.8fr); }
  .demo-grid, .quick-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 52rem) {
  .workspace { margin-left: 0; }
  .sidebar { z-index: 4; top: var(--topbar); max-width: 85vw; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .sidebar.open { transform: translateX(0); visibility: visible; box-shadow: 0 14px 35px #18152b42; }
  #nav-toggle { display: inline-flex; }
}
@media (max-width: 38rem) {
  .hero { grid-template-columns: minmax(0,1fr); }
  .hero img { display: none; }
  .breadcrumb-parent { display: none; }
  .section-grid { grid-template-columns: minmax(0,1fr); }
  .dropzone { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .dropzone .button { grid-column: 2; margin-left: 0; justify-self: start; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 25rem) {
  .demo-grid, .quick-grid, .form-grid { grid-template-columns: minmax(0,1fr); }
  .header-actions { gap: .3rem; }
  .header-actions .button { padding-inline: .52rem; }
  .header-actions .button .icon { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; } }

