:root {
  --shell: #354a5f; --brand: #0a6ed1; --brand-dark: #085caf; --bg: #edf1f5; --card: #fff;
  --text: #32363a; --muted: #6a6d70; --line: #d9dde1; --field: #89919a;
  --error: #bb0000; --error-bg: #ffebeb; --ok: #107e3e; --warn: #e9730c;
  --radius: 6px; --shadow: 0 1px 2px rgba(31, 53, 78, .08), 0 4px 14px rgba(31, 53, 78, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
  font: 14px/1.4 "72", "Segoe UI", -apple-system, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
#shell { display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 12px; background: var(--shell); color: #fff; flex: none; }
#shell h1 { margin: 0 0 0 10px; font-size: 16px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius); background: none; color: #fff; cursor: pointer; }
.shell-btn:hover { background: rgba(255, 255, 255, .14); }
.shell-btn svg { width: 18px; height: 18px; }
.logo { margin-left: 6px; padding: 3px 9px; border-radius: 4px; background: linear-gradient(135deg, #1b90ff, #0a6ed1); font-weight: 700; letter-spacing: .5px; }
.spacer { flex: 1; }
.user { padding: 4px 12px; border-radius: 99px; background: rgba(255, 255, 255, .14); font-size: 12px; font-variant-numeric: tabular-nums; }
#app { flex: 1; min-height: 0; overflow: auto; }

/* ---------- status bar ---------- */
#status { flex: none; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 14px; background: #3f5161; color: #fff; font-size: 13px; }
#status .badge { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; flex: none; }
#status .badge svg { width: 13px; height: 13px; stroke-width: 2.4; }
#status.S .badge { background: #abe2ab; color: #0f5a2c; }
#status.E .badge { background: #ffb3b3; color: #8a0000; }
#status.W .badge { background: #ffd9a8; color: #8a4500; }
#status.I .badge { background: #cfe3f8; color: #0a4c8f; }
#status.flash { animation: flash .5s ease-out; }
@keyframes flash { from { background: #5b7791; } }

/* ---------- launchpad ---------- */
.pad { max-width: 1120px; margin: 0 auto; padding: 28px 24px 40px; }
.pad h2 { margin: 0 0 4px; font-size: 22px; font-weight: 400; }
.pad .sub { margin: 0 0 22px; color: var(--muted); }
.pad h3 { margin: 26px 0 12px; font-size: 15px; font-weight: 600; color: #475e75; }
.tiles { display: flex; flex-wrap: wrap; gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; width: 184px; height: 176px; padding: 16px; text-align: left;
  border: 1px solid transparent; border-radius: 10px; background: var(--card); box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 6px 22px rgba(10, 110, 209, .16); }
.tile:active { transform: scale(.98); }
.tile b { font-size: 15px; font-weight: 600; line-height: 1.3; }
.tile small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.tile .foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; color: var(--brand); }
.tile .foot svg { width: 30px; height: 30px; stroke-width: 1.3; }
.tile .num { font-size: 30px; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.tile .num span { margin-left: 4px; font-size: 12px; color: var(--muted); }

/* ---------- toolbar ---------- */
.toolbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.toolbar .sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line); }
.tb { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--brand-dark); cursor: pointer; white-space: nowrap; }
.tb:hover:not(:disabled) { background: #ebf5fe; border-color: #b7d4f1; }
.tb:disabled { color: #a9b0b7; cursor: default; }
.tb.on { background: #e1eefb; border-color: var(--brand); font-weight: 600; }
.tb.primary { background: var(--brand); color: #fff; }
.tb.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.tb.primary:disabled { background: #b9c6d3; color: #fff; }

/* ---------- workspace ---------- */
.work { display: flex; align-items: flex-start; gap: 16px; padding: 16px; }
.locator { position: sticky; top: 58px; flex: none; width: 276px; padding: 12px 14px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.locator h4 { margin: 0 0 10px; font-size: 14px; color: var(--brand-dark); border-bottom: 2px solid var(--brand); display: inline-block; padding-bottom: 4px; }
.locator .row .lbl { width: 96px; font-size: 13px; }
.locator .ctl input[type=text], .locator .ctl select { min-width: 0; }
.hits { margin: 10px -6px 0; padding: 0; list-style: none; max-height: 46vh; overflow: auto; }
.hits li { display: flex; gap: 8px; padding: 6px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.hits li:hover { background: #ebf5fe; }
.hits .no { color: var(--brand-dark); font-variant-numeric: tabular-nums; font-weight: 600; }
.hits .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane { flex: 1; min-width: 0; }
.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 46px; height: 46px; stroke-width: 1.1; color: #9fb3c8; }
.empty p { margin: 12px 0 18px; }
.empty .tb { margin: 0 3px; border-color: #b7d4f1; }

.card { margin-bottom: 14px; padding: 12px 18px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.card > h4 { display: flex; align-items: center; margin: 0 -18px 10px; padding: 0 18px 8px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.card > h5 { margin: 4px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card h4 .tb { margin-left: auto; height: 26px; }
.head { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; background: #f5f9fd; border: 1px solid #dbe7f3; box-shadow: none; }
.head .row .lbl { width: 150px; }
.bpname { color: var(--muted); }

.tabs { display: flex; gap: 22px; margin: 0 0 12px; padding: 0 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 8px 2px 7px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--text); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--brand-dark); }
.tabs button.on { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tabs button.bad::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--error); vertical-align: middle; }

/* ---------- form ---------- */
.row { display: flex; align-items: center; min-height: 32px; gap: 8px; }
.lbl { flex: none; width: 190px; text-align: right; color: #51555a; white-space: nowrap; }
.lbl.inline { width: auto; margin-left: 28px; }
.lbl.req::before { content: "* "; color: var(--error); font-weight: 700; }
.cells { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.ctl { display: inline-flex; align-items: center; gap: 0; }
.ctl input[type=text], .ctl input[type=date], .ctl select {
  height: 26px; padding: 0 6px; border: 1px solid var(--field); border-radius: 3px; background: #fff; max-width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.ctl select { min-width: 200px; padding-right: 2px; }
.ctl input.wide { width: 320px; }
.ctl input[type=date] { width: 150px; }
.ctl input:hover:not(:disabled), .ctl select:hover:not(:disabled) { border-color: var(--brand); }
.ctl input:focus, .ctl select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(10, 110, 209, .28); }
.ctl input:disabled, .ctl select:disabled { background: #f2f4f6; border-color: #cfd4d9; color: #51555a; opacity: 1; }
.ctl .err, .ctl input.err { border-color: var(--error); background: var(--error-bg); box-shadow: inset 0 0 0 1px var(--error); }
.ctl.f4 input { border-radius: 3px 0 0 3px; }
.f4btn { display: grid; place-items: center; width: 26px; height: 26px; margin-left: -1px; border: 1px solid var(--field); border-radius: 0 3px 3px 0; background: #f7f9fb; color: var(--brand-dark); cursor: pointer; }
.f4btn:hover:not(:disabled) { background: #e1eefb; border-color: var(--brand); }
.f4btn:disabled { color: #a9b0b7; border-color: #cfd4d9; cursor: default; }
.f4btn svg { width: 13px; height: 13px; }
.desc { margin-left: 10px; color: var(--muted); white-space: nowrap; }
.suffix { margin-left: 5px; color: var(--muted); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th { padding: 7px 10px; text-align: left; font-weight: 600; color: #51555a; background: #f3f5f7; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 6px 10px; border-bottom: 1px solid #eceff2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid.pick tbody tr { cursor: pointer; }
.grid.pick tbody tr:hover { background: #ebf5fe; }
.grid.pick tbody tr.sel { background: #d8e9fa; }
.grid td .ctl input { height: 24px; }
.grid .num, .ctl input.num { text-align: right; }
.grid.items td { padding: 3px 10px; }
.grid.items td:first-child, .grid.items th:first-child { width: 34px; }
.card h4 .acts { display: flex; gap: 2px; margin-left: auto; }
.card h4 .acts .tb { margin-left: 0; }
.head.one { display: block; }
dialog .body h5 { margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.count { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }

/* ---------- dialogs ---------- */
dialog { width: min(92vw, var(--w, 480px)); max-height: 86vh; padding: 0; border: 0; border-radius: 8px; box-shadow: 0 12px 48px rgba(20, 35, 50, .32); color: var(--text); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
dialog::backdrop { background: rgba(28, 40, 54, .42); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog > header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; color: #51555a; }
dialog > header .x { margin-left: auto; border: 0; background: none; color: var(--brand-dark); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
dialog > header .x:hover { background: #ebf5fe; }
dialog > .body { padding: 16px 18px; overflow: auto; }
dialog > .body p { margin: 0 0 12px; white-space: pre-line; }
dialog > .body .row .lbl { width: 150px; }
dialog > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; background: #3f5161; }
dialog > footer .tb { border-color: rgba(255, 255, 255, .5); color: #fff; min-width: 76px; justify-content: center; }
dialog > footer .tb:hover:not(:disabled) { background: rgba(255, 255, 255, .16); border-color: #fff; }
dialog > footer .tb.primary { background: #fff; color: var(--brand-dark); border-color: #fff; font-weight: 600; }
dialog > footer .tb.primary:hover:not(:disabled) { background: #e1eefb; }
.filter { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.filter input { flex: 1; max-width: 260px; height: 28px; padding: 0 8px; border: 1px solid var(--field); border-radius: 3px; }
.filter input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(10, 110, 209, .28); }
.scroll { max-height: 48vh; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
.scroll th { position: sticky; top: 0; }

@media (max-width: 900px) {
  .work { flex-direction: column; }
  .locator { position: static; width: 100%; }
  .head { grid-template-columns: 1fr; }
  .lbl { width: 150px; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
