/* Qsynapse Platform: the customer pages, in Medad's frame (the owner's redesign of 2026-11-03,
   docs/superpowers/specs/2026-11-03-friendly-customer-pages-design.md and its mockups).

   _app.html (signed in) and _public.html (sign-in, invitation, reset, errors) load the kit first
   (kit/fonts.css, kit/tokens.css, kit/components.css, copied unchanged from the website), then
   this file only. The staff console loads it too, then staff.css (its redesign of 2026-11-04).

   Served from 'self' only (CSP): no inline styles, no external fonts, no JavaScript. Menus and
   folds are <details>; bars, the seats meter and the balance ring are SVG sized by attributes.
   Logical properties throughout (margin-inline, inset-inline-start, text-align: start ...), so
   the Arabic pages (dir="rtl", the default) and the English ones share every rule; the only
   physical direction is the bars', which fill from the start side (section 6).

   WCAG AA, checked by tests/test_design_kit.py: the primary pill is white on the kit's
   --teal-text (5.0:1; white on --teal is 3.1:1); chips and notices darken green and amber as
   app.css does; input borders are #8a8a8a (3.4:1). */

:root {
  --primary: #087a8d; /* the kit's teal for small text: white text on it passes AA */
  --primary-hover: #066877;
  --ok-text: #1c7d45;
  --warn-text: #9d5e00;
  --warn-line: #f3d9a8;
  --risk-line: #f6cdc8;
  --ok-line: #c5e8d4;
  --field-line: #8a8a8a;
  --hover: #eceeef;
  --hairline: #f1f2f3;
  --side-w: 248px;
}

/* ---------- 1. The Arabic font, and the stacks per language ---------- */
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
[lang="ar"] {
  --font-head: "IBM Plex Sans Arabic", "Space Grotesk", "Inter Display", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Inter Display", "Inter", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-ui: "IBM Plex Sans Arabic", "Inter", "Inter Display", system-ui, "Segoe UI", Tahoma, sans-serif;
}
[lang="en"] {
  --font-head: "Space Grotesk", "Inter Display", "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-body: "Inter Display", "Inter", "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-ui: "Inter", "Inter Display", "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
}
/* Arabic letters join: no spaced-out or upper-cased labels; and its marks need taller lines. */
[dir="rtl"] :is(.eyebrow, .label, .box__label, .side__name small, .btn) {
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- 2. Base ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}
[dir="rtl"] body {
  line-height: 1.75;
}
p {
  margin: 0;
}
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-head);
  letter-spacing: 0;
}
.visually-hidden {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  background: var(--navy);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 500;
  text-decoration: none;
}
.skip-link:focus {
  inset-block-start: 12px;
}
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}
.muted {
  color: var(--ink-3);
}
.num {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
a {
  color: var(--teal-text);
}
.link {
  color: var(--teal-text);
  font-weight: 500;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
[dir="rtl"] .arrow {
  display: inline-block;
}

/* ---------- 3. Buttons, chips, notices, fields ---------- */
.btn {
  font-family: var(--font-ui);
}
.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}
.btn--small {
  padding: 6px 14px;
  font-size: 13px;
}
.btn--block {
  display: flex;
  inline-size: 100%;
  justify-content: center;
}
.btn--risk {
  color: var(--risk);
  border-color: var(--risk-line);
  background: var(--paper);
}
.btn--risk:hover {
  background: var(--risk-soft);
  color: var(--risk);
}
/* A menu's line: the look of a link in a list, still a real button (a POST form). */
.btn--menu {
  display: block;
  inline-size: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
}
.btn--menu:hover {
  background: var(--grey);
  transform: none;
  box-shadow: none;
}
.btn--menu.btn--risk {
  color: var(--risk);
}
.btn--menu.btn--risk:hover {
  background: var(--risk-soft);
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid #e3e3e3;
  background: var(--grey);
  color: var(--ink-2);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}
.chip--admin,
.chip--sent {
  background: var(--teal-soft);
  border-color: var(--teal-line);
  color: var(--teal-text);
}
.chip--off,
.chip--failed {
  background: var(--risk-soft);
  border-color: var(--risk-line);
  color: var(--risk);
}
.chip--wait,
.chip--running {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn-text);
}
.chip--done {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok-text);
}
.notice {
  margin: 0 0 16px;
  padding: 10px 16px;
  border: 1px solid var(--teal-line);
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-text);
  font-size: 14px;
}
.notice--ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok-text);
}
.notice--warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn-text);
}
.notice--risk {
  background: var(--risk-soft);
  border-color: var(--risk-line);
  color: var(--risk);
}
.notice a {
  color: inherit;
  font-weight: 600;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-block-end: 12px;
}
.form-field label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.input {
  inline-size: 100%;
  box-sizing: border-box;
  block-size: 42px;
  padding: 0 12px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.input[readonly] {
  background: var(--grey);
}
/* An address reads left to right, also on an Arabic page. */
:is(.input[type="email"], .input[type="password"]) {
  direction: ltr;
}
[dir="rtl"] :is(.input[type="email"], .input[type="password"]) {
  text-align: end;
}
.form-hint {
  margin-block-start: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}
/* A field the server sent back (_fields.html): a red edge, and its message under it. */
.input[aria-invalid="true"] {
  border-color: var(--risk);
  box-shadow: 0 0 0 3px var(--risk-soft);
}
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-block-start: 2px;
  color: var(--risk);
  font-size: 13px;
  font-weight: 500;
}
.field-error svg {
  flex: none;
}

/* ---------- 4. The signed-in frame: Medad's sidebar ---------- */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-block-size: 100vh;
}
.side {
  position: sticky;
  inset-block-start: 0;
  box-sizing: border-box;
  block-size: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px 12px;
  background: var(--grey);
  border-inline-end: 1px solid var(--line);
}
.side__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 14px;
  color: var(--ink);
  text-decoration: none;
}
.side__brand img {
  inline-size: 32px;
  block-size: 32px;
}
.side__name {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.side__name b {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
}
.side__name small {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-text);
}
.open-medad {
  justify-content: center;
  margin-block-end: 14px;
  padding: 10px 16px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(8, 122, 141, 0.22);
}
.side__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
}
.side__link svg {
  flex: none;
  color: var(--ink-3);
}
.side__link:hover {
  background: var(--hover);
}
.side__link[aria-current="page"] {
  background: var(--paper);
  color: var(--teal-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.side__link[aria-current="page"] svg {
  color: var(--teal-text);
}
.me {
  position: relative;
  margin-block-start: auto;
}
.me > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
}
.me > summary::-webkit-details-marker {
  display: none;
}
.me > summary:hover,
.me[open] > summary {
  background: var(--hover);
}
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 32px;
  block-size: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
.avatar--small {
  inline-size: 26px;
  block-size: 26px;
  font-size: 11px;
}
.avatar--waiting {
  background: var(--paper);
  border: 1.5px dashed #c3ccd0;
  color: var(--ink-3);
}
.me__who {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  line-height: 1.4;
}
.me__who b {
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.me__who small {
  overflow: hidden;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* An address is cut at its end, also on an Arabic page (it reads left to right). */
[dir="rtl"] .me__who b {
  direction: ltr;
  text-align: end;
}
.me__more {
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
}
.me__menu {
  position: absolute;
  inset-inline: 0;
  inset-block-end: calc(100% + 6px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}
.me__menu > a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.me__menu > a:hover {
  background: var(--grey);
}
.me__menu form {
  margin: 0;
}
.main {
  min-inline-size: 0;
  padding: 28px 36px 56px;
}
.main__in {
  max-inline-size: 1080px;
  margin-inline: auto;
}

/* ---------- 5. Page parts ---------- */
.page-hi {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.35;
}
.page-sub {
  margin-block: 2px 18px;
  color: var(--ink-3);
  font-size: 14px;
}
.crumb {
  margin-block-end: 2px;
  font-size: 13px;
  color: var(--ink-3);
}
.head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-block-end: 16px;
}
.head-row .page-sub {
  margin-block-end: 0;
}
.box {
  box-sizing: border-box;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.box + .box,
.box + .section-head {
  margin-block-start: 14px;
}
.box__label {
  margin-block-end: 10px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-block: 20px 8px;
}
.section-head .box__label {
  margin: 0;
}
.box > .section-head:first-child {
  margin-block-start: 0;
}
.empty {
  color: var(--ink-3);
  font-size: 14px;
}

/* Home: the balance ring and the subscription. */
.home-top {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
}
.home-top > .box + .box {
  margin-block-start: 0; /* the grid's gap spaces the two cards */
}
.tools + .box {
  margin-block-start: 14px;
}
.balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
}
.ring {
  position: relative;
  flex: none;
  inline-size: 124px;
  block-size: 124px;
}
.ring svg {
  display: block;
  inline-size: 124px;
  block-size: 124px;
  transform: rotate(-90deg);
}
.ring__track {
  fill: none;
  stroke: #e6eef0;
  stroke-width: 10;
}
.ring__fill {
  fill: none;
  stroke: var(--teal);
  stroke-width: 10;
  stroke-linecap: round;
}
.ring--low .ring__fill {
  stroke: #d98a00;
}
.ring--out .ring__fill {
  stroke: var(--risk);
}
.ring__in {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring__in b {
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
}
.ring__in small {
  margin-block-start: 4px;
  font-size: 12px;
  color: var(--ink-3);
}
.enough__of {
  font-size: 15px;
  font-weight: 600;
}
.enough__list {
  margin: 6px 0 10px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--ink-2);
}
.enough__list b {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--ink);
}
.enough__list .cannot {
  color: var(--warn-text);
}
.renew {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px;
  border: 1px solid var(--teal-line);
  border-radius: var(--radius-pill);
  background: var(--teal-soft);
  color: var(--teal-text);
  font-size: 13px;
}
.renew--warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn-text);
}
.facts {
  margin: 0;
}
.facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-block: 7px;
  border-block-end: 1px solid var(--hairline);
  font-size: 14px;
}
.facts > div:last-child {
  border-block-end: 0;
}
.facts dt {
  color: var(--ink-3);
}
.facts dd {
  margin: 0;
  font-weight: 500;
  text-align: end;
}
.yes {
  color: var(--ok-text);
}
.tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tool {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.tool__icon {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 38px;
  block-size: 38px;
  border-radius: 11px;
  background: var(--teal-soft);
  color: var(--teal-text);
}
.tool b {
  display: block;
  font-family: var(--font-ui);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}
.tool small {
  display: block;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}
.top-users {
  margin: 0;
  padding: 0;
  list-style: none;
}
.top-users li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(70px, 170px) auto;
  align-items: center;
  gap: 12px;
  padding-block: 5px;
  font-size: 13.5px;
}
.top-users .who {
  overflow: hidden;
  font-family: var(--font-ui);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.top-users .amount {
  font-weight: 500;
  white-space: nowrap;
}

/* Bars and the seats meter: SVG in CSS pixels (no viewBox, so nothing stretches the rounded
   ends), the fill's width a percentage, from the start side. */
.bar {
  display: block;
  inline-size: 100%;
  block-size: 8px;
}
[dir="rtl"] .bar {
  transform: scaleX(-1);
}
.bar__track {
  fill: #eef1f2;
}
.bar__fill {
  fill: var(--teal);
}
.bar--full .bar__fill {
  fill: #d98a00;
}

/* A User's Home: Medad's tool cards. */
.modecards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.modecard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  block-size: 100%;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease);
}
.modecard:hover {
  border-color: var(--teal-line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}
.modecard .tool__icon {
  inline-size: 40px;
  block-size: 40px;
  margin-block-end: 4px;
}
.modecard b {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}
.modecard span:last-child {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-3);
}

/* The Team page. */
/* «إضافة عضو» ends the title's row; open, its form takes a row of its own under the title. */
.add[open] {
  flex-basis: 100%;
}
.add > summary {
  inline-size: fit-content;
  margin-inline-start: auto;
  list-style: none;
  cursor: pointer;
}
.add__form {
  margin-block-start: 12px;
}
.add > summary::-webkit-details-marker {
  display: none;
}
.add__form {
  margin-block-end: 14px;
  padding: 16px 20px;
  border: 1.5px solid var(--teal-line);
  border-radius: 16px;
  background: #fbfeff;
}
.add__form h2 {
  margin-block-end: 12px;
  font-size: 16px;
  font-weight: 600;
}
.add__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}
.add__row .form-field {
  margin: 0;
}
.add__row .btn {
  block-size: 42px;
}
.seats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}
.seats__text b {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.seats__text span {
  font-size: 13px;
  color: var(--ink-3);
}
.seats .bar {
  flex: 1 1 200px;
}
.list {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.list th {
  padding: 0 8px 8px;
  border-block-end: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  text-align: start;
}
.list td {
  padding: 9px 8px;
  border-block-end: 1px solid var(--hairline);
  vertical-align: middle;
}
.list tr:last-child td {
  border-block-end: 0;
}
.list .end {
  text-align: end;
}
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-inline-size: 0;
}
.person__email {
  font-family: var(--font-ui);
  overflow-wrap: anywhere;
}
.person__name {
  display: block;
  font-weight: 600;
}
.person__name + .person__email {
  font-size: 12.5px;
  color: var(--ink-3);
}
.use b {
  font-family: var(--font-ui);
  font-weight: 600;
}
.why {
  display: block;
  margin-block-start: 2px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.row-menu {
  position: relative;
  display: inline-block;
}
.row-menu > summary {
  display: grid;
  place-items: center;
  inline-size: 32px;
  block-size: 32px;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 18px;
  cursor: pointer;
  list-style: none;
}
.row-menu > summary::-webkit-details-marker {
  display: none;
}
.row-menu > summary:hover,
.row-menu[open] > summary {
  background: var(--hover);
  color: var(--ink);
}
.row-menu__list {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: calc(100% + 4px);
  z-index: 5;
  inline-size: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}
.row-menu__list form {
  margin: 0;
}
.row-menu__note {
  padding: 2px 10px 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* The usage details. */
.months {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 13.5px;
}
.months a,
.months span {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  text-decoration: none;
}
.months a:hover {
  background: var(--grey);
}
.months [aria-current="date"] {
  background: var(--grey);
  color: var(--ink);
  font-weight: 600;
}
.figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
.figures > div {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.figures dt {
  font-size: 12.5px;
  color: var(--ink-3);
}
.figures dd {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
}
.tool-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-name .tool__icon {
  inline-size: 26px;
  block-size: 26px;
  border-radius: 8px;
}
.pager {
  display: flex;
  gap: 10px;
  margin-block-start: 10px;
}
.fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.fold > summary::-webkit-details-marker {
  display: none;
}
.fold > summary::after {
  content: "+";
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 400;
}
.fold[open] > summary::after {
  content: "−";
}
.fold[open] > summary {
  margin-block-end: 8px;
}
.amount-in {
  color: var(--ok-text);
}
.amount-in,
.amount-out {
  font-family: var(--font-ui);
  font-weight: 600;
  white-space: nowrap;
}

/* The Account page. */
.acc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.acc-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.acc-col .box + .box {
  margin: 0;
}
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile .avatar {
  inline-size: 48px;
  block-size: 48px;
  font-size: 18px;
}
.profile b {
  display: block;
  font-family: var(--font-ui);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.profile span {
  color: var(--ink-3);
  font-size: 13.5px;
}
.langs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 14px;
}
.langs > a,
.langs > span {
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  color: var(--ink);
  text-decoration: none;
}
.langs > span {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.langs > a:hover {
  background: var(--grey);
}

/* ---------- 6. The public pages: one card ---------- */
.public {
  position: relative;
  box-sizing: border-box;
  min-block-size: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 40px;
  background: linear-gradient(180deg, #f7fbfc, #edf3f5);
}
.public__lang {
  position: absolute;
  inset-block-start: 16px;
  inset-inline-end: 20px;
  font-family: var(--font-ui);
  font-size: 14px;
}
.public__lang a {
  color: var(--teal-text);
  font-weight: 500;
  text-decoration: none;
}
.pcard {
  box-sizing: border-box;
  inline-size: min(420px, 100%);
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}
.pcard__mark {
  inline-size: 44px;
  block-size: 44px;
}
.pcard h1 {
  margin-block: 12px 4px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
}
.pcard__lead {
  margin-block-end: 18px;
  color: var(--ink-2);
  font-size: 14.5px;
}
.pcard__more {
  margin-block-start: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
.pcard form {
  margin: 0;
}
.public__foot {
  margin-block-start: 22px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.public__foot a {
  color: inherit;
}

/* ---------- 7. Narrow screens: the sidebar becomes a top bar ---------- */
@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: static;
    block-size: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-inline-end: 0;
    border-block-end: 1px solid var(--line);
  }
  .side__brand {
    flex: 1 1 auto;
    padding: 0;
  }
  .open-medad {
    order: 2;
    margin: 0;
    padding: 8px 16px;
  }
  .me {
    order: 3;
    margin: 0;
  }
  .me > summary {
    display: block;
    padding: 2px;
  }
  .me__who,
  .me__more {
    display: none;
  }
  .me__menu {
    inset-inline: auto 0;
    inset-block: calc(100% + 6px) auto;
    min-inline-size: 240px;
  }
  .side__nav {
    order: 4;
    flex-basis: 100%;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
  }
  .side__link {
    padding: 7px 12px;
    white-space: nowrap;
  }
  .main {
    padding: 18px 16px 40px;
  }
  .home-top,
  .acc-grid,
  .add__row {
    grid-template-columns: minmax(0, 1fr);
  }
  .tools,
  .modecards {
    grid-template-columns: minmax(0, 1fr);
  }
  .figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-hi {
    font-size: 24px;
  }
  /* Lists stack: each row a card, each cell with its column's name above it. */
  .list thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .list,
  .list tbody,
  .list tr,
  .list td {
    display: block;
  }
  .list tr {
    padding-block: 8px;
    border-block-end: 1px solid var(--line);
  }
  .list tr:last-child {
    border-block-end: 0;
  }
  .list td {
    padding: 3px 0;
    border: 0;
  }
  .list td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--ink-3);
  }
  .list .end {
    text-align: start;
  }
  .top-users li {
    grid-template-columns: 26px minmax(0, 1fr) auto;
  }
  .top-users .bar {
    display: none;
  }
}
