@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700;800&family=Nunito+Sans:wght@400;500;600;700;800&family=Rubik:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg-page: #f3f5f9;
  --bg-surface: #ffffff;
  --bg-soft: #f7f9fc;
  --bg-hover: #eef4ff;
  --line: #e5eaf3;
  --line-strong: #d6deeb;
  --text: #20293a;
  --text-muted: #69778d;
  --primary: #2f7cf6;
  --primary-pressed: #1f69df;
  --ok: #12a150;
  --warn: #f59f3a;
  --danger: #e44747;
  --font-size-caption: 13px;
  --font-size-base: 14px;
  --font-size-body: 15px;
  --font-size-title: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg-page);
  color: var(--text);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

.pc-global-nav {
  position: relative;
  min-height: 56px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(246, 249, 255, 0.94) 100%);
  color: #1f2b40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(214, 222, 235, 0.95);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
  backdrop-filter: blur(10px);
}

.pc-global-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 160% at 0% 20%, rgba(47, 124, 246, 0.18) 0%, rgba(47, 124, 246, 0) 60%),
    radial-gradient(70% 140% at 100% 0%, rgba(18, 161, 80, 0.08) 0%, rgba(18, 161, 80, 0) 55%);
  pointer-events: none;
}

.pc-global-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
}

.pc-global-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #1f2b40;
}

.pc-global-brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #56a2ff 0%, #2f7cf6 100%);
  box-shadow: 0 0 0 6px rgba(47, 124, 246, 0.14);
}

.pc-global-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5e6f8b;
  font-size: 14px;
  font-weight: 600;
}

.pc-global-menu span {
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.pc-global-menu span.active {
  color: #1f69df;
  border-color: rgba(47, 124, 246, 0.28);
  background: rgba(47, 124, 246, 0.12);
}

.pc-global-menu span:hover {
  color: #1f69df;
  background: rgba(47, 124, 246, 0.08);
}

.pc-global-menu span#nav_buy {
  cursor: pointer;
}

.pc-global-menu span#nav_buy:hover {
  color: #1f69df;
  border-color: rgba(47, 124, 246, 0.22);
  background: rgba(47, 124, 246, 0.08);
}

.pc-global-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pc-nav-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  font-weight: 700;
}

.pc-nav-btn:hover {
  border-color: rgba(47, 124, 246, 0.28);
  background: linear-gradient(180deg, rgba(246, 249, 255, 0.95) 0%, rgba(238, 244, 255, 0.95) 100%);
  color: #1f69df;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

label {
  display: block;
  color: var(--text-muted);
  font-size: var(--font-size-base);
  line-height: 1.4;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-size: var(--font-size-base);
  line-height: 1.45;
}

select {
  /* Make select behave consistently across browsers/resolutions (arrow spacing, shrink-to-fit). */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px; /* reserve room for arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%235c6b82' d='M7.41 8.58 12 13.17l4.59-4.59L18 10l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keep native UI for multi-select/listbox. */
select[multiple],
select[size] {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  background-image: none;
  padding-right: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #9cc0ff;
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.15);
}

button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: var(--font-size-base);
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

button:hover {
  background: var(--primary-pressed);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #fff;
  color: #4f5f77;
  border-color: var(--line-strong);
}

button.secondary:hover {
  background: var(--bg-soft);
}

.pc-global-actions .pc-nav-btn {
  border-color: rgba(214, 222, 235, 0.95);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(246, 249, 255, 0.92) 100%);
  color: #40516a;
  box-shadow: 0 10px 18px rgba(16, 24, 40, 0.08);
}

.pc-global-actions .pc-nav-btn:hover {
  border-color: rgba(47, 124, 246, 0.28);
  background: linear-gradient(180deg, rgba(246, 249, 255, 0.95) 0%, rgba(238, 244, 255, 0.95) 100%);
  color: #1f69df;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bar .sel {
  width: min(220px, 100%);
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  font-size: var(--font-size-base);
  white-space: nowrap;
}

th {
  color: #4f5f77;
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
  font-size: var(--font-size-caption);
}

.sel {
  height: 38px;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 38px;
}

code {
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: var(--font-size-caption);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--font-size-caption);
  border: 1px solid var(--line-strong);
  color: #4f5f77;
  background: #f8fafc;
}

.chip.ok {
  color: #06753a;
  border-color: #bde8ce;
  background: #ecf9f1;
}

.chip.warn {
  color: #9d5d11;
  border-color: #f4d7b2;
  background: #fff7eb;
}

.chip.mute {
  color: #69778d;
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 36px rgba(25, 37, 58, 0.12);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  max-width: min(90vw, 640px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2600;
}

.group-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.group-picker-mask {
  position: absolute;
  inset: 0;
  background: rgba(12, 19, 35, 0.46);
}

.group-picker-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(var(--h5-vh, 100vh) - 32px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid #dbe4f4;
  background: #fff;
  box-shadow: 0 24px 56px rgba(18, 32, 58, 0.25);
  padding: 16px;
}

.group-picker-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1f2b40;
}

.group-picker-desc {
  margin-top: 8px;
  color: #5e6f8b;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.group-picker-fields {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.group-picker-field label {
  display: block;
  margin-bottom: 6px;
  color: #5e6f8b;
  font-size: 13px;
}

.group-picker-field select {
  margin-top: 0;
}

.group-picker-field input {
  margin-top: 0;
}

.group-picker-field textarea {
  margin-top: 0;
}

.group-picker-error {
  margin-top: 10px;
  color: #cf3434;
  font-size: 13px;
}

.group-picker-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* User PC */
.user-shell {
  min-height: calc(100vh - 56px);
}

.pc-shell {
  display: grid;
  grid-template-columns: 1fr;
  background: #f2f4f8;
}

.user-sidebar {
  border-right: 1px solid #dbe2ef;
  background: #f4f6fb;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-brand-main {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.user-brand-sub {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--font-size-caption);
}

.user-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: #4b5e7c;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.user-nav-item:hover {
  background: #eef4ff;
  color: #245fc7;
}

.user-nav-item.active {
  background: #e9f1ff;
  color: #1d57bd;
  border-color: #cdddf8;
}

.user-side-foot {
  margin-top: auto;
  border-top: 1px dashed var(--line-strong);
  padding-top: 12px;
}

.dot-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-caption);
  color: #16884a;
}

.dot-online::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1cb35f;
  box-shadow: 0 0 0 4px rgba(25, 186, 98, 0.18);
}

.user-main {
  padding: 14px 16px 18px;
}

.user-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.crumb {
  color: #8c99ad;
  font-size: var(--font-size-caption);
}

.page-title {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
}

.auth-card {
  max-width: 760px;
}

.auth-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-main-actions {
  padding: 0 2px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pc-main-search {
  margin-left: auto;
  gap: 8px;
  flex-wrap: nowrap;
}

.pc-main-search input {
  width: clamp(220px, 24vw, 420px);
  margin-top: 0;
  height: 36px;
}

.pc-panel {
  display: none;
}

.pc-panel.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  border-color: #dde6f4;
}

.kpi-label {
  color: #75849b;
  font-size: var(--font-size-caption);
}

.kpi-value {
  margin-top: 6px;
  font-size: 34px;
  font-weight: 800;
  color: #1f365a;
}

.profile-card {
  margin-top: 12px;
}

.profile-title {
  color: #76859b;
  font-size: var(--font-size-caption);
}

.profile-name {
  margin: 6px 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.section-card {
  min-height: 160px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-entry-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-entry {
  height: 44px;
  background: #f8fbff;
  color: #3d5370;
  border: 1px solid var(--line);
}

.quick-entry:hover {
  background: #edf4ff;
}

.pc-console {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  min-height: 680px;
}

.pc-group-pane {
  padding: 10px;
  border-radius: 10px;
}

.pc-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pc-group-head h3 {
  font-size: 16px;
}

.pc-group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-group-actions button {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: var(--font-size-caption);
}

.pc-check-list {
  margin-top: 6px;
  max-height: calc(100vh - 280px);
  overflow: auto;
  padding-right: 4px;
}

.pc-check-row {
  width: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: #2b3950;
  font-size: 14px;
}

.pc-check-row:hover {
  background: #eef3fb;
}

.pc-check-row input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.pc-check-text {
  flex: 1;
  cursor: text;
}

.pc-check-dot {
  font-style: normal;
  font-size: var(--font-size-caption);
  color: #73839c;
}

.pc-check-dot.online {
  color: #0f9647;
}

.pc-check-dot.idle {
  color: #7f8da1;
}

.pc-check-all {
  border: 1px solid var(--line);
  background: #fafcff;
}

.pc-device-pane {
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc-device-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.pc-device-pager-left {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.pc-device-pager-mid {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex: 1;
}

.pc-device-pager-info {
  color: var(--text-muted);
  font-size: var(--font-size-caption);
  white-space: nowrap;
}

.pc-device-pager-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.pc-device-pager-jump {
  width: 70px;
  max-width: 90px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
}

.pc-device-pager-jump:focus {
  border-color: rgba(47, 124, 246, 0.8);
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.16);
}

.pc-device-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.pc-device-title {
  margin-top: 0;
  margin-right: 4px;
  white-space: nowrap;
}

.pc-device-actions {
  margin-left: calc(260px + 24px - 160px);
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.device-list {
  display: grid;
  gap: 10px;
}

body[data-mode="pc"] .device-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.device-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.device-card.selected {
  border-color: #2f7cf6;
  box-shadow:
    inset 0 0 0 4px rgba(47, 124, 246, 0.95),
    0 0 0 2px rgba(47, 124, 246, 0.7),
    0 10px 24px rgba(39, 79, 155, 0.24);
}

.device-preview {
  position: relative;
  height: 180px;
  background: radial-gradient(120% 100% at 50% 10%, #152033 0%, #111927 42%, #0b1019 100%);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.device-preview::after {
  content: "● ● ●";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  letter-spacing: 5px;
  color: rgba(255, 255, 255, 0.36);
}

.device-preview.has-thumb {
  background: #0b111c;
}

.device-preview.has-thumb::after {
  display: none;
}

.device-thumb-frame,
.device-thumb-img {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  pointer-events: none;
}

.device-thumb-img {
  display: block;
  position: absolute;
  inset: 0;
  object-fit: contain;
}

.thumb-pending {
  position: absolute;
  left: 12px;
  top: 12px;
  right: 12px;
  z-index: 3;
  font-size: var(--font-size-caption);
  color: rgba(255, 255, 255, 0.86);
}

.preview-gear {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: rgba(10, 13, 19, 0.75);
  color: #fff;
  padding: 0;
  z-index: 5;
}

.preview-gear-icon {
  width: 58%;
  height: 58%;
  display: block;
  fill: currentColor;
}

.preview-plan {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 5;
  border-radius: 999px;
  border: 0;
  background: rgba(3, 6, 12, 0.65);
  color: #f4f7ff;
  font-size: var(--font-size-caption);
  padding: 3px 8px;
  box-shadow: none;
}

.preview-lease {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 12px 10px;
  background: linear-gradient(180deg, rgba(8, 12, 19, 0) 0%, rgba(8, 12, 19, 0.88) 68%);
  z-index: 4;
}

.preview-lease strong {
  display: block;
  font-size: 30px;
}

.preview-lease span {
  font-size: 13px;
  opacity: 0.85;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  --preview-strip-size: 44px;
}

.preview-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 19, 0.72);
}

.preview-modal-card {
  position: absolute;
  z-index: 1;
  width: min(560px, calc(100vw - 24px));
  height: min(920px, calc(100vh - 24px));
  left: 12px;
  top: 12px;
  background: #050608;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.58);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-modal-resize-handle {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  z-index: 5;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  cursor: nwse-resize;
  touch-action: none;
  padding: 0;
}

.preview-modal-resize-handle::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  background:
    linear-gradient(135deg, transparent 0 45%, rgba(255, 255, 255, 0.78) 45% 56%, transparent 56% 100%),
    linear-gradient(135deg, transparent 0 68%, rgba(255, 255, 255, 0.6) 68% 78%, transparent 78% 100%);
  opacity: 0.86;
}

.preview-modal-resize-handle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.preview-modal-resize-handle:active {
  background: rgba(255, 255, 255, 0.2);
}

.preview-modal-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr var(--preview-strip-size);
}

.preview-modal-head {
  display: grid;
  grid-template-columns: 1fr var(--preview-strip-size);
  align-items: center;
  min-height: var(--preview-strip-size);
  padding: 0 12px;
  border-bottom: 0;
  background: linear-gradient(180deg, #0b0c11 0%, #06070b 100%);
  cursor: move;
  user-select: none;
}

.preview-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #f2f5ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.preview-modal-actions {
  display: none;
}

.preview-modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.07);
  color: #f0f4ff;
  font-size: 22px;
  line-height: 1;
  justify-self: center;
  margin-right: 0;
  transform: translateX(12px);
  cursor: pointer;
}

.preview-modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.preview-modal-close:active {
  /* Keep the right offset while applying the global button active press. */
  transform: translateX(12px) translateY(1px);
}

.preview-modal-body {
  background: #000;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

.preview-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  display: block;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.preview-modal.is-loading .preview-modal-frame {
  opacity: 0;
}

.preview-modal-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.preview-modal.is-loading .preview-modal-loading {
  opacity: 1;
  pointer-events: auto;
}

/* PC: keep close/tools clickable even while loading overlay is visible. */
.preview-modal:not(.preview-modal-h5).is-loading .preview-modal-loading {
  pointer-events: none;
}

.preview-modal-loading-bg {
  position: absolute;
  inset: -12px;
  background: #000 center / cover no-repeat;
  filter: blur(18px) saturate(1.15);
  transform: scale(1.08);
  opacity: 0.55;
}

.preview-modal-loading-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 520px at 40% 30%, rgba(12, 18, 30, 0.10) 0%, rgba(4, 5, 8, 0.88) 65%),
    linear-gradient(180deg, rgba(4, 5, 8, 0.92) 0%, rgba(4, 5, 8, 0.55) 55%, rgba(4, 5, 8, 0.85) 100%);
}

.preview-modal-loading-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(6, 7, 11, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(10px);
}

.preview-modal-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(242, 245, 255, 0.92);
  animation: previewSpin 1s linear infinite;
}

.preview-modal-loading-text {
  color: rgba(242, 245, 255, 0.92);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

@keyframes previewSpin {
  to { transform: rotate(360deg); }
}

.preview-modal-tools {
  position: relative;
  background: linear-gradient(
    to top,
    #1d0052 0%,
    #120837 34%,
    #07080d 58%,
    #06070b 100%
  );
  border-left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.06);
}

.preview-tools-main {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preview-tools-top {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preview-tools-nav-bottom {
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-modal:not(.preview-modal-h5) .preview-tools-nav-bottom {
  margin-bottom: 18px;
}

.preview-modal-tools::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 52%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

.preview-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(2, 4, 10, 0.42);
  color: #f0f4ff;
  font-size: 16px;
  font-weight: 600;
  padding: 0;
  line-height: 1;
  backdrop-filter: blur(3px);
}

.preview-tool-btn.preview-tool-btn-text {
  width: auto;
  min-width: 34px;
  padding: 0 7px;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.preview-tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.preview-modal-foot {
  display: none;
}

.preview-modal-left {
  display: none;
}

.preview-modal.preview-modal-h5 {
  --preview-h5-right: 56px;
  --preview-h5-right-tab: 48px;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--h5-modal-vh, 100dvh);
}

.preview-modal.preview-modal-h5 .preview-modal-mask {
  background: rgba(0, 0, 0, 0.9);
}

.preview-modal.preview-modal-h5 .preview-modal-card {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: var(--h5-modal-vh, 100dvh);
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}

.preview-modal.preview-modal-h5 .preview-modal-resize-handle {
  display: none;
}

.preview-modal.preview-modal-h5 .preview-modal-stage {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: var(--h5-modal-vh, 100dvh);
  display: block;
}

.preview-modal.preview-modal-h5 .preview-modal-body {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: var(--h5-modal-vh, 100dvh);
  z-index: 1;
  overflow: hidden;
}

.preview-modal.preview-modal-h5 .preview-modal-left {
  display: none;
}

.preview-modal.preview-modal-h5 .preview-modal-tools.preview-modal-tools-h5 {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--preview-h5-right);
  z-index: 3;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 6px) 10px 6px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.preview-modal.preview-modal-h5 .preview-modal-tools::before {
  display: none;
}

.preview-modal.preview-modal-h5 .preview-tools-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.preview-modal.preview-modal-h5 .preview-tools-top {
  gap: 10px;
}

.preview-modal.preview-modal-h5 .preview-tools-nav-bottom {
  gap: 10px;
  border-top-color: transparent;
}

.preview-modal.preview-modal-h5 .preview-tool-btn.preview-tool-btn-h5 {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(145deg, rgba(98, 113, 134, 0.94) 0%, rgba(66, 79, 98, 0.92) 100%);
  box-shadow: none;
  backdrop-filter: none;
  font-size: 16px;
  color: #fff;
}

.preview-modal.preview-modal-h5 .preview-tool-btn.preview-tool-btn-h5:hover {
  background: linear-gradient(145deg, rgba(112, 127, 149, 0.96) 0%, rgba(76, 89, 109, 0.94) 100%);
}

.preview-modal.preview-modal-h5 .preview-tool-btn.preview-tool-btn-h5:active {
  background: linear-gradient(145deg, rgba(84, 98, 119, 0.96) 0%, rgba(58, 70, 88, 0.95) 100%);
  box-shadow: none;
}

.preview-modal.preview-modal-h5 .preview-tool-btn.preview-tool-btn-h5.preview-tool-btn-text {
  width: auto;
  min-width: 42px;
  padding: 0 8px;
  font-size: 11px;
  letter-spacing: 0;
}

.preview-modal.preview-modal-h5 .preview-floating-nav {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 8;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  user-select: none;
}

.preview-modal.preview-modal-h5 .preview-floating-nav.is-dragging {
  opacity: 0.9;
}

.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5 {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.95);
  padding: 0;
}

.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5.preview-floating-tool-action {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(98, 113, 134, 0.96) 0%, rgba(66, 79, 98, 0.94) 100%);
  box-shadow: 0 8px 16px rgba(10, 18, 28, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
}

.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5:hover,
.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5:active {
  background: transparent;
  box-shadow: none;
}

.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5.preview-floating-tool-action:hover {
  background: linear-gradient(145deg, rgba(112, 127, 149, 0.98) 0%, rgba(76, 89, 109, 0.95) 100%);
  box-shadow: 0 10px 18px rgba(10, 18, 28, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5.preview-floating-tool-action:active {
  background: linear-gradient(145deg, rgba(84, 98, 119, 0.96) 0%, rgba(58, 70, 88, 0.95) 100%);
  box-shadow: 0 6px 12px rgba(10, 18, 28, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.preview-modal.preview-modal-h5 .preview-floating-nav .preview-tool-btn.preview-tool-btn-h5.preview-floating-tool-drag {
  cursor: grab;
}

.preview-modal.preview-modal-h5 .preview-floating-nav.is-dragging .preview-tool-btn.preview-tool-btn-h5.preview-floating-tool-drag {
  cursor: grabbing;
}

.preview-modal.preview-modal-h5 .preview-latency {
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(145deg, rgba(98, 113, 134, 0.92) 0%, rgba(66, 79, 98, 0.9) 100%);
  color: #fff;
  box-shadow: none;
  font-size: var(--font-size-caption);
  font-weight: 700;
  line-height: 48px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.preview-modal.preview-modal-h5.right-collapsed .preview-modal-tools.preview-modal-tools-h5 {
  width: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  overflow: visible;
  pointer-events: none;
}

.preview-modal.preview-modal-h5.right-collapsed .preview-tools-main {
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  visibility: hidden;
}

.preview-modal.preview-modal-h5.right-collapsed .preview-latency {
  display: block;
  position: fixed;
  right: calc(env(safe-area-inset-right) + 13px);
  top: calc(env(safe-area-inset-top) + 10px);
  width: 42px;
  height: 42px;
  line-height: 42px;
  border-radius: 12px;
  z-index: 9;
  background: linear-gradient(145deg, rgba(98, 113, 134, 0.94) 0%, rgba(66, 79, 98, 0.92) 100%);
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
}

.preview-modal.preview-modal-h5.right-collapsed #preview_tool_tools_toggle {
  display: none;
}

.device-body {
  padding: 12px;
}

.device-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.device-id {
  color: #8090a8;
  font-size: var(--font-size-caption);
}

.device-serial {
  margin-top: 3px;
  color: #253b5c;
  font-size: 14px;
  font-weight: 600;
}

.device-meta {
  margin-top: 8px;
  color: #7789a4;
  font-size: var(--font-size-caption);
  line-height: 1.55;
}

.device-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.device-actions button {
  padding: 8px 10px;
  font-size: var(--font-size-caption);
}

body[data-mode="pc"] .pc-device-grid .device-preview {
  width: 144px;
  height: 256px;
  margin: 0 auto;
  border-radius: 10px;
}

body[data-mode="pc"] .pc-device-grid {
  grid-template-columns: repeat(auto-fill, 144px);
  justify-content: flex-start;
  gap: 12px;
}

body[data-mode="pc"] .pc-device-grid .device-card {
  width: 144px;
  border-radius: 10px;
}

body[data-mode="pc"] .pc-device-grid .preview-plan {
  left: 6px;
  top: 6px;
  padding: 2px 6px;
  font-size: 12px;
}

body[data-mode="pc"] .pc-device-grid .preview-gear {
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  font-size: 15px;
}

body[data-mode="pc"] .pc-device-grid .thumb-pending {
  left: 8px;
  top: 8px;
  right: 8px;
  font-size: 12px;
}

body[data-mode="pc"] .pc-device-grid .preview-lease {
  padding: 8px 8px 7px;
}

body[data-mode="pc"] .pc-device-grid .preview-lease strong {
  font-size: var(--font-size-caption);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-mode="pc"] .pc-device-grid .preview-lease span {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium {
  grid-template-columns: repeat(auto-fill, 216px);
  gap: 14px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .device-card {
  width: 216px;
  border-radius: 12px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .device-preview {
  width: 216px;
  height: 384px;
  border-radius: 12px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .preview-plan {
  left: 8px;
  top: 8px;
  padding: 3px 8px;
  font-size: 13px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .preview-gear {
  right: 8px;
  top: 8px;
  width: 26px;
  height: 26px;
  font-size: 16px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .thumb-pending {
  left: 10px;
  top: 10px;
  right: 10px;
  font-size: 13px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .preview-lease {
  padding: 10px 10px 8px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .preview-lease strong {
  font-size: 14px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-medium .preview-lease span {
  font-size: 13px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large {
  grid-template-columns: repeat(auto-fill, 288px);
  gap: 16px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .device-card {
  width: 288px;
  border-radius: 14px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .device-preview {
  width: 288px;
  height: 512px;
  border-radius: 14px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .preview-plan {
  left: 10px;
  top: 10px;
  padding: 4px 10px;
  font-size: 14px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .preview-gear {
  right: 10px;
  top: 10px;
  width: 30px;
  height: 30px;
  font-size: 17px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .thumb-pending {
  left: 12px;
  top: 12px;
  right: 12px;
  font-size: 14px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .preview-lease {
  padding: 12px 12px 10px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .preview-lease strong {
  font-size: 16px;
}

body[data-mode="pc"] .pc-device-grid.pc-view-large .preview-lease span {
  font-size: 13px;
}

/* H5 */
body[data-mode="h5"] {
  --h5-primary: #ff2442;
  --h5-secondary: #fb7185;
  --h5-accent: #e61e3c;
  --h5-ink: #2a2330;
  --h5-muted: #74687f;
  --h5-card-bg: rgba(255, 255, 255, 0.94);
  --h5-card-border: rgba(236, 231, 238, 0.96);
  --h5-shadow: 0 14px 30px rgba(198, 33, 67, 0.12);
  --h5-soft: #fff1f4;
  --h5-soft-2: #fff7f9;
  --h5-control-bg: rgba(255, 255, 255, 0.95);
  --h5-control-border: rgba(226, 219, 228, 0.96);
  --h5-control-text: #4f435a;
  --h5-control-muted: #7d7287;
  --h5-control-active-bg: #fff1f4;
  --h5-control-active-border: rgba(255, 36, 66, 0.28);
  --h5-control-active-text: #b51f3b;
  --h5-thumb-w: 144px;
  --h5-thumb-h: 256px;
  background: #f3f4f7;
  color: var(--h5-ink);
  min-height: var(--h5-vh, 100vh);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
  font-family: "Rubik", "Nunito Sans", "Noto Sans SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body[data-mode="h5"] .group-picker-field input,
body[data-mode="h5"] .group-picker-field textarea,
body[data-mode="h5"] .group-picker-field select {
  font-size: 16px;
}

.h5-root {
  position: relative;
  min-height: var(--h5-vh, 100vh);
  isolation: isolate;
}

.h5-ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.h5-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(1px);
  opacity: 0.75;
}

.h5-orb-a {
  width: 280px;
  height: 280px;
  top: -130px;
  right: -60px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 36, 66, 0.24), rgba(255, 36, 66, 0.06) 62%, rgba(255, 36, 66, 0) 74%);
}

.h5-orb-b {
  width: 220px;
  height: 220px;
  top: 32%;
  left: -110px;
  background: radial-gradient(circle at 45% 45%, rgba(251, 113, 133, 0.2), rgba(251, 113, 133, 0.05) 65%, rgba(251, 113, 133, 0) 74%);
}

.h5-orb-c {
  width: 260px;
  height: 260px;
  bottom: -160px;
  right: -90px;
  background: radial-gradient(circle at 40% 42%, rgba(221, 198, 210, 0.28), rgba(221, 198, 210, 0.05) 68%, rgba(221, 198, 210, 0) 76%);
}

.h5-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: var(--h5-vh, 100vh);
  padding: 14px calc(env(safe-area-inset-right) + 14px) 10px calc(env(safe-area-inset-left) + 14px);
}

.h5-main {
  padding-bottom: 2px;
}

.h5-login-shell {
  padding-top: max(18px, calc(env(safe-area-inset-top) + 6px));
}

.h5-login {
  margin-top: 8px;
  border-radius: 22px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.h5-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.h5-login-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--h5-primary) 0%, var(--h5-secondary) 100%);
  box-shadow: 0 0 0 10px rgba(255, 36, 66, 0.12);
}

.h5-login-title {
  margin: 0;
  color: var(--h5-ink);
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0.1px;
}

.h5-login-sub {
  margin-top: 4px;
  font-size: 13px;
}

.h5-code-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.h5-topbar {
  position: static;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: 2px 2px 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--h5-card-border);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.h5-toolbar-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.h5-toolbar-row-main {
  gap: 10px;
}

.h5-toolbar-row-filters {
  align-items: stretch;
}

.h5-toolbar-row-group {
  align-items: stretch;
}

.h5-toolbar-row-drive-return {
  margin-top: -2px;
}

.h5-view-filter {
  position: relative;
  flex: 1;
  min-width: 0;
}

.h5-view-filter > .h5-filter-btn {
  width: 100%;
}

.h5-search-box {
  flex: 1;
  min-width: 0;
  height: 54px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--h5-control-border);
  background: var(--h5-control-bg);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.h5-search-box:focus-within {
  border-color: var(--h5-control-active-border);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.16);
}

.h5-search-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  fill: var(--h5-control-muted);
}

.h5-search-box input {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--h5-control-text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
}

.h5-search-box input::placeholder {
  color: #a495ab;
}

.h5-search-box input:focus {
  border: 0;
  box-shadow: none;
}

.h5-round-btn {
  width: 54px;
  height: 54px;
  min-width: 54px;
  min-height: 54px;
  border-radius: 999px;
  border: 1px solid var(--h5-control-border);
  background: var(--h5-control-bg);
  color: var(--h5-control-text);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.h5-round-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.h5-batch-btn {
  min-width: 108px;
  height: 54px;
  min-height: 54px;
  border: 1px solid var(--h5-control-border);
  border-radius: 999px;
  background: var(--h5-control-bg);
  color: var(--h5-control-active-text);
  padding: 0 22px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
}

.h5-batch-btn.active {
  background: var(--h5-control-active-bg);
  border-color: var(--h5-control-active-border);
  color: var(--h5-control-active-text);
}

.h5-filter-btn {
  flex: 1;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--h5-control-border);
  background: var(--h5-control-bg);
  color: var(--h5-control-text);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
}

.h5-filter-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.h5-filter-btn span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h5-caret {
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--h5-control-muted);
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}

.h5-filter-btn.active .h5-caret {
  transform: rotate(180deg);
}

.h5-group-btn {
  flex: 1;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--h5-control-border);
  background: var(--h5-control-bg);
  color: var(--h5-control-text);
  padding: 0 10px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.h5-group-btn.active {
  border-color: var(--h5-control-active-border);
  background: rgba(255, 36, 66, 0.1);
  color: var(--h5-control-active-text);
}

.h5-group-btn.h5-group-btn-primary {
  border-color: var(--h5-control-active-border);
  background: linear-gradient(135deg, #ff5f72 0%, #ff7d58 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(255, 95, 114, 0.18);
}

.h5-group-btn.h5-group-btn-upload {
  border-color: rgba(255, 122, 69, 0.36);
  background: linear-gradient(135deg, rgba(255, 122, 69, 0.14) 0%, rgba(255, 36, 66, 0.08) 100%);
  color: #f24b30;
}

.h5-group-btn:disabled,
.h5-group-btn.is-disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.h5-drive-return-toolbar-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff3656 0%, #ff2442 100%);
  color: #fff;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 24px rgba(255, 36, 66, 0.2);
}

.h5-drive-return-toolbar-btn:disabled {
  opacity: 0.56;
  box-shadow: none;
}


.h5-view-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 35;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--h5-control-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 26px rgba(42, 35, 48, 0.15);
  display: grid;
  gap: 6px;
  backdrop-filter: blur(6px);
}

.h5-view-menu-item {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--h5-soft-2);
  color: var(--h5-control-text);
  padding: 8px 10px;
  text-align: left;
  display: grid;
  gap: 1px;
  justify-items: start;
}

.h5-view-menu-item-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.h5-view-menu-item-meta {
  font-size: 12px;
  line-height: 1.2;
  color: var(--h5-muted);
}

.h5-view-menu-item.active {
  border-color: var(--h5-control-active-border);
  background: var(--h5-control-active-bg);
  color: var(--h5-control-active-text);
}

.h5-view-menu-item.active .h5-view-menu-item-meta {
  color: var(--h5-control-active-text);
}

.h5-refresh-btn {
  position: relative;
  overflow: hidden;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  border-color: rgba(255, 64, 98, 0.45);
  background: linear-gradient(145deg, #ff5c76 0%, #ff2f58 100%);
  color: #fff;
  box-shadow: 0 8px 14px rgba(255, 47, 88, 0.16);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
}

.h5-refresh-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0) 80%);
  transform: translateX(-120%);
  transition: transform .38s ease;
  pointer-events: none;
}

.h5-refresh-btn .h5-refresh-icon {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}

.h5-round-btn:hover,
.h5-batch-btn:hover,
.h5-filter-btn:hover,
.h5-group-btn:hover {
  background: var(--h5-soft-2);
  border-color: var(--h5-control-active-border);
}

.h5-group-btn.is-disabled:hover {
  background: inherit;
  border-color: inherit;
}

.h5-refresh-btn:hover {
  background: linear-gradient(145deg, #ff7388 0%, #ff3f67 100%);
  border-color: rgba(255, 64, 98, 0.52);
  box-shadow: 0 10px 18px rgba(255, 47, 88, 0.2);
}

.h5-refresh-btn:hover::before {
  transform: translateX(120%);
}

.h5-refresh-btn:hover .h5-refresh-icon {
  transform: rotate(-18deg);
}

.h5-refresh-btn:active {
  background: linear-gradient(145deg, #ff4e70 0%, #ff2f58 100%);
  box-shadow: 0 5px 10px rgba(255, 47, 88, 0.2);
}

.h5-refresh-btn.is-refreshing .h5-refresh-icon {
  animation: h5-refresh-spin .9s linear infinite;
}

.h5-refresh-btn:disabled,
.h5-refresh-btn.is-refreshing {
  cursor: wait;
  opacity: .94;
}

.h5-refresh-btn:disabled::before,
.h5-refresh-btn.is-refreshing::before {
  transform: none;
  opacity: .35;
}

.h5-round-btn:active,
.h5-batch-btn:active,
.h5-filter-btn:active,
.h5-group-btn:active {
  transform: none;
  background: rgba(244, 238, 242, 0.98);
}

.h5-group-btn.is-disabled:active {
  background: inherit;
}

.h5-round-btn:focus-visible,
.h5-batch-btn:focus-visible,
.h5-filter-btn:focus-visible,
.h5-group-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.2);
}

@keyframes h5-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 420px) {
  .h5-topbar {
    padding-left: 2px;
    padding-right: 2px;
  }

  .h5-search-box {
    height: 50px;
    padding: 0 13px;
  }

  .h5-search-icon {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .h5-search-box input {
    font-size: 15px;
  }

  .h5-round-btn {
    width: 50px;
    min-width: 50px;
    height: 50px;
    min-height: 50px;
  }

  .h5-round-btn svg {
    width: 24px;
    height: 24px;
  }

  .h5-batch-btn {
    min-width: 94px;
    height: 50px;
    min-height: 50px;
    padding: 0 16px;
    font-size: 16px;
  }

  .h5-filter-btn {
    height: 46px;
    min-height: 46px;
    padding: 0 11px;
    gap: 6px;
    font-size: 14px;
  }

  .h5-filter-btn svg {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .h5-group-btn {
    height: 44px;
    min-height: 44px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 14px;
  }

  .h5-refresh-btn {
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
  }

  .h5-refresh-btn .h5-refresh-icon {
    width: 21px;
    height: 21px;
  }

  .h5-view-menu {
    border-radius: 12px;
    padding: 5px;
    gap: 5px;
  }

  .h5-view-menu-item {
    min-height: 40px;
    padding: 7px 9px;
  }

  .h5-view-menu-item-title {
    font-size: 13px;
  }

  .h5-view-menu-item-meta {
    font-size: 11px;
  }
}

.h5-panel {
  display: none;
}

.h5-panel.active {
  display: block;
}

.h5-field {
  margin: 0;
}

.h5-field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--h5-muted);
  font-size: 13px;
  font-weight: 600;
}

.h5-select {
  margin-top: 0;
  height: 44px;
  line-height: 44px;
  border-radius: 12px;
  border-color: var(--h5-control-border);
  background-color: var(--h5-control-bg);
  font-size: 14px;
}

.h5-device-list {
  --h5-grid-cols: 3;
  --h5-grid-gap: 10px;
  --h5-grid-radius: 14px;
  --h5-meta-font: 11px;
  width: 100%;
  grid-template-columns: repeat(var(--h5-grid-cols), minmax(0, 1fr));
  gap: var(--h5-grid-gap);
  align-items: start;
}

.h5-device-list.h5-view-large {
  --h5-grid-cols: 2;
  --h5-grid-gap: 12px;
  --h5-grid-radius: 16px;
  --h5-meta-font: 12px;
}

.h5-device-list.h5-view-medium {
  --h5-grid-cols: 3;
  --h5-grid-gap: 10px;
  --h5-grid-radius: 14px;
  --h5-meta-font: 11px;
}

.h5-device-list.h5-view-small {
  --h5-grid-cols: 4;
  --h5-grid-gap: 8px;
  --h5-grid-radius: 12px;
  --h5-meta-font: 10px;
}

body[data-mode="h5"] .h5-device-list .device-card {
  width: 100%;
  min-width: 0;
  border-radius: var(--h5-grid-radius);
  overflow: hidden;
  border: 1px solid var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: 0 6px 14px rgba(42, 35, 48, 0.06);
}

body[data-mode="h5"] .h5-device-list .device-card.selected {
  border-color: rgba(255, 36, 66, 0.95);
  box-shadow:
    inset 0 0 0 3px rgba(255, 36, 66, 0.88),
    0 0 0 2px rgba(255, 36, 66, 0.28),
    0 12px 24px rgba(198, 33, 67, 0.18);
}

body[data-mode="h5"] .h5-device-list .device-preview {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 16;
  border-radius: var(--h5-grid-radius) var(--h5-grid-radius) 0 0;
  background: var(--h5-soft);
}

body[data-mode="h5"] .h5-device-list .device-preview.has-thumb {
  background: var(--h5-soft-2);
}

/* H5 thumbnail iframe can hijack touch events on some mobile browsers.
   Add a transparent shield above the iframe so vertical pan scrolls the page. */
body[data-mode="h5"] .h5-device-list .device-preview.has-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  touch-action: pan-y;
}

body[data-mode="h5"] .device-thumb-frame {
  pointer-events: none !important;
}

body[data-mode="h5"] .device-thumb-img {
  object-fit: cover;
}

body[data-mode="h5"] .h5-device-list .preview-plan {
  left: 6px;
  top: 6px;
  padding: 2px 6px;
  font-size: var(--h5-meta-font);
}

body[data-mode="h5"] .h5-device-list .preview-gear {
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  font-size: 14px;
}

body[data-mode="h5"] .h5-device-list.h5-view-large .preview-gear {
  width: 26px;
  height: 26px;
  font-size: 15px;
}

body[data-mode="h5"] .h5-device-list.h5-view-small .preview-gear {
  width: 22px;
  height: 22px;
  font-size: 13px;
}

body[data-mode="h5"] .h5-device-list .thumb-pending {
  left: 8px;
  top: 8px;
  right: 8px;
  font-size: var(--h5-meta-font);
}

body[data-mode="h5"] .h5-device-list .preview-lease strong {
  font-size: var(--h5-meta-font);
  line-height: 1.2;
}

body[data-mode="h5"] .h5-device-list .preview-lease span {
  font-size: 12px;
}

body[data-mode="h5"] .h5-device-list .h5-preview-lease {
  padding: 6px 6px 5px;
  text-align: center;
}

body[data-mode="h5"] .h5-device-list.h5-view-large .h5-preview-lease {
  padding: 8px 8px 7px;
}

body[data-mode="h5"] .h5-device-list .h5-preview-lease span {
  display: block;
  font-size: var(--h5-meta-font);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-mode="h5"] .device-body {
  padding: 10px;
  border-top: 1px solid var(--h5-card-border);
}

body[data-mode="h5"] .device-actions button {
  flex: 1;
  min-width: 86px;
  min-height: 38px;
  border-radius: 10px;
}

@media (max-width: 420px) {
  .h5-device-list.h5-view-large {
    --h5-grid-gap: 10px;
  }

  .h5-device-list.h5-view-small {
    --h5-grid-gap: 6px;
    --h5-meta-font: 9px;
  }
}

.h5-notice-card {
  margin-top: 2px;
  border-radius: 18px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.notice-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.notice-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  background: var(--h5-soft-2);
  border: 1px solid var(--h5-card-border);
}

.notice-list li strong {
  display: block;
  color: var(--h5-ink);
  font-size: 14px;
}

.notice-list li p {
  margin: 3px 0 0;
  color: var(--h5-muted);
  line-height: 1.5;
  font-size: 13px;
}

.h5-notice-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--h5-primary) 0%, var(--h5-secondary) 100%);
  box-shadow: 0 0 0 5px rgba(255, 36, 66, 0.14);
  flex-shrink: 0;
}

.h5-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.h5-section-head h3,
.h5-section-title {
  margin: 0;
  color: var(--h5-ink);
  font-size: 18px;
  font-weight: 800;
}

.h5-section-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid var(--h5-control-active-border);
  background: var(--h5-control-bg);
  color: var(--h5-control-active-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.h5-me-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.h5-avatar {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--h5-primary) 0%, var(--h5-secondary) 100%);
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.08em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(198, 33, 67, 0.3);
}

.h5-user-block {
  min-width: 0;
  flex: 1;
}

.h5-user-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--h5-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h5-user-id {
  margin-top: 4px;
  color: var(--h5-muted);
  font-size: 12px;
}

.h5-profile-btn {
  min-height: 38px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.h5-service-banner {
  margin-top: 10px;
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(125deg, rgba(255, 36, 66, 0.94) 0%, rgba(230, 30, 60, 0.92) 62%, rgba(251, 113, 133, 0.86) 100%);
  color: #fff;
  box-shadow: 0 16px 30px rgba(198, 33, 67, 0.24);
}

.h5-service-time {
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.h5-service-btn {
  margin-top: 10px;
  width: 100%;
  min-height: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--h5-accent);
  border: 0;
  font-weight: 700;
}

.h5-service-btn:hover {
  background: rgba(255, 255, 255, 1);
}

.h5-quick-card {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  border-radius: 18px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.h5-quick-btn {
  min-height: 66px;
  height: 66px;
  border-radius: 13px;
  border: 1px solid var(--h5-card-border);
  background: var(--h5-soft-2);
  color: var(--h5-ink);
  font-size: 12px;
  font-weight: 600;
  display: grid;
  justify-items: flex-start;
  gap: 3px;
  align-content: center;
  text-align: left;
  padding: 10px 11px;
}

.h5-quick-btn small {
  color: var(--h5-muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
}

.h5-quick-btn:hover {
  background: var(--h5-soft);
}

.h5-drive-card {
  margin-top: 10px;
  border-radius: 18px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.h5-drive-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.h5-drive-sub {
  margin-top: 5px;
  font-size: 13px;
}

.h5-upload-btn {
  min-height: 44px;
  white-space: nowrap;
}

.h5-drive-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.h5-drive-item {
  border: 1px solid var(--h5-card-border);
  border-radius: 13px;
  padding: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--h5-soft-2);
}

.h5-drive-meta {
  min-width: 0;
  flex: 1;
}

.h5-drive-name {
  color: var(--h5-ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h5-drive-info {
  margin-top: 4px;
  color: var(--h5-muted);
  font-size: 12px;
}

.h5-drive-actions {
  display: flex;
  gap: 6px;
}

.h5-drive-actions button {
  min-width: 56px;
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
}

.pc-drive-pane {
  padding: 14px;
  border-radius: 10px;
}

.pc-drive-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.pc-drive-tools {
  margin-top: 10px;
  margin-bottom: 10px;
}

.pc-drive-tools .sel {
  width: min(420px, 100%);
}

.pc-rent-pane {
  padding: 18px;
  border-radius: 12px;
}

.pc-rent-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 12px;
}

.pc-rent-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pc-rent-field label {
  margin-bottom: 6px;
}

.pc-rent-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.pc-rent-price {
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
}

.pc-rent-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
}

.pc-rent-actions button {
  min-width: 140px;
}

/* PC user page: unified Xiaohongshu-like palette. */
body[data-mode="pc"] #pc_app_root {
  --bg-page: #f8f7fa;
  --bg-surface: #ffffff;
  --bg-soft: #fdf1f5;
  --bg-hover: #fff4f7;
  --line: #ece7ee;
  --line-strong: #e2dbe4;
  --text: #2a2330;
  --text-muted: #74687f;
  --primary: #ff2442;
  --primary-pressed: #e61e3c;
  --preview-shell: radial-gradient(120% 100% at 50% 10%, #3a1f29 0%, #2b1820 42%, #1e1218 100%);
  --preview-shell-has-thumb: #1a1015;
  --preview-chip-bg: rgba(38, 20, 27, 0.78);
  --preview-footer-bg: linear-gradient(180deg, rgba(26, 16, 21, 0) 0%, rgba(26, 16, 21, 0.9) 68%);
}

body[data-mode="pc"] .card {
  border-color: var(--line);
  background: var(--bg-surface);
}

body[data-mode="pc"] .muted {
  color: var(--text-muted);
}

body[data-mode="pc"] .page-title {
  color: var(--text);
}

body[data-mode="pc"] .pc-device-pager {
  border-color: var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fff5f8 100%);
}

body[data-mode="pc"] .pc-device-pager-jump {
  border-color: var(--line-strong);
  color: var(--text);
}

body[data-mode="pc"] .pc-device-pager-jump:focus {
  border-color: rgba(255, 36, 66, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.18);
}

body[data-mode="pc"] .device-card {
  border-color: var(--line);
  background: var(--bg-surface);
  box-shadow: 0 6px 14px rgba(18, 42, 90, 0.05);
}

body[data-mode="pc"] .device-card.selected {
  border-color: var(--primary);
  box-shadow:
    inset 0 0 0 4px rgba(255, 36, 66, 0.9),
    0 0 0 2px rgba(255, 36, 66, 0.52),
    0 10px 24px rgba(198, 33, 67, 0.2);
}

body[data-mode="pc"] .device-preview {
  background: var(--preview-shell);
}

body[data-mode="pc"] .device-preview.has-thumb {
  background: var(--preview-shell-has-thumb);
}

body[data-mode="pc"] .preview-gear {
  background: rgba(8, 12, 19, 0.58);
}

body[data-mode="pc"] .preview-plan {
  background: rgba(8, 12, 19, 0.58);
  border: 0;
  box-shadow: none;
}

body[data-mode="pc"] .preview-lease {
  background: linear-gradient(180deg, rgba(8, 12, 19, 0) 0%, rgba(8, 12, 19, 0.76) 70%);
}

body[data-mode="h5"] .preview-gear {
  background: rgba(8, 12, 19, 0.58);
}

body[data-mode="h5"] .preview-plan {
  background: rgba(8, 12, 19, 0.58);
  border: 0;
  box-shadow: none;
}

body[data-mode="h5"] .preview-lease {
  background: linear-gradient(180deg, rgba(8, 12, 19, 0) 0%, rgba(8, 12, 19, 0.74) 70%);
}

body[data-mode="pc"] .h5-drive-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

body[data-mode="pc"] .h5-drive-item {
  width: 200px;
  max-width: 200px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

body[data-mode="pc"] .h5-drive-meta {
  width: 200px;
  height: 200px;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

body[data-mode="pc"] .h5-drive-name {
  width: 100%;
  color: var(--text);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

body[data-mode="pc"] .h5-drive-info {
  margin-top: 8px;
  color: var(--text-muted);
}

body[data-mode="pc"] .h5-drive-actions {
  width: 200px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body[data-mode="pc"] .h5-drive-actions button {
  width: 100%;
  min-width: 0;
}

body[data-mode="pc"] .pc-rent-summary {
  border-color: var(--line);
  background: var(--bg-soft);
}

body[data-mode="pc"] .pc-rent-price {
  color: var(--text);
}

.h5-menu-card {
  margin-top: 10px;
  padding: 0;
  border-radius: 18px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.h5-menu-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--h5-card-border);
  border-radius: 0;
  background: transparent;
  color: var(--h5-ink);
  text-align: left;
  min-height: 48px;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  padding: 0 14px;
}

.h5-menu-item:last-child {
  border-bottom: 0;
}

.h5-menu-item:hover {
  background: var(--h5-soft);
}

.h5-lease-card {
  margin-top: 10px;
  border-radius: 18px;
  border-color: var(--h5-card-border);
  background: var(--h5-card-bg);
  box-shadow: var(--h5-shadow);
}

.h5-logout-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  margin-bottom: 8px;
  border-radius: 12px;
}

.h5-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: auto;
  padding: 6px calc(env(safe-area-inset-right) + 8px) calc(env(safe-area-inset-bottom) + 6px) calc(env(safe-area-inset-left) + 8px);
  border-top: 1px solid var(--h5-card-border);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: none;
  box-shadow: 0 -8px 20px rgba(42, 35, 48, 0.08);
  display: none;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  z-index: 60;
}

body[data-mode="h5"] .h5-bottom-nav {
  display: flex;
}

body[data-mode="h5"].modal-open .h5-bottom-nav {
  display: none;
}

.h5-tab {
  flex: 1;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--h5-muted);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.h5-tab span {
  line-height: 1;
}

.h5-tab-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.h5-tab.active {
  color: var(--h5-primary);
  background: linear-gradient(170deg, rgba(255, 36, 66, 0.16) 0%, rgba(255, 241, 244, 0.85) 100%);
}

.h5-tab.active .h5-tab-icon {
  transform: translateY(-1px);
}

.h5-tab:hover {
  background: rgba(255, 36, 66, 0.08);
}

body[data-mode="h5"] button:active {
  transform: none;
}

body[data-mode="h5"] button,
body[data-mode="h5"] [role="button"] {
  touch-action: manipulation;
}

body[data-mode="h5"] button:focus-visible,
body[data-mode="h5"] input:focus-visible,
body[data-mode="h5"] select:focus-visible {
  outline: 2px solid rgba(255, 36, 66, 0.58);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  body[data-mode="h5"] * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Admin */
body[data-page="admin"],
body[data-page="admin-login"] {
  --admin-bg: #f2f4f8;
  --admin-surface: #ffffff;
  --admin-surface-soft: #f7f9fd;
  --admin-line: #dce5f1;
  --admin-line-strong: #c9d6ea;
  --admin-text: #1f2c40;
  --admin-muted: #6f809a;
  --admin-primary: #2f69ff;
  --admin-primary-pressed: #2458df;
  --admin-sidebar: #051638;
  --admin-sidebar-2: #0b1f48;
  --admin-sidebar-line: #1f3567;
  --admin-sidebar-text: #c4d2f1;
  --admin-sidebar-muted: #90a7d8;
  min-height: 100vh;
  background:
    radial-gradient(88% 72% at -5% -10%, rgba(47, 105, 255, 0.14) 0%, rgba(47, 105, 255, 0) 62%),
    radial-gradient(65% 52% at 100% 0%, rgba(15, 43, 109, 0.14) 0%, rgba(15, 43, 109, 0) 58%),
    var(--admin-bg);
  color: var(--admin-text);
  font-family: "Noto Sans SC", "Nunito Sans", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
}

.admin {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.admin-shell {
  align-items: start;
}

.sidebar {
  background: linear-gradient(180deg, var(--admin-sidebar) 0%, var(--admin-sidebar-2) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(3, 16, 44, 0.34);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--admin-sidebar-text);
}

.admin-sidebar {
  position: sticky;
  top: 12px;
  min-height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.admin-brand {
  padding: 8px 6px 4px;
}

.admin-brand-kicker {
  color: var(--admin-sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 800;
}

.brand-title {
  margin-top: 4px;
  color: #f2f6ff;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #b2c4ea;
}

.admin-nav {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(112, 145, 219, 0.52) transparent;
}

.admin-nav::-webkit-scrollbar {
  width: 6px;
}

.admin-nav::-webkit-scrollbar-thumb {
  background: rgba(112, 145, 219, 0.52);
  border-radius: 999px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  position: relative;
  display: block;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--admin-sidebar-text);
  text-decoration: none;
  padding: 10px 10px;
  font-weight: 600;
  line-height: 1.3;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-item::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(166, 191, 245, 0.45);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.nav-item-text {
  display: inline-block;
  padding-left: 14px;
}

.nav-item:hover {
  background: rgba(47, 105, 255, 0.18);
  border-color: rgba(129, 165, 243, 0.45);
  color: #f4f8ff;
}

.nav-item.active {
  background: linear-gradient(165deg, rgba(52, 109, 249, 0.96) 0%, rgba(36, 91, 219, 0.96) 100%);
  border-color: rgba(141, 177, 255, 0.68);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 8px 20px rgba(28, 73, 187, 0.46);
}

.nav-item.active::before {
  background: rgba(255, 255, 255, 0.92);
}

.nav-group {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(132, 157, 214, 0.44);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-group-title {
  padding: 4px 10px 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--admin-sidebar-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nav-item.nav-sub {
  padding-left: 9px;
}

.nav-item.nav-sub .nav-item-text {
  padding-left: 18px;
}

.sidebar-footer {
  margin-top: auto;
}

.admin-sidebar-footer {
  padding-top: 10px;
  border-top: 1px dashed rgba(132, 157, 214, 0.44);
}

.admin-logout-btn {
  width: 100%;
  min-height: 40px;
}

.content {
  min-width: 0;
  padding: 0;
}

.admin-content {
  min-width: 0;
}

.admin-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-topbar {
  margin-bottom: 0;
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(18, 42, 90, 0.1);
  padding: 14px 16px;
}

.admin-topbar-main {
  min-width: 0;
}

.admin-page-kicker {
  color: #5f7494;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 800;
}

.admin-page-title {
  margin: 4px 0 0;
  color: #17315b;
  font-size: 23px;
  line-height: 1.2;
}

.admin-page-sub {
  margin-top: 4px;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-refresh-btn {
  min-height: 40px;
}

.route + .route {
  margin-top: 12px;
}

body[data-page="admin"] .card,
body[data-page="admin-login"] .card {
  border-radius: 14px;
  border: 1px solid var(--admin-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 9px 20px rgba(17, 38, 79, 0.08);
}

body[data-page="admin"] .bar {
  align-items: flex-start;
  gap: 10px;
}

body[data-page="admin"] .bar > h3 {
  margin: 0;
  color: #193866;
  font-size: 19px;
}

body[data-page="admin"] .table-wrap {
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  overflow: auto;
  background: #ffffff;
}

body[data-page="admin"] table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

body[data-page="admin"] th {
  padding: 11px 10px;
  border-bottom: 1px solid var(--admin-line);
  color: #4b6389;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #f5f8fe;
}

body[data-page="admin"] td {
  padding: 11px 10px;
  border-bottom: 1px solid #e7edf7;
  color: #203652;
}

body[data-page="admin"] tbody tr:hover td {
  background: #f8fbff;
}

body[data-page="admin"] code {
  color: #2958bb;
  background: #f1f6ff;
  border: 1px solid #c9d9f5;
  border-radius: 7px;
  padding: 1px 6px;
}

body[data-page="admin"] input,
body[data-page="admin"] select,
body[data-page="admin"] textarea,
body[data-page="admin-login"] input,
body[data-page="admin-login"] select,
body[data-page="admin-login"] textarea {
  border-radius: 9px;
  border-color: var(--admin-line-strong);
  background: #ffffff;
  color: var(--admin-text);
}

body[data-page="admin"] input:focus,
body[data-page="admin"] select:focus,
body[data-page="admin"] textarea:focus,
body[data-page="admin-login"] input:focus,
body[data-page="admin-login"] select:focus,
body[data-page="admin-login"] textarea:focus {
  border-color: rgba(47, 105, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(47, 105, 255, 0.16);
}

body[data-page="admin"] button,
body[data-page="admin-login"] button {
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(47, 105, 255, 0.34);
  background: linear-gradient(180deg, #3c76ff 0%, #2f69ff 100%);
  box-shadow: 0 6px 16px rgba(47, 105, 255, 0.28);
}

body[data-page="admin"] button:hover,
body[data-page="admin-login"] button:hover {
  background: linear-gradient(180deg, #4a83ff 0%, #3a73ff 100%);
}

body[data-page="admin"] button.secondary,
body[data-page="admin-login"] button.secondary {
  border-color: var(--admin-line-strong);
  background: #f9fbff;
  color: #375173;
  box-shadow: none;
}

body[data-page="admin"] button.secondary:hover,
body[data-page="admin-login"] button.secondary:hover {
  background: #f0f5ff;
  color: #234a85;
}

body[data-page="admin"] .admin-logout-btn.secondary,
body[data-page="admin-login"] .admin-logout-btn.secondary {
  border-color: rgba(145, 171, 231, 0.3);
  background: rgba(7, 31, 80, 0.82);
  color: #d8e3fa;
}

body[data-page="admin"] .admin-logout-btn.secondary:hover,
body[data-page="admin-login"] .admin-logout-btn.secondary:hover {
  background: rgba(13, 40, 96, 0.92);
  color: #f3f7ff;
}

body[data-page="admin"] .muted,
body[data-page="admin-login"] .muted {
  color: var(--admin-muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-inline-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.admin-textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  min-height: 110px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.admin-textarea-lg {
  min-height: 220px;
}

.admin-divider {
  margin-top: 14px;
  height: 1px;
  background: #dce5f1;
}

.admin-form-field {
  margin-top: 10px;
}

.admin-state-text {
  margin-bottom: 10px;
}

.admin-note {
  margin-top: 8px;
}

.admin-subgroup-title {
  margin-bottom: 6px;
}

.admin-settings-alert {
  margin-bottom: 12px;
  border-color: rgba(226, 61, 61, 0.42) !important;
  background: #fff6f6 !important;
}

.admin-settings-alert-text {
  color: #c12b3d;
}

.admin-settings-layout {
  display: grid;
  grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
  gap: 12px;
}

.admin-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-settings-nav-title {
  font-size: 15px;
  font-weight: 700;
  color: #183862;
}

.admin-settings-nav-sub {
  font-size: 13px;
  line-height: 1.4;
}

.admin-settings-tab-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-settings-tab-btn {
  min-height: 58px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.admin-settings-tab-btn.active {
  border-color: rgba(47, 105, 255, 0.58) !important;
  background: rgba(47, 105, 255, 0.12) !important;
  color: #1f4ea5 !important;
  box-shadow: inset 0 0 0 1px rgba(47, 105, 255, 0.12), 0 6px 12px rgba(38, 81, 174, 0.14);
}

.admin-settings-tab-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-settings-tab-hint {
  font-size: 12px;
  line-height: 1.35;
  color: #6f83a7;
}

.admin-settings-panel {
  min-height: 520px;
}

.admin-settings-panel-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dce5f1;
}

.admin-settings-panel-title {
  margin: 0;
  font-size: 20px;
  color: #1a3b6d;
}

.admin-settings-panel-sub {
  font-size: 13px;
}

.admin-settings-block {
  display: block;
}

body[data-page="admin"] .group-picker-card {
  border-radius: 14px;
  border-color: var(--admin-line-strong);
  box-shadow: 0 22px 44px rgba(15, 38, 82, 0.24);
}

.admin-login-page {
  grid-template-columns: minmax(244px, 324px) minmax(0, 1fr);
}

.admin-login-sidebar {
  justify-content: flex-start;
}

.admin-login-side-copy {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(129, 159, 221, 0.25);
  background: rgba(255, 255, 255, 0.05);
}

.admin-login-side-title {
  margin: 0;
  color: #eef3ff;
  font-size: 18px;
}

.admin-login-side-text {
  margin-top: 8px;
  font-size: 13px;
  color: #b9c8e8;
}

.admin-login-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-login-card {
  width: min(560px, calc(100vw - 64px));
  margin: 0;
  padding: 24px 22px 22px;
}

.admin-login-title {
  margin: 0;
  color: #163664;
}

.admin-login-sub {
  margin-top: 6px;
}

.admin-login-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

body[data-page="admin"] .admin-topbar,
body[data-page="admin"] .route .card,
body[data-page="admin-login"] .admin-login-card {
  animation: admin-fade-in-up 240ms ease both;
}

@keyframes admin-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="admin"] .admin-topbar,
  body[data-page="admin"] .route .card,
  body[data-page="admin-login"] .admin-login-card {
    animation: none !important;
  }
}

/* Responsive */
@media (max-width: 1200px) {
  body[data-mode="pc"] .device-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pc-console {
    grid-template-columns: 220px 1fr;
  }
  .pc-device-actions {
    margin-left: calc(220px + 24px - 160px);
  }
  .pc-main-search input {
    width: min(360px, 100%);
  }
  .pc-rent-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .pc-global-menu {
    gap: 14px;
    font-size: 13px;
  }

  .pc-global-nav {
    height: auto;
    min-height: 52px;
    padding-top: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .pc-global-main {
    width: 100%;
  }

  .pc-global-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .pc-shell {
    grid-template-columns: 1fr;
  }

  .user-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(247, 249, 252, 0.97);
    backdrop-filter: blur(6px);
  }

  .user-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .user-nav-item {
    width: auto;
  }

  .pc-console {
    grid-template-columns: 1fr;
  }

  .pc-check-list {
    max-height: 240px;
  }
  .pc-main-actions {
    justify-content: flex-start;
  }
  .pc-main-search input {
    width: 100%;
    min-width: 220px;
  }
  .pc-device-topbar {
    flex-wrap: wrap;
  }
  .pc-device-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .quick-entry-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(133, 160, 222, 0.3);
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-group {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-group-title {
    display: none;
  }

  .nav-item.nav-sub {
    padding-left: 10px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="admin"] .admin,
  body[data-page="admin-login"] .admin {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  body[data-page="admin"] .admin-sidebar,
  body[data-page="admin-login"] .admin-sidebar {
    position: relative;
    top: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  body[data-page="admin"] .sidebar,
  body[data-page="admin-login"] .sidebar {
    border-color: rgba(133, 160, 222, 0.3);
  }

  body[data-page="admin"] .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  body[data-page="admin"] .admin-topbar-actions {
    width: 100%;
  }

  body[data-page="admin"] .admin-refresh-btn {
    width: 100%;
  }

  body[data-page="admin-login"] .admin-login-content {
    padding: 6px;
  }

  .admin-settings-layout {
    grid-template-columns: 1fr;
  }

  .admin-settings-tab-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .admin-settings-tab-btn {
    flex: 1 1 180px;
    min-width: 180px;
  }

  .preview-modal-card {
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .preview-modal {
    --preview-strip-size: 44px;
  }

  .preview-modal-head {
    min-height: var(--preview-strip-size);
  }
}

@media (max-width: 680px) {
  .pc-global-nav {
    padding: 0 10px;
    gap: 10px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .pc-global-brand {
    font-size: 16px;
  }

  .pc-global-menu {
    gap: 10px;
    font-size: var(--font-size-caption);
    overflow: auto;
    white-space: nowrap;
  }

  .pc-global-actions {
    justify-content: flex-start;
  }

  .user-main {
    padding: 12px;
  }

  .user-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  body[data-mode="pc"] .device-list {
    grid-template-columns: 1fr;
  }

  .h5-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .h5-quick-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="admin"] .admin-page-title {
    font-size: 21px;
  }

  body[data-page="admin-login"] .admin-login-card {
    width: min(560px, calc(100vw - 22px));
    padding: 18px 14px;
  }

  body[data-page="admin"] .nav-item,
  body[data-page="admin"] .nav-item.nav-sub {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding-right: 12px;
  }

  .admin-settings-grid {
    grid-template-columns: 1fr;
  }

  .admin-settings-tab-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .admin-settings-tab-btn {
    flex: 0 0 auto;
    width: 220px;
    min-width: 220px;
  }

  .admin-settings-panel {
    min-height: 0;
  }

  .preview-modal-card {
    max-width: calc(100vw - 8px);
    max-height: calc(100vh - 12px);
    border-radius: 10px;
  }

  .preview-modal {
    --preview-strip-size: 44px;
  }
}

/* PC dashboard custom layout (used by /pc logged-in page). */
.pc-dashboard-shell {
  --pc-topbar-h: 62px;
  --pc-notice-h: 40px;
  min-height: 100vh;
  background: #f3f4f7;
  display: flex;
}

.pc-dashboard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pc-dashboard-topbar {
  height: var(--pc-topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8ecf3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 12px;
}

.pc-account-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pc-account-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3562ff;
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pc-account-phone {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

.pc-activate-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: #2f69ff;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.pc-account-tools {
  display: flex;
  gap: 10px;
}

.pc-icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #d7deea;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pc-top-icon {
  width: 16px;
  height: 16px;
  display: block;
  stroke: #5f6f8a;
  stroke-width: 2.1;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.pc-top-icon * {
  fill: none;
  stroke: inherit;
  stroke-width: inherit;
  stroke-linecap: inherit;
  stroke-linejoin: inherit;
}

.pc-notice-bar {
  min-height: var(--pc-notice-h);
  background: #fdecea;
  border-bottom: 1px solid #f8d7d3;
  color: #9a3f35;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
}

.pc-notice-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.pc-notice-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pc-notice-action {
  border: 0;
  background: #f15542;
  color: #fff;
  border-radius: 4px;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
}

.pc-notice-close {
  border: 0;
  background: transparent;
  color: #bf857e;
  font-size: 14px;
  cursor: pointer;
}

.pc-dashboard-workspace {
  flex: 1;
  min-height: 0;
}

.pc-dashboard-mobile-tip {
  display: none;
}

.pc-side-nav {
  width: 74px;
  min-width: 74px;
  background: #051638;
  color: #9fb1db;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 7px 6px 10px;
  box-sizing: border-box;
}

.pc-side-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #0f2b6d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.pc-logo-mark {
  width: 20px;
  height: 20px;
  display: block;
  fill: #66a1ff;
}

.pc-side-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-side-item {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 9px 4px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.pc-side-item.active {
  color: #fff;
  background: #2d66ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.pc-side-icon {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pc-side-icon * {
  fill: none;
  stroke: inherit;
  stroke-width: inherit;
  stroke-linecap: inherit;
  stroke-linejoin: inherit;
}

.pc-side-foot {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pc-side-mini {
  border: 1px solid #1c2c4f;
  border-radius: 6px;
  background: #0b1f48;
  color: #c3d0f0;
  padding: 6px 0;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}

.pc-devices-page {
  min-height: calc(100vh - 94px);
  display: flex;
  flex-direction: column;
  background: #f2f4f8;
}

.pc-devices-toolbar {
  height: 58px;
  border-bottom: 1px solid #e8ecf3;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
}

.pc-devices-toolbar-left,
.pc-devices-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pc-keyword-input {
  width: 170px;
  height: 32px;
  border: 1px solid #dce1eb;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
}

.pc-tool-btn,
.pc-op-btn {
  border: 1px solid #d8deea;
  background: #fff;
  color: #344257;
  border-radius: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pc-tool-btn.primary {
  background: #2f69ff;
  border-color: #2f69ff;
  color: #fff;
}

.pc-selected-text {
  color: #6c778b;
  font-size: 12px;
}

.pc-devices-content {
  flex: 1;
  min-height: 0;
  display: flex;
}

.pc-filter-pane {
  width: 272px;
  min-width: 272px;
  background: #fff;
  border-right: 1px solid #e8ebf3;
  padding: 8px 10px;
  box-sizing: border-box;
}

.pc-pane-handle {
  width: 20px;
  height: 48px;
  margin: auto -1px;
  border: 1px solid #e0e5ef;
  border-radius: 0 8px 8px 0;
  background: #f5f7fb;
  color: #b0b8c8;
}

.pc-filter-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pc-filter-tab {
  border: 1px solid #dde3ef;
  background: #f7f9fd;
  color: #4b5568;
  border-radius: 5px;
  height: 30px;
  cursor: pointer;
}

.pc-filter-tab.active {
  color: #2f69ff;
  background: #eef3ff;
  border-color: #c8d8ff;
}

.pc-group-select-wrap {
  margin-top: 10px;
}

.pc-group-select {
  width: 100%;
  height: 32px;
  border: 1px solid #dce1eb;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.pc-filter-item {
  margin-top: 12px;
  color: #6a7384;
  font-size: 12px;
}

.pc-filter-hint {
  margin-top: 2px;
  color: #8d98ad;
  font-size: 11px;
  line-height: 18px;
}

.pc-filter-device-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: calc(100vh - 360px);
  overflow-y: auto;
  padding-right: 2px;
}

.pc-filter-device-item {
  border-radius: 6px;
  background: #fff;
  transition: background-color 0.15s ease;
}

.pc-filter-device-item:hover {
  background: #f6f9ff;
}

.pc-filter-device-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 2px 20px 2px 0;
  line-height: 20px;
  white-space: nowrap;
}

.pc-filter-device-name-btn {
  display: block;
  max-width: 84px;
  min-width: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #2f3b4e;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 20px;
  word-break: normal;
  overflow-wrap: normal;
  border-radius: 4px;
  outline: none;
  flex: 0 1 auto;
}

.pc-filter-device-name-btn:hover {
  color: #2f69ff;
}

.pc-filter-device-dot {
  color: #9aa6bc;
  line-height: 20px;
  flex: 0 0 auto;
}

.pc-filter-device-no {
  max-width: 58px;
  font-size: 12px;
  color: #44536b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  flex: 0 1 auto;
}

.pc-filter-device-group {
  min-width: 0;
  max-width: 68px;
  font-size: 12px;
  color: #56647d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 20px;
  flex: 0 1 auto;
  word-break: keep-all;
  overflow-wrap: normal;
}

button.pc-filter-device-edit-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 1px solid #d5deef;
  background: #f7f9fd;
  color: #2f69ff;
  border-radius: 3px;
  line-height: 14px;
  font-size: 10px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

button.pc-filter-device-edit-btn:hover {
  background: #eef4ff;
  border-color: #b2c7ee;
}

.pc-filter-device-empty {
  font-size: 12px;
  color: #98a3b8;
  padding: 4px 0;
}

.pc-canvas-pane {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
}

.pc-empty-wrap {
  height: calc(100vh - 216px);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 30px;
}

.pc-empty-card {
  width: 188px;
  height: 188px;
  border: 1px dashed #d6dbe5;
  background: #fff;
  color: #4d5a70;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  margin-top: 10px;
}

.pc-empty-plus {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f0f2f6;
  color: #2f69ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  line-height: 1;
}

.pc-bottom-bar {
  height: 42px;
  border-top: 1px solid #e8ebf3;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #6a7384;
  font-size: 12px;
  padding: 0 16px;
  gap: 10px;
}

.pc-op-icon {
  width: 13px;
  height: 13px;
  display: block;
  stroke: #66758f;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pc-op-icon * {
  fill: none;
  stroke: inherit;
  stroke-width: inherit;
  stroke-linecap: inherit;
  stroke-linejoin: inherit;
}

.pc-bottom-nav {
  color: #b0b8c8;
}

.pc-bottom-size {
  height: 30px;
  border: 1px solid #dbe1ec;
  border-radius: 6px;
  background: #fff;
  color: #546177;
  padding: 0 10px;
}

.pc-bottom-input {
  width: 34px;
  height: 24px;
  border: 1px solid #dbe1ec;
  border-radius: 4px;
  background: #f7f9fd;
}

@media (max-width: 1280px) {
  .pc-devices-toolbar {
    height: auto;
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .pc-devices-toolbar-left,
  .pc-devices-toolbar-right {
    flex-wrap: wrap;
  }

  .pc-filter-pane {
    width: 220px;
    min-width: 220px;
  }
}

@media (max-width: 1024px) {
  .pc-dashboard-shell {
    flex-direction: column;
  }

  .pc-dashboard-mobile-tip {
    display: block;
    font-size: 12px;
    color: #6b7280;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
  }

  .pc-side-nav {
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex-direction: row;
    align-items: stretch;
    padding: 8px;
    gap: 8px;
    overflow-x: auto;
  }

  .pc-side-menu {
    flex-direction: row;
    min-width: max-content;
  }

  .pc-side-foot {
    margin-top: 0;
    flex-direction: row;
    margin-left: auto;
    width: auto;
  }

  .pc-devices-content {
    flex-direction: column;
  }

  .pc-filter-pane {
    width: 100%;
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid #e8ebf3;
  }
}
