/* CalculatorsPlatform — site shell styles */
:root, html[data-theme="light"] {
  --bg: #f6f7fb; --surface: #ffffff; --surface2: #f1f4f9; --line: #e2e7f0; --line2: #cfd7e4;
  --text: #0f172a; --text2: #334155; --muted: #64748b; --accent: #2563eb; --accent-h: #1d4ed8; --accent-soft: #eff4ff;
  --good: #15803d; --good-soft: #ecfdf3; --bad: #dc2626; --bad-soft: #fef2f2; --warn: #b45309; --warn-soft: #fffbeb; --info-soft: #eff6ff;
  --c1: #2563eb; --c2: #f59e0b; --c3: #10b981; --c4: #ef4444; --c5: #8b5cf6; --c6: #06b6d4;
  --header-bg: rgba(255, 255, 255, .92); --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .14);
  --radius: 14px; --radius-s: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ic-finance: #2563eb; --ic-health: #16a34a; --ic-math: #7c3aed; --ic-time: #ea580c; --ic-home: #b45309; --ic-convert: #0891b2;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0b1120; --surface: #131b2e; --surface2: #1a2438; --line: #26324a; --line2: #34425f;
  --text: #e6ebf5; --text2: #c3cbdb; --muted: #8b97ae; --accent: #6b9bff; --accent-h: #8db1ff; --accent-soft: #17264a;
  --good: #4ade80; --good-soft: #10291c; --bad: #f87171; --bad-soft: #2d1518; --warn: #fbbf24; --warn-soft: #2a2110; --info-soft: #14223f;
  --c1: #6b9bff; --c2: #fbbf24; --c3: #34d399; --c4: #f87171; --c5: #a78bfa; --c6: #22d3ee;
  --header-bg: rgba(11, 17, 32, .9); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  --ic-finance: #6b9bff; --ic-health: #4ade80; --ic-math: #a78bfa; --ic-time: #fb923c; --ic-home: #f59e0b; --ic-convert: #22d3ee;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
mark { background: rgba(250, 204, 21, .35); color: inherit; border-radius: 2px; padding: 0 1px; }
kbd { font: 12px var(--mono); }

/* ---------- category icons (CSS masks, tinted per category) ---------- */
.card-ic { display: inline-block; width: 20px; height: 20px; flex: none; background: var(--accent); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ic-finance { background: var(--ic-finance); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10 12 4l9 6'/%3E%3Cpath d='M5 10v8M9.7 10v8M14.3 10v8M19 10v8M3 21h18'/%3E%3C/svg%3E"); }
.ic-health { background: var(--ic-health); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 5.6a5.5 5.5 0 0 0-7.8 0L12 6.6l-1-1a5.5 5.5 0 0 0-7.8 7.8l1 1L12 22l7.8-7.6 1-1a5.5 5.5 0 0 0 0-7.8z'/%3E%3Cpath d='M3.5 12h4l2-3 3 6 2-3h6'/%3E%3C/svg%3E"); }
.ic-math { background: var(--ic-math); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Cpath d='M7 8.5h4M9 6.5v4M13.5 8.5h4M7 15.5l3 3M10 15.5l-3 3M13.5 15h4M13.5 18h4'/%3E%3C/svg%3E"); }
.ic-time { background: var(--ic-time); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='13' r='8'/%3E%3Cpath d='M12 9v4l2.5 2.5M9 2h6M12 2v3'/%3E%3C/svg%3E"); }
.ic-home { background: var(--ic-home); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11 12 4l9 7'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M9 20v-6h6v6'/%3E%3C/svg%3E"); }
.ic-convert { background: var(--ic-convert); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h14l-4-4M20 16H6l4 4'/%3E%3C/svg%3E"); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line); }
.site-header > .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 18px; letter-spacing: -0.02em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { width: 30px; height: 30px; flex: none; }
.logo b { color: var(--accent); font-weight: 750; }
.site-search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.site-search input { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 999px; padding: 0 40px 0 38px; font: inherit; font-size: 15px; transition: border-color .15s, background .15s, box-shadow .15s; }
.site-search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.site-search input::-webkit-search-cancel-button { display: none; }
.search-ic { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: 1px solid var(--line2); color: var(--muted); border-radius: 5px; padding: 0 6px; line-height: 18px; pointer-events: none; }
.site-search input:focus ~ .search-kbd { display: none; }
.search-results { position: absolute; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; max-height: min(70vh, 520px); overflow: auto; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); }
.sr-item:hover, .sr-item.on { background: var(--accent-soft); text-decoration: none; }
.sr-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.sr-all { display: block; padding: 8px 10px; font-size: 14px; border-top: 1px solid var(--line); margin-top: 4px; }
.sr-empty { padding: 14px; color: var(--muted); font-size: 14px; }
.head-tools { display: flex; align-items: center; gap: 6px; }
.theme-btn, .menu-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.theme-btn:hover, .menu-btn:hover { color: var(--text); border-color: var(--line2); }
.theme-btn svg, .menu-btn svg { width: 18px; height: 18px; }
.theme-btn svg { display: none; }
.theme-btn[data-mode="light"] .i-light, .theme-btn[data-mode="dark"] .i-dark, .theme-btn[data-mode="auto"] .i-auto, .theme-btn:not([data-mode]) .i-auto { display: block; }
.lang-switch { height: 38px; display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text2); font-size: 14px; font-weight: 600; }
.lang-switch:hover { text-decoration: none; border-color: var(--line2); color: var(--text); }
.menu-btn { display: none; }
.site-nav { border-top: 1px solid var(--line); }
.site-nav .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; height: 44px; align-items: center; }
.site-nav .wrap::-webkit-scrollbar { display: none; }
.site-nav a { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; color: var(--text2); font-size: 14.5px; font-weight: 550; white-space: nowrap; }
.site-nav a .card-ic { width: 16px; height: 16px; }
.site-nav a:hover { background: var(--surface2); text-decoration: none; color: var(--text); }
.site-nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 760px) {
  .site-header > .wrap { gap: 8px; height: 56px; flex-wrap: wrap; }
  .logo span { font-size: 16px; }
  .site-header .site-search { order: 5; flex-basis: 100%; max-width: none; margin: 0 0 10px; }
  .site-header > .wrap { height: auto; padding-top: 8px; }
  .head-tools { margin-left: auto; }
  .search-kbd { display: none; }
  .menu-btn { display: grid; }
  .site-nav { display: none; }
  .site-nav.open { display: block; }
  .site-nav.open .wrap { flex-direction: column; align-items: stretch; height: auto; padding: 8px 0; }
}

/* ---------- home ---------- */
.hero { background: linear-gradient(180deg, var(--accent-soft), transparent); padding: 44px 0 26px; text-align: center; }
.hero h1 { font-size: clamp(28px, 4.6vw, 44px); margin: 0 0 10px; letter-spacing: -0.03em; }
.hero p { margin: 0 auto 22px; max-width: 680px; color: var(--muted); font-size: 17px; }
.home-search { position: relative; max-width: 680px; margin: 0 auto; }
.home-search input { width: 100%; height: 58px; border-radius: 16px; border: 1.5px solid var(--line2); background: var(--surface); color: var(--text); font: inherit; font-size: 18px; padding: 0 18px 0 52px; box-shadow: var(--shadow); }
.home-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); }
.home-search .search-ic { left: 18px; width: 22px; height: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text2); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip .card-ic { width: 15px; height: 15px; }
.chip:hover { border-color: var(--line2); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip[aria-pressed="true"] .card-ic { background: #fff; }
.count { color: var(--muted); font-size: 14px; margin: 8px 0 12px; }
.section { margin: 26px 0 8px; }
.section-h { font-size: 20px; margin: 0 0 12px; }
.empty { grid-column: 1 / -1; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:hover { text-decoration: none; border-color: var(--line2); box-shadow: var(--shadow); transform: translateY(-1px); }
.card .card-ic { width: 22px; height: 22px; margin-top: 2px; }
.card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-title { font-weight: 620; line-height: 1.3; }
.card-short { color: var(--muted); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin: 30px 0 40px; }
.cat-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cat-head .card-ic { width: 24px; height: 24px; }
.cat-head h2 { font-size: 18px; margin: 0; flex: 1; }
.cat-head h2 a { color: var(--text); }
.cat-n { font-size: 12px; color: var(--muted); background: var(--surface2); border-radius: 999px; padding: 2px 9px; }
.link-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 16px; }
.link-list li { break-inside: avoid; padding: 3px 0; font-size: 14.5px; line-height: 1.4; }
.link-list a { color: var(--text2); }
.link-list a:hover { color: var(--accent); }
@media (max-width: 420px) { .link-list { columns: 1; } .cat-grid { grid-template-columns: 1fr; } }

/* ---------- inner pages ---------- */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 13.5px; margin: 16px 0 6px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.page-head h1 { display: flex; align-items: center; gap: 12px; font-size: clamp(26px, 3.6vw, 36px); margin: 8px 0 6px; }
.page-head h1 .card-ic { width: 32px; height: 32px; }
.page-head p { color: var(--muted); margin: 0 0 22px; max-width: 820px; }
.prose { max-width: 780px; margin: 24px auto 56px; }
.prose h1 { font-size: 32px; }
.prose h2 { font-size: 21px; margin-top: 30px; }
.all-list { padding-left: 20px; }
.all-list li { margin: 4px 0; color: var(--muted); font-size: 15px; }
.site-search.big { max-width: 560px; margin: 20px 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; padding: 34px 0 24px; font-size: 14px; color: var(--muted); }
.foot-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.foot-brand p { margin: 10px 0 0; max-width: 340px; }
.foot-nav { display: flex; flex-direction: column; gap: 6px; }
.foot-nav a { color: var(--text2); }
.foot-copy { margin: 26px 0 0; font-size: 13px; }
@media (max-width: 760px) { .foot-cols { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

@media print {
  .site-header, .site-footer, .related, .cp-toolbar, .toc, .cp-form-actions, .skip { display: none !important; }
  body { background: #fff; }
}
