/* FLX LX Tools — built on the FLX Web App Style Guide starter CSS.
   Blue (#019AFF) is the only accent; everything else is cool grey. */
:root {
  --ink: #23262b;  --ink-2: #4b5260;  --muted: #7b8493;
  --line: #e3e6eb; --line-2: #cfd4dc; --bg: #f1f3f6; --panel: #fff;
  --blue: #019AFF; --blue-d: #0082db; --blue-l: #e6f4ff; --red: #d33b3b;
  --green: #15803d;
  --nav-h: 54px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Frame: charcoal nav on top, scrolling content under it */
.app { display: flex; flex-direction: column; height: 100%; }
.content { flex: 1; overflow: auto; }

.nav { height: var(--nav-h); flex: none; display: flex; align-items: center; gap: 4px; padding: 0 18px; background: var(--ink); color: #fff; }
.nav a { color: #c7ccd4; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.nav a.brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 0; margin-right: 10px; color: #fff; background: none; }
.nav a.brand img { height: 26px; display: block; }
.nav .wm { font-size: 18px; font-weight: 800; letter-spacing: .04em; }
.nav .brand small { color: #c7ccd4; font-weight: 500; font-size: 13px; }
.nav .here { display: none; color: #fff; font-weight: 600; margin-left: 4px; }
@media (max-width: 1020px) { .nav .tool-link { display: none; } .nav .here { display: inline; } }
@media (max-width: 480px) { .nav { padding: 0 12px; } .nav .brand small { display: none; } }

.page { max-width: 1100px; margin: 0 auto; padding: 26px 24px 60px; }
.page.narrow { max-width: 820px; }
@media (max-width: 480px) { .page { padding: 20px 14px 50px; } }
.page-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.page-sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 8px; margin-bottom: 14px; }
.card h4 { margin: 0 0 12px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.card h4 .note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); margin-left: 8px; }
.card p.hint { margin: 0 0 12px; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; align-items: center; }

.btn { border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.btn:hover { background: #f6f7f9; border-color: #b9c0cb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eceff3; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

input, select, textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(1,154,255,.18); }
input[type="checkbox"] { width: auto; }
input[type="color"] { padding: 2px; height: 36px; cursor: pointer; }
input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--blue); -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--line-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--blue-d); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line-2); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--blue-d); }
input::placeholder { color: var(--muted); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; margin-top: 4px; }
label .unit { color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-size: 12.5px; }

.form { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }
.inline { display: flex; gap: 8px; align-items: stretch; }
.inline > input { flex: 1; min-width: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; gap: 0; } }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.grid th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.grid td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid td input, .grid td select { padding: 5px 8px; }
.grid .num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid th.num { text-align: right; }
.table-wrap { overflow-x: auto; margin-bottom: 14px; }
.table-wrap table.grid { margin-bottom: 0; }
@media (max-width: 600px) { .grid th, .grid td { padding: 8px 8px; } .grid .hide-sm { display: none; } }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceff3; color: #4b5260; }
.pill.blue { background: #e6f4ff; color: #0070c0; }
.pill.green { background: #e1f5e8; color: #1a7a3d; }
.pill.amber { background: #fff0d6; color: #a15c00; }
.pill.purple { background: #ece8fb; color: #5b45b8; }
.pill.red { background: #f3e9e9; color: #9a4040; }

code, .mono { font: 12px ui-monospace, Menlo, Consolas, monospace; background: #eef0f3; padding: 1px 6px; border-radius: 5px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.card .stat { background: #fafbfc; }
.stat .cap { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .fig { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .fig.key { color: var(--blue-d); }
.stat .fig.small { font-size: 20px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.warn { border-color: #f1c27a; background: #fff8ea; }
.stat.bad { border-color: #e3b0b0; background: #fbf0f0; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; background: #fff; vertical-align: middle; flex-wrap: nowrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button:hover { background: #f6f7f9; }
.seg button.on { background: var(--ink); color: #fff; }
.seg.blue button.on { background: var(--blue); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type="search"] { width: 200px; }

.empty { border: 2px dashed var(--line-2); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); margin-bottom: 14px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: 1; }

.note-box { background: var(--blue-l); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.note-box.warn { background: #fff0d6; color: #7a4600; }

/* Landing page tool buttons */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tool-btn { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; transition: border-color .12s, background .12s; }
.tool-btn:hover { border-color: var(--blue); background: #f7fbff; }
.tool-btn:active { transform: translateY(1px); }
.tool-btn .ico { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 34px; padding: 0 10px; border-radius: 8px; background: var(--blue-l); color: var(--blue-d); font-weight: 800; font-size: 13px; letter-spacing: .04em; margin-bottom: 12px; }
.tool-btn h3 { margin: 0 0 4px; font-size: 16px; }
.tool-btn p { margin: 0; color: var(--muted); font-size: 13px; }
.foot-note { margin-top: 26px; color: var(--muted); font-size: 12.5px; }

/* Swatchbook */
.pal { display: flex; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 10px; }
.pal button { flex: 1; border: 0; cursor: pointer; position: relative; padding: 0; }
.pal button:hover { flex: 1.25; }
.pal button.sel::after { content: ""; position: absolute; inset: 6px; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.pal-grid .card { margin-bottom: 0; padding-bottom: 14px; }
.pal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pal-head strong { font-size: 14px; }
.pal-head .spacer { flex: 1; }
.pal-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sel-card { display: flex; gap: 18px; align-items: stretch; flex-wrap: wrap; padding-bottom: 14px; }
.sel-swatch { width: 140px; min-height: 120px; border-radius: 12px; border: 1px solid var(--line); flex: none; display: flex; align-items: flex-end; padding: 8px 10px; font: 700 13px ui-monospace, Menlo, Consolas, monospace; }
.sel-body { flex: 1; min-width: 240px; }
.sel-body .stats { margin-top: 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cct { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; background: #fff; cursor: pointer; }
.cct:hover { border-color: var(--blue); }
.cct i { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); display: block; }

/* DIP switch */
.dip-wrap { overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.dip { display: inline-flex; gap: 6px; padding: 10px 14px 8px; background: var(--ink); border-radius: 10px; align-items: flex-end; }
.dip .onlbl { color: #8d95a3; font-size: 11px; font-weight: 700; letter-spacing: .06em; align-self: flex-start; writing-mode: vertical-rl; transform: rotate(180deg); margin-right: 4px; }
.dip .col { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 34px; }
.dip .num { color: #e9ecf1; font-size: 12px; font-weight: 700; }
.dip .wt { color: #8d95a3; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.dip button.tog { width: 26px; height: 48px; border-radius: 5px; border: 1px solid #5b6270; background: #3a3f48; position: relative; cursor: pointer; padding: 0; }
.dip button.tog::after { content: ""; position: absolute; left: 3px; right: 3px; height: 20px; border-radius: 3px; background: #e9ecf1; top: 24px; transition: top .1s; }
.dip button.tog.on { background: var(--blue-d); border-color: var(--blue); }
.dip button.tog.on::after { top: 3px; }
/* Phones: shrink the switches so all of them stay on screen (the wrapper still scrolls as a last resort). */
@media (max-width: 480px) {
  .dip { gap: 3px; padding: 10px 8px 8px; }
  .dip .col { width: 25px; }
  .dip button.tog { width: 20px; }
  .dip .wt { font-size: 9.5px; }
}
@media (max-width: 380px) {
  .dip { gap: 2px; }
  .dip .col { width: 22px; }
  .dip button.tog { width: 18px; }
}
.mini { display: inline-flex; gap: 2px; vertical-align: middle; }
.mini i { width: 9px; height: 15px; border-radius: 2px; background: #dfe3e9; display: block; }
.mini i.on { background: var(--blue); }
.sw-list { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stepper { display: flex; gap: 6px; }
.stepper input { text-align: center; font-weight: 700; font-size: 18px; }
.stepper button { width: 40px; flex: none; }

@media print {
  .nav, .noprint, .toast { display: none !important; }
  html, body, .app { height: auto; background: #fff; }
  .content { overflow: visible; }
  .card, table.grid { border-color: #bbb; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
