/* ==========================================================================
   Visual layer for the China Trademark Registration Guide.
   Sits on top of Material for MkDocs 9.x — no external fonts, no JS.

   Design notes
   ------------
   * Header is a fixed dark navy surface in both colour schemes, so the site
     keeps one identity while the reading surface switches light / dark.
   * Content is capped at 46rem for prose; the home page opts into a wider
     canvas via :has() so the hero and card grid can breathe.
   * Everything below is expressed with Material's own custom properties, so
     the theme's own components (search, nav, admonitions, footnotes) inherit
     the new palette instead of fighting it.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Palette
   -------------------------------------------------------------------------- */

[data-md-color-primary="custom"],
[data-md-color-primary="custom"] [data-md-color-scheme] {
  --md-primary-fg-color: #0d1628;
  --md-primary-fg-color--light: #17233c;
  --md-primary-fg-color--dark: #070d18;

  /* Text and icons that sit on the header */
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.68);
}

[data-md-color-scheme="default"] {
  --tm-bg: #f6f8fc;
  --tm-surface: #ffffff;
  --tm-surface-alt: #f1f4fa;
  --tm-border: rgba(15, 23, 42, 0.09);
  --tm-border-strong: rgba(15, 23, 42, 0.16);
  --tm-text: #0f172a;
  --tm-text-muted: #55637a;
  --tm-accent: #2f5bff;
  --tm-accent-soft: rgba(47, 91, 255, 0.09);
  --tm-on-accent: #ffffff;
  --tm-warn-fg: #92400e;
  --tm-warn-bg: rgba(217, 119, 6, 0.1);
  --tm-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --tm-shadow-md: 0 10px 30px -12px rgba(15, 23, 42, 0.22);
  --tm-header-line: rgba(255, 255, 255, 0.1);

  --md-default-bg-color: var(--tm-bg);
  --md-default-fg-color: var(--tm-text);
  --md-default-fg-color--light: var(--tm-text-muted);
  --md-default-fg-color--lighter: rgba(85, 99, 122, 0.62);
  --md-typeset-color: var(--tm-text);
  --md-typeset-a-color: var(--tm-accent);
  --md-code-bg-color: #eef2f9;
  --md-code-fg-color: #1e293b;
}

[data-md-color-scheme="slate"] {
  --tm-bg: #0a0e16;
  --tm-surface: #111826;
  --tm-surface-alt: #161f30;
  --tm-border: rgba(255, 255, 255, 0.09);
  --tm-border-strong: rgba(255, 255, 255, 0.18);
  --tm-text: #e7ecf5;
  --tm-text-muted: #9aa8bd;
  --tm-accent: #8fa9ff;
  --tm-accent-soft: rgba(143, 169, 255, 0.14);
  --tm-on-accent: #0a0e16;
  --tm-warn-fg: #fbbf24;
  --tm-warn-bg: rgba(251, 191, 36, 0.14);
  --tm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --tm-shadow-md: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  --tm-header-line: rgba(255, 255, 255, 0.08);

  --md-default-bg-color: var(--tm-bg);
  --md-default-fg-color: var(--tm-text);
  --md-default-fg-color--light: var(--tm-text-muted);
  --md-default-fg-color--lighter: rgba(154, 168, 189, 0.6);
  --md-typeset-color: var(--tm-text);
  --md-typeset-a-color: var(--tm-accent);
  --md-code-bg-color: #0e1624;
  --md-code-fg-color: #d7e0f0;
}

/* --------------------------------------------------------------------------
   2. Base typography
   -------------------------------------------------------------------------- */

/* System stack: no webfont request, no layout shift, Chinese renders with the
   platform UI face instead of a fallback that only covers half the glyphs. */
:root {
  --md-text-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto,
    Helvetica, Arial, sans-serif;
  --md-code-font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo,
    Consolas, "Liberation Mono", monospace;
}

body {
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}

.md-typeset {
  font-size: 0.78rem;
  line-height: 1.72;
  letter-spacing: 0.002em;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  font-weight: 700;
  letter-spacing: -0.021em;
  color: var(--tm-text);
}

.md-typeset h1 {
  font-size: 2.05rem;
  line-height: 1.18;
  margin-bottom: 0.7em;
}

.md-typeset h2 {
  font-size: 1.32rem;
  margin-top: 2.4em;
  padding-top: 0.2em;
}

.md-typeset h3 {
  font-size: 1.02rem;
  margin-top: 1.9em;
}

.md-typeset h2::after {
  content: "";
  display: block;
  width: 2.2rem;
  height: 3px;
  margin-top: 0.55rem;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--tm-accent), rgba(47, 91, 255, 0));
}

.md-typeset a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

.md-typeset a:hover {
  border-bottom-color: currentColor;
}

.md-typeset strong {
  font-weight: 700;
}

/* Reading width: prose stays comfortable, wide blocks opt out below. */
.md-content__inner {
  max-width: 46rem;
  margin-inline: auto;
}

/* The home page asks for a wider canvas so the hero can span the viewport. */
.md-content__inner:has(> .hero) {
  max-width: 74rem;
  padding-bottom: 1rem;
}

.md-content__inner:has(> .hero) > p,
.md-content__inner:has(> .hero) > ul,
.md-content__inner:has(> .hero) > ol,
.md-content__inner:has(> .hero) > h2,
.md-content__inner:has(> .hero) > h3,
.md-content__inner:has(> .hero) > hr {
  max-width: 46rem;
}

.md-content__inner:has(> .hero) > h2 {
  margin-top: 3rem;
}

/* --------------------------------------------------------------------------
   3. Header: frosted, hairline, no drop shadow
   -------------------------------------------------------------------------- */

.md-header {
  background: rgba(13, 22, 40, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--tm-header-line);
  box-shadow: none;
}

.md-header[data-md-state="shadow"],
.md-header--shadow {
  box-shadow: none;
  border-bottom-color: rgba(255, 255, 255, 0.16);
}

.md-header__title {
  font-weight: 700;
  letter-spacing: -0.018em;
  font-size: 0.78rem;
}

.md-header__topic:first-child {
  font-weight: 700;
}

.md-header__button {
  opacity: 0.9;
}

.md-search__form {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 150ms ease, border-color 150ms ease;
}

.md-search__form:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
}

.md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.md-search__input {
  color: #fff;
}

.md-search__icon[for="__search"],
.md-search__icon svg {
  color: rgba(255, 255, 255, 0.75);
}

.md-search__options .md-search__icon {
  color: rgba(255, 255, 255, 0.6);
}

/* Breadcrumbs (theme feature: navigation.path) */
.md-path {
  font-size: 0.62rem;
  color: var(--tm-text-muted);
  opacity: 1;
  padding: 0.5rem 0 0;
}

.md-path__link {
  color: var(--tm-text-muted);
}

/* --------------------------------------------------------------------------
   4. Sidebar navigation
   -------------------------------------------------------------------------- */

.md-nav {
  font-size: 0.68rem;
}

.md-nav__title {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--tm-text-muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.md-nav__link {
  border-radius: 8px;
  padding: 0.28rem 0.5rem;
  margin-inline: -0.5rem;
  transition: background 120ms ease, color 120ms ease;
}

.md-nav__link:hover {
  background: var(--tm-accent-soft);
  color: var(--tm-accent);
}

.md-nav__item .md-nav__link--active,
.md-nav__link--active {
  color: var(--tm-accent);
  font-weight: 700;
  background: var(--tm-accent-soft);
}

/* Section headers inside the class list */
.md-nav--primary .md-nav__item--section > .md-nav__link {
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.07em;
  color: var(--tm-text-muted);
  font-weight: 700;
}

.md-sidebar--secondary .md-nav__link {
  margin-inline: 0;
}

/* --------------------------------------------------------------------------
   5. Home page: hero + stats
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 2.4rem;
  padding: 3.1rem 3rem 2.7rem;
  border: 1px solid var(--tm-border);
  border-radius: 22px;
  background:
    radial-gradient(58% 120% at 12% -10%, rgba(47, 91, 255, 0.2), transparent 60%),
    radial-gradient(48% 100% at 100% 0%, rgba(255, 176, 32, 0.16), transparent 62%),
    linear-gradient(180deg, var(--tm-surface), var(--tm-surface-alt));
  box-shadow: var(--tm-shadow-sm);
}

/* Faint grid, keeps the gradient from looking like a blob */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--tm-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--tm-border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 70% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 0%, #000 20%, transparent 78%);
  opacity: 0.55;
  pointer-events: none;
}

.hero > * {
  position: relative;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
  padding: 0.34rem 0.75rem;
  border: 1px solid var(--tm-border-strong);
  border-radius: 999px;
  background: var(--tm-surface);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tm-text-muted);
  text-transform: none;
}

.hero__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

.md-typeset .hero h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.9rem, 3.4vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -0.032em;
  max-width: 30ch;
}

.md-typeset .hero p {
  margin: 0;
  max-width: 60ch;
  font-size: 0.86rem;
  line-height: 1.68;
  color: var(--tm-text-muted);
}

.md-typeset .hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.55rem;
}

/* Markdown wraps consecutive buttons in a paragraph — make that the flex row. */
.md-typeset .hero__actions > p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0;
}

.md-typeset .hero__actions .md-button {
  margin: 0;
}

/* Stat strip */
.md-typeset .stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 2.1rem;
  padding-top: 1.45rem;
  border-top: 1px solid var(--tm-border);
}

.md-typeset .stat {
  padding-right: 1rem;
  border-right: 1px solid var(--tm-border);
}

.md-typeset .stat:last-child {
  border-right: 0;
}

.md-typeset .stat b {
  display: block;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--tm-text);
}

.md-typeset .stat span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tm-text-muted);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.md-typeset .md-button {
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--tm-border-strong);
  border-radius: 999px;
  background: var(--tm-surface);
  color: var(--tm-text);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  box-shadow: var(--tm-shadow-sm);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.md-typeset .md-button:hover,
.md-typeset .md-button:focus {
  transform: translateY(-1px);
  border-color: var(--tm-accent);
  background: var(--tm-surface);
  color: var(--tm-text);
  box-shadow: var(--tm-shadow-md);
}

.md-typeset .md-button--primary {
  border-color: transparent;
  background: linear-gradient(180deg, #3d68ff, #2447d8);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(47, 91, 255, 0.9);
}

.md-typeset .md-button--primary:hover,
.md-typeset .md-button--primary:focus {
  color: #fff;
  background: linear-gradient(180deg, #4a74ff, #2b4ee6);
}

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */

.md-typeset .grid.cards > ul > li,
.md-typeset .grid > .card {
  border: 1px solid var(--tm-border);
  border-radius: 16px;
  background: var(--tm-surface);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--tm-shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid > .card:hover {
  transform: translateY(-2px);
  border-color: var(--tm-border-strong);
  box-shadow: var(--tm-shadow-md);
}

.md-typeset .grid.cards > ul > li > hr {
  margin: 0.55rem 0 0.7rem;
  border-bottom: 1px solid var(--tm-border);
}

.md-typeset .grid.cards > ul > li > p:first-child {
  font-weight: 700;
  letter-spacing: -0.012em;
  font-size: 0.78rem;
}

.md-typeset .grid.cards > ul > li a {
  font-weight: 600;
  font-size: 0.66rem;
}

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */

.md-typeset table:not([class]) {
  display: table;
  width: 100%;
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--tm-surface);
  font-size: 0.7rem;
  box-shadow: var(--tm-shadow-sm);
}

.md-typeset table:not([class]) th {
  background: var(--tm-surface-alt);
  color: var(--tm-text-muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--tm-border);
  vertical-align: bottom;
}

.md-typeset table:not([class]) td {
  padding: 0.6rem 0.85rem;
  border-top: 1px solid var(--tm-border);
  vertical-align: top;
}

.md-typeset table:not([class]) tr:first-child td {
  border-top: 0;
}

.md-typeset table:not([class]) tbody tr:hover {
  background: var(--tm-accent-soft);
}

/* Numeric first column in the class pages stays aligned */
.md-typeset table:not([class]) td:first-child {
  font-variant-numeric: tabular-nums;
  color: var(--tm-text-muted);
}

/* --------------------------------------------------------------------------
   9. Code, admonitions, misc surfaces
   -------------------------------------------------------------------------- */

.md-typeset code {
  border-radius: 6px;
  padding: 0.1em 0.32em;
  font-size: 0.78em;
  background: var(--md-code-bg-color);
  box-shadow: none;
}

.md-typeset pre > code {
  border-radius: 12px;
  border: 1px solid var(--tm-border);
}

.md-typeset .admonition,
.md-typeset details {
  border-radius: 12px;
  border-width: 1px;
  border-color: var(--tm-border);
  background: var(--tm-surface);
  box-shadow: var(--tm-shadow-sm);
  font-size: 0.7rem;
}

.md-typeset hr {
  border-bottom: 1px solid var(--tm-border);
}

.md-typeset blockquote {
  border-left: 3px solid var(--tm-accent);
  border-radius: 0 8px 8px 0;
  background: var(--tm-accent-soft);
  color: var(--tm-text);
  padding: 0.2rem 1rem;
}

.md-typeset .headerlink {
  color: var(--tm-border-strong);
}

.md-typeset .headerlink:hover {
  color: var(--tm-accent);
}

/* Footer */
.md-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--tm-border);
  background: transparent;
  color: var(--tm-text-muted);
}

.md-footer-meta {
  background: transparent;
  color: var(--tm-text-muted);
}

.md-footer-meta__inner {
  border-top: 1px solid var(--tm-border);
}

.md-copyright,
.md-copyright__highlight {
  color: var(--tm-text-muted);
  font-size: 0.6rem;
}

.md-footer__link {
  opacity: 1;
}

.md-footer__title,
.md-footer__direction {
  color: var(--tm-text-muted);
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--tm-border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */

@media screen and (max-width: 76.1875em) {
  .md-content__inner:has(> .hero) {
    max-width: 100%;
  }
}

@media screen and (max-width: 44.9375em) {
  .hero {
    padding: 2rem 1.25rem 1.8rem;
    border-radius: 18px;
    margin-bottom: 1.8rem;
  }

  .md-typeset .hero h1 {
    font-size: 1.72rem;
  }

  .md-typeset .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 0;
  }

  .md-typeset .stat:nth-child(2) {
    border-right: 0;
  }

  .md-typeset .stat:nth-child(-n + 2) {
    padding-bottom: 0.4rem;
  }

  .md-typeset h1 {
    font-size: 1.6rem;
  }

  .md-content__inner {
    padding-inline: 0.9rem;
  }
}

/* The tool needs a wider canvas than prose: let it break out, keep text capped. */
.md-content__inner:has(#tm-search) {
  max-width: 78rem;
}

.md-content__inner:has(#tm-search) > p,
.md-content__inner:has(#tm-search) > ul,
.md-content__inner:has(#tm-search) > h2,
.md-content__inner:has(#tm-search) > h3 {
  max-width: 46rem;
}

.md-typeset #tm-search {
  margin: 1.6rem 0 2.2rem;
}

/* The tool needs a wider canvas than prose: let it break out, keep text capped. */
.md-content__inner:has(#tm-search) {
  max-width: 78rem;
}

.md-content__inner:has(#tm-search) > p,
.md-content__inner:has(#tm-search) > ul,
.md-content__inner:has(#tm-search) > h2,
.md-content__inner:has(#tm-search) > h3 {
  max-width: 46rem;
}

.md-typeset #tm-search {
  margin: 1.6rem 0 2.2rem;
}


/* --------------------------------------------------------------------------
   11. Classification search tool
   -------------------------------------------------------------------------- */

.md-typeset #tm-search {
  margin: 1.4rem 0 2rem;
  --tm-header: 2.4rem;
}

/* Control bar ------------------------------------------------------------- */

.md-typeset .tm-bar {
  position: sticky;
  top: var(--tm-header);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 0 -0.2rem;
  padding: 0.6rem 0.2rem;
  background: color-mix(in srgb, var(--tm-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--tm-border);
}

.tm-field {
  position: relative;
  flex: 1 1 20rem;
  min-width: 0;
}

.md-typeset .tm-field__input {
  width: 100%;
  margin: 0;
  padding: 0.7rem 2.6rem 0.7rem 2.5rem;
  border: 1px solid var(--tm-border-strong);
  border-radius: 10px;
  background: var(--tm-surface);
  color: var(--tm-text);
  font-size: 0.74rem;
  font-family: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.md-typeset .tm-field__input::placeholder {
  color: var(--tm-text-muted);
}

.md-typeset .tm-field__input:focus {
  outline: none;
  border-color: var(--tm-accent);
  box-shadow: 0 0 0 3px var(--tm-accent-soft);
}

.md-typeset .tm-field__input::-webkit-search-cancel-button {
  display: none;
}

.tm-field__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  width: 0.95rem;
  height: 0.95rem;
  transform: translateY(-50%);
  fill: var(--tm-text-muted);
  pointer-events: none;
}

.md-typeset .tm-field__clear {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tm-text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.md-typeset .tm-field__clear:hover {
  background: var(--tm-surface-alt);
  color: var(--tm-text);
}

.md-typeset .tm-cbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.7rem 0.7rem;
  border: 1px solid var(--tm-border-strong);
  border-radius: 10px;
  background: var(--tm-surface);
  color: var(--tm-text);
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.md-typeset .tm-cbtn:hover {
  border-color: var(--tm-accent);
  color: var(--tm-accent);
}

.md-typeset .tm-cbtn svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
}

.md-typeset p.tm-status {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  font-size: 0.6rem;
  color: var(--tm-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Active filters + suggestions ------------------------------------------- */

.tm-activebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.6rem 0 0;
}

.md-typeset .tm-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--tm-accent);
  color: var(--tm-on-accent);
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.tm-tag__x {
  opacity: 0.7;
  font-size: 0.75rem;
  line-height: 1;
}

.md-typeset .tm-linkbtn {
  margin: 0;
  padding: 0.25rem 0.4rem;
  border: 0;
  background: none;
  color: var(--tm-text-muted);
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.md-typeset .tm-linkbtn:hover {
  color: var(--tm-accent);
}

.tm-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.55rem 0 0;
}

.tm-suggest__label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tm-text-muted);
}

.md-typeset .tm-suggest__item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.24rem 0.5rem;
  border: 1px solid var(--tm-border);
  border-radius: 7px;
  background: var(--tm-surface);
  color: var(--tm-text-muted);
  font-size: 0.6rem;
  cursor: pointer;
}

.md-typeset .tm-suggest__item b {
  color: var(--tm-text);
}

.md-typeset .tm-suggest__item:hover {
  border-color: var(--tm-accent);
}

.tm-suggest__item i {
  font-style: normal;
  font-size: 0.55rem;
  color: var(--tm-text-muted);
}

/* Layout ------------------------------------------------------------------ */

.tm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 1.4rem;
  align-items: start;
  margin-top: 0.8rem;
}

.tm-results {
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  background: var(--tm-surface);
  overflow: hidden;
  box-shadow: var(--tm-shadow-sm);
}

/* Results ----------------------------------------------------------------- */

.tm-group + .tm-group {
  border-top: 1px solid var(--tm-border);
}

.md-typeset .tm-ghead {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: var(--tm-surface-alt);
  border-bottom: 1px solid var(--tm-border);
}

.md-typeset .tm-ghead b {
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.md-typeset .tm-ghead span {
  font-size: 0.62rem;
  color: var(--tm-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-typeset .tm-ghead i {
  font-style: normal;
  font-size: 0.58rem;
  color: var(--tm-text-muted);
  white-space: nowrap;
}

.md-typeset .tm-ghead em {
  font-style: normal;
  font-size: 0.55rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--tm-border);
  color: var(--tm-text-muted);
  font-variant-numeric: tabular-nums;
}

.md-typeset .tm-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) 3.4rem 2rem;
  gap: 0.6rem;
  align-items: start;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--tm-border);
  transition: background 120ms ease;
}

.md-typeset .tm-row:first-of-type {
  border-top: 0;
}

.md-typeset .tm-row:hover {
  background: var(--tm-accent-soft);
}

.md-typeset .tm-row.is-on {
  background: var(--tm-accent-soft);
}

.tm-row__c {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--tm-accent);
  font-variant-numeric: tabular-nums;
}

.tm-row__item {
  display: block;
  min-width: 0;
}

.tm-row__en {
  display: block;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--tm-text);
  overflow-wrap: break-word;
}

.tm-row__zh {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.62rem;
  line-height: 1.45;
  color: var(--tm-text-muted);
  overflow-wrap: break-word;
}

.md-typeset .tm-row__zh code {
  margin-left: 0.4rem;
  padding: 0;
  background: none;
  color: var(--tm-text-muted);
  font-size: 0.55rem;
  opacity: 0.75;
}

.tm-row__s {
  padding: 0.08rem 0.25rem;
  border-radius: 5px;
  background: var(--tm-surface-alt);
  color: var(--tm-text-muted);
  font-family: var(--md-code-font-family);
  font-size: 0.55rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  cursor: help;
}

.md-typeset .tm-add {
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tm-border-strong);
  border-radius: 8px;
  background: var(--tm-surface);
  color: var(--tm-text-muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.md-typeset .tm-add:hover {
  border-color: var(--tm-accent);
  color: var(--tm-accent);
}

.md-typeset .tm-add.is-on {
  border-color: transparent;
  background: var(--tm-accent);
  color: var(--tm-on-accent);
}

.md-typeset mark {
  padding: 0 0.1em;
  border-radius: 3px;
  background: rgba(47, 91, 255, 0.22);
  color: inherit;
}

[data-md-color-scheme="slate"] .md-typeset mark {
  background: rgba(143, 169, 255, 0.3);
}

.md-typeset .tm-more {
  display: block;
  width: 100%;
  margin: 0.6rem 0 0;
  padding: 0.6rem;
  border: 1px dashed var(--tm-border-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--tm-text-muted);
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
}

.md-typeset .tm-more:hover {
  border-color: var(--tm-accent);
  color: var(--tm-accent);
}

/* Entry + empty states ---------------------------------------------------- */

.md-typeset .tm-start {
  padding: 1.2rem;
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  background: var(--tm-surface);
}

.md-typeset .tm-start__title {
  margin: 0 0 0.8rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tm-text);
}

.tm-start__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.6rem;
}

.md-typeset .tm-start__card {
  display: block;
  margin: 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--tm-border);
  border-radius: 10px;
  background: var(--tm-surface);
  color: var(--tm-text);
  text-align: left;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.md-typeset .tm-start__card b {
  display: block;
  font-size: 0.68rem;
  margin-bottom: 0.25rem;
  color: var(--tm-text);
}

.md-typeset .tm-start__card span {
  display: block;
  font-size: 0.6rem;
  line-height: 1.5;
  color: var(--tm-text-muted);
}

.md-typeset .tm-start__card:hover {
  border-color: var(--tm-accent);
  transform: translateY(-1px);
  box-shadow: var(--tm-shadow-md);
}

.md-typeset .tm-start__note {
  margin: 0.9rem 0 0;
  font-size: 0.58rem;
  color: var(--tm-text-muted);
}

.md-typeset .tm-empty {
  padding: 2rem 1.2rem;
  text-align: center;
  color: var(--tm-text-muted);
  font-size: 0.66rem;
}

.md-typeset .tm-empty__title {
  margin: 0 0 0.35rem;
  color: var(--tm-text);
  font-weight: 600;
}

.tm-empty__eg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.8rem;
}

.md-typeset .tm-eg {
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--tm-border);
  border-radius: 999px;
  background: var(--tm-surface);
  color: var(--tm-text-muted);
  font-size: 0.6rem;
  cursor: pointer;
}

.md-typeset .tm-eg:hover {
  border-color: var(--tm-accent);
  color: var(--tm-accent);
}

/* Application list -------------------------------------------------------- */

.tm-panel {
  position: sticky;
  top: calc(var(--tm-header, 2.4rem) + 4.6rem);
  padding: 0.9rem;
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  background: var(--tm-surface);
  box-shadow: var(--tm-shadow-sm);
}

.md-typeset .tm-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.md-typeset .tm-panel__title {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.68rem;
  font-weight: 700;
}

.md-typeset .tm-panel__title::after {
  display: none;
}

.md-typeset .tm-panel__count {
  min-width: 1.5rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  background: var(--tm-accent-soft);
  color: var(--tm-accent);
  font-size: 0.58rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.md-typeset .tm-total {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.7rem;
  font-size: 0.58rem;
  color: var(--tm-text-muted);
  font-variant-numeric: tabular-nums;
}

.md-typeset .tm-total b {
  color: var(--tm-text);
  font-size: 0.68rem;
}

.md-typeset .tm-total__price {
  flex: 1 1 100%;
  padding-top: 0.4rem;
  border-top: 1px solid var(--tm-border);
  color: var(--tm-accent);
}

.md-typeset .tm-total__price b {
  color: var(--tm-accent);
  font-size: 0.82rem;
}

.tm-selbody {
  max-height: 44vh;
  overflow-y: auto;
  margin-bottom: 0.8rem;
}

.md-typeset .tm-selbody__empty {
  margin: 0;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--tm-surface-alt);
  font-size: 0.58rem;
  line-height: 1.6;
  color: var(--tm-text-muted);
}

.md-typeset .tm-selbody__empty b {
  color: var(--tm-text);
}

.tm-sgroup {
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--tm-border);
}

.tm-sgroup:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.md-typeset .tm-sgroup__head {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.58rem;
}

.md-typeset .tm-sgroup__head b {
  font-size: 0.62rem;
  color: var(--tm-text);
}

.tm-sgroup__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--tm-text-muted);
  font-size: 0.55rem;
}

.md-typeset .tm-sgroup__count {
  color: var(--tm-text-muted);
  font-variant-numeric: tabular-nums;
}

.tm-sgroup.is-over .tm-sgroup__count {
  color: var(--tm-warn-fg);
  font-weight: 700;
}

.md-typeset .tm-sgroup__warn {
  margin: 0.3rem 0 0;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  background: var(--tm-warn-bg);
  color: var(--tm-warn-fg);
  font-size: 0.58rem;
  font-weight: 600;
}

.md-typeset ul.tm-sgroup__list {
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
}

.md-typeset ul.tm-sgroup__list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
  margin: 0.1rem 0;
  font-size: 0.58rem;
  line-height: 1.5;
}

/* Each list entry mirrors what Copy list and the CSV produce: the official
   Chinese wording first, its English name right under it. */
.tm-sgroup__item {
  flex: 1;
  min-width: 0;
}

.md-typeset .tm-sgroup__item b {
  display: block;
  font-weight: 400;
  color: var(--tm-text);
  overflow-wrap: break-word;
}

.md-typeset .tm-sgroup__item i {
  display: block;
  font-style: normal;
  font-size: 0.54rem;
  color: var(--tm-text-muted);
  overflow-wrap: break-word;
}

.md-typeset .tm-remove {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--tm-text-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.md-typeset .tm-remove:hover {
  background: var(--tm-border);
  color: var(--tm-text);
}

.md-typeset .tm-panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.md-typeset .tm-btn {
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--tm-border-strong);
  border-radius: 8px;
  background: var(--tm-surface);
  color: var(--tm-text);
  font-size: 0.6rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.md-typeset .tm-btn:hover {
  border-color: var(--tm-accent);
  color: var(--tm-accent);
}

.md-typeset .tm-btn--primary {
  border-color: transparent;
  background: var(--tm-accent);
  color: var(--tm-on-accent);
}

.md-typeset .tm-btn--primary:hover {
  color: var(--tm-on-accent);
  filter: brightness(1.08);
}

.md-typeset .tm-btn--ghost {
  grid-column: 1 / -1;
  border-style: dashed;
  color: var(--tm-text-muted);
}

.md-typeset .tm-btn[disabled] {
  opacity: 0.65;
  cursor: default;
}

/* Mobile dock ------------------------------------------------------------- */

.tm-dock {
  display: none;
}

/* Class picker dialog ----------------------------------------------------- */

.md-typeset .tm-dlg {
  width: min(34rem, 92vw);
  max-height: 84vh;
  padding: 0;
  border: 1px solid var(--tm-border);
  border-radius: 14px;
  background: var(--tm-surface);
  color: var(--tm-text);
  box-shadow: 0 24px 60px -20px rgba(8, 12, 20, 0.5);
}

.md-typeset .tm-dlg::backdrop {
  background: rgba(8, 12, 20, 0.55);
  backdrop-filter: blur(2px);
}

.md-typeset .tm-dlg__form {
  display: flex;
  flex-direction: column;
  max-height: 84vh;
}

.md-typeset .tm-dlg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--tm-border);
}

.md-typeset .tm-dlg__head h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.8rem;
}

.md-typeset .tm-dlg__head h2::after {
  display: none;
}

.md-typeset .tm-dlg__close {
  width: 1.8rem;
  height: 1.8rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tm-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.md-typeset .tm-dlg__close:hover {
  background: var(--tm-surface-alt);
  color: var(--tm-text);
}

.md-typeset .tm-dlg__search {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--tm-border);
}

.md-typeset .tm-dlg__search input {
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--tm-border-strong);
  border-radius: 8px;
  background: var(--tm-surface);
  color: var(--tm-text);
  font-size: 0.7rem;
  font-family: inherit;
}

.md-typeset .tm-dlg__list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.7rem 0.8rem;
}

.md-typeset .tm-fieldset {
  margin: 0.4rem 0 0;
  padding: 0;
  border: 0;
}

.md-typeset .tm-fieldset legend {
  padding: 0.4rem 0.3rem;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tm-text-muted);
}

.md-typeset .tm-crow {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.4rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}

.md-typeset .tm-crow:hover {
  background: var(--tm-accent-soft);
}

.md-typeset .tm-crow input {
  margin: 0.15rem 0 0;
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--tm-accent);
  flex: 0 0 auto;
}

.md-typeset .tm-crow__code {
  flex: 0 0 1.4rem;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  color: var(--tm-accent);
}

.tm-crow__text {
  flex: 1;
  min-width: 0;
}

.md-typeset .tm-crow__name {
  display: block;
  font-style: normal;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--tm-text);
}

.md-typeset .tm-crow__zh {
  display: block;
  font-style: normal;
  font-size: 0.56rem;
  color: var(--tm-text-muted);
}

.md-typeset .tm-crow__n {
  flex: 0 0 auto;
  font-size: 0.55rem;
  color: var(--tm-text-muted);
  font-variant-numeric: tabular-nums;
}

.md-typeset .tm-dlg__foot {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--tm-border);
}

.md-typeset .tm-dlg__foot .tm-btn {
  flex: 1;
}

/* Focus visibility -------------------------------------------------------- */

.md-typeset :focus-visible,
.tm-dlg :focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Responsive -------------------------------------------------------------- */

/* Narrow desktop: keep the two-column layout, just slim the list panel.
   Collapsing to one column here would push the application list above the
   results on ordinary ~1000px windows, which reads as a broken page. */
@media screen and (max-width: 62em) {
  .tm-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 1rem;
  }
}

/* True mobile: single column, results first, the dock carries the running
   total and jumps to the list on tap. */
@media screen and (max-width: 48em) {
  .tm-layout {
    grid-template-columns: 1fr;
  }

  .tm-panel {
    position: static;
    margin-top: 0.8rem;
  }

  .tm-selbody {
    max-height: none;
  }

  .md-typeset .tm-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    background: var(--tm-surface);
    border-top: 1px solid var(--tm-border-strong);
    box-shadow: 0 -8px 24px -16px rgba(8, 12, 20, 0.5);
    font-size: 0.64rem;
    color: var(--tm-text);
  }

  .md-typeset .tm-dock__btn {
    margin: 0;
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--tm-accent);
    color: var(--tm-on-accent);
    font-size: 0.62rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
  }

  .md-content {
    padding-bottom: 4rem;
  }

  .md-typeset .tm-dlg {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
    margin: auto auto 0;
  }

  .md-typeset .tm-dlg__form {
    max-height: 92vh;
  }
}

@media screen and (max-width: 44.9375em) {
  .md-typeset #tm-search {
    margin-top: 1rem;
  }

  .md-typeset .tm-bar {
    gap: 0.45rem;
  }

  .md-typeset p.tm-status {
    flex: 1 1 100%;
    margin-left: 0;
    text-align: right;
    font-size: 0.56rem;
  }

  .md-typeset .tm-cbtn {
    padding: 0.7rem;
  }

  /* Row becomes a compact card: class / sub-class in a left rail */
  .md-typeset .tm-row {
    grid-template-columns: 2.1rem minmax(0, 1fr) 2.2rem;
    grid-template-rows: auto auto;
    gap: 0 0.55rem;
    padding: 0.6rem 0.7rem;
  }

  .tm-row__c {
    grid-column: 1;
    grid-row: 1;
  }

  .tm-row__s {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    margin-top: 0.15rem;
  }

  .tm-row__item {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .md-typeset .tm-add {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    width: 2rem;
    height: 2rem;
  }

  .md-typeset .tm-ghead span {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .tm-row,
  .md-typeset .tm-add,
  .md-typeset .tm-start__card,
  .md-typeset .tm-chip {
    transition: none;
  }

  .md-typeset .tm-start__card:hover {
    transform: none;
  }
}
