:root {
  color-scheme: dark;
  --bg: #050B2B; --panel: #0B1546; --panel-2: #00105E; --line: #243473;
  --text: #EDF2FF; --muted: #A9B8E4; --accent: #0077FF; --accent-fill: #0069E0;
  --link: #74B9FF; --good: #63D6A6; --warn: #FFC56B; --bad: #FF8C8C;
  --sans: "Manrope", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; text-wrap: balance; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--link); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.big { font-size: 28px; }
.ok { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.app.guest { display: block; }
.side { border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; padding-inline: 6px; color: var(--accent); text-decoration: none; }
nav { display: flex; flex-direction: column; gap: 3px; }
nav a { border-radius: 8px; padding: 9px 10px; color: var(--muted); font-weight: 500; text-decoration: none; }
nav a:hover { background: var(--panel); color: var(--text); }
nav a[aria-current="page"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.out { margin-top: auto; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding-inline: 6px; overflow-wrap: anywhere; }
.link { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; }
main { padding: 28px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px)); min-width: 0; }
.view { max-width: 820px; margin-inline: auto; display: flex; flex-direction: column; gap: 22px; }
.lead { color: var(--muted); max-width: 62ch; margin-top: 6px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.auth { max-width: 420px; width: 100%; margin: 8vh auto 0; }
.newkey { border-color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.btn { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; font-weight: 600; color: var(--text); text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.note { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.result { border-radius: 8px; padding: 12px; background: var(--bg); border: 1px solid var(--line); }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tab { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--text); text-decoration: none; }
.tab:hover, .tab[aria-current] { border-color: var(--accent); }
.tab[aria-current] { background: var(--panel-2); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: s; }
.steps > li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; counter-increment: s; }
.steps > li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--accent); display: grid; place-items: center; font: 500 13px var(--mono); color: var(--link); }
.steps > li > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
pre { margin: 0; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; font: 13px/1.5 var(--mono); }
.field { display: flex; flex-direction: column; gap: 6px; }
.flabel { font-weight: 600; font-size: 14px; }
select { width: 100%; max-width: 520px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; color: inherit; }
.worklist { display: flex; flex-direction: column; }
.work { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.wname { flex: 1 1 240px; min-width: 0; }
.wcount { flex: 0 0 auto; }
.result .big { font-size: 22px; }
.devcalc summary { cursor: pointer; font-weight: 600; }
.devcalc[open] summary { margin-bottom: 12px; }
input:not([type=hidden]) { width: 100%; max-width: 360px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.slider { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; max-width: 520px; }
.slider input[type=range] { flex: 1 1 200px; max-width: none; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.slider input[type=number] { flex: 0 0 110px; }
.hint { display: inline-block; vertical-align: middle; font-weight: 400; }
.hint summary { list-style: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--link); color: var(--link); font: 600 12px/18px var(--sans); text-align: center; cursor: pointer; }
.hint summary::-webkit-details-marker { display: none; }
.hint[open] summary { background: var(--accent-fill); color: #fff; }
.tip { position: absolute; z-index: 5; left: 16px; right: 16px; max-width: 480px; margin-top: 6px; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--text); }
.box { position: relative; }
.bar { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.bar::-webkit-progress-bar { background: var(--bg); }
.bar::-webkit-progress-value { background: var(--accent); }
.bar::-moz-progress-bar { background: var(--accent); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.r { text-align: right; }
tr.sel { background: var(--panel-2); }
.lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
.sum { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) {
  .app { display: block; min-height: 0; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); gap: 10px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  nav a { padding: 7px 10px; font-size: 14px; }
  .out { margin: 0; flex-direction: row; justify-content: space-between; align-items: center; }
  .tabs, .split { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 23px; }
}
