/* © 2026 KiQ Limited, Ireland. All rights reserved. Proprietary software of KiQ Limited. */
/* KiQ 3D Glass for the web app (stage 1 of the web parity work, 2026-11-23): the desktop app's look, built once.
   Loaded BEFORE app.css, so every rule here is a base that a screen's own rule in app.css may refine.
   1. THE token set: colours, canvas, glass, radii, shadows, type, columns, motion; light, then dark. Nothing else in
      the web app defines these names (app.css's three older blocks were folded into this one).
   2. The surfaces: .g-panel (GlassPanel) · .g-bar (ReaderBarGlass) · .g-head (HeaderGlass) · .g-pill (PillGlass).
   3. The buttons: .g-tile (KiQTile: .primary / plain, .square, .wide, .sm) with its press · .g-liquid (New message, +)
      · .g-glassbtn (the reader's glass tools, tinted with --tint) · .g-round. The older names wear them:
      .btn = .g-tile.primary, .btn.ghost = .g-tile, .icon-btn = .g-glassbtn.square.
   4. The icons: .g-ico (KiQ 3D glass drawing, light / dark, soft glow) · .g-line (line mark) · .g-tileico (GlassTileIcon).
   5. The pieces: the menu (.k-menu) · the pop-up (.g-scrim + .g-pop) · the address pill (.g-addr) · the banner
      (.g-banner) · the KiQ AI mark with its ring (.kai-ring) · the empty state (.g-empty).
   The components that draw them are in js/glass.js. Values are the desktop app's (KiQMail/iOS/KiQMail/UI/Theme.swift,
   KiQTileButton.swift, PhoneShell.swift, MessageView.swift, AttachmentsMenu.swift). */

/* ───────────────────────────────────────────── 1. tokens ───────────────────────────────────────────── */
:root {
  color-scheme: light;
  /* colour (the app's colour sets) */
  --accent: #4C5BD4;            /* words, rims, tints: lighter in dark mode */
  --indigo: #4C5BD4;            /* a filled accent surface under white words: the same in both modes */
  --accent-top: #7383F7;        /* the top of a primary tile */
  --navy: #0F1629; --ink: #1f2328; --muted: #6B7280; --line: #E0E3E8; --bg: #F3F4F6; --panel: #FFFFFF; --tint: #EEF1FF;
  --blue: #3563E9; --ok: #0f7b3f; --err: #c42b1c; --warn: #b35c00;
  --violet: #7C3AED;
  --ai: linear-gradient(135deg, #7C3AED, #DB2777); --ai-glow: rgba(124, 58, 237, .40);
  --ai-plus: linear-gradient(135deg, #7F42FA, #F02488); --ai-plus-glow: rgba(211, 34, 172, .40);
  /* what a tool means */
  --c-green: #22A06B; --c-orange: #F0703C; --c-red: #E5486A; --c-amber: #F59E0B; --c-teal: #14B8A6; --c-blue: #3B82F6; --c-slate: #64748B; --c-grey: #6B7280;
  /* the older tone names of the duotone icons (kept: js/kiq-icons.js and the /v2 beta may still read them) */
  --t-blue: #3a76f0; --t-indigo: #5b5bd6; --t-violet: #8b5cf6; --t-teal: #0fa3a0; --t-green: #14a46b;
  --t-amber: #eda01a; --t-orange: #f0703c; --t-rose: #e5486a; --t-slate: #64748b; --ic-tint: .3;
  /* canvas (GlassBackground) */
  --canvas: radial-gradient(circle 110vw at 0% -8%, rgba(76, 91, 212, .17), rgba(76, 91, 212, 0)),
            radial-gradient(circle 95vw at 100% -4%, rgba(168, 85, 247, .16), rgba(168, 85, 247, 0)),
            radial-gradient(circle 55vh at 60% 110%, rgba(56, 189, 248, .16), rgba(56, 189, 248, 0)),
            linear-gradient(180deg, #EFF1F9, #E3E8F3);
  /* glass */
  --glass: rgba(255, 255, 255, .64); --glass-strong: rgba(255, 255, 255, .80); --glass-rim: rgba(255, 255, 255, .85);
  --glass-edge: rgba(15, 23, 42, .08); --glass-blur: saturate(1.7) blur(22px);
  --row: rgba(255, 255, 255, .86);                    /* a plain list row (GlassRowBackground) */
  --row-on: rgba(76, 91, 212, .14);                   /* the open email's row (MacRowHighlight) */
  --hover: rgba(15, 23, 42, .05);
  --field: rgba(255, 255, 255, .9); --field-rim: rgba(15, 23, 42, .14);
  --switch-off: #C3CAD6; --switch-off-ink: #4B5565;                 /* the web's switches: grey OFF (green ON is --c-green) */
  --sheen: rgba(255, 255, 255, .35);
  --g3-glow: rgba(61, 107, 255, .22);                 /* the soft blue glow under a 3D glass icon */
  /* radii */
  --radius: 10px; --r-panel: 18px; --r-card: 14px; --r-ctl: 10px; --r-row: 9px; --r-tool: 11px;
  /* shadows */
  --shadow-panel: 0 8px 36px rgba(30, 41, 59, .10);
  --shadow-2: 0 8px 24px rgba(30, 41, 59, .10), 0 1px 3px rgba(30, 41, 59, .06);
  --shadow-pop: 0 6px 36px rgba(0, 0, 0, .16);
  /* type: the system font, so a Mac shows the desktop app's own letters */
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 13.5px; --fs-nav: 13.5px; --fs-folder: 13px; --fs-greet: 19px; --fs-subject: 20px;
  --fs-name: 17px; --fs-subj: 15px; --fs-snip: 13px;             /* a row of the email list: the sender, the subject, the two lines of the email */
  /* columns (MacColumns) */
  --side: 260px; --list: 400px; --topbar-h: 56px;
  /* motion (PlusPress / PressScale / the pop-up's fade) */
  --spring: cubic-bezier(.34, 1.56, .64, 1); --t-press: .09s; --t-back: .32s; --t-pop-in: .2s; --t-pop-out: .16s;
}
[data-theme=dark] {
  color-scheme: dark;
  --accent: #8B97F7;
  --navy: #E8EAED; --ink: #d9dce1; --muted: #9AA1AB; --line: #3A3F47; --bg: #1B1D21; --panel: #25282D; --tint: #2A2F4A;
  --t-blue: #5b93ff; --t-indigo: #8285ff; --t-violet: #a67cff; --t-teal: #2cc7c0; --t-green: #2fc585; --t-amber: #f7b83a; --t-orange: #ff8a57; --t-rose: #ff6b8b; --t-slate: #8f9bb0; --ic-tint: .36;
  --canvas: radial-gradient(circle 110vw at 0% -8%, rgba(76, 91, 212, .30), rgba(76, 91, 212, 0)),
            radial-gradient(circle 95vw at 100% 0%, rgba(168, 85, 247, .18), rgba(168, 85, 247, 0)),
            linear-gradient(180deg, #15171C, #0F1115);
  --glass: rgba(26, 29, 36, .70); --glass-strong: rgba(30, 33, 41, .82); --glass-rim: rgba(255, 255, 255, .08);
  --glass-edge: rgba(255, 255, 255, .06); --glass-blur: saturate(1.5) blur(22px);
  --row: rgba(30, 33, 41, .9); --row-on: rgba(139, 151, 247, .26);
  --hover: rgba(255, 255, 255, .06);
  --field: rgba(255, 255, 255, .07); --field-rim: rgba(255, 255, 255, 0);
  --switch-off: #4A5263; --switch-off-ink: #D5DAE4;
  --sheen: rgba(255, 255, 255, .10);
  --g3-glow: rgba(61, 107, 255, .32);
  --shadow-panel: 0 8px 36px rgba(0, 0, 0, .35);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-pop: 0 6px 36px rgba(0, 0, 0, .45);
}

/* ───────────────────────────────────────────── base ───────────────────────────────────────────── */
body { font: var(--fs)/1.5 var(--font-ui); letter-spacing: -0.003em; -webkit-font-smoothing: antialiased; color: var(--ink);
  background: var(--canvas); background-attachment: fixed; }
a { color: var(--accent); }
/* the keyboard's place is always visible (never the mouse's) */
:where(button, a, [role=button], [role=menuitem], [role=menuitemradio], [role=option], [tabindex], summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:where(input, select, textarea):focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }

/* ───────────────────────────────────────────── 2. surfaces ───────────────────────────────────────────── */
/* GlassPanel: blur + see-through fill + a 1 px light rim + a soft shadow. .weak = the lighter fill, .flat = no shadow. */
.g-panel { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-rim); border-radius: var(--r-panel); box-shadow: var(--shadow-panel); }
.g-panel.weak { background: var(--glass); }
.g-panel.flat { box-shadow: none; }
/* ReaderBarGlass: 35 % see-through, a liquid edge bright at the top and the bottom, a thin dark line inside, a sheen
   over the top half. For tool bars, pop-ups and menus. */
.g-bar { position: relative; isolation: isolate; border-radius: 20px;
  background: linear-gradient(color-mix(in srgb, var(--accent) 4%, transparent), color-mix(in srgb, var(--accent) 4%, transparent)), color-mix(in srgb, var(--panel) 72%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(26px); backdrop-filter: saturate(1.8) blur(26px);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .06), var(--shadow-pop); }
.g-bar::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, var(--sheen), transparent 50%); }
.g-bar::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.4px; pointer-events: none;
  background: conic-gradient(from 0deg, rgba(255, 255, 255, .95) 0, rgba(255, 255, 255, .30) 20%, rgba(255, 255, 255, .85) 38%, rgba(255, 255, 255, .25) 55%, rgba(255, 255, 255, .90) 75%, rgba(255, 255, 255, .30) 90%, rgba(255, 255, 255, .95) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
[data-theme=dark] .g-bar { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), var(--shadow-pop);
  background: linear-gradient(color-mix(in srgb, var(--accent) 8%, transparent), color-mix(in srgb, var(--accent) 8%, transparent)), color-mix(in srgb, var(--panel) 78%, transparent); }
[data-theme=dark] .g-bar::after { background: conic-gradient(from 0deg, rgba(255, 255, 255, .55) 0, rgba(255, 255, 255, .10) 20%, rgba(255, 255, 255, .45) 38%, rgba(255, 255, 255, .08) 55%, rgba(255, 255, 255, .50) 75%, rgba(255, 255, 255, .10) 90%, rgba(255, 255, 255, .55) 100%); }
/* HeaderGlass: the frosted strip a list scrolls under (a pinned header, the top bar). */
.g-head { background: color-mix(in srgb, var(--bg) 55%, var(--glass)); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-edge); box-shadow: 0 4px 20px rgba(0, 0, 0, .07); }
/* PillGlass: a frosted capsule with a light edge. */
.g-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid color-mix(in srgb, #fff 55%, transparent); box-shadow: 0 2px 12px rgba(0, 0, 0, .10); }
[data-theme=dark] .g-pill { border-color: rgba(255, 255, 255, .12); }

/* ───────────────────────────────────────────── 3. buttons ───────────────────────────────────────────── */
/* KiQTile. Plain = tinted glass with accent words; .primary = the accent gradient with white words. A curved sheen over
   the top half (::before), a rim lighter at the top (::after), a soft coloured shadow. --h is its height: corners 0.28 of it.
   .btn (primary) and .btn.ghost (plain) are the same tile under their older names. */
.g-tile, .btn { --h: 36px; --tile: var(--accent); position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h); padding: 0 14px; border: 0; border-radius: calc(var(--h) * .28); font: 600 13px/1 var(--font-ui); letter-spacing: 0; white-space: nowrap; text-decoration: none; cursor: pointer;
  color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 8%, transparent), color-mix(in srgb, var(--tile) 16%, transparent)), var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--tile) 18%, transparent);
  transition: transform var(--t-back) var(--spring), filter .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; }
.g-tile::before, .btn::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, var(--sheen), rgba(255, 255, 255, .02) 54%, transparent 54%); clip-path: ellipse(62.5% 31% at 50% 23%); }
.g-tile::after, .btn::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .08) 50%, color-mix(in srgb, var(--tile) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
[data-theme=dark] :is(.g-tile, .btn) { background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 16%, transparent), color-mix(in srgb, var(--tile) 26%, transparent)), var(--glass); }
.g-tile.primary, .btn:where(:not(.ghost)) { --tile: #4C5BD4; color: #fff; background: linear-gradient(180deg, var(--accent-top), #4C5BD4);
  -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 3px 12px rgba(76, 91, 212, .45); }
.g-tile.primary::before, .btn:where(:not(.ghost))::before { background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .02) 54%, transparent 54%); }
.g-tile.primary::after, .btn:where(:not(.ghost))::after { background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .08) 50%, rgba(76, 91, 212, .45)); }
.g-tile.sm, .btn.sm { --h: 30px; padding: 0 11px; font-size: 12.5px; }
.g-tile.square { width: var(--h); padding: 0; }
.g-tile.wide { display: flex; width: 100%; padding: 0 4px; }
/* a tile that deletes: red words on red-tinted glass; primary: a red fill */
.g-tile.danger, .btn.ghost.danger { --tile: #DC2626; color: #DC2626; }
[data-theme=dark] :is(.g-tile.danger, .btn.ghost.danger) { color: #ff8a8a; }
.g-tile.primary.danger, .btn.danger:where(:not(.ghost)) { --tile: #DC2626; color: #fff; background: linear-gradient(180deg, #F26464, #DC2626); box-shadow: 0 3px 12px rgba(220, 38, 38, .40); }
:is(.g-tile, .btn):hover { filter: brightness(1.04); }
:is(.g-tile, .btn):disabled, :is(.g-tile, .btn)[aria-disabled=true] { opacity: .5; cursor: default; filter: none; }
/* the press: it sinks in (smaller, a little lower, a touch darker) and springs back when let go */
:is(.g-tile, .btn, .g-glassbtn, .icon-btn, .g-round):active:not(:disabled) { transform: translateY(1px) scale(.95); filter: brightness(.94); transition-duration: var(--t-press); transition-timing-function: ease-out; }
:is(.g-liquid, .g-tile.square):active:not(:disabled) { transform: translateY(3px) scale(.86); filter: brightness(.94); transition-duration: var(--t-press); transition-timing-function: ease-out; }

/* The top bar's buttons (New message, +, KiQ AI): 36 high, rounded 10, a colour gradient, a light rim at the top, a soft
   glow of its colour. .glass = the see-through KiQ 3D glass of the phone's big +. */
.g-liquid { --fill: linear-gradient(135deg, #6170F2, #4C5BD4); --glow: rgba(76, 91, 212, .40); position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border: 0; border-radius: 10px; font: 600 13.5px/1 var(--font-ui); letter-spacing: 0; white-space: nowrap; color: #fff; cursor: pointer; text-decoration: none;
  background: var(--fill); box-shadow: 0 3px 18px var(--glow); transition: transform var(--t-back) var(--spring), filter .2s; -webkit-tap-highlight-color: transparent; flex: none; }
.g-liquid::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 50%, rgba(0, 0, 0, .10));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.g-liquid.square { width: 36px; padding: 0; }
.g-liquid.ai { --fill: var(--ai); --glow: var(--ai-glow); padding: 0 12px; gap: 6px; }
.g-liquid.ai.plus { --fill: var(--ai-plus); --glow: var(--ai-plus-glow); }
.g-liquid:hover { filter: brightness(1.06); }
.g-liquid.glass { background: linear-gradient(135deg, rgba(129, 140, 248, .80), rgba(124, 58, 237, .72)), rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: inset 0 -3px 5px -2px rgba(255, 255, 255, .55), inset 0 2px 3px -1px rgba(255, 255, 255, .75), 0 8px 16px rgba(99, 102, 241, .50), 0 1px 2px rgba(0, 0, 0, .15); }
.g-liquid.glass::after { background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .18) 50%, rgba(255, 255, 255, .55)); }

/* The reader's glass tool (MacGlass): a small frosted button whose rim and hover take its tool's colour (--tint).
   With words or .square (an icon alone). .icon-btn is the same button under its older name. */
.g-glassbtn, .icon-btn { --tint: var(--accent); position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none;
  height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-tool); font: 600 13px/1 var(--font-ui); letter-spacing: 0; white-space: nowrap; color: var(--ink); cursor: pointer; text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .15)), var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06); transition: transform var(--t-back) var(--spring), box-shadow .18s, background-color .18s, filter .2s; -webkit-tap-highlight-color: transparent; }
.g-glassbtn::after, .icon-btn::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), color-mix(in srgb, var(--tint) 14%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; transition: background .18s; }
.g-glassbtn.square, .icon-btn { width: 32px; padding: 0; }
[data-theme=dark] :is(.g-glassbtn, .icon-btn) { background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .02)), var(--glass); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
[data-theme=dark] :is(.g-glassbtn, .icon-btn)::after { background: linear-gradient(180deg, rgba(255, 255, 255, .20), color-mix(in srgb, var(--tint) 14%, transparent)); }
@media (hover: hover) {
  :is(.g-glassbtn, .icon-btn):hover:not(:disabled) { background-color: color-mix(in srgb, var(--tint) 14%, transparent); transform: scale(1.035);
    box-shadow: 0 3px 20px color-mix(in srgb, var(--tint) 38%, transparent), 0 1px 4px rgba(0, 0, 0, .06); }
  :is(.g-glassbtn, .icon-btn):hover:not(:disabled)::after { background: linear-gradient(180deg, rgba(255, 255, 255, .95), color-mix(in srgb, var(--tint) 60%, transparent)); }
  [data-theme=dark] :is(.g-glassbtn, .icon-btn):hover:not(:disabled) { background-color: color-mix(in srgb, var(--tint) 22%, transparent); }
  [data-theme=dark] :is(.g-glassbtn, .icon-btn):hover:not(:disabled)::after { background: linear-gradient(180deg, rgba(255, 255, 255, .42), color-mix(in srgb, var(--tint) 60%, transparent)); }
}
:is(.g-glassbtn, .icon-btn).active { background-color: color-mix(in srgb, var(--tint) 18%, transparent); }
:is(.g-glassbtn, .icon-btn):disabled { opacity: .5; cursor: default; }
/* a round glass button (the list's refresh) */
.g-round { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border-radius: 50%; cursor: pointer; color: var(--ink);
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-rim);
  transition: transform var(--t-back) var(--spring), background-color .18s, filter .2s; -webkit-tap-highlight-color: transparent; }
.g-round:hover { background: var(--glass-strong); }

/* ───────────────────────────────────────────── 4. icons ───────────────────────────────────────────── */
/* A KiQ 3D glass icon (js/glass.js Ico): the app's own drawing as a picture, its light or dark version by the theme
   (--i / --id carry the two addresses; only the one in use is fetched), with the soft blue glow under it. --s = size. */
.g-ico { --s: 18px; display: inline-block; flex: none; width: var(--s); height: var(--s); vertical-align: middle;
  background: var(--i) center / contain no-repeat; filter: drop-shadow(0 calc(var(--s) / 16) calc(var(--s) / 12) var(--g3-glow)); }
[data-theme=dark] .g-ico { background-image: var(--id); }
.g-ico.flat { filter: none; }
/* a line mark (Fluent Regular): takes the words' colour */
.g-line { display: inline-block; flex: none; vertical-align: middle; fill: currentColor; overflow: visible; }
/* GlassTileIcon: a frosted rounded tile (white glass, smoked in dark mode, a whisper of --tint) with the icon on it */
.g-tileico { --s: 22px; --tint: #6366F1; position: relative; isolation: isolate; display: inline-grid; place-items: center; flex: none; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .28);
  background: linear-gradient(color-mix(in srgb, var(--tint) 8%, transparent), color-mix(in srgb, var(--tint) 8%, transparent)), linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .6));
  box-shadow: 0 calc(var(--s) * .06) calc(var(--s) * .24) rgba(0, 0, 0, .10), 0 calc(var(--s) * .1) calc(var(--s) * .4) color-mix(in srgb, var(--tint) 12%, transparent); }
.g-tileico::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .6), transparent 45%); clip-path: ellipse(55% 30% at 50% 8%); }
.g-tileico::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.g-tileico > .g-ico { --s: calc(var(--ts, 22px) * .74); }
[data-theme=dark] .g-tileico { background: linear-gradient(color-mix(in srgb, var(--tint) 16%, transparent), color-mix(in srgb, var(--tint) 16%, transparent)), linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05));
  box-shadow: 0 calc(var(--s) * .06) calc(var(--s) * .24) rgba(0, 0, 0, .40); }
[data-theme=dark] .g-tileico::before { background: linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 45%); }
[data-theme=dark] .g-tileico::after { background: linear-gradient(180deg, rgba(255, 255, 255, .32), rgba(255, 255, 255, .08)); }

/* ───────────────────────────────────────────── 5. pieces ───────────────────────────────────────────── */
/* THE menu (js/glass.js Menu): under a button or at the pointer; ↑ ↓ Enter Escape; a click outside closes it. Rows:
   .k-menu-item (.checked, .accent, .danger, .active = the row the keyboard is on), .k-menu-sep, .k-menu-header. */
.k-menu-backdrop { position: fixed; inset: 0; z-index: 90; }
.k-menu { position: fixed; z-index: 91; min-width: 220px; max-width: min(360px, calc(100vw - 16px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain;
  padding: 5px; border-radius: 14px; color: var(--ink); outline: none; isolation: isolate;
  /* drawn above the page (js/glass.js Above), so its blur sees what is behind it; still nearly solid, to stay readable */
  background: linear-gradient(180deg, var(--sheen), transparent 50%), color-mix(in srgb, var(--panel) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(26px); backdrop-filter: saturate(1.8) blur(26px);
  border: 1px solid var(--glass-rim); box-shadow: 0 0 0 1px rgba(15, 23, 42, .07), var(--shadow-pop), 0 4px 12px -4px rgba(15, 23, 42, .12);
  animation: g-pop-in var(--t-pop-in) ease-out both; }
[data-theme=dark] .k-menu { box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), var(--shadow-pop); }
.k-menu-item { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 30px; padding: 0 8px 0 4px; border: 0; border-radius: 9px; background: none; color: inherit; font: inherit; font-size: 13.5px; text-align: left;
  cursor: default; white-space: nowrap; user-select: none; -webkit-user-select: none; }
.k-menu-item:hover, .k-menu-item.active, .k-menu-item:focus-visible { background: color-mix(in srgb, var(--accent) 14%, transparent); outline: none; }
.k-menu-item:has(small) { padding-top: 5px; padding-bottom: 5px; }
.k-menu-item.danger { color: #DC2626; } [data-theme=dark] .k-menu-item.danger { color: #ff8a8a; }
.k-menu-item[aria-disabled=true] { opacity: .45; pointer-events: none; }
.k-menu-check { width: 18px; flex: none; display: flex; justify-content: center; color: var(--accent); }
.k-menu-icon { width: 20px; flex: none; display: flex; justify-content: center; color: var(--muted); }
.k-menu-item.danger .k-menu-icon { color: inherit; }
.k-menu-icon .flip { display: flex; transform: scaleX(-1); }
.k-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.k-menu-label small { display: block; font-size: 11.5px; color: var(--muted); margin-top: -1px; overflow: hidden; text-overflow: ellipsis; }
.k-menu-item.accent .k-menu-label { color: var(--accent); font-weight: 600; }
.k-menu-item.accent .k-menu-label small { white-space: normal; font-weight: 400; }
.k-menu-key { flex: none; margin-left: 12px; font: 500 11.5px var(--font-ui); color: var(--muted); }
.k-menu-sub { color: var(--muted); display: flex; }
.k-menu-header { padding: 8px 10px 3px; font-size: 11px; font-weight: 650; letter-spacing: .02em; color: var(--muted); }
.k-menu-sep { height: 1px; background: var(--glass-edge); margin: 4px 8px; }

/* THE pop-up (js/glass.js Popup): a dim over the page and a glass card that fade in 0.2 s and out 0.16 s. Escape and a
   click outside close it; the keyboard stays inside. */
.g-scrim { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(15, 22, 41, .32);
  animation: g-fade-in var(--t-pop-in) ease-out both; }
[data-theme=dark] .g-scrim { background: rgba(0, 0, 0, .5); }
.g-pop { position: relative; isolation: isolate; width: min(420px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: auto; padding: 16px 18px 20px; border-radius: 20px; color: var(--ink); outline: none;
  /* nearly solid and no blur of its own: a blurred box would frame the "fixed" boxes drawn inside it (the big QR code) */
  background: linear-gradient(180deg, var(--sheen), transparent 40%), color-mix(in srgb, var(--panel) 95%, transparent);
  border: 1px solid var(--glass-rim); box-shadow: 0 24px 60px rgba(16, 24, 40, .25), inset 0 0 0 1px rgba(0, 0, 0, .04);
  animation: g-fade-in var(--t-pop-in) ease-out both; }
.g-scrim.closing, .g-scrim.closing .g-pop { animation: g-fade-out var(--t-pop-out) ease-in both; }
.g-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.g-pop-head b { font-size: 15px; color: var(--navy); }
.g-pop-close { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: -4px -6px -4px 0; padding: 0; border: 0; border-radius: 50%; background: var(--hover); color: var(--muted); cursor: pointer; }
.g-pop-close:hover { color: var(--ink); }
@keyframes g-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes g-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes g-pop-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* An address as a small pill (AddressPill): the name, or the address itself. Shown only, for now. */
.g-addr { display: inline-flex; align-items: center; max-width: 100%; height: 20px; padding: 0 8px; border-radius: 999px; font: 500 12px/1 var(--font-ui); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: color-mix(in srgb, var(--navy) 85%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--accent) 22%, transparent); }
.g-addr > span { overflow: hidden; text-overflow: ellipsis; }

/* The banner (Banner): a dark glass capsule at the bottom, with an icon and, when there is one, a button (Undo).
   .toast is the same capsule under its older name. */
.g-banner, .toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 40px));
  padding: 10px 16px; border-radius: 999px; font: 600 13.5px/1.3 var(--font-ui); color: #fff; background: rgba(15, 22, 41, .92);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 6px 28px rgba(0, 0, 0, .25);
  animation: g-banner-in .28s var(--spring) both; }
.g-banner-txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.g-banner-act { flex: none; margin: -3px -6px -3px 4px; padding: 5px 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.g-banner-act:hover { background: rgba(255, 255, 255, .26); }
@keyframes g-banner-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* KiQ AI's mark with its ring (AISparkle): three stars on a leaning ring; they turn while KiQ AI works (.busy). */
.kai-ring { display: inline-block; flex: none; vertical-align: middle; overflow: visible; }
.kai-ring .kr-orbit { fill: none; stroke: currentColor; stroke-opacity: .28; stroke-width: .8; }
.kai-ring .kr-star { fill: currentColor; transform-box: fill-box; transform-origin: center; }
.kai-ring.busy .kr-star { animation: kai-turn 1.8s linear infinite; }
.kai-ring.busy .kr-star:nth-of-type(2) { animation-delay: -.6s; }
.kai-ring.busy .kr-star:nth-of-type(3) { animation-delay: -1.2s; }
/* one turn round the ring (rx 2.8, ry 7.5): in front it is larger and brighter, behind smaller and fainter */
@keyframes kai-turn {
  0%    { transform: translate(0, 7.5px) scale(.85); opacity: .72; }
  12.5% { transform: translate(1.98px, 5.3px) scale(1.06); opacity: .92; }
  25%   { transform: translate(2.8px, 0) scale(1.15); opacity: 1; }
  37.5% { transform: translate(1.98px, -5.3px) scale(1.06); opacity: .92; }
  50%   { transform: translate(0, -7.5px) scale(.85); opacity: .72; }
  62.5% { transform: translate(-1.98px, -5.3px) scale(.64); opacity: .53; }
  75%   { transform: translate(-2.8px, 0) scale(.55); opacity: .45; }
  87.5% { transform: translate(-1.98px, 5.3px) scale(.64); opacity: .53; }
  100%  { transform: translate(0, 7.5px) scale(.85); opacity: .72; }
}
/* a KiQ AI picture (the app mark) with a ring of light turning round it while KiQ AI works */
.kai-halo { position: relative; display: inline-grid; place-items: center; flex: none; }
.kai-halo.busy::after { content: ''; position: absolute; inset: -3px; border-radius: 34%; padding: 2px; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 55%, #fff 80%, #DB2777 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: kai-halo-turn 1.8s linear infinite; }
@keyframes kai-halo-turn { to { transform: rotate(360deg); } }

/* An empty state: a big 3D glass icon (64) over the words. */
.g-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 20px; text-align: center; color: var(--muted); }
.g-empty b { font-size: 15px; font-weight: 600; color: var(--navy); }
.g-empty .g-ico { --s: 64px; }

/* A sender's face (Avatar): the initials on their colour's gradient with a light ring; a photo fills the circle; a logo
   with a ground of its own fills it too (--c = that ground); a logo on white stays a softly rounded square. --s = size. */
.ava { --s: 42px; --c: #4C5BD4; position: relative; display: inline-grid; place-items: center; flex: none; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden;
  font: 600 calc(var(--s) * .38)/1 var(--font-ui); letter-spacing: 0; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.ava.ava-img { object-fit: cover; background: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.ava .ava-logo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s; }
.ava .ava-logo.on { opacity: 1; }
.ava.logo-fill { background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); color: transparent; }
.ava.logo-fill .ava-logo { inset: 5%; width: 90%; height: 90%; }
.ava.logo-cover { background: none; color: transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.ava.logo-cover .ava-logo { object-fit: cover; }
.ava.logo-plain { background: #fff; color: transparent; border-radius: 20%; box-shadow: none; }

/* ───────────────────────────────────────────── motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  :is(.g-tile, .btn, .g-glassbtn, .icon-btn, .g-liquid, .g-round) { transition: none; }
  :is(.g-tile, .btn, .g-glassbtn, .icon-btn, .g-liquid, .g-round):active:not(:disabled), :is(.g-glassbtn, .icon-btn):hover:not(:disabled) { transform: none; }
  .k-menu, .g-scrim, .g-pop, .g-banner, .toast, .g-scrim.closing, .g-scrim.closing .g-pop { animation: none; }
  .kai-ring.busy .kr-star, .kai-halo.busy::after { animation: none; }
}
