/* ============================================================
   大聚 X9 · 远程控制台 · 管理页样式（remote-admin）
   依赖 shared/css/tokens.css + base.css；与 remote-core 的 remote.css 共存
   命名空间：adm-*  （不覆写公共 .card/.tbl/.btn 基类）
   ============================================================ */

/* ---------------- 页面框架 ---------------- */
.adm-page { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.adm-head-txt { min-width: 0; }
.adm-title { font-size: 22px; font-weight: 800; letter-spacing: .3px; color: var(--ink); line-height: 1.2; }
.adm-sub { margin-top: 5px; font-size: 13px; color: var(--muted); }
.adm-head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------------- 卡片微调 ---------------- */
.adm-card { min-width: 0; }
.adm-card .card-head { padding: 15px 18px 8px; }
.adm-card .card-body { padding: 4px 18px 18px; }
.adm-card-tools { font-size: 13px; color: var(--ink-3); }
.adm-card-tools .btn-sm { height: 28px; padding: 0 10px; }
.adm-card-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }

/* ---------------- 统计卡 ---------------- */
.adm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.adm-stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; min-width: 0; }
.adm-stat .stat { min-width: 0; }
.adm-stat .stat .v { font-size: 25px; }
.adm-stat-ic { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--panel-3); color: var(--ink-3); flex: 0 0 auto; }
.adm-stat-ic.red { background: var(--red-soft); color: var(--red); }
.adm-stat-ic.amber { background: var(--amber-soft); color: #b47600; }
.adm-stat-ic.blue { background: var(--blue-soft); color: var(--blue); }
.adm-stat-ic.green { background: var(--green-soft); color: var(--green); }

/* ---------------- 筛选工具条 ---------------- */
.adm-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-toolbar .select { width: auto; min-width: 132px; height: 36px; }
.adm-toolbar .input { width: auto; height: 36px; }
.adm-toolbar .field { gap: 4px; }
.adm-toolbar .field > label { font-size: 12px; }
.adm-toolbar .grow { flex: 1 1 auto; }
.adm-toolbar-tip { font-size: 12px; color: var(--muted); }
.adm-search { width: 210px; flex: 0 0 auto; }
.adm-tabs { flex-wrap: wrap; }
.adm-inline-field { display: inline-flex; align-items: center; gap: 7px; }
.adm-inline-field > span { font-size: 13px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.adm-inline-field .select, .adm-inline-field .input { min-width: 0; }

/* ---------------- 表格 ---------------- */
.adm-table-wrap { width: 100%; min-width: 0; overflow-x: auto; border-radius: var(--radius-md); }
.adm-table { width: 100%; }
.adm-table thead th { background: var(--dark); padding: 10px 10px; font-size: 13px; white-space: nowrap; }
.adm-table tbody td { padding: 9px 10px; font-size: 13.5px; }
.adm-table .t-left { text-align: left; }
.adm-table .t-right { text-align: right; }
.adm-table .col-actions { white-space: nowrap; }
.adm-table .col-actions .btn { height: 27px; padding: 0 9px; font-size: 12.5px; }
.adm-table .adm-cell-strong { color: var(--ink); font-weight: 700; }
.adm-table .adm-cell-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; font-family: var(--font-num); }
.adm-table tr.adm-tr-clickable { cursor: pointer; }
.adm-table tr.adm-tr-empty td { padding: 0; background: #fff; }
.adm-table tr.adm-tr-empty:hover td { background: #fff; }
.adm-table .num, .adm-table .mono { font-family: var(--font-num); }
.adm-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: nowrap; }
.adm-link { color: var(--blue); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; font-size: 13px; }
.adm-link:hover { text-decoration: underline; }
.adm-link.danger { color: var(--red); }

/* 单元格内状态条 */
.adm-status-line { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.adm-signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.adm-signal i { display: block; width: 3px; border-radius: 1px; background: #d3d6db; }
.adm-signal i:nth-child(1) { height: 4px; } .adm-signal i:nth-child(2) { height: 7px; }
.adm-signal i:nth-child(3) { height: 10px; } .adm-signal i:nth-child(4) { height: 14px; }
.adm-signal i.on { background: var(--green); }
.adm-signal.bad i.on { background: var(--red); }

/* ---------------- 分页 ---------------- */
.adm-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; }
.adm-pager-info { font-size: 12.5px; color: var(--muted); }
.adm-pager-info b { color: var(--ink-2); }
.adm-pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-pager-btns .btn { height: 28px; padding: 0 10px; font-size: 12.5px; min-width: 30px; }
.adm-pager-gap { color: var(--muted); padding: 0 2px; }

/* ---------------- 加载 / 空 / 无权限 ---------------- */
.adm-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 46px 16px; color: var(--muted); font-size: 14px; }
.adm-noperm { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.adm-noperm-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--amber-soft); color: #a86a00; display: flex; align-items: center; justify-content: center; }
.adm-noperm-title { font-size: 18px; font-weight: 800; }
.adm-noperm-desc { font-size: 13.5px; color: var(--ink-3); line-height: 1.8; max-width: 460px; }
.adm-noperm-meta { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 4px; }

/* ---------------- 信息栅格 / 详情 ---------------- */
.adm-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.adm-info-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.adm-info-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-info-item { display: flex; flex-direction: column; gap: 3px; background: #fff; padding: 10px 14px; min-width: 0; }
.adm-info-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.adm-info-v { font-size: 14px; color: var(--ink); word-break: break-all; }
.adm-info-v.mono { font-family: var(--font-num); }
.adm-detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.adm-detail-name { font-size: 17px; font-weight: 800; }
.adm-detail-sub { font-size: 12.5px; color: var(--muted); }
.adm-detail-sec { margin-top: 16px; }
.adm-detail-sec > h4 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.adm-detail-sec > h4::before { content: ""; width: 3px; height: 13px; background: var(--dark); border-radius: 2px; }

/* ---------------- 表单 ---------------- */
.adm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.adm-form-grid .span-2 { grid-column: span 2; }
.adm-form-grid .field > label { font-size: 12.5px; }
.adm-form-grid .field .req { color: var(--red); margin-left: 2px; }
.adm-form-err { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.adm-form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.adm-field-note { font-size: 12px; color: var(--muted); }
.adm-modal-foot-hint { margin-right: auto; font-size: 12px; color: var(--muted); align-self: center; }

/* ---------------- 编辑表格（参数设置） ---------------- */
.adm-edit-table { width: 100%; }
.adm-edit-table thead th { background: var(--dark); color: #fff; font-size: 12.5px; padding: 9px 6px; white-space: nowrap; }
.adm-edit-table tbody td { padding: 6px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.adm-edit-table tbody tr:hover td { background: #f8f9fa; }
.adm-edit-table .input, .adm-edit-table .select { height: 32px; padding: 0 8px; font-size: 13px; text-align: center; font-family: var(--font-num); }
.adm-edit-table .input:disabled, .adm-edit-table .select:disabled { background: var(--panel-3); color: var(--ink-3); }
.adm-edit-table .input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.adm-edit-table .input[type="number"]::-webkit-outer-spin-button,
.adm-edit-table .input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.adm-edit-table .row-name { font-weight: 700; white-space: nowrap; color: var(--ink); }
.adm-edit-table .fan-cell { min-width: 74px; }
.adm-edit-table .fan-cell .adm-fan-line { display: flex; align-items: center; justify-content: center; gap: 4px; }
.adm-edit-table .fan-cell .input { width: 56px; }
.adm-fan-dot { width: 8px; height: 8px; border-radius: 50%; background: #cfd2d7; flex: 0 0 auto; }
.adm-fan-dot.on { background: var(--red); box-shadow: 0 0 0 3px rgba(229, 72, 77, .13); }
.adm-save-bar { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 14px; }
.adm-save-bar .adm-save-hint { margin-right: auto; font-size: 12px; color: var(--muted); }

/* 灯光时段编辑 */
.adm-light-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.adm-light-box { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; background: var(--panel-2); }
.adm-light-box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.adm-light-box-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.adm-schedule-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 0; }
.adm-schedule-row .input { width: 104px; height: 32px; font-family: var(--font-num); }
.adm-schedule-row .adm-sch-label { font-size: 12px; color: var(--muted); width: 46px; flex: 0 0 auto; }
.adm-light-props { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.adm-light-props .field > label { font-size: 12px; }
.adm-light-props .input { height: 32px; font-size: 13px; }

/* ---------------- 报表 ---------------- */
.adm-report-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-report-toolbar .input[type="date"] { width: 156px; height: 36px; }
.adm-chart { width: 100%; min-height: 240px; }
.adm-report-cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.adm-report-cols.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.adm-chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); padding: 2px 0 8px; }
.adm-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.adm-hbar-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 66px; align-items: center; gap: 10px; padding: 6px 0; }
.adm-hbar-label { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-hbar-track { height: 10px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.adm-hbar-fill { height: 100%; background: linear-gradient(90deg, var(--blue-2), var(--blue)); border-radius: 999px; }
.adm-hbar-val { font-family: var(--font-num); font-size: 13px; text-align: right; color: var(--ink-2); }
.adm-report-metric { display: flex; align-items: baseline; gap: 6px; }
.adm-report-metric b { font-family: var(--font-num); font-size: 21px; color: var(--ink); }
.adm-report-metric span { font-size: 12px; color: var(--muted); }

/* ---------------- 日志类型 / 结果 ---------------- */
.adm-type-tag { display: inline-flex; align-items: center; gap: 5px; }

/* ---------------- 用户头像 ---------------- */
.adm-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--dark); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.adm-user-cell { display: flex; align-items: center; gap: 10px; text-align: left; }
.adm-user-cell .adm-user-name { font-weight: 700; color: var(--ink); }
.adm-user-cell .adm-user-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); font-family: var(--font-num); }

/* ---------------- 个人中心 ---------------- */
.adm-profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.adm-profile-head { display: flex; align-items: center; gap: 16px; padding: 6px 0 4px; }
.adm-avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; flex: 0 0 auto; }
.adm-profile-name { font-size: 19px; font-weight: 800; }
.adm-profile-role { margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-notify-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; }
.adm-notify-row + .adm-notify-row { border-top: 1px dashed var(--line); }
.adm-notify-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.adm-notify-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* ---------------- 设备管理 ---------------- */
.adm-device-name { display: flex; align-items: center; gap: 10px; text-align: left; }
.adm-device-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-3); color: var(--ink-2); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.adm-device-ic.online { background: var(--green-soft); color: var(--green); }
.adm-device-ic.offline { background: var(--red-soft); color: var(--red); }
.adm-net-line { font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.adm-net-line .mono { color: var(--ink-2); }
.adm-mqtt-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.adm-mqtt-chip .muted { font-size: 11.5px; }

/* ---------------- 桌面/移动双布局辅助 ---------------- */
.adm-only-mobile { display: none; }

/* 通风级别移动端卡片 */
.adm-level-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 13px; background: #fff; }
.adm-level-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.adm-level-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.adm-level-fields .field > label { font-size: 11.5px; }
.adm-level-fields .input { height: 32px; font-size: 13px; font-family: var(--font-num); text-align: center; }
.adm-level-fan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; margin-top: 4px; }
.adm-fan-input { display: flex; align-items: center; gap: 5px; }
.adm-fan-input .input { height: 30px; padding: 0 6px; font-size: 12.5px; width: 100%; min-width: 0; }
.adm-fan-input .tiny { white-space: nowrap; }

/* ---------------- 移动端：表格转卡片 ---------------- */
@media (max-width: 820px) {
  .adm-page { gap: 12px; }
  .adm-only-desktop { display: none !important; }
  .adm-only-mobile { display: flex; flex-direction: column; gap: 10px; }
  .adm-level-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-level-fan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-card .card-head { flex-wrap: wrap; padding: 14px 14px 8px; }
  .adm-card .card-head .adm-card-tools { width: 100%; }
  .adm-card .card-head .adm-card-tools .adm-search { flex: 1 1 auto; width: 100%; }
  .adm-card .card-head .adm-card-tools .btn { flex: 0 0 auto; }
  .adm-card .card-body { padding: 4px 14px 16px; }
  .adm-search { width: 100%; }
  .adm-tabs { width: 100%; display: flex; }
  .adm-tabs button { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 12.5px; white-space: nowrap; }
  .adm-fan-input .input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
  .adm-fan-input .input[type="number"]::-webkit-outer-spin-button,
  .adm-fan-input .input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .adm-edit-table .input[type="number"] { -moz-appearance: textfield; }
  .adm-head { align-items: flex-start; gap: 10px; }
  .adm-title { font-size: 19px; }
  .adm-sub { font-size: 12px; }
  .adm-head-tools { width: 100%; }
  .adm-head-tools .btn { flex: 1 1 auto; }

  .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .adm-stat { padding: 12px 13px; gap: 10px; }
  .adm-stat .stat .v { font-size: 21px; }
  .adm-stat-ic { width: 36px; height: 36px; border-radius: 10px; }

  .adm-toolbar { gap: 8px; }
  .adm-toolbar .field { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .adm-toolbar .field .select, .adm-toolbar .field .input { width: 100%; }
  .adm-toolbar .btn { flex: 1 1 auto; }
  .adm-inline-field { flex: 1 1 100%; }
  .adm-inline-field .select { flex: 1 1 auto; width: 100%; }

  .adm-table-wrap { overflow: visible; }
  .adm-table { display: block; }
  .adm-table thead { display: none; }
  .adm-table tbody { display: block; }
  .adm-table tbody tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 4px 13px; margin-bottom: 10px; }
  .adm-table tbody tr:hover td { background: transparent; }
  .adm-table tbody tr.adm-tr-empty { border: 0; padding: 0; }
  .adm-table tbody td { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); text-align: right; white-space: normal; font-size: 13px; }
  .adm-table tbody td:last-child { border-bottom: 0; }
  .adm-table tbody td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; flex: 0 0 auto; padding-top: 1px; }
  .adm-table tbody td.col-actions::before { content: ""; }
  .adm-table tbody td.col-actions { justify-content: flex-end; padding-top: 10px; }
  .adm-table tbody td.col-actions .adm-actions { flex-wrap: wrap; justify-content: flex-end; }
  .adm-table tbody td.col-actions .btn { height: 30px; }
  .adm-table .adm-cell-sub { text-align: right; }
  .adm-table tbody tr.adm-tr-empty td { display: block; text-align: center; border: 0; }
  .adm-table tbody tr.adm-tr-empty td::before { content: ""; }

  .adm-info-grid, .adm-info-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .adm-form-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .adm-form-grid .span-2 { grid-column: auto; }
  .adm-report-cols, .adm-report-cols.wide-left, .adm-profile-grid { grid-template-columns: minmax(0, 1fr); }
  .adm-light-grid { grid-template-columns: minmax(0, 1fr); }
  .adm-light-props { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-pager { justify-content: center; }
  .adm-pager-info { width: 100%; text-align: center; }
  .adm-chart { min-height: 200px; }
  .adm-report-toolbar .seg { width: 100%; }
  .adm-report-toolbar .seg button { flex: 1 1 0; padding: 0 6px; }
}

@media (max-width: 420px) {
  .adm-head-tools .btn { width: 100%; }
  .adm-stat { padding: 11px 12px; }
  .adm-stat .stat .v { font-size: 19px; }
  .adm-stat-ic { display: none; }
  .adm-light-props { grid-template-columns: minmax(0, 1fr); }
}
