:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #14213d;
  background: #f4f7fb;
  --navy: #071b47;
  --blue: #087cf0;
  --cyan: #16d4e8;
  --green: #2ee58f;
  --muted: #66758f;
  --line: #dce5f2;
  --danger: #d8334a;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
.topbar {
  min-height: 68px; padding: 0 28px; display: flex; align-items: center;
  justify-content: space-between; color: white;
  background: linear-gradient(105deg, var(--navy), #09377e);
}
.topbar > div, .top-actions { display: flex; align-items: center; gap: 12px; }
.mini-mark, .brand-mark {
  font-weight: 900; color: white; background: linear-gradient(135deg, var(--blue), var(--green));
  border-radius: 14px; box-shadow: 0 8px 24px #02a4cc55;
}
.mini-mark { padding: 8px 10px; font-size: 18px; }
.brand-mark { width: 84px; height: 84px; display: grid; place-items: center; margin: auto; font-size: 34px; }
.ghost { color: white; background: transparent; border: 1px solid #ffffff55; padding: 7px 12px; border-radius: 8px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 24px; background: white; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 10px 14px; border-radius: 9px; color: var(--muted); white-space: nowrap; }
.tabs button.active { background: #e8f3ff; color: #0068d9; font-weight: 700; }
main { padding: 24px; max-width: 1500px; margin: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 14px; }
.card, .panel {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 6px 18px #102a5410;
}
.card { padding: 18px; }
.card small { color: var(--muted); }
.card strong { display: block; margin-top: 8px; font-size: 28px; }
.monitor-hero { overflow: visible; }
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(135px,1fr));
  gap: 10px; margin-top: 16px;
}
.kpi-card {
  min-width: 0; padding: 14px; border: 1px solid var(--line);
  border-radius: 11px; background: linear-gradient(145deg,#f9fcff,#eef6ff);
}
.kpi-card span { display: block; color: var(--muted); font-size: 12px; }
.kpi-card strong { display: block; margin-top: 7px; color: var(--navy); font-size: 24px; }
.two-column { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.system-tools { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 12px; }
.tool-card {
  display: flex; min-height: 105px; flex-direction: column; gap: 8px;
  align-items: flex-start; padding: 16px; border: 1px solid var(--line);
  border-radius: 12px; color: #213552; background: #f9fcff; cursor: pointer;
  text-align: left;
}
.tool-card:hover { border-color: #77baff; background: #eef7ff; }
.tool-card strong { color: #0068d9; font-size: 15px; }
.tool-card span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal-dialog {
  width: min(1180px,calc(100vw - 36px)); max-height: calc(100vh - 36px);
  padding: 20px; border: 1px solid var(--line); border-radius: 16px;
  color: #14213d; background: white; box-shadow: 0 28px 90px #06163866;
}
.modal-dialog::backdrop { background: #06163880; backdrop-filter: blur(2px); }
.modal-dialog h2 { margin: 0; font-size: 17px; }
.modal-dialog .table-wrap { max-height: 52vh; margin-top: 14px; }
.panel { margin-top: 18px; padding: 18px; overflow-x: auto; }
.panel h2 { font-size: 17px; margin: 0 0 14px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; color: #2d3e59; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 10px; align-items: end; }
.form-grid > * { min-width: 0; }
.form-grid label, .filter-grid label, .compact-form label, .datetime-pair label { color: var(--muted); font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea,
.filter-grid input, .filter-grid select, .compact-form input, .datetime-pair input {
  width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: white;
}
.form-grid button, .form-actions button, .compact-form button, .action {
  border: 0; padding: 9px 13px; border-radius: 8px; background: var(--blue);
  color: white; cursor: pointer;
}
.action.secondary { background: #e8f3ff; color: #0068d9; }
.action.danger { background: #fff0f2; color: var(--danger); }
.form-section { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.datetime-pair { display: grid; grid-template-columns: minmax(240px,1fr) minmax(240px,1fr); gap: 12px; max-width: 860px; }
.section-note { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.datetime-24-field { min-width: 0; }
.datetime-24-label { display: block; color: var(--muted); font-size: 13px; }
.datetime-24-control {
  display: grid; grid-template-columns: minmax(150px,1fr) 88px 8px 88px;
  gap: 7px; align-items: center; margin-top: 5px;
}
.datetime-24-control input, .datetime-24-control select {
  width: 100%; min-width: 0; margin: 0; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: white;
}
.datetime-separator { color: var(--muted); text-align: center; font-weight: 700; }
.filter-grid {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr));
  gap: 10px; align-items: end; margin-top: 14px;
}
.filter-grid .wide-field { grid-column: span 2; }
.compact-form { display: flex; align-items: end; gap: 10px; max-width: 620px; }
.compact-form label { flex: 1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.choice-field {
  position: relative; min-width: 0; margin: 12px 0 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: white;
}
.choice-field legend { padding: 0 5px; color: var(--muted); font-size: 13px; }
.choice-toolbar { position: absolute; top: -28px; right: 4px; display: flex; gap: 8px; }
.text-button {
  padding: 2px 4px; border: 0; background: transparent; color: #0068d9;
  font-size: 12px; cursor: pointer;
}
.choice-list { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-chip { position: relative; cursor: pointer; }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip span {
  display: block; padding: 6px 11px; border: 1px solid var(--line);
  border-radius: 999px; color: #40516c; background: white; font-size: 13px;
}
.choice-chip input:checked + span { border-color: #77baff; background: #e8f3ff; color: #0068d9; font-weight: 700; }
.choice-chip input:focus-visible + span { outline: 2px solid #72b5ff; outline-offset: 2px; }
.filter-choice-grid { display: grid; grid-template-columns: minmax(230px,.7fr) minmax(380px,1.3fr); gap: 12px; }
.device-selector { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfe; }
.selector-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.selector-heading span { color: #0068d9; font-size: 13px; font-weight: 700; }
.selector-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.selector-toolbar label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.selector-toolbar input[type="number"] {
  width: 76px; padding: 8px 9px; border: 1px solid var(--line);
  border-radius: 8px; background: white;
}
.selector-toolbar input[type="search"] {
  min-width: 190px; flex: 1; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: white;
}
.group-shortcuts { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 13px; }
.group-button {
  padding: 6px 9px; border: 1px solid #b8cce6; border-radius: 8px;
  background: white; color: #315274; cursor: pointer;
}
.group-button.active { border-color: #58a6f6; background: #e8f3ff; color: #0068d9; }
.device-check-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(170px,1fr)); gap: 8px; margin-top: 10px; max-height: 240px; overflow-y: auto; }
.device-check { display: flex; gap: 9px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.device-check:has(input:checked) { border-color: #77baff; background: #eef7ff; }
.device-check input { width: 16px; height: 16px; accent-color: var(--blue); }
.device-check span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.device-check strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.device-check small, .cell-note { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 3px; }
.group-card-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(360px,1fr)); gap: 14px; }
.group-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.group-card-title { display: flex; align-items: center; gap: 10px; }
.group-card-title input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.group-card-title span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.readiness-grid {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 10px;
  margin-top: 14px;
}
.readiness-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  color: #40516c; background: #f9fcff; cursor: pointer; text-align: left;
}
.readiness-card:hover { border-color: #77baff; background: #eef7ff; }
.readiness-card strong { color: var(--navy); font-size: 22px; }
.owner-tree { display: grid; gap: 12px; }
.owner-card { border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; overflow: hidden; }
.owner-card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; border-bottom: 1px solid var(--line); background: #f3f8ff;
}
.owner-card-title div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.owner-card-title small, .owner-card-title span { color: var(--muted); font-size: 12px; }
.device-tree { display: grid; gap: 8px; padding: 10px; }
.device-node { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.device-node-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.device-node-main > div:first-child { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.device-node-main small { color: var(--muted); font-size: 11px; }
.slot-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.slot-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px;
  border: 1px dashed #c8d5e6; border-radius: 8px; color: var(--muted); font-size: 12px;
}
.slot-chip.configured { border-style: solid; border-color: #9edbc0; color: #087c47; background: #effaf5; }
.slot-row.observed .slot-chip.configured { border-color: #93bff0; color: #075ca8; background: #eef7ff; }
.sim-compare { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 10px; }
.sim-compare > div { min-width: 0; padding: 9px; border-radius: 9px; background: #f8fbff; }
.sim-compare small { color: var(--muted); font-size: 11px; }
.drift-warning { margin-top: 9px; padding: 8px 10px; border-radius: 8px; color: #a64a00; background: #fff4df; font-size: 12px; }
.claim-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(340px,1fr)); gap: 12px; margin-top: 14px; }
.claim-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.claim-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.claim-card-title > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.claim-card-title small { color: var(--muted); font-size: 11px; }
.claim-card-title > span { white-space: nowrap; font-size: 13px; font-weight: 700; }
.claim-match-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.claim-match-grid > div { min-width: 0; padding: 9px; border-radius: 9px; background: white; }
.claim-match-grid small { color: var(--muted); font-size: 11px; }
.claim-warning { display: inline-block; margin-top: 10px; padding: 5px 8px; border-radius: 7px; color: #a64a00; background: #fff0d6; font-size: 12px; font-weight: 700; }
.claim-reasons { display: block; margin-top: 8px; overflow-wrap: anywhere; color: var(--muted); line-height: 1.55; }
.claim-actions { margin-top: 12px; }
.binding-placeholder { display: grid; min-height: 160px; place-items: center; margin-top: 14px; border: 1px dashed var(--line); border-radius: 12px; background: #f8fbff; }
.binding-dialog { width: min(760px,calc(100% - 28px)); }
.device-scope-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(310px,1fr)); gap: 8px; }
.device-scope-row {
  display: grid; grid-template-columns: auto minmax(0,1fr) 150px; gap: 9px;
  align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 9px;
}
.device-scope-row > input { width: 17px; height: 17px; accent-color: var(--blue); }
.device-scope-row span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.device-scope-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.device-scope-row small { color: var(--muted); font-size: 11px; }
.device-scope-row select { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.compact-grid { max-height: 220px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.qr-result { display: flex; gap: 18px; align-items: center; margin-top: 14px; padding: 14px; background: #f7fbff; border-radius: 12px; }
.qr-result img { width: 210px; height: 210px; background: white; }
.notice { margin: 12px 0; padding: 10px 12px; border-radius: 8px; background: #eaf8f2; color: #087c47; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table-wrap { width: 100%; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 10px 8px; font-size: 13px; }
th { color: var(--muted); font-weight: 600; background: #f9fbfe; position: sticky; top: 0; }
.table-control {
  width: 100%; min-width: 115px; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: 7px; background: white;
}
.table-control:disabled { color: #8d98aa; background: #f1f4f8; }
.table-number { min-width: 68px; max-width: 80px; }
.status-ok { color: #087c47; }
.status-bad { color: var(--danger); font-weight: 700; }
.status-wait { color: #946200; font-weight: 700; }
.status-bad small, .status-wait small { display: block; margin-top: 4px; font-weight: 400; }
.device-progress { margin-top: 5px; color: var(--muted); line-height: 1.55; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title h2, .panel-title .hint { margin: 0; }
.panel-title .hint { margin-top: 5px; }
.refresh-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; cursor: pointer; }
.inline-toggle input { width: 16px; height: 16px; accent-color: var(--blue); }
.action.download { display: inline-block; text-decoration: none; white-space: nowrap; }
button:disabled { opacity: .55; cursor: not-allowed; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pagination > div { display: flex; gap: 8px; }
.bars { display: flex; gap: 4px; align-items: end; height: 160px; padding-top: 12px; }
.bar { flex: 1; min-width: 8px; background: linear-gradient(180deg,var(--cyan),var(--blue)); border-radius: 5px 5px 0 0; position: relative; }
.bar span { position: absolute; bottom: -20px; font-size: 10px; color: var(--muted); left: 50%; transform: translateX(-50%); }
.login-page { display: grid; place-items: center; background: radial-gradient(circle at top,#164493,#061638 70%); }
.login-card { width: min(420px,calc(100% - 32px)); background: white; padding: 34px; border-radius: 20px; text-align: center; box-shadow: 0 24px 70px #0008; }
.login-card h1 { margin-bottom: 4px; }
.login-card p { color: var(--muted); }
.login-card label { display: block; text-align: left; margin: 16px 0; color: var(--muted); }
.login-card input { display: block; width: 100%; margin-top: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.login-card button { width: 100%; padding: 12px; border: 0; border-radius: 9px; background: var(--blue); color: white; font-weight: 700; }
.error { background: #fff0f2; color: var(--danger); padding: 10px; border-radius: 8px; }
.empty, .loading { text-align: center; padding: 60px; color: var(--muted); }
.empty.compact { padding: 20px; }
.download-page {
  display: grid; place-items: center; padding: 28px;
  background:
    radial-gradient(circle at 18% 5%, #1162c755, transparent 34%),
    linear-gradient(145deg, #041127, #08285b 62%, #0a4180);
}
.download-shell { width: min(920px,100%); padding: 0; }
.download-card {
  padding: 36px; border: 1px solid #ffffff33; border-radius: 24px;
  background: #ffffff; box-shadow: 0 28px 90px #0008;
}
.download-brand { display: flex; align-items: center; gap: 18px; }
.download-brand img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 10px 28px #0b73c244; }
.download-brand span { color: var(--blue); font-size: 13px; font-weight: 700; }
.download-brand h1 { margin: 5px 0 0; font-size: clamp(25px,4vw,36px); color: var(--navy); }
.download-content {
  display: grid; grid-template-columns: minmax(0,1fr) 230px;
  gap: 38px; align-items: center; margin-top: 30px;
}
.download-lead { margin: 0 0 20px; color: #44546d; font-size: 17px; line-height: 1.7; }
.download-primary {
  display: inline-flex; justify-content: center; align-items: center;
  min-width: 250px; min-height: 54px; padding: 14px 24px;
  border-radius: 13px; color: white; background: linear-gradient(135deg,#087cf0,#09a9cc);
  box-shadow: 0 12px 30px #087cf055; text-decoration: none; font-size: 18px; font-weight: 800;
}
.download-primary:hover { transform: translateY(-1px); box-shadow: 0 15px 34px #087cf066; }
.download-meta { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.download-steps { margin: 24px 0 0; padding-left: 22px; color: #40516c; line-height: 1.9; }
.download-qr {
  display: flex; flex-direction: column; align-items: center; padding: 16px;
  border: 1px solid var(--line); border-radius: 18px; background: #f7fbff; text-align: center;
}
.download-qr img { width: 190px; height: 190px; border-radius: 8px; background: white; }
.download-qr strong { margin-top: 10px; color: var(--navy); }
.download-qr span { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.download-unavailable { margin-top: 28px; padding: 28px; border-radius: 14px; background: #fff4f5; color: var(--danger); }
.download-unavailable h2 { margin: 0 0 8px; }
.download-unavailable p { margin: 0; }
.download-footer { margin: 15px 0 0; color: #d6e8ff; text-align: center; font-size: 12px; }
[hidden] { display: none !important; }
@media (max-width: 700px) {
  main { padding: 14px; }
  .topbar { padding: 0 14px; }
  .panel { padding: 14px; }
  .datetime-pair, .filter-choice-grid { grid-template-columns: 1fr; }
  .datetime-24-control { grid-template-columns: minmax(130px,1fr) 76px 8px 76px; }
  .filter-grid .wide-field { grid-column: span 1; }
  .compact-form { align-items: stretch; flex-direction: column; }
  .compact-form button { width: 100%; }
  .selector-toolbar .action { flex: 1 1 auto; }
  .selector-toolbar input[type="search"] { flex-basis: 100%; }
  .group-card-grid { grid-template-columns: 1fr; }
  .readiness-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .device-scope-grid { grid-template-columns: 1fr; }
  .device-scope-row { grid-template-columns: auto minmax(0,1fr); }
  .device-scope-row select { grid-column: 2; width: 100%; }
  .device-node-main { flex-direction: column; }
  .sim-compare, .claim-match-grid { grid-template-columns: 1fr; }
  .claim-grid { grid-template-columns: 1fr; }
  .qr-result { align-items: flex-start; flex-direction: column; }
  .qr-result img { align-self: center; width: min(210px,100%); height: auto; }
  .two-column { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .panel-title { align-items: flex-start; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination > div, .pagination button { flex: 1; }
  .download-page { padding: 14px; }
  .download-shell { padding: 0; }
  .download-card { padding: 24px 18px; border-radius: 19px; }
  .download-brand { gap: 13px; }
  .download-brand img { width: 58px; height: 58px; border-radius: 16px; }
  .download-brand h1 { font-size: 24px; }
  .download-content { grid-template-columns: 1fr; gap: 25px; margin-top: 24px; }
  .download-primary { display: flex; width: 100%; min-width: 0; }
  .download-qr { width: min(250px,100%); margin: auto; }
}
@media (max-width: 390px) {
  main { padding: 10px; }
  .panel { padding: 12px; }
  .readiness-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .readiness-card { padding: 9px; }
  .owner-card-title { align-items: flex-start; }
  .slot-chip { width: 100%; justify-content: space-between; }
  .claim-grid { gap: 8px; }
  .claim-card { padding: 11px; }
  .claim-card-title { flex-direction: column; }
  .claim-actions .action { flex: 1 1 100%; }
}
