/* DATUM task pane: calm, minimal, keyboard friendly. */
/* The wordmark's font (SIL Open Font License, assets/fonts/OFL.txt). */
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap; src: url('assets/fonts/sora-700.woff2') format('woff2'); }
:root {
  /* The company theme's first colour (set by app.ts). */
  --accent: var(--theme-accent, #0f2b46);
  --text: #1f2328;
  --muted: #6b7680;
  --line: #e4e7eb;
  --soft: #f5f6f8;
  /* Page, raised surfaces (inputs, menus, dialogs) and the chart preview (a slide). */
  --bg: #fff;
  --surface: #fff;
  --raised: #fff;
  --slide: #fff;
  --on-accent: #fff;
  --primary: var(--accent);
  --focus-bg: #eef4fb;
  --shadow: rgb(0 0 0 / 0.14);
  --danger: #b42318;
  --warn: #9a6700;
  --radius: 8px;
  color-scheme: light;
  font: 13px/1.45 'Segoe UI Variable Text', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
}
/* Dark pane, in Aqentra's colours: deep navy, blue and mint, a magenta-to-orange call to action. */
:root[data-appearance='dark'] {
  --accent: #63b6ff;
  --mint: #8be5d8;
  --text: #e7efff;
  --muted: #a3b1c9;
  --line: rgb(128 161 220 / 0.22);
  --soft: rgb(99 182 255 / 0.09);
  --bg: #070e1a;
  --surface: #0f1c31;
  --raised: #152540;
  --slide: #fff;
  --on-accent: #fff;
  --primary: linear-gradient(140deg, #f64fff, #d86a0e);
  --focus-bg: #152540;
  --shadow: rgb(4 10 21 / 0.55);
  --danger: #ff8a80;
  --warn: #ffb875;
  --radius: 10px;
  color-scheme: dark;
}
/* The glow fills the whole pane (the page's root), however short the page. */
:root[data-appearance='dark'] {
  min-height: 100%;
  background:
    radial-gradient(circle at 10% 0%, rgb(99 182 255 / 0.1), transparent 45%) fixed,
    radial-gradient(circle at 100% 100%, rgb(139 229 216 / 0.07), transparent 45%) fixed,
    var(--bg);
}
:root[data-appearance='dark'] body { background: transparent; }
:root[data-appearance='dark'] header { background: rgb(7 14 26 / 0.8); backdrop-filter: blur(14px); }
:root[data-appearance='dark'] .primary { border: 1px solid rgb(255 168 236 / 0.55); }
:root[data-appearance='dark'] .primary.dirty:hover { box-shadow: 0 0 24px rgb(246 79 255 / 0.3); }
:root[data-appearance='dark'] .footer, :root[data-appearance='dark'] #status { background: rgb(7 14 26 / 0.92); backdrop-filter: blur(14px); }
:root[data-appearance='dark'] .preview { border-color: transparent; }
/* The grid's sticky header stays solid as rows scroll under it. */
:root[data-appearance='dark'] .grid thead th, :root[data-appearance='dark'] .grid .corner { background: var(--surface); }
/* Dark colours stay visible on the dark pane. */
:root[data-appearance='dark'] .well, :root[data-appearance='dark'] .dot { box-shadow: 0 0 0 1px rgb(139 185 255 / 0.45); }
:root[data-appearance='dark'] .dot.on { box-shadow: 0 0 0 2px var(--text); }
:root[data-appearance='dark'] button:focus-visible, :root[data-appearance='dark'] input:focus-visible,
:root[data-appearance='dark'] select:focus-visible, :root[data-appearance='dark'] textarea:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgb(99 182 255 / 0.34); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Room for the scrollbar is kept on every page, so Data and Format (and the
   preview above them) are the same width whether or not the page scrolls. */
html { overflow-y: scroll; scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); }
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.brand { font: 700 14px/1 'Sora', 'Segoe UI', sans-serif; letter-spacing: 0.04em; display: flex; align-items: center; gap: 8px; }
.mark { width: 20px; height: 20px; flex: none; display: block; }
.mark-dark, :root[data-appearance='dark'] .mark-light { display: none; }
:root[data-appearance='dark'] .mark-dark { display: block; }
.head-tools { display: flex; align-items: center; gap: 2px; }
/* Light or dark pane: the moon shows in the light pane, the sun in the dark one. */
#appearance-btn .sun, :root[data-appearance='dark'] #appearance-btn .moon { display: none; }
:root[data-appearance='dark'] #appearance-btn .sun { display: inline; }
main { padding: 14px; padding-bottom: 110px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 12px; font-weight: 600; margin: 0; }
a { color: var(--accent); }
.hint, .muted { color: var(--muted); font-size: 12px; }
.hint.error, #status.error { color: var(--danger); }
.hint.warn { color: var(--warn); }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button[disabled] { opacity: 0.45; cursor: not-allowed; }
.ghost { padding: 5px 9px; border-radius: 6px; color: var(--muted); }
.ghost:hover { background: var(--soft); color: var(--text); }
.ghost.icon { padding: 4px 7px; line-height: 1; }
.primary {
  width: 100%; padding: 9px; border-radius: var(--radius); background: var(--primary); color: var(--on-accent); font-weight: 600;
  opacity: 0.55; transition: opacity 0.15s;
}
.primary.dirty, .primary:hover { opacity: 1; }
.secondary {
  padding: 5px 11px; border-radius: 6px; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; white-space: nowrap;
}
.secondary:hover { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--accent); transition: border-color 0.15s, transform 0.15s;
}
.tile span { color: var(--text); font-size: 12px; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.tile.small { padding: 8px 4px 6px; gap: 4px; }
.tile.small span { font-size: 11px; }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.steps { margin: 12px 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.steps li { margin-bottom: 3px; }
.paste {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; margin-bottom: 12px;
  border: 1px dashed var(--line); border-radius: var(--radius); cursor: text;
}
.paste:focus { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--bg)); outline: none; }
.paste strong { font-size: 12px; }
.linked-list:not(:empty) { padding: 10px 12px; margin-bottom: 12px; background: var(--soft); border-radius: var(--radius); }
.linked-item { font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked-item.live { display: grid; gap: 1px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); white-space: normal; cursor: pointer; }
.linked-item.live > span, .linked-item.live .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked-item.live:hover .name, .linked-item.pick:hover { color: var(--accent); }
.linked-item.pick { display: block; width: 100%; text-align: left; padding: 4px 0; }
.tools .chip { padding: 3px 9px; font-size: 12px; }

/* Link status: live (green), saved file (blue), new data waiting (amber), problem (red). */
.state { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c4c9cf; }
.state.live { background: #1a7f37; box-shadow: 0 0 0 3px color-mix(in srgb, #1a7f37 18%, transparent); }
.state.file { background: #0969da; }
.state.pending { background: #d97706; }
.state.missing, .state.error { background: #b42318; }

.row { display: flex; align-items: center; gap: 6px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.tight { gap: 0; }
button.icon:disabled { opacity: 0.35; cursor: default; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }

.preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 10px 0 12px; min-height: 80px; background: var(--slide); }
.preview svg { width: 100%; height: auto; display: block; }
.editor .preview { margin-bottom: 4px; cursor: context-menu; }
.preview svg * { pointer-events: none; }
/* Every part of the chart can be clicked for its menu (see menu.ts). */
.preview [data-s], .preview [data-role] { cursor: pointer; pointer-events: auto; }
.preview [data-s]:hover, .preview [data-role]:hover, .preview .picked,
.preview :has(+ .grab:hover), .preview :has(+ .grab.picked) { opacity: 0.65; }
.editor .preview [data-role="decoration"] { cursor: grab; touch-action: none; }
.editor .preview.dragging, .editor .preview.dragging * { cursor: grabbing; }
.preview.dragging [data-role]:hover { opacity: 1; }
.hint.center { text-align: center; margin: 0 0 10px; }
.menu {
  position: fixed; z-index: 10; width: 280px; max-width: calc(100vw - 16px); padding: 10px 12px 12px; display: grid; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px var(--shadow);
}
.menu.narrow { width: 180px; padding: 4px; gap: 0; }
.menu-head strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; }
.menu-label { font-size: 11px; color: var(--muted); }
.menu-sep { border-top: 1px solid var(--line); margin: 2px 0; }
/* A menu opened for shapes selected on the slide: where it comes from, and buttons to change the selection. */
.menu-slide { gap: 6px; font-size: 11px; }
.menu input.wide { width: 100%; }
.menu-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; }
.menu-item:hover { background: var(--soft); }
select.type { max-width: 200px; font-weight: 600; border-color: transparent; background: var(--soft); }
.issues { margin: 0; padding-left: 18px; color: var(--danger); font-size: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { padding: 7px 10px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.grid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: 260px; }
.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; min-width: 64px; }
.grid thead th { background: var(--soft); position: sticky; top: 0; }
.grid th.label { padding: 6px 8px; text-align: left; font-weight: 600; font-size: 12px; }
.grid input { width: 100%; border: 0; padding: 6px 8px; font: inherit; color: inherit; background: transparent; }
.grid thead input, .grid tbody th input { font-weight: 600; }
.grid input.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid input:focus { background: var(--focus-bg); outline: none; box-shadow: none; }
.grid .corner { background: var(--soft); }
.grid tbody th { min-width: 96px; }
.grid th { position: relative; }
.grid .remove {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%); padding: 1px 5px; font-size: 12px;
  background: var(--soft); opacity: 0; transition: opacity 0.1s;
}
.grid th:hover .remove, .grid th:focus-within .remove { opacity: 1; }
.grid .remove[disabled] { display: none; }
.link { margin-bottom: 10px; }
.link.linked { padding: 8px 10px; background: var(--soft); border-radius: var(--radius); }
.link .source { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link .row:has(> .state) { min-width: 0; }
.link button { white-space: nowrap; }
.link .hint { margin: 4px 0 0; }
.link-panel:not(:empty) { display: grid; gap: 8px; margin-top: 8px; padding: 8px; background: var(--soft); border-radius: var(--radius); }
.tools { margin-top: 6px; flex-wrap: wrap; gap: 2px; }
.tools .ghost { white-space: nowrap; font-size: 12px; }

.group { border-bottom: 1px solid var(--line); padding: 2px 0 6px; margin-bottom: 8px; }
.group > summary { cursor: pointer; font-weight: 600; padding: 6px 0 10px; list-style: none; display: flex; justify-content: space-between; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after { content: '›'; color: var(--muted); transform: rotate(90deg); transition: transform 0.15s; }
.group:not([open]) > summary::after { transform: none; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--soft); border-radius: var(--radius); padding: 2px; }
.segmented button { padding: 5px 11px; border-radius: 6px; color: var(--muted); }
.segmented button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 2px var(--shadow); font-weight: 600; }
.chip { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
input.small, select { border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font: inherit; color: inherit; width: 70px; background: var(--surface); }
select { width: auto; max-width: 170px; }
input.wide { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; color: inherit; width: 100%; background: var(--surface); }
input[type='range'] { width: 100%; accent-color: var(--accent); }
input.custom { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; }
.stepper span { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.series, .deco { padding: 4px 0; }
.series .name, .deco .name { font-size: 12px; min-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A line series' width and pattern, under its colour; the Lines section. */
.series-line { padding: 0 0 6px 78px; }
select.marker-pick { max-width: 132px; }
.marker-icon { width: 11px; height: 11px; display: block; fill: currentColor; }
.line-kind { padding: 4px 0 6px; display: grid; gap: 4px; }
.line-kind .name { font-size: 12px; }
.swatches { gap: 4px; }
.menu .swatches { flex-wrap: wrap; }
.segmented button { white-space: nowrap; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.dot.on { box-shadow: 0 0 0 2px var(--text); }
.dot.big { width: 24px; height: 24px; }
/* Theme page: colour wells open the colour picker. */
.well { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1px var(--line); flex: none; }
.well input { width: 40px; height: 40px; margin: -7px; padding: 0; border: 0; cursor: pointer; background: none; }
.well:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.palette { gap: 6px; }
.named-colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px 10px; }
.named { display: flex; align-items: center; gap: 7px; font-size: 12px; cursor: pointer; }
.fields { gap: 0 18px; align-items: flex-start; }
.theme-page > input.wide { margin-bottom: 2px; font-weight: 600; }

textarea.json {
  width: 100%; min-height: 260px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  font: 12px/1.5 ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace; resize: vertical; color: inherit; background: var(--surface);
}
.footer { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px; background: var(--bg); border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.footer .primary { flex: 1; width: auto; }
#status { position: fixed; bottom: 57px; left: 0; right: 0; padding: 4px 14px; font-size: 12px; color: var(--muted); background: var(--bg); display: flex; align-items: baseline; gap: 8px; }
#status:empty { display: none; }
#status > span { flex: 1; min-width: 0; }
#status button { border: 0; background: none; padding: 0 2px; font: inherit; cursor: pointer; color: inherit; }
#status button.link { color: var(--accent); font-weight: 600; text-decoration: underline; }
#status button.close { font-size: 15px; line-height: 1; opacity: 0.7; }
#status button.close:hover { opacity: 1; }
.editor .preview.picking, .editor .preview.picking [data-s] { cursor: crosshair; }
.hint.active { color: var(--accent); font-weight: 600; }
.design { margin: 0 0 12px; padding: 8px 10px; background: var(--soft); border-radius: var(--radius); }
label.check { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 10px; cursor: pointer; }
.role-key { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.role-key span { display: inline-flex; align-items: center; gap: 4px; }
.role-key i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(47, 111, 235, 0.45); }
.place .steps { margin: 0 0 8px; padding-left: 20px; font-size: 13px; line-height: 1.45; }

/* The pane's own dialog (Update linked charts?). */
.modal { position: fixed; inset: 0; background: rgb(0 0 0 / 0.25); display: flex; align-items: flex-start; justify-content: center; padding: 70px 14px 14px; z-index: 20; }
.dialog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px var(--shadow); padding: 16px; width: 100%; max-width: 340px; }
.dialog h3 { font-size: 14px; margin-bottom: 6px; }
.dialog p { margin: 0 0 14px; color: var(--muted); }
.dialog .row { flex-wrap: wrap; }

/* Data links: pick charts to update. */
.manager .linked-item .path { font-size: 11px; }
.manager input[type='checkbox'] { margin: 0 4px 0 0; accent-color: var(--accent); }
.manager label.row { cursor: pointer; }
.manager-foot { margin-top: 12px; }

/* Excel: which presentations each block of linked cells feeds. */
.connection { margin-top: 6px; }
.connection .use { display: block; font-size: 11px; padding-left: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
