/* Консультации, direction G "Стекло": the design system. DESIGN.md is its documentation, design/system.html its showcase.
   Tokens in three levels:
   1. primitives  (--blue-600, --space-4 ...): every allowed value, no meaning; used only inside this block;
   2. roles       (--color-accent, --space-lg, --shape-md, --type-label ...): what a value is for; light and dark change only these;
   3. components  (--button-*, --tile-*, --cell-*, --field-*, --card-*, --sheet-*, --bar-*): parts of one component, pointing at roles.
   Rules: no raw colour, size, radius or spacing outside this block; a focus ring = element radius + --ring-gap;
   a nested corner = outer radius - padding. */

@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/onest-var-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/onest-var-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/unbounded-600-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/unbounded-600-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light dark;

  /* ===== 1. primitives ===== */
  /* palette: blue and pink from "Ризограф", neutral greys with a blue cast, one red */
  --blue-100: #e4e9fb; --blue-300: #8fa6ff; --blue-600: #2a45a6; --blue-900: #1e2547;
  --pink-400: #ff7ab8; --pink-500: #ff5ea8;
  --red-300: #ff8a80; --red-700: #b42318;
  --grey-0: #ffffff; --grey-50: #f3f4f8; --grey-100: #e9eaf0; --grey-150: #e2e4ec; --grey-300: #b7bacb;
  --grey-500: #80849a; --grey-550: #767a90; --grey-700: #4a4e63; --grey-850: #272833; --grey-875: #262833;
  --grey-900: #1a1b23; --grey-950: #16182a; --grey-1000: #0e0f14; --grey-10: #f1f2f6;
  /* size steps (px) */
  --size-4: 4px; --size-8: 8px; --size-12: 12px; --size-16: 16px; --size-24: 24px; --size-32: 32px; --size-48: 48px; --size-64: 64px;
  /* type primitives */
  --family-onest: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --family-unbounded: "Unbounded", "Onest", system-ui, sans-serif;
  --font-14: 0.875rem; --font-16: 1rem; --font-22: 1.375rem; --font-32: 2rem;
  --weight-400: 400; --weight-500: 500; --weight-600: 600;

  /* ===== 2. roles ===== */
  /* colour roles; "on-X" is text and icons on top of X */
  --color-bg: var(--grey-50);                     /* page ground */
  --color-surface: var(--grey-0);                 /* cards, tiles, fields; text: on-surface */
  --color-on-surface: var(--grey-950);            /* text, 16.0:1 on bg */
  --color-on-surface-muted: var(--grey-700);      /* second text, 7.5:1 on bg, 6.8:1 on past */
  --color-divider: var(--grey-150);               /* hairlines between rows, decoration only */
  --color-outline: var(--grey-500);               /* borders of controls, 3.4:1 on bg, 3.7:1 on surface */
  --color-accent: var(--blue-600);                /* free / open hour, links, primary action; 8.4:1 on surface */
  --color-on-accent: var(--grey-0);
  --color-accent-container: var(--blue-100);      /* open hour in the hub, current section; accent on it 6.9:1 */
  --color-booking: var(--pink-500);               /* a booking */
  --color-on-booking: var(--grey-950);            /* 6.2:1 on booking */
  --color-past: var(--grey-100);                  /* time that has passed, disabled controls */
  --color-error: var(--red-700);                  /* errors, irreversible actions; 6.6:1 on surface */
  --color-on-error: var(--grey-0);
  --color-focus: var(--color-accent);
  /* hour states: the same meaning for the student and the hub */
  --hour-free-bg: var(--color-surface);       --hour-free-fg: var(--color-accent);          --hour-free-border: var(--color-outline);
  --hour-selected-bg: var(--color-accent);    --hour-selected-fg: var(--color-on-accent);   --hour-selected-border: var(--color-accent);
  --hour-open-bg: var(--color-accent-container); --hour-open-fg: var(--color-accent);       --hour-open-border: var(--color-accent);
  --hour-booked-bg: var(--color-booking);     --hour-booked-fg: var(--color-on-booking);    --hour-booked-border: var(--color-booking);
  --hour-past-bg: var(--color-past);          --hour-past-fg: var(--color-on-surface-muted); --hour-past-border: transparent;
  --hour-closed-bg: var(--color-surface);     --hour-closed-fg: var(--color-on-surface);    --hour-closed-border: var(--color-outline);
  /* glass: only on the floating layer (menus, bars, toasts); never on a block with a field in it. Regular variant, dense enough for AA */
  --glass-bg: rgb(255 255 255 / 0.82);
  --glass-blur: 20px;
  --glass-shadow: 0 12px 32px rgb(22 24 42 / 0.14), 0 1px 3px rgb(22 24 42 / 0.08), inset 0 1px 0 rgb(255 255 255 / 0.95), inset 0 0 0 1px rgb(22 24 42 / 0.07);
  /* state layers: the content colour laid over the container, one at a time (as in Material 3) */
  --state-hover: 8%;
  --state-pressed: 12%;
  --state-press-scale: 0.97;

  /* type roles: two typefaces, seven roles; each role is a font shorthand */
  --font-text: var(--family-onest);
  --font-display: var(--family-unbounded);
  --type-display: var(--weight-600) var(--font-32)/1.1 var(--font-display);    /* 32/35.2: page title, the time of «Моя запись», sign-in code */
  --type-headline: var(--weight-600) var(--font-22)/1.2 var(--font-display);   /* 22/26.4: block headings, the week range, a student's name */
  --type-title: var(--weight-600) var(--font-16)/1.5 var(--font-text);         /* 16/24: day names, small headings */
  --type-numeric: var(--weight-600) var(--font-16)/1.5 var(--font-text);       /* 16/24 tabular: hour figures on tiles and beside the grid */
  --type-label: var(--weight-500) var(--font-16)/1.5 var(--font-text);         /* 16/24: buttons, menu, field labels, names, grid cells */
  --type-body: var(--weight-400) var(--font-16)/1.5 var(--font-text);          /* 16/24: running text */
  --type-caption: var(--weight-400) var(--font-14)/1.45 var(--font-text);      /* 14/20.3: hints, meta, dates, legend, tab labels */
  --track-display: -0.02em;
  --track-headline: -0.01em;

  /* space roles */
  --space-xs: var(--size-4); --space-sm: var(--size-8); --space-md: var(--size-12); --space-lg: var(--size-16);
  --space-xl: var(--size-24); --space-2xl: var(--size-32); --space-3xl: var(--size-48); --space-4xl: var(--size-64);

  /* shape roles; nested corners are concentric (inner = outer - padding) */
  --shape-sm: var(--size-8);    /* grid cells, inline links, small marks */
  --shape-md: var(--size-16);   /* hour tiles, fields, inner plates, list rows */
  --shape-lg: var(--size-24);   /* cards, day blocks, the week board */
  --shape-xl: var(--size-32);   /* «Моя запись», the header, toasts */
  --shape-full: 999px;          /* buttons, menu items, bars */

  /* focus ring */
  --ring-w: 2px;
  --ring-gap: 2px;

  /* targets */
  --tap: 44px;
  --tap-l: var(--size-48);

  /* safe areas: the phone notch and the Telegram mini app (its script sets the --tg-* variables) */
  --safe-t: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-l: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-r: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));

  /* motion (DESIGN.md, «Движение»): two curves, six durations, two distances. JS reads the same tokens
     (common.js, ms()), so a duration lives in one place */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* appear, leave, press, colour of a state */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* something that travels on screen: the section pill */
  --t-press: 160ms;   /* press, hover, a state's colour (hour opened, hour chosen) */
  --t-pop: 180ms;     /* chevron turn, close of a block opened in place, toast leaving */
  --t-open: 220ms;    /* a block opening in place (form under a day, panels), toast arriving */
  --t-move: 280ms;    /* the section pill moving to another section, a week sliding in */
  --t-arrive: 360ms;  /* «Запись готова», «Время изменено», «Запись отменена»: the result of the main action */
  --t-stagger: 60ms;  /* step between parts that arrive one after another */
  --rise: 12px;       /* how far an arriving block travels */
  --rise-sm: 4px;     /* how far a block opening in place travels */

  /* ===== 3. components ===== */
  --button-height: var(--tap-l);  --button-pad-x: var(--space-xl);  --button-radius: var(--shape-full);
  --tile-height: var(--tap-l);    --tile-radius: var(--shape-md);   --tile-gap: var(--space-sm);
  --cell-height: 40px;            --cell-radius: var(--shape-sm);   --cell-pad-x: var(--space-sm);
  --field-height: var(--tap-l);   --field-radius: var(--shape-md);  --field-pad-x: var(--space-lg);
  --card-radius: var(--shape-lg); --card-pad: var(--space-xl);      --card-pad-tight: var(--space-sm);
  --sheet-radius: var(--shape-xl); /* «Моя запись» and toasts */
  --bar-radius: var(--shape-full); --bar-pad: var(--space-xs);
  --row-radius: var(--shape-md);
  /* layout widths (media-query breakpoints cannot be variables: 360, 560, 768, 1024, 1280, see DESIGN.md) */
  --layout-wide: 1180px; --layout-student: 640px; --layout-form: 560px; --layout-list: 340px; --layout-side: 244px;
}

/* 320: cards take 16 in, so a button with its icon and the time with «МСК» keep one line */
@media (max-width: 359px) { :root { --card-pad: var(--space-lg); } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: var(--grey-1000); --color-surface: var(--grey-900); --color-on-surface: var(--grey-10); --color-on-surface-muted: var(--grey-300);
    --color-divider: var(--grey-875); --color-outline: var(--grey-550);
    --color-accent: var(--blue-300); --color-on-accent: var(--grey-1000); --color-accent-container: var(--blue-900);
    --color-booking: var(--pink-400); --color-on-booking: var(--grey-1000); --color-past: var(--grey-850);
    --color-error: var(--red-300); --color-on-error: var(--grey-1000);
    --glass-bg: rgb(28 29 38 / 0.82);
    --glass-shadow: 0 12px 32px rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.14), inset 0 0 0 1px rgb(255 255 255 / 0.08);
  }
}
:root[data-theme="dark"] {
  --color-bg: var(--grey-1000); --color-surface: var(--grey-900); --color-on-surface: var(--grey-10); --color-on-surface-muted: var(--grey-300);
  --color-divider: var(--grey-875); --color-outline: var(--grey-550);
  --color-accent: var(--blue-300); --color-on-accent: var(--grey-1000); --color-accent-container: var(--blue-900);
  --color-booking: var(--pink-400); --color-on-booking: var(--grey-1000); --color-past: var(--grey-850);
  --color-error: var(--red-300); --color-on-error: var(--grey-1000);
  --glass-bg: rgb(28 29 38 / 0.82);
  --glass-shadow: 0 12px 32px rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.14), inset 0 0 0 1px rgb(255 255 255 / 0.08);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* ---------- reset: nothing keeps a browser default size, weight or spacing ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-on-surface);
  font: var(--type-body); font-variant-numeric: lining-nums tabular-nums;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, form, fieldset { margin: 0; }
h1, h2, h3, h4, b, strong, small, th, legend { font-size: inherit; font-weight: inherit; line-height: inherit; }
ul, ol, fieldset, legend { padding: 0; list-style: none; border: 0; }
button, input, select, textarea { font: inherit; font-variant-numeric: inherit; letter-spacing: inherit; color: inherit; margin: 0; }
button { padding: 0; }
p, li { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }
[hidden] { display: none !important; }
::selection { background: var(--color-accent); color: var(--color-on-accent); }

/* figures: tabular and lining everywhere (the font shorthand would reset them) */
*, *::before, *::after { font-variant-numeric: lining-nums tabular-nums; }

/* ---------- type roles: every text on the site is one of these ---------- */
h2, h3 { font: var(--type-title); font-variant-numeric: lining-nums tabular-nums; }
h1, .type-display { font: var(--type-display); font-variant-numeric: lining-nums tabular-nums; letter-spacing: var(--track-display); }
.type-headline { font: var(--type-headline); font-variant-numeric: lining-nums tabular-nums; letter-spacing: var(--track-headline); }
.type-title { font: var(--type-title); font-variant-numeric: lining-nums tabular-nums; letter-spacing: normal; }
.type-numeric { font: var(--type-numeric); font-variant-numeric: lining-nums tabular-nums; letter-spacing: normal; }
.type-label, .btn, .label, .link-tap, .slot-plate, .toast .toast-act, .choice, .menu-item { font: var(--type-label); font-variant-numeric: lining-nums tabular-nums; letter-spacing: normal; }
.type-body, .rel { font: var(--type-body); font-variant-numeric: lining-nums tabular-nums; letter-spacing: normal; }
.type-caption, .hint, .error, .counter, .meta, .tag { font: var(--type-caption); font-variant-numeric: lining-nums tabular-nums; letter-spacing: normal; }

a { color: var(--color-accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; border-radius: var(--shape-sm); }
@media (hover: hover) { a:hover { text-decoration-thickness: 2.5px; } }

/* ---------- states, one model for everything you can press ----------
   hover / pressed: a layer of the content colour (currentColor) over the container, --state-hover / --state-pressed;
   pressed on buttons and hour tiles: also a 0.97 press; choices, menu items and list rows only darken;
   focus: one ring, it follows the element's own radius (ring radius = element radius + ring gap);
   selected: a fill (accent for an hour, accent-container for a menu item or a choice);
   disabled: the past colour, muted text, no border.
   .is-hover, .is-active, .is-focus force a state on the showcase page (design/system.html);
   they sit next to the real :hover / :active / :focus-visible rules with the same declarations. */
:focus-visible, .is-focus { outline: var(--ring-w) solid var(--color-focus); outline-offset: var(--ring-gap); }
/* headings and blocks that only receive focus from a script: no ring. Grid cells keep theirs */
:is(h1, h2, h3, p, article, section, div:not([role]))[tabindex="-1"]:focus { outline: none; }

.muted { color: var(--color-on-surface-muted); }
.num { font-variant-numeric: lining-nums tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- material: glass for the floating layer only ---------- */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%);
  backdrop-filter: blur(var(--glass-blur)) saturate(170%);
  box-shadow: var(--glass-shadow);
}
/* text on glass is on-surface or on-surface-muted; accent sits on its own solid pill, never straight on the glass */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--color-surface); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--color-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .glass { background: var(--color-surface); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: inset 0 0 0 1.5px var(--color-outline); }
}

/* ---------- button: capsule. Variants: secondary (default), primary, danger, plain, round, booking ---------- */
.btn {
  --_container: var(--color-surface);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  min-height: var(--button-height); padding: var(--space-sm) var(--button-pad-x);
  border: 1px solid var(--color-outline); border-radius: var(--button-radius);
  background-color: var(--_container); color: var(--color-on-surface);
  text-decoration: none; text-align: center;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-press) var(--ease-out), color var(--t-press) var(--ease-out), border-color var(--t-press) var(--ease-out);
}
.btn-primary { --_container: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.btn-danger { --_container: var(--color-error); border-color: var(--color-error); color: var(--color-on-error); }
.btn-plain { --_container: transparent; border-color: transparent; }
/* main action inside a pink booking ("Войти во встречу"): the booking's own ink. Blue on pink falls to 1.0:1 in the dark theme */
.btn-booking { --_container: var(--color-on-booking); border-color: var(--color-on-booking); color: var(--color-booking); }
.btn-round { width: var(--button-height); padding: 0; }
@media (hover: hover) { .btn:hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); } }
.btn.is-hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); }
.btn:active, .btn.is-active { background-color: color-mix(in srgb, currentColor var(--state-pressed), var(--_container)); transform: scale(var(--state-press-scale)); }
.btn[aria-disabled="true"], .btn:disabled { color: var(--color-on-surface-muted); background-color: var(--color-past); border-color: transparent; cursor: not-allowed; transform: none; }
.btn-wide { width: 100%; }

/* icon button: a round target without a frame */
.icon-btn {
  --_container: transparent;
  display: inline-grid; place-items: center; width: var(--tap); min-height: var(--tap); padding: 0;
  border: 0; border-radius: var(--shape-full); background-color: var(--_container); color: var(--color-on-surface); cursor: pointer;
  transition: background-color var(--t-press) var(--ease-out);
}
@media (hover: hover) { .icon-btn:hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); } }
.icon-btn:active { background-color: color-mix(in srgb, currentColor var(--state-pressed), var(--_container)); }
/* icons: Iconoteka Regular (outlined paths), filled with the text colour */
.icon-btn svg, .ico { width: var(--icon-size); height: var(--icon-size); fill: currentColor; flex: none; }
:root { --icon-size: 22px; --icon-size-md: 20px; --icon-size-sm: 16px; }

/* link and text-like button: underlined accent text */
.link {
  display: inline; padding: 0; border: 0; background: none; border-radius: var(--shape-sm);
  color: var(--color-accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  cursor: pointer; touch-action: manipulation; text-align: left;
}
@media (hover: hover) { .link:hover { text-decoration-thickness: 2.5px; } }
.link.is-hover { text-decoration-thickness: 2.5px; }
/* links that stand alone get a full tap target */
.link-tap { display: inline-flex; align-items: center; min-height: var(--tap); }

/* choice: capsules with aria-pressed (filters, attendance). Selected = accent container */
.choice-group { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.choice {
  --_container: var(--color-surface);
  min-height: var(--tap); padding: 0 var(--space-lg); border: 1px solid var(--color-outline); border-radius: var(--shape-full);
  background-color: var(--_container); color: var(--color-on-surface); cursor: pointer; touch-action: manipulation;
  transition: background-color var(--t-press) var(--ease-out), color var(--t-press) var(--ease-out), border-color var(--t-press) var(--ease-out);
}
.choice[aria-pressed="true"] { --_container: var(--color-accent-container); border-color: var(--color-accent); color: var(--color-accent); }
@media (hover: hover) { .choice:hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); } }
.choice.is-hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); }
.choice:active, .choice.is-active { background-color: color-mix(in srgb, currentColor var(--state-pressed), var(--_container)); }

/* menu item: side menu link and bottom tab. Selected = accent container */
.menu-item {
  --_container: transparent;
  border: 0; border-radius: var(--shape-full); background-color: var(--_container); color: var(--color-on-surface); cursor: pointer;
  transition: background-color var(--t-press) var(--ease-out), color var(--t-press) var(--ease-out);
}
.menu-item[aria-current="page"] { --_container: var(--color-accent-container); color: var(--color-accent); }
@media (hover: hover) { .menu-item:hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); } }
.menu-item.is-hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); }
.menu-item:active, .menu-item.is-active { background-color: color-mix(in srgb, currentColor var(--state-pressed), var(--_container)); }

/* list row: a whole row you can press (student in a list, a day on the phone) */
.list-row {
  --_container: transparent;
  border: 0; border-radius: var(--row-radius); background-color: var(--_container); color: var(--color-on-surface); cursor: pointer; text-align: left;
  transition: background-color var(--t-press) var(--ease-out);
}
.list-row[aria-current="true"] { --_container: var(--color-accent-container); }
@media (hover: hover) { .list-row:hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); } }
.list-row.is-hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); }
.list-row:active, .list-row.is-active { background-color: color-mix(in srgb, currentColor var(--state-pressed), var(--_container)); }

.row { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.stack > * + * { margin-top: var(--space-md); }

/* ---------- field: label, input, hint, error ---------- */
.field { display: grid; gap: var(--space-sm); }
.field + .field { margin-top: var(--space-lg); }
.label { color: var(--color-on-surface); }
.label .opt { color: var(--color-on-surface-muted); }
.hint { color: var(--color-on-surface-muted); }
.input, .textarea, .select {
  width: 100%; min-height: var(--field-height); padding: 0 var(--field-pad-x);
  border: 1px solid var(--color-outline); border-radius: var(--field-radius);
  background-color: var(--color-surface); color: var(--color-on-surface);
  transition: border-color var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out);
}
.textarea { padding: var(--space-md) var(--field-pad-x); min-height: calc(var(--field-height) * 2.5); resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: var(--space-3xl); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-on-surface) 50%), linear-gradient(135deg, var(--color-on-surface) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input::placeholder, .textarea::placeholder { color: var(--color-on-surface-muted); opacity: 1; }
@media (hover: hover) { .input:hover, .textarea:hover, .select:hover { border-color: var(--color-on-surface-muted); } }
.input.is-hover { border-color: var(--color-on-surface-muted); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible, .input.is-focus { border-color: var(--color-accent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-error); box-shadow: inset 0 0 0 1px var(--color-error); }
.input:disabled { background-color: var(--color-past); color: var(--color-on-surface-muted); border-color: transparent; cursor: not-allowed; }
.error { color: var(--color-error); }
.error:empty { display: none; }
.counter { color: var(--color-on-surface-muted); justify-self: end; }
.counter:empty { display: none; }

/* ---------- plates and confirms (content layer, solid) ---------- */
.note { padding: var(--space-md) var(--space-lg); border-radius: var(--shape-md); background: var(--color-surface); color: var(--color-on-surface); }
.note-danger { box-shadow: inset 0 0 0 1px var(--color-error); }
.note > * + * { margin-top: var(--space-sm); }
.note:empty { display: none; }

.confirm { padding: var(--space-lg); border-radius: var(--shape-md); background: var(--color-surface); color: var(--color-on-surface); }
.confirm > * + * { margin-top: var(--space-md); }

/* ---------- toast: glass, floating layer ---------- */
.toasts {
  position: fixed; left: 50%; translate: -50% 0; z-index: 50;
  bottom: calc(var(--space-lg) + var(--safe-b) + var(--toast-lift, 0px));
  width: min(var(--layout-form), calc(100% - 2 * var(--space-lg)));
  display: grid; gap: var(--space-sm); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-md); justify-content: space-between;
  min-height: calc(var(--tap) + 2 * var(--space-sm)); padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-xl);
  border-radius: var(--sheet-radius); color: var(--color-on-surface); pointer-events: auto;
  /* a transition, not keyframes: a toast that leaves while it still arrives turns back from where it is */
  transition: opacity var(--t-open) var(--ease-out), transform var(--t-open) var(--ease-out);
}
/* it rises from the bottom edge it lives at, and leaves the same way, a little faster */
@starting-style { .toast { opacity: 0; transform: translateY(var(--rise)) scale(0.97); } }
.toast.is-leaving { opacity: 0; transform: translateY(var(--rise)) scale(0.97); transition-duration: var(--t-pop); pointer-events: none; }
.toast .toast-act {
  --_container: var(--color-surface);
  flex: none; min-height: var(--tap); padding: 0 var(--space-lg); border: 1px solid var(--color-outline); border-radius: var(--shape-full);
  background-color: var(--_container); color: var(--color-on-surface); cursor: pointer; touch-action: manipulation;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-press) var(--ease-out);
}
@media (hover: hover) { .toast .toast-act:hover { background-color: color-mix(in srgb, currentColor var(--state-hover), var(--_container)); } }
.toast .toast-act:active { background-color: color-mix(in srgb, currentColor var(--state-pressed), var(--_container)); transform: scale(var(--state-press-scale)); }

/* a block that opened in place: its height grows in JS (common.js unfold), its content comes in with this */
.appear { animation: appear var(--t-open) var(--ease-out) both; }
@keyframes appear { from { opacity: 0; transform: translateY(var(--rise-sm)); } }
/* the result of the main action arrives: rises and comes in, parts one after another (--i). From 0.4, not from
   nothing: the place where the old content was never goes blank */
.arrive { animation: arrive var(--t-arrive) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--t-stagger)); }
@keyframes arrive { from { opacity: 0.4; transform: translateY(var(--rise)); } }
/* a tick that draws itself left to right, after its block has arrived */
.tick-draw { animation: tick-draw var(--t-arrive) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--t-stagger) + var(--t-open)); }
@keyframes tick-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* native disclosure: the content fades in (and grows where the browser can animate to auto) */
:root { interpolate-size: allow-keywords; }
details::details-content {
  block-size: 0; opacity: 0;
  transition: block-size var(--t-open) var(--ease-out), opacity var(--t-open) var(--ease-out), content-visibility var(--t-open) allow-discrete;
}
details[open]::details-content { block-size: auto; opacity: 1; }
/* clip while it grows, but leave room for focus rings (only where the height is animated at all) */
@supports (interpolate-size: allow-keywords) { details::details-content { overflow: clip; overflow-clip-margin: calc(var(--ring-w) + var(--ring-gap)); } }

/* skeleton for loading states; same height as the content it stands for */
.skeleton { background: var(--color-surface); border-radius: var(--card-radius); }

/* reduce motion: what moves or scales stops, what fades in stays (the colour of a state still changes softly) */
@media (prefers-reduced-motion: reduce) {
  .btn:active, .btn.is-active, .toast .toast-act:active { transform: none; }
  @starting-style { .toast { opacity: 0; transform: none; } }
  .toast.is-leaving { transform: none; }
  @keyframes appear { from { opacity: 0; } }
  @keyframes arrive { from { opacity: 0.4; } }
  .tick-draw { animation: none; }
  details::details-content { transition: opacity var(--t-open) var(--ease-out), content-visibility var(--t-open) allow-discrete; block-size: auto; }
  html { scroll-behavior: auto !important; }
}
