/*
 * The website: home, download, docs, plans, account and admin.
 *
 * The colour tokens are frontend/taskpane.css's, copied value for value, so
 * the website, the Word task pane and the desktop app read as one product.
 * tests/unit/desktop-ui.test.ts fails if they drift apart, so the marketing
 * pieces (the hero, the bands) spell their colours out instead of adding
 * tokens. Copied rather than imported because the pane's stylesheet is laid
 * out for a 320px column inside Word; only its palette belongs here.
 */
:root {
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-pressed: #0c3b5e;
  --brand-tint: #eff6fc;
  --fg: #242424;
  --fg-secondary: #424242;
  --fg-muted: #616161;
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-hover: #f0f0f0;
  --border: #d1d1d1;
  --border-subtle: #e6e6e6;
  --danger-bg: #fdf3f4;
  --danger-border: #f3d6d8;
  --danger-fg: #a4262c;
  --warn-bg: #fff8e6;
  --warn-border: #f7e2b0;
  --warn-fg: #8a6100;
  --ok-bg: #eff6ef;
  --ok-border: #cfe4cf;
  --ok-fg: #0e700e;
  --radius: 4px;
  --radius-lg: 6px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #479ef5;
    --brand-hover: #62abf5;
    --brand-pressed: #2886de;
    --brand-tint: #0c2337;
    --fg: #ffffff;
    --fg-secondary: #d6d6d6;
    --fg-muted: #adadad;
    --bg: #1f1f1f;
    --bg-subtle: #272727;
    --bg-hover: #383838;
    --border: #484848;
    --border-subtle: #3d3d3d;
    --danger-bg: #3a2325;
    --danger-border: #5c3438;
    --danger-fg: #f1707b;
    --warn-bg: #3a2f16;
    --warn-border: #5c4a22;
    --warn-fg: #f0c674;
    --ok-bg: #1f3320;
    --ok-border: #34502f;
    --ok-fg: #6cc46c;
  }
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/inter.woff2") format("woff2");
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-subtle);
  color: var(--fg);
  font: 15px/1.6 "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.home { background: var(--bg); }


a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
code { font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; font-size: .92em; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--brand); color: #fff; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, .08);
}
.site-header-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--fg); text-decoration: none; flex-shrink: 0; }
.brand img { border-radius: 7px; }
.site-nav { display: flex; gap: 3px; flex: none; min-width: 0; margin-left: auto; }
.site-nav a, .header-link, .site-nav-menu summary { color: var(--fg-secondary); text-decoration: none; padding: 7px 10px; border-radius: 8px; font-weight: 550; font-size: 14px; white-space: nowrap; }
.site-nav a:hover, .header-link:hover, .site-nav-menu summary:hover { color: var(--fg); background: rgba(15, 23, 42, .05); }
.site-nav a[aria-current="page"], .header-link[aria-current="page"], .site-nav-menu summary[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }
.site-nav-menu { position: relative; flex: none; }
.site-nav-menu summary { display: block; cursor: pointer; list-style: none; }
.site-nav-menu summary::-webkit-details-marker { display: none; }
.site-nav-popover { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; display: none; min-width: 240px; padding: 7px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); box-shadow: 0 12px 32px rgba(16, 24, 40, .16); }
.site-nav-menu[open] .site-nav-popover { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; left: 50%; width: min(620px, calc(100vw - 32px)); transform: translateX(-50%); }
.site-nav-popover a { white-space: normal; }
.site-nav-group { display: grid; align-content: start; gap: 2px; }
.site-nav-heading { margin: 4px 10px 4px; color: var(--fg-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.site-nav-popover a.site-nav-all { grid-column: 1 / -1; margin-top: 4px; padding: 10px; border-top: 1px solid var(--border-subtle); border-radius: 0 0 8px 8px; color: var(--brand); font-weight: 600; }
@media (max-width: 760px) {
  .site-nav-popover { position: fixed; top: var(--site-header-height, 64px); left: 16px; right: 16px; min-width: 0; max-height: calc(100vh - var(--site-header-height, 64px) - 16px); overflow-y: auto; }
  .site-nav-menu[open] .site-nav-popover { grid-template-columns: minmax(0, 1fr); left: 16px; width: auto; transform: none; }
}
.site-nav-popover a { display: block; padding: 9px 10px; border-radius: 8px; }
.site-nav-popover a strong { display: block; color: var(--fg); font-weight: 600; }
.site-nav-popover a small { display: block; margin-top: 1px; color: var(--fg-muted); font-size: 12.5px; font-weight: 400; }
.site-nav-popover a:hover { background: var(--bg-hover); color: var(--fg); }
.home .site-nav-popover a { color: var(--fg); }
.home .site-nav-popover a.site-nav-all { color: var(--brand); }
.home .site-nav-popover a:hover { color: var(--fg); background: var(--bg-hover); }

.feature-guide { max-width: 960px; margin: 0 auto; padding: 52px 20px 80px; }
.feature-guide-head { margin-bottom: 28px; }
.feature-guide-head h1 { max-width: 20ch; margin: 0 0 12px; font-size: clamp(32px, 5vw, 48px); line-height: 1.08; letter-spacing: -.035em; }
.feature-guide-head > p:not(.eyebrow) { max-width: 64ch; margin: 0 0 20px; color: var(--fg-secondary); font-size: 17px; line-height: 1.6; }
.feature-guide-card { scroll-margin-top: 24px; margin: 16px 0; padding: 24px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); }
.feature-guide-card h2 { margin: 0 0 9px; font-size: 23px; letter-spacing: -.02em; }
.feature-guide-card p { max-width: 72ch; margin: 0 0 14px; color: var(--fg-secondary); line-height: 1.65; }
.feature-guide-card ol { padding-left: 22px; color: var(--fg-secondary); line-height: 1.7; }
.feature-guide-card li { padding-left: 3px; margin: 4px 0; }
.feature-try-link { display: inline-block; margin-top: 3px; color: var(--brand); font-weight: 650; text-decoration: none; }
.feature-try-link:hover { text-decoration: underline; }
.feature-guide-more { margin-top: 28px; color: var(--fg-secondary); }

.feature-detail { max-width: 1120px; margin: 0 auto; padding: 28px 24px 76px; }
.feature-breadcrumb { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--fg-muted); font-size: 13px; }
.feature-breadcrumb a { color: var(--fg-secondary); text-decoration: none; }
.feature-breadcrumb a:hover { color: var(--brand); text-decoration: underline; }
.feature-detail-hero { overflow: hidden; position: relative; padding: clamp(34px, 7vw, 70px); border: 1px solid rgba(148, 163, 184, .18); border-radius: 22px; color: #e2e8f0; background: radial-gradient(45% 90% at 90% 0%, rgba(99, 102, 241, .28), transparent 72%), radial-gradient(40% 90% at 0% 100%, rgba(14, 165, 233, .20), transparent 72%), linear-gradient(135deg, #0b1b34, #10284b); }
.feature-detail-hero .eyebrow { margin: 0 0 14px; color: #7dd3fc; }
.feature-detail-hero h1 { max-width: 16ch; margin: 0 0 18px; color: #fff; font-size: clamp(36px, 6vw, 58px); line-height: 1.04; letter-spacing: -.045em; }
.feature-detail-lead { max-width: 66ch; margin: 0; color: #c2cede; font-size: clamp(16px, 2vw, 19px); line-height: 1.65; }
.feature-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.feature-detail-actions .btn-glass { border-color: rgba(226, 232, 240, .32); }
.feature-steps { padding: clamp(40px, 6vw, 64px) 0 28px; }
.feature-section-head { margin-bottom: 22px; }
.feature-section-head .eyebrow { margin-bottom: 8px; }
.feature-section-head h2 { margin: 0; font-size: clamp(25px, 4vw, 34px); letter-spacing: -.03em; }
.feature-step-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature-step-grid article { min-height: 205px; padding: 22px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); }
.feature-step-number { display: inline-block; margin-bottom: 22px; color: var(--brand); font-size: 12px; font-weight: 750; letter-spacing: .12em; }
.feature-step-grid h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.015em; }
.feature-step-grid p { margin: 0; color: var(--fg-secondary); font-size: 14.5px; line-height: 1.65; }
.feature-detail-note { margin-top: 22px; padding: 22px 24px; border-left: 3px solid var(--brand); border-radius: 0 12px 12px 0; background: var(--bg-subtle); }
.feature-detail-note h2 { margin: 0 0 7px; font-size: 17px; }
.feature-detail-note p { max-width: 75ch; margin: 0; color: var(--fg-secondary); line-height: 1.65; }
.feature-detail-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin: 28px 0 0; }
.feature-detail-footer a { color: var(--brand); font-size: 14px; font-weight: 650; text-decoration: none; }
.feature-detail-footer a:hover { text-decoration: underline; }
@media (max-width: 760px) { .feature-detail { padding: 20px 16px 56px; } .feature-step-grid { grid-template-columns: 1fr; } .feature-step-grid article { min-height: 0; } .feature-step-number { margin-bottom: 12px; } }
/* Product pages: what it reads, the plans strip and the questions. */
.feature-checks { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 22px 0 0; padding: 0; list-style: none; color: #c2cede; font-size: 14px; }
.feature-checks li::before { content: "\2713"; margin-right: 8px; color: #7dd3fc; font-weight: 700; }
.feature-points { padding: clamp(40px, 6vw, 64px) 0 0; }
.feature-point-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature-point-grid article { padding: 20px 22px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-subtle); }
.feature-point-grid h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: -.01em; }
.feature-point-grid p { margin: 0; color: var(--fg-secondary); font-size: 14.5px; line-height: 1.6; }
.feature-plans { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: 28px; padding: 24px 26px; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg); }
.feature-plans h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.feature-plans p { max-width: 62ch; margin: 0; color: var(--fg-secondary); line-height: 1.6; }
.feature-plans .feature-detail-actions { margin-top: 0; }
.feature-faq { padding: clamp(36px, 5vw, 56px) 0 0; }
@media (max-width: 860px) { .feature-point-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .feature-point-grid { grid-template-columns: 1fr; } .feature-plans { padding: 20px; } }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(24, 24, 27, .8); border-bottom-color: rgba(255, 255, 255, .08); }
  .site-nav a:hover, .header-link:hover, .site-nav-menu summary:hover { background: rgba(255, 255, 255, .07); }
}

/* On the home page the header sits on the dark hero. */
.home .site-header { background: rgba(9, 20, 40, .72); border-bottom-color: rgba(255, 255, 255, .08); }
.home .brand, .home .site-nav a, .home .header-link, .home .site-nav-menu summary { color: #e2e8f0; }
.home .site-nav a:hover, .home .header-link:hover, .home .site-nav-menu summary:hover { color: #ffffff; background: rgba(255, 255, 255, .08); }

/* The menu button: phones and small tablets only (siteHeader in scripts/website.mjs). */
.site-mobile-nav { display: none; }
.site-mobile-nav summary { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px; color: var(--fg); cursor: pointer; list-style: none; }
.site-mobile-nav summary::-webkit-details-marker { display: none; }
.site-mobile-nav summary svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.site-mobile-nav .site-mobile-close, .site-mobile-nav[open] .site-mobile-open { display: none; }
.site-mobile-nav[open] .site-mobile-close { display: block; }
.site-mobile-nav[open] summary { background: var(--bg-hover); }
.site-mobile-panel { position: absolute; top: 100%; left: 0; right: 0; max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px); overflow-y: auto; padding: 8px 16px 22px; border-bottom: 1px solid var(--border); background: var(--bg); box-shadow: 0 18px 40px rgba(15, 23, 42, .18); }
.site-mobile-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.site-mobile-heading { grid-column: 1 / -1; margin: 14px 0 4px; color: var(--fg-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.site-mobile-panel a { display: block; padding: 10px 8px; border-radius: 8px; color: var(--fg); font-size: 15px; font-weight: 550; text-decoration: none; }
.site-mobile-panel a:hover, .site-mobile-panel a[aria-current="page"] { background: var(--brand-tint); color: var(--brand); }
.site-mobile-all { grid-column: 1 / -1; color: var(--brand) !important; }
.site-mobile-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; padding-top: 10px; }
.home .site-mobile-nav summary { border-color: rgba(255, 255, 255, .22); color: #e2e8f0; }
.home .site-mobile-nav[open] summary { background: rgba(255, 255, 255, .1); }

@media (max-width: 820px) {
  .site-header-inner { gap: 10px; padding: 0 16px; }
  .site-nav, .header-actions .header-link { display: none; }
  .header-actions { margin-left: auto; }
  .site-mobile-nav { display: block; }
}
@media (max-width: 380px) {
  .site-header .brand { gap: 8px; font-size: 16px; }
  .site-header .brand img { width: 26px; height: 26px; }
  .header-actions .btn-sm { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 340px) {
  .site-mobile-products, .site-mobile-links { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- product pages (scripts/product-pages.mjs) ---------- */

.product-steps { margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.product-steps li { padding: 22px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); }
.product-steps .feature-step-number { margin-bottom: 14px; padding: 3px 10px; border-radius: 999px; background: var(--brand-tint); letter-spacing: .06em; text-transform: uppercase; }
.product-steps-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 20px 0 0; color: var(--fg-muted); font-size: 14px; }
.product-tips { margin-top: 12px; padding: 24px 26px; border: 1px solid var(--border-subtle); border-left: 3px solid var(--brand); border-radius: 0 14px 14px 0; background: var(--bg-subtle); }
.product-tips h2 { margin: 0 0 12px; font-size: 19px; letter-spacing: -.015em; }
.product-tips ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; margin: 0; padding: 0; list-style: none; }
.product-tips li { position: relative; padding-left: 26px; color: var(--fg-secondary); line-height: 1.6; }
.product-tips li::before { content: "¹3"; position: absolute; left: 0; top: 0; color: var(--brand); font-weight: 700; }
.product-related { padding-top: clamp(28px, 4vw, 44px); }
.product-related h2 { margin: 0 0 16px; font-size: clamp(21px, 3vw, 26px); letter-spacing: -.02em; }
.product-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.product-related-grid a { display: flex; flex-direction: column; gap: 5px; padding: 18px 20px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); color: var(--fg); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.product-related-grid a:hover { border-color: var(--brand); box-shadow: 0 10px 24px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.product-related-grid strong { font-size: 16px; font-weight: 650; }
.product-related-grid span { color: var(--fg-secondary); font-size: 14px; line-height: 1.55; }
.product-related-grid em { margin-top: auto; padding-top: 8px; color: var(--brand); font-size: 14px; font-style: normal; font-weight: 650; }
.products-overview .feature-guide-head { margin-bottom: 8px; }
.products-group { padding-top: 28px; }
.products-group h2 { margin: 0 0 14px; color: var(--fg-muted); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 760px) {
  .product-tips { padding: 20px; }
  .product-tips ul { grid-template-columns: minmax(0, 1fr); }
  .product-steps-cta .btn { width: 100%; justify-content: center; }
  .product-page .feature-detail-actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* ---------- footer ---------- */

.site-footer { background: #0b1220; color: #94a3b8; padding: 56px 20px 28px; font-size: 14px; }
.site-footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-top { display: grid; grid-template-columns: 1.4fr repeat(5, minmax(0, 1fr)); gap: 32px; padding-bottom: 36px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
@media (max-width: 1080px) { .footer-top { grid-template-columns: repeat(3, minmax(0, 1fr)); } .footer-brand { grid-column: 1 / -1; } }
.footer-brand .brand { color: #ffffff; margin-bottom: 12px; }
.footer-brand p { max-width: 30ch; margin: 0; line-height: 1.6; }
.footer-col h2 { margin: 4px 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #e2e8f0; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.site-footer a { color: #94a3b8; text-decoration: none; }
.site-footer a:hover { color: #ffffff; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 22px; font-size: 12.5px; color: #64748b; }
@media (max-width: 820px) {
  .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 8px 18px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: linear-gradient(180deg, #1a7ad4, #0f6cbd); border-color: #0f62ab; color: #fff; box-shadow: 0 1px 2px rgba(15, 108, 189, .3), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: linear-gradient(180deg, #1670c4, #0d5ea6); border-color: #0c5596; }
.btn-danger { background: var(--danger-fg); border-color: var(--danger-fg); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { background: #c4314b; border-color: #c4314b; } }
.btn-wide { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 14px; font-size: 14px; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 12px 26px; font-size: 16px; border-radius: 12px; }
.btn-glass { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); color: #ffffff; }
.btn-glass:hover { background: rgba(255, 255, 255, .15); }
.btn-on-brand { background: #ffffff; border-color: #ffffff; color: #0b2a52; }
.btn-on-brand:hover { background: #eef5ff; }
.btn-ghost-on-brand { background: transparent; border-color: rgba(255, 255, 255, .5); color: #ffffff; }
.btn-ghost-on-brand:hover { background: rgba(255, 255, 255, .12); }

/* ---------- inner pages ---------- */

.page { width: 100%; max-width: 680px; margin: 0 auto; padding: 40px 20px 56px; flex: 1; }
.page-wide { max-width: 1120px; }
h1 { margin: 0 0 16px; font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; }
h2 { margin: 0 0 8px; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
h3 { margin: 20px 0 8px; font-size: 14px; font-weight: 600; color: var(--fg-secondary); }
p { margin: 0 0 10px; }
.lead { color: var(--fg-secondary); margin-bottom: 24px; font-size: 16.5px; }
.muted { color: var(--fg-muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.page-hero { text-align: center; max-width: 720px; margin: 0 auto 36px; }
.page-hero h1 { font-size: clamp(30px, 4.5vw, 42px); }
.page-hero .lead { margin: 0 auto; max-width: 60ch; }

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

.card {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
}
.card-attention { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.notice {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.notice-info { background: var(--brand-tint); border-color: var(--brand); }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.notice-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }

.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.field-inline { flex: 1 1 220px; width: auto; }
.field span { font-size: 13px; font-weight: 500; color: var(--fg-secondary); }
.field input, .field select, .field textarea {
  font: inherit;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field select { width: auto; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--fg-muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border-subtle); }

/* ---------- sign-in popup (web/src/signin.ts) ---------- */

.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  animation: modal-fade .15s ease-out;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 32px 28px 22px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .28);
  text-align: center;
  animation: modal-rise .18s ease-out;
}
.modal h2 { font-size: 21px; margin: 10px 0 6px; }
.modal .stack { align-items: stretch; text-align: left; }
.modal .notice { text-align: left; margin: 12px 0 0; }
.modal-logo { display: block; margin: 0 auto; border-radius: 10px; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--bg-hover); color: var(--fg); }
.modal-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.modal-foot { margin: 18px 0 0; }
.modal-foot a { color: inherit; }
.btn-google { margin-top: 18px; gap: 10px; }
.btn-link { border-color: transparent; background: transparent; color: var(--brand); font-weight: 500; }
.btn-link:hover { background: var(--brand-tint); }
.signed-out { text-align: center; padding: 36px 24px; }
.signed-out p { max-width: 46ch; margin: 0 auto 18px; }
/* The sign-in gate: one look for every page or panel that needs an account (account, PDF, photos). */
.signed-out.gate { position: relative; display: flex; flex-direction: column; align-items: center; max-width: 620px; margin: 8px auto; padding: 40px 32px 0; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 18px; background: radial-gradient(120% 70% at 50% 0%, var(--brand-tint), transparent 62%), var(--bg); box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 16px 40px rgba(15, 23, 42, .07); }
.signed-out.gate[hidden] { display: none; }
.gate-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 16px; border: 1px solid var(--border-subtle); border-radius: 18px; background: var(--bg); color: var(--brand); box-shadow: 0 6px 18px rgba(15, 108, 189, .16); }
.signed-out .gate-eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.gate .gate-title { margin: 0 0 10px; font-size: 24px; line-height: 1.25; letter-spacing: -.01em; }
.signed-out .gate-lead { max-width: 50ch; margin: 0 auto 20px; color: var(--fg-secondary); font-size: 15px; line-height: 1.55; }
.gate-points { display: grid; gap: 9px; margin: 0 auto 24px; padding: 0; list-style: none; text-align: left; }
.gate-points li { position: relative; padding-left: 28px; color: var(--fg); font-size: 14.5px; line-height: 1.45; }
.gate-points li::before { content: ""; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; box-sizing: border-box; border: 1px solid var(--ok-border); border-radius: 50%; background: var(--ok-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-5' fill='none' stroke='%2322a33a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat; }
.gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 28px; }
.gate-actions .btn { min-height: 46px; padding: 10px 22px; border-radius: 12px; font-size: 15px; }
.signed-out .gate-foot { align-self: stretch; max-width: none; margin: 0 -32px; padding: 14px 24px; border-top: 1px solid var(--border-subtle); background: var(--bg-subtle); color: var(--fg-muted); font-size: 13px; line-height: 1.6; }
.gate-foot a { color: var(--brand); font-weight: 500; text-decoration: none; white-space: nowrap; }
.gate-foot a:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .signed-out.gate { padding: 30px 18px 0; border-radius: 14px; }
  .gate .gate-title { font-size: 20px; }
  .gate-actions { align-self: stretch; flex-direction: column; }
  .signed-out .gate-foot { margin: 0 -18px; padding: 12px 16px; }
}
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal-backdrop, .modal { animation: none; } }

.link-code {
  font: 600 26px/1.2 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  letter-spacing: .08em;
  margin: 4px 0 12px;
}

.confirm { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-border); }

.device-list { list-style: none; margin: 0 0 16px; padding: 0; }
.device-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}
.device-list li > div { min-width: 0; overflow-wrap: break-word; }
.device-list li > .btn, .device-list li > button { flex: none; white-space: nowrap; }
@media (max-width: 560px) {
  .device-list li { flex-wrap: wrap; }
  .device-list li > div { flex: 1 1 100%; }
  .account-main .device-list li > .btn, .account-main .device-list li > button { margin-left: 48px; }
}
.device-update { display: inline-block; margin-top: 4px; font-size: 0.9em; font-weight: 600; }

/* ---------- admin ---------- */

.row-between { justify-content: space-between; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 0; }
.stats > div { padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-subtle); }
.stats > div.stat-alert { background: var(--warn-bg); border-color: var(--warn-border); }
.stats dt { font-size: 13px; color: var(--fg-muted); }
.stats dd { margin: 4px 0 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }

.table-wrap { position: relative; overflow-x: auto; margin-bottom: 8px; } /* relative: screen-reader-only labels in a cell stay inside the scroller, not widening the page */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--fg-muted); font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; overflow-wrap: anywhere; }
.plain-list, .audit-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.plain-list li, .audit-list li { padding: 6px 0; border-top: 1px solid var(--border-subtle); overflow-wrap: anywhere; }
.audit-list li.audit-entry { display: grid; grid-template-columns: 11.5em minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.audit-list time { color: var(--fg-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.audit-list .why { display: block; color: var(--fg-muted); }
@media (max-width: 560px) { .audit-list li.audit-entry { grid-template-columns: minmax(0, 1fr); } }
.link-btn { font: inherit; padding: 0; border: 0; background: none; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-bottom: 12px; }
.toolbar .field-inline { flex: 1 1 200px; }
.toolbar .field-fit { flex: 0 1 auto; }
.toolbar .field { min-width: 0; max-width: 100%; }
.toolbar .field select { max-width: 100%; }

.tabs-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.converter-tabs { margin-bottom: 14px; }
.converter-tabs .tab-btn { flex: none; }
.ai-mode-tabs { display: flex; gap: 6px; margin: 0 0 14px; overflow-x: auto; }
.ai-mode-tabs .tab-btn { flex: none; border: 1px solid var(--border); border-radius: 9px 9px 0 0; }
.ai-mode-tabs .tab-btn[aria-selected="true"] { border-color: var(--brand); background: var(--brand-tint); }
.card > .field { margin-bottom: 12px; }
.tab-btn { font: inherit; padding: 8px 14px; border: 0; background: none; color: var(--fg-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab-btn[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--brand); font-weight: 600; }
/* Not ".matrix": the home page draws a matrix in an equation under that name. */
.feature-matrix th, .feature-matrix td { text-align: center; }
.feature-matrix th:first-child, .feature-matrix td:first-child { text-align: left; min-width: 240px; position: sticky; left: 0; z-index: 1; background: var(--bg); }
.feature-matrix td:first-child small { display: block; color: var(--fg-muted); font-size: 12.5px; }
.feature-matrix thead th { vertical-align: bottom; }
.feature-matrix .plan-off { color: var(--fg-muted); font-weight: 400; }
.feature-matrix input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand); }
.feature-matrix input[type="checkbox"]:disabled { cursor: default; }
.feature-matrix tr.feature-off td { opacity: .55; }
.feature-matrix tr.group th { text-align: left; background: var(--bg-subtle); color: var(--fg-secondary); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding-top: 12px; }
.feature-edit { display: grid; gap: 6px; margin-top: 6px; }
.feature-matrix select.where { display: block; margin: 4px auto 0; font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); max-width: 150px; }
.feature-matrix select.where:disabled { border-color: transparent; background: transparent; appearance: none; text-align: center; }
.settings-group + .settings-group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.settings-group h3 { margin: 0 0 10px; }
.ai-keys { display: grid; gap: 12px; }
.ai-key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.ai-key strong { flex: 1 1 100%; }
.ai-key p { flex: 1 1 100%; margin: 0; }
.ai-key input { flex: 1 1 260px; min-width: 0; }
.setting { align-self: start; }
.setting input[type="checkbox"] { width: 18px; height: 18px; }
.setting small { font-size: 12.5px; }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--fg-muted); white-space: nowrap; }
.pill-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.pill-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; align-items: end; margin-bottom: 10px; }
.cell-input { font: inherit; font-size: 14px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); width: 100%; min-width: 64px; }
.cell-input:disabled { border-color: transparent; background: transparent; }

/* ---------- account ---------- */

.profile { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 14px; }
.profile dt { color: var(--fg-muted); font-size: 13.5px; }
.profile dd { margin: 0; overflow-wrap: anywhere; }
.field input.code-input { font: 600 22px/1.2 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; letter-spacing: .3em; max-width: 12em; }
/* The sign-in popup's look: later than the base rules above, so these win. */
.modal-backdrop { background: rgba(8, 15, 30, .52); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-auth { max-width: 420px; padding: 36px 32px 24px; border-radius: 20px; border-color: rgba(15, 23, 42, .06); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 32px 80px -12px rgba(15, 23, 42, .38); }
.modal-auth::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, #0f6cbd, #4f8ef7 55%, #7c6cf2); }
.modal-auth-head { margin-bottom: 22px; }
.modal-auth .modal-logo { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 6px 16px rgba(15, 108, 189, .22); }
.modal-auth h2 { margin: 16px 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.modal-sub { max-width: 34ch; margin: 0 auto; color: var(--fg-muted); font-size: 14px; line-height: 1.55; }
.signin-free { display: inline-block; margin: 12px auto 0; padding: 4px 12px; border: 1px solid var(--ok-border); border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); font-size: 12.5px; font-weight: 600; }
.signin-free[hidden] { display: none; }
.modal-close { display: inline-grid; place-items: center; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 999px; }
.modal-auth .notice { margin: 0 0 14px; font-size: 14px; }
.modal-auth .btn-google { margin-top: 0; min-height: 46px; border-radius: 12px; font-size: 15px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.modal-auth .btn-google:hover { border-color: #b7bfcc; background: var(--bg-subtle); }
.modal-auth .divider { margin: 20px 0; font-size: 12.5px; }
.modal-auth .stack { gap: 14px; }
.modal-auth .field span { font-size: 13px; font-weight: 600; color: var(--fg-secondary); }
.modal-auth .field input { min-height: 46px; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
.modal-auth .btn-primary { min-height: 46px; border-radius: 12px; font-size: 15px; }
.modal-auth .field input.code-input { max-width: none; text-align: center; font-size: 26px; letter-spacing: .5em; padding-left: calc(14px + .5em); }
.modal-auth .field input.code-input::placeholder { color: var(--border); }
.code-sent { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--brand-tint); color: var(--fg-secondary); font-size: 14px; line-height: 1.5; }
.code-sent p { margin: 0; }
.code-sent strong { color: var(--fg); overflow-wrap: anywhere; }
.code-sent-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--bg); color: var(--brand); }
.modal-auth .modal-links .btn-link { padding: 6px 8px; min-height: 0; font-size: 13.5px; }
.modal-auth #code-hint { margin: 0; text-align: center; }
.modal-trust { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 0; color: var(--fg-muted); font-size: 12.5px; }
.modal-auth .modal-foot { margin: 14px -32px -24px; padding: 14px 32px; border-top: 1px solid var(--border-subtle); background: var(--bg-subtle); border-radius: 0 0 20px 20px; font-size: 12.5px; }
.modal-auth .modal-foot a { color: var(--fg-secondary); font-weight: 500; }
@media (max-width: 480px) {
  .modal-auth { padding: 30px 20px 20px; }
  .modal-auth .modal-foot { margin: 14px -20px -20px; padding: 12px 20px; }
}

/* The account page: a header with who is signed in, a section menu, and cards. */
.account-page { padding-top: 32px; }
.account-title { margin-bottom: 20px; }
.account-title h1 { margin: 0 0 4px; font-size: 28px; }
.account-title p { margin: 0; }
.account-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-bottom: 22px; padding: 22px 24px; border-radius: 18px; color: #e2e8f0; background: radial-gradient(60% 140% at 100% 0%, rgba(124, 108, 242, .35), transparent 60%), radial-gradient(50% 120% at 0% 100%, rgba(14, 165, 233, .25), transparent 65%), linear-gradient(135deg, #0b1b34, #12305a); box-shadow: 0 10px 30px -10px rgba(11, 27, 52, .5); }
.acct-avatar { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 999px; background: linear-gradient(135deg, #4f8ef7, #7c6cf2); color: #fff; font-size: 21px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 0 0 3px rgba(255, 255, 255, .16); }
.account-hero-text { flex: 1 1 220px; min-width: 0; }
.account-hero-name { margin: 0 0 6px; color: #fff; font-size: 21px; font-weight: 700; letter-spacing: -.015em; overflow-wrap: anywhere; }
.account-hero-meta { margin: 0; }
.acct-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); color: #e2e8f0; font-size: 12.5px; font-weight: 600; }
.acct-badge:empty { display: none; }
.acct-badge::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: #4ade80; }
.account-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-hero-actions .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .24); color: #fff; }
.account-hero-actions .btn:hover { background: rgba(255, 255, 255, .16); }
.account-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.account-nav { position: sticky; top: 84px; display: grid; gap: 2px; padding: 8px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); }
.account-nav-list { display: grid; gap: 2px; }
.account-nav a { padding: 8px 12px; border-radius: 9px; color: var(--fg-secondary); font-size: 14px; font-weight: 550; text-decoration: none; }
.account-nav a:hover { background: var(--bg-hover); color: var(--fg); }
.account-nav a[href="#delete"] { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border-subtle); border-radius: 0 0 9px 9px; color: var(--danger-fg); }
.account-main { min-width: 0; }
.account-main .card { scroll-margin-top: 84px; padding: 22px 24px; border-radius: 16px; }
.modal-auth:has(#code-form:not([hidden])) #google, .modal-auth:has(#code-form:not([hidden])) .divider { display: none; }
.account-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 16px; scroll-margin-top: 84px; }
.account-pair > .card { margin-bottom: 16px; }
.account-pair > #teams { order: 1; grid-column: 1 / -1; }
.acct-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.acct-head h2 { margin: 0; font-size: 17px; }
.acct-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-tint); color: var(--brand); }
.card-danger { border-color: var(--danger-border); }
.card-danger .acct-icon { background: var(--danger-bg); color: var(--danger-fg); }
.account-main .profile { gap: 0; margin-bottom: 16px; border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; }
.account-main .profile dt, .account-main .profile dd { padding: 11px 14px; border-top: 1px solid var(--border-subtle); }
.account-main .profile dt:first-of-type, .account-main .profile dd:first-of-type { border-top: 0; }
.account-main .profile dt { background: var(--bg-subtle); font-weight: 500; }
.plan-line { margin-bottom: 6px; }
.plan-line strong, .stat-figure strong { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat-figure { margin-bottom: 6px; }
.account-main .device-list li { padding: 12px 14px; margin-top: 8px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-subtle); }
.account-main .device-list li:first-child { margin-top: 0; }
.account-main .device-list li > div { position: relative; padding-left: 48px; min-height: 36px; }
.account-main .device-list li > div::before { content: ""; position: absolute; left: 0; top: 50%; width: 36px; height: 36px; margin-top: -18px; border-radius: 10px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='4' width='18' height='12' rx='2' fill='none' stroke='%230f6cbd' stroke-width='1.8'/%3E%3Cpath d='M8 20h8M12 16v4' stroke='%230f6cbd' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center / 18px no-repeat; border: 1px solid var(--border-subtle); }
.account-main #sessions li > div::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%230f6cbd' stroke-width='1.8'/%3E%3Cpath d='M3 12h18M12 3c2.5 2.5 3.8 5.5 3.8 9s-1.3 6.5-3.8 9c-2.5-2.5-3.8-5.5-3.8-9S9.5 5.5 12 3z' fill='none' stroke='%230f6cbd' stroke-width='1.8'/%3E%3C/svg%3E"); }
.account-main .device-list .muted { font-size: 13px; }
.account-main .table-wrap { border: 1px solid var(--border-subtle); border-radius: 12px; }
.account-main .table th { padding: 10px 14px; background: var(--bg-subtle); border-bottom-color: var(--border-subtle); }
.account-main .table td { padding: 11px 14px; }
.account-main .table tr:last-child td { border-bottom: 0; }
.account-main .confirm { padding: 14px 16px; border-radius: 12px; }
@media (max-width: 860px) {
  .account-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .account-nav { position: static; display: flex; overflow-x: auto; margin-bottom: 16px; padding: 6px; }
  .account-nav a { flex: none; white-space: nowrap; }
  .account-nav a[href="#delete"] { margin: 0; padding-top: 8px; border-top: 0; border-radius: 9px; }
  .account-pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 560px) {
  .account-hero { padding: 18px; }
  .account-hero-actions { width: 100%; }
  .account-hero-actions .btn { flex: 1; }
  .account-hero { gap: 14px; }
  .account-hero .acct-avatar { width: 52px; height: 52px; font-size: 18px; }
  .account-hero-text { flex-basis: 0; }
  .account-hero-name { font-size: 17px; line-height: 1.3; }
  .account-hero-actions .btn { justify-content: center; min-height: 42px; white-space: nowrap; }
  .account-main .card { padding: 18px; }
  .account-main .profile { grid-template-columns: minmax(0, 1fr); }
  .account-main .profile dt { padding-bottom: 2px; background: none; border-top: 1px solid var(--border-subtle); }
  .account-main .profile dd { padding-top: 0; border-top: 0; }
}
@media (prefers-color-scheme: dark) {
  .modal-auth { border-color: var(--border-subtle); }
  .modal-auth .btn-google:hover { border-color: var(--border); }
}

/* ---------- pricing page ---------- */

.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); margin-bottom: 20px; }
.segment { font: inherit; font-weight: 500; border: 0; padding: 6px 16px; border-radius: 9px; background: transparent; color: var(--fg-secondary); cursor: pointer; }
.segment[aria-checked="true"] { background: var(--brand); color: #fff; }

.topups { margin-top: 20px; }
.topups h2 { margin-bottom: 4px; }
.topups > p { margin-bottom: 18px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 18px; margin-bottom: 24px; }
.plan { display: flex; flex-direction: column; margin: 0; padding: 24px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.plan:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15, 23, 42, .04), 0 16px 32px rgba(15, 23, 42, .08); }
.plan h2 { font-size: 19px; }
.plan-current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.plan-price { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 12px; }
.plan-saving { font-size: 12.5px; font-weight: 600; letter-spacing: 0; vertical-align: middle; }
.plan-features { margin: 0 0 20px; padding-left: 0; list-style: none; flex: 1; }
.plan-features li { position: relative; padding-left: 24px; margin-bottom: 7px; color: var(--fg-secondary); font-size: 14.5px; }
.plan-features li::before { content: ""; position: absolute; left: 0; top: .3em; width: 15px; height: 15px; border-radius: 50%; background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.plan-features li::after { content: ""; position: absolute; left: 5px; top: calc(.3em + 4px); width: 4px; height: 7px; border: solid var(--brand); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.plan-yours { margin: 0; font-weight: 600; color: var(--brand); }
.badge { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-border); white-space: nowrap; }

/* The Plans page's own: the most popular plan, a price with its period, the Enterprise band, credits by number, questions. */
.pricing-plans { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); align-items: stretch; margin-top: 8px; }
.pricing .plan { position: relative; }
.plan-popular { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint), 0 16px 32px rgba(15, 23, 42, .08); }
.plan-badge { position: absolute; top: -12px; left: 24px; padding: 3px 12px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.plan-about { margin: 4px 0 0; color: var(--fg-muted); font-size: 14px; }
@media (min-width: 900px) { .plan-about { min-height: 4.4em; } }
.pricing .plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; margin: 14px 0 2px; }
.plan-price strong { font-size: 34px; font-weight: 750; letter-spacing: -.02em; }
.plan-per { font-size: 15px; font-weight: 500; color: var(--fg-muted); letter-spacing: 0; }
.plan-billed { margin: 0 0 16px; min-height: 1.5em; }
.pricing .plan-features { flex: 1; }
.plan-features-small li { font-size: 13.5px; margin-bottom: 5px; }
.plan-includes { margin-top: 14px; border-top: 1px solid var(--border-subtle); padding-top: 10px; }
.plan-includes summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand); }
.plan-includes .plan-features { margin: 10px 0 0; }

.pricing-enterprise { display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap; margin: 4px 0 40px; padding: 24px 28px; background: linear-gradient(120deg, var(--brand-tint), transparent 70%); }
.pricing-enterprise > div { flex: 1 1 320px; }
.pricing-enterprise .eyebrow { margin-bottom: 4px; }
.pricing-reading { margin: 4px 0 40px; padding: 24px 28px; }
.pricing-reading h2 { margin-top: 0; }
.pricing-reading td, .pricing-reading th[scope="row"] { white-space: nowrap; }
@media (max-width: 600px) { .pricing-reading { padding: 18px 16px; } .pricing-reading td, .pricing-reading th[scope="row"] { white-space: normal; } }
.pricing-enterprise h2 { font-size: 20px; margin: 0 0 4px; }
.pricing-enterprise p:last-child { margin: 0; }

.credits-any { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); max-width: 820px; margin: 0 auto 22px; padding: 0; overflow: hidden; }
.credits-choose { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 26px 28px; }
.credits-summary { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 26px 28px; background: linear-gradient(160deg, var(--brand-tint), transparent 85%); border-left: 1px solid var(--border-subtle); }
.credits-picker { display: inline-flex; align-items: center; gap: 8px; }
.credits-label { font-weight: 650; font-size: 15px; }
.credits-step { width: 44px; height: 44px; padding: 0; font-size: 22px; line-height: 1; justify-content: center; border-radius: 12px; }
.credits-count { width: 100px; height: 44px; text-align: center; font: inherit; font-size: 20px; font-weight: 700; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--fg); }
.credits-count:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.credits-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; width: 100%; }
.credits-tier { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 8px; font: inherit; cursor: pointer; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--fg); transition: border-color .15s, background .15s; }
.credits-tier strong { font-size: 15px; }
.credits-tier span { font-size: 12.5px; font-weight: 600; color: var(--ok-fg); }
.credits-tier:hover { border-color: var(--brand); }
.credits-tier:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-tint); border-color: var(--brand); }
.credits-tier[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.credits-next { margin: 0; min-height: 1.5em; font-size: 13.5px; font-weight: 600; color: var(--brand); }
.credits-total { margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.credits-total strong { font-size: 36px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.credits-was { font-size: 18px; color: var(--fg-muted); }
.credits-was:empty { display: none; }
.credits-save { align-self: flex-start; margin: 0; font-size: 12.5px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-border); }
.credits-rate { margin: 0 0 8px; font-size: 14px; }
.credits-action .btn { width: 100%; justify-content: center; }
.credits-fine { margin: 2px 0 0; font-size: 12.5px; text-align: center; }

.pricing-faq { max-width: 760px; margin: 48px auto 28px; }
.pricing-faq h2 { margin-bottom: 14px; }
.pricing-faq details { border: 1px solid var(--border-subtle); border-radius: 12px; padding: 0 18px; margin-bottom: 10px; background: var(--bg); }
.pricing-faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
.pricing-faq details p { margin: 0 0 14px; color: var(--fg-secondary); }
@media (max-width: 560px) {
  .credits-any { grid-template-columns: 1fr; }
  .credits-choose { align-items: center; padding: 22px 16px; }
  .credits-summary { border-left: 0; border-top: 1px solid var(--border-subtle); padding: 22px 16px; align-items: center; text-align: center; }
  .credits-total { justify-content: center; }
  .credits-save { align-self: center; }
  .credits-action { width: 100%; }
  .pricing-enterprise .btn { width: 100%; }
}

/* ---------- home: hero ---------- */

.hero {
  position: relative;
  color: #e2e8f0;
  background:
    radial-gradient(60% 55% at 85% 20%, rgba(99, 102, 241, .35), transparent 70%),
    radial-gradient(50% 60% at 10% 10%, rgba(14, 165, 233, .28), transparent 70%),
    radial-gradient(40% 40% at 60% 100%, rgba(59, 130, 246, .25), transparent 70%),
    linear-gradient(180deg, #091428 0%, #0b1b34 60%, #0d2142 100%);
  overflow: hidden;
  margin-top: -64px;
  padding-top: 64px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000 30%, transparent 80%);
  mask-image: radial-gradient(70% 60% at 50% 30%, #000 30%, transparent 80%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 1200px; margin: 0 auto; padding: 72px 20px 56px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 56px; align-items: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 6px 14px 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); font-size: 13px; font-weight: 500; color: #cbd5e1; }
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .18); }
.hero h1 { color: #ffffff; font-size: clamp(38px, 5.6vw, 64px); line-height: 1.04; letter-spacing: -.035em; font-weight: 800; margin: 0 0 22px; }
.grad { background: linear-gradient(92deg, #7dd3fc 0%, #60a5fa 40%, #a78bfa 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { font-size: 18px; line-height: 1.65; color: #b6c2d4; margin: 0 0 30px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.hero-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: #94a3b8; }
.hero-checks li { display: inline-flex; align-items: center; gap: 7px; }
.hero-checks li::before { content: "✓"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(52, 211, 153, .16); color: #34d399; font-size: 11px; font-weight: 700; }

/* The product mock-up: a Word window drawn in HTML, only to show the idea. */
.mock {
  margin: 0;
  border-radius: 14px;
  background: #f3f3f3;
  color: #242424;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 30px 80px -10px rgba(0, 0, 0, .6), 0 10px 30px rgba(15, 23, 42, .4);
  transform: perspective(1800px) rotateY(-6deg) rotateX(2deg);
  transform-origin: left center;
  font-family: "Segoe UI", "Inter", sans-serif;
}
.mock-titlebar { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 12px; background: #185abd; color: #ffffff; font-size: 12px; }
.mock-dots { display: inline-flex; gap: 6px; }
.mock-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.mock-title { flex: 1; text-align: center; margin-right: 46px; opacity: .92; }
.mock-ribbon { display: flex; gap: 2px; padding: 6px 10px; background: #ffffff; border-bottom: 1px solid #e1e1e1; font-size: 11.5px; color: #444; overflow: hidden; white-space: nowrap; }
.mock-ribbon span { padding: 3px 9px; border-radius: 4px; }
.mock-ribbon .on { color: #185abd; box-shadow: inset 0 -2px #185abd; border-radius: 0; }
.mock-ribbon .mock-addin { margin-left: auto; background: #e8f1fb; color: #0f6cbd; font-weight: 600; }
.mock-body { display: grid; grid-template-columns: minmax(0, 1fr) 250px; height: 540px; }
.mock-doc { padding: 22px 22px 0; background: #e9e9e9; overflow: hidden; }
.mock-page { background: #ffffff; min-height: 100%; padding: 26px 26px 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font: 13px/1.5 Calibri, "Segoe UI", sans-serif; }
.mock-q { margin: 0 0 6px; font-weight: 600; color: #222; }
.mock-line { display: block; height: 7px; border-radius: 4px; background: #e5e7eb; margin: 0 0 9px; }
.mock-line.w90 { width: 90%; }
.mock-line.w80 { width: 80%; }
.mock-line.w70 { width: 70%; }
.mock-line.w60 { width: 60%; }
.mock-line + .mock-q { margin-top: 18px; }
.eq-new { outline: 1.5px dashed rgba(15, 108, 189, .55); outline-offset: 4px; border-radius: 2px; background: rgba(15, 108, 189, .06); }
.mock-pane { background: #fafafa; border-left: 1px solid #e1e1e1; padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; }
.mock-pane-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.mock-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #707070; margin-top: 4px; }
.mock-input { font: 10.5px/1.45 "Cascadia Mono", Consolas, monospace; background: #ffffff; border: 1px solid #0f6cbd; border-radius: 6px; padding: 7px 8px; box-shadow: 0 0 0 2px #e3eefa; overflow-wrap: anywhere; color: #1f2937; }
.caret { display: inline-block; width: 1px; height: 12px; background: #0f6cbd; vertical-align: -2px; margin-left: 1px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.mock-preview { background: #ffffff; border: 1px solid #e1e1e1; border-radius: 6px; padding: 8px; display: grid; place-items: center; min-height: 54px; }
.mock-btn { background: #0f6cbd; color: #ffffff; border-radius: 6px; text-align: center; padding: 6px; font-weight: 600; font-size: 11.5px; }
.mock-btn-inline { display: inline-block; padding: 5px 12px; }
.mock-chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.mock-chips span { display: grid; place-items: center; height: 24px; background: #ffffff; border: 1px solid #e1e1e1; border-radius: 5px; font: 13px "Cambria Math", Cambria, serif; }
/* The real pane, docked where Word docks it. */
.mock-pane-shot { padding: 0; display: block; overflow: hidden; background: #f3f5f8; }
.mock-pane-shot img { display: block; width: 100%; height: auto; }

.works-with { position: relative; max-width: 1200px; margin: 0 auto; padding: 22px 20px 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 34px; font-size: 14px; color: #94a3b8; }
.works-label { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #64748b; }
.works-item { display: inline-flex; align-items: center; gap: 8px; color: #cbd5e1; font-weight: 500; }

@media (max-width: 980px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding-top: 48px; gap: 44px; }
  .mock { transform: none; }
}
@media (max-width: 560px) {
  .mock-body { grid-template-columns: minmax(0, 1fr); height: 520px; }
  .mock-doc { display: none; }
  .mock-pane { border-left: 0; }
  .mock-ribbon span:not(.on):not(.mock-addin) { display: none; }
  .mock-title { margin-right: 0; }
}

/* A hand-set equation, only to show the idea: the real one is Word's. */
.eq { margin: 4px 0; font: 24px/1 "Cambria Math", Cambria, "STIX Two Math", "Times New Roman", serif; display: flex; align-items: center; flex-wrap: wrap; color: var(--fg); }
.mock .eq { color: #111; }
.eq-sm { font-size: 18px; margin: 4px 0 12px; }
.eq-xs { font-size: 15px; margin: 0; }
.eq i { font-style: italic; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 2px; }
.frac .num { padding: 0 4px 3px; display: inline-flex; align-items: flex-end; }
.frac .den { padding: 3px 4px 0; border-top: 1.5px solid currentColor; align-self: stretch; text-align: center; }
.sqrt { display: inline-flex; align-items: stretch; }
.sqrt::before { content: "√"; font-size: 1.1em; margin-right: 1px; }
.sqrt .radicand { border-top: 1.5px solid currentColor; padding: 2px 2px 0; }
.eq sup { font-size: .6em; position: relative; top: -.85em; vertical-align: baseline; line-height: 0; }
.eq sup sup { font-size: .8em; top: -.6em; }
.lims sup, .lims sub { position: static; }
.frac .den sup { top: -.45em; }
.bigop { display: inline-flex; align-items: center; font-size: 1.5em; margin-right: 3px; }
.lims { display: inline-flex; flex-direction: column; justify-content: space-between; font-size: .42em; height: 2.2em; margin-left: 1px; }
.lims sup, .lims sub { font-size: 1em; vertical-align: baseline; line-height: 1; }
.bigop-sum { flex-direction: column; font-size: 1em; }
.bigop-sum { position: relative; display: inline-grid; justify-items: center; font-size: 1.6em; line-height: 1; padding: 14px 0; }
.lims-under { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: center; font-size: .36em; height: auto; margin: 0; }
.paren { font-size: 2.2em; font-weight: 200; line-height: 1; }
.eq .matrix { display: inline-grid; grid-template-columns: auto auto; gap: 4px 16px; padding: 0 4px; }

/* ---------- home: sections ---------- */

.section { padding: 96px 20px; background: var(--bg); }
.section-alt { background: var(--bg-subtle); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.section-inner { max-width: 1200px; margin: 0 auto; }
.section-narrow { max-width: 780px; }
.section-head { text-align: center; max-width: 760px; margin: 0 auto 56px; }
.eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.section-title { font-size: clamp(28px, 3.8vw, 42px); line-height: 1.15; letter-spacing: -.028em; font-weight: 750; margin: 0 0 14px; }
.section-lead { color: var(--fg-muted); font-size: 17.5px; line-height: 1.65; margin: 0 auto; max-width: 46em; }
.text-link { font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.showcase { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: center; margin-bottom: 96px; }
.showcase:last-child { margin-bottom: 0; }
.showcase-flip .showcase-copy { order: 2; }
.showcase-tag { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.showcase h3 { margin: 0 0 14px; font-size: clamp(24px, 2.8vw, 32px); line-height: 1.2; letter-spacing: -.022em; font-weight: 720; color: var(--fg); }
.showcase-copy > p { color: var(--fg-muted); font-size: 16.5px; line-height: 1.7; margin-bottom: 20px; }
.showcase-visual {
  position: relative;
  padding: 36px;
  border-radius: 24px;
  background:
    radial-gradient(70% 70% at 100% 0%, rgba(99, 102, 241, .14), transparent 70%),
    radial-gradient(70% 70% at 0% 100%, rgba(14, 165, 233, .14), transparent 70%),
    var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: grid;
  gap: 14px;
  justify-items: stretch;
}

.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 30px; color: var(--fg-secondary); font-size: 15px; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-tint); }
.ticks li::after { content: ""; position: absolute; left: 7px; top: 6px; width: 5px; height: 9px; border: solid var(--brand); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.code-card, .eq-card, .doc-card, .plot-card, .palette-card {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .08);
}
.code-card { overflow: hidden; }
.code-card-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--border-subtle); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.copy-pill { text-transform: none; letter-spacing: 0; padding: 1px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-border); }
.code-card pre, .plot-card pre { margin: 0; padding: 14px 16px; font: 14px/1.55 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
.eq-card { padding: 22px 20px 14px; display: grid; justify-items: center; }
.eq-card .eq { font-size: 26px; }
.eq-card-note { margin: 10px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ok-fg); }
.arrow-down { justify-self: center; width: 36px; height: 36px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border-subtle); position: relative; box-shadow: 0 4px 12px rgba(15, 23, 42, .08); }
.arrow-down::after { content: ""; position: absolute; left: 50%; top: 45%; width: 9px; height: 9px; border: solid var(--brand); border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }

.doc-card { overflow: hidden; }
.doc-card-head { padding: 12px 16px; font-weight: 650; border-bottom: 1px solid var(--border-subtle); }
.doc-list { list-style: none; margin: 0; padding: 6px 0; }
.doc-list li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13.5px; overflow-wrap: anywhere; }
.doc-list li + li { border-top: 1px solid var(--border-subtle); }
.doc-list .ok { display: inline-grid; place-items: center; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-fg); font-size: 11px; font-weight: 700; }
.doc-card-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border-subtle); background: var(--bg-subtle); font-size: 13px; color: var(--fg-muted); }

.plot-card { overflow: hidden; }
.plot-card svg { display: block; width: 100%; height: auto; padding: 14px 10px 0; }
.plot-card pre { border-top: 1px solid var(--border-subtle); font-size: 13px; }
.plot-grid { stroke: var(--border-subtle); }
.plot-axis { stroke: var(--fg-muted); }
.plot-curve { stroke: #2563eb; }
.plot-label { fill: var(--fg-secondary); font: italic 13px "Cambria Math", Cambria, serif; }
.plot-tick { fill: var(--fg-muted); font: 12px "Inter", sans-serif; }

/* The subject palettes: real screenshots of the pane behind radio-button tabs. */
.shots { justify-items: center; }
.shots > input { position: absolute; opacity: 0; pointer-events: none; }
.shot-tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-subtle); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.shot-tabs label { padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--fg-muted); cursor: pointer; user-select: none; }
.shot-tabs label:hover { color: var(--fg); }
#shot-maths:checked ~ .shot-tabs [for="shot-maths"],
#shot-physics:checked ~ .shot-tabs [for="shot-physics"],
#shot-chemistry:checked ~ .shot-tabs [for="shot-chemistry"] { background: var(--brand-tint); color: var(--brand); }
#shot-maths:focus-visible ~ .shot-tabs [for="shot-maths"],
#shot-physics:focus-visible ~ .shot-tabs [for="shot-physics"],
#shot-chemistry:focus-visible ~ .shot-tabs [for="shot-chemistry"] { outline: 2px solid var(--brand); outline-offset: 1px; }
.shot-frame { margin: 0; width: min(300px, 100%); border-radius: 16px; overflow: hidden; background: #f3f5f8; box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 24px 48px -12px rgba(15, 23, 42, .28); }
.shot { display: none; width: 100%; height: auto; aspect-ratio: 360 / 860; object-fit: cover; object-position: top; }
#shot-maths:checked ~ .shot-frame .shot-maths,
#shot-physics:checked ~ .shot-frame .shot-physics,
#shot-chemistry:checked ~ .shot-frame .shot-chemistry { display: block; }
.shot-caption { margin: 0; font-size: 12.5px; color: var(--fg-muted); }
.showcase-cta { margin: 24px 0 0; }

@media (max-width: 900px) {
  .section { padding: 72px 16px; }
  .showcase { grid-template-columns: minmax(0, 1fr); gap: 32px; margin-bottom: 72px; }
  .showcase-flip .showcase-copy { order: 0; }
  .showcase-visual { padding: 20px; }
}

.stats-band { background: linear-gradient(120deg, #0b1b34, #12305e 55%, #1e3a8a); color: #ffffff; padding: 64px 20px; }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; text-align: center; }
.stat strong { display: block; font-size: clamp(34px, 4.5vw, 48px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; background: linear-gradient(180deg, #ffffff, #93c5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { display: block; margin-top: 8px; color: #b6c2d4; font-size: 14.5px; }
@media (max-width: 720px) { .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.audience-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.audience { padding: 30px; border-radius: 18px; border: 1px solid var(--border-subtle); background: var(--bg); transition: transform .15s, box-shadow .15s, border-color .15s; }
.audience:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(15, 23, 42, .08); border-color: var(--border); }
.audience h3 { margin: 18px 0 8px; font-size: 19px; color: var(--fg); }
.audience p { margin: 0; color: var(--fg-muted); }
.audience-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #ffffff; box-shadow: 0 8px 20px rgba(99, 102, 241, .3); }
@media (max-width: 860px) { .audience-grid { grid-template-columns: minmax(0, 1fr); } }

.diagram { margin: 16px 0 24px; }
.diagram img { display: block; max-width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--border-subtle); background: var(--bg); box-shadow: 0 12px 40px rgba(15, 23, 42, .06); }
.diagram figcaption { margin-top: 8px; font-size: 13px; color: var(--fg-muted); }
.diagram-wide { max-width: 900px; margin-left: auto; margin-right: auto; }
.diagram-wide img { width: 100%; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.steps li { counter-increment: step; position: relative; padding: 28px; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 18px; display: grid; gap: 6px; }
.steps li::before { content: counter(step); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; font-weight: 750; font-size: 17px; }
.steps strong { color: var(--fg); font-size: 18px; }
.steps span { color: var(--fg-muted); }
@media (max-width: 860px) { .steps { grid-template-columns: minmax(0, 1fr); } }

.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.platform { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-subtle); color: var(--fg); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.platform span { color: var(--fg-muted); font-size: 14px; }
.platform:hover, .card-link:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* As many columns as there are plans (the catalogue's, from web/src/index.ts), down to one on a phone. */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 16px; align-items: stretch; margin-bottom: 20px; }
.price-grid[hidden] { display: none; }
.price-card { position: relative; display: flex; flex-direction: column; padding: 30px 22px 24px; border-radius: 20px; background: var(--bg); border: 1px solid var(--border-subtle); }
.price-card h3 { margin: 0 0 6px; font-size: 18px; color: var(--fg); }
.price { margin: 0 0 22px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.price strong { font-size: 36px; font-weight: 800; letter-spacing: -.035em; }
.price span { color: var(--fg-muted); }
.price-card .ticks { flex: 1; align-content: start; margin-bottom: 26px; }
.price-card-featured { border: 2px solid transparent; background: linear-gradient(var(--bg), var(--bg)) padding-box, linear-gradient(135deg, #0ea5e9, #6366f1) border-box; box-shadow: 0 20px 50px rgba(99, 102, 241, .18); }

.faq { display: grid; gap: 12px; margin-bottom: 28px; }
.faq details { border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg); padding: 0 22px; transition: border-color .15s, box-shadow .15s; }
.faq details[open] { border-color: var(--border); box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 28px 18px 0; font-weight: 600; font-size: 16px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 8px; height: 8px; border: solid var(--fg-muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { margin: 0 0 18px; color: var(--fg-muted); line-height: 1.7; }

.cta-band {
  position: relative;
  padding: 96px 20px;
  color: #ffffff;
  text-align: center;
  background:
    radial-gradient(50% 80% at 20% 0%, rgba(14, 165, 233, .35), transparent 70%),
    radial-gradient(50% 80% at 80% 100%, rgba(139, 92, 246, .35), transparent 70%),
    linear-gradient(135deg, #0b1b34, #13306a);
}
.cta-band h2 { font-size: clamp(28px, 4vw, 44px); line-height: 1.15; letter-spacing: -.03em; font-weight: 800; margin: 0 0 12px; }
.cta-band p { margin: 0 0 30px; color: #b6c2d4; font-size: 18px; }
.cta-inner .hero-actions { justify-content: center; margin: 0; }

/* ---------- download ---------- */

.download-group { margin: 40px 0 16px; font-size: 21px; letter-spacing: -.015em; }
.download-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 18px; }
.download { display: flex; flex-direction: column; margin: 0; padding: 26px; transition: box-shadow .15s, transform .15s; }
.download:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(15, 23, 42, .08); }
.download h3 { margin: 0 0 4px; font-size: 18px; color: var(--fg); }
.download-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #ffffff; }
.download-steps { margin: 8px 0 20px; padding-left: 20px; flex: 1; font-size: 14.5px; color: var(--fg-secondary); }
.download-steps li { margin-bottom: 4px; }
.download-store { margin: 4px 0 4px; }
.download-store p { margin: 6px 0 0; }
.download .btn-wide { margin-top: auto; }
.download-done { margin: 10px 0 0; padding: 8px 12px; border: 1px solid var(--ok-border); border-radius: 8px; background: var(--ok-bg); color: var(--ok-fg); }
.cmd { margin: 4px 0 16px; padding: 10px 12px; font: 13px/1.4 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: 10px; overflow-x: auto; flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.download-note { margin-top: 28px; text-align: center; }

/* ---------- docs ---------- */

.docs-layout { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 20px 56px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; flex: 1; }
.docs-nav { position: sticky; top: 88px; align-self: start; font-size: 14px; max-height: calc(100vh - 110px); overflow-y: auto; }
.docs-nav ul { list-style: none; margin: 0 0 14px; padding: 0; }
.docs-nav li a { display: block; padding: 6px 12px; border-radius: 8px; color: var(--fg-secondary); text-decoration: none; }
.docs-nav li a:hover { background: var(--bg-hover); color: var(--fg); }
.docs-nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.docs-home { display: block; padding: 6px 12px; margin-bottom: 8px; font-weight: 650; color: var(--fg); text-decoration: none; }
.docs-nav-group { margin: 14px 0 6px; padding: 0 12px; font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.docs-main { min-width: 0; }
.docs-index-group { margin: 32px 0 14px; font-size: 19px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 14px; }
.card-link { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--fg); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.card-link .muted { font-size: 14px; }

.prose { max-width: 780px; font-size: 16px; line-height: 1.75; overflow-wrap: break-word; }
.prose h1 { font-size: clamp(30px, 4vw, 40px); margin: 0 0 20px; }
.prose h2 { font-size: 24px; margin: 44px 0 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); letter-spacing: -.02em; }
.prose h3 { font-size: 18px; margin: 30px 0 8px; color: var(--fg); }
.prose h2, .prose h3, .prose h4 { position: relative; scroll-margin-top: 90px; }
.prose .anchor { position: absolute; left: -1em; width: 1em; color: var(--fg-muted); text-decoration: none; opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose code { font-size: .88em; padding: 2px 6px; background: var(--bg-hover); border-radius: 6px; }
.prose pre { margin: 0 0 18px; padding: 14px 16px; background: #0b1220; color: #e2e8f0; border-radius: 12px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.prose pre code { padding: 0; background: none; color: inherit; }
.prose blockquote { margin: 0 0 16px; padding: 10px 16px; border-left: 3px solid var(--brand); color: var(--fg-secondary); background: var(--brand-tint); border-radius: 0 10px 10px 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.prose th { font-weight: 600; border-bottom-color: var(--border); background: var(--bg-subtle); }
.prose .table-wrap { margin: 0 0 18px; border: 1px solid var(--border-subtle); border-radius: 12px; }
.prose img { max-width: 100%; }

.docs-pager { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.docs-pager a { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); text-decoration: none; font-weight: 600; transition: border-color .15s; }
.docs-pager a span { font-size: 12.5px; font-weight: 400; color: var(--fg-muted); }
.docs-pager-next { text-align: right; }
.docs-pager a:hover { border-color: var(--brand); }

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .docs-nav { position: static; max-height: none; border: 1px solid var(--border-subtle); border-radius: 12px; padding: 10px; background: var(--bg); }
  .docs-nav ul { display: flex; flex-wrap: wrap; gap: 2px; }
  .prose .anchor { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- try it live (try.html) ---------- */

.try-hero {
  padding: 56px 20px 34px;
  color: #e2e8f0;
  background:
    radial-gradient(50% 80% at 85% 0%, rgba(99, 102, 241, .32), transparent 70%),
    radial-gradient(45% 80% at 5% 0%, rgba(14, 165, 233, .25), transparent 70%),
    linear-gradient(180deg, #091428, #0d2142);
}
.try-hero .eyebrow { color: #7dd3fc; }
.try-hero h1 { margin: 0 0 14px; color: #ffffff; font-size: clamp(30px, 4.4vw, 48px); line-height: 1.1; letter-spacing: -.03em; font-weight: 800; }
.try-lead { margin: 0; max-width: 46em; color: #b6c2d4; font-size: 17px; line-height: 1.65; }

.try-body { padding: 28px 20px 80px; background: var(--bg-subtle); }
.try-modes { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin-bottom: 20px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-subtle); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.try-mode { font: inherit; font-size: 14.5px; font-weight: 600; padding: 8px 18px; border: 0; border-radius: 9px; background: transparent; color: var(--fg-muted); cursor: pointer; }
.try-mode:hover { color: var(--fg); }
.try-mode[aria-selected="true"] { background: var(--brand); color: #ffffff; }

.try-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.try-ocr-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .try-ocr-grid { grid-template-columns: minmax(0, 1fr); } }
.try-ocr-copy { margin: 0; color: var(--fg-secondary); font-size: 14px; line-height: 1.55; }
.try-ocr-result textarea { width: 100%; min-height: 180px; }
.try-ocr-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.try-ocr-or { display: flex; align-items: center; gap: 10px; color: var(--fg-muted); font-size: 12px; }
.try-ocr-or::before, .try-ocr-or::after { content: ""; height: 1px; flex: 1; background: var(--border-subtle); }
.try-ocr-pdf-preview { display: grid; gap: 10px; max-height: 540px; overflow: auto; }
.try-ocr-pdf-page { margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.try-ocr-pdf-page img { display: block; max-width: 100%; max-height: 320px; margin: auto; object-fit: contain; }
.try-ocr-pdf-page figcaption { padding-top: 5px; color: var(--fg-muted); font-size: 12px; text-align: center; }
.try-ocr-review { margin: 0; padding: 9px 11px; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-fg); font-size: 13px; }
.try-ocr-review[hidden], .try-mode[hidden] { display: none; }
@media (max-width: 900px) { .try-grid { grid-template-columns: minmax(0, 1fr); } }
.try-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06); min-width: 0; }
.try-result { position: sticky; top: 84px; }
@media (max-width: 900px) { .try-result { position: static; } }
.try-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.try-card-title { font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.try-card-note { font-size: 12.5px; color: var(--fg-muted); }
.try-editor-head { margin-top: 8px; }

.try-subjects { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: #e9edf3; }
.try-subject { flex: 1 1 0; min-width: 0; font: inherit; font-size: 14px; font-weight: 600; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--fg-muted); cursor: pointer; }
.try-subject:hover { color: var(--fg); }
.try-subject[aria-selected="true"] { background: var(--bg); color: var(--brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 1px 1px rgba(16, 24, 40, .06); }
.try-groups { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
.try-group { font: inherit; font-size: 13px; font-weight: 500; padding: 4px 11px; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg); color: var(--fg-secondary); cursor: pointer; }
.try-group:hover { border-color: var(--border); color: var(--fg); }
.try-group[aria-selected="true"] { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); font-weight: 650; }

.try-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; max-height: 250px; overflow-y: auto; padding: 2px 1px; }
.try-key { display: flex; align-items: center; justify-content: center; height: 46px; padding: 2px; font: 20px/1 "Cambria Math", "STIX Two Math", "Latin Modern Math", Cambria, Georgia, serif; color: var(--fg); background: linear-gradient(180deg, #ffffff, #f7f9fc); border: 1px solid #dfe4ec; border-radius: 10px; box-shadow: 0 1px 0 rgba(16, 24, 40, .05); cursor: pointer; overflow: hidden; white-space: nowrap; transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease, color .12s ease; }
.try-key:hover { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 4px 10px rgba(15, 108, 189, .14); transform: translateY(-1px); }
.try-key.is-word { font-size: 14px; }
/* The palette's template miniatures, as the pane draws them (frontend/taskpane.css). */
.try-key .slot { display: inline-block; width: 8px; height: 8px; border: 1px dashed currentColor; border-radius: 1.5px; opacity: .6; vertical-align: middle; }
.try-key .t-frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-size: 13px; }
.try-key .t-frac .t-den { border-top: 1px solid currentColor; padding-top: 2px; margin-top: 1px; }
.try-key .t-rad { display: inline-flex; align-items: flex-start; line-height: 1; font-size: 19px; }
.try-key .t-rad .t-radicand { border-top: 1px solid currentColor; padding: 2px 2px 0; margin-top: 1px; font-size: 13px; }
.try-key .t-rad .t-deg { font-size: 8px; margin-right: -3px; }
.try-key .t-over { border-top: 1px solid currentColor; padding-top: 1px; }
.try-key .t-acc { display: inline-block; line-height: .5; font-size: 13px; }
.try-key .t-base { font-size: 14px; }
.try-key .t-ss { display: inline-flex; flex-direction: column; font-size: 9px; line-height: 1; }
.try-key .t-bigop, .try-key .t-xarrow { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-size: 17px; }
.try-key .t-bigop sup, .try-key .t-bigop sub, .try-key .t-xarrow sup, .try-key .t-xarrow sub { font-size: 8px; line-height: 1; }
.try-key sup, .try-key sub { font-size: 9px; }
.try-key .t-mat { display: inline-flex; align-items: center; font-size: 19px; line-height: 1; }
.try-key .t-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 0 1px; }
.try-key .t-grid i, .try-key .t-stack i { display: block; width: 6px; height: 6px; border: 1px dashed currentColor; opacity: .6; }
.try-key .t-stack { display: grid; gap: 3px; }
.try-key .t-stack i { width: 13px; }
/* Aligned equations: rows with an = in them, so the button differs from Stacked. */
.try-key .t-stack-eq i { position: relative; } .try-key .t-stack-eq i::after { content: "="; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); font-size: 7px; font-style: normal; line-height: 1; opacity: 1; }
.try-key .t-grid-text i { width: auto; height: auto; border: 0; opacity: 1; font-size: 9px; line-height: 1; font-style: normal; text-align: center; }
.try-key .t-evalbar { font-size: 19px; line-height: 1; margin-left: 1px; }
/* Boxed, underlined, coloured and augmented-matrix button faces. */
.try-key .t-boxed { display: inline-block; padding: 1px 2px; border: 1px solid currentColor; line-height: 1; }
.try-key .t-under { display: inline-block; border-bottom: 1px solid currentColor; padding-bottom: 1px; line-height: 1; }
.try-key .t-color-red { color: var(--danger-fg); font-weight: 600; }
.try-key .t-color-blue { color: var(--brand); font-weight: 600; }
.try-key .t-rule { display: inline-block; width: 1px; align-self: stretch; margin: 0 2px; background: currentColor; opacity: .7; }
.try-key .t-col { display: grid; gap: 2px; }
.try-key .t-col i { display: block; width: 5px; height: 5px; border: 1px dashed currentColor; opacity: .6; }
.try-key .t-cancel { position: relative; display: inline-block; padding: 1px 3px; }
.try-key .t-cancel::before, .try-key .t-cancel-x::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top right, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%); }
.try-key .t-cancel-x::after { background: linear-gradient(to bottom right, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%); }
.try-key .t-brace { display: inline-block; font-size: 15px; line-height: 1; }

.try-latex { width: 100%; min-height: 84px; padding: 11px 13px; font: 14.5px/1.55 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; color: var(--fg); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; resize: vertical; }
.try-latex:focus { outline: none; background: var(--bg); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 108, 189, .2); }
.try-code { font-size: 13px; min-height: 260px; }
.try-select { font: inherit; font-size: 14.5px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--fg); }
.try-hint { margin: 6px 0 0; }
.try-editor-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.try-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-secondary); cursor: pointer; }
.try-check input { accent-color: var(--brand); }
.try-quiet { background: transparent; border-color: transparent; color: var(--fg-muted); }
.try-quiet:hover { background: var(--bg-hover); }
.try-examples-title { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.try-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.try-example { font: inherit; font-size: 13px; padding: 5px 11px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); color: var(--fg-secondary); cursor: pointer; }
.try-example:hover { border-style: solid; border-color: var(--brand); color: var(--brand); }

.try-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ok-fg); }
.try-live i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.try-paper { display: grid; place-items: safe center; min-height: 190px; padding: 28px 22px; background: #ffffff; color: #111111; border: 1px solid var(--border-subtle); border-radius: 12px; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .04); overflow-x: auto; }
.try-preview { font-size: 26px; max-width: 100%; }
.try-preview math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; }
.try-preview:empty::before { content: "Type LaTeX, click a symbol, or pick an example."; font: italic 14px "Inter", sans-serif; color: #6b7280; }
.try-figure img { display: block; max-width: 100%; height: auto; }
.try-error { margin: 0; white-space: pre-wrap; font-size: 14px; }
.try-actions { display: grid; gap: 8px; }
.try-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.try-actions .btn:disabled { opacity: .5; cursor: default; }
.try-tables-actions { max-width: 440px; margin: 14px 0 8px; }
.try-status { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; border: 1px solid; }
.try-status-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg); }
.try-status-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.try-facts { margin-top: 6px; }
.try-facts li { font-size: 14px; }
.try-upsell { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-top: 4px; padding: 14px 16px; border-radius: 12px; background: var(--brand-tint); }
.try-upsell p { margin: 0; flex: 1 1 260px; font-size: 14px; color: var(--fg-secondary); }
.try-doc-summary { margin: 0; font-size: 14.5px; font-weight: 600; }
.try-doc-intro { margin: 0; color: var(--fg-secondary); font-size: 13.5px; line-height: 1.5; }
.try-doc-field { display: grid; gap: 6px; margin: 14px 0 8px; font-size: 13px; font-weight: 650; color: var(--fg-secondary); }
.try-doc-field .try-select { width: 100%; max-width: 440px; }
.try-doc-file-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.try-doc-file-row label.btn { cursor: pointer; }
.try-doc-file-name { color: var(--fg-muted); font-size: 13px; overflow-wrap: anywhere; }
.try-doc-download-bar { position: sticky; bottom: 12px; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 18px; margin-top: 16px; padding: 18px 20px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-subtle); box-shadow: 0 6px 24px rgba(15, 23, 42, .10); }
.try-doc-download-bar p { margin: 4px 0 0; color: var(--fg-secondary); font-size: 13px; }
.try-doc-download-bar [role="status"] { grid-column: 1 / -1; min-height: 1.3em; color: var(--fg-muted); font-size: 13px; }
@media (max-width: 560px) { .try-doc-download-bar { grid-template-columns: 1fr; } .try-doc-download-bar .btn { width: 100%; } }
.try-account { margin: 12px 0 0; max-width: 46em; color: #d7e3f4; font-size: 14.5px; }
.try-work { padding: 8px 0 40px; }
.try-work h2 { margin: 0 0 4px; }
.try-work .try-status { margin: 10px 0; }

/* ---------- Your work (frontend/src/your-work.ts) ---------- */
.your-work-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.your-work-search { flex: 1 1 220px; min-width: 0; }
.your-work-search, .your-work-filter, .your-work-rename { font: inherit; padding: 7px 10px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg, #fff); color: inherit; }
.your-work-list { list-style: none; margin: 0; padding: 0; }
.your-work-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--border-subtle); overflow-wrap: anywhere; }
.your-work-item.is-pinned .your-work-title::before { content: "★ "; }
.your-work-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; min-width: 0; }
.your-work-title { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.your-work-meta { color: var(--fg-secondary); font-size: 13px; }
.your-work-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.your-work-renaming { display: flex; gap: 6px; flex-wrap: wrap; }
.your-work-empty { margin: 8px 0; }
.your-work-more { margin-top: 8px; }
.try-doc-page { margin: 0; padding: 18px 20px; border: 1px solid var(--border-subtle); border-radius: 12px; max-height: 520px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.75; }
.try-doc-page:empty { display: none; }
.try-doc-page math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; font-size: 1.12em; }
.try-doc-page math[display="block"] { margin: 6px 0; }
.try-doc-page > p { margin: 0 0 12px; }
.try-doc-page > h1, .try-doc-page > h2, .try-doc-page > h3, .try-doc-page > h4 { margin: 12px 0 8px; line-height: 1.3; }
.try-doc-page table { max-width: 100%; border-collapse: collapse; }
.try-doc-page td { padding: 5px 8px; border: 1px solid var(--border-subtle); vertical-align: top; }
.try-doc-image-placeholder { color: var(--fg-muted); font-style: italic; }
.try-doc-fill { display: inline-block; width: 3em; }
.try-doc-blank { display: inline-block; max-width: 100%; border-bottom: 1px solid currentColor; vertical-align: baseline; height: 1em; }
.try-doc-bad { padding: 1px 4px; border-radius: 4px; background: var(--danger-bg); color: var(--danger-fg); font-size: 0.85em; text-decoration: underline wavy; text-underline-offset: 3px; }
.try-doc-problems { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; color: var(--danger-fg); }
.try-doc-problems:empty { display: none; }
.try-doc-problems code { margin-right: 6px; overflow-wrap: anywhere; }

/* ---- graph builder (frontend/src/graph-editor.ts; the Word pane styles the same classes) ---- */
.try-grid-graph { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
@media (max-width: 900px) { .try-grid-graph { grid-template-columns: minmax(0, 1fr); } }
.gb-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gb-subjects { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: #e9edf3; }
.gb-subject { flex: 1 1 0; min-width: 0; font: inherit; font-size: 14px; font-weight: 600; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--fg-muted); cursor: pointer; }
.gb-subject:hover { color: var(--fg); }
.gb-subject[aria-selected="true"] { background: var(--bg); color: var(--brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.gb-start { display: flex; align-items: center; gap: 10px; }
.gb-label { flex: none; font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.gb-preset, .gb-select { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 14px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--fg); }
.gb-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gb-line { display: grid; gap: 5px; padding: 6px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg); }
.gb-line.has-error { border-color: var(--danger-border); background: var(--danger-bg); }
.gb-line-head { display: flex; align-items: center; gap: 6px; }
.gb-input { width: 100%; min-width: 0; font: 14px/1.4 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; padding: 7px 9px; color: var(--fg); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 8px; }
.gb-input:focus { outline: none; background: var(--bg); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 108, 189, .2); }
.gb-line-input { flex: 1 1 auto; border-color: transparent; background: transparent; }
.gb-add { border-style: dashed; }
.gb-swatch { flex: none; width: 18px; height: 18px; padding: 0; border: 2px solid var(--bg); border-radius: 50%; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.gb-swatch.is-hidden { opacity: .3; }
.gb-icon { flex: none; width: 28px; height: 28px; padding: 0; font-family: inherit; font-size: 15px; line-height: 1; border: 0; border-radius: 7px; background: transparent; color: var(--fg-muted); cursor: pointer; }
.gb-icon:hover { background: var(--bg-hover); color: var(--fg); }
.gb-remove:hover { color: var(--danger-fg); }
.gb-palette { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 2px 26px; }
.gb-palette[hidden] { display: none; }
.gb-chip { width: 22px; height: 22px; padding: 0; border: 2px solid var(--bg); border-radius: 50%; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.gb-chip:hover { box-shadow: 0 0 0 2px var(--brand); }
.gb-slider { display: flex; align-items: center; gap: 6px; padding-left: 26px; }
.gb-slider[hidden] { display: none; }
.gb-slider input[type=range] { flex: 1 1 auto; min-width: 60px; accent-color: var(--brand); }
.gb-num { width: 74px; flex: none; font-size: 13px; padding: 4px 6px; }
.gb-range-end { width: 58px; }
.gb-message { padding-left: 26px; font-size: 13px; color: var(--fg-muted); overflow-wrap: anywhere; }
.gb-message[hidden] { display: none; }
.gb-message.is-error { color: var(--danger-fg); }
.gb-message.is-result { color: var(--ok-fg); font-weight: 600; }
.gb-help, .gb-settings { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.gb-help summary, .gb-settings summary { cursor: pointer; font-weight: 600; color: var(--fg-secondary); }
.gb-help dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 6px; }
.gb-help dt { font: 13px "Cascadia Mono", Consolas, monospace; color: var(--brand); }
.gb-help dd { margin: 0; font-size: 13px; color: var(--fg-secondary); }
@media (max-width: 520px) { .gb-help dl { grid-template-columns: 1fr; } .gb-help dd { margin-bottom: 6px; } }
.gb-note { margin: 4px 0 2px; font-size: 13px; color: var(--fg-muted); }
.gb-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 10px; }
@media (max-width: 520px) { .gb-settings-grid { grid-template-columns: 1fr; } }
.gb-field { display: grid; gap: 4px; font-size: 12.5px; color: var(--fg-muted); }
.gb-field .gb-input, .gb-field .gb-select { font-size: 13.5px; }
.gb-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-secondary); cursor: pointer; }
.gb-check input { accent-color: var(--brand); }
.gb-view-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gb-view-row .gb-num { width: 100%; }
.gb-stage { display: grid; gap: 8px; }
.gb-canvas { position: relative; overflow: hidden; background: #ffffff; border: 1px solid var(--border-subtle); border-radius: 12px; touch-action: none; }
.gb-canvas:focus-visible { outline: 3px solid rgba(15, 108, 189, .35); outline-offset: 2px; }
.gb-figure { display: block; width: 100%; height: auto; cursor: grab; user-select: none; -webkit-user-select: none; }
.gb-canvas.is-dragging .gb-figure { cursor: grabbing; }
.gb-tools { position: absolute; top: 8px; right: 8px; display: grid; gap: 4px; }
.gb-tool { width: 32px; height: 32px; padding: 0; font-family: inherit; font-size: 17px; font-weight: 600; line-height: 1; color: #333333; background: rgba(255, 255, 255, .92); border: 1px solid #d6d9de; border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); cursor: pointer; }
.gb-tool:hover { border-color: var(--brand); color: var(--brand); }
.gb-readout { position: absolute; left: 8px; bottom: 6px; font: 12px "Cascadia Mono", Consolas, monospace; color: #555555; background: rgba(255, 255, 255, .85); padding: 1px 6px; border-radius: 5px; pointer-events: none; }
.gb-readout:empty { display: none; }
.gb-error { margin: 0; font-size: 14px; color: var(--danger-fg); }
.gb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gb-actions .btn { flex: 1 1 auto; }

@media (prefers-color-scheme: dark) {
  .try-subjects, .gb-subjects { background: #2a2c30; }
  .try-key { background: linear-gradient(180deg, #303236, #2a2c30); border-color: #3d4045; }
}

/* ---------- admin: diagram library ---------- */

.library-preview { margin: 10px 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; overflow: auto; text-align: center; }
.library-preview:empty { display: none; }
.library-preview img { max-width: 100%; height: auto; }
#library-source { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

/* ---------- ai.html ---------- */

.ai-thumb { display: block; max-width: 100%; max-height: 220px; margin: 8px 0 12px; border: 1px solid var(--border); border-radius: 8px; }
/* The crop box over a photo (ai.html, frontend/src/photo-crop.ts): what's outside it is dimmed. */
.crop { margin: 8px 0 12px; }
.crop-stage { position: relative; display: inline-block; max-width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; line-height: 0; }
.crop-stage img { display: block; max-width: 100%; max-height: 420px; pointer-events: none; }
.crop-box { position: absolute; box-sizing: border-box; border: 2px solid #fff; outline: 1px solid rgba(0, 0, 0, .6); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); cursor: move; }
.crop-box:focus-visible { outline: 3px solid var(--brand); }
.crop-handle { position: absolute; width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); box-sizing: border-box; }
.crop-nw { left: 0; top: 0; cursor: nwse-resize; }
.crop-ne { right: 0; top: 0; cursor: nesw-resize; }
.crop-sw { left: 0; bottom: 0; cursor: nesw-resize; }
.crop-se { right: 0; bottom: 0; cursor: nwse-resize; }
.crop-help { margin: 6px 0 0; line-height: 1.5; }
.crop-help .btn-link { display: inline; padding: 0; min-height: 0; vertical-align: baseline; }
.ai-preview { margin: 4px 0 14px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #111; overflow: auto; text-align: center; }
.ai-preview:empty { display: none; }
.ai-preview img { max-width: 100%; height: auto; }
.ai-preview math { font-size: 1.4em; }
/* Your creations (ai.html): a tile per saved result, drawn again from its LaTeX. */
.creations { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.creation { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.creation-pinned { border-color: var(--brand); background: var(--brand-tint); }
.creation-thumb { height: 120px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 8px; background: #fff; color: #111; }
.creation-thumb img { max-width: 100%; max-height: 120px; }
.creation-thumb code { font-size: 12px; white-space: pre-wrap; word-break: break-word; padding: 6px; text-align: left; }
.creation-photo { max-width: 100%; max-height: 72px; align-self: flex-start; border-radius: 6px; border: 1px solid var(--border); }
.creation-meta { font-size: 13px; color: var(--fg-muted); }
.creation-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.creation-actions .btn { padding: 4px 10px; font-size: 13px; }
#result-source { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

/* ---------- the admin dashboard (web/admin.html): an app of its own ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.admin { background: var(--bg-subtle); min-height: 100vh; }
.admin-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}
.admin-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.admin-brand img { border-radius: 7px; }
.admin-brand-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); }
.env-badge { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-border); }
.admin-top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.admin-top-link { color: var(--fg-secondary); text-decoration: none; font-size: 14px; }
.admin-top-link:hover { color: var(--fg); text-decoration: underline; }
.admin-who { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--border-subtle); }
.admin-who-text { display: flex; flex-direction: column; line-height: 1.25; }
.admin-who-text strong { font-size: 13.5px; font-weight: 600; }
.admin-who-text span { font-size: 12px; color: var(--fg-muted); }
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a7ad4, #0b3f74);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12.5px; }

.admin-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); flex: 1; }
.admin-nav {
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg);
}
.admin-nav[hidden] { display: none; }
.admin-nav-list { display: flex; flex-direction: column; gap: 2px; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-secondary);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.admin-nav-item svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.admin-nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.admin-nav-item[aria-selected="true"] { background: var(--brand-tint); color: var(--brand); font-weight: 600; }

.admin-main { min-width: 0; padding: 28px 32px 56px; }
.admin-panel { max-width: 1180px; margin: 0 auto; }
.admin-loading { padding: 40px 0; text-align: center; }
.admin-denied { max-width: 520px; margin: 48px auto; text-align: center; }
.admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-head h1 { font-size: 26px; margin: 0 0 4px; }
.admin-head p { margin: 0; max-width: 72ch; }
.admin-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.admin-grid-2 > .card { margin-bottom: 0; }
.admin-panel > .card, .admin-panel > .admin-grid-2 { margin-bottom: 16px; }
.reading-example { margin-bottom: 12px; }
.reading-example code { white-space: pre-wrap; overflow-wrap: anywhere; }
.reading-photo { display: block; max-width: 100%; max-height: 320px; margin: 8px 0; background: #fff; border: 1px solid var(--border); border-radius: 6px; }

.admin .card { border-radius: 12px; padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; font-size: 16px; }
.card-flush { padding: 0 !important; overflow: hidden; }
.card-flush .table th, .card-flush .table td { padding-left: 16px; padding-right: 16px; }
.card-flush > .card-pad { margin: 0; padding: 16px; }
.card-foot { padding: 10px 16px; }
.card-foot:has(> [hidden]:only-child) { display: none; }
.form-band { margin-top: 12px; padding: 14px; border-radius: 10px; background: var(--bg-subtle); border: 1px dashed var(--border); }

.reason-field { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: var(--brand-tint); border: 1px solid var(--border-subtle); }
.reason-field[hidden] { display: none; }
.reason-field input { background: var(--bg); }

/* The overview's figures. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { padding: 16px 18px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-subtle); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.kpi dt { font-size: 13px; color: var(--fg-muted); font-weight: 500; }
.kpi dd { margin: 4px 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.kpi-note { margin: 0; font-size: 12.5px; color: var(--fg-muted); }
.kpi-warn { border-color: var(--warn-border); background: var(--warn-bg); }
.kpi-warn dd { color: var(--warn-fg); }

/* Tables. */
.admin .table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 8px; background: var(--bg-subtle); border-bottom: 1px solid var(--border-subtle); }
.admin .table td { padding: 10px 8px; }
.admin .table tbody tr:hover td { background: var(--bg-subtle); }
.admin .table tbody tr:last-child td { border-bottom: 0; }
.table-compact td { padding-top: 7px !important; padding-bottom: 7px !important; }
.admin .feature-matrix th { text-transform: none; letter-spacing: 0; font-size: 13px; }
.admin .feature-matrix th small { font-weight: 400; }
.meter:has(+ .table-wrap > [hidden]) { margin-bottom: 4px; }
.row-link { cursor: pointer; }
.row-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.account-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-cell > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.account-cell strong { font-weight: 500; overflow-wrap: anywhere; }

.admin .badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.admin .badge + .badge { margin-left: 4px; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-border) !important; }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border) !important; }
.badge-info { background: var(--brand-tint); color: var(--brand); }
.badge-muted { background: var(--bg-hover); color: var(--fg-muted); }

.admin-search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.admin-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--fg-muted); stroke-width: 1.8; stroke-linecap: round; }
.admin-search input { flex: 1; min-width: 0; font: inherit; padding: 8px 4px; border: 0; background: transparent; color: var(--fg); }
.admin-search input:focus { outline: none; }
.admin-search-filter { flex: none; font: inherit; font-size: 13.5px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); cursor: pointer; }
.admin .toolbar .field-inline { flex: 0 1 360px; }
.admin .toolbar .field-fit { flex: 0 1 auto; }
@media (max-width: 640px) { .admin-search { flex-wrap: wrap; } .admin-search input { flex-basis: calc(100% - 30px); } }

.meter { height: 8px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; margin: 4px 0 14px; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width .3s; }
.meter span.meter-warn { background: #d18a00; }
.meter span.meter-danger { background: var(--danger-fg); }

.library-edit { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.library-edit textarea { font-family: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; font-size: 13px; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--fg-secondary); margin-bottom: 5px; }
.library-edit .library-preview { margin: 0; min-height: 120px; }
.library-help { margin: 8px 0 0; padding-left: 18px; }
.library-help li { margin: 2px 0; }
/* A question paper in the Library tab's preview, roughly as Word lays it out. */
.paper-preview { text-align: left; color: #111; font-size: 13px; line-height: 1.45; }
.paper-preview p { margin: 0 0 4px; }
.paper-school, .paper-exam, .paper-section, .paper-note, .paper-or { text-align: center; }
.paper-school { font-size: 17px; font-weight: 700; }
.paper-exam, .paper-section, .paper-heading, .paper-or { font-weight: 700; }
.paper-preview .paper-section { margin-top: 12px; }
.paper-note { font-style: italic; }
.paper-fields { display: flex; justify-content: space-between; gap: 12px; }
.paper-instructions { margin: 0 0 8px; padding-left: 22px; }
.paper-preview .paper-question { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px; margin-top: 8px; }
.paper-marks { white-space: nowrap; }
.paper-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; padding-left: 30px; margin-bottom: 4px; }
.paper-part, .paper-text { padding-left: 30px; }

/* Messages: a toast at the top right, over everything. */
.admin-toast { position: fixed; top: 68px; right: 20px; z-index: 120; max-width: min(440px, calc(100vw - 40px)); margin: 0; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); background: var(--bg); }

/* One account: a panel from the right, over a dimmed page. */
.drawer { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: flex-end; background: rgba(15, 23, 42, .45); animation: modal-fade .15s ease-out; }
.drawer[hidden] { display: none; }
.drawer-panel { display: flex; flex-direction: column; width: min(760px, 100%); height: 100%; background: var(--bg); box-shadow: -16px 0 48px rgba(15, 23, 42, .2); animation: drawer-in .2s ease-out; }
.drawer-head { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 20px 64px 16px 24px; border-bottom: 1px solid var(--border-subtle); }
.drawer-head h2 { margin: 0 0 4px; font-size: 19px; overflow-wrap: anywhere; }
.drawer-head p { margin: 0; }
.drawer-head .modal-close { top: 16px; right: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 24px 40px; }
.drawer-section { padding: 16px 0; border-top: 1px solid var(--border-subtle); }
.drawer-section > h3:first-child { margin-top: 0; }
.drawer .reason-field { margin-bottom: 4px; }
@keyframes drawer-in { from { transform: translateX(32px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-panel { animation: none; } }

@media (max-width: 960px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: sticky; top: 56px; z-index: 15; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .admin-nav-item { width: auto; flex: none; white-space: nowrap; }
  .admin-main { padding: 20px 16px 48px; }
  .admin-grid-2, .library-edit { grid-template-columns: minmax(0, 1fr); }
  .admin-who-text, .admin-top-link { display: none; }
}
@media (max-width: 560px) {
  .admin-brand span:not(.admin-brand-tag) { display: none; }
  .admin-head { flex-direction: column; }
  .admin-top, .admin-top-actions { gap: 8px; }
  .admin-top { padding: 0 12px; }
  .admin-who { padding-left: 8px; }
  .admin-top .btn { white-space: nowrap; }
  /* Two figures a row, not one per screen. */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi dd { font-size: 22px; }
  /* Tables scroll sideways in their wrapper instead of breaking emails and dates letter by letter. */
  .admin-main .table td, .admin-main .account-cell strong { overflow-wrap: break-word; }
  .admin-main .table td:last-child { white-space: nowrap; }
  .env-badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; letter-spacing: 0; padding: 3px 6px; }
  .admin-brand-tag { flex: none; }
}

/* The desktop app's build: what's new, and a checksum to compare. */
.download-details { margin-top: 8px; }
.download-details summary { cursor: pointer; color: var(--fg-muted, inherit); }
.download-notes { white-space: pre-line; margin: 8px 0; }
.download-sha { word-break: break-all; font-size: 12px; }

/* ---- PDF to LaTeX (pdf.html; desktop/ui/pdf.ts, styled as in the desktop app) ---- */
body.pdf-embedded { min-width: 0; background: transparent; }
body.pdf-embedded .site-header, body.pdf-embedded .site-footer,
body.pdf-embedded .pdf-app > h1, body.pdf-embedded .pdf-app > .lead,
body.pdf-embedded .pdf-studio .converter-tabs { display: none !important; }
body.pdf-embedded .pdf-app { max-width: none; margin: 0; padding: 14px; }
body.pdf-embedded .pdf-studio { gap: 10px; }
.pdf-studio { display: flex; flex-direction: column; gap: 16px; }
.pdf-studio .tabs-row { margin-bottom: 0; }
a.tab-btn { text-decoration: none; }
.pdf-app .banner { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pdf-app .banner-info { background: var(--brand-tint); border-color: var(--brand); }
.pdf-app .banner-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.pdf-app .banner p { margin: 0; flex: 1 1 280px; }
.pdf-app .banner .btn[hidden] { display: none; }
.pdf-app .drop { border: 1.5px dashed var(--brand); border-radius: 18px; background: linear-gradient(145deg, var(--brand-tint), var(--bg) 72%); padding: clamp(30px, 5vw, 54px) 24px; text-align: center; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease; }
.pdf-app .drop:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pdf-app .drop.is-over { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 4px rgba(15, 108, 189, .12); transform: translateY(-1px); }
.pdf-app .drop.is-disabled { opacity: .55; pointer-events: none; }
.pdf-app .drop-title { margin: 0; font-size: clamp(19px, 2vw, 23px); font-weight: 700; letter-spacing: -.02em; }
.pdf-app .drop-hint { margin: 9px auto 20px; max-width: 68ch; color: var(--fg-secondary); line-height: 1.65; }
.pdf-app .drop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pdf-app .hint { margin: 0; color: var(--fg-muted); font-size: 13px; }
.pdf-job { display: flex; flex-direction: column; gap: 16px; border-radius: 16px; }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pdf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.pdf-file { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pdf-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.pdf-range { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-secondary); }
.pdf-range input { width: 5.5em; min-height: 40px; font: inherit; padding: 6px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--fg); }
.pdf-cost { margin: 0; color: var(--fg-secondary); }
.pdf-cost.is-short { color: var(--danger-fg); }
.pdf-notice p { flex-basis: 100%; }
.pdf-progress-box { display: flex; flex-direction: column; gap: 8px; }
.pdf-progress-box progress { width: 100%; height: 6px; accent-color: var(--brand); }
.pdf-pages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.pdf-page { min-width: 2.2em; padding: 2px 6px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; border: 1px solid var(--border-subtle); border-radius: var(--radius); color: var(--fg-muted); background: var(--bg-subtle); }
.pdf-page.is-reading, .pdf-page.is-converting { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.pdf-page.is-converting { font-weight: 600; }
.pdf-page.is-done { border-color: var(--ok-border); color: var(--ok-fg); background: var(--ok-bg); }
.pdf-page.is-check { border-color: var(--warn-border); color: var(--warn-fg); background: var(--warn-bg); }
.pdf-page.is-failed { border-color: var(--danger-border); color: var(--danger-fg); background: var(--danger-bg); }
.pdf-page.is-here { border-color: var(--ok-border); color: var(--ok-fg); background: var(--bg); border-style: dashed; }
.pdf-check { margin: 4px 0 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-fg); }
.pdf-check p { margin: 0; }
.pdf-check .hint { margin-top: 6px; color: inherit; opacity: .85; }
.pdf-check-title { font-weight: 600; }
.pdf-check ul { margin: 4px 0 0; padding-left: 18px; }
.pdf-check li { overflow-wrap: anywhere; }
.pdf-modes { margin: 0; padding: 8px 12px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius); display: grid; gap: 6px; }
.pdf-modes legend { padding: 0 4px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.pdf-mode { display: flex; align-items: flex-start; gap: 8px; color: var(--fg-secondary); }
.pdf-mode input { margin-top: 3px; }
.pdf-engine { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; color: var(--fg-secondary); }
.pdf-engine[hidden] { display: none; }
.pdf-engine-label { font-weight: 600; }
.pdf-engine-option { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pdf-app .results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pdf-history { display: flex; flex-direction: column; gap: 8px; }
.pdf-history h2, .pdf-history p { margin: 0; }
.pdf-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pdf-history-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.pdf-history-list li span { overflow-wrap: anywhere; }
.pdf-app .result { background: var(--bg); border: 1px solid var(--border-subtle); border-left: 3px solid var(--ok-fg); border-radius: var(--radius); padding: 10px 12px; }
.pdf-app .result-head { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pdf-app .result-summary { margin: 2px 0 8px; color: var(--fg-secondary); }
.pdf-app .result-error { margin: 4px 0 0; color: var(--danger-fg); }
.pdf-app .result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pdf-app .result details { margin-top: 8px; color: var(--fg-secondary); }
.pdf-app .result summary { cursor: pointer; }
.pdf-app .result details ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.pdf-app.page { max-width: 1480px; padding: 42px clamp(20px, 4vw, 64px) 72px; }
.pdf-embedded .pdf-app.page { max-width: none; padding: 14px; }
.pdf-app > h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 40px); letter-spacing: -.035em; }
.pdf-app > .lead { max-width: 74ch; margin-bottom: 26px; line-height: 1.65; }
.pdf-app .converter-tabs { gap: 7px; padding: 6px; overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: 13px; background: var(--bg-subtle); }
.pdf-app .converter-tabs .tab-btn { flex: 0 0 auto; min-height: 40px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 600; }
.pdf-app .converter-tabs .tab-btn[aria-current="page"] { border-color: var(--brand); background: var(--bg); color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.pdf-app .pdf-job { padding: clamp(16px, 2.5vw, 26px); }
.pdf-app .pdf-modes { padding: 13px 16px 15px; border-radius: 12px; }
.pdf-app .pdf-mode { padding: 5px 0; line-height: 1.55; }
.pdf-app .pdf-options { padding: 4px 0; }
.pdf-app .pdf-cost { padding: 13px 15px; border: 1px solid var(--border-subtle); border-radius: 11px; background: var(--bg-subtle); line-height: 1.55; }
.pdf-app .pdf-notice { padding: 13px 15px; border-radius: 11px; line-height: 1.6; }
.pdf-app .pdf-actions .btn { min-height: 44px; padding-inline: 18px; }
.pdf-review-result { padding: clamp(14px, 2.5vw, 24px) !important; border-left: 0 !important; border-top: 3px solid var(--brand) !important; border-radius: 16px !important; box-shadow: 0 6px 22px rgba(15, 23, 42, .06); }
.pdf-review-result > .result-head { font-size: 20px; letter-spacing: -.02em; }
.pdf-review-result > .result-summary { margin: 6px 0 16px; font-size: 14px; }
.pdf-review-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 6px; padding: 14px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-subtle); }
.pdf-review-toolbar label { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 650; }
.pdf-review-toolbar .btn { min-height: 42px; padding-inline: 20px; }
.pdf-review-format { min-width: min(280px, 70vw); min-height: 42px; padding: 7px 36px 7px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--fg); font: inherit; }
.pdf-review-status { display: block; min-height: 1.5em; color: var(--fg-secondary); font-size: 13px; line-height: 1.5; }
.pdf-review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 16px; align-items: stretch; }
.pdf-review-pane { min-width: 0; min-height: 680px; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg); box-shadow: 0 3px 14px rgba(15, 23, 42, .045); }
.pdf-review-pane h3 { margin: 0; padding: 15px 18px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; color: var(--fg-secondary); }
.pdf-review-original { display: flex; flex-direction: column; background: linear-gradient(155deg, var(--brand-tint), var(--bg) 45%); }
.pdf-review-original-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 18px; }
.pdf-review-main-image { display: block; max-width: 100%; max-height: 610px; object-fit: contain; background: #fff; border: 1px solid var(--border-subtle); border-radius: 4px; box-shadow: 0 8px 28px rgba(15, 23, 42, .12); }
.pdf-review-page-label { margin: 11px 0 0; color: var(--fg-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pdf-review-thumbnails { display: flex; gap: 9px; max-width: 100%; overflow-x: auto; padding: 12px; border-bottom: 1px solid var(--border-subtle); scrollbar-width: thin; }
.pdf-review-thumb { display: grid; flex: 0 0 66px; gap: 4px; justify-items: center; padding: 5px; border: 1px solid var(--border-subtle); border-radius: 9px; background: var(--bg); color: var(--fg-secondary); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.pdf-review-thumb:hover { border-color: var(--brand); transform: translateY(-1px); }
.pdf-review-thumb:focus-visible, .pdf-review-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pdf-review-thumb[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint); color: var(--brand); }
.pdf-review-thumb img { display: block; width: 52px; height: 68px; object-fit: contain; background: #fff; }
.pdf-review-thumb span { font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pdf-review-converted { display: flex; flex-direction: column; }
.pdf-review-tabs { display: flex; gap: 5px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-subtle); }
.pdf-review-tab { padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--fg-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.pdf-review-tab:hover { background: var(--bg-hover); color: var(--fg); }
.pdf-review-tab.is-active { border-color: var(--brand); background: var(--bg); color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.pdf-review-preview { flex: 1; min-height: 0; max-height: 720px; overflow: auto; padding: clamp(18px, 2.8vw, 30px); color: var(--fg); line-height: 1.75; scrollbar-width: thin; }
.pdf-review-preview[hidden], .pdf-review-editor[hidden] { display: none; }
.pdf-review-text { margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pdf-review-preview .math-pieces { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; margin: 20px 0; padding: 8px; font-size: 1.22em; }
.pdf-review-preview .math-piece math { max-width: 100%; }
.pdf-review-bad-math { display: block; overflow-wrap: anywhere; color: var(--danger-fg); }
.pdf-review-editor { flex: 1; width: 100%; min-height: 600px; resize: vertical; box-sizing: border-box; padding: 20px; border: 0; border-radius: 0 0 16px 16px; background: var(--bg-subtle); color: var(--fg); font: 13px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.pdf-review-editor:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; }
.pdf-review-result .pdf-check { margin: 12px 0; padding: 13px 15px; border-radius: 11px; line-height: 1.55; }
.pdf-app .btn { border-radius: 9px; font-weight: 650; transition: transform .14s ease, box-shadow .14s ease, background .14s ease; }
.pdf-app .btn-primary { box-shadow: 0 2px 5px rgba(15, 108, 189, .25); }
.pdf-app .btn-primary:hover:not(:disabled) { box-shadow: 0 5px 12px rgba(15, 108, 189, .25); transform: translateY(-1px); }
.pdf-app .btn:focus-visible, .pdf-review-format:focus-visible, .pdf-range input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 900px) {
  .pdf-review-grid { grid-template-columns: minmax(0, 1fr); }
  .pdf-review-pane { min-height: 500px; }
  .pdf-review-main-image { max-height: 430px; }
  .pdf-review-preview { max-height: 620px; }
  .pdf-review-editor { min-height: 480px; }
}
@media (max-width: 600px) {
  .pdf-app.page { padding: 28px 14px 48px; }
  .pdf-review-result { padding: 12px !important; }
  .pdf-review-toolbar { align-items: stretch; }
  .pdf-review-toolbar label { align-items: flex-start; flex-direction: column; }
  .pdf-review-format { width: 100%; min-width: 0; }
  .pdf-review-toolbar .btn { width: 100%; }
  .pdf-review-pane { min-height: 400px; }
  .pdf-review-original-body { min-height: 360px; }
  .pdf-review-main-image { max-height: 340px; }
  .pdf-review-preview { max-height: 520px; padding: 18px; }
  .pdf-review-editor { min-height: 420px; padding: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .pdf-app .drop, .pdf-app .btn, .pdf-review-tab, .pdf-review-thumb { transition: none; }
}

/* Admin -> Plans: a plan's highlights, one a line. */
.plan-highlights { min-width: 220px; width: 100%; font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); resize: vertical; }
.plan-pages { display: grid; gap: 4px; }
.plan-pages label { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

/* ---------- tabs become a menu on phones (web/src/mobile-menu.ts) ----------
   A button naming the current section opens the whole list; picking one closes it. */
.mobile-menu-toggle { display: none; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--fg); font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.mobile-menu-toggle svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-menu-toggle .mobile-menu-hint { color: var(--fg-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mobile-menu-toggle .mobile-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-menu-toggle .mobile-menu-chevron { transition: transform .15s; }
.mobile-menu-toggle[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-chevron { transform: rotate(180deg); }
@media (max-width: 760px) { .try-shell .mobile-menu-toggle { display: flex; } }

/* Account: the section links (account.ts). */
@media (max-width: 860px) {
  .account-nav .mobile-menu-toggle { display: flex; }
  .account-nav { position: sticky; top: 72px; z-index: 30; display: block; overflow: visible; margin-bottom: 16px; padding: 0; border: 0; background: transparent; }
  .account-nav:not(.is-menu-open) a { display: none; }
  .account-nav.is-menu-open .account-nav-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); display: grid; gap: 2px; padding: 6px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); box-shadow: 0 16px 36px rgba(15, 23, 42, .16); }
  .account-nav.is-menu-open a { display: block; padding: 11px 12px; white-space: normal; }
  .account-nav.is-menu-open a[href="#delete"] { margin-top: 4px; padding-top: 11px; border-top: 1px solid var(--border-subtle); border-radius: 0 0 9px 9px; }
}

/* Admin: the sections (admin.ts). */
@media (max-width: 960px) {
  .admin-nav .mobile-menu-toggle { display: flex; }
  .admin-nav { position: sticky; top: 56px; z-index: 15; display: block; overflow: visible; padding: 10px 12px; }
  .admin-nav:not(.is-menu-open) .admin-nav-item { display: none; }
  .admin-nav.is-menu-open .admin-nav-list { position: absolute; left: 12px; right: 12px; top: calc(100% - 4px); display: grid; gap: 2px; max-height: calc(100vh - 140px); overflow-y: auto; padding: 6px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); box-shadow: 0 16px 36px rgba(15, 23, 42, .16); }
  .admin-nav.is-menu-open .admin-nav-item { display: flex; width: 100%; white-space: normal; }
}

/* Docs: the sidebar is a menu on phones (scripts/docs-site.mjs). */
.docs-mobile-menu { display: none; }
@media (max-width: 860px) {
  .docs-layout > .docs-nav { display: none; }
  .docs-mobile-menu { display: block; position: relative; }
  .docs-mobile-menu > summary { display: flex; list-style: none; }
  .docs-mobile-menu > summary::-webkit-details-marker { display: none; }
  .docs-mobile-menu[open] > summary { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
  .docs-mobile-menu[open] > summary .mobile-menu-chevron { transform: rotate(180deg); }
  .docs-mobile-menu .docs-nav { position: static; display: block; margin-top: 8px; max-height: none; padding: 8px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg); box-shadow: 0 16px 36px rgba(15, 23, 42, .12); }
  .docs-mobile-menu .docs-nav ul { display: block; }
  .docs-mobile-menu .docs-nav li a, .docs-mobile-menu .docs-home { padding: 10px 12px; }
}

/* The For institutes page's enquiry form (web/src/institutes.ts). */
.enquiry { padding: 28px; margin: 40px 0; scroll-margin-top: 84px; }
.enquiry h2 { margin: 0 0 6px; }
.enquiry form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.enquiry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.enquiry textarea { resize: vertical; }
.enquiry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.enquiry .notice { margin: 0; }
/* A field people never see; a bot that fills it is thanked and ignored. */
.enquiry-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 600px) { .enquiry { padding: 20px 16px; } }
.enquiry-message { margin: 6px 0 0; max-width: 46ch; white-space: pre-wrap; }

/* The home page's row of smaller tools under the three main features. */
.more-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 56px; }
.more-tool { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.more-tool:hover, .more-tool:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.more-tool strong { color: var(--fg); font-size: 15px; }
.more-tool span { color: var(--fg-secondary); font-size: 14px; line-height: 1.5; }

/* The account page's invite link (web/src/account.ts renderInvite). */
.invite-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.invite-link { flex: 1 1 240px; min-width: 0; font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); }

/* "Help TeXConverter read better": the converter pages' popup (src/share-ask.ts). */
.share-ask { width: min(100% - 32px, 520px); max-height: calc(100vh - 32px); padding: 32px 32px 22px; border: 1px solid var(--border-subtle); border-radius: 18px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 64px rgba(15, 23, 42, .28); overflow: auto; }
.share-ask::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.share-ask-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-tint); color: var(--brand); }
.share-ask h2 { margin: 14px 0 8px; font-size: 22px; line-height: 1.25; }
.share-ask-lead { margin: 0 0 16px; color: var(--fg-secondary); line-height: 1.55; }
.share-ask-points { list-style: none; margin: 0 0 18px; padding: 14px 16px; border-radius: 12px; background: var(--bg-subtle); border: 1px solid var(--border-subtle); display: grid; gap: 10px; }
.share-ask-points li { display: grid; gap: 2px; padding-left: 22px; position: relative; font-size: 14px; line-height: 1.45; color: var(--fg-secondary); }
.share-ask-points li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 10px; height: 6px; border-left: 2px solid var(--ok-fg); border-bottom: 2px solid var(--ok-fg); transform: rotate(-45deg); }
.share-ask-points strong { color: var(--fg); font-weight: 600; }
.share-ask-status { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); border: 1px solid var(--ok-border); color: var(--ok-fg); font-size: 14px; }
.share-ask-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.share-ask-actions .btn { min-height: 42px; padding-inline: 20px; border-radius: 10px; }
.share-ask-fine { margin: 14px 0 0; font-size: 13px; color: var(--fg-muted); }
@media (max-width: 480px) {
  .share-ask { padding: 26px 18px 18px; }
  .share-ask-actions .btn { flex: 1 1 auto; }
}

/*
 * The Matrix / Cases / Aligned-equations size dialog (frontend/src/template-dialog.ts).
 *
 * Shared by the Word pane, the website and the desktop app: each build
 * appends this file to that host's own stylesheet. It uses only the colour
 * tokens all three define (--bg, --fg, --border, --brand...), so it follows
 * each host's light and dark themes without a theme of its own. Sized for the
 * narrowest host, a ~320px Word task pane.
 */
.tpl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 8px;
  overflow-y: auto;
  background: rgba(0, 0, 0, .38);
}

.tpl-overlay, .tpl-overlay * { box-sizing: border-box; }

.tpl-dialog {
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: 16px 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 6px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
}

.tpl-title { margin: 0 0 12px; font-size: 16px; font-weight: 600; }

.tpl-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }

.tpl-picker-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tpl-picker {
  display: grid;
  grid-template-columns: repeat(8, 14px);
  gap: 2px;
  cursor: pointer;
  user-select: none;
}
.tpl-cell {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-subtle);
}
.tpl-cell.on { background: var(--brand-tint); border-color: var(--brand); }
.tpl-size { margin: 0; font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.tpl-side { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 120px; }
.tpl-numbers { display: flex; gap: 8px; }
.tpl-number { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--fg-secondary); }
.tpl-number input {
  width: 56px;
  padding: 4px 6px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius, 4px);
}
.tpl-number input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.tpl-preview, .tpl-lines {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 40px;
  max-width: 100%;
  overflow: hidden;
  color: var(--fg-secondary);
}
.tpl-fence { display: flex; align-items: center; font-size: 26px; line-height: 1; font-family: "Cambria Math", "STIX Two Math", serif; }
.tpl-mini { display: inline-grid; gap: 3px; align-self: center; padding: 2px; }
.tpl-mini i {
  display: block;
  min-width: 10px;
  height: 10px;
  background: var(--fg-muted);
  opacity: .45;
  border-radius: 1px;
}
.tpl-mini i.has-text {
  height: auto;
  background: none;
  opacity: 1;
  font: 10px/1.1 "Cambria Math", "STIX Two Math", serif;
  font-style: normal;
}
.tpl-mini .tpl-rule { display: block; width: 1px; align-self: stretch; background: var(--fg-secondary); margin: 0 1px; }
.tpl-check { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--fg-secondary); cursor: pointer; }
.tpl-check input { margin: 0; accent-color: var(--brand); }
.tpl-align-left i { justify-self: start; }
.tpl-align-right i { justify-self: end; }
.tpl-align-center i { justify-self: center; }

.tpl-choices { margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.tpl-choices legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--fg-secondary); }
.tpl-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.tpl-seg-item { position: relative; display: inline-flex; }
.tpl-seg-item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tpl-seg-item span {
  min-width: 34px;
  padding: 4px 8px;
  text-align: center;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius, 4px);
  background: var(--bg);
  white-space: nowrap;
}
/* ‖ falls back to a colour emoji-like glyph in some UI fonts; brackets are maths. */
.tpl-fences .tpl-seg-item span { font-family: "Cambria Math", "STIX Two Math", Cambria, serif; font-size: 15px; line-height: 18px; }
.tpl-seg-item:hover span { background: var(--bg-hover); }
.tpl-seg-item input:checked + span { background: var(--brand-tint); border-color: var(--brand); color: var(--fg); font-weight: 600; }
.tpl-seg-item input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }

.tpl-lines { margin-top: 10px; }
.tpl-line-stack { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.tpl-line { display: flex; gap: 6px; }
.tpl-line i { display: block; width: 48px; height: 10px; border-radius: 1px; background: var(--fg-muted); opacity: .45; }
.tpl-lines-gather .tpl-line { justify-content: center; }
.tpl-hint { margin: 8px 0 0; font-size: 12px; color: var(--fg-muted); }

.tpl-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/*
 * Palette styles every host shares (frontend/src/palette-view.ts): the
 * Formulas tab, where each button is a whole formula drawn above its name.
 * Appended to each host's stylesheet by its build, like template-dialog.css.
 * The selectors name all three hosts' grid and key classes — the pane's
 * .grid/.sym, the website's .try-keys/.try-key, the desktop app's .keys/.key —
 * so they outrank each host's own square-cell layout.
 */
.grid.is-formulas,
.try-keys.is-formulas,
.keys.is-formulas {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  max-height: 320px;
}

.sym.f-key,
.try-key.f-key,
.key.f-key {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
  height: auto;
  min-height: 40px;
  padding: 6px 10px;
  gap: 2px;
  text-align: left;
  white-space: normal;
  overflow-x: auto;
  overflow-y: hidden;
}

.f-key .f-math {
  max-width: 100%;
  font-family: "Cambria Math", "STIX Two Math", math;
  font-size: 15px;
  line-height: 1.25;
}
.f-key .f-math math { font-size: 1em; }

.f-key .f-name {
  font-family: inherit;
  font-size: 11px;
  line-height: 1.3;
  color: var(--fg-muted);
}
.f-key:hover .f-name { color: inherit; }

.is-formulas .f-section {
  margin: 8px 2px 2px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.is-formulas .f-section:first-child { margin-top: 2px; }

/* The Favourites tab's panel (frontend/src/favourites-view.ts), under its buttons. */
.fav-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
}
.fav-hint, .fav-status { margin: 0; color: var(--fg-muted); line-height: 1.4; }
.fav-status:empty { display: none; }
.fav-status.is-bad { color: var(--danger-fg); }
.fav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.fav-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(60px, 1.2fr) auto 72px auto;
  align-items: center;
  gap: 4px;
}
.fav-latex {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--fg-secondary);
}
.fav-input {
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.fav-btn {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.fav-btn:hover { background: var(--bg-hover); }
.fav-btn.is-recording { border-color: var(--brand); color: var(--brand); }
.fav-primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.fav-primary:hover { background: var(--brand-hover); }
.fav-tools { display: inline-flex; gap: 2px; }
.fav-add { display: flex; gap: 4px; flex-wrap: wrap; }
.fav-add .fav-input { flex: 1 1 140px; }
@media (max-width: 420px) {
  .fav-row { grid-template-columns: 1fr auto; }
  .fav-latex { grid-column: 1 / -1; }
}

/* Explain and Fix with AI, under the preview (frontend/src/ai-assist.ts). */
.ai-assist { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; font-size: 12px; }
.ai-assist[hidden] { display: none; }
.ai-assist-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ai-assist-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.ai-assist-btn:hover:not(:disabled) { background: var(--bg-hover); }
.ai-assist-btn:disabled { opacity: .6; cursor: default; }
.ai-assist-btn[hidden] { display: none; }
.ai-assist-primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.ai-assist-primary:hover:not(:disabled) { background: var(--brand-hover); }
.ai-assist-link { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
.ai-assist-state { color: var(--fg-muted); }
.ai-assist-answer { padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-subtle); }
.ai-explain { margin: 0 0 6px; line-height: 1.5; color: var(--fg); }
.ai-math math { font-family: "Cambria Math", "STIX Two Math", math; }
.ai-fix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.ai-fix-side { min-width: 0; }
.ai-fix-title { margin: 0 0 2px; font-weight: 600; color: var(--fg-secondary); }
.ai-fix-latex { display: block; white-space: pre-wrap; word-break: break-word; font-size: 11px; color: var(--fg); }
.ai-fix-math { margin-top: 4px; overflow-x: auto; font-family: "Cambria Math", "STIX Two Math", math; }
@media (max-width: 360px) { .ai-fix { grid-template-columns: 1fr; } }

/*
 * The equation preview's pieces (frontend/src/preview-math.ts), in every
 * host. A long equation arrives as several <math> elements, cut after its
 * relations and operators; laid out as a wrapping row they flow onto as many
 * lines as the preview's width needs, the way words do. "safe" centring
 * keeps the start of a piece wider than the preview reachable by scrolling
 * instead of pushing it off the left edge.
 */
.math-pieces {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: safe center;
  row-gap: .35em;
  max-width: 100%;
}
.math-piece { display: inline-block; flex: none; }

/*
 * Editing in the preview (frontend/src/preview-edit.ts). The preview is
 * always white paper, in every host and theme, so its highlights are fixed
 * tints of the brand blue; the editor that floats over it takes the host's
 * own colours, with fallbacks for a host that names them differently.
 */
.tc-preview-editable { cursor: text; }
.tc-preview-editable:focus { outline: none; }
.tc-preview-editable:focus-visible { outline: 2px solid var(--brand, #0f6cbd); outline-offset: 2px; }
.tc-preview-editable [data-src] { cursor: pointer; border-radius: 3px; }
.tc-preview-editable .tc-part-hover { background: rgba(15, 108, 189, .08); }
.tc-preview-editable .tc-part-caret { background: rgba(15, 108, 189, .10); box-shadow: inset 0 -2px 0 rgba(15, 108, 189, .6); }
.tc-preview-editable .tc-part-selected { background: rgba(15, 108, 189, .16); box-shadow: 0 0 0 1.5px #0f6cbd; }

.tc-part-editor {
  position: fixed;
  z-index: 1000;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  color: var(--fg, #242424);
  background: var(--bg-raised, var(--bg, #ffffff));
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .12);
  font: 13px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}
.tc-part-editor[hidden] { display: none; }
.tc-part-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  resize: none;
  overflow-y: auto;
  font: 13px/1.45 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color: inherit;
  background: var(--bg-subtle, rgba(127, 127, 127, .06));
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
}
.tc-part-input:focus { outline: none; border-color: var(--brand, #0f6cbd); box-shadow: 0 0 0 1px var(--brand, #0f6cbd); }
.tc-part-actions { display: flex; gap: 6px; }
.tc-part-actions button {
  flex: 1 1 0;
  padding: 4px 8px;
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
  cursor: pointer;
}
.tc-part-actions button:hover:not(:disabled) { background: var(--bg-hover, rgba(127, 127, 127, .1)); }
.tc-part-actions button:disabled { opacity: .45; cursor: default; }
.tc-part-actions button.is-primary { color: #ffffff; background: var(--brand, #0f6cbd); border-color: var(--brand, #0f6cbd); }
.tc-part-actions button.is-primary:hover { background: var(--brand-hover, #115ea3); }
.tc-part-hint { margin: 0; font-size: 11.5px; color: var(--fg-muted, #616161); }

/*
 * The live suggestion list under a LaTeX box (frontend/src/suggest-view.ts).
 *
 * Shared by the Word pane, the website and the desktop app: each build
 * appends this file to that host's stylesheet. Tokens the website and the
 * desktop app don't define (--bg-raised, --corner, the fonts) fall back to
 * ones all three do, so the list follows each host's light and dark themes.
 *
 * The list overlays what is below the box rather than pushing it down: a
 * panel that grows and shrinks on every keystroke makes the preview and the
 * buttons underneath jump around while you type.
 */
.editor,
.suggest-anchor { position: relative; }

.suggest-anchor > textarea { display: block; width: 100%; box-sizing: border-box; }

.suggest {
  position: absolute;
  z-index: 5;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-raised, var(--bg));
  border: 1px solid var(--card-border, var(--border));
  border-radius: var(--corner, 8px);
  box-shadow: 0 10px 28px rgba(16, 24, 40, .18);
}

.suggest-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 7px;
  border-radius: var(--corner-sm, 6px);
  cursor: pointer;
  font-size: 12px;
}
.suggest-item:hover { background: var(--bg-hover); }
.suggest-item.is-active { background: var(--brand-tint); }

.suggest-glyph {
  flex: none;
  width: 20px;
  text-align: center;
  font-family: var(--math-font, "Cambria Math", "STIX Two Math", "Latin Modern Math", Cambria, Georgia, serif);
  font-size: 14px;
  color: var(--fg);
}
.suggest-name {
  font-family: var(--mono-font, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace);
  color: var(--fg);
  white-space: nowrap;
}
.suggest-detail {
  margin-left: auto;
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
 * The Maths & statistics tables screen (frontend/src/stat-tables-view.ts).
 *
 * Shared by the Word pane, the website and the desktop app: each build
 * appends this file to that host's stylesheet. Only colour tokens all three
 * define, with fallbacks for the ones the pane alone has, so it follows each
 * host's light and dark themes. Sized for the narrowest host, a ~320px pane:
 * the controls wrap and the table scrolls inside its own box.
 */
.st-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.st-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1 1 140px;
  font-size: 12px;
  color: var(--fg-muted);
}

.st-select {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--corner-sm, 6px);
}
.st-select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.st-preview {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--corner, 8px);
  background: var(--bg);
}
.st-preview:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.st-table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

.st-caption {
  padding: 8px 10px;
  font-weight: 600;
  text-align: center;
  caption-side: top;
}

.st-table th,
.st-table td {
  padding: 3px 8px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

/* The heading rows and the row heads stay in view while the table scrolls. */
.st-table thead th {
  position: sticky;
  z-index: 1;
  background: var(--bg-hover);
  font-weight: 600;
}
.st-table thead tr:first-child th { top: 0; }
.st-table thead tr:nth-child(2) th { top: 23px; }
.st-table tbody th {
  position: sticky;
  left: 0;
  background: var(--bg-hover);
  font-weight: 600;
}
.st-table .st-span { font-weight: 500; color: var(--fg-muted); }
.st-table tbody tr:hover td { background: var(--brand-tint); }

/* Your own table: the caption box, and a grid of boxes to type in. */
.st-text {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--corner-sm, 6px);
}
.st-text:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.st-own { margin: 10px auto; border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.st-own th,
.st-own td { padding: 0; border-right: 1px solid var(--border); }
.st-own tbody th { position: static; background: var(--bg-hover); }
.st-cell {
  width: 110px;
  font: inherit;
  padding: 5px 6px;
  text-align: center;
  color: var(--fg);
  background: transparent;
  border: 0;
}
.st-own th .st-cell { font-weight: 600; }
.st-cell:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.st-cell-bad { background: rgba(220, 38, 38, 0.14); box-shadow: inset 0 -2px 0 rgb(220, 38, 38); }

.st-hint {
  margin: 0 10px 10px;
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
}

/*
 * Editing a diagram on its picture (frontend/src/figure-edit.ts), in the Word
 * pane, on the website and in the desktop app: the outline over what's
 * selected, Undo / Redo under the picture, and the panel holding its LaTeX.
 * Each host's own colours where it has them, these where it doesn't.
 */
.tc-figure-editable { position: relative; }
.tc-figure-editable img { cursor: pointer; user-select: none; -webkit-user-select: none; }
.tc-figure-editable:focus-visible { outline: 2px solid var(--brand, #0f6cbd); outline-offset: 2px; }
.tc-figure-selected {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed var(--brand, #0f6cbd);
  border-radius: 6px;
  background: rgba(15, 108, 189, .06);
  pointer-events: none;
}
.tc-figure-selected[hidden] { display: none; }
.tc-figure-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.tc-figure-tools[hidden] { display: none; }
.tc-figure-hint { flex: 1 1 100%; font-size: 12px; color: var(--fg-muted, #616161); }
.tc-figure-panel {
  margin: 0 0 10px;
  padding: 8px;
  color: var(--fg, #242424);
  background: var(--brand-tint, #eff6fc);
  border: 1px solid var(--brand, #0f6cbd);
  border-radius: 8px;
  font: 13px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}
.tc-figure-panel[hidden] { display: none; }
.tc-figure-label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.tc-figure-input {
  box-sizing: border-box;
  width: 100%;
  padding: 5px 8px;
  resize: vertical;
  font: 13px/1.45 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color: inherit;
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
}
.tc-figure-input:focus { outline: none; border-color: var(--brand, #0f6cbd); box-shadow: 0 0 0 1px var(--brand, #0f6cbd); }
.tc-figure-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tc-figure-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font: 600 12.5px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--fg, #242424);
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
  cursor: pointer;
}
.tc-figure-btn[hidden] { display: none; }
.tc-figure-btn:hover:not(:disabled) { background: var(--bg-hover, rgba(127, 127, 127, .1)); }
.tc-figure-btn:disabled { opacity: .45; cursor: default; }
.tc-figure-btn.is-primary { color: #ffffff; background: var(--brand, #0f6cbd); border-color: var(--brand, #0f6cbd); }
.tc-figure-btn.is-primary:hover { background: var(--brand-hover, #115ea3); }
.tc-figure-btn svg { flex: none; }
.tc-figure-btn.is-danger { color: var(--danger-fg, #a4262c); }
.tc-figure-btn.is-quiet { border-color: transparent; background: transparent; color: var(--fg-muted, #616161); font-weight: 500; }
.tc-figure-note { margin: 6px 0 0; font-size: 12px; color: var(--fg-muted, #616161); }
.tc-figure-editable img { -webkit-user-drag: none; }
/* A dot on a point of the part selected: drag it to move that point. */
.tc-figure-handle {
  position: absolute;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: #ffffff;
  border: 2px solid var(--brand, #0f6cbd);
  border-radius: 50%;
  cursor: move;
  touch-action: none;
  z-index: 1;
}
.tc-figure-handle.is-radius { border-radius: 2px; cursor: ew-resize; background: var(--brand, #0f6cbd); }
.tc-figure-handle[hidden] { display: none; }
/* A finger needs more to land on than the dot it sees. */
.tc-figure-handle::after { content: ""; position: absolute; inset: -6px; }
@media (pointer: coarse) { .tc-figure-handle::after { inset: -12px; } }
.tc-figure-marquee {
  position: absolute;
  box-sizing: border-box;
  border: 1px dashed var(--brand, #0f6cbd);
  background: rgba(15, 108, 189, .08);
  pointer-events: none;
}
.tc-figure-marquee[hidden] { display: none; }
/* The bar for what's selected: what to do with it, and its style. */
.tc-figure-bar {
  margin: 0 0 8px;
  padding: 8px;
  color: var(--fg, #242424);
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 8px;
  font: 13px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}
.tc-figure-bar[hidden] { display: none; }
.tc-figure-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tc-figure-count { font-size: 12px; font-weight: 600; color: var(--fg-muted, #616161); }
.tc-figure-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tc-figure-row[hidden] { display: none; }
.tc-figure-row + .tc-figure-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-subtle, #e6e6e6); }
/* Each row's name, in a column of its own so the buttons line up beside it, however they wrap. */
.tc-figure-row.is-named { position: relative; padding-left: 50px; }
.tc-figure-row-name { position: absolute; left: 0; top: 6px; font-size: 11.5px; font-weight: 600; color: var(--fg-muted, #616161); }
.tc-figure-row + .tc-figure-row .tc-figure-row-name { top: 12px; }
.tc-figure-field { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--fg-muted, #616161); }
.tc-figure-field[hidden] { display: none; }
.tc-figure-select {
  padding: 3px 6px;
  font: 12.5px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--fg, #242424);
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
}
.tc-figure-select:focus { outline: none; border-color: var(--brand, #0f6cbd); box-shadow: 0 0 0 1px var(--brand, #0f6cbd); }
.tc-figure-status { margin: 6px 0 0; font-size: 12px; color: var(--fg-muted, #616161); }
.tc-figure-status:empty { display: none; }
/* The dot above what's selected that turns it. */
.tc-figure-turn {
  position: absolute;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--brand, #0f6cbd);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--brand, #0f6cbd);
  cursor: grab;
  touch-action: none;
  z-index: 1;
}
.tc-figure-turn[hidden] { display: none; }
.tc-figure-turn::after { content: ""; position: absolute; inset: -6px; }
@media (pointer: coarse) { .tc-figure-turn::after { inset: -12px; } }
/* Where a dragged point lands on another part's point. */
.tc-figure-snap {
  position: absolute;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #d13438;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}
.tc-figure-snap[hidden] { display: none; }
/* The grid snapped to, its squares sized and placed by the editor. */
.tc-figure-grid {
  position: absolute;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(15, 108, 189, .16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 108, 189, .16) 1px, transparent 1px);
}
.tc-figure-grid[hidden] { display: none; }
.tc-figure-selected.is-group { border-style: solid; }
.tc-figure-editable.is-adding img { cursor: crosshair; }
/* Buttons that belong together, joined into one strip: Select and the shapes, Undo and Redo. */
.tc-figure-group { display: inline-flex; flex-wrap: wrap; align-items: stretch; }
.tc-figure-group .tc-figure-btn { border-radius: 0; margin-left: -1px; }
.tc-figure-group .tc-figure-btn:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.tc-figure-group .tc-figure-btn:last-child { border-radius: 0 4px 4px 0; }
.tc-figure-btn[aria-pressed="true"] { position: relative; color: #ffffff; background: var(--brand, #0f6cbd); border-color: var(--brand, #0f6cbd); }
.tc-figure-btn[aria-pressed="true"]:hover:not(:disabled) { background: var(--brand-hover, #115ea3); }
/* Asking the AI to change what's selected. */
.tc-figure-ai { flex-wrap: nowrap; }
/* In a narrow column (the Word pane) the shapes keep only their pictures; their names stay as tooltips. */
@media (max-width: 480px) {
  .tc-figure-group .tc-figure-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tc-figure-group .tc-figure-btn { padding: 5px 8px; }
  .tc-figure-row.is-named { padding-left: 0; }
  .tc-figure-row-name, .tc-figure-row + .tc-figure-row .tc-figure-row-name { position: static; flex-basis: 100%; }
}
.tc-figure-ai[hidden] { display: none; }
.tc-figure-ask {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 8px;
  font: 12.5px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--fg, #242424);
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
}
.tc-figure-ask:focus { outline: none; border-color: var(--brand, #0f6cbd); box-shadow: 0 0 0 1px var(--brand, #0f6cbd); }
.tc-figure-ask:disabled { opacity: .6; }
@media (max-width: 480px) { .tc-figure-ai { flex-wrap: wrap; } .tc-figure-ask { flex-basis: 100%; } }
/* Zoomed in: the picture scrolls inside its box. */
.tc-figure-editable.is-zoomed { overflow: auto; max-height: 70vh; }
/* The More shapes list while one of its shapes is being drawn. */
.tc-figure-select.is-active { color: #ffffff; background: var(--brand, #0f6cbd); border-color: var(--brand, #0f6cbd); }
.tc-figure-group .tc-figure-btn span:empty { display: none; }
/* The Place row: x and y of each point, and a radius. */
.tc-figure-num {
  width: 64px;
  padding: 3px 4px;
  font: 12.5px/1.4 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color: var(--fg, #242424);
  background: var(--bg, #ffffff);
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 4px;
}
.tc-figure-num:focus { outline: none; border-color: var(--brand, #0f6cbd); box-shadow: 0 0 0 1px var(--brand, #0f6cbd); }
.tc-figure-point { margin-right: 6px; }
/* The colour picker opened by "Custom colour…": there, but not seen. */
.tc-figure-bar { position: relative; }
.tc-figure-colour { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }

/*
 * The molecule sketcher (frontend/src/chem-sketch.ts) above a chemistry
 * picture, in the Word pane, on the website and in the desktop app. Its
 * buttons are figure-edit.css's; these are its bars and canvas.
 */
.tc-chem { margin: 0 0 10px; font: 13px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif; color: var(--fg, #242424); }
.tc-chem[hidden] { display: none; }
.tc-chem-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; }
.tc-chem-bar .tc-figure-btn { min-height: 30px; padding: 3px 8px; }
.tc-chem-el { min-width: 30px; justify-content: center; font-weight: 700; }
.tc-chem-el[data-el="N"] { color: #2f4fd0; }
.tc-chem-el[data-el="O"] { color: #d12b2b; }
.tc-chem-el[data-el="S"] { color: #a68f00; }
.tc-chem-el[data-el="P"] { color: #d9730d; }
.tc-chem-el[data-el="F"], .tc-chem-el[data-el="Cl"] { color: #1e9a3a; }
.tc-chem-el[data-el="Br"] { color: #9b3a1f; }
.tc-chem-el[data-el="I"] { color: #7a2aa8; }
.tc-chem-el sub, .tc-chem-el sup { font-size: 70%; line-height: 0; }
.tc-chem-other { display: inline-flex; gap: 4px; align-items: center; flex: 1 1 180px; max-width: 260px; }
.tc-chem-canvas {
  position: relative;
  height: 340px;
  overflow: hidden;
  color: #1b1b1b;
  background-color: #ffffff;
  background-image: radial-gradient(rgba(15, 108, 189, .16) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid var(--border, #d1d1d1);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}
.tc-chem-canvas:focus-visible { outline: 2px solid var(--brand, #0f6cbd); outline-offset: 2px; }
.tc-chem-canvas[data-tool="select"] { cursor: default; }
.tc-chem-canvas[data-tool="erase"] { cursor: not-allowed; }
.tc-chem-svg { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; }
.tc-chem-label { font-family: "Segoe UI", Arial, sans-serif; font-weight: 600; }
.tc-chem-label-bg { fill: #ffffff; }
.tc-chem-hover { fill: rgba(15, 108, 189, .14); stroke: var(--brand, #0f6cbd); stroke-width: 1.5; }
.tc-chem-hover-bond { stroke: rgba(15, 108, 189, .18); }
.tc-chem-picked { fill: rgba(15, 108, 189, .22); }
.tc-chem-ghost { stroke: var(--brand, #0f6cbd); stroke-dasharray: 5 4; }
.tc-chem-marquee { fill: rgba(15, 108, 189, .08); stroke: var(--brand, #0f6cbd); stroke-dasharray: 4 3; }
.tc-chem-notice { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; background: rgba(255, 255, 255, .92); }
.tc-chem-notice[hidden] { display: none; }
.tc-chem-notice p { margin: 0; max-width: 420px; color: var(--fg-muted, #616161); }
.tc-chem-hint { margin: 6px 0 0; }
/* A chemistry picture has nothing to draw with the shape tools: the sketcher does that. */
.tc-chem-on > .tc-figure-tools { display: none; }
@media (max-width: 480px) {
  .tc-chem-canvas { height: 280px; }
  .tc-chem-bar .tc-figure-group .tc-figure-btn span { position: static; width: auto; height: auto; clip-path: none; }
}

/*
 * The Biology builder (frontend/src/biology-builder-ui.ts) above a diagram's
 * picture, in the Word pane, on the website and in the desktop app. Its
 * buttons are figure-edit.css's.
 */
.tc-bio { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border, #d1d1d1); border-radius: 8px; font: 13px/1.4 "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif; color: var(--fg, #242424); }
.tc-bio[hidden] { display: none; }
.tc-bio > summary { cursor: pointer; font-weight: 600; }
.tc-bio-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 4px; }
.tc-bio-kind { flex: 1 1 180px; max-width: 280px; min-height: 30px; padding: 3px 6px; border: 1px solid var(--border, #d1d1d1); border-radius: 4px; background: var(--bg, #ffffff); color: inherit; font: inherit; }
.tc-bio-draw { min-height: 30px; padding: 3px 14px; font-weight: 600; }
.tc-bio-help { margin: 4px 0 6px; color: var(--muted, #616161); }
.tc-bio-fields { display: grid; gap: 6px; }
.tc-bio-field { display: grid; gap: 2px; }
.tc-bio-field input, .tc-bio-field textarea { width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1px solid var(--border, #d1d1d1); border-radius: 4px; background: var(--bg, #ffffff); color: inherit; font: 13px/1.4 Consolas, "Cascadia Mono", monospace; resize: vertical; }
.tc-bio-check { display: inline-flex; gap: 6px; align-items: center; }
.tc-bio-message { margin: 6px 0 0; min-height: 1em; }
.tc-bio-message[data-tone="danger"] { color: #b10e1c; }
.tc-bio-message[data-tone="ok"] { color: var(--muted, #616161); }
