:root {
  color-scheme: light;
  --paper: #eef4fb;
  --sheet: #ffffff;
  --ink: #0b1f3a;
  --muted: #5b6d80;
  --line: #b8c9dc;
  --soft-line: #dde7f1;
  --accent: #1769e0;
  --accent-ink: #ffffff;
  --wash: #e7f1ff;
  --grid: #dce7f3;
  --danger: #b42318;
  --good: #08775a;
  --shadow: 0 18px 48px rgba(11, 31, 58, .1);
  --display: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --body: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

html[data-theme="night"] {
  color-scheme: dark;
  --paper: #071426;
  --sheet: #0d2138;
  --ink: #f4f8ff;
  --muted: #a8b8cb;
  --line: #33516f;
  --soft-line: #203b57;
  --accent: #67afff;
  --accent-ink: #061426;
  --wash: #153a61;
  --grid: #112c47;
  --danger: #ff8a80;
  --good: #63d5ad;
  --shadow: 0 22px 58px rgba(0, 8, 20, .36);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  font: 15px/1.55 var(--body);
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 2px;
}
.hidden { display: none !important; }

.app {
  width: min(1200px, calc(100% - 40px));
  margin: 20px auto 32px;
  padding: 0 0 40px;
}
.topbar { display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 4px 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; color: #fff; background: var(--accent); border-radius: 15px; box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 18%, transparent); font: 800 15px/1 Georgia, serif; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font: 700 22px/1.05 Georgia, "Songti SC", serif; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.masthead {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  padding: 48px 4px 34px;
}
.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2em;
}
h1 { margin: 0; font: 760 clamp(40px, 5vw, 60px)/1 var(--display); letter-spacing: -.045em; }
h2 { margin: 0; font: 700 22px/1.15 var(--display); letter-spacing: -.02em; }
.masthead-note { max-width: 680px; margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.hero-actions { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr); width: min(360px, 42%); gap: 10px; }
.hero-actions > .button, .hero-actions summary { width: 100%; }
.add-label-mobile { display: none; }
.utility-menu { position: relative; }
.utility-menu summary { display: flex; min-height: 44px; align-items: center; justify-content: center; list-style: none; }
.settings-icon { margin-right: 5px; }
.utility-menu summary::-webkit-details-marker { display: none; }
.utility-menu-panel { position: absolute; z-index: 14; top: calc(100% + 8px); right: 0; display: grid; width: 250px; gap: 4px; padding: 10px; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.utility-menu-panel .button, .utility-menu-panel .sync-pill { width: 100%; justify-content: center; }
.utility-menu-panel .menu-action { min-height: 38px; justify-content: flex-start; padding: 8px 10px; background: transparent; border: 0; border-radius: 8px; font-weight: 650; }
.utility-menu-panel .menu-action:hover { background: var(--wash); transform: none; }
.utility-menu-panel .logout-action { color: var(--danger); }
.menu-icon { display: inline-grid; width: 22px; flex: 0 0 22px; place-items: center; font-size: 20px; line-height: 1; }
.menu-lock { position: relative; width: 16px; height: 14px; margin: 5px 3px 0; border: 2px solid currentColor; border-radius: 3px; }
.menu-lock::before { position: absolute; top: -9px; left: 2px; width: 8px; height: 8px; content: ""; border: 2px solid currentColor; border-bottom: 0; border-radius: 7px 7px 0 0; }
.menu-divider { width: calc(100% - 12px); height: 1px; margin: 5px auto; background: var(--line); border: 0; }
.button {
  appearance: none;
  min-height: 42px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
  transition: transform .16s ease, border-color .16s ease, color .16s ease;
}
.button.secondary { color: var(--accent); background: transparent; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.button:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { color: var(--accent-ink); filter: brightness(.92); }
.button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.button.small { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.icon-button {
  appearance: none;
  min-width: 38px;
  min-height: 38px;
  padding: 5px 7px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
}
.icon-button:hover { color: var(--accent); border-color: var(--accent); }
.theme-button { width: 42px; height: 42px; padding: 0; background: var(--wash); border: 1px solid var(--line); border-radius: 12px; font-size: 20px; }
.sync-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 11px;
  color: var(--muted);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
}
.sync-pill::before { width: 7px; height: 7px; margin-right: 7px; content: ""; background: var(--good); border-radius: 50%; }
.sync-pill[data-state="syncing"]::before { background: var(--accent); animation: pulse 1s infinite; }
.sync-pill[data-state="error"]::before { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

.summary {
  display: grid;
  grid-template-columns: minmax(280px, 1.55fr) repeat(3, minmax(150px, .7fr));
  gap: 14px;
}
.metric { min-height: 154px; padding: 24px 22px; background: var(--sheet); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 6%, transparent); }
.metric.hero { color: #fff; background: var(--accent); border-color: var(--accent); }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.metric-value { display: block; margin-top: 17px; font: 700 clamp(27px, 3vw, 46px)/1 var(--display); letter-spacing: -.04em; }
.metric.hero .metric-label, .metric.hero .metric-detail { color: color-mix(in srgb, #fff 75%, transparent); }
.metric.hero .metric-value { color: #fff; }
.metric-date { font-size: clamp(22px, 2.4vw, 35px); }
.metric-detail { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }

.records { padding-top: 28px; }
.records-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 16px; }
.filters { display: grid; grid-template-columns: minmax(260px, 1.6fr) repeat(3, minmax(140px, .6fr)); gap: 8px; margin-bottom: 14px; }
.search-box {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 42px;
  padding: 0 7px 0 12px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-icon { color: var(--accent); font-size: 22px; line-height: 1; }
.search-input { width: 100%; min-width: 0; height: 40px; padding: 7px 10px; color: var(--ink); background: transparent; border: 0; outline: 0; }
.search-input:focus-visible { outline: 0; }
.search-input::placeholder { color: var(--muted); }
.search-clear { min-width: 44px; min-height: 32px; padding: 4px 8px; color: var(--accent); background: var(--wash); border: 0; border-radius: 5px; font-size: 12px; font-weight: 750; }
.control { width: 100%; min-height: 42px; padding: 8px 11px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; }
textarea.control { min-height: 88px; resize: vertical; }
textarea.control.tall { min-height: 118px; }

.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: 8px; }
table { width: 100%; min-width: 940px; border-collapse: collapse; }
th { padding: 9px 10px; background: var(--wash); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; letter-spacing: .025em; text-align: center; vertical-align: middle; white-space: nowrap; }
td { padding: 13px 10px; border-bottom: 1px solid var(--soft-line); vertical-align: middle; }
td:not(:first-child) { text-align: center; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: color-mix(in srgb, var(--wash) 36%, transparent); }
.category-group-heading td { padding: 0; background: color-mix(in srgb, var(--wash) 72%, var(--sheet)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.category-group-heading:first-child td { border-top: 0; }
.category-group-heading:hover td { background: color-mix(in srgb, var(--wash) 72%, var(--sheet)); }
.category-group-toggle {
  display: grid;
  width: 100%;
  min-height: 54px;
  padding: 11px 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.category-group-toggle:hover { color: var(--accent); }
.category-group-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 26%, transparent); outline-offset: -3px; }
.category-group-name { font: 750 17px/1.3 var(--display); }
.category-group-count { padding: 3px 8px; color: var(--muted); background: var(--sheet); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 700; }
.category-group-symbol { justify-self: end; width: 28px; color: var(--accent); font-size: 20px; font-weight: 500; line-height: 1; text-align: center; }
.tool-title-line { display: flex; align-items: center; gap: 8px; }
.tool-title { color: var(--ink); font: 700 15px/1.4 var(--display); text-decoration: none; overflow-wrap: anywhere; }
.tool-title[href]:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.favorite-mark { color: #d89200; font-size: 17px; }
.subline { max-width: 440px; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 7px; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.row-actions { display: flex; justify-content: center; gap: 7px; }
.empty { display: grid; min-height: 300px; padding: 42px; place-items: center; align-content: center; text-align: center; }
.empty-mark { color: var(--wash); font: 700 68px/1 var(--display); }
.empty h3 { margin: 10px 0 3px; font: 700 22px/1.2 var(--display); }
.empty p { margin: 0 0 18px; color: var(--muted); }
.footer-note { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 12px; }

dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(4, 20, 42, .66); backdrop-filter: blur(3px); }
dialog form { display: flex; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); flex-direction: column; margin: 0; }
.dialog-fallback-open { overflow: hidden; }
.dialog-fallback-open::before { position: fixed; z-index: 90; content: ""; inset: 0; background: rgba(4, 20, 42, .66); }
dialog.dialog-fallback[open] { display: block; position: fixed; z-index: 100; top: 50%; left: 50%; margin: 0; transform: translate(-50%, -50%); }
.auth-dialog, .confirm-dialog { width: min(480px, calc(100% - 28px)); }
.dialog-head { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: start; gap: 14px; padding: 22px 24px 18px; background: var(--sheet); border-bottom: 2px solid var(--accent); }
.dialog-head h2 { font-size: 28px; }
.close-button { padding: 0 5px; color: var(--muted); background: transparent; border: 0; font-size: 28px; line-height: 1; }
.form-body { min-height: 0; padding: 22px 24px 10px; overflow-y: auto; overscroll-behavior: contain; }
.auth-copy { margin: 0 0 18px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 800; letter-spacing: .025em; }
.field.full { grid-column: 1 / -1; }
.field small { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.preset-options { display: flex; flex-wrap: wrap; gap: 7px; }
.option-chip {
  appearance: none;
  min-height: 32px;
  padding: 5px 10px;
  color: var(--muted);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}
.option-chip:hover { color: var(--accent); border-color: var(--accent); }
.option-chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.checkbox-field { min-height: 42px; flex-direction: row; align-items: center; padding-top: 23px; }
.checkbox-field input { width: 19px; height: 19px; accent-color: var(--accent); }
.required::after { color: var(--accent); content: " *"; }
.error { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: 12px; }
.dialog-actions { display: flex; flex: 0 0 auto; justify-content: space-between; gap: 12px; padding: 16px 24px 20px; background: var(--sheet); border-top: 1px solid var(--line); }
.dialog-actions.end { justify-content: flex-end; }
.action-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-card { display: flex; gap: 12px; margin: 10px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice-card:has(input:checked) { background: var(--wash); border-color: var(--accent); }
.choice-card input { margin-top: 4px; accent-color: var(--accent); }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: 3px; color: var(--muted); }
.danger-choice:has(input:checked) { border-color: var(--danger); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(360px, calc(100% - 48px)); padding: 12px 16px; color: var(--accent-ink); background: var(--accent); border-radius: 8px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(20px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 981px) {
  .app { margin-top: 12px; margin-bottom: 24px; padding-bottom: 28px; }
  .topbar { min-height: 62px; padding-bottom: 10px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 13px; }
  .brand-copy strong { font-size: 20px; }
  .brand-copy small { margin-top: 2px; }
  .masthead { align-items: center; padding-top: 24px; padding-bottom: 20px; }
  .eyebrow { margin-bottom: 6px; font-size: 10px; }
  h1 { font-size: clamp(36px, 3.8vw, 48px); }
  .masthead-note { margin-top: 9px; font-size: 14px; }
  .hero-actions { width: min(340px, 40%); }
  .summary { grid-template-columns: repeat(3, minmax(180px, 1fr)) minmax(300px, 1.35fr); gap: 12px; }
  .metric { display: flex; min-height: 72px; padding: 10px 16px; align-items: center; justify-content: space-between; gap: 14px; border-radius: 12px; }
  .metric-label { font-size: 14px; letter-spacing: .04em; }
  .metric-value { flex: 0 0 auto; margin-top: 0; font-size: clamp(28px, 2.4vw, 36px); }
  .metric-date { font-size: clamp(22px, 1.8vw, 28px); white-space: nowrap; }
  .metric-detail { display: none; }
  .records {
    display: grid;
    padding-top: 26px;
    grid-template-columns: minmax(140px, .55fr) minmax(320px, 1.7fr) repeat(3, minmax(145px, .72fr)) auto;
    align-items: center;
    gap: 10px;
  }
  .records-head, .filters { display: contents; }
  .records-head > div { grid-column: 1; grid-row: 1; align-self: center; text-align: center; }
  .records-head h2 { font-size: 26px; }
  .records-head #installButton { grid-column: 6; grid-row: 1; min-height: 42px; align-self: stretch; white-space: nowrap; }
  .filters .search-box { grid-column: 2; grid-row: 1; }
  .filters #categoryFilter { grid-column: 3; grid-row: 1; }
  .filters #platformFilter { grid-column: 4; grid-row: 1; }
  .filters #sortFilter { grid-column: 5; grid-row: 1; }
  .table-wrap, .footer-note { grid-column: 1 / -1; }
  .table-wrap { margin-top: 18px; }
  .footer-note { margin-top: 4px; }
}

@media (min-width: 1100px) {
  .app { width: min(1380px, calc(100% - 56px)); }
  .header-shell {
    display: grid;
    min-height: 70px;
    padding: 8px 8px 10px;
    border-bottom: 1px solid var(--line);
    grid-template-columns: minmax(260px, 300px) minmax(360px, 1fr) 44px minmax(300px, 340px);
    align-items: center;
    column-gap: 24px;
  }
  .header-shell .topbar, .header-shell .masthead { display: contents; }
  .header-shell .brand { grid-column: 1; grid-row: 1; min-width: 0; }
  .header-shell .brand-copy small { display: none; }
  .header-shell .masthead > div:first-child { min-width: 0; grid-column: 2; grid-row: 1; }
  .header-shell .eyebrow { display: none; }
  .header-shell h1 { font-size: 28px; letter-spacing: -.03em; }
  .header-shell .masthead-note { margin-top: 4px; font-size: 12px; line-height: 1.35; }
  .header-shell .top-actions { grid-column: 3; grid-row: 1; justify-content: center; gap: 6px; }
  .header-shell .hero-actions { width: auto; grid-column: 4; grid-row: 1; gap: 6px; }
  .header-shell .hero-actions .button, .header-shell .hero-actions summary, .header-shell .top-actions .button, .header-shell .theme-button { min-height: 40px; height: 40px; }
  .summary { margin-top: 20px; }
}

@media (max-width: 980px) {
  .masthead { align-items: stretch; flex-direction: column; }
  .hero-actions { width: min(460px, 100%); }
  .summary { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .app { width: min(100% - 20px, 1200px); margin: 10px auto 18px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .header-shell {
    position: relative;
    display: block;
    padding: 14px;
    background: var(--sheet);
    border: 1px solid var(--soft-line);
    border-radius: 18px;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--ink) 8%, transparent);
  }
  .topbar { display: flex; min-height: 42px; padding: 0; border: 0; gap: 8px; }
  .brand { display: flex; min-width: 0; flex: 1 1 auto; gap: 8px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 12px; font-size: 13px; }
  .brand-copy { min-width: 0; }
  .brand-copy strong { overflow: visible; font-size: clamp(16px, 4.6vw, 18px); text-overflow: clip; white-space: nowrap; }
  .brand-copy small { display: none; }
  .top-actions { display: flex; flex: 0 0 auto; margin-right: 49px; }
  .theme-button {
    width: 42px;
    height: 42px;
    color: var(--ink);
    background: var(--sheet);
    border-radius: 12px;
    font-size: 21px;
  }
  .masthead { display: flex; gap: 0; padding: 25px 0 0; }
  .masthead > div:first-child { display: block; min-width: 0; }
  .masthead h1 { font-size: 36px; line-height: 1.05; letter-spacing: -.035em; white-space: nowrap; }
  .masthead .eyebrow { display: none; }
  .masthead-note { display: block; margin-top: 16px; font-size: 15px; line-height: 1.55; }
  .hero-actions { display: block; width: 100%; }
  .utility-menu { position: absolute; z-index: 30; top: 14px; right: 14px; }
  .utility-menu summary {
    width: 42px;
    min-height: 42px;
    padding: 0;
    color: var(--ink);
    background: var(--sheet);
    border-color: var(--line);
    border-radius: 12px;
  }
  .utility-menu summary:hover { color: var(--accent); transform: none; }
  .utility-menu[open] summary { color: var(--accent); border-color: var(--accent); }
  .settings-icon { margin: 0; font: 23px/1 Arial, sans-serif; }
  .settings-label { display: none; }
  .utility-menu-panel {
    top: calc(100% + 12px);
    right: 0;
    left: auto;
    width: min(380px, calc(100vw - 48px));
    max-height: calc(100dvh - 112px - env(safe-area-inset-bottom));
    gap: 2px;
    padding: 10px;
    overflow-y: auto;
    background: var(--sheet);
    border-radius: 17px;
    box-shadow: 0 22px 55px rgba(11, 31, 58, .2);
  }
  .utility-menu-panel .sync-pill {
    min-height: 46px;
    justify-content: flex-start;
    padding: 10px 12px;
    border: 0;
    border-radius: 11px;
    font-size: 14px;
  }
  .utility-menu-panel .sync-pill::before { width: 9px; height: 9px; margin-right: 10px; }
  .utility-menu-panel .menu-action {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 650;
    text-align: left;
  }
  .utility-menu-panel .menu-action:hover { background: transparent; }
  .utility-menu-panel .menu-action:active { background: var(--wash); }
  .utility-menu-panel .menu-divider { width: calc(100% - 20px); margin: 6px auto; }
  #addButton {
    position: static;
    width: 100%;
    min-height: 56px;
    margin-top: 23px;
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow: none;
    font-size: 18px;
    font-weight: 800;
  }
  .add-label-desktop { display: none; }
  .add-label-mobile { display: inline; }
  .summary { margin-top: 10px; grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { display: grid; min-height: 94px; padding: 12px 9px; grid-template-rows: auto auto; place-content: center; justify-items: center; gap: 8px; border-radius: 14px; text-align: center; }
  .metric.hero { min-height: 94px; }
  .metric-label, .metric-value { width: auto; margin-right: auto; margin-left: auto; justify-self: center; text-align: center; }
  .metric-label { font-size: 13px; font-weight: 800; line-height: 1.2; letter-spacing: 0; }
  .metric-value { margin-top: 0; font-size: 31px; font-weight: 800; line-height: 1; }
  .metric-date { font-size: 15px; font-weight: 800; line-height: 1.1; letter-spacing: -.025em; white-space: nowrap; }
  .metric-detail { display: none; }
  .records-head { align-items: start; flex-direction: column; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-box { grid-column: 1 / -1; }
  .filters select:last-child { grid-column: auto; }
  .filters > select { min-width: 0; padding-right: 6px; padding-left: 6px; font-size: 13px; text-align: center; text-align-last: center; }
  .button, .control { min-height: 44px; }
  .table-wrap { overflow: visible; }
  table { display: block; min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; padding: 10px; }
  tbody tr { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; background: var(--sheet); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 13px; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 5%, transparent); }
  tbody td { display: grid; min-width: 0; gap: 5px; padding: 11px 12px; overflow-wrap: anywhere; border: 0; border-bottom: 1px solid var(--soft-line); }
  tbody td { text-align: left; }
  tbody td::before { color: var(--muted); content: attr(data-label); font-size: 11px; font-weight: 800; line-height: 1.25; letter-spacing: .08em; }
  tbody td:first-child, tbody td:nth-child(4), tbody td:last-child { grid-column: 1 / -1; }
  tbody td:first-child { padding: 15px 14px 14px; background: var(--wash); }
  tbody td:first-child::before, tbody td:last-child::before { content: none; }
  tbody .category-child-row td:not(:first-child) { text-align: left; }
  tbody td:nth-child(2), tbody td:nth-child(3), tbody td:nth-child(4) { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: center; gap: 6px; font-size: 15px; }
  tbody td:nth-child(3) { font-weight: 700; }
  tbody td:nth-child(2)::before, tbody td:nth-child(3)::before, tbody td:nth-child(4)::before { flex: 0 0 100%; margin-bottom: 2px; }
  tbody td.free-price-cell { display: none !important; }
  tbody .free-tool-row td:nth-child(2), tbody .free-tool-row td:nth-child(4) { grid-column: auto; }
  tbody .tool-title { font-size: 17px; line-height: 1.35; }
  tbody .subline { display: -webkit-box; max-width: none; margin-top: 7px; overflow: hidden; font-size: 13px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
  tbody .tag { margin: 0 8px 0 0; padding: 0; background: transparent; border: 0; border-radius: 0; font-size: 15px; line-height: 1.45; }
  tbody td:last-child { border-bottom: 0; }
  tbody tr:hover td { background: inherit; }
  tbody tr:hover td:first-child { background: var(--wash); }
  tbody .category-group-heading { display: block; margin-top: 8px; overflow: visible; background: transparent; border: 0; border-radius: 0; }
  tbody .category-group-heading:first-child { margin-top: 0; }
  tbody .category-group-heading td { display: block; padding: 0; background: transparent; border: 0; }
  tbody .category-group-heading td::before { content: none; }
  tbody .category-group-heading:hover td { background: transparent; }
  .category-group-toggle { min-height: 52px; padding: 10px 13px; background: var(--wash); border: 1px solid var(--line); border-radius: 9px; }
  .category-group-name { font-size: 16px; }
  .row-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .row-actions .icon-button { flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
  .footer-note { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .checkbox-field { padding-top: 0; }
  .dialog-head, .form-body, .dialog-actions { padding-right: 16px; padding-left: 16px; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions > div, .action-group { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .dialog-actions.end { flex-direction: row; }
  .dialog-actions.end .button { flex: 1; }
  .toast { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: calc(100% - 24px); }
}

@media (max-width: 430px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .search-box { grid-column: 1 / -1; }
  .filters select:last-child { grid-column: auto; }
  .masthead h1 { font-size: 34px; }
  .metric, .metric.hero { min-height: 90px; }
}

