/* Design tokens (theme-independent) + element defaults. Colours live in themes.css. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  /* type scale */
  --fs-xs: 11px; --fs-sm: 12px; --fs-meta: 12.5px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 21px; --fs-title: 28px;
  /* spacing (4px grid) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  /* radii */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  /* motion (150–250 ms) */
  --dur-fast: 150ms; --dur: 200ms; --dur-slow: 240ms;
  --ease: cubic-bezier(0.2, 0, 0, 1); --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease-in: cubic-bezier(0.4, 0, 1, 1); --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  /* layout */
  --sidebar-w: 248px; --inspector-w: 360px; --row-indent: 22px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs-base)/1.5 var(--font); letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent; font-feature-settings: "kern";
}
:lang(zh-CN) body, html:lang(zh-CN) body { letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea {
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-md); padding: 7px 10px; outline: none; width: 100%;
  transition: none;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px;
}
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; cursor: pointer; }
input[type=number], .num, .badge, .count, .title-count, kbd { font-variant-numeric: tabular-nums; }
a { color: var(--accent-ink); }
kbd {
  font: 500 11px/1 var(--font-mono); padding: 3px 6px; border-radius: var(--r-xs); color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 1px 0 var(--line-strong); white-space: nowrap;
}
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.spacer { flex: 1; }
svg.ico { flex: none; display: block; }

/* Focus: visible but elegant – a soft accent halo, only for keyboard focus. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--r-sm); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 6px 14px;
  border-radius: var(--r-md); background: var(--accent); color: var(--accent-text); font-weight: 560; font-size: 13.5px; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.btn:hover { filter: brightness(1.06); }
.btn:active, .icon-btn:active, .side-item:active, .proc-btn:active, .tabbar button:active, .fab:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--text); box-shadow: var(--e-1); }
.btn.ghost:hover { background: var(--surface-3); filter: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { min-height: 28px; padding: 3px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none;
  transition: transform var(--dur-fast) var(--ease);
}
.icon-btn.sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.xs { width: 22px; height: 22px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { color: var(--accent-ink); background: var(--accent-soft); }
@media (pointer: coarse) { .icon-btn, .icon-btn.sm { width: 44px; height: 44px; } .btn { min-height: 44px; } }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 35%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--muted) 60%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

/* Motion off (Settings → Motion → Off, or "System" while the OS asks for reduced motion): no CSS animations or
   transitions anywhere; app/motion.js skips every WAAPI animation as well. An explicit Full / Simple choice wins. */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]):not([data-motion="simple"]) *, html:not([data-motion="full"]):not([data-motion="simple"]) *::before, html:not([data-motion="full"]):not([data-motion="simple"]) *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
