:root {
  --blue-900: #0b2a5b;
  --blue-700: #14489a;
  --blue-600: #1a5cc0;
  --blue-100: #e6eefb;
  --blue-50: #f3f7fd;
  --ink: #1b2330;
  --muted: #5a6779;
  --line: #d3dbe8;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #17663a;
  --ok-bg: #e3f4ea;
  --err: #a11a1a;
  --err-bg: #fdeaea;
  --warn: #7a5200;
  --warn-bg: #fff3d6;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--blue-700); }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; color: var(--blue-900); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: 0; }
/* Focus ring: dark blue on the light page (about 14:1 against white); amber on the dark top bar (about 7:1). The earlier amber ring on white was about 2:1. */
:focus-visible { outline: 3px solid var(--blue-900); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #f5a623; }

.topbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--blue-900); color: #fff; padding: .6rem 1rem; border-bottom: 4px solid var(--blue-600); }
.brand { display: flex; align-items: center; gap: .6rem; }
.mark { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 6px; background: #fff; color: var(--blue-900); font-weight: 700; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.unofficial { font-size: .75rem; color: #cfe0ff; letter-spacing: .02em; }
.context { margin-left: auto; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.context label { display: flex; gap: .4rem; align-items: center; font-size: .85rem; color: #cfe0ff; }
.context select { max-width: 16rem; }
.ctx-item { background: rgba(255,255,255,.14); padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; }
.menu-btn { display: none; background: transparent; color: #fff; border: 1px solid #fff; border-radius: 4px; font-size: 1.2rem; padding: .1rem .6rem; cursor: pointer; }

.layout { display: grid; grid-template-columns: 14rem 1fr; min-height: calc(100vh - 8rem); }
.sidenav { background: #fff; border-right: 1px solid var(--line); padding: .8rem 0; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a { display: block; padding: .65rem 1.2rem; color: var(--ink); text-decoration: none; border-left: 4px solid transparent; }
.sidenav a:hover { background: var(--blue-50); }
.sidenav a.active { background: var(--blue-100); border-left-color: var(--blue-600); color: var(--blue-900); font-weight: 600; }
.content { padding: 1.2rem 1.5rem 2rem; min-width: 0; }
.footer { background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; padding: .8rem 1rem; text-align: center; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sub { margin: .2rem 0 0; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--blue-600); border-radius: 6px; padding: 1rem; }
.card.wide { margin-bottom: 1rem; }
.card.notice { background: var(--blue-50); }
.kv { display: grid; grid-template-columns: fit-content(55%) minmax(0, 1fr); gap: .25rem 1rem; margin: 0 0 .6rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: break-word; font-variant-numeric: tabular-nums; }
.kv.totals { max-width: 24rem; margin-top: .8rem; padding: .6rem .8rem; background: var(--blue-50); border: 1px solid var(--line); border-radius: 6px; }
.note { color: var(--muted); font-size: .85rem; margin: .4rem 0; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { padding: .4rem .6rem; border-left: 4px solid var(--blue-600); background: var(--blue-50); margin-bottom: .4rem; }
.tasks li.attention { border-left-color: #c77700; background: var(--warn-bg); }

.btn { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--blue-700); border-radius: 4px; background: #fff; color: var(--blue-700); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--blue-50); }
.btn.primary { background: var(--blue-700); color: #fff; }
.btn.primary:hover { background: var(--blue-900); }
.btn.small { padding: .2rem .6rem; font-size: .85rem; margin-top: .4rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.muted { background: #e8ecf2; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--blue-100); color: var(--blue-900); font-size: .85rem; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: .5rem; }
input, select { font: inherit; padding: .4rem .5rem; border: 1px solid #6b7a90; border-radius: 4px; background: #fff; color: var(--ink); min-width: 0; }
.form .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem; }
fieldset.line { border: 1px solid var(--line); border-radius: 6px; margin: 1rem 0 .6rem; padding: .6rem .8rem .8rem; background: var(--blue-50); }
fieldset.line legend { padding: 0 .4rem; font-weight: 600; color: var(--blue-900); }
.field-error { color: var(--err); font-size: .82rem; margin-top: .15rem; }
.error-box { background: var(--err-bg); border: 1px solid #e0a5a5; color: var(--err); border-radius: 6px; padding: .6rem .9rem; margin: 1rem 0; }
.error-box ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.error-box code { background: rgba(0,0,0,.06); padding: 0 .25rem; border-radius: 3px; }
.success { background: var(--ok-bg); color: var(--ok); border: 1px solid #a8d7b9; border-radius: 6px; padding: .6rem .9rem; margin: 1rem 0; }
.empty { background: #fff; border: 1px dashed #98a6bb; border-radius: 6px; padding: 1.5rem; text-align: center; }
.empty ul { display: inline-block; text-align: left; }
.limits { margin-top: 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .5rem .9rem; font-size: .85rem; }
.limits summary { cursor: pointer; font-weight: 600; color: var(--blue-900); }

/* persistence, master data and settings */
.layout.single { grid-template-columns: 1fr; }
.save-chip { padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: rgba(255,255,255,.14); color: #fff; }
.save-chip.ok { background: #d7f0e0; color: var(--ok); }
.save-chip.err { background: var(--err-bg); color: var(--err); }
.save-chip.warn { background: var(--warn-bg); color: var(--warn); }
.banner { padding: .55rem 1rem; font-weight: 600; }
.banner.err { background: var(--err-bg); color: var(--err); border-bottom: 1px solid #e0a5a5; }
.banner-empty { display: none; }
.badge.fiction { background: var(--blue-100); color: var(--blue-900); }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .5rem 1rem; text-decoration: none; color: var(--ink); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { background: var(--blue-50); }
.tabs a.active { border-bottom-color: var(--blue-600); color: var(--blue-900); font-weight: 600; }
.btn.danger { border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.warn-text { background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: .5rem .7rem; font-size: .9rem; }
.confirm { border: 2px solid var(--warn); border-radius: 6px; padding: .7rem .9rem; margin: .6rem 0; background: #fffdf5; }
.confirm label { display: block; margin: .5rem 0; }
.card input[type="file"] { max-width: 100%; }

@media (max-width: 800px) {
  .menu-btn { display: inline-block; }
  .layout { grid-template-columns: 1fr; }
  .sidenav { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidenav.open { display: block; }
  .context { margin-left: 0; width: 100%; }
  .content { padding: 1rem; }
  /* touch comfort: 16px form text stops mobile browsers zooming in on focus; larger tap targets */
  input, select { font-size: 16px; min-height: 2.5rem; }
  .btn { min-height: 2.5rem; }
  .btn.small { min-height: 2.25rem; padding: .35rem .7rem; }
  .menu-btn { min-height: 2.5rem; min-width: 2.75rem; }
  .actions .btn { flex: 1 1 auto; text-align: center; }
}
@media (max-width: 480px) {
  .topbar { padding: .5rem .75rem; }
  .content { padding: .75rem; }
  .card { padding: .8rem; }
  .context select { max-width: 100%; width: 100%; }
  .context label { width: 100%; flex-direction: row; align-items: center; }
  .context select { flex: 1 1 auto; min-width: 0; }
  /* compact header: the menu button and the brand share one row; the chips share one row */
  .topbar { gap: .4rem .5rem; }
  .brand { flex: 1 1 0; min-width: 0; gap: .45rem; }
  .mark { width: 1.9rem; height: 1.9rem; }
  .brand-name { font-size: 1rem; }
  .unofficial { font-size: .72rem; }
  .context { gap: .35rem .4rem; }
  .ctx-item, .save-chip { font-size: .75rem; padding: .1rem .5rem; }
  .page-header .actions, .page-header > div:last-child { width: 100%; }
}

/* Schema 9 screens: notes, ledgers, returns shell */
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; background: var(--blue-50); padding: .5rem; border-radius: 4px; }
.card.unsupported { border-style: dashed; background: #f6f7f9; }
.card.unsupported h2 { color: var(--muted); }
.num-off { font-variant-numeric: tabular-nums; color: var(--muted); border-top: 1px dashed var(--line); padding-top: .4rem; margin-bottom: 0; }
form.form fieldset { border: 1px solid var(--line); border-radius: 6px; margin: .8rem 0; padding: .5rem .8rem; }
form.form fieldset legend { padding: 0 .4rem; font-weight: 600; }
form.form fieldset label.inline { display: flex; align-items: center; gap: .4rem; margin: .3rem 0; font-weight: 400; }

/* Returns dashboard (2026-11-16): File Returns step and one tile per form, after the structure of the official Returns Dashboard */
.section-title { margin: 1.4rem 0 .6rem; font-size: 1.15rem; color: var(--blue-900); }
.req { color: #b3261e; font-weight: 700; }
.tile { padding-top: 0; overflow: hidden; }
.tile-head { background: var(--blue-900); color: #fff; margin: 0 -1rem .8rem; padding: .7rem 1rem; text-align: center; }
.tile-head h3 { margin: 0; font-size: 1rem; color: #fff; }
.tile-code { margin: .2rem 0 0; font-size: .85rem; color: #cfe0ff; }
.tile-status { margin: .2rem 0 .6rem; font-weight: 600; }
.tile .actions { margin-top: .6rem; }

/* Breadcrumbs (2026-11-16) */
.breadcrumb { margin: 0 0 .8rem; font-size: .85rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem .35rem; align-items: center; }
.breadcrumb li + li::before { content: "›"; color: var(--muted); margin-right: .35rem; }
.breadcrumb a { color: var(--blue-600); }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Table 12 tabs (B2B / B2C) and mandatory-field legend */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: .5rem 0 .75rem; flex-wrap: wrap; }
.tab { background: var(--blue-50); color: var(--blue-900); border: 1px solid var(--line); border-bottom: 0; border-radius: 4px 4px 0 0; padding: .5rem .9rem; font: inherit; cursor: pointer; min-height: 2.5rem; }
.tab[aria-selected="true"] { background: #fff; font-weight: 700; border-bottom: 3px solid var(--blue-600); margin-bottom: -2px; }
[role="tabpanel"][hidden] { display: none; }

/* Main navigation: horizontal bar with a Services menu on wide screens (the drawer below 800px is unchanged, Services always expanded) */
.services-btn { display: none; }
@media (min-width: 801px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidenav { padding: 0 1rem; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
  .sidenav > ul { display: flex; flex-wrap: wrap; align-items: stretch; }
  .sidenav a, .services-btn { display: block; padding: .8rem 1rem; border-left: 0; border-bottom: 4px solid transparent; }
  .sidenav a.active, .services-btn.active { border-left-color: transparent; border-bottom-color: var(--blue-600); }
  .services { position: relative; }
  .services-btn { display: block; background: transparent; border: 0; border-bottom: 4px solid transparent; font: inherit; color: var(--ink); cursor: pointer; min-height: 2.75rem; }
  .services-btn:hover, .services-btn[aria-expanded="true"] { background: var(--blue-50); }
  .services-btn.active { background: var(--blue-100); color: var(--blue-900); font-weight: 600; }
  .submenu { display: none; position: absolute; top: 100%; left: 0; z-index: 30; min-width: 15rem; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
  .submenu.open { display: block; }
  .submenu a { border-bottom: 0; border-left: 4px solid transparent; }
  .submenu a.active { border-left-color: var(--blue-600); }
}
@media (max-width: 800px) {
  .services-btn { display: none; }
  .submenu { display: block; padding-left: .5rem; }
}
