/* Wivrix Cloud app shell. Same tokens and controls as the Notes app (site/apps/notes). */
:root {
  color-scheme: light;
  --canvas: #f6f7fb; --surface: #ffffff; --surface-sunk: #f2f4f9; --surface-hover: #eef1f7;
  --ink: #0f1424; --ink-soft: #2e3548; --ink-muted: #475069; --ink-faint: #5f6680;
  --line: #e4e7ef; --line-strong: #cdd2df;
  --danger: #b91c1c; --danger-tint: #fdecec; --ok: #15803d; --ok-tint: #e7f6ec; --warn: #a16207; --warn-tint: #fdf6e3;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 12px 32px -12px rgba(16,24,40,.12);
  --shadow-lift: 0 1px 2px rgba(16,24,40,.05), 0 16px 36px -14px rgba(16,24,40,.22);
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-ui: var(--font-sans);
  --fs-base: 15px;
  /* Type scale (4 steps + big numbers), tied to the Text size setting. At the default 15px: 12 / 14 / 15 / 20, and 28. Nothing goes under 12px. */
  --fs-xs: max(12px, calc(var(--fs-base) * .8)); --fs-sm: calc(var(--fs-base) * .9333); --fs-md: var(--fs-base); --fs-lg: calc(var(--fs-base) * 1.3333); --fs-xl: calc(var(--fs-base) * 1.8667);
  /* Page side margin: one value per size. */
  --inset: 24px;
  --r: 10px; --r-lg: 14px; --r-pill: 999px;
  --pad: 12px; --row: 40px; --bar-h: 52px;
  --side-w: 300px;
  --dur: 150ms; --ease: cubic-bezier(.2,0,.2,1);
  /* accent (indigo default) */
  --accent: #4f46e5; --accent-strong: #4338ca; --accent-tint: #eef0ff; --accent-line: #c7d2fe; --on-accent: #fff;
}
[data-accent="blue"]   { --accent: #2563eb; --accent-strong: #1d4ed8; --accent-tint: #eaf1ff; --accent-line: #bfd3fe; }
[data-accent="teal"]   { --accent: #0d9488; --accent-strong: #0f766e; --accent-tint: #e6f7f5; --accent-line: #a7e3dc; }
[data-accent="green"]  { --accent: #16a34a; --accent-strong: #15803d; --accent-tint: #e8f7ee; --accent-line: #b5e5c6; }
[data-accent="amber"]  { --accent: #d97706; --accent-strong: #b45309; --accent-tint: #fdf3e2; --accent-line: #f6d49c; }
[data-accent="orange"] { --accent: #ea580c; --accent-strong: #c2410c; --accent-tint: #fdeee5; --accent-line: #f8c6a6; }
[data-accent="rose"]   { --accent: #e11d48; --accent-strong: #be123c; --accent-tint: #fdebef; --accent-line: #f8b9c7; }
[data-accent="violet"] { --accent: #7c3aed; --accent-strong: #6d28d9; --accent-tint: #f2ecfe; --accent-line: #d4c2fb; }
[data-accent="slate"]  { --accent: #475569; --accent-strong: #334155; --accent-tint: #eef1f5; --accent-line: #cbd3de; }
[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0b0e17; --surface: #121625; --surface-sunk: #181d2f; --surface-hover: #1d2236;
  --ink: #e9ecf5; --ink-soft: #cfd4e2; --ink-muted: #aab1c6; --ink-faint: #8b93ab;
  --line: #232a3e; --line-strong: #323a53;
  --danger: #f87171; --danger-tint: #3a1d24; --ok: #4ade80; --ok-tint: #15291f; --warn: #fbbf24; --warn-tint: #33290f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.5);
  --shadow-lift: 0 1px 2px rgba(0,0,0,.35), 0 16px 36px -14px rgba(0,0,0,.65);
  --accent: #818cf8; --accent-strong: #a5b4fc; --accent-tint: #252b55; --accent-line: #353b7a; --on-accent: #0b0e17;
}
[data-theme="dark"][data-accent="blue"]   { --accent: #60a5fa; --accent-strong: #93c5fd; --accent-tint: #1b2b4a; --accent-line: #27406b; }
[data-theme="dark"][data-accent="teal"]   { --accent: #2dd4bf; --accent-strong: #5eead4; --accent-tint: #12302e; --accent-line: #1d4a46; }
[data-theme="dark"][data-accent="green"]  { --accent: #4ade80; --accent-strong: #86efac; --accent-tint: #142d1e; --accent-line: #1f4a30; }
[data-theme="dark"][data-accent="amber"]  { --accent: #fbbf24; --accent-strong: #fcd34d; --accent-tint: #33290f; --accent-line: #57431a; }
[data-theme="dark"][data-accent="orange"] { --accent: #fb923c; --accent-strong: #fdba74; --accent-tint: #3a2214; --accent-line: #5e3720; }
[data-theme="dark"][data-accent="rose"]   { --accent: #fb7185; --accent-strong: #fda4af; --accent-tint: #3a1a24; --accent-line: #5e2838; }
[data-theme="dark"][data-accent="violet"] { --accent: #a78bfa; --accent-strong: #c4b5fd; --accent-tint: #2a2050; --accent-line: #41337a; }
[data-theme="dark"][data-accent="slate"]  { --accent: #94a3b8; --accent-strong: #cbd5e1; --accent-tint: #1f2635; --accent-line: #334055; }
[data-density="compact"] { --pad: 8px; --row: 34px; --bar-h: 46px; }
[data-corners="soft"] { --r: 6px; --r-lg: 8px; }
[data-corners="square"] { --r: 2px; --r-lg: 3px; --r-pill: 3px; }
[data-sidew="narrow"] { --side-w: 260px; }
[data-sidew="wide"] { --side-w: 360px; }
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
body.wx {
  background: var(--surface); color: var(--ink);
  font-family: var(--font-ui); font-size: var(--fs-base); line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; overflow: hidden;
}
/* Pinch-zoom: unlock document scroll so the visual viewport can be dragged around.
   (overflow:hidden on body otherwise clips the zoomed page and blocks pan.) */
html.wx-zoomed,
html.wx-zoomed body.wx {
  overflow: auto !important;
  height: auto;
  min-height: 100%;
  overscroll-behavior: auto;
  touch-action: pan-x pan-y pinch-zoom;
}
html.wx-zoomed .wx-frame,
html.wx-zoomed .wx-app,
html.wx-zoomed .wx-main,
html.wx-zoomed .wx-side {
  height: auto;
  min-height: 0;
  overflow: visible;
}
html.wx-zoomed .wx-frame { min-height: 100dvh; }
html.wx-zoomed .wx-app { min-height: calc(100dvh - var(--bar-h)); }
html.wx-zoomed .wx-content,
html.wx-zoomed .wx-side-body {
  overflow: visible !important;
  overscroll-behavior: auto;
}
/* Form controls normally capture drags (caret / text select). When zoomed, treat
   those touches as viewport pans so dragging from an input still moves the UI. */
html.wx-zoomed input,
html.wx-zoomed textarea,
html.wx-zoomed select,
html.wx-zoomed [contenteditable],
html.wx-zoomed [contenteditable="true"] {
  touch-action: pan-x pan-y pinch-zoom;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wx-skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r); }
.wx-skip:focus { left: 8px; }
.wx-ico { width: 20px; height: 20px; flex: none; }
.wx-ico-sm { width: 16px; height: 16px; }
.mono { font-family: var(--font-mono); }

/* ---- layout ---- */
.wx-frame { display: flex; flex-direction: column; height: 100dvh; width: 100%; }
[data-bar="bottom"] .wx-frame { flex-direction: column-reverse; }
.wx-app { display: flex; flex: 1; min-height: 0; width: 100%; }
[data-side="right"] .wx-app { flex-direction: row-reverse; }
.wx-side {
  width: var(--side-w); flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-sunk); border-right: 1px solid var(--line);
}
[data-side="right"] .wx-side { border-right: 0; border-left: 1px solid var(--line); }
.wx-side-top { display: flex; align-items: center; gap: 10px; height: var(--bar-h); padding: 0 8px 0 14px; flex: none; }
.wx-side-top h2 { font-size: 1em; font-weight: 650; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-side-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--tool, var(--accent)); flex: none; }
.wx-side-ico .wx-ico { width: 16px; height: 16px; }
.wx-side-actions { display: flex; gap: 2px; }
.wx-side-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: auto; -webkit-overflow-scrolling: touch; }
.wx-side-foot { display: flex; align-items: center; gap: 4px; padding: 8px; border-top: 1px solid var(--line); flex: none; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.wx-brand { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 36px; padding: 0 8px; border-radius: var(--r); font-weight: 650; font-size: var(--fs-sm); color: var(--ink); text-align: left; }
.wx-brand span { flex: 1; }
.wx-brand:hover { background: var(--surface-hover); }
.wx-brand .wx-ico-sm { color: var(--ink-faint); }
.wx-mark { width: 22px; height: 22px; flex: none; }

.wx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.wx-bar {
  display: flex; align-items: center; gap: 6px; height: var(--bar-h); padding: 0 8px 0 14px; flex: none;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.wx-title { font-size: 1em; font-weight: 650; letter-spacing: -.01em; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-bar-tools, .wx-bar-end { display: flex; align-items: center; gap: 2px; flex: none; }
.wx-bar-end { padding-left: 4px; }
.wx-content { flex: 1; min-height: 0; overflow: auto; position: relative; overscroll-behavior-y: auto; -webkit-overflow-scrolling: touch; }

/* Pull-to-refresh affordance (touch). Fixed under the top bar. */
.wx-ptr {
  position: fixed; left: 0; right: 0; top: 0; z-index: 45;
  display: flex; justify-content: center; pointer-events: none;
  padding-top: calc(env(safe-area-inset-top) + 8px);
  transform: translateY(-120%);
  transition: transform 180ms var(--ease), opacity 180ms var(--ease);
  opacity: 0;
}
.wx-ptr.is-on { opacity: 1; transition: none; }
.wx-ptr.is-arm { opacity: 1; }
.wx-ptr-pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink-muted); font-size: var(--fs-sm); font-weight: 650;
  border: 1px solid var(--line); box-shadow: var(--shadow-lift);
}
.wx-ptr.is-ready .wx-ptr-pill { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint); }
.wx-ptr-ico { width: 18px; height: 18px; flex: none; transition: transform 160ms var(--ease); }
.wx-ptr.is-ready .wx-ptr-ico { transform: rotate(180deg); }
.wx-ptr.is-busy .wx-ptr-ico { animation: wxSpin 700ms linear infinite; transform: none; }
@keyframes wxSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .wx-ptr, .wx-ptr-ico { transition: none; }
  .wx-ptr.is-busy .wx-ptr-ico { animation: none; }
}

.wx-icon-btn {
  width: 36px; height: 36px; border-radius: var(--r); display: inline-grid; place-items: center; color: var(--ink-soft); flex: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.wx-icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.wx-icon-btn[aria-pressed="true"], .wx-icon-btn.is-on { background: var(--accent-tint); color: var(--accent); }
.wx-icon-btn:disabled { opacity: .4; cursor: default; background: none; }
.wx-moon { display: block; } .wx-sun { display: none; }
[data-theme="dark"] .wx-moon { display: none; } [data-theme="dark"] .wx-sun { display: block; }
.wx-credits { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-sunk); color: var(--ink-soft); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid var(--line); margin-right: 4px; }
.wx-credits .wx-ico { width: 16px; height: 16px; color: var(--warn); }
.wx-credits:hover { border-color: var(--line-strong); color: var(--ink); }
.wx-signin { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-pill); color: var(--accent); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; margin-right: 2px; }
.wx-signin:hover { background: var(--accent-tint); }
.wx-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: var(--fs-sm); margin-left: 4px; }
.wx-only-mobile { display: none; }

/* ---- controls (Notes .tool-btn family) ---- */
.wx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: var(--r); background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.wx-btn:hover { background: var(--accent-strong); }
.wx-btn .wx-ico { width: 18px; height: 18px; }
.wx-btn-2 { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.wx-btn-2:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.wx-btn-ghost { background: transparent; color: var(--ink-soft); }
.wx-btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.wx-btn-danger { background: var(--danger); color: #fff; }
.wx-btn-danger:hover { background: var(--danger); filter: brightness(.92); }
.wx-btn-sm { min-height: 32px; padding: 6px 12px; font-size: var(--fs-sm); }
.wx-btn:disabled { opacity: .5; cursor: default; }
.wx-input, .wx-select {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink); outline: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.wx-input:focus, .wx-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.wx-input::placeholder { color: var(--ink-faint); }
.wx-search { position: relative; }
.wx-search .wx-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-faint); pointer-events: none; }
.wx-search .wx-input { padding-left: 32px; min-height: 36px; background: var(--surface); }
.wx-field { display: grid; gap: 6px; }
.wx-field > label, .wx-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); }
.wx-help { font-size: var(--fs-xs); color: var(--ink-faint); }
.wx-error { font-size: var(--fs-sm); color: var(--danger); }
.wx-field-err { margin: 6px 0 0; }
.wx-input[aria-invalid="true"], .wx-select[aria-invalid="true"] { border-color: var(--danger); }
.wx-seg { display: flex; padding: 3px; gap: 2px; background: var(--surface-sunk); border-radius: calc(var(--r) + 2px); border: 1px solid var(--line); }
.wx-seg button { flex: 1; min-height: 32px; padding: 4px 10px; border-radius: calc(var(--r) - 2px); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-muted); white-space: nowrap; }
.wx-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .wx-seg button[aria-pressed="true"] { background: var(--surface-hover); }
.wx-switch { position: relative; width: 40px; height: 24px; border-radius: 99px; background: var(--line-strong); flex: none; transition: background-color var(--dur) var(--ease); }
.wx-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--dur) var(--ease); }
.wx-switch[aria-checked="true"] { background: var(--accent); }
.wx-switch[aria-checked="true"]::after { transform: translateX(16px); }
.wx-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 650; background: var(--surface-sunk); color: var(--ink-muted); border: 1px solid var(--line); white-space: nowrap; }
.wx-tag-accent { background: var(--accent-tint); color: var(--accent); border-color: var(--accent-line); }
.wx-tag-ok { background: var(--ok-tint); color: var(--ok); border-color: transparent; }
.wx-tag-warn { background: var(--warn-tint); color: var(--warn); border-color: transparent; }
.wx-note { padding: 10px 12px; border-radius: var(--r); background: var(--surface-sunk); color: var(--ink-muted); font-size: var(--fs-sm); }
.wx-note-warn { background: var(--warn-tint); color: var(--warn); }
.wx-note-err { background: var(--danger-tint); color: var(--danger); }

/* ---- sheets (Notes settings look) ---- */
.wx-sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(15,20,36,.38); display: grid; place-items: center; padding: 24px; animation: wxFade var(--dur) var(--ease); }
[data-theme="dark"] .wx-sheet-back { background: rgba(0,0,0,.55); }
.wx-sheet { width: min(560px, 100%); max-height: min(86dvh, 820px); display: flex; flex-direction: column; background: var(--surface-sunk); border-radius: 18px; box-shadow: var(--shadow-lift); overflow: hidden; animation: wxRise 180ms var(--ease); }
.wx-sheet-wide { width: min(760px, 100%); }
.wx-sheet-head { display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; height: 56px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.wx-sheet-head h3 { text-align: center; font-size: var(--fs-md); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-sheet-done { justify-self: end; color: var(--accent); font-weight: 650; padding: 6px 8px; border-radius: 8px; }
.wx-sheet-done:hover { background: var(--accent-tint); }
.wx-sheet-body { overflow-y: auto; padding: 4px 16px 24px; overscroll-behavior: contain; }
.wx-sec { margin-top: 18px; }
.wx-sec-title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin: 0 4px 8px; }
.wx-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.wx-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; width: 100%; text-align: left; color: var(--ink); text-decoration: none; }
.wx-row + .wx-row, .wx-row + .wx-block, .wx-block + .wx-row, .wx-block + .wx-block { border-top: 1px solid var(--line); }
button.wx-row:hover, a.wx-row:hover { background: var(--surface-hover); }
.wx-row-main { flex: 1; min-width: 0; }
.wx-row-label { display: block; font-weight: 550; font-size: var(--fs-sm); }
.wx-row-desc { display: block; font-size: var(--fs-xs); color: var(--ink-faint); margin-top: 1px; }
.wx-row-val { color: var(--ink-muted); font-size: var(--fs-sm); white-space: nowrap; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.wx-row-chev { width: 16px; height: 16px; color: var(--ink-faint); flex: none; }
.wx-row-danger .wx-row-label { color: var(--danger); }
.wx-row-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--tool, var(--accent)); flex: none; }
.wx-row-ico .wx-ico { width: 17px; height: 17px; }
.wx-block { padding: 12px 14px; display: grid; gap: 10px; }
.wx-block .wx-row-label { margin-bottom: 0; }
.wx-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.wx-swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--sw); position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.wx-swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--sw); }
.wx-check { width: 20px; height: 20px; color: var(--accent); flex: none; }
.wx-order { display: flex; gap: 2px; }
.wx-order .wx-icon-btn { width: 30px; height: 30px; }
.wx-drag { cursor: grab; color: var(--ink-faint); width: 18px; height: 18px; flex: none; }
.wx-row.is-dragging { opacity: .5; }
.wx-row.is-over { box-shadow: inset 0 2px 0 var(--accent); }
.wx-font-sample { font-size: var(--fs-md); }

/* ---- menus, toast ---- */
.wx-menu { position: fixed; z-index: 60; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lift); animation: wxFade 120ms var(--ease); }
.wx-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.wx-menu-head strong { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; }
.wx-menu-head span { font-size: var(--fs-xs); color: var(--ink-faint); }
.wx-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--ink); text-decoration: none; font-size: var(--fs-sm); }
.wx-menu-item:hover, .wx-menu-item:focus-visible { background: var(--surface-hover); outline: none; }
.wx-menu-item .wx-ico { width: 18px; height: 18px; color: var(--ink-muted); }
.wx-menu-item.is-danger, .wx-menu-item.is-danger .wx-ico { color: var(--danger); }
.wx-menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.wx-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; max-width: min(460px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); font-size: var(--fs-sm); font-weight: 550; box-shadow: var(--shadow-lift); animation: wxRise 160ms var(--ease); }
[data-bar="bottom"] .wx-toast { bottom: calc(var(--bar-h) + 24px + env(safe-area-inset-bottom)); }

/* ---- empty state ---- */
.wx-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 24px; color: var(--ink-muted); }
.wx-empty-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); }
.wx-empty-ico .wx-ico { width: 26px; height: 26px; }
.wx-empty h2 { font-size: var(--fs-lg); color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
.wx-empty p { max-width: 380px; font-size: var(--fs-sm); }

/* ---- launcher sheet ---- */
.wx-launch { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; padding: 14px 0 4px; }
.wx-launch-item { display: grid; justify-items: center; gap: 8px; padding: 14px 6px 12px; border-radius: var(--r-lg); color: var(--ink); text-decoration: none; text-align: center; font-size: var(--fs-sm); font-weight: 550; position: relative; }
.wx-launch-item:hover { background: var(--surface); }
.wx-launch-item.is-current { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.wx-launch-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--tool, var(--accent)); box-shadow: 0 6px 14px -8px var(--tool, var(--accent)); }
.wx-launch-ico .wx-ico { width: 24px; height: 24px; }
.wx-launch-classic { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }

@keyframes wxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wxRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- mobile ---- */
@media (max-width: 760px) {
  .wx-only-mobile { display: inline-grid; }
  .wx-only-desktop { display: none !important; }
  .wx-side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(86vw, 340px); transform: translateX(-102%); transition: transform 200ms var(--ease); box-shadow: var(--shadow-lift); }
  [data-side="right"] .wx-side { left: auto; right: 0; transform: translateX(102%); }
  .wx-app.is-drawer .wx-side { transform: none; }
  .wx-drawer-back { position: fixed; inset: 0; z-index: 39; background: rgba(15,20,36,.38); }
  .wx-bar { padding-left: 4px; }
  .wx-credits { padding: 0 8px; }
  .wx-sheet-back { padding: 0; place-items: end stretch; }
  .wx-sheet { width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  .wx-sheet-body { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .wx-launch { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
@media (max-width: 760px) { #wxMenuBtn.is-hidden-by-back { display: none; } }
.wx-sheet-head [data-back][hidden] { display: inline-grid !important; visibility: hidden; }
.wx-mytools .wx-row-label .wx-tag { margin-left: 6px; vertical-align: 1px; }
@media (max-width: 760px) {
  .wx-mytools .wx-row { gap: 8px; padding: 10px 10px; }
  .wx-mytools .wx-row-desc { display: none; }
  .wx-mytools .wx-row-ico { width: 28px; height: 28px; }
  .wx-mytools .wx-drag { display: none; }
}

/* Shared helpers for tool apps (same as Temp mail's, so every tool can use them). */
.mx-full { width: 100%; }
.mx-loading { padding: 32px; color: var(--ink-faint); text-align: center; }
.mx-danger { color: var(--danger) !important; }
.mx-link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.mx-name-row { display: flex; align-items: center; gap: 6px; }
.mx-name-row .wx-input { flex: 1; min-width: 0; }
.mx-name-row .wx-select { width: auto; max-width: 48%; }
.mx-at { color: var(--ink-faint); font-weight: 600; }
.mx-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mx-inline .wx-input { flex: 1; min-width: 140px; }
.mx-check { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.mx-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.mx-share-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mx-nowrap { flex-wrap: nowrap; flex-shrink: 0; }
.wx-help.is-ok { color: var(--ok); }
@media (max-width: 520px) {
  .mx-share-row { flex-wrap: wrap; }
  .mx-name-row { flex-wrap: wrap; }
  .mx-name-row > .wx-input { flex: 1 1 100%; min-width: 0; }
  .mx-name-row > .wx-select { flex: 1 1 0; min-width: 0; max-width: none; }
}

/* Menu backdrop: catches every tap outside an open menu (also over iframes). */
.wx-menu-backdrop { position: fixed; inset: 0; z-index: 59; background: transparent; touch-action: none; -webkit-tap-highlight-color: transparent; }
/* Official Wivrix mark */
img.wx-mark { width: 22px; height: 22px; object-fit: contain; flex: none; }
.wx-side-logo { width: 30px; height: 30px; object-fit: contain; flex: none; }
.wx-launch-logo { background: transparent !important; box-shadow: none; } .wx-launch-logo img { width: 100%; height: 100%; object-fit: contain; }
.wx-menu-check { width: 18px; height: 18px; display: grid; place-items: center; flex: none; color: var(--accent); }
.wx-menu-check .wx-ico { width: 16px; height: 16px; }
.wx-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-menu-meta { flex: none; margin-left: 12px; font-size: var(--fs-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.wx-menu-meta.is-accent { color: var(--on-accent); background: var(--accent); padding: 1px 7px; border-radius: 99px; font-weight: 650; }

/* ---- One top bar: menu · tool · settings · more ---- */
.wx-top { display: flex; align-items: center; gap: 4px; height: var(--bar-h); padding: 0 6px; padding-top: env(safe-area-inset-top); box-sizing: content-box; flex: none; background: var(--surface); border-bottom: 1px solid var(--line); }
[data-bar="bottom"] .wx-top { border-bottom: 0; border-top: 1px solid var(--line); padding-top: 0; padding-bottom: env(safe-area-inset-bottom); }
.wx-top-id { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 6px; margin-left: 2px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.wx-top-id:hover { background: var(--surface-hover); }
.wx-top-name { font-size: 1em; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-top-logo { width: 26px; height: 26px; object-fit: contain; flex: none; }
.wx-top .wx-side-ico { width: 26px; height: 26px; border-radius: 7px; }
.wx-top-fill { flex: 1; }
.wx-top-tools { display: flex; align-items: center; gap: 2px; }
.wx-top-tools:empty { display: none; }
.wx-quick { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: min(52vw, 560px); }
.wx-quick .wx-btn { white-space: nowrap; }
.wx-quick .wx-btn .wx-ico { width: 16px; height: 16px; }
.wx-only-mobile { display: none !important; }
.wx-bar.is-empty { height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; border: 0; overflow: hidden; }
.wx-bar { padding-left: 8px; }

/* Desktop: use the spare main-pane width; mobile keeps the tighter 760–820 caps. */
@media (min-width: 761px) {
  .mx-read, .sl-read, .wh-over, .em-pane, .sm-over, .sm-read,
  .cj-detail, .mn-detail, .mk-main, .qr-main, .ac-pane, .cr-pane {
    max-width: 1100px;
  }
}

/* ---- Cloud drawer ---- */
.wx-nav-back { position: fixed; inset: 0; z-index: 55; background: rgba(15,20,36,0); transition: background-color 180ms var(--ease); touch-action: none; -webkit-tap-highlight-color: transparent; }
.wx-nav-back.is-open { background: rgba(15,20,36,.38); }
[data-theme="dark"] .wx-nav-back.is-open { background: rgba(0,0,0,.55); }
.wx-nav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 56; width: min(86vw, 320px); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-lift); transform: translateX(-102%); transition: transform 200ms var(--ease); outline: none; padding-top: env(safe-area-inset-top); }
.wx-nav.is-open { transform: none; }
[data-motion="reduce"] .wx-nav, [data-motion="reduce"] .wx-nav-back { transition: none; }
.wx-nav-head { display: flex; align-items: center; gap: 6px; height: var(--bar-h); padding: 0 6px 0 10px; flex: none; border-bottom: 1px solid var(--line); }
.wx-nav-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; border-radius: var(--r); color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.wx-nav-brand img { width: 28px; height: 28px; object-fit: contain; flex: none; }
.wx-nav-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 12px; }
.wx-nav-promo { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; padding: 8px 10px; border-radius: var(--r); background: var(--accent-tint); color: var(--accent); font-size: var(--fs-sm); font-weight: 600; }
.wx-nav-promo-msg { flex: 1; min-width: 0; }
.wx-nav-promo .wx-btn { flex: none; }
.wx-nav-promo .wx-icon-btn { flex: none; color: var(--ink-faint); }
.wx-recaptcha-note { margin-top: 12px; }
/* Hide Google’s floating badge; disclosure lives in Help / auth foot notes (same as classic). */
.grecaptcha-badge { visibility: hidden !important; }
.wx-nav-acct { display: flex; align-items: center; gap: 12px; padding: 12px 8px 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.wx-nav-acct .wx-avatar { margin: 0; flex: none; width: 36px; height: 36px; }
.wx-nav-acct-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.wx-nav-acct-main strong { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-nav-acct-main a, .wx-nav-acct-main span { font-size: var(--fs-xs); color: var(--ink-faint); text-decoration: none; }
.wx-nav-acct-main a:hover { color: var(--accent); }
.wx-nav-title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); padding: 14px 8px 6px; }
.wx-nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 6px 8px; border-radius: var(--r); color: var(--ink); text-decoration: none; text-align: left; font-size: var(--fs-sm); font-weight: 500; }
.wx-nav-item:hover { background: var(--surface-hover); }
.wx-nav-item.is-current { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.wx-nav-item > .wx-ico { width: 18px; height: 18px; margin: 0 4px; color: var(--ink-muted); }
.wx-nav-item.is-danger, .wx-nav-item.is-danger .wx-ico { color: var(--danger); }
.wx-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-nav-meta { font-size: var(--fs-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.wx-nav-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--tool, var(--accent)); flex: none; }
.wx-nav-ico .wx-ico { width: 15px; height: 15px; }
.wx-nav-ico.is-logo { background: transparent; }
.wx-nav-ico.is-logo img { width: 26px; height: 26px; object-fit: contain; }
.wx-nav-foot { flex: none; padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .wx-frame.has-back .wx-top { display: none; }
  [data-tool="launcher"] .wx-side { display: none; }
  .wx-top { padding: 0 4px; padding-top: env(safe-area-inset-top); }
}
.wx-nav-item.is-classic::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: none; margin-right: 4px; }
.wx-nav-acct .wx-avatar { display: grid; place-items: center; font-size: var(--fs-sm); }

/* ================= Consistency layer (UI review Phase 1) ================= */
@media (max-width: 760px) { :root { --inset: 16px; } }

/* Drawer: legal links fold into one row; Sign out sits at the end of the list, never over settings. */
.wx-nav-group > summary { list-style: none; cursor: pointer; }
.wx-nav-group > summary::-webkit-details-marker { display: none; }
.wx-nav-item > .wx-nav-chev { width: 16px; height: 16px; margin: 0 2px 0 auto; color: var(--ink-faint); transition: transform var(--dur) var(--ease); }
.wx-nav-group[open] .wx-nav-chev { transform: rotate(90deg); }
.wx-nav-sub { display: grid; padding: 2px 0 6px 38px; }
.wx-nav-subitem { padding: 8px; border-radius: var(--r); color: var(--ink-muted); text-decoration: none; font-size: var(--fs-sm); }
.wx-nav-subitem:hover { background: var(--surface-hover); color: var(--ink); }
.wx-nav-subitem.is-current { color: var(--accent); font-weight: 600; }
.wx-nav-out { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

/* One empty state for every tool: icon tile, title, one sentence, one button, a quiet note. It lives in the main pane.
   The sidebar only says "No … yet."; on phones an empty list shows the main pane instead. */
.wx-empty { max-width: 520px; margin: 0 auto; padding: 56px var(--inset); gap: 12px; }
.wx-empty h2 { font-size: var(--fs-lg); line-height: 1.3; }
.wx-empty p { font-size: var(--fs-sm); max-width: 400px; }
.wx-empty .wx-help, .wx-empty p.wx-help { font-size: var(--fs-xs); color: var(--ink-faint); margin-top: 4px; }
.wx-empty > .wx-btn { width: auto; min-width: 180px; }
[data-empty-list] .wx-btn { display: none !important; }
:where([data-empty-list]) { padding: 12px var(--inset); color: var(--ink-faint); font-size: var(--fs-sm); }
:where([data-empty-list]) p { margin: 0; }
@media (max-width: 760px) {
  .wx-empty { padding: 40px var(--inset); }
  .wx-app.is-empty-list .wx-side { display: none !important; }
  .wx-app.is-empty-list .wx-main { display: flex !important; }
}

/* Styled controls instead of raw browser ones. */
.wx-select { -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.wx-select[multiple] { background-image: none; padding-right: 12px; }
.wx-app details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 40px; }
.wx-app details > summary::-webkit-details-marker { display: none; }
.wx-app details > summary::after, .wx-app details[open] > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin-left: auto; margin-right: 4px;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint); transform: rotate(-45deg); transition: transform var(--dur) var(--ease); }
.wx-app details[open] > summary::after { transform: rotate(45deg); }
.wx-app input[type="file"] { font-size: var(--fs-sm); color: var(--ink-muted); max-width: 100%; }
.wx-app input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 8px 14px; min-height: 40px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.wx-app input[type="file"]::file-selector-button:hover { background: var(--surface-hover); }
.wx-app input[type="color"] { -webkit-appearance: none; appearance: none; width: 44px; height: 40px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; flex: none; }
.wx-app input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.wx-app input[type="color"]::-webkit-color-swatch { border: 0; border-radius: calc(var(--r) - 4px); }
.wx-app input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }

/* Page tab strips fit at 390: labels only on phones (no icons), tighter gaps; if they still overflow, they scroll with a fade edge. */
@media (max-width: 760px) {
  .cr-tabs, .ac-tabs { gap: 18px; }
  .cr-tab .wx-ico, .ac-tab .wx-ico { display: none; }
  .cr-tabs.is-overflow, .ac-tabs.is-overflow { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
@media (min-width: 761px) {
  .sl-top, .wh-card.is-empty [data-new] { display: none !important; }
}

/* ---------- Phase 2: shared components ---------- */
:root { --hair: color-mix(in srgb, var(--line) 70%, transparent); --hair-soft: color-mix(in srgb, var(--line) 45%, transparent); --gold-1: #f2d98b; --gold-2: #c9973f; --gold-3: #f7e7b2; --gold-ink: #a87a26; }
[data-theme="dark"] { --gold-1: #e8c96a; --gold-2: #9c7124; --gold-3: #f1dc9a; --gold-ink: #e6c46a; }

/* Credits badge: one pill, coin + balance, thin gold edge. */
.wx-credits { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 8px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; width: max-content;
  border: 1px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(135deg, var(--gold-1), var(--gold-2) 45%, var(--gold-3) 72%, var(--gold-2)) border-box;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--gold-2) 18%, transparent); transition: box-shadow var(--dur) var(--ease); }
.wx-credits:hover { box-shadow: 0 2px 8px color-mix(in srgb, var(--gold-2) 30%, transparent); }
.wx-credits-ico { width: 16px; height: 16px; color: var(--gold-ink); flex: none; }
.wx-credits b { font-weight: 700; font-variant-numeric: tabular-nums; }
.wx-credits span { color: var(--ink-muted); font-weight: 500; }
.wx-credits-sm { height: 26px; font-size: var(--fs-xs); padding: 0 10px 0 7px; margin-top: 4px; }
.wx-credits-sm .wx-credits-ico { width: 14px; height: 14px; }
.wx-nav-acct-main a.wx-credits { color: var(--ink); font-size: var(--fs-xs); }
.wx-nav-acct-main a.wx-credits span { color: var(--ink-muted); }

/* Toast: ✓ for success, an action button for network errors. */
.wx-toast { display: flex; align-items: center; gap: 10px; }
.wx-toast[hidden] { display: none; }
.wx-toast-ico { width: 16px; height: 16px; flex: none; color: color-mix(in srgb, var(--ok) 70%, var(--surface)); }
.wx-toast-msg { min-width: 0; }
.wx-toast-act { flex: none; margin: -4px -6px -4px 4px; padding: 4px 10px; border-radius: 8px; font-weight: 700; color: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.wx-toast-act:hover { background: color-mix(in srgb, var(--surface) 14%, transparent); }

/* Confirm dialog (replaces window.confirm). */
.wx-confirm-back { position: fixed; inset: 0; z-index: 80; background: rgba(15,20,36,.42); display: grid; place-items: center; padding: 24px; animation: wxFade var(--dur) var(--ease); }
[data-theme="dark"] .wx-confirm-back { background: rgba(0,0,0,.6); }
.wx-confirm { width: min(400px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lift); padding: 22px 22px 18px; display: grid; gap: 8px; animation: wxRise 160ms var(--ease); outline: none; }
.wx-confirm h3 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
.wx-confirm-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.wx-confirm-msg { color: var(--ink-muted); font-size: var(--fs-sm); line-height: 1.5; }
.wx-confirm .wx-field { margin-top: 6px; }
.wx-confirm-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.wx-confirm-acts .wx-btn { min-width: 96px; }
@media (max-width: 760px) {
  .wx-confirm-back { place-items: end stretch; padding: 0; }
  .wx-confirm { width: 100%; border-radius: 18px 18px 0 0; padding: 22px var(--inset) max(18px, env(safe-area-inset-bottom)); }
  .wx-confirm-acts { flex-direction: column-reverse; }
  .wx-confirm-acts .wx-btn { width: 100%; }
}

/* Sheet forms: fields sit on the sheet (no card inside), Cancel on the left, the filled button pinned at the bottom. */
.wx-sheet.is-form { background: var(--surface); }
.wx-sheet.is-form .wx-sheet-body { padding: 0 20px 20px; }
.wx-sheet.is-form .wx-card { background: transparent; border: 0; border-radius: 0; overflow: visible; box-shadow: none; }
.wx-sheet.is-form .wx-block { padding: 14px 0; gap: 14px; }
.wx-sheet.is-form .wx-row { padding-left: 0; padding-right: 0; }
.wx-sheet.is-form .wx-sec { margin-top: 0; padding-top: 16px; }
.wx-sheet.is-form .wx-sec + .wx-sec { border-top: 1px solid var(--hair); margin-top: 8px; }
.wx-sheet.is-form .wx-sec-title { margin: 0 0 2px; }
.wx-sheet.is-form .wx-sec-foot { margin: 0; padding-bottom: 4px; }
.wx-sheet.is-form:not(.has-back) [data-back] { display: none !important; }
.wx-sheet.is-form:not(.has-back) [data-done] { grid-column: 1; grid-row: 1; justify-self: start; }
.wx-sheet.is-form:not(.has-back) .wx-sheet-head h3 { grid-column: 2; grid-row: 1; }
.wx-sheet.is-form [data-done] { color: var(--ink-muted); font-weight: 550; }
.wx-sheet.is-form .wx-block > .wx-btn:last-child:not(.wx-btn-2):not(.wx-btn-ghost):not(.wx-btn-sm):not(.wx-btn-danger),
.wx-sheet.is-form .wx-block > form > .wx-btn:last-child:not(.wx-btn-2):not(.wx-btn-ghost),
.wx-sheet.is-form .wx-block > .mx-inline:last-child { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 12px 0 var(--surface), 0 -14px 14px -2px var(--surface); }
.wx-sheet.is-form .wx-block > .mx-inline:last-child { background: var(--surface); padding-top: 4px; }

/* List rows: one inset, title + meta line, value or chevron on the right. Applied to every tool's sidebar list. */
.sl-item, .wh-item, .mn-item, .cj-item, .mk-item, .qr-item, .mx-item, .lx-row { --row-x: 12px; }
:where(.sl-item, .wh-item, .mn-item, .cj-item, .mk-item, .qr-item) { min-height: 56px; }
:where(.sl-item, .mn-item, .cj-item, .mk-item, .qr-item) strong, :where(.sl-item, .mn-item, .cj-item, .mk-item, .qr-item) b { font-weight: 600; }

/* Detail header: name, status chip, URL with copy, then key stats. */
.wx-dh { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.wx-dh-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wx-dh-top h2 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; min-width: 0; overflow-wrap: anywhere; }

/* Settings sheet: plain icons on the Cloud rows. */
.wx-row-ico-plain { background: var(--surface-sunk); color: var(--ink-soft); }
.wx-nav-item.is-quiet, .wx-nav-item.is-quiet .wx-ico { color: var(--ink-faint); }
.wx-nav-item.is-quiet:hover, .wx-nav-item.is-quiet:hover .wx-ico { color: var(--ink); }
/* A hidden error block at the top of a card doesn't draw a divider above the first field. */
.wx-card > [hidden]:first-child + .wx-block, .wx-card > [hidden]:first-child + .wx-row { border-top: 0; }
.wx-sheet.is-form .wx-block + .wx-block { border-top: 0; padding-top: 0; }

/* ---------- Phase 3: charts (inline SVG; colours follow theme and accent) ---------- */
.wx-chart { margin: 0; display: grid; gap: 6px; min-width: 0; }
.wx-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wx-chart-title { font-size: var(--fs-sm); font-weight: 650; color: var(--ink); }
.wx-chart-val { font-size: var(--fs-sm); font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.wx-chart-svg { display: block; width: 100%; height: 64px; overflow: visible; }
.wx-chart.is-strip .wx-chart-svg { height: 24px; }
.wx-chart-axis { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.wx-chart-sum { margin: 0; font-size: var(--fs-xs); color: var(--ink-muted); line-height: 1.45; }
.wx-chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--ink-muted); }
.wx-chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.wx-chart-legend i { width: 9px; height: 9px; border-radius: 2px; background: var(--accent); }
.wx-chart-legend i.c-ok { background: var(--ok); } .wx-chart-legend i.c-bad { background: var(--danger); } .wx-chart-legend i.c-warn { background: var(--warn); }
.wx-chart-legend i.c-soft { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.wx-chart rect.c-acc, .wx-hbar .c-acc { fill: var(--accent); }
.wx-chart rect.c-soft { fill: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.wx-chart rect.c-ok { fill: var(--ok); }
.wx-chart rect.c-bad { fill: var(--danger); }
.wx-chart rect.c-warn { fill: var(--warn); }
.wx-chart rect.c-none, .wx-chart rect.c-zero, .wx-hbar .c-track { fill: var(--line); }
.wx-chart rect:hover { opacity: .8; }
.wx-chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.wx-chart-area { fill: var(--accent); opacity: .1; }
.wx-chart.is-empty { gap: 8px; }
.wx-chart-none { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--ink-faint); font-size: var(--fs-sm); }
.wx-chart-none .wx-ico { width: 18px; height: 18px; flex: none; }
.wx-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wx-hbars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: var(--fs-sm); }
.wx-hbar-name { color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-hbar-val { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.wx-hbar { grid-column: 1 / -1; display: block; width: 100%; height: 6px; }
.wx-charge { font-size: var(--fs-xs); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
/* Low balance: the badge turns red when it won't cover the next charges. */
.wx-credits.is-low { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.wx-credits.is-low .wx-credits-ico, .wx-credits.is-low b { color: var(--danger); }
@media (prefers-reduced-motion: no-preference) { .wx-chart rect { transition: opacity .15s; } }
.wx-chart-val { white-space: nowrap; }
/* Phase 3 drawer: plain monochrome icons outside TOOLS; thin dividers between groups. */
.wx-nav-ico.is-plain { background: transparent; color: var(--ink-muted); }
.wx-nav-item.is-current .wx-nav-ico.is-plain { color: var(--accent); }
.wx-nav-body > .wx-nav-title { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
