/*
 * Design tokens. Text and interactive colours meet WCAG 2.2 AA on their backgrounds:
 * --c-text 15.9:1, --c-text-muted 7.4:1, --c-primary 12.5:1 (white on primary), --c-danger 6.5:1,
 * --c-success 5.9:1, --c-border-strong 4.5:1 (input borders, ≥3:1 non-text), --c-focus 5.7:1.
 * D222 (CN-366): the default primary is the MyCaDesk navy. --c-accent (the focus ring and active
 * marks on the navy header) stays gold (7.0:1 on navy): the brand's Tick Green #218A41 reaches only
 * 2.85:1 on navy, below the 3:1 a focus indicator needs. Firm palettes (UX-4) are unchanged.
 */
:root {
  --c-bg: #ffffff;
  --c-surface: #f5f7fa;
  --c-surface-raised: #ffffff;
  --c-text: #161b26;
  --c-text-muted: #475467;
  --c-primary: #1b2f6e;
  --c-primary-hover: #142352;
  --c-on-primary: #ffffff;
  --c-accent: #f2b84b;
  --c-border: #d0d5dd;
  --c-border-strong: #737b8c;
  --c-focus: #1a5fc2;
  --c-danger: #b42318;
  --c-danger-bg: #fef3f2;
  --c-success: #067647;
  --c-success-bg: #ecfdf3;
  --c-warning-bg: #fffaeb;
  --c-warning-text: #93370d;
  --c-overlay: rgb(16 24 40 / 55%);

  --font-sans:
    system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Devanagari', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;

  --radius: 6px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 12px rgb(16 24 40 / 10%);
  --sidebar-w: 15rem;
  --header-h: 3.5rem;
  --target: 2.75rem; /* 44px minimum touch target */
  --motion: 150ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion: 0s;
  }
}

/* CN-337 help system: side panel, article blocks, law stamps, error help, field hints. */

.help-panel {
  position: fixed;
  z-index: 51;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(28rem, 100vw);
  overflow: auto;
  background: var(--c-surface-raised);
  box-shadow: var(--shadow);
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.help-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.help-panel__heading {
  font-size: var(--fs-lg);
  margin: 0;
}
.help-panel__title {
  font-size: var(--fs-lg);
  margin: 0;
}
.help-panel__lead {
  color: var(--c-text-muted);
}

.help-article h2,
.help-article h3,
.help-article h4 {
  margin-top: var(--sp-4);
}
.help-block {
  border-left: 4px solid var(--c-border-strong);
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-4);
  margin: var(--sp-3) 0;
}
.help-block--warning {
  border-left-color: var(--c-warning-text);
  background: var(--c-warning-bg);
}
.help-block__label {
  font-weight: 600;
  margin: var(--sp-2) 0 0;
}
.help-law {
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0;
}
.help-law__banner {
  background: var(--c-warning-bg);
  color: var(--c-warning-text);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
}
.help-law__cite,
.help-law__stamp,
.help-disclaimer,
.help-reviewed {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.help-token--live {
  font-weight: 600;
}
.help-token--offline,
.help-token--neutral {
  font-style: italic;
}
.help-related ul,
.help-list,
.help-search__results {
  padding-left: var(--sp-4);
}
.help-search__summary {
  display: block;
  font-size: var(--fs-sm);
}
.help-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-3) 0;
}
.help-kinds [aria-pressed='true'] {
  background: var(--c-primary);
  color: var(--c-on-primary);
}
.help-glossary dt {
  font-weight: 600;
  margin-top: var(--sp-3);
}
.help-glossary dd {
  margin-left: 0;
}
.help-error {
  margin-top: var(--sp-2);
}
.help-error__ref {
  font-size: var(--fs-sm);
}
.help-link.ui-button--link {
  padding: 0;
  min-height: 0;
  vertical-align: baseline;
}
.auth-help {
  margin-top: var(--sp-4);
  text-align: right;
}

/* CN-339 guided tours: the step card, the outlined element, the module banner, the Help panel
   section and the firm setup checklist. Motion only when the user has not asked for less. */
.tour-dialog {
  position: fixed;
  z-index: 60;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(22.5rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--c-surface-raised);
  border: 2px solid var(--c-focus);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-4) var(--sp-6);
}
.tour-dialog--anchored {
  transform: none;
}
@media (max-width: 639px) {
  .tour-dialog {
    top: auto;
    bottom: var(--sp-4);
    transform: translateX(-50%);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .tour-dialog--anchored {
    transition:
      top var(--motion),
      left var(--motion);
  }
}
.tour-dialog__meta {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.tour-dialog__title {
  font-size: var(--fs-lg);
  margin: var(--sp-1) 0 var(--sp-2);
}
.tour-dialog__title:focus {
  outline: none;
}
.tour-dialog__title:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}
.tour-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.tour-target {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: var(--radius);
}
.tour-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  border: 1px solid var(--c-border-strong);
  border-left: 4px solid var(--c-focus);
  border-radius: var(--radius);
  background: var(--c-surface-raised);
  padding: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.tour-banner p {
  margin: 0;
}
.help-tours {
  border-top: 1px solid var(--c-border-strong);
  padding-top: var(--sp-3);
}
.help-tours__heading {
  font-size: var(--fs-md);
  margin: 0 0 var(--sp-2);
}
.setup-checklist__items {
  list-style: none;
  padding: 0;
  margin: var(--sp-3) 0;
  display: grid;
  gap: var(--sp-2);
}
.setup-checklist__items li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  align-items: baseline;
}
.setup-checklist__status {
  min-width: 4.5rem;
  font-weight: 600;
}
.setup-checklist__items li.is-done .setup-checklist__status {
  color: var(--c-success);
}
.setup-checklist__links {
  display: inline-flex;
  gap: var(--sp-3);
}
/* CN-340: "Was this helpful?" at the end of an article */
.help-feedback {
  border-top: 1px solid var(--c-border);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.help-feedback__choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.help-feedback__choices [aria-pressed='true'] {
  outline: 2px solid var(--c-focus, currentColor);
  outline-offset: 1px;
}
.help-feedback__comment {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
}

/* CN-342: the firm's own note under an article (marked as the firm's text) */
.help-firm-note {
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-border-strong, var(--c-border));
  border-radius: var(--radius-sm, 4px);
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.help-firm-note__body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}
.help-firm-note__by {
  font-size: var(--fs-sm);
  margin: 0;
}
.help-firm-note__input {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
}
.help-firm-note__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* CN-342: What's new (help centre page and the Help panel entry) */
.help-whats-new {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.help-panel__whats-new {
  border-top: 1px solid var(--c-border);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
}

/* CN-343 (§15.23): Print / save as PDF on a help centre article — only the article is printed,
   stamped on every page (print.ts adds the @page margin boxes) and once at its end. */
.help-print-stamp {
  display: none;
}
@media print {
  /* scoped to a help centre article page; other pages print as before */
  .shell:has(.help-article-page) {
    display: block;
    min-height: 0;
  }
  .shell:has(.help-article-page) .shell__header,
  .shell:has(.help-article-page) .shell__nav,
  .shell:has(.help-article-page) .skip-link,
  .help-article-page .help-print-action,
  .help-article-page .help-feedback,
  .shell:has(.help-article-page) .help-panel {
    display: none !important;
  }
  .shell:has(.help-article-page) .shell__main {
    padding: 0;
    max-width: none;
  }
  .help-article-page h2,
  .help-article-page h3 {
    break-after: avoid;
  }
  .help-article-page .help-block,
  .help-article-page .help-law {
    break-inside: avoid;
  }
  .help-print-stamp {
    display: block;
    margin-top: 8mm;
    padding-top: 2mm;
    border-top: 1px solid #d0d5dd;
    font-size: 8pt;
    color: #475467;
  }
}

/*
 * CN-343: the public docs site and printable module guides. Served after the app's own
 * tokens.css and help.css (the build concatenates them), so articles look as they do in the app.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.55;
}
body {
  margin: 0;
}
a {
  color: var(--c-primary);
}
a:hover {
  color: var(--c-primary-hover);
}
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
main {
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-8);
}
main:focus {
  outline: none;
}
h1 {
  font-size: var(--fs-xl);
  line-height: 1.3;
}
table {
  border-collapse: collapse;
  width: 100%;
  margin: var(--sp-3) 0;
  font-size: var(--fs-sm);
}
th,
td {
  border: 1px solid var(--c-border);
  padding: var(--sp-2);
  text-align: left;
  vertical-align: top;
}
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.site-skip {
  position: absolute;
  left: -100rem;
  top: 0;
  background: var(--c-surface-raised);
  padding: var(--sp-2) var(--sp-4);
  z-index: 10;
}
.site-skip:focus {
  left: var(--sp-2);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-6);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-primary);
  color: var(--c-on-primary);
}
.site-header a {
  color: var(--c-on-primary);
}
.site-header :focus-visible {
  outline-color: var(--c-accent);
}
.site-brand {
  font-weight: 700;
  text-decoration: none;
  font-size: var(--fs-lg);
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  min-height: var(--target);
  line-height: var(--target);
}
.site-nav a[aria-current='page'] {
  font-weight: 700;
}
.site-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}
.site-search input {
  min-height: var(--target);
  padding: 0 var(--sp-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  font: inherit;
  width: 12rem;
  max-width: 50vw;
}
.site-search button {
  min-height: var(--target);
  padding: 0 var(--sp-3);
  border: 1px solid var(--c-on-primary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--c-on-primary);
  font: inherit;
  cursor: pointer;
}

.site-lead {
  color: var(--c-text-muted);
  font-size: var(--fs-lg);
}
.site-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-sm);
}
.site-breadcrumb li + li::before {
  content: '›';
  margin-right: var(--sp-2);
  color: var(--c-text-muted);
}
.site-list,
.site-cards {
  padding-left: var(--sp-4);
}
.site-list li,
.site-cards li {
  margin: var(--sp-2) 0;
}
.site-list__summary {
  display: block;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.site-whatsnew__date {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-bottom: 0;
}
.site-related__heading {
  font-size: var(--fs-md);
}
.signin-link__note {
  font-size: var(--fs-sm);
}
.site-shot {
  margin: var(--sp-4) 0;
}
.site-shot img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.site-shot figcaption {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.site-guide__article {
  border-top: 1px solid var(--c-border);
  margin-top: var(--sp-6);
}
.site-guide__stamp {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}

.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  padding: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.site-footer p {
  max-width: 48rem;
  margin: var(--sp-2) auto;
}
.site-print-stamp {
  display: none;
}

/* ── print: articles and module guides, every page stamped (§15.23) ── */
@page {
  size: A4;
  margin: 18mm 16mm 22mm;
}
@media print {
  html {
    font-size: 11pt;
    background: #fff;
  }
  .site-header,
  .site-footer,
  .site-skip,
  .site-breadcrumb,
  .site-guide__toc,
  .site-search,
  noscript {
    display: none !important;
  }
  main {
    max-width: none;
    padding: 0;
  }
  a {
    color: inherit;
  }
  h1,
  h2,
  h3,
  h4 {
    break-after: avoid;
  }
  .help-block,
  .site-shot,
  table,
  tr {
    break-inside: avoid;
  }
  .site-guide__article {
    break-before: page;
    border-top: 0;
  }
  /* the stamp at the end of the document; every page also carries it in the page margin (the
     @page margin boxes the build appends with this build's release and date) */
  .site-print-stamp {
    display: block;
    margin-top: 8mm;
    font-size: 8pt;
    color: #475467;
    border-top: 1px solid #d0d5dd;
    padding-top: 2mm;
  }
}

@page {
  @bottom-left {
    content: "Help release c4e6d48f22a45602 · Generated 22 November 2026 · Help explains how the software works and is not professional advice; refer to the statute or notification.";
    font-family: system-ui, sans-serif;
    font-size: 7pt;
    color: #475467;
    vertical-align: top;
    padding-top: 3mm;
  }
  @bottom-right {
    content: "page " counter(page) " of " counter(pages);
    font-family: system-ui, sans-serif;
    font-size: 7pt;
    color: #475467;
    vertical-align: top;
    padding-top: 3mm;
  }
}
