:root{
  --bg:#f3f5f7;
  --surface:#ffffff;
  --surface-muted:#f7f9fa;
  --surface-dark:#172c3d;
  --line:#dce4ea;
  --line-strong:#c5d0d9;
  --text:#17232d;
  --muted:#6e7d89;
  --muted-dark:#a9bac6;
  --accent:#167b86;
  --accent-strong:#0f626c;
  --blue:#2e6fc5;
  --warning:#b46f16;
  --danger:#b34f52;
  --success:#287858;
  --shadow:0 8px 24px rgba(25,43,58,.06);
  --shadow-soft:0 3px 12px rgba(25,43,58,.06);
  --radius:10px;
  --sidebar-width:248px;
}

*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0;
  color:var(--text);
  background:var(--bg);
  font-family:"Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

body.nav-open,
body.modal-open{overflow:hidden}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.icon{
  width:16px;
  height:16px;
  flex:0 0 auto;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.app-backdrop{
  position:fixed;
  inset:0;
  background:rgba(16,31,43,.48);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
  z-index:24;
}
body.nav-open .app-backdrop{
  opacity:1;
  pointer-events:auto;
}

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:var(--sidebar-width) minmax(0,1fr);
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
  padding:26px 18px 18px;
  color:#f3f7f9;
  background:var(--surface-dark);
  border-right:1px solid rgba(255,255,255,.07);
  display:flex;
  flex-direction:column;
  gap:20px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 8px;
}
.brand-mark{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.18);
  border-radius:8px;
  background:#2b9097;
  color:#fff;
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
}
.brand-mark.large{
  width:56px;
  height:56px;
  border-radius:10px;
  font-size:15px;
}
.brand-name{
  font-size:17px;
  font-weight:800;
  letter-spacing:.01em;
}
.brand-sub{
  margin-top:2px;
  color:var(--muted-dark);
  font-size:12px;
}
.sidebar-kicker{
  padding:8px 10px 0;
  color:#7f98a8;
  font-size:11px;
  font-weight:700;
  letter-spacing:.12em;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.nav-item{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:44px;
  padding:0 10px;
  border:1px solid transparent;
  border-radius:8px;
  color:#c4d1d9;
  transition:background .18s ease,border-color .18s ease,color .18s ease;
}
.nav-item .icon{
  width:18px;
  height:18px;
  color:#7592a2;
}
.nav-item:hover{
  color:#fff;
  background:rgba(255,255,255,.07);
}
.nav-item.is-active{
  color:#fff;
  background:#245064;
  border-color:#2e6c7d;
}
.nav-item.is-active .icon{color:#9fe0df}

.sidebar-footer{
  margin-top:auto;
  padding:16px 8px 0;
  border-top:1px solid rgba(255,255,255,.12);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  color:#c4d1d9;
  font-size:13px;
}
.sidebar-footer strong,
.sidebar-footer small{display:block}
.sidebar-footer strong{
  color:#f3f7f9;
  font-size:13px;
}
.sidebar-footer small{
  margin-top:3px;
  color:#8099a8;
  font-size:11px;
}
.sidebar-footer a{
  display:inline-flex;
  align-items:center;
  gap:5px;
  color:#a8c8cf;
  font-size:12px;
}
.sidebar-footer a:hover{color:#fff}

.main{min-width:0}
.topbar{
  position:sticky;
  top:0;
  z-index:18;
  min-height:72px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 28px;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid var(--line);
}
.topbar-title-wrap{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:1px;
}
.topbar-title{
  overflow:hidden;
  color:var(--text);
  font-size:18px;
  font-weight:800;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.topbar-subtitle{
  color:var(--muted);
  font-size:12px;
}
.topbar-user{
  margin-left:auto;
  min-height:36px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--accent-strong);
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
  transition:border-color .18s ease,background .18s ease,color .18s ease;
}
.topbar-user:hover{
  border-color:#9fc8cd;
  background:#f0f8f8;
}
.icon-btn{
  display:none;
  align-items:center;
  justify-content:center;
  width:40px;
  height:40px;
  padding:0;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--text);
}
.nav-toggle{
  flex-direction:column;
  gap:4px;
}
.nav-toggle span{
  display:block;
  width:16px;
  height:2px;
  background:var(--text);
}

.content{
  width:100%;
  max-width:1600px;
  padding:28px;
  display:flex;
  flex-direction:column;
  gap:20px;
}
.grid{display:grid;gap:14px}
.cards-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.panel-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:20px;
}

.panel,
.stat-card,
.login-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.panel{padding:22px}
.panel h2{
  margin:0;
  color:var(--text);
  font-size:18px;
  line-height:1.3;
}
.panel-hint{
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.panel-actions{
  width:auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:nowrap;
}

.stat-card{
  position:relative;
  min-height:116px;
  padding:18px 20px;
  overflow:hidden;
}
.stat-card::after{
  content:"";
  position:absolute;
  right:20px;
  top:20px;
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--accent);
}
.stat-card:nth-child(2)::after{background:var(--success)}
.stat-card:nth-child(3)::after{background:var(--warning)}
.stat-card:nth-child(4)::after{background:var(--blue)}
.stat-card div{
  color:var(--muted);
  font-size:13px;
}
.stat-card strong{
  display:block;
  margin-top:12px;
  color:var(--text);
  font-size:30px;
  line-height:1;
  font-weight:800;
}
.dashboard-stats .stat-card{
  display:flex;
  align-items:center;
  gap:18px;
  transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}
.dashboard-stats .stat-card:hover{
  border-color:#c9d8df;
  box-shadow:0 12px 28px rgba(25,43,58,.09);
  transform:translateY(-1px);
}
.dashboard-stats .stat-card::after{display:none}
.stat-icon{
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background:#203946;
  color:#1fb9bb;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 10px 22px rgba(25,43,58,.1);
}
.stat-icon .icon{
  width:34px;
  height:34px;
  stroke-width:2.2;
}
.stat-copy{min-width:0}
.stat-copy > div{
  color:#667783;
  font-size:13px;
  font-weight:700;
}
.dashboard-stats .stat-card strong{
  margin-top:8px;
  font-size:32px;
}
.stat-card-total .stat-icon{
  background:#203f4a;
  color:#36d8cf;
}
.stat-card-online .stat-icon{
  background:#213d36;
  color:#58c96d;
}
.stat-card-offline .stat-icon{
  background:#39352b;
  color:#ff9f1f;
}
.stat-card-detecting .stat-icon{
  background:#23384e;
  color:#58a6ff;
}

.table-shell{
  width:100%;
  overflow-x:auto;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
}
.table-head,
.table-row{
  display:grid;
  align-items:center;
  gap:16px;
}
.table-head > span{white-space:nowrap}
.table-head{
  min-height:44px;
  padding:0 16px;
  background:#f4f7f9;
  color:#687984;
  font-size:12px;
  font-weight:700;
}
.table-row{
  min-height:64px;
  padding:12px 16px;
  border-top:1px solid #e8edf0;
  color:var(--text);
  transition:background .18s ease;
}
.table-row:hover{background:#fbfcfd}
.table-row:first-child{border-top:0}
.table-body{min-width:0}
.logs-table-head,
.logs-row{
  grid-template-columns:minmax(0,1.05fr) minmax(0,1.4fr) minmax(0,1.2fr) minmax(0,1fr) minmax(0,1.3fr);
}
.logs-row > span,
.commands-row > span,
.users-row > span,
.devices-row > span{
  min-width:0;
  overflow-wrap:anywhere;
}
.logs-row strong,
.commands-row strong{color:var(--text)}
.logs-table-shell{background:var(--surface)}
.commands-table-head,
.commands-row{
  grid-template-columns:minmax(0,1.35fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.15fr) minmax(88px,.8fr);
}
.commands-row > span:not(:first-child){
  color:var(--muted);
  font-size:13px;
}
.commands-row strong{display:block}
.commands-row small{
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.dashboard-devices-head,
.dashboard-devices-row{
  grid-template-columns:minmax(0,1.35fr) minmax(0,1.15fr) minmax(0,1fr) minmax(0,.9fr);
}
.dashboard-devices-row > span{
  min-width:0;
  overflow-wrap:anywhere;
  line-height:1.45;
}
.dashboard-device-link:hover{background:#f7fbfb}
.devices-table-head,
.devices-row{
  grid-template-columns:minmax(106px,.9fr) minmax(86px,.75fr) minmax(150px,1fr) minmax(86px,.75fr) minmax(76px,.6fr) minmax(145px,.95fr) minmax(292px,292px);
  gap:12px;
}
.devices-row > span{min-width:0}
.devices-row > span:nth-child(6){white-space:nowrap}
.devices-name-cell{
  display:flex;
  min-width:0;
  align-items:center;
}
.device-name-link{
  color:var(--text);
  font-weight:800;
}
.device-name-link:hover{color:var(--accent)}
.devices-actions-cell,
.users-actions-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.devices-actions-cell{
  flex-wrap:nowrap;
  white-space:nowrap;
}
.devices-actions-cell .action-btn{
  flex:0 0 auto;
  padding:0 10px;
}
.devices-actions-cell form{
  flex:0 0 auto;
  margin:0;
}
.devices-actions-cell form .action-btn{
  width:auto;
}
.devices-table-head > span:last-child,
.users-table-head > span:last-child{text-align:center}
.users-table-head,
.users-row{
  grid-template-columns:minmax(140px,1.1fr) minmax(100px,.8fr) minmax(100px,.8fr) minmax(100px,.8fr) minmax(165px,1.1fr) minmax(150px,1fr);
}
.users-row > span:nth-child(5){white-space:nowrap}
.records-table-head,
.records-row{
  grid-template-columns:minmax(76px,.75fr) minmax(108px,.9fr) minmax(50px,.42fr) repeat(3,minmax(116px,.95fr)) minmax(72px,72px) minmax(244px,244px);
  gap:8px;
}
.records-row > span{
  min-width:0;
  overflow-wrap:anywhere;
}
.records-row > span:nth-child(4),
.records-row > span:nth-child(5),
.records-row > span:nth-child(6){
  font-size:13px;
  white-space:nowrap;
}
.records-status-cell{
  display:flex;
  align-items:center;
  justify-content:center;
}
.record-state-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:54px;
  height:30px;
  padding:0 12px;
  border:1px solid transparent;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
  line-height:1;
  cursor:default;
  white-space:nowrap;
}
.record-state-normal{
  border-color:#b9e2cc;
  background:#ecfdf3;
  color:#087443;
}
.record-state-warning{
  border-color:#f7c982;
  background:#fff6df;
  color:#a15c06;
}
.records-table-head > span:last-child{text-align:center}
.records-actions-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex-wrap:nowrap;
  white-space:nowrap;
}
.records-actions-cell .action-btn{
  flex:0 0 auto;
  min-height:32px;
  padding:0 8px;
}

.baseline-status-strip{
  margin-bottom:18px;
  padding:12px 14px;
  border:1px solid #cfe0e3;
  border-radius:8px;
  background:#f4f9f9;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  color:#536873;
  font-size:13px;
}
.baseline-status-strip > span:first-child{font-weight:700;color:var(--text)}
.baseline-form{
  padding:18px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-muted);
}
.baseline-form-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(150px,1fr));
  gap:16px;
}
.baseline-readonly input{
  border-color:#d8e2e7;
  background:#eef3f5;
  color:#455b67;
  font-weight:700;
}
.baseline-form-footer{
  margin-top:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.baseline-table-head,
.baseline-table-row{
  min-width:980px;
  grid-template-columns:60px repeat(7,minmax(95px,1fr)) 150px;
  gap:10px;
}
.baseline-actions-cell{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  white-space:nowrap;
}
.baseline-actions-cell form{margin:0}
.baseline-actions-cell .action-btn{min-height:32px;padding:0 10px}

.report-record-table-head,
.report-record-row{
  grid-template-columns:minmax(130px,1.15fr) minmax(110px,.8fr) minmax(110px,.8fr) minmax(150px,1fr) minmax(150px,1fr) minmax(90px,90px);
  gap:8px;
}
.report-record-row > span{
  min-width:0;
  overflow-wrap:anywhere;
}
.report-record-row > span:nth-child(4),
.report-record-row > span:nth-child(5){font-size:13px;white-space:nowrap}
.report-record-table-head > span:last-child{text-align:center}
.report-record-actions-cell{
  display:flex;
  align-items:center;
  justify-content:center;
}
.report-record-actions-cell .action-btn{min-height:32px;padding:0 12px}

.report-detail-card{height:min(82vh,760px)}
.report-detail-meta{
  margin-bottom:14px;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.report-detail-meta span{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:0 10px;
  border:1px solid #d5e0e6;
  border-radius:999px;
  background:#f5f8fa;
  color:#536873;
  font-size:12px;
  font-weight:700;
}
.report-json-shell{
  min-height:0;
  flex:1;
  overflow:auto;
  border:1px solid #d7e0e7;
  border-radius:10px;
  background:#f7f8fc;
  box-shadow:inset 0 1px 3px rgba(25,43,58,.05);
}
.report-json-shell pre{
  min-width:max-content;
  margin:0;
  padding:22px 24px;
  color:#243746;
  font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace;
  font-size:14px;
  line-height:1.72;
  tab-size:2;
  white-space:pre;
}

.pagination-bar{
  margin-top:16px;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:8px;
  background:linear-gradient(180deg,#fbfdff 0%,#f5f9fb 100%);
  box-shadow:var(--shadow-soft);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.pagination-summary{
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
}
.pagination-summary strong{color:var(--text)}
.pagination-nav{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.pagination-pages{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.pagination-jump-form{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.pagination-jump-label{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
}
.pagination-jump-label input{
  width:72px;
  min-height:36px;
  padding:0 10px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  text-align:center;
  outline:none;
}
.pagination-jump-label input:focus{
  border-color:#79b8bf;
  box-shadow:0 0 0 3px rgba(22,123,134,.1);
}
.pagination-jump-btn{
  min-width:68px;
}
.pagination-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-width:38px;
  min-height:36px;
  padding:0 12px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:#fff;
  color:#526572;
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
  transition:border-color .18s ease,background .18s ease,color .18s ease,box-shadow .18s ease;
}
.pagination-link:hover{
  border-color:#8ebdc2;
  background:#f2f9f9;
  color:var(--accent-strong);
  box-shadow:0 4px 12px rgba(22,123,134,.08);
}
.pagination-link.is-active{
  border-color:var(--accent);
  background:var(--accent);
  color:#fff;
  box-shadow:0 6px 14px rgba(22,123,134,.16);
}
.pagination-link.is-disabled{
  opacity:.45;
  cursor:not-allowed;
  pointer-events:none;
  box-shadow:none;
}
.pagination-ellipsis{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:20px;
  color:var(--muted);
  font-weight:700;
}
.pagination-arrow .icon{
  width:14px;
  height:14px;
}

.status-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  min-height:26px;
  padding:0 9px;
  border:1px solid #cbdce0;
  border-radius:999px;
  background:#f0f7f7;
  color:var(--accent-strong);
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}
.status-pill .icon{
  width:13px;
  height:13px;
  stroke-width:2;
}
.pill-neutral{
  border-color:#cbdce0;
  background:#f0f7f7;
  color:var(--accent-strong);
}
.pill-info{
  border-color:#c5d9f0;
  background:#f0f6ff;
  color:#2e6fc5;
}
.pill-online{
  border-color:#b9dec6;
  background:#edf8f1;
  color:#287858;
}
.pill-offline,
.pill-warning{
  border-color:#efd3a5;
  background:#fff7e8;
  color:#b46f16;
}
.pill-detecting{
  border-color:#c5d9f0;
  background:#f0f6ff;
  color:#2e6fc5;
}
.pill-standby,
.pill-disabled{
  border-color:#cbd7dd;
  background:#f3f6f7;
  color:#647684;
}
.pill-ready{
  border-color:#b9dec6;
  background:#edf8f1;
  color:#287858;
}
.pill-paused{
  border-color:#e6cfaa;
  background:#fff8eb;
  color:#9a6c21;
}
.pill-success{
  border-color:#bddbcf;
  background:#eef8f2;
  color:#287858;
}
.pill-danger{
  border-color:#e3c4c5;
  background:#fdf1f1;
  color:#a94e51;
}

.actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.actions form{
  margin:0;
  display:inline-flex;
}
.actions button,
.search-form button,
.login-form button,
.form-actions button,
.primary-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-height:40px;
  padding:0 16px;
  border:1px solid var(--accent);
  border-radius:8px;
  background:var(--accent);
  color:#fff;
  font-weight:700;
  transition:background .18s ease,border-color .18s ease,box-shadow .18s ease,opacity .18s ease;
}
.actions button:hover,
.search-form button:hover,
.login-form button:hover,
.form-actions button:hover,
.primary-btn:hover{
  border-color:var(--accent-strong);
  background:var(--accent-strong);
  box-shadow:0 5px 14px rgba(22,123,134,.18);
}

.search-form{
  display:flex;
  gap:8px;
  flex:0 1 420px;
  min-width:min(100%,280px);
}
.search-form input{flex:1 1 auto}
.search-form button{
  flex:0 0 auto;
  min-width:82px;
  white-space:nowrap;
}
.records-search{
  flex:0 1 auto;
  min-width:0;
  max-width:none;
  margin-left:auto;
  justify-content:flex-end;
}
.records-search input[name="device_name"]{
  flex:0 0 128px;
  width:128px;
  min-width:128px;
  max-width:128px;
}
.report-records-search input[name="device_name"]{
  flex-basis:200px;
  width:200px;
  min-width:200px;
  max-width:200px;
}
.records-search input[type="date"]{
  flex:0 0 190px;
  width:190px;
  min-width:190px;
}
.search-form input,
.search-form select,
.login-form input,
.form-grid input,
.form-grid select,
.param-item input,
.param-item select{
  width:100%;
  min-width:0;
  min-height:42px;
  padding:0 12px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  outline:none;
  background:#fff;
  color:var(--text);
  transition:border-color .18s ease,box-shadow .18s ease;
}
.form-grid select,
.param-item select{
  padding-right:12px;
  appearance:auto;
}
.search-form select{
  min-width:128px;
}
.search-form input:focus,
.search-form select:focus,
.login-form input:focus,
.form-grid input:focus,
.form-grid select:focus,
.param-item input:focus,
.param-item select:focus{
  border-color:#79b8bf;
  box-shadow:0 0 0 3px rgba(22,123,134,.1);
}

.form-grid,
.param-form{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:18px;
}
.form-grid label,
.param-item{
  display:flex;
  flex-direction:column;
  gap:7px;
  color:#5e707c;
  font-size:13px;
  font-weight:600;
}
.param-item input,
.param-item select{min-height:44px}
.param-section{
  grid-column:1/-1;
  padding-top:8px;
  color:var(--text);
  font-weight:800;
}
.form-actions{
  grid-column:1/-1;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
}
.users-form-actions{align-self:end}
.users-password-field span{
  color:var(--muted);
  font-size:11px;
  font-weight:400;
}

.ghost-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:0 14px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:#fff;
  color:#526572;
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
  transition:border-color .18s ease,background .18s ease,color .18s ease;
}
.ghost-btn:hover{
  border-color:#8ebdc2;
  background:#f2f9f9;
  color:var(--accent-strong);
}

.device-delete-form{
  margin:0;
  display:inline-flex;
}
.action-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-height:36px;
  padding:0 12px;
  border:1px solid transparent;
  border-radius:8px;
  color:#fff;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
  transition:filter .18s ease,opacity .18s ease;
}
.action-btn:hover{filter:brightness(.94)}
.action-btn-primary{background:var(--accent)}
.action-btn-info{background:var(--blue)}
.action-btn-warning{background:var(--warning)}
.action-btn-edit{background:#18877f}
.action-btn-monitor{background:#0b7f91}
.action-btn-success{background:var(--success)}
.search-form .action-btn-success{border-color:var(--success)}
.action-btn-back{background:#647684}
.action-btn-danger{background:var(--danger)}

.form-grid-wide{grid-column:1/-1}
.form-help{
  margin-top:-2px;
  color:var(--muted);
  font-size:11px;
  font-weight:400;
  line-height:1.45;
}
.monitor-panel{min-height:calc(100vh - 128px)}
.monitor-head{align-items:flex-start}
.monitor-kicker{
  margin-bottom:5px;
  color:var(--accent);
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.monitor-head h2{margin:0}
.monitor-head-actions{
  display:flex;
  align-items:center;
  gap:10px;
}
.monitor-control-actions{
  display:flex;
  align-items:center;
  gap:8px;
}
.monitor-light-on{background:#b07a16}
.monitor-light-off{background:#526b7b}
.monitor-live-badge{
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:36px;
  padding:0 12px;
  border:1px solid #9cd9d4;
  border-radius:8px;
  background:#effafa;
  color:#11736e;
  font-size:12px;
  font-weight:800;
}
.monitor-live-badge .icon{width:15px;height:15px}
.monitor-viewer{
  overflow:hidden;
  border:1px solid #244b5c;
  border-radius:10px;
  background:#102531;
  box-shadow:0 12px 28px rgba(16,43,57,.14);
}
.monitor-viewer-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  min-height:42px;
  padding:0 14px;
  border-bottom:1px solid rgba(255,255,255,.1);
  color:#c1dce3;
  font-size:12px;
}
.monitor-viewer-bar > span:first-child{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:#b5e5dc;
  font-weight:700;
  white-space:nowrap;
}
.monitor-viewer-bar i{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#d6a43b;
  box-shadow:0 0 0 4px rgba(214,164,59,.14);
}
.monitor-viewer-bar [data-state="live"]{
  color:#b5e5dc;
}
.monitor-viewer-bar [data-state="live"] i{
  background:#46c997;
  box-shadow:0 0 0 4px rgba(70,201,151,.14);
}
.monitor-viewer-bar [data-state="error"]{
  color:#f0b2a6;
}
.monitor-viewer-bar [data-state="error"] i{
  background:#d86e5e;
  box-shadow:0 0 0 4px rgba(216,110,94,.14);
}
.monitor-viewer-url{
  min-width:0;
  overflow:hidden;
  color:#87a8b4;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.monitor-screen{
  position:relative;
  display:grid;
  min-height:420px;
  place-items:center;
  background:#081a23;
}
.monitor-stream{
  display:block;
  width:100%;
  height:auto;
  max-height:calc(100vh - 270px);
  min-height:280px;
  object-fit:contain;
}
.monitor-stream[hidden]{display:none}
.monitor-stream-error[hidden]{display:none}
.monitor-stream-error,
.monitor-empty{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:9px;
  color:#b9d0d7;
  text-align:center;
}
.monitor-stream-error strong,
.monitor-empty strong{color:#f2f7f8;font-size:16px}
.monitor-stream-error > span:not(.monitor-error-icon),
.monitor-empty > span:not(.monitor-empty-icon){color:#8eabb5;font-size:12px}
.monitor-error-icon,
.monitor-empty-icon{
  display:grid;
  place-items:center;
  width:54px;
  height:54px;
  border:1px solid rgba(129,211,211,.28);
  border-radius:14px;
  background:rgba(45,125,141,.2);
  color:#81d3d3;
}
.monitor-error-icon .icon,
.monitor-empty-icon .icon{width:26px;height:26px}
.monitor-empty{
  min-height:420px;
  border:1px dashed var(--line-strong);
  border-radius:10px;
  background:linear-gradient(145deg,#f8fbfc,#eef6f7);
}
.monitor-empty strong{color:var(--text)}
.monitor-empty > span:not(.monitor-empty-icon){color:var(--muted)}
.monitor-empty .action-btn{margin-top:7px}

.actions button:disabled,
.action-btn:disabled,
.ghost-btn:disabled,
.primary-btn:disabled,
.topbar-user:disabled{
  opacity:.45;
  cursor:not-allowed;
  box-shadow:none;
  filter:none;
}

.meta-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:10px;
}
.meta-grid > div{
  min-width:0;
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-muted);
  color:var(--muted);
}
.meta-grid > div span{
  display:block;
  margin-bottom:4px;
  color:var(--muted);
  font-size:12px;
}
.meta-grid strong{
  display:block;
  overflow-wrap:anywhere;
  color:var(--text);
  font-size:14px;
}
.meta-grid > div > .status-pill{
  display:inline-flex;
  width:max-content;
  max-width:100%;
  margin:0;
  color:inherit;
  font-size:12px;
}
.meta-grid > div > .status-pill > .icon{
  display:block;
  width:14px;
  height:14px;
  margin:0;
  color:inherit;
}
.meta-grid > div > .status-pill > span{
  display:inline;
  margin:0;
  color:inherit;
  font-size:inherit;
}
.users-meta strong{font-size:15px}

.parameter-region{
  grid-column:1/-1;
  padding:24px 0 4px;
  border-top:1px solid var(--line);
}
.parameter-region:first-child{
  padding-top:4px;
  border-top:0;
}
.parameter-region-head{
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:18px;
}
.parameter-region-index{
  display:grid;
  flex:0 0 34px;
  height:34px;
  place-items:center;
  border:1px solid #bcd9dc;
  border-radius:8px;
  background:#edf7f7;
  color:var(--accent-strong);
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:11px;
  font-weight:800;
}
.parameter-region-head h3{
  margin:0;
  color:var(--text);
  font-size:17px;
}
.parameter-region-head p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:12px;
}
.parameter-region-body{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}
.parameter-value{
  min-width:0;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-muted);
}
.parameter-value span{
  display:block;
  margin-bottom:5px;
  color:var(--muted);
  font-size:12px;
}
.parameter-value strong{
  display:block;
  overflow-wrap:anywhere;
  color:var(--text);
  font-size:14px;
}
.step-region-body{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.step-group{
  padding-top:16px;
  border-top:1px solid #e8edf0;
}
.step-group:first-child{
  padding-top:0;
  border-top:0;
}
.step-group-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.step-group-head-main{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.step-group-head span{
  color:var(--text);
  font-size:15px;
  font-weight:800;
}
.step-max-badge{
  color:var(--muted);
  font-size:12px;
}
.step-max-value{
  padding:14px 16px;
  border:1px solid #dfe8eb;
  border-radius:10px;
  background:#f8fbfc;
}
.step-group-head small{
  color:var(--muted);
  font-size:11px;
}
.step-fields{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}
.transfer-region-body{
  display:flex;
  flex-direction:column;
  gap:20px;
}
.transfer-group{
  padding-top:18px;
  border-top:1px solid #e8edf0;
}
.transfer-group:first-child{
  padding-top:0;
  border-top:0;
}
.transfer-group-head{
  display:flex;
  align-items:center;
  margin-bottom:12px;
}
.transfer-group-head h4{
  margin:0;
  color:var(--text);
  font-size:15px;
}
.transfer-group-head p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:12px;
}

.state-updated{
  color:var(--muted);
  font-size:12px;
  font-weight:400;
}
.state-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:10px;
}
.state-item{
  min-width:0;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-muted);
}
.state-item span{
  display:block;
  margin-bottom:5px;
  color:var(--muted);
  font-size:12px;
}
.state-item strong{
  display:block;
  overflow-wrap:anywhere;
  color:var(--text);
  font-size:15px;
}
.trend-grid{
  display:grid;
  gap:18px;
}
.trend-section{
  padding:18px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--surface);
  box-shadow:var(--shadow-soft);
}
.trend-section h3{
  margin:0 0 14px;
  color:var(--text);
  font-size:16px;
  line-height:1.3;
}
.trend-grid-inner{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.trend-chart-card{
  position:relative;
  height:100%;
  padding:14px 14px 12px;
  border:1px solid #d9e6ef;
  border-radius:10px;
  background:linear-gradient(180deg,#ffffff,#f7fbff);
  overflow:hidden;
}
.trend-chart-head{
  margin-bottom:8px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.trend-chart-title{
  color:var(--text);
  font-size:14px;
  font-weight:800;
}
.trend-chart-subtitle{
  margin-top:2px;
  color:var(--muted);
  font-size:12px;
}
.trend-chart-range{
  display:flex;
  flex-direction:column;
  gap:3px;
  align-items:flex-end;
  color:var(--muted);
  font-size:11px;
  white-space:nowrap;
}
.trend-chart-range strong{
  color:var(--accent-strong);
  font-size:12px;
}
.trend-chart-svg{
  width:100%;
  height:180px;
  display:block;
  overflow:visible;
}
.trend-grid line{
  stroke:#d9e6ef;
  stroke-width:1;
  stroke-dasharray:4 4;
}
.trend-y-labels text{
  fill:#6d7f92;
  font-size:10px;
  font-weight:700;
  dominant-baseline:middle;
}
.trend-line{
  fill:none;
  stroke:#2c7ef7;
  stroke-width:2.5;
  stroke-linejoin:round;
  stroke-linecap:round;
}
.trend-points circle{
  fill:#ffffff;
  stroke:#2c7ef7;
  stroke-width:2;
}
.trend-hover-line{
  stroke:#39d9d0;
  stroke-width:1.2;
  opacity:0;
  transition:opacity .16s ease;
  pointer-events:none;
}
.trend-hover-line.is-visible{opacity:.85}
.trend-hover-point{
  fill:#ffffff;
  stroke:#39d9d0;
  stroke-width:3;
  opacity:0;
  filter:drop-shadow(0 0 10px rgba(57,217,208,.35));
  transition:opacity .16s ease;
  pointer-events:none;
}
.trend-hover-point.is-visible{opacity:1}
.trend-labels text{
  fill:#6d7f92;
  font-size:10px;
}
.trend-tooltip{
  position:absolute;
  z-index:4;
  width:max-content;
  min-width:184px;
  max-width:min(236px, calc(100% - 24px));
  padding:11px 12px 10px;
  border:1px solid rgba(40,173,173,.78);
  border-radius:12px;
  background:linear-gradient(180deg,rgba(18,21,39,.98) 0%,rgba(20,23,43,.98) 100%);
  box-shadow:0 12px 28px rgba(10,16,31,.24), inset 0 1px 0 rgba(255,255,255,.07);
  color:#e8f8f7;
  opacity:0;
  visibility:hidden;
  transform:translateY(3px) scale(.98);
  transition:opacity .16s ease, transform .16s ease, visibility .16s ease;
  pointer-events:none;
}
.trend-tooltip.is-visible{
  opacity:1;
  visibility:visible;
  transform:translateY(0) scale(1);
}
.trend-tooltip-title{
  color:#43efe4;
  font-size:14px;
  font-weight:800;
  line-height:1.28;
  overflow-wrap:anywhere;
}
.trend-tooltip-meta{
  margin-top:6px;
  color:#aeb7c9;
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}
.trend-tooltip-list{
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:5px;
}
.trend-tooltip-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:18px;
}
.trend-tooltip-label{
  color:#99a3b8;
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}
.trend-tooltip-value{
  color:#4eece2;
  font-size:13px;
  font-weight:800;
  white-space:nowrap;
}
.trend-tooltip-row:nth-child(3) .trend-tooltip-value{
  color:#ffad2f;
}
.trend-empty{
  min-height:160px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  border:1px dashed #cdd9e2;
  border-radius:10px;
  background:#fbfdff;
}
@media (max-width:820px){
  .trend-grid-inner{grid-template-columns:1fr}
}

.empty{
  padding:16px 0;
  color:var(--muted);
}
.flash-wrap{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.flash{
  padding:11px 14px;
  border:1px solid #cbdfe3;
  border-radius:8px;
  background:#f1f8f8;
  color:#225c64;
}
.flash-success{
  border-color:#c0dfd0;
  background:#eff8f2;
  color:#287858;
}
.flash-error{
  border-color:#e4c5c6;
  background:#fdf2f2;
  color:#a94e51;
}

.command-modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:44;
}
.command-modal[hidden]{display:none}
.command-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(16,31,43,.52);
}
.command-modal-card{
  position:relative;
  z-index:1;
  width:min(560px,calc(100vw - 24px));
  max-height:min(88vh,720px);
  overflow:auto;
  padding:24px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  box-shadow:0 22px 60px rgba(16,31,43,.2);
}
.command-modal-wide{
  width:min(920px,calc(100vw - 28px));
  max-height:min(88vh,860px);
  padding:26px 26px 22px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.command-modal-detail{
  width:min(880px,calc(100vw - var(--sidebar-width) - 40px));
  max-width:calc(100vw - var(--sidebar-width) - 40px);
  margin-left:calc(var(--sidebar-width) / 2);
}
.command-modal-record-detail{
  width:min(1080px,calc(100vw - var(--sidebar-width) - 40px));
  max-width:calc(100vw - var(--sidebar-width) - 40px);
}
.command-modal-detail .command-modal-body{
  flex-direction:column;
  gap:14px;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-gutter:stable;
  padding-right:6px;
  min-height:0;
  -webkit-overflow-scrolling:touch;
}
.command-modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}
.command-modal-head h3{
  margin:0;
  color:var(--text);
  font-size:19px;
}
.command-modal-head p{
  margin:5px 0 0;
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
}
.command-modal-body{
  min-height:0;
  flex:1;
  display:flex;
  overflow:hidden;
}
.record-export-form{
  display:grid;
  grid-template-columns:minmax(170px,1fr) minmax(180px,1fr) minmax(180px,1fr) auto;
  gap:12px;
  align-items:end;
}
.record-export-field{
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:0;
  color:#5e707c;
  font-size:13px;
  font-weight:700;
}
.record-export-field select,
.record-export-field input{
  width:100%;
  min-width:0;
  min-height:42px;
  padding:0 12px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  outline:none;
  background:#fff;
  color:var(--text);
  transition:border-color .18s ease,box-shadow .18s ease;
}
.record-export-field select:focus,
.record-export-field input:focus{
  border-color:#79b8bf;
  box-shadow:0 0 0 3px rgba(22,123,134,.1);
}
.record-export-submit{
  display:flex;
  align-items:flex-end;
}
.record-export-btn{
  min-width:118px;
  border-color:var(--success);
  background:var(--success);
  white-space:nowrap;
}
.record-export-btn:hover{
  border-color:#2e8f57;
  background:#2e8f57;
  box-shadow:0 5px 14px rgba(58,166,102,.18);
}
.record-export-form + .command-modal-actions{
  margin-top:28px;
}
.modal-table-shell{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  border:1px solid #dce7ee;
  border-radius:12px;
  overflow:hidden;
  background:#fdfefe;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8);
}
.modal-table-head{
  display:grid;
  grid-template-columns:minmax(100px,.7fr) minmax(140px,1fr) minmax(110px,.75fr);
  gap:0;
  min-height:56px;
  padding:0 22px;
  align-items:center;
  background:linear-gradient(180deg,#f3f8fc 0%,#edf4fa 100%);
  color:#36506a;
  font-size:18px;
  font-weight:800;
  border-bottom:1px solid #dfe7ee;
}
.modal-table-head > span{
  text-align:center;
}
.modal-table-body{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  max-height:none;
  overflow-y:auto;
  scrollbar-gutter:stable;
  background:#fff;
}
.modal-table-row{
  display:grid;
  grid-template-columns:minmax(100px,.7fr) minmax(140px,1fr) minmax(110px,.75fr);
  gap:0;
  min-height:64px;
  padding:0 22px;
  align-items:center;
  border-bottom:1px solid #edf1f4;
  color:var(--text);
  font-size:18px;
  font-weight:700;
}
.modal-table-row:last-child{
  border-bottom:0;
}
.modal-table-row > span{
  text-align:center;
  min-width:0;
  overflow-wrap:anywhere;
}
.modal-table-row > span::before{
  display:none;
}
.modal-detail-shell{
  --record-detail-columns:76px 112px 72px 72px 112px 72px 72px 162px 104px 104px 112px 112px 112px 168px;
  --record-detail-width:1462px;
  min-width:0;
  flex:0 0 auto;
}
.modal-detail-scroll{
  width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}
.record-detail-stack{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:0;
  width:100%;
}
.modal-detail-head{
  width:var(--record-detail-width);
  min-width:var(--record-detail-width);
  grid-template-columns:var(--record-detail-columns);
  font-size:13px;
  column-gap:0;
  padding:0;
  min-height:50px;
  align-items:center;
}
.modal-detail-head > span{
  display:flex;
  align-items:center;
  justify-content:center;
  height:100%;
  white-space:nowrap;
  overflow:visible;
  text-overflow:clip;
  word-break:normal;
  line-height:1.2;
  padding:0 7px;
  border-right:1px solid #d5e1eb;
}
.modal-detail-head > span:last-child{border-right:0}
.modal-detail-body{
  max-height:none;
  width:var(--record-detail-width);
  min-width:var(--record-detail-width);
  overflow-x:visible;
  padding-bottom:2px;
}
.modal-detail-row{
  display:grid;
  width:var(--record-detail-width);
  min-width:var(--record-detail-width);
  grid-template-columns:var(--record-detail-columns);
  gap:0;
  min-height:64px;
  column-gap:0;
  padding:0;
  align-items:center;
  color:var(--text);
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
  border-bottom:1px solid #e4ebf0;
}
.modal-detail-row > span{
  display:flex;
  align-items:center;
  justify-content:center;
  height:100%;
  text-align:center;
  min-width:0;
  overflow:visible;
  text-overflow:clip;
  padding:0 7px;
  border-right:1px solid #e4ebf0;
}
.modal-detail-row > span:last-child{border-right:0}
.modal-detail-row > span::before{
  display:none;
}
.modal-detail-body .modal-detail-row:last-child{
  border-bottom:0;
}
.record-warning-panel{
  border:1px solid #f3d08b;
  border-radius:14px;
  background:linear-gradient(180deg,#fffaf1 0%,#fff4df 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.82),0 8px 20px rgba(180,111,22,.08);
  padding:16px 16px 14px;
}
.record-warning-head{
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:12px;
}
.record-warning-icon{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:40px;
  height:40px;
  border-radius:12px;
  background:linear-gradient(180deg,#ffd895 0%,#f4b75d 100%);
  color:#8a4d00;
  box-shadow:0 8px 16px rgba(180,111,22,.16);
}
.record-warning-icon .icon{
  width:20px;
  height:20px;
}
.record-warning-head h4{
  margin:1px 0 4px;
  color:#8a4d00;
  font-size:15px;
  font-weight:800;
}
.record-warning-head p{
  margin:0;
  color:#a26a14;
  font-size:12px;
}
.record-warning-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.record-warning-item{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:11px 12px;
  border:1px solid #f6d9a7;
  border-radius:12px;
  background:rgba(255,255,255,.7);
}
.record-warning-index{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:26px;
  height:26px;
  border-radius:50%;
  background:#b46f16;
  color:#fff;
  font-size:12px;
  font-weight:800;
}
.record-warning-text{
  min-width:0;
  color:#6f460a;
  font-size:13px;
  line-height:1.55;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.modal-table-body .empty{
  min-height:220px;
  display:grid;
  place-items:center;
  color:var(--muted);
  font-size:15px;
}
.command-modal-close{
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  font-size:19px;
  line-height:1;
}
.command-modal-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.password-modal-form .param-item span{
  color:var(--muted);
  font-size:12px;
}
.password-modal-form .param-item input{min-height:44px}
.command-choice{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fbfcfd;
  transition:border-color .18s ease,background .18s ease;
}
.command-choice.is-selected{
  border-color:#93c4c8;
  background:#f1f8f8;
}
.command-choice input[type="radio"]{
  width:17px;
  height:17px;
  margin:0;
  accent-color:var(--accent);
  flex:0 0 auto;
}
.command-choice-body{
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}
.command-choice-body strong{font-size:14px}
.command-choice-body small{
  color:var(--muted);
  font-size:12px;
}
.command-count-input{
  width:120px;
  min-height:40px;
  margin-left:auto;
  padding:0 12px;
  border:1px solid var(--line-strong);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  text-align:center;
}
.command-count-input:disabled{
  background:#f2f5f6;
  color:#9aa7ae;
}
.command-modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:8px;
}
.command-modal-actions-center{
  justify-content:center;
}
.command-modal-actions .primary-btn,
.command-modal-actions .danger-btn{min-width:132px}
.command-modal-actions .record-close-btn{
  min-width:160px;
  background:linear-gradient(180deg,#2e6fc5 0%,#2157b2 100%);
  border-color:#2e6fc5;
  box-shadow:0 8px 18px rgba(46,111,197,.18);
}
.command-modal-actions .record-close-btn:hover{
  background:linear-gradient(180deg,#377ad1 0%,#1f53a7 100%);
  border-color:#1f53a7;
  box-shadow:0 10px 22px rgba(46,111,197,.24);
}
.danger-btn{
  border-color:var(--danger);
  background:var(--danger);
}
.danger-btn:hover{
  border-color:#963e41;
  background:#963e41;
}

.login-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:#edf2f4;
}
.login-card{
  width:min(440px,100%);
  padding:30px;
}
.login-head{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:22px;
}
.login-tag{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 9px;
  border:1px solid #bfdcdf;
  border-radius:999px;
  background:#f0f8f8;
  color:var(--accent-strong);
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
}
.login-head h1{
  margin:0;
  font-size:24px;
}
.login-head p{
  margin:5px 0 0;
  color:var(--muted);
  font-size:13px;
}
.login-form{
  display:flex;
  flex-direction:column;
  gap:13px;
}
.login-form label{
  display:flex;
  flex-direction:column;
  gap:7px;
  color:#5e707c;
  font-size:13px;
  font-weight:600;
}
.login-form button{width:100%;margin-top:4px}

@media (max-width:1100px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;
    inset:0 auto 0 0;
    width:min(82vw,300px);
    transform:translateX(-105%);
    transition:transform .22s ease;
    z-index:30;
    box-shadow:12px 0 30px rgba(16,31,43,.18);
  }
  body.nav-open .sidebar{transform:translateX(0)}
  .icon-btn{display:inline-flex}
  .panel-grid{grid-template-columns:1fr}
}

@media (max-width:820px){
  .content{padding:20px}
  .baseline-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .topbar{padding:0 20px}
  .cards-4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .panel-actions{
    width:100%;
    justify-content:stretch;
    flex-wrap:wrap;
  }
  .panel-actions .search-form{flex:1 1 auto}
}

@media (max-width:620px){
  body{overflow-x:hidden}
  .baseline-form-grid{grid-template-columns:1fr}
  .baseline-form-footer{align-items:stretch;flex-direction:column}
  .baseline-form-footer .actions{width:100%}
  .baseline-form-footer .actions > button{width:100%}
  .baseline-table-row,
  .report-record-row{min-width:0}
  .baseline-table-row > span,
  .report-record-row > span{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    overflow:visible;
    white-space:normal;
  }
  .baseline-table-row > span::before,
  .report-record-row > span::before{
    content:attr(data-label);
    flex:0 0 92px;
    color:var(--muted);
    font-size:11px;
    font-weight:600;
  }
  .content{
    padding:14px;
    gap:14px;
  }
  .monitor-panel{min-height:calc(100vh - 102px)}
  .monitor-head-actions{
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
  }
  .monitor-control-actions{
    order:1;
    width:100%;
  }
  .monitor-control-actions .action-btn{
    flex:1 1 0;
  }
  .monitor-live-badge{order:2}
  .monitor-head-actions > .action-btn{order:3}
  .monitor-viewer-bar{
    align-items:flex-start;
    flex-direction:column;
    gap:4px;
    padding:10px 12px;
  }
  .monitor-viewer-url{max-width:100%}
  .monitor-screen{min-height:260px}
  .monitor-stream{min-height:220px;max-height:none}
  .monitor-empty{min-height:300px}
  .topbar{
    min-height:64px;
    padding:0 14px;
  }
  .topbar-title{font-size:16px}
  .topbar-user{
    min-height:34px;
    padding:0 9px;
    font-size:12px;
  }
  .panel{
    padding:17px 15px;
    border-radius:8px;
  }
  .panel-head{
    align-items:stretch;
    gap:12px;
    margin-bottom:15px;
  }
  .panel-head > .actions,
  .panel-head > .panel-actions{width:100%}
  .panel-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .panel-actions .search-form,
  .panel-actions > .action-btn{
    width:100%;
    max-width:none;
  }
  .search-form{
    width:100%;
    min-width:0;
    flex-direction:column;
  }
  .records-search{
    min-width:0;
  }
  .records-search input[name="device_name"]{
    flex:1 1 auto;
    width:100%;
    min-width:0;
    max-width:none;
  }
  .records-search input[type="date"]{
    flex:1 1 auto;
    width:100%;
    min-width:0;
  }
  .search-form input,
  .search-form button{width:100%}
  .cards-4{grid-template-columns:1fr 1fr;gap:10px}
  .stat-card{
    min-height:96px;
    padding:15px;
  }
  .stat-card strong{font-size:25px}
  .dashboard-stats .stat-card{
    align-items:flex-start;
    flex-direction:column;
    gap:12px;
  }
  .stat-icon{
    width:48px;
    height:48px;
    border-radius:12px;
  }
  .stat-icon .icon{
    width:27px;
    height:27px;
  }
  .dashboard-stats .stat-card strong{font-size:27px}
  .table-shell{
    overflow:visible;
    border:0;
    background:transparent;
  }
  .table-head{display:none}
  .table-body{
    display:flex;
    flex-direction:column;
    gap:10px;
  }
  .table-row{
    display:grid;
    grid-template-columns:1fr;
    gap:9px;
    min-height:0;
    padding:14px;
    border:1px solid var(--line);
    border-radius:8px;
    background:#fff;
  }
  .table-row:hover{background:#fff}
  .dashboard-devices-row > span,
  .devices-row > span,
  .logs-row > span,
  .commands-row > span,
  .users-row > span{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    line-height:1.45;
  }
  .dashboard-devices-row > span::before,
  .devices-row > span::before,
  .logs-row > span::before,
  .commands-row > span::before,
  .users-row > span::before{
    content:attr(data-label);
    flex:0 0 72px;
    color:var(--muted);
    font-size:11px;
    font-weight:600;
  }
  .dashboard-devices-row > span:last-child,
  .devices-actions-cell,
  .users-actions-cell{justify-content:flex-start}
  .devices-row > span:first-child{
    display:flex;
    flex-direction:row;
    align-items:flex-start;
  }
  .commands-row > span:first-child{
    display:grid;
    grid-template-columns:72px minmax(0,1fr);
    align-items:start;
  }
  .commands-row > span:first-child::before{grid-row:1 / span 2}
  .commands-row > span:first-child strong,
  .commands-row > span:first-child small{grid-column:2}
  .devices-actions-cell,
  .users-actions-cell{
    flex-wrap:wrap;
    gap:7px;
  }
  .devices-actions-cell .action-btn,
  .users-actions-cell .action-btn,
  .users-actions-cell .ghost-btn{min-height:34px}
  .pagination-bar{
    align-items:stretch;
    flex-direction:column;
  }
  .pagination-summary{
    white-space:normal;
  }
  .pagination-nav{
    justify-content:center;
  }
  .pagination-pages{
    justify-content:center;
  }
  .pagination-jump-form{
    justify-content:center;
    width:100%;
  }
  .pagination-jump-label{
    width:100%;
    justify-content:space-between;
  }
  .pagination-jump-label input{
    width:100%;
    max-width:140px;
    flex:1 1 auto;
  }
  .pagination-jump-btn{
    width:min(120px,100%);
  }
  .pagination-link{
    min-height:34px;
    padding:0 10px;
  }
  .actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  .actions > a,
  .actions > form,
  .actions > form > button{width:100%}
  .actions > form{display:block}
  .form-grid,
  .param-form{grid-template-columns:1fr;gap:15px}
  .form-actions{
    display:grid;
    grid-template-columns:1fr;
  }
  .form-actions > *,
  .form-actions button{width:100%}
  .meta-grid{grid-template-columns:1fr 1fr;gap:8px}
  .meta-grid > div{padding:11px 12px}
  .parameter-region{padding-top:20px}
  .parameter-region-body,
  .step-fields,
  .state-grid{grid-template-columns:1fr}
  .parameter-region-head{margin-bottom:14px}
  .parameter-region-head h3{font-size:16px}
  .command-modal{
    align-items:flex-end;
    padding:10px;
  }
  .command-modal-card{
    width:100%;
    max-height:90vh;
    padding:19px 16px;
    border-radius:10px;
  }
  .command-modal-wide{
    width:100%;
    max-height:92vh;
    padding:18px 14px 14px;
  }
  .command-modal-detail{
    width:100%;
    max-width:100%;
    margin-left:0;
  }
  .command-modal-detail .command-modal-body{
    padding-right:4px;
  }
  .record-export-form{
    grid-template-columns:1fr;
    gap:13px;
  }
  .record-export-submit,
  .record-export-btn{
    width:100%;
  }
  .modal-table-head{
    min-height:48px;
    padding:0 14px;
    font-size:14px;
  }
  .modal-table-body{
    max-height:none;
  }
  .modal-table-row{
    min-height:54px;
    padding:0 14px;
    font-size:15px;
  }
  .modal-detail-head{
    display:grid;
    width:var(--record-detail-width);
    min-width:var(--record-detail-width);
    padding:0;
    font-size:12px;
    column-gap:0;
    min-height:62px;
  }
  .modal-detail-head > span{
    line-height:1.1;
  }
  .modal-detail-row{
    width:var(--record-detail-width);
    min-width:var(--record-detail-width);
    padding:0;
    font-size:12px;
    column-gap:0;
  }
  .record-warning-panel{
    padding:14px 12px 12px;
  }
  .record-warning-head{
    gap:10px;
    margin-bottom:10px;
  }
  .record-warning-icon{
    width:36px;
    height:36px;
    border-radius:11px;
  }
  .record-warning-item{
    padding:10px 11px;
  }
  .command-choice{
    align-items:flex-start;
    flex-wrap:wrap;
  }
  .command-count-input{
    width:100%;
    margin:2px 0 0 29px;
  }
  .command-modal-actions{
    flex-direction:column-reverse;
    align-items:stretch;
  }
  .command-modal-actions-center{
    flex-direction:column;
    align-items:center;
  }
  .command-modal-actions.command-modal-actions-center > *{
    width:min(240px,100%);
  }
  .command-modal-actions > *{width:100%}
  .login-card{padding:24px 18px}
  .login-head h1{font-size:21px}
}

@media (max-width:360px){
  .cards-4{grid-template-columns:1fr}
  .meta-grid{grid-template-columns:1fr}
  .topbar-user{max-width:96px;overflow:hidden;text-overflow:ellipsis}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    scroll-behavior:auto!important;
    transition-duration:.01ms!important;
    animation-duration:.01ms!important;
  }
}
