/* gwizpy feeds & speeds UI - plain CSS, no framework */
:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #66727f;
  --line: #d5dbe1;
  --accent: #2b6cb0;
  --accent-ink: #ffffff;
  --top: #24384f;
  --ok: #2f9e44;
  --warn: #e8a317;
  --bad: #d64545;
  --warn-bg: #fff6e0;
  --bad-bg: #fdecec;
  --radius: 8px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: normal; }

/* ---- top bar ---------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--top); color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.brand { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand small { display: block; font-weight: 400; font-size: .72rem; opacity: .75; }
.summary { display: flex; align-items: center; gap: 6px; flex: 1 1 420px; flex-wrap: wrap; min-width: 0; }
.sum-item { background: rgba(255,255,255,.1); border-radius: 6px; padding: 3px 10px; min-width: 84px; }
.sum-l { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.sum-v { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.sum-status { padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: .85rem; background: var(--ok); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-status.bad { background: var(--bad); }
.sum-status.warn { background: var(--warn); color: #222; }
.sum-status.busy { background: #6b7b8c; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 5px 12px; font-size: .9rem; }
.seg input:checked + span { background: #fff; color: var(--top); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid #9cc3ff; outline-offset: -2px; }

.btn {
  font: inherit; font-size: .9rem; cursor: pointer;
  border: 1px solid var(--line); background: #f7f9fb; color: var(--ink);
  border-radius: 6px; padding: 5px 12px;
}
.btn:hover { background: #e9eef3; }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.topbar .btn:hover { background: rgba(255,255,255,.12); }

/* ---- layout ----------------------------------------------------- */
.layout {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1440px; margin: 0 auto; padding: 14px;
}
@media (min-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
  .results { position: sticky; top: 72px; max-height: calc(100vh - 84px); overflow-y: auto; padding-right: 2px; }
}
@media (min-width: 700px) and (max-width: 1079px) {
  /* tablet: two result cards per row */
  .results { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .results > .card { margin-bottom: 0; }
  .results > .result-main, .results > #input-error, .results > #d-report, .results > #c-msgs { grid-column: 1 / -1; }
}
.inputs, .results { min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---- fields ----------------------------------------------------- */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-all { grid-column: 1 / -1; }
@media (max-width: 420px) { .field.span-2 { grid-column: 1 / -1; } }
.field > label { font-size: .8rem; font-weight: 600; margin-bottom: 3px; color: #34414e; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 3px; }
p.hint { margin: 8px 0 0; }

input[type=text], select {
  font: inherit; font-size: 1rem; width: 100%;
  border: 1px solid #b9c2cc; border-radius: 6px; padding: 6px 8px;
  background: #fff; color: var(--ink); min-height: 36px;
}
input[type=text]:focus, select:focus { outline: 2px solid #9cc3ff; border-color: var(--accent); }
input[type=text]:disabled { background: #f0f2f4; color: #8a949e; }
input.invalid { border-color: var(--bad); background: var(--bad-bg); }
input::placeholder { color: #9aa4ae; }
.inp { display: flex; align-items: stretch; }
.inp input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; font-variant-numeric: tabular-nums; }
.inp .u {
  display: flex; align-items: center; padding: 0 8px; font-size: .8rem; color: var(--muted);
  border: 1px solid #b9c2cc; border-left: 0; border-radius: 0 6px 6px 0; background: #f4f6f8; white-space: nowrap;
}
.inp input:only-child { border-radius: 6px; }
.field > label.lbl-check { display: flex; align-items: center; gap: 5px; margin-bottom: 1px; }
.field > label.lbl-check input { width: 16px; height: 16px; margin: 0; }
.checks { margin-top: 10px; }
label.check { display: flex; align-items: center; gap: 6px; font-size: .9rem; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

details.sub > summary { cursor: pointer; font-weight: 600; font-size: .9rem; padding: 2px 0; }
details.sub[open] > summary { margin-bottom: 10px; }
details.sub .fields { margin-top: 4px; }
section.card > details.sub > summary { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
section.card > details.sub:not(:first-child) { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }

/* gas pedal */
.pedal { margin-top: 12px; }
.pedal-head { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; color: #34414e; }
.pedal-head output { font-variant-numeric: tabular-nums; }
.pedal-row { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.pedal-row input[type=range] { flex: 1; accent-color: var(--accent); height: 28px; }

/* ---- combobox --------------------------------------------------- */
.combo { position: relative; display: flex; }
.combo input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.combo-btn {
  border: 1px solid #b9c2cc; border-left: 0; border-radius: 0 6px 6px 0; background: #f4f6f8;
  width: 34px; cursor: pointer; color: var(--muted); font-size: .9rem;
}
.combo-list {
  position: absolute; z-index: 30; top: 100%; left: 0; right: 0; margin: 2px 0 0; padding: 4px 0;
  list-style: none; background: #fff; border: 1px solid #9fb0c2; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15); max-height: 320px; overflow-y: auto;
}
.combo-list li { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.combo-list li .sub { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.combo-list li.active { background: #e3eefb; }
.combo-list li.selected { font-weight: 600; }
.combo-list li.group { cursor: default; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f6f8fa; padding: 4px 10px; }
.combo-list li.empty { cursor: default; color: var(--muted); }

/* ---- results ---------------------------------------------------- */
.banner { border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; font-weight: 600; }
.banner.error { background: var(--bad-bg); color: #9b1c1c; border: 1px solid #f1b3b3; }
.banner.warn { background: var(--warn-bg); color: #7a5300; border: 1px solid #f0d58c; }
.results.stale .card:not(#input-error) { opacity: .55; }

.big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.bignum { border: 2px solid var(--line); border-radius: 8px; padding: 6px 12px; display: flex; flex-direction: column; }
.bignum .lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.bignum .val { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.bignum .unit { font-size: .85rem; color: var(--muted); }
.bignum.maxed { border-color: var(--bad); background: var(--bad-bg); }

table.kv { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.kv td { padding: 4px 4px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
table.kv tr:last-child td { border-bottom: 0; }
table.kv td:first-child { color: #44515e; }
table.kv td.v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
table.kv td.x { color: var(--muted); font-size: .8rem; text-align: right; }

.gauge-row { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 8px; margin: 6px 0; font-size: .9rem; }
.gauge-row .g-lbl { color: #44515e; }
.gauge-row .g-pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge { height: 14px; background: #e7ebef; border-radius: 7px; overflow: hidden; position: relative; }
.gauge-fill { height: 100%; background: var(--ok); border-radius: 7px; transition: width .2s; }
.gauge-row.warn .gauge-fill { background: var(--warn); }
.gauge-row.bad .gauge-fill { background: var(--bad); }
.gauge-row.bad .g-pct { color: var(--bad); }
.gauge-row.na { opacity: .6; }
.gauge-detail { grid-column: 2 / -1; font-size: .78rem; color: var(--muted); margin-top: -4px; }

ul.msgs { list-style: none; margin: 0; padding: 0; }
ul.msgs li { padding: 5px 8px; border-radius: 5px; margin-bottom: 4px; font-size: .92rem; }
ul.msgs li.error { background: var(--bad-bg); color: #9b1c1c; font-weight: 600; }
ul.msgs li.warning { background: var(--warn-bg); color: #6b4a00; }
ul.msgs li.tip { background: #eef5ee; color: #1f4d26; }
ul.msgs li.note { background: #f3f4f6; color: #55606b; font-size: .82rem; }
.th-gw551 { margin: .4rem 0 .6rem; padding: .45rem .6rem; border-left: 3px solid #c9a227; background: #fbf7e9; color: #55606b; font-size: .82rem; }
ul.msgs li.none { color: var(--muted); }
ul.msgs li .tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-right: 6px; opacity: .8; }

#d-report summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
#report { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: .8rem; background: #f6f8fa; padding: 8px; border-radius: 6px; overflow-x: auto; white-space: pre; }

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 4px 0 18px; }

@media (max-width: 699px) {
  .topbar { padding: 6px 10px; gap: 8px; }
  .sum-item { min-width: 70px; padding: 2px 7px; }
  .bignum .val { font-size: 1.6rem; }
  .layout { padding: 10px; }
}
summary .cnt { color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 700; }

/* ---- tabs, tool crib, my machines ----------------------------- */
.tabs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; max-width: 1440px; margin: 0 auto; padding: 10px 14px 0; }
.tab { font: inherit; font-size: .92rem; cursor: pointer; border: 1px solid var(--line); border-bottom: 0; background: #e2e7ec; color: #34414e; border-radius: 8px 8px 0 0; padding: 7px 14px; }
.tab.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 -2px 0 var(--accent) inset; }
.tab-n { color: var(--muted); font-weight: 400; font-size: .8rem; }
.tab-msg { margin-left: auto; font-size: .85rem; color: var(--ok); font-weight: 600; min-height: 1em; }
.tab-msg.err { color: var(--bad); }
.pane { max-width: 1440px; margin: 0 auto; padding: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card-actions select { width: auto; min-width: 180px; }
.btn.small { padding: 3px 9px; font-size: .82rem; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #245a94; }
.btn.danger { color: #9b1c1c; border-color: #f1b3b3; }
.btn.danger:hover { background: var(--bad-bg); }
a.btn { text-decoration: none; display: inline-block; }
.filebtn { position: relative; overflow: hidden; display: inline-block; }
.filebtn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.savebox { border: 1px solid #b7cde6; background: #f3f8fd; border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.crib-loaded { margin: -4px 0 8px; color: var(--accent); }
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.grid th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--line); padding: 5px 6px; white-space: nowrap; }
table.grid td { border-bottom: 1px solid #eef1f4; padding: 5px 6px; vertical-align: middle; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid td.acts { white-space: nowrap; text-align: right; }
table.grid td.acts .btn { padding: 3px 8px; font-size: .8rem; margin-left: 2px; }
table.grid td.notes { color: var(--muted); font-size: .82rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid tbody tr:hover { background: #f5f8fb; }
table.grid tr.current { background: #e3eefb; }
table.curve { max-width: 320px; }
table.curve input { min-height: 30px; padding: 3px 6px; }
.mach-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .mach-layout { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); align-items: start; } }
ul.mlist { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
ul.mlist li { padding: 7px 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; border: 1px solid transparent; }
ul.mlist li:hover { background: #f1f5f9; }
ul.mlist li.selected { background: #e3eefb; border-color: #b7cde6; font-weight: 600; }
ul.mlist li .sub { color: var(--muted); font-size: .78rem; font-weight: 400; white-space: nowrap; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 9px; font-size: .75rem; font-weight: 600; }
.copyfrom { margin-top: 8px; }
.field.check-field { justify-content: flex-end; }
.combo-list li .sub.user, .user-tag { color: var(--accent); font-weight: 600; }
.fields.filters { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

/* ---- thread calculator ------------------------------------------ */
.iso-cls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.th-desig { font-size: 1.35rem; font-weight: 700; margin: 0 0 2px; word-break: break-word; }
#th-notes { margin: 8px 0; }
#th-table td.x { width: 2.5em; }
.th-drills { max-height: 420px; overflow-y: auto; }
table.grid tr.clear td { color: var(--muted); }
ol.recipe { margin: 8px 0 0; padding-left: 1.6em; font-size: .9rem; }
ol.recipe li { margin-bottom: 4px; white-space: pre-wrap; }
details.card > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
#th-report { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: .8rem; background: #f6f8fa; padding: 8px; border-radius: 6px; overflow-x: auto; white-space: pre; }
#th-results.stale .card { opacity: .55; }
@media (min-width: 700px) and (max-width: 1079px) {
  #th-results > #th-error, #th-results > #th-recipe-d, #th-results > #th-report-d, #th-results > #th-drills-c { grid-column: 1 / -1; }
}

/* ---- geometry / tool life / catalogs ------------------------------ */
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; }
.subtabs .btn { padding: 4px 10px; font-size: .85rem; }
.subtabs .btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
table.kv td.given { color: var(--muted); font-size: .75rem; text-align: right; width: 4em; }
table.kv tr.out td.v { color: var(--accent); }
.geo-svg { display: block; margin: 10px auto 0; max-width: 100%; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; }
.blocks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.blocks .blk { border: 2px solid #8aa4bf; background: #eef4fa; border-radius: 4px; padding: 6px 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fields .sep { grid-column: 1 / -1; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
#cat-table td.prod { font-size: .82rem; }

/* Cut Optimizer speedometer buttons (G-Wizard GWizOptimizeBtn) */
.opt-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; flex: 0 0 32px;
  margin-left: 4px; padding: 0; border: 1px solid #b9c2cc; border-radius: 6px; background: #f4f6f8;
  color: var(--accent); cursor: pointer;
}
.opt-btn:hover { background: #e6eef8; border-color: var(--accent); }
.opt-btn:disabled { opacity: .5; cursor: wait; }
.opt-btn.hidden { display: none; }
.pedal-row .opt-btn { height: 28px; }
label.opt-label.opt-on { cursor: pointer; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.opt-msg { margin-top: 8px; font-size: .8rem; padding: 5px 8px; border-radius: 6px; background: #f4f6f8; color: #34414e; }
.opt-msg.ok { background: #eaf6ee; color: #1e5b33; }
.opt-msg.bad { background: var(--bad-bg); color: #9b1c1c; }

/* ---- Notebook (G-Wizard QuickRef > Notebook) ---------------------- */
.nb-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .nb-layout { grid-template-columns: 340px minmax(0, 1fr); } }
.nb-btns { margin-top: 0; gap: 6px; }
.nb-list { list-style: none; margin: 0; padding: 4px 0; border: 1px solid var(--line); border-radius: 6px; max-height: 340px; overflow-y: auto; }
.nb-list:focus { outline: 2px solid #9cc3ff; }
.nb-list li { padding: 6px 10px; cursor: pointer; display: flex; gap: 6px; align-items: baseline; }
.nb-list li:hover { background: #f5f8fb; }
.nb-list li.sel { background: #e3eefb; }
.nb-list li .nb-kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-left: auto; white-space: nowrap; }
.nb-list li.missing .nb-name { color: #9b1c1c; }
.nb-panel { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd; }
.nb-panel h3 { margin: 0 0 8px; font-size: .9rem; }
.nb-panel .field { margin-bottom: 8px; }
.nb-radios { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; font-size: .9rem; }
.nb-import { margin-top: 12px; }
.nb-main .tablewrap { max-height: calc(100vh - 210px); overflow: auto; }
.nb-main table.grid th { position: sticky; top: 0; background: #fff; cursor: pointer; user-select: none; }
.nb-main table.grid th.sorted-asc::after { content: " \25B2"; }
.nb-main table.grid th.sorted-desc::after { content: " \25BC"; }
.nb-text { width: 100%; min-height: 420px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.nb-frame { width: 100%; height: calc(100vh - 260px); min-height: 360px; border: 1px solid var(--line); border-radius: 6px; margin-top: 10px; }
.nb-main #nb-title { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); }
.nb-btns .btn { font-size: .8rem; }

/* ---- drill chart / drill index picker ---------------------------- */
.dr-checks { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; min-height: 34px; }
.dr-wrap { max-height: 62vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.dr-wrap thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
table.grid tr.dr-sel { background: #cfe2fb; font-weight: 600; }
table.grid tr.dr-pick { cursor: pointer; }
.gw551-small { display: block; font-size: .72rem; color: #9a8a4a; font-weight: normal; }
.inp .sizes-btn { margin-left: 6px; white-space: nowrap; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20,30,40,.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; }
.modal-box { background: var(--card); border-radius: var(--radius); padding: 14px; width: min(760px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 6px 30px rgba(0,0,0,.35); }
.modal-box .dr-wrap { max-height: 50vh; }
.fits-grid td.num { vertical-align: top; }
.fits-grid td:first-child { font-weight: 600; white-space: nowrap; }
.fit-um { font-size: 11px; color: #6b7785; }

/* Cut KB */
.kb-edit-top { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.kb-nums { flex: 0 0 auto; min-width: 250px; }
.kb-nums .pct { color: var(--muted); margin-left: 6px; font-size: .85rem; }
.kb-desc { flex: 1 1 220px; font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }
.kb-pre { white-space: pre-line; }
.modal-box.kb-search-box { width: min(1180px, 100%); }
.kb-s-filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.kb-s-filters .field { min-width: 220px; }
.kb-match { flex-basis: 100%; font-size: .85rem; }
.kb-match label.check { display: inline-flex; align-items: center; gap: 4px; margin: 0 12px 4px 0; white-space: nowrap; }
.kb-s-count { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; font-size: .9rem; }
.kb-s-count span { margin-right: auto; }
.kb-wrap { max-height: 52vh; overflow: auto; }
.kb-grid td { white-space: nowrap; }
.kb-grid td.txt { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.kb-grid tr.dr-sel, .kb-grid tr.dr-sel:hover { background: #d4e6fb; }
.kb-grid thead th { position: sticky; top: 0; background: var(--card); }
#kb-comments { font: inherit; width: 100%; border: 1px solid #b9c2cc; border-radius: 6px; padding: 6px 8px; resize: vertical; }

/* thread drawings (threaddraw.js) */
.td-wrap { overflow-x: auto; }
.td-svg { width: 100%; max-width: 760px; height: auto; display: block; background: #fff; }
.td-svg .td-prof { stroke: #22313f; stroke-width: 2; fill: none; stroke-linejoin: miter; }
.td-svg .td-ref { stroke: #6b7783; stroke-width: 1; stroke-dasharray: 6 4; }
.td-svg .td-pd { stroke: #c0392b; stroke-width: 1; stroke-dasharray: 10 3 2 3; }
.td-svg .td-axis { stroke: #6b7783; stroke-width: 1; stroke-dasharray: 14 3 3 3; }
.td-svg .td-dim { stroke: #2a6fb0; stroke-width: 1.1; }
.td-svg .td-ext { stroke: #2a6fb0; stroke-width: .7; }
.td-svg .td-sharp { stroke: #2a6fb0; stroke-width: .9; stroke-dasharray: 3 3; fill: none; }
.td-svg .td-break { stroke: #6b7783; stroke-width: 1.2; fill: none; }
.td-svg text { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; fill: #22313f; }
.td-svg .td-lbl { font-size: 13px; font-weight: 600; }
.td-svg .td-small { font-size: 11.5px; }
.td-svg .td-big { font-size: 16px; font-weight: 700; }
.td-svg .td-pdl { fill: #c0392b; }
.td-svg .td-ang { fill: #2a6fb0; }
.td-svg .td-muted { fill: #6b7783; font-size: 10.5px; }

/* GD&T reference (gdt.js) */
.gdt-table td { vertical-align: middle; }
.gdt-table td.gdt-ctl { font-weight: 600; background: #f3f6f9; max-width: 160px; white-space: normal; }
.gdt-table td.gdt-sym { width: 92px; white-space: nowrap; }
.gdt-table td.gdt-sym a { color: var(--ink); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.gdt-table td.gdt-sym svg { width: 30px; height: 30px; border: 1.5px solid currentColor; border-radius: 2px; padding: 2px; background: #fff; }
.gdt-table td.gdt-sym .gdt-uni { color: var(--muted); font-size: .78rem; }
.gdt-table td.gdt-notes { white-space: pre-line; font-size: .86rem; color: #3b4652; max-width: 420px; }
.gdt-table tr.gdt-panel-start td { border-top: 2px solid var(--line); }
.gdt-table .gdt-calc { margin-left: 8px; font-size: .78rem; }
.gdt-tp { max-width: 760px; }

/* ---- account menu (multi-user mode) ------------------------------ */
.acct { position: relative; }
.acct-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; }
.acct-btn #acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; }
.acct.user .acct-dot { background: #6fdc8c; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 300px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.25); padding: 6px; }
.acct-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: .86rem; }
.acct-head b { display: block; font-size: .95rem; word-break: break-all; }
.acct-head .note { color: var(--muted); margin-top: 4px; font-size: .8rem; }
.acct-item { display: block; width: 100%; text-align: left; font: inherit; font-size: .9rem; background: none; border: 0; border-radius: 6px;
  padding: 7px 10px; cursor: pointer; color: var(--ink); }
.acct-item:hover, .acct-item:focus-visible { background: #e9eef3; outline: none; }
.acct-item.danger { color: #9b1c1c; }
.acct-sep { border-top: 1px solid var(--line); margin: 4px 0; }
.acct-box { width: min(440px, 100%); }
.acct-fields { grid-template-columns: 1fr; }
.acct-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.acct-intro:empty, #acct-foot:empty { display: none; }
.acct-intro { margin: 0 0 10px; }

/* Admin page (multi-user mode, admins only) */
.adm-table th[data-sort] { cursor: pointer; user-select: none; }
.adm-table th.sorted-asc::after { content: " \25B2"; }
.adm-table th.sorted-desc::after { content: " \25BC"; }
.adm-table tr.adm-guest td { color: var(--muted); }
#view-admin .card { margin-bottom: 14px; }
#view-admin .card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#adm-filter { min-width: 200px; }
.adm-cols { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, 1.4fr); gap: 14px; }
@media (max-width: 900px) { .adm-cols { grid-template-columns: 1fr; } }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.adm-warn { color: #7a5300; background: var(--warn-bg); border: 1px solid #f0d58c; border-radius: 6px; padding: 6px 10px; }
.adm-logwrap { max-height: 360px; overflow: auto; }
#adm-log td.nowrap, .adm-table td { white-space: nowrap; }
.tag { display: inline-block; font-size: .72rem; padding: 0 6px; border-radius: 9px; background: #e6ebf0; color: #34414e; margin-left: 2px; vertical-align: 1px; }
.tag.admin { background: #dbe9fb; color: #1d4f91; }
.tag.me { background: #e1f3e6; color: #1d6b35; }
.tag.warn { background: var(--warn-bg); color: #7a5300; }
.adm-temp { display: flex; gap: 6px; }
.adm-temp input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .03em; }
