* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: #f5f6fa;
  color: #1a1a1a;
}
.hidden { display: none !important; }
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.login-card {
  width: 360px;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
  background: #fff;
}
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-card p { color: #666; font-size: 14px; margin-bottom: 24px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 16px;
}
.error { color: #ff4757; font-size: 13px; min-height: 20px; }
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #eee;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.brand { font-size: 18px; font-weight: 700; margin-bottom: 24px; }
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  background: none;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 14px;
}
.nav-item.active, .nav-item:hover { background: #eef9ff; color: #0088aa; }
.logout {
  margin-top: auto;
  border: 1px solid #eee;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}
.main { flex: 1; padding: 28px; }
.tab { display: none; }
.tab.active { display: block; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; }
.filter-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.stat-card .num { font-size: 28px; font-weight: 700; color: #0088aa; }
.stat-card .label { color: #666; font-size: 13px; margin-top: 6px; }
.table-wrap {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  margin-top: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 14px 12px; border-bottom: 1px solid #f0f0f0; text-align: left; }
th { background: #fafafa; color: #666; font-weight: 600; }
.preview-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

.preview-dot--img {
  object-fit: cover;
  display: block;
  background: #e8e8ec;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.preview-dot--placeholder {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #eef9ff;
  color: #0088aa;
}
.badge.off { background: #f5f5f5; color: #999; }
.btn {
  border: 1px solid #ddd;
  background: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary {
  background: linear-gradient(135deg, #00d4ff, #7b61ff);
  color: #fff;
  border: none;
}
.btn-danger { color: #ff4757; border-color: #ffc9cf; }
.form-card {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  max-width: 720px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 14px; color: #444; }
.form-row input, .form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 6px; }
.hint { font-size: 13px; color: #666; margin-top: 8px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.cover-preview {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.cover-preview__ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(145deg, #e8e8ec, #d0d0d8);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  position: relative;
  flex-shrink: 0;
}
.cover-preview__img,
.cover-preview__placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.cover-preview__placeholder {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.cover-preview__img.hidden,
.cover-preview__placeholder.hidden {
  display: none;
}
.cover-preview__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-advanced {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}
.form-advanced summary {
  cursor: pointer;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}
.preview-wrap {
  position: relative;
  width: 40px;
  height: 40px;
}
.preview-wrap .preview-dot--placeholder.hidden {
  display: none;
}
.preview-wrap .preview-dot--img.hidden {
  display: none;
}
.banner-list { display: grid; gap: 12px; margin-top: 16px; }
.page-hint {
  color: #666;
  font-size: 14px;
  margin: 8px 0 16px;
}
.banner-preview {
  width: 375px;
  max-width: 100%;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f4;
  margin-bottom: 12px;
}
.banner-preview__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.banner-preview__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.banner-preview__img.hidden,
.banner-preview__placeholder.hidden { display: none; }
.banner-thumb {
  width: 120px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #eee;
}
.featured-add {
  display: flex;
  gap: 12px;
}
.featured-add select { flex: 1; }
.featured-list {
  display: grid;
  gap: 10px;
}
.featured-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
}
.featured-item__name { flex: 1; font-size: 14px; }
.featured-item__actions { display: flex; gap: 8px; }
.banner-item {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.firmware-status {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  border-left: 4px solid #0088aa;
}
.firmware-status--published { border-left-color: #2ed573; }
.firmware-status--draft { border-left-color: #ffa502; }
.firmware-status__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}
.firmware-status__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 24px;
  font-size: 14px;
}
.firmware-status__label { color: #666; }
.firmware-status__value { color: #1a1a1a; font-weight: 500; }
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
}
.page-hint code {
  background: #f0f0f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.page-hint--tight {
  margin: 4px 0 0;
}

.label-sub {
  font-size: 12px;
  font-weight: 400;
  color: #888;
}

/* ========== 出厂预置 ========== */
.factory-type-tabs {
  display: flex;
  gap: 12px;
}

.factory-type-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.factory-type-tab:has(input:checked) {
  border-color: #00a8cc;
  background: #f0fbff;
  color: #0077aa;
  font-weight: 600;
}

.factory-type-tab input {
  margin: 0;
}

.badge-static {
  background: #eef8ee;
  color: #2d7a2d;
}

.badge-dynamic {
  background: #eef4ff;
  color: #3d5afe;
}

.factory-upload-grid--single {
  grid-template-columns: 1fr;
}

.factory-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .factory-layout {
    grid-template-columns: 1fr;
  }
}

.factory-form {
  max-width: none;
}

.factory-form h3 {
  margin: 0 0 20px;
  font-size: 18px;
}

.factory-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.factory-id-row input {
  flex: 1;
}

.factory-id-suffix {
  color: #666;
  font-size: 14px;
  white-space: nowrap;
}

.factory-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  .factory-upload-grid {
    grid-template-columns: 1fr;
  }
}

.factory-upload-card {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}

.factory-upload-card__title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.factory-upload-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.factory-dropzone {
  position: relative;
  height: 200px;
  border: 2px dashed #ccc;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}

.factory-dropzone:hover,
.factory-dropzone--drag {
  border-color: #0088aa;
  background: #f8fdff;
}

.factory-dropzone__placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #888;
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.factory-dropzone__icon {
  font-size: 32px;
  line-height: 1;
}

.factory-dropzone__sub {
  font-size: 12px;
  color: #aaa;
}

.factory-dropzone__preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.factory-dropzone__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.factory-checks {
  align-items: flex-end;
  padding-bottom: 10px;
}

.factory-side__card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  margin-bottom: 16px;
}

.factory-side__card h4 {
  margin: 0 0 16px;
  font-size: 15px;
}

.factory-phone-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.factory-phone-preview__ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  padding: 4px;
  border: 3px solid #0088aa;
  overflow: hidden;
  background: #f5f5f5;
}

.factory-phone-preview__img,
.factory-phone-preview__video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.factory-phone-preview__ph {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #999;
  background: #eef9ff;
}

.factory-phone-preview__name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.factory-phone-preview__tag {
  font-size: 12px;
  color: #0088aa;
  background: #eef9ff;
  padding: 4px 12px;
  border-radius: 999px;
}

.factory-side__tips ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #555;
  line-height: 1.8;
}

.factory-table-wrap {
  margin-top: 0;
}

.col-sort {
  width: 72px;
  text-align: center;
}

.factory-sort-input {
  width: 56px;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
}

.factory-sort-input:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

.badge-factory {
  background: #e8f4ea;
  color: #2d8a4e;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ========== 素材库下发工作台 ========== */
.lib-workflow {
  margin-bottom: 28px;
  max-width: none;
}

.lib-step {
  margin-bottom: 20px;
}

.lib-step__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.lib-step__title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: #222;
}

.lib-step__tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lib-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 12px;
}

.lib-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
}

.lib-picker-item:has(input:checked) {
  border-color: #0099cc;
  background: #f0f9fc;
}

.lib-picker-item__thumb .preview-dot,
.lib-picker-item__thumb img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.lib-picker-item__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lib-picker-item__meta strong {
  font-size: 13px;
  color: #222;
}

.lib-picker-item__meta small {
  font-size: 12px;
  color: #888;
}

.lib-selected-hint {
  margin-top: 10px;
}

.lib-pack-actions {
  margin-top: 8px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
}

.lib-list-title {
  margin: 8px 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.lib-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f7ee;
  color: #1a8f4a;
  font-size: 12px;
}

/* ========== 市场素材（WiFi 下发） ========== */
.market-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .market-layout {
    grid-template-columns: 1fr;
  }
}

.market-form {
  max-width: none;
}

.market-step {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.market-step:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
}

.market-step__title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.market-type-toggle {
  display: flex;
  gap: 8px;
}

.market-type-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.market-type-btn:hover {
  border-color: #0088aa;
}

.market-type-btn.active {
  border-color: #0088aa;
  background: #eef9ff;
  color: #006688;
  font-weight: 600;
}

.market-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 720px) {
  .market-upload-grid {
    grid-template-columns: 1fr;
  }
}

.market-upload-hint {
  margin: 0 0 12px;
}

.market-checklist {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.market-check {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.market-check--pending {
  background: #fff8e6;
  color: #996600;
}

.market-check--ok {
  background: #e8f7ee;
  color: #1a8f4a;
}

.market-form-actions {
  flex-wrap: wrap;
}

.market-advanced {
  margin-top: 12px;
}

.market-side__id .market-device-id {
  margin: 0 0 8px;
  font-size: 15px;
}

.market-id-hint {
  color: #888;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
