:root {
  --bg: #f6f7fb;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #e8eaf3;
  --text: #161821;
  --muted: #72798c;
  --primary: #ff4d73;
  --primary-deep: #eb3f67;
  --primary-soft: #fff0f4;
  --danger: #db3a34;
  --success: #19a15d;
  --shadow: 0 20px 60px rgba(30, 38, 66, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 90, 120, 0.12), transparent 26%),
    linear-gradient(180deg, #fff7f9 0, var(--bg) 320px);
}

body.app-booting {
  overflow: hidden;
}

body.is-modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.portal-shell {
  min-height: 100vh;
}

body.app-booting .portal-shell {
  visibility: hidden;
}

.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(246, 247, 251, 0.96);
}

body.app-booting .boot-splash {
  display: grid;
}

.boot-card {
  width: min(360px, 100%);
  padding: 28px 24px;
  border-radius: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.boot-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 77, 115, 0.14);
  border-top-color: var(--primary);
  animation: boot-spin 0.9s linear infinite;
}

.boot-title {
  font-size: 18px;
  font-weight: 700;
}

.boot-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card,
.panel,
.summary-card,
.modal-card {
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(560px, 100%);
  padding: 36px;
  border-radius: 30px;
}

.auth-brand,
.workspace-topbar,
.workspace-actions,
.panel-head,
.action-row,
.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
}

.auth-brand {
  gap: 18px;
  margin-bottom: 24px;
}

.auth-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-deep);
  background: linear-gradient(180deg, #fff7fa, #ffe6ed);
  box-shadow: inset 0 0 0 1px rgba(255, 77, 115, 0.14);
}

.auth-brand h1,
.workspace-title h1,
.panel-head h3,
.modal-head h3 {
  margin: 0;
}

.auth-brand p,
.workspace-title p,
.summary-hint,
.hint-text,
.status-text,
.empty-block,
.empty-inline,
.upload-panel-head p,
.modal-head p {
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.auth-tab,
.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn,
.mini-btn,
.dropzone {
  border-radius: 14px;
  border: 1px solid var(--line);
}

.auth-tab,
.primary-btn,
.ghost-btn,
.danger-btn {
  padding: 12px 18px;
  font-weight: 700;
}

.auth-tab,
.ghost-btn,
.icon-btn,
.mini-btn,
.dropzone {
  background: #fff;
}

.auth-tab.is-active {
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-color: rgba(255, 77, 115, 0.18);
}

.primary-btn {
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, var(--primary), #ff6287);
}

.danger-btn {
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, #ef5350, var(--danger));
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 24px;
  color: var(--muted);
}

.mini-btn {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.mini-btn.danger {
  color: var(--danger);
}

.stack-form,
.filter-grid,
.inline-grid {
  display: grid;
  gap: 16px;
}

.stack-form label,
.filter-grid label,
.inline-grid label,
.asset-field {
  display: grid;
  gap: 8px;
}

.stack-form span,
.filter-grid span,
.inline-grid span,
.asset-field span,
.summary-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.field-counter {
  justify-self: end;
  font-size: 12px;
  color: var(--muted);
}

.field-counter.is-limit {
  color: var(--danger);
  font-weight: 700;
}

.storage-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f7f8fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.storage-label.is-hot {
  background: rgba(25, 161, 93, 0.12);
  color: var(--success);
}

.storage-label.is-expired {
  background: rgba(252, 176, 0, 0.14);
  color: #ba7b00;
}

.storage-label.is-cleaned {
  background: rgba(219, 58, 52, 0.1);
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 77, 115, 0.45);
  box-shadow: 0 0 0 4px rgba(255, 77, 115, 0.08);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.workspace {
  padding: 28px;
}

.workspace-topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.workspace-actions {
  gap: 12px;
}

.summary-card {
  min-width: 220px;
  padding: 14px 18px;
  border-radius: 20px;
}

.summary-value {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

.summary-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}

.workspace-panel {
  border-radius: var(--radius);
  padding: 24px;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.action-row {
  gap: 10px;
}

.action-row.wrap {
  flex-wrap: wrap;
}

.filter-grid {
  grid-template-columns: 220px 180px minmax(260px, 1fr) 120px;
  align-items: end;
  margin-bottom: 10px;
}

.filter-grid .wide {
  min-width: 320px;
}

.fit-btn {
  align-self: end;
}

.table-wrap {
  overflow: auto;
}

.notes-table .link-cell {
  max-width: 220px;
  word-break: break-all;
}

.notes-table .remark-cell {
  max-width: 180px;
  color: #121623;
  font-weight: 800;
  word-break: break-word;
}

.notes-table .qr-cell img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.notes-table .qr-empty {
  font-size: 12px;
  color: var(--muted);
}

.mono {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.empty-block,
.empty-inline {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  background: #fbfcff;
}

.empty-inline {
  padding: 14px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.error-text {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.inline-error {
  margin-bottom: 4px;
}

.footer-status {
  margin-top: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 22, 35, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
}

.modal-large {
  width: min(880px, calc(100vw - 40px));
}

.modal-head,
.modal-foot {
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
}

.modal-body {
  padding: 20px 24px;
  overflow: auto;
}

.upload-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fbfcff;
}

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

.upload-panel-head h4 {
  margin: 0;
}

.upload-panel-head p {
  margin: 8px 0 0;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 120px;
  border-style: dashed;
  color: var(--muted);
  font-weight: 600;
}

.dropzone.is-dragover {
  color: var(--primary-deep);
  border-color: rgba(255, 77, 115, 0.4);
  background: var(--primary-soft);
}

.upload-progress {
  border: 1px solid #ffe1e7;
  border-radius: 18px;
  background: #fff8fa;
  padding: 14px;
}

.upload-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #121623;
  font-size: 13px;
}

.upload-progress-row span {
  color: var(--primary-deep);
  font-weight: 900;
}

.upload-progress-bar {
  height: 9px;
  border-radius: 999px;
  background: #ffe5eb;
  overflow: hidden;
  margin-top: 10px;
}

.upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-deep), #ff7891);
  transition: width 0.2s ease;
}

.upload-progress-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.media-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
}

.media-card-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #f0f2f8;
}

.media-preview-btn {
  padding: 0;
}

.media-preview-btn:hover {
  border-color: rgba(255, 77, 115, 0.24);
  box-shadow: 0 8px 24px rgba(255, 77, 115, 0.12);
}

.media-card-preview img,
.media-card-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card-meta {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.media-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.media-slot-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.media-preview-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-radius: 999px;
}

.asset-body {
  display: grid;
  gap: 18px;
}

.preview-modal-card {
  width: min(980px, calc(100vw - 40px));
}

.preview-modal-body {
  display: grid;
  place-items: center;
  min-height: min(70vh, 680px);
  background: #10131b;
}

.preview-surface {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.preview-surface img,
.preview-surface video {
  max-width: 100%;
  max-height: min(68vh, 640px);
  border-radius: 18px;
  background: #000;
}

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

.summary-tile {
  padding: 16px;
  border-radius: 18px;
  background: #fbfcff;
  border: 1px solid var(--line);
}

.summary-tile span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.summary-tile strong,
.summary-tile code {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  word-break: break-all;
}

.asset-section {
  display: grid;
  gap: 16px;
}

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

.asset-preview-card {
  padding: 16px;
  border-radius: 18px;
  background: #fbfcff;
  border: 1px solid var(--line);
}

.asset-preview-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.asset-qr-preview {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.is-active {
  color: var(--success);
  background: rgba(25, 161, 93, 0.12);
}

.badge.is-draft {
  color: #ba7b00;
  background: rgba(252, 176, 0, 0.14);
}

.badge.is-disabled {
  color: var(--danger);
  background: rgba(219, 58, 52, 0.1);
}

@media (max-width: 1240px) {
  .workspace-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 960px) {
  .workspace {
    padding: 20px;
  }

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

  .asset-summary-grid,
  .asset-preview-wrap,
  .inline-grid,
  .media-slot-grid {
    grid-template-columns: 1fr;
  }
}
