/* PCB Flasher — Fleet Console. Light theme, restrained, professional. */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c2430;
  --ink-soft: #5b6675;
  --line: #e3e7ec;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --green: #1f9d55;
  --green-soft: #e6f6ec;
  --red: #d64545;
  --red-soft: #fbeaea;
  --amber: #c98a1b;
  --amber-soft: #fbf2dd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 4px 16px rgba(20, 30, 45, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--bg); font-size: 14px; line-height: 1.5;
}

/* --- top bar --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand .logo { width: 26px; height: 26px; color: var(--accent); fill: none;
  stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand .sub { color: var(--ink-soft); font-weight: 400; }
.conn { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot-off { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* --- layout --- */
.layout {
  display: grid; grid-template-columns: 320px 1fr 320px; gap: 16px;
  padding: 16px; align-items: start;
}
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.panel.grow { min-height: 60vh; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; margin: 0; }
.pill { background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-weight: 600; }

/* --- fleet list --- */
.fleet { display: flex; flex-direction: column; gap: 8px; }
.station {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; transition: border-color .12s, background .12s; background: #fff;
}
.station:hover { border-color: #cdd6e2; background: #fafbfc; }
.station.selected { border-color: var(--accent); background: var(--accent-soft); }
.station-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.station-name { font-weight: 600; }
.station-id { color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.station-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px; }
.badge-online { background: var(--green-soft); color: var(--green); }
.badge-offline { background: var(--red-soft); color: var(--red); }
.badge-available { background: var(--accent-soft); color: var(--accent); }
.badge-armed { background: var(--amber-soft); color: var(--amber); }
.badge-family { background: #eef1f5; color: var(--ink-soft); }
.status-led { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.led-green { background: var(--green); }
.led-red { background: var(--red); }
.led-grey { background: #c2cad6; }

/* --- detail --- */
.detail { display: flex; flex-direction: column; gap: 16px; }
.empty { color: var(--ink-soft); text-align: center; padding: 48px 16px; }
.empty-icon { width: 44px; height: 44px; color: #c2cad6; fill: none;
  stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; margin-bottom: 8px; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv .cell { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kv .cell .label { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.kv .cell .val { font-weight: 600; margin-top: 2px; }

.assign-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign-row input, .assign-row select { padding: 6px 8px; }

table.records { width: 100%; border-collapse: collapse; font-size: 13px; }
table.records th, table.records td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.records th { color: var(--ink-soft); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.verdict { font-weight: 600; padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.verdict-ok { background: var(--green-soft); color: var(--green); }
.verdict-recovered { background: var(--amber-soft); color: var(--amber); }
.verdict-hardware_suspected, .verdict-flag, .verdict-recoverable { background: var(--red-soft); color: var(--red); }

/* --- firmware --- */
.fw-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field select, .arm-form input, .arm-form select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px;
  font-family: inherit; font-size: 13px; background: #fff;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fw-list { display: flex; flex-direction: column; gap: 6px; }
.fw-item { display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; font-size: 13px; }
.fw-item .fw-name { font-weight: 600; }
.fw-item .fw-sub { color: var(--ink-soft); font-size: 12px; }

/* --- buttons --- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 12px; border-radius: 7px; font-family: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s; }
.btn:hover { background: #f3f5f8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4fd8; }
.row { display: flex; gap: 8px; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }

/* --- collapsible help reminder --- */
.help { margin: 12px 0; border: 1px solid var(--line); border-radius: 8px;
  background: #fafbfc; overflow: hidden; }
.help summary { cursor: pointer; padding: 10px 12px; font-weight: 600;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
  list-style: none; color: var(--ink); }
.help summary::-webkit-details-marker { display: none; }
.help summary:hover { background: #f3f5f8; }
.help[open] summary { border-bottom: 1px solid var(--line); }
.help-icon { width: 16px; height: 16px; color: var(--accent); fill: none;
  stroke: currentColor; stroke-width: 1.6; stroke-linecap: round;
  stroke-linejoin: round; flex-shrink: 0; }
.help-body { padding: 12px; font-size: 13px; color: var(--ink); }
.help-body p { margin: 0 0 8px; }
.help-body ul { margin: 0 0 10px; padding-left: 18px; }
.help-body li { margin-bottom: 5px; }
.help-body code { background: #eef1f5; padding: 1px 5px; border-radius: 4px;
  font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.help-body pre { background: #1c2430; color: #e7ecf3; padding: 10px 12px;
  border-radius: 7px; font-size: 11.5px; line-height: 1.5; overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; margin: 0 0 10px; }
.help-body pre code { background: none; padding: 0; color: inherit; }

/* --- board types (boot profiles) --- */
.bt-block { margin-bottom: 16px; }
.bt-head { display: flex; align-items: center; justify-content: space-between; }
.bt-head h3 { font-size: 14px; margin: 0; }
.bt-intro { font-size: 12px; margin: 6px 0 10px; }
.bt-list { display: flex; flex-direction: column; gap: 6px; }
.bt-item { display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
.bt-item .bt-name { font-weight: 600; font-size: 13px; }
.bt-item .bt-sub { color: var(--ink-soft); font-size: 12px; }
.bt-item .bt-actions { display: flex; gap: 6px; }
.bt-item .btn { padding: 4px 9px; font-size: 12px; }
.bt-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px;
  padding: 10px; background: var(--accent-soft); border-radius: 7px;
  font-size: 12px; color: var(--ink); }
.bt-note .help-icon { color: var(--accent); margin-top: 1px; }
.adv-import { margin: 4px 0 14px; }
.adv-import > summary { cursor: pointer; font-size: 12px; color: var(--ink-soft);
  padding: 4px 0; list-style: none; }
.adv-import > summary::-webkit-details-marker { display: none; }
.adv-import[open] > summary { margin-bottom: 8px; }
.arm-form input[type="file"] { padding: 5px; font-size: 12px; }

/* --- dialog --- */
dialog { border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; width: min(420px, 92vw); }
dialog::backdrop { background: rgba(20, 30, 45, .35); }
.arm-form { display: flex; flex-direction: column; gap: 10px; }
.arm-form h3 { margin: 0; }
.arm-form label { font-size: 12px; color: var(--ink-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: 1; }
