/* couponkhassm.com — the coupon-and-ledger design, built on the logo's orange and navy.
   Mobile first: every rule outside a min-width query is the phone layout. */

:root {
  color-scheme: light dark;
  --paper: #fffaf3;
  --paper-2: #fdf0df;
  --card: #ffffff;
  --ink: #0b1740;
  --ink-2: #3a4566;
  --ink-3: #68718c;
  --rule: #ecdac1;
  --rule-2: #f6eadb;
  --brand: #fc6c04;
  --brand-2: #ff8f2e;
  --brand-ink: #a84300;
  --brand-bg: #fff0e0;
  --navy: #04143c;
  --link: #17408a;
  --stamp: #1d4f91;
  --stamp-bg: #e6edf8;
  --credit: #0f6b4c;
  --credit-bg: #e2f1e9;
  --fee: #a3301e;
  --fee-bg: #f9e7e2;
  --amber: #7d5200;
  --mark: #ffe3bd;
  --m-sa: #1f7a57;
  --m-ae: #2b5a9c;
  --m-eg: #a8571f;
  --m-kw: #00796b;
  --m-qa: #8a1538;
  --m-om: #6a3d9a;
  --m-bh: #b32c64;
  --btn-bg: #04143c;
  --btn-ink: #ffffff;
  --btn-hover-bg: #fc6c04;
  --btn-hover-ink: #04143c;
  --foot-bg: #04143c;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(11, 23, 64, 0.04), 0 14px 30px -18px rgba(11, 23, 64, 0.3);
  --shadow-lift: 0 2px 0 rgba(11, 23, 64, 0.05), 0 22px 40px -20px rgba(11, 23, 64, 0.42);
  --ticket-shadow: drop-shadow(0 10px 12px rgba(11, 23, 64, 0.16));
  --font: "Segoe UI", -apple-system, "SF Pro Text", "Noto Sans Arabic", "Noto Sans", Tahoma, "Geeza Pro", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1026;
    --paper-2: #111a36;
    --card: #152042;
    --ink: #f4f0e6;
    --ink-2: #c9cfe3;
    --ink-3: #9aa3c0;
    --rule: #2a3763;
    --rule-2: #1f2a50;
    --brand: #ff7f1f;
    --brand-2: #ff9d4d;
    --brand-ink: #ffb574;
    --brand-bg: #3a2512;
    --link: #a9c4f5;
    --stamp: #9dbcf3;
    --stamp-bg: #1a2a52;
    --credit: #74d3aa;
    --credit-bg: #123329;
    --fee: #f5a493;
    --fee-bg: #40201a;
    --amber: #e8bd66;
    --mark: #5a3d14;
    --btn-bg: #ff7f1f;
    --btn-ink: #04143c;
    --btn-hover-bg: #ffffff;
    --btn-hover-ink: #04143c;
    --foot-bg: #060b1d;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 30px -18px rgba(0, 0, 0, 0.75);
    --shadow-lift: 0 2px 0 rgba(0, 0, 0, 0.35), 0 22px 40px -20px rgba(0, 0, 0, 0.85);
    --ticket-shadow: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.45));
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.75;
  overflow-wrap: break-word;
}

html[lang="en"] body {
  line-height: 1.65;
}

::selection {
  background: var(--mark);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration-color: var(--brand);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.09em;
}

a:hover {
  color: var(--brand-ink);
  text-decoration-thickness: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -5rem;
  z-index: 60;
  background: var(--navy);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
}

.skip:focus {
  top: 0.5rem;
}

.offscreen {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.wrap {
  width: min(100% - 2rem, 80rem);
  margin-inline: auto;
}

/* ---------- masthead ---------- */

.mast {
  position: relative;
  z-index: 40;
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}

.mast::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, #ffb85c);
}

.mast-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-end: auto;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  min-height: 2.75rem;
}

.brand picture {
  display: block;
}

.brand-logo,
.brand-icon {
  display: block;
  width: auto;
  height: 2.1rem;
}

.nav-wide {
  display: none;
}

.nav-narrow > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.3rem 0.95rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  user-select: none;
}

.nav-narrow > summary::-webkit-details-marker {
  display: none;
}

.nav-narrow[open] > summary {
  border-color: var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-ink);
}

.nav-narrow nav {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 30;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding: 0.25rem 1rem 0.9rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-narrow .nav-list a {
  display: block;
  padding: 0.75rem 0.25rem;
  border-bottom: 1px dotted var(--rule);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.nav-list a[aria-current] {
  color: var(--brand-ink);
}

.lang {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.3rem 0.85rem;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.lang:hover {
  border-color: var(--brand);
  color: var(--brand-ink);
}

@media (min-width: 48rem) {
  .brand-logo {
    height: 2.6rem;
  }

  .brand-icon {
    height: 2.4rem;
  }
}

@media (min-width: 62rem) {
  html {
    scroll-padding-top: 5.6rem;
  }

  .mast {
    position: sticky;
    top: 0;
  }

  .nav-narrow {
    display: none;
  }

  .nav-wide {
    display: block;
  }

  .nav-wide .nav-list {
    display: flex;
    gap: 0.15rem;
  }

  .nav-wide .nav-list a {
    display: block;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
  }

  .nav-wide .nav-list a:hover {
    background: var(--brand-bg);
    color: var(--brand-ink);
  }

  .nav-wide .nav-list a[aria-current] {
    background: var(--btn-bg);
    color: var(--btn-ink);
  }
}

/* ---------- page head: a band across the whole page ---------- */

.sheet-head {
  position: relative;
  overflow: hidden;
  border-bottom: 2px dashed var(--rule);
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
}

.sheet-head::before,
.sheet-head::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.sheet-head::before {
  inset-block-start: -9rem;
  inset-inline-end: -5rem;
  width: 22rem;
  height: 22rem;
  background: radial-gradient(closest-side, rgba(252, 108, 4, 0.2), rgba(252, 108, 4, 0));
}

.sheet-head::after {
  inset-block-end: -7rem;
  inset-inline-start: -4rem;
  width: 14rem;
  height: 14rem;
  background: radial-gradient(closest-side, rgba(29, 79, 145, 0.12), rgba(29, 79, 145, 0));
}

.sheet-head-in {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.15rem 1.1rem;
}

.sheet-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.hero-art {
  display: none;
}

.sheet-in {
  padding-block: 1.4rem 3rem;
}

.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  margin: 0 0 0.6rem;
  padding: 0;
  color: var(--ink-3);
  font-size: 0.84rem;
}

.crumbs a {
  color: var(--ink-2);
}

.crumbs li + li::before {
  margin-inline-end: 0.45rem;
  color: var(--brand);
  font-weight: 800;
}

[dir="rtl"] .crumbs li + li::before {
  content: "\2039";
}

[dir="ltr"] .crumbs li + li::before {
  content: "\203A";
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.45rem;
  padding: 0.1rem 0.8rem;
  border-radius: 999px;
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-size: 0.8rem;
  font-weight: 800;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.55rem, 5.4vw, 2.4rem);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* The logo's underline, under every page title. */
h1::after {
  content: "";
  display: block;
  width: min(13rem, 62%);
  height: 0.72rem;
  margin-top: 0.4rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 22' preserveAspectRatio='none'%3E%3Cpath d='M2 20C70 5 160 -1 233 5c7 1 7 9 0 9C160 6 70 11 2 20z' fill='%23fc6c04'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

[dir="ltr"] h1::after {
  transform: scaleX(-1);
}

[data-page="home"] h1 {
  font-size: clamp(1.8rem, 6.6vw, 3.1rem);
  line-height: 1.22;
}

h2 {
  margin: 2.6rem 0 0.9rem;
  font-size: clamp(1.25rem, 3.8vw, 1.65rem);
  line-height: 1.38;
  font-weight: 800;
  text-wrap: balance;
}

/* A small orange diamond marks each section of a page. */
.sheet-main > h2 {
  position: relative;
  padding-inline-start: 1.25rem;
}

.sheet-main > h2::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.1rem;
  top: 0.62em;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 2px;
  background: var(--brand);
  transform: rotate(45deg);
}

h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1.45;
  font-weight: 800;
}

p {
  margin: 0 0 1rem;
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  margin: 0;
  color: var(--ink-3);
  font-size: 0.83rem;
}

.sheet-meta .tag {
  margin-inline-start: 0.15rem;
}

.sheet-meta .obs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
}

.sheet-meta .audit a {
  color: inherit;
}

.nowrap {
  white-space: nowrap;
}

.lead {
  color: var(--ink-2);
  font-size: 1.1rem;
}

.fine {
  color: var(--ink-2);
  font-size: 0.92rem;
}

.muted {
  color: var(--ink-3);
}

.more {
  font-weight: 700;
}

.sheet-main {
  min-width: 0;
}

.sheet-main > :first-child {
  margin-top: 0;
}

/* Every block fills the column it sits in. On a wide screen long lists, pairs, questions and
   forms break into columns, so the width is used without one line running across the page. */
.sheet-main > p {
  text-wrap: pretty;
}

@media (min-width: 62rem) {
  .sheet-main > ul.list:not(.formula):not(.chips),
  .market > ul.list,
  .qa > ul.list,
  .note > ul {
    columns: 27rem auto;
    column-gap: 2.6rem;
  }

  .sheet-main > ul.list > li,
  .market > ul.list > li,
  .qa > ul.list > li,
  .note > ul > li {
    break-inside: avoid;
  }

  .sheet-main > .pairs,
  .sheet-main > .formula {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  }

  .sheet-main > .pairs > div,
  .sheet-main > .pairs > div:last-child {
    border-bottom: 1px dotted var(--rule);
    border-inline-end: 1px dotted var(--rule);
  }

  .sheet-main > .formula {
    gap: 0.8rem;
  }

  .sheet-main > .formula > li {
    margin: 0;
  }

  .faq {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 27rem), 1fr));
    column-gap: 2.2rem;
  }

  /* A ticket beside its terms; the text that follows runs the full width under the two, so
     neither a narrow stack nor an empty column is left. */
  .stack:has(> .ticket) {
    display: grid;
    grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
    column-gap: 1.8rem;
    align-items: start;
  }

  .stack:has(> .ticket) > * {
    grid-column: 1 / -1;
  }

  .stack:has(> .ticket) > .ticket {
    grid-column: 1;
  }

  /* The terms take the ticket's height and share it between their rows. */
  .stack:has(> .ticket) > .pairs {
    display: grid;
    grid-auto-rows: 1fr;
    grid-column: 2;
    align-self: stretch;
  }

  .stack:has(> .ticket) > .pairs > div {
    align-items: center;
  }

  /* Two tickets sit side by side, and their terms run under them in one row. */
  .stack:has(> .ticket-minor) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stack:has(> .ticket-minor) > .ticket-minor {
    grid-column: 2;
  }

  .stack:has(> .ticket-minor) > .pairs {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    grid-column: 1 / -1;
  }
}

.split {
  display: grid;
  gap: 1.1rem;
  margin: 0 0 1.25rem;
}

.split > * > :last-child {
  margin-bottom: 0;
}

@media (min-width: 62rem) {
  .split {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }
}

@media (min-width: 48rem) {
  .sheet-head-in {
    padding-block: 1.8rem 1.6rem;
  }

  .hero-art {
    display: block;
    flex: none;
    width: clamp(8.5rem, 17vw, 13rem);
    height: auto;
    margin-inline-end: clamp(0rem, 3vw, 3rem);
    transform: rotate(-5deg);
    filter: drop-shadow(0 18px 20px rgba(252, 108, 4, 0.3));
  }
}

@media (min-width: 48rem) and (prefers-reduced-motion: no-preference) {
  .hero-art {
    animation: ticket-bob 6s ease-in-out infinite;
  }

  @keyframes ticket-bob {
    50% {
      transform: translateY(-7px) rotate(-8deg);
    }
  }
}

/* ---------- Executive Brief ---------- */

.memo {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 1.05rem 1.1rem 1.15rem;
  border: 1px solid var(--rule);
  border-inline-start: 6px solid var(--brand);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.memo-title {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.08rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.memo-text {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.9;
}

html[lang="en"] .memo-text {
  line-height: 1.7;
}

.memo-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr));
  gap: 0.55rem;
  margin: 0.95rem 0 0;
  font-size: 0.9rem;
}

.memo-facts div {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  background: var(--paper-2);
}

.memo-facts dt {
  color: var(--ink-3);
  font-size: 0.8rem;
}

.memo-facts dd {
  margin: 0;
  font-weight: 800;
}

@media (min-width: 62rem) {
  .memo {
    padding: 1.3rem 1.5rem 1.4rem;
  }

  .memo:has(.memo-facts) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15.5rem;
    column-gap: 1.8rem;
    align-items: start;
  }

  .memo:has(.memo-facts) .memo-title {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .memo:has(.memo-facts) .memo-facts {
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
  }
}

/* ---------- inline pieces ---------- */

.ref {
  margin-inline-start: 0.14em;
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
}

.ref a {
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: var(--stamp-bg);
  color: var(--stamp);
  font-weight: 800;
  text-decoration: none;
}

code {
  padding: 0.06em 0.4em;
  border: 1px dashed var(--brand);
  border-radius: 6px;
  background: var(--brand-bg);
  font-family: var(--mono);
  font-size: 0.9em;
  font-weight: 700;
  overflow-wrap: anywhere;
}

pre.code {
  margin: 0 0 1.1rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: #04143c;
  color: #f4f0e6;
  font-size: 0.84rem;
  line-height: 1.6;
  text-align: left;
}

pre.code code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 400;
  white-space: pre;
  overflow-wrap: normal;
}

.tag {
  display: inline-block;
  padding: 0.02rem 0.65rem;
  border-radius: 999px;
  background: var(--ink-3);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.tag-sa {
  background: var(--m-sa);
}

.tag-ae {
  background: var(--m-ae);
}

.tag-eg {
  background: var(--m-eg);
}

.tag-kw {
  background: var(--m-kw);
}

.tag-qa {
  background: var(--m-qa);
}

.tag-om {
  background: var(--m-om);
}

.tag-bh {
  background: var(--m-bh);
}

/* ---------- lists and pairs ---------- */

.list {
  margin: 0 0 1rem;
  padding-inline-start: 1.25rem;
}

.list li {
  margin-bottom: 0.55rem;
}

.list li::marker {
  color: var(--brand);
  font-weight: 800;
}

.formula,
.chips {
  list-style: none;
  padding: 0;
}

.formula li {
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--rule);
  border-inline-start: 4px solid var(--brand);
  border-radius: 10px;
  background: var(--card);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips li {
  margin: 0;
  padding: 0.15rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.9rem;
}

.pairs {
  margin: 0 0 1rem;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}

.pairs > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px dotted var(--rule);
}

.pairs > div:last-child {
  border-bottom: 0;
}

.pairs dt {
  color: var(--ink-2);
  font-size: 0.93rem;
}

.pairs dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.pairs-wide > div {
  flex-direction: column;
  gap: 0.15rem;
}

.pairs-wide dt {
  color: var(--ink);
  font-weight: 800;
}

.pairs-wide dd {
  font-weight: 400;
  text-align: start;
}

/* ---------- ledger tables: cards on a phone, a table from 48rem ---------- */

.ledger-wrap {
  margin: 0 0 1.25rem;
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.ledger caption {
  margin-bottom: 0.5rem;
  font-weight: 700;
  text-align: start;
}

.ledger thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ledger tbody,
.ledger tr {
  display: block;
}

.ledger tr {
  margin-bottom: 0.7rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}

.ledger th[scope="row"],
.ledger td {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--rule);
  font-weight: 400;
  text-align: end;
}

.ledger tr > :last-child {
  border-bottom: 0;
}

.ledger th[scope="row"]::before,
.ledger td::before {
  content: attr(data-label);
  flex: 0 0 44%;
  color: var(--ink-3);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: start;
}

.ledger th[scope="row"] {
  font-weight: 800;
}

.ledger-sources th[scope="row"],
.ledger-sources td,
.ledger-log th[scope="row"],
.ledger-log td,
.ledger-compare th[scope="row"],
.ledger-compare td {
  flex-direction: column;
  gap: 0.1rem;
  text-align: start;
}

.ledger-sources th[scope="row"]::before,
.ledger-sources td::before,
.ledger-log th[scope="row"]::before,
.ledger-log td::before,
.ledger-compare th[scope="row"]::before,
.ledger-compare td::before {
  flex: none;
}

.ledger-compare th[scope="row"]::before {
  content: none;
}

.ledger a {
  overflow-wrap: anywhere;
}

/* The code and its copy button stay on one line in the register. */
.ledger-codes th[scope="row"] {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (min-width: 48rem) {
  .ledger {
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card);
    box-shadow: var(--shadow);
  }

  .ledger thead {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    white-space: normal;
  }

  .ledger thead,
  .ledger tbody {
    display: table-row-group;
  }

  .ledger thead {
    display: table-header-group;
  }

  .ledger tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .ledger th,
  .ledger td,
  .ledger th[scope="row"] {
    display: table-cell;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--rule-2);
    text-align: start;
    vertical-align: middle;
  }

  .ledger tbody tr:last-child > * {
    border-bottom: 0;
  }

  .ledger tbody tr:hover > * {
    background: var(--brand-bg);
  }

  .ledger th[scope="row"]::before,
  .ledger td::before {
    content: none;
  }

  .ledger thead th {
    border-bottom: 2px solid var(--brand);
    background: var(--paper-2);
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 800;
  }

  .ledger-num td,
  .ledger-terms td {
    font-variant-numeric: tabular-nums;
  }

  .ledger-codes th[scope="row"],
  .ledger-codes td:nth-child(n + 3) {
    white-space: nowrap;
  }

  .ledger-codes th[scope="row"] {
    width: 1%;
  }

  .ledger-sources td,
  .ledger-log td,
  .ledger-compare td,
  .ledger-sources th[scope="row"],
  .ledger-log th[scope="row"],
  .ledger-compare th[scope="row"] {
    vertical-align: top;
  }
}

/* ---------- notes ---------- */

.note {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 0.97rem;
}

.note > :last-child {
  margin-bottom: 0;
}

.note ul {
  margin: 0;
  padding-inline-start: 1.1rem;
}

.note li {
  margin-bottom: 0.35rem;
}

.note-title {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  font-weight: 800;
}

.note-unstated {
  border-style: dashed;
  border-color: var(--ink-3);
}

.note-unstated .note-title {
  color: var(--fee);
}

.note-scope {
  border-inline-start: 4px solid var(--credit);
}

.note-scope .note-title {
  color: var(--credit);
}

.note-info {
  background: var(--paper-2);
}

/* ---------- code ticket: a coupon in two parts joined by a perforation ---------- */

.ticket {
  --notch: 0.7rem;
  margin: 0 0 1rem;
  filter: var(--ticket-shadow);
}

.ticket-main,
.ticket-side {
  /* Each part is cut at the corners it shares with the other, which makes the two notches. */
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 51% 100%;
  mask-size: 51% 100%;
  -webkit-mask-position: left, right;
  mask-position: left, right;
}

.ticket-main {
  position: relative;
  display: grid;
  gap: 0.5rem;
  overflow: hidden;
  padding: 0.95rem 1.1rem 1.15rem;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, #ff9a3d, #fc6c04 62%);
  color: #04143c;
  -webkit-mask-image: radial-gradient(circle var(--notch) at 0 100%, transparent 97%, #000), radial-gradient(circle var(--notch) at 100% 100%, transparent 97%, #000);
  mask-image: radial-gradient(circle var(--notch) at 0 100%, transparent 97%, #000), radial-gradient(circle var(--notch) at 100% 100%, transparent 97%, #000);
}

/* The percent sign of the logo, faint, behind the code. */
.ticket-main::after {
  content: "%";
  position: absolute;
  inset-inline-end: 0.2rem;
  top: -1.1rem;
  color: rgba(255, 255, 255, 0.2);
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-14deg);
  pointer-events: none;
}

.ticket-label {
  position: relative;
  z-index: 1;
  color: #04143c;
  font-size: 0.82rem;
  font-weight: 800;
}

.ticket-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
}

.ticket-code {
  padding: 0.12rem 0.75rem;
  border: 2px dashed rgba(4, 20, 60, 0.55);
  border-radius: 12px;
  background: #fff;
  color: #04143c;
  font-size: clamp(1.5rem, 7.5vw, 2.05rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.ticket .btn-copy {
  border-color: #04143c;
  background: #04143c;
  color: #fff;
}

.ticket .btn-copy:hover {
  border-color: #fff;
  background: #fff;
  color: #04143c;
}

.ticket-side {
  display: grid;
  gap: 0.6rem;
  padding: 0.95rem 1.1rem 1rem;
  border-top: 2px dashed var(--brand);
  border-radius: 0 0 16px 16px;
  background: var(--brand-bg);
  -webkit-mask-image: radial-gradient(circle var(--notch) at 0 0, transparent 97%, #000), radial-gradient(circle var(--notch) at 100% 0, transparent 97%, #000);
  mask-image: radial-gradient(circle var(--notch) at 0 0, transparent 97%, #000), radial-gradient(circle var(--notch) at 100% 0, transparent 97%, #000);
}

.ticket-meta {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.88rem;
}

.ticket-meta div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
}

.ticket-meta dt {
  color: var(--ink-3);
}

.ticket-meta dd {
  margin: 0;
  font-weight: 700;
}

/* The secondary code: the same coupon, quieter. */
.ticket-minor .ticket-main {
  padding-block: 0.8rem 0.95rem;
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--brand);
}

.ticket-minor .ticket-main::after {
  content: none;
}

.ticket-minor .ticket-label {
  color: var(--brand-ink);
}

.ticket-minor .ticket-code {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--ink);
  font-size: 1.45rem;
}

.ticket-minor .btn-copy {
  border-color: var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-ink);
}

.ticket-minor .btn-copy:hover {
  border-color: var(--btn-hover-bg);
  background: var(--btn-hover-bg);
  color: var(--btn-hover-ink);
}

.stamp {
  display: inline-block;
  justify-self: start;
  padding: 0.05rem 0.7rem;
  border: 2px solid currentColor;
  border-radius: 6px;
  outline: 1px solid currentColor;
  outline-offset: 2px;
  color: var(--credit);
  font-size: 0.85rem;
  font-weight: 800;
  transform: rotate(-2.5deg);
}

.stamp-conditional {
  color: var(--amber);
}

.stamp-suspended,
.stamp-expired {
  color: var(--fee);
}

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

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.2rem;
  border: 2px solid var(--btn-bg);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--btn-hover-bg);
  background: var(--btn-hover-bg);
  color: var(--btn-hover-ink);
}

.btn-ghost {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--ink);
}

.btn-copy {
  min-height: 2.6rem;
  padding: 0.3rem 1rem;
  font-size: 0.86rem;
}

/* Two overlapping sheets: the copy sign, drawn with the button's own colour. */
.btn-copy::before {
  content: "";
  flex: none;
  width: 0.95em;
  height: 0.95em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 1h8a2 2 0 0 1 2 2v8h-2V3H5z'/%3E%3Crect x='1' y='5' width='10' height='10' rx='2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 1h8a2 2 0 0 1 2 2v8h-2V3H5z'/%3E%3Crect x='1' y='5' width='10' height='10' rx='2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.btn-copy.done,
.ticket .btn-copy.done {
  border-color: var(--credit);
  background: var(--credit);
  color: #fff;
}

.btn-mini {
  min-height: 2.2rem;
  margin-inline-start: 0.5rem;
  padding: 0.1rem 0.75rem;
  border: 1.5px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  font-size: 0.78rem;
}

.btn-mini:hover {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--ink);
}

/* ---------- countries ---------- */

.markets {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.market {
  min-width: 0;
  overflow: hidden;
  padding: 0 1rem 1.05rem;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.market > :last-child {
  margin-bottom: 0;
}

.market-sa {
  --m: var(--m-sa);
}

.market-ae {
  --m: var(--m-ae);
}

.market-eg {
  --m: var(--m-eg);
}

.market-kw {
  --m: var(--m-kw);
}

.market-qa {
  --m: var(--m-qa);
}

.market-om {
  --m: var(--m-om);
}

.market-bh {
  --m: var(--m-bh);
}

.market-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 -1rem 0.95rem;
  padding: 0.6rem 1rem;
  border-top: 5px solid var(--m, var(--rule));
  border-bottom: 1px solid var(--rule-2);
  background: var(--paper-2);
  font-size: 1rem;
}

.market-name .tag {
  padding: 0.12rem 0.85rem;
  font-size: 0.86rem;
}

.market .note,
.market .pairs {
  box-shadow: none;
}

.market .pairs {
  border: 0;
  border-radius: 0;
  background: none;
}

.market .pairs > div {
  padding-inline: 0;
}

@media (min-width: 62rem) {
  .markets-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 1.25rem;
  }
}

html[data-lens="sa"] [data-cc]:not([data-cc~="sa"]),
html[data-lens="ae"] [data-cc]:not([data-cc~="ae"]),
html[data-lens="eg"] [data-cc]:not([data-cc~="eg"]),
html[data-lens="kw"] [data-cc]:not([data-cc~="kw"]),
html[data-lens="qa"] [data-cc]:not([data-cc~="qa"]),
html[data-lens="om"] [data-cc]:not([data-cc~="om"]),
html[data-lens="bh"] [data-cc]:not([data-cc~="bh"]) {
  /* The visitor's own choice of country: no layout rule may bring a hidden country back. */
  display: none !important;
}

html[data-lens] .markets-cols {
  grid-template-columns: minmax(0, 1fr);
}

/* With one country chosen, its card takes the whole row: the ticket on one side and what
   explains it packed beside it. The ticket spans many rows so that its height is not handed to
   the rows beside it as gaps. */
@media (min-width: 62rem) {
  html[data-lens] .markets-cols > .market:has(> .ticket) {
    display: grid;
    grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
    column-gap: 1.8rem;
    align-items: start;
  }

  html[data-lens] .markets-cols > .market:has(> .ticket) > * {
    grid-column: 2;
  }

  html[data-lens] .markets-cols > .market:has(> .ticket) > .market-name {
    grid-column: 1 / -1;
  }

  html[data-lens] .markets-cols > .market:has(> .ticket) > .ticket {
    grid-column: 1;
    grid-row: 2 / span 12;
  }

  /* Two tickets sit side by side, and what explains them runs under them. */
  html[data-lens] .markets-cols > .market:has(> .ticket-minor) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-lens] .markets-cols > .market:has(> .ticket-minor) > * {
    grid-column: 1 / -1;
  }

  html[data-lens] .markets-cols > .market:has(> .ticket-minor) > .ticket {
    grid-column: 1;
    grid-row: auto;
  }

  html[data-lens] .markets-cols > .market:has(> .ticket-minor) > .ticket-minor {
    grid-column: 2;
  }

  html[data-lens] .markets-cols > .market > .pairs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    column-gap: 2.2rem;
  }
}

/* With one country chosen, a card that only carries a rule trades its country band for a small
   tag: the chosen country is already named in the bar above. */
html[data-lens] .markets-cols > .market:not(:has(> .ticket)) {
  border-top: 5px solid var(--m, var(--rule));
}

html[data-lens] .markets-cols > .market:not(:has(> .ticket)) > .market-name {
  margin: 0 0 0.3rem;
  padding: 0.7rem 0 0;
  border: 0;
  background: none;
}

/* The comparison's items. Each one is a heading over its countries' cards. */
.aspect > .markets {
  margin-bottom: 0;
}

.aspects {
  margin: 0 0 1.25rem;
}

/* With one country chosen an item is a single short card, so the items sit side by side and
   each row's cards share one height; the page is half as long and no row is left half empty. */
@media (min-width: 62rem) {
  html[data-lens] .aspects {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
  }

  html[data-lens] .aspect {
    display: flex;
    flex-direction: column;
  }

  html[data-lens] .aspect > .markets {
    flex: 1 1 auto;
    align-items: stretch;
  }
}

.lens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.9rem;
}

.lens-label {
  margin-inline: 0.45rem 0.2rem;
  font-weight: 800;
}

.lens-btn {
  appearance: none;
  min-height: 2.5rem;
  padding: 0.25rem 0.95rem;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.lens-btn:hover {
  border-color: var(--brand);
}

.lens-btn[aria-pressed="true"] {
  border-color: var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-ink);
}

@media (max-width: 30rem) {
  .lens {
    border-radius: var(--radius);
  }
}

/* ---------- cards ---------- */

/* Cards wrap in rows and every row is filled: the cards of a short last row widen instead of
   leaving empty cells beside them. */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex: 1 1 16rem;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.card-title {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.5;
  text-decoration: none;
}

.card:hover .card-title {
  color: var(--brand-ink);
}

.card-title::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.card-tag {
  align-self: flex-start;
}

.card-tag code {
  font-weight: 800;
}

.cards-dept .card {
  flex-basis: 14rem;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

/* Six in a list would wrap as five and one; three and three reads better. */
@media (min-width: 62rem) {
  .cards-dept:has(> :nth-child(6):last-child) > .card {
    flex-basis: 30%;
  }
}

/* ---------- the departments directory ---------- */

.families {
  margin: 0 0 1.25rem;
}

.family {
  overflow: hidden;
  margin: 0 0 1rem;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  break-inside: avoid;
}

.family > h3 {
  margin: 0;
  padding: 0.6rem 1rem;
  border-top: 5px solid var(--brand);
  border-bottom: 1px solid var(--rule-2);
  background: var(--paper-2);
  font-size: 1rem;
}

.family > .cards {
  display: block;
  margin: 0;
}

.family > .cards > .card {
  padding: 0.55rem 1rem;
  border: 0;
  border-bottom: 1px dotted var(--rule);
  border-radius: 0;
  background: none;
}

.family > .cards > .card:last-child {
  border-bottom: 0;
}

.family > .cards > .card:hover {
  background: var(--brand-bg);
  box-shadow: none;
  transform: none;
}

.family .card-title::after {
  border-radius: 0;
}

@media (min-width: 40rem) {
  .families {
    columns: 2;
    column-gap: 1.1rem;
  }
}

@media (min-width: 62rem) {
  .families {
    columns: 3;
    column-gap: 1.25rem;
  }
}

.cards-dept .card-tag {
  align-self: center;
  flex: none;
}

.cards-tools .card,
.cards-guides .card {
  padding-block: 1rem;
  border-top: 4px solid var(--brand);
}

.cards-links .card {
  padding: 0.6rem 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

/* ---------- on-this-page ---------- */

.toc {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.toc-title {
  margin: 0 0 0.4rem;
  color: var(--ink-3);
  font-size: 0.8rem;
  font-weight: 800;
}

.toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.15rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  text-decoration: none;
}

@media (min-width: 72rem) {
  .has-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 2.5rem;
    align-items: start;
  }

  .has-toc .toc {
    position: sticky;
    top: 5.6rem;
    order: 2;
    max-height: calc(100vh - 6.6rem);
    overflow: auto;
    padding: 0.9rem 1rem 0.8rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--card);
  }

  .toc ul {
    flex-direction: column;
    gap: 0;
  }

  .toc a {
    display: block;
    min-height: 0;
    padding: 0.3rem 0.6rem;
    border: 0;
    border-inline-start: 2px solid var(--rule-2);
    border-radius: 0;
    background: none;
  }

  .toc a:hover {
    border-color: var(--brand);
    color: var(--ink);
  }
}

/* ---------- Source Authority ---------- */

.sources {
  margin-top: 3rem;
  padding: 1.1rem 1.1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.sources h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.sources-lead {
  color: var(--ink-2);
  font-size: 0.9rem;
}

.src-list {
  margin: 0;
  padding-inline-start: 1.7rem;
  font-size: 0.9rem;
}

.src-list li {
  margin-bottom: 0.6rem;
  padding-inline-start: 0.2rem;
  break-inside: avoid;
}

@media (min-width: 62rem) {
  .src-list {
    columns: 26rem auto;
    column-gap: 3rem;
  }
}

.src-list li:target {
  outline: 5px solid var(--mark);
  border-radius: 4px;
  background: var(--mark);
}

.src-list a {
  overflow-wrap: anywhere;
}

.src-meta {
  display: block;
  color: var(--ink-3);
  font-size: 0.84rem;
}

/* ---------- questions ---------- */

.qa {
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule-2);
}

.qa h3 {
  margin-top: 1rem;
}

/* ---------- figures ---------- */

.chart {
  margin: 0 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}

.chart figcaption {
  margin-top: 0.5rem;
  color: var(--ink-2);
  font-size: 0.9rem;
}

/* ---------- tools ---------- */

.tool {
  display: grid;
  gap: 0.95rem;
  margin: 0 0 1.5rem;
  padding: 1.1rem;
  border: 1px solid var(--rule);
  border-top: 5px solid var(--brand);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.field label,
.seg legend {
  font-size: 0.93rem;
  font-weight: 800;
}

.field input[type="text"],
.field input[type="search"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-height: 2.9rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--ink-3);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
}

html[dir="rtl"] .field input[dir="ltr"] {
  text-align: right;
}

.hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.83rem;
}

.field-check label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font-weight: 700;
  cursor: pointer;
}

.field-check input {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  accent-color: var(--brand);
}

.seg {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.seg legend {
  margin-bottom: 0.35rem;
  padding: 0;
}

.seg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.seg-opt {
  position: relative;
  flex: 1 1 auto;
}

.seg-opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.seg-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.3rem 0.9rem;
  border: 1.5px solid var(--ink-3);
  border-radius: 10px;
  background: var(--paper);
  font-size: 0.93rem;
  font-weight: 700;
  text-align: center;
}

.seg-opt input:checked + span {
  border-color: var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-ink);
}

.seg-opt input:focus-visible + span {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.more > summary {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 0.93rem;
  font-weight: 800;
  cursor: pointer;
}

details.more[open] {
  display: grid;
  gap: 0.8rem;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* On a wide screen a form's fields sit two abreast; its buttons and result take the full row. */
@media (min-width: 62rem) {
  .tool {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.3rem;
    align-items: start;
  }

  .tool > .tool-actions,
  .tool > .receipt,
  .tool > details,
  .tool > .field-check,
  .tool > .field:has(textarea) {
    grid-column: 1 / -1;
  }

  .split .tool {
    grid-template-columns: minmax(0, 1fr);
  }
}

.filter {
  margin-bottom: 0.9rem;
}

.receipt {
  padding: 0.9rem 1rem;
  border: 2px dashed var(--brand);
  border-radius: 14px;
  background: var(--paper);
  font-size: 0.97rem;
}

.receipt > :last-child {
  margin-bottom: 0;
}

.receipt-title {
  margin: 0 0 0.5rem;
  font-weight: 800;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--rule);
}

.receipt-line > :last-child {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.receipt-total {
  margin-top: 0.35rem;
  padding-top: 0.6rem;
  border-top: 3px double var(--ink);
  border-bottom: 0;
  font-size: 1.07rem;
  font-weight: 800;
}

.receipt .plus {
  color: var(--fee);
}

.receipt .minus {
  color: var(--credit);
}

.receipt-note {
  margin: 0.6rem 0 0;
  color: var(--ink-2);
  font-size: 0.87rem;
}

.receipt-flag {
  margin: 0.5rem 0 0;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: var(--fee-bg);
  color: var(--fee);
  font-size: 0.9rem;
}

.receipt h4 {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.9rem;
}

.receipt ul {
  margin: 0.3rem 0 0.4rem;
  padding-inline-start: 1.1rem;
  font-size: 0.93rem;
}

.receipt li {
  margin-bottom: 0.4rem;
}

.verdict {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--stamp-bg);
  color: var(--stamp);
  font-size: 1.03rem;
  font-weight: 800;
}

.verdict-bad {
  background: var(--fee-bg);
  color: var(--fee);
}

.verdict-good {
  background: var(--credit-bg);
  color: var(--credit);
}

.clock {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.stack > :last-child {
  margin-bottom: 0;
}

/* ---------- footer: navy, like the logo's lettering ---------- */

.foot {
  margin-top: 1rem;
  padding: 0 0 2.2rem;
  background: var(--foot-bg);
  color: #d9dcea;
  font-size: 0.92rem;
}

.foot::before {
  content: "";
  display: block;
  height: 5px;
  margin-bottom: 2.2rem;
  background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, #ffb85c);
}

.foot-top {
  display: grid;
  gap: 1.6rem;
  margin-bottom: 1.6rem;
}

.foot-brand .brand {
  margin: 0 0 0.5rem;
  color: #fff;
}

.foot-brand .brand-logo,
.foot-brand .brand-icon {
  height: 2.5rem;
}

.foot-brand p {
  max-width: 24rem;
  margin: 0;
  color: #aeb5cf;
  font-size: 0.9rem;
}

.foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 1.4rem;
}

.foot h2 {
  margin: 0 0 0.45rem;
  color: #ffb574;
  font-size: 0.84rem;
}

.foot ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot a {
  color: #fff;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

.foot a:hover {
  color: #ffb574;
  text-decoration-color: currentColor;
}

.foot li a {
  display: inline-block;
  padding: 0.32rem 0;
}

.foot-note {
  max-width: 60rem;
  margin: 0 0 0.5rem;
  color: #aeb5cf;
  font-size: 0.85rem;
}

.foot-note:first-of-type {
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

@media (min-width: 62rem) {
  .foot-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 3rem;
  }
}

/* A short, wide window (a laptop at a large zoom): the page head gives its room to the content. */
@media (min-width: 62rem) and (max-height: 50rem) {
  .mast-row {
    min-height: 3.3rem;
  }

  .sheet-head-in {
    padding-block: 1rem 0.9rem;
  }

  h1 {
    margin-bottom: 0.5rem;
    font-size: clamp(1.5rem, 3.2vw, 2rem);
  }

  [data-page="home"] h1 {
    font-size: clamp(1.7rem, 3.8vw, 2.4rem);
  }

  .hero-art {
    width: clamp(6rem, 11vw, 8.5rem);
  }

  .sheet-in {
    padding-top: 1.1rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media print {
  .mast,
  .lens,
  .toc,
  .foot,
  .hero-art,
  .tool-actions,
  .btn-copy {
    display: none !important;
  }

  .sheet-head {
    background: none;
  }

  .ticket {
    filter: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
