/* Dental Charting */

:root {
  --brand-900: #1f2f40;
  --brand-800: #2a3e53;
  --brand-700: #324a63;
  --brand-600: #3b546f;   /* logo slate blue */
  --brand-500: #4f6b89;
  --brand-300: #9fb2c6;
  --brand-200: #c9d5e1;
  --brand-100: #e6edf4;
  --brand-50: #f2f6fa;

  --ink-900: #16202a;
  --ink-800: #222e3a;
  --ink-700: #384655;
  --ink-600: #4f5e6d;
  --ink-500: #677685;
  --ink-400: #8a97a4;
  --line: #dfe5ec;
  --line-strong: #cbd4de;
  --bg: #f3f5f8;
  --surface: #ffffff;

  --clin-red: #e74c3c;    /* chart symbol colours, as drawn by the engine */
  --clin-blue: #3498db;

  --danger-600: #c0362c;
  --danger-50: #fdf1f0;
  --ok-600: #1f7a4d;
  --focus: #2f6fbf;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(22, 32, 42, .06);
  --shadow: 0 1px 2px rgba(22, 32, 42, .05), 0 4px 16px rgba(22, 32, 42, .06);
  --shadow-lg: 0 12px 40px rgba(22, 32, 42, .18);

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink-800);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--brand-700); color: #fff; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.sprite { position: absolute; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: none; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn--primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-700); }
.btn--primary:active { background: var(--brand-800); }
.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink-800); }
.btn--secondary:hover { background: var(--brand-50); border-color: var(--brand-300); }
.btn--ghost { color: var(--ink-700); }
.btn--ghost:hover { background: var(--brand-50); color: var(--brand-800); }
.btn--danger { background: var(--danger-600); color: #fff; }
.btn--danger:hover { background: #a52c23; }
.btn--tool {
  height: 34px; padding: 0 11px; color: var(--ink-700); font-weight: 600;
  border-color: var(--line); background: var(--surface);
}
.btn--tool:hover { background: var(--brand-50); border-color: var(--brand-200); }
.btn--tool[aria-pressed="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn--danger-text:hover { color: var(--danger-600); background: var(--danger-50); border-color: #f2c9c5; }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-700);
  transition: background-color .15s, color .15s, border-color .15s;
}
.iconbtn:hover:not(:disabled) { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-200); }
.iconbtn:disabled, .iconbtn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

.linkbtn {
  border: 0; padding: 0; background: none; color: var(--ink-500);
  text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--brand-700); }

/* ----------------------------------------------------------------- appbar */

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 8px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.appbar__brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.appbar__logo { height: 38px; width: auto; display: block; }
.appbar__actions { display: flex; align-items: center; gap: 4px; }
.appbar__sep { width: 1px; height: 24px; margin: 0 6px; background: var(--line); }

/* ----------------------------------------------------------- patient card */

.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn--sm .icon { width: 16px; height: 16px; }

.patient-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
  margin: 0; padding: 2px 16px 14px;
}
.patient-fields > div { min-width: 0; }
.patient-fields > div:first-child { grid-column: 1 / -1; }
.patient-fields dt {
  font-size: 10.5px; font-weight: 650; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-500);
}
.patient-fields dd {
  margin: 1px 0 0; font-size: 13.5px; font-weight: 600; color: var(--ink-900);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.patient-fields > div:first-child dd { font-size: 15px; }
.patient-fields dd.is-empty { color: var(--ink-500); font-weight: 500; }

/* -------------------------------------------------------------- workspace */

.workspace {
  flex: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start;
  width: 100%; max-width: 1640px; margin: 0 auto; padding: 16px 24px 24px;
}
.workspace__main, .workspace__side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.workspace__side { position: sticky; top: 72px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px 8px;
}
.card__title { margin: 0; font-size: 15px; font-weight: 650; color: var(--ink-900); display: flex; align-items: center; gap: 8px; }
.card__title label { cursor: inherit; }

.count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--brand-100); color: var(--brand-800);
  font-size: 12px; font-weight: 700;
}

/* ---------------------------------------------------------------- palette */

.legend-dots { display: flex; gap: 14px; font-size: 12px; color: var(--ink-500); }
.legend-dots span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--red { background: var(--clin-red); }
.dot--blue { background: var(--clin-blue); }

.palette {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px;
  padding: 0 16px;
}
.palette__btn {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  min-height: 31px; padding: 4px 9px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-800);
  font-size: 12.5px; font-weight: 600; line-height: 1.2; text-align: left;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.palette__btn:hover { border-color: var(--brand-300); background: var(--brand-50); }
.palette__btn[aria-pressed="true"] {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
  box-shadow: 0 2px 8px rgba(59, 84, 111, .35);
}
.palette__btn[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px #fff; }
.palette__label { min-width: 0; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }

.toolhint {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 16px 12px; padding: 7px 11px;
  border-radius: var(--radius); background: var(--brand-50); border: 1px solid var(--brand-100);
  color: var(--ink-700); font-size: 13px;
}
.toolhint .icon { color: var(--brand-500); }
.toolhint b { color: var(--ink-900); }
.toolhint__term { color: var(--ink-600); }
.toolhint.is-active { background: #eef7fd; border-color: #cfe6f6; }
.toolhint.is-active .icon { color: var(--clin-blue); }
.toolhint.is-red.is-active { background: #fdf2f1; border-color: #f6d3cf; }
.toolhint.is-red.is-active .icon { color: var(--clin-red); }
.toolhint kbd { font-size: 11px; }

/* ------------------------------------------------------------------ chart */

.chart-card:focus { outline: none; }
.chart-toolbar { padding-bottom: 8px; }
.chart-toolbar__tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }

.segmented {
  display: inline-flex; padding: 3px; gap: 3px;
  background: var(--brand-50); border: 1px solid var(--line); border-radius: 10px;
}
.segmented__btn {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 108px; padding: 3px 13px;
  border: 0; border-radius: 7px; background: none; color: var(--ink-600);
  line-height: 1.15; text-align: left;
}
.segmented__btn:hover { color: var(--brand-800); }
.segmented__label { font-weight: 650; font-size: 13.5px; }
.segmented__sub { font-size: 11.5px; color: var(--ink-600); }
.segmented__btn[aria-checked="true"] { background: var(--surface); color: var(--brand-800); box-shadow: inset 0 0 0 2px var(--brand-600), 0 1px 3px rgba(22, 32, 42, .12); }
.segmented__btn[aria-checked="true"] .segmented__sub { color: var(--brand-500); }

.chart-scroll {
  margin: 0 16px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.odontogram:focus-visible { outline-offset: -2px; }
.odontogram {
  display: block; width: 100%; min-width: 640px; aspect-ratio: 680 / 408;
  /* keep palette + whole chart on one screen */
  margin: 0 auto;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.chart-help { margin: 8px 16px 12px; color: var(--ink-500); font-size: 12px; }
.chart-help b { color: var(--ink-700); }

kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; background: var(--surface); color: var(--ink-700); font: 600 11.5px var(--font);
}

/* --------------------------------------------------------------- findings */

.filter { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); }
.filter button:first-child { border-radius: 7px 0 0 7px; }
.filter button:last-child { border-radius: 0 7px 7px 0; }
.filter button { border: 0; background: var(--surface); padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--ink-600); }
.filter button + button { border-left: 1px solid var(--line); }
.filter button[aria-checked="true"] { background: var(--brand-600); color: #fff; }

.findings {
  list-style: none; margin: 0; padding: 0 8px 10px;
  max-height: calc(100vh - 520px); min-height: 180px; overflow-y: auto;
}
.findings__empty { padding: 26px 18px 30px; text-align: center; color: var(--ink-500); }
.findings__empty svg { width: 34px; height: 34px; color: var(--brand-300); margin-bottom: 6px; }
.findings__empty b { display: block; color: var(--ink-700); margin-bottom: 2px; font-size: 13.5px; }
.findings__group {
  padding: 10px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-500);
}
.finding {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
}
.finding:hover { background: var(--brand-50); }
.finding__tooth {
  display: grid; place-items: center; min-width: 38px; height: 30px; padding: 0 6px;
  border-radius: 7px; background: var(--brand-100); color: var(--brand-800);
  font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.finding__body { min-width: 0; }
.finding__title { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink-900); font-size: 13.5px; }
.finding__meta { color: var(--ink-600); font-size: 12px; margin-top: 1px; }
.finding__code {
  font: 700 11px var(--font); letter-spacing: .4px; color: #1a6699;
  border: 1px solid #b9dcf3; border-radius: 4px; padding: 0 4px;
}
.finding__code.is-red { color: #c0392b; border-color: #f5c2bc; }
.finding__remove {
  width: 28px; height: 28px; border: 0; border-radius: 6px; background: none;
  color: var(--ink-600); display: grid; place-items: center; opacity: 0; transition: opacity .12s;
}
.finding:hover .finding__remove, .finding__remove:focus-visible { opacity: 1; }
.finding__remove:hover { background: var(--danger-50); color: var(--danger-600); }
@media (hover: none) { .finding__remove { opacity: 1; } }

.notes-card .card__head { padding-bottom: 8px; }
.notes-card .textarea { display: block; width: calc(100% - 32px); margin: 0 16px 16px; }

/* ----------------------------------------------------------------- inputs */

.input, .textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid #7d8a97; border-radius: var(--radius);
  background: var(--surface); color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s;
}
.input { height: 38px; }
.textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.input:hover, .textarea:hover { border-color: var(--brand-300); }
.input:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79, 107, 137, .18); }
.input::placeholder, .textarea::placeholder { color: var(--ink-500); }
.input--code {
  height: 52px; text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 8px;
  text-transform: uppercase; color: #1f78b4;
}

.field { display: grid; gap: 6px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.field__help { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-500); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field--full { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- dialogs */

.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 14px;
  background: var(--surface); color: var(--ink-800); box-shadow: var(--shadow-lg);
}
.dialog--sm { width: min(420px, calc(100vw - 32px)); }
.dialog--lg { width: min(1040px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(22, 32, 42, .45); backdrop-filter: blur(2px); }
.dialog[open] { animation: dlg-in .16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.dialog__body { padding: 20px 22px 22px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog__head h2 { margin: 0; font-size: 17px; font-weight: 650; color: var(--ink-900); }
.dialog__head .iconbtn { border-color: transparent; }
.dialog__text { margin: 0 0 6px; color: var(--ink-600); }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.prose p { margin: 0 0 12px; color: var(--ink-700); }
.prose code { font-size: 12.5px; background: var(--brand-50); padding: 1px 5px; border-radius: 4px; }

/* -------------------------------------------------------------- symbol key */

.keygrid {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px;
}
.keyitem {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--radius);
}
.keyitem canvas { display: block; height: 108px; width: auto; border-radius: 4px; background: #fff; }
.keyitem__title { font-weight: 650; color: var(--ink-900); font-size: 13.5px; }
.keyitem__term { font-size: 12px; color: var(--ink-500); margin-top: 1px; }
.keyitem__def { font-size: 12px; color: var(--ink-600); margin-top: 6px; }
.keyitem__es { font-size: 11px; color: var(--ink-500); margin-top: 6px; }

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 10px;
  background: var(--ink-900); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out;
}
.toast .icon { color: #8fd3ad; }
.toast--error { pointer-events: auto; background: #5c1b16; }
.toast--error .icon { color: #ff9b91; }
.toast__close { display: grid; place-items: center; width: 26px; height: 26px; margin-left: 4px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .12); color: #fff; }
.toast__close:hover { background: rgba(255, 255, 255, .22); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------------- footer */

.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px 18px; color: var(--ink-500); font-size: 12.5px;
  border-top: 1px solid var(--line); background: var(--surface);
}

/* ------------------------------------------------------------------ login */

.login-page {
  background-color: var(--bg);
  /* faint pattern of the logo mark */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='%233b546f' fill-opacity='.045'%3E%3Crect x='41' y='26' width='13' height='13' rx='3'/%3E%3Crect x='25.5' y='41.5' width='13' height='13' rx='3'/%3E%3Crect x='56.5' y='41.5' width='13' height='13' rx='3'/%3E%3Crect x='41' y='57' width='13' height='13' rx='3'/%3E%3Crect x='41' y='41.5' width='13' height='13' rx='3'/%3E%3C/g%3E%3C/svg%3E");
}
.login {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 32px 16px;
}
.login__card {
  width: min(420px, 100%); padding: 32px 32px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.login__logo { display: block; height: 46px; width: auto; margin: 0 auto 22px; }
.login__title { margin: 0; font-size: 22px; font-weight: 650; color: var(--ink-900); text-align: center; }
.login__lead { margin: 4px 0 20px; color: var(--ink-600); text-align: center; }
.login__form { display: grid; gap: 14px; }
.login__submit { height: 42px; margin-top: 4px; font-size: 14.5px; }
.login__submit:disabled { opacity: .75; cursor: progress; }
.login__alert {
  margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--danger-50); border: 1px solid #f2c9c5; color: #8f2a22; font-weight: 600; font-size: 13.5px;
}
.login__alert--info { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
.login__small { margin: 18px 0 0; color: var(--ink-600); font-size: 12.5px; text-align: center; }
.login__foot { margin: 0; color: var(--ink-600); font-size: 12.5px; text-align: center; }
.login__hint { margin: 0; color: var(--ink-600); font-size: 12.5px; text-align: center; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--brand-50); border: 1px solid var(--line); border-radius: 10px;
}
.tabs__tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px;
  border: 0; border-radius: 7px; background: none; color: var(--ink-600); font-weight: 600; font-size: 13.5px;
}
.tabs__tab:hover { color: var(--brand-800); }
.tabs__tab[aria-selected="true"] {
  background: var(--surface); color: var(--brand-800);
  box-shadow: inset 0 0 0 2px var(--brand-600), 0 1px 3px rgba(22, 32, 42, .12);
}
.tabs__panel[hidden] { display: none; }

.org-banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--brand-50); border: 1px solid var(--brand-200); color: var(--ink-700);
}
.org-banner .icon { color: var(--brand-600); }
.org-banner b { color: var(--ink-900); }
.org-banner[hidden], .field[hidden] { display: none; }

.password { position: relative; display: block; }
.password .input { padding-right: 64px; }
.password__toggle {
  position: absolute; top: 4px; right: 4px; height: 30px; padding: 0 10px;
  border: 0; border-radius: 6px; background: var(--brand-50); color: var(--brand-800); font-weight: 600; font-size: 12.5px;
}
.password__toggle:hover { background: var(--brand-100); }

/* signed-in user in the app bar */
.signout { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.signout[hidden] { display: none; }
.signout__user {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 0 10px; height: 30px;
  border-radius: 999px; background: var(--brand-50); color: var(--brand-800); font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .workspace__side { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .workspace__side .patient-card { grid-column: 1 / -1; }
  .findings { max-height: 420px; }
}

@media (max-width: 900px) {
  .appbar { flex-wrap: wrap; padding: 10px 16px; }
  .appbar__actions { width: 100%; overflow-x: auto; padding: 4px; }
  .workspace { padding: 16px; }
  .workspace__side { grid-template-columns: minmax(0, 1fr); }
  .palette { gap: 4px; }
  .palette__btn { font-size: 11.5px; padding: 4px 5px; gap: 5px; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .palette { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .appbar__actions .btn span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .appbar__actions .btn { padding: 0 10px; }
  .appbar__logo { height: 32px; }
  .palette { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 12px; }
  .card__head { padding: 12px; }
  .toolhint, .chart-help { margin-left: 12px; margin-right: 12px; }
  .chart-scroll { margin: 0 12px; }
  .chart-toolbar__tools .btn span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .segmented__btn { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ print */

.print-root { display: none; }

@media print {
  @page { size: A4; margin: 0; }
  html.is-printing body { background: #fff; display: block; }
  html:not(.is-printing) .appbar, html:not(.is-printing) .workspace__side { position: static; }
  html.is-printing body > *:not(.print-root) { display: none !important; }
  html.is-printing .print-root { display: block !important; }
  .print-root img { display: block; width: 210mm; height: 297mm; break-after: page; page-break-after: always; }
  .print-root img:last-child { break-after: auto; page-break-after: auto; }
}
