/* Base + components. Hairlines over boxes; one shadow, only on floating layers (modal, menu, toast). */
*, *::before, *::after { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; overflow-x: clip }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--t-md)/1.55 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility }
a { color: inherit; text-underline-offset: 3px } a:hover { color: var(--accent) }
button, input, select, textarea { font: inherit; color: inherit }
[hidden] { display: none !important }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm) }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent) }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.015em; text-wrap: balance }
.h-page { font-size: var(--t-2xl); line-height: 1.15 } .h-sec { font-size: var(--t-lg); margin-top: var(--s7) }
.lede { color: var(--muted); margin: var(--s2) 0 0; max-width: 62ch } .muted { color: var(--muted) } .small { font-size: var(--t-sm) }
code, .mono { font-family: var(--mono); font-size: .86em }
.mark { display: inline-block; width: 22px; height: 22px; background: currentColor; -webkit-mask: url("../assets/mark.png") center/contain no-repeat; mask: url("../assets/mark.png") center/contain no-repeat }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 40px; padding: 0 var(--s4); border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 600; font-size: var(--t-sm); white-space: nowrap; cursor: pointer; text-decoration: none; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease) }
.btn svg { width: 18px; height: 18px }
.btn-primary { background: var(--text); color: var(--bg) } .btn-primary:hover { background: color-mix(in srgb, var(--text) 86%, var(--bg)); color: var(--bg) }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text) } .btn-secondary:hover { background: var(--raise); color: var(--text) }
.btn-ghost { background: transparent; color: var(--text-2) } .btn-ghost:hover { background: var(--raise); color: var(--text) }
.btn-block { width: 100% } .btn-lg { height: 48px; font-size: var(--t-md) } .btn-sm { height: 32px; padding: 0 var(--s3); font-size: var(--t-xs) }
.btn:disabled { opacity: .5; cursor: not-allowed }
.btn-icon { width: 36px; height: 36px; padding: 0 }

/* fields */
.field { display: grid; gap: 6px } .field > span { font-size: var(--t-sm); font-weight: 500; color: var(--text-2) }
.input, .select, .textarea { width: 100%; height: 44px; padding: 0 var(--s3); border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease) }
.textarea { height: auto; min-height: 120px; padding: var(--s3); line-height: 1.6; resize: vertical }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent) }
.hint { font-size: var(--t-xs); color: var(--muted) } .error { font-size: var(--t-sm); color: var(--bad); min-height: 1.2em }

/* segmented + tabs */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: color-mix(in srgb, var(--text) 6%, transparent) }
.seg button { height: 30px; padding: 0 var(--s3); border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: var(--t-sm); font-weight: 500; cursor: pointer }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line) }

/* data */
.stats { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); border-block: 1px solid var(--line) }
.stat { padding: var(--s5) var(--s5) var(--s5) 0 } .stat + .stat { padding-left: var(--s5); border-left: 1px solid var(--line) }
.stat .k { font-size: var(--t-sm); color: var(--muted) } .stat .v { font-size: 1.75rem; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25 }
.stat .s { font-size: var(--t-sm); color: var(--muted) }
.meter { height: 3px; border-radius: 3px; background: var(--line); margin-top: var(--s2); overflow: hidden } .meter > i { display: block; height: 100%; background: var(--accent) }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums }
.table th { text-align: left; font-weight: 500; font-size: var(--t-xs); color: var(--muted); padding: var(--s2) var(--s4) var(--s2) 0; border-bottom: 1px solid var(--line) }
.table td { padding: var(--s3) var(--s4) var(--s3) 0; border-bottom: 1px solid var(--line); vertical-align: middle } .table .r { text-align: right }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 500; background: var(--raise); color: var(--text-2) }
.badge.ok { color: var(--ok) } .badge.soon { color: var(--muted) } .badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor }
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); color: var(--text-2); font-size: var(--t-sm) }
.empty { padding: var(--s7) 0; text-align: center; color: var(--muted) } .empty b { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px }
.code { position: relative; border-radius: var(--r-md); background: var(--code-bg); color: var(--code-fg); overflow: hidden }
.code pre { margin: 0; padding: var(--s4) var(--s5); overflow-x: auto; font: 13px/1.7 var(--mono) }
.code .copy { position: absolute; top: 10px; right: 10px; height: 28px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid #3A3D42; background: #232528; color: #E9E6E1; font-size: 12px; cursor: pointer }
.skel { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--raise), var(--line), var(--raise)); background-size: 200% 100%; animation: sk 1.2s infinite linear; color: transparent }
@keyframes sk { to { background-position: -200% 0 } }

/* floating layers */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: var(--s4); z-index: 50; animation: fade var(--slow) var(--ease) }
.dialog { width: min(920px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); animation: rise var(--slow) var(--ease) }
.menu { position: absolute; min-width: 220px; padding: var(--s2); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); z-index: 40 }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: var(--s2); height: 36px; padding: 0 var(--s3); border: 0; border-radius: var(--r-sm); background: none; text-align: left; text-decoration: none; cursor: pointer; font-size: var(--t-sm) }
.menu a:hover, .menu button:hover { background: var(--raise); color: var(--text) }
.toast { position: fixed; bottom: var(--s5); left: 50%; transform: translateX(-50%); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: var(--t-sm); box-shadow: var(--shadow); z-index: 60; animation: rise var(--slow) var(--ease) }
@keyframes fade { from { opacity: 0 } } @keyframes rise { from { opacity: 0; transform: translateY(8px) } }
.toast { animation-name: fade }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important } }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 2px } .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent) }
