/* ==========================================================================
   LAN Drop 样式表
   设计取向：Apple AirDrop 式的克制感 —— 大留白、圆角、毛玻璃、单一强调色。
   无任何外部字体 / 图标库，全部系统字体 + 内联 SVG。
   ========================================================================== */

:root {
  --bg: #f5f5f7;
  --bg-layer: radial-gradient(1100px 520px at 12% -8%, #e6efff 0%, rgba(230, 239, 255, 0) 62%),
              radial-gradient(900px 460px at 96% 2%, #e6f6ff 0%, rgba(230, 246, 255, 0) 58%),
              #f5f5f7;
  --card: rgba(255, 255, 255, 0.72);
  --card-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #1c1c1e;
  --text-2: #6e6e73;
  --text-3: #9099a5;
  --accent: #0a84ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 132, 255, 0.1);
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.1);
  --success: #34c759;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 70px rgba(16, 24, 40, 0.18);
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --blur: saturate(180%) blur(20px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0f;
    --bg-layer: radial-gradient(1100px 520px at 10% -10%, rgba(10, 132, 255, 0.14) 0%, rgba(10, 132, 255, 0) 60%),
                radial-gradient(900px 460px at 96% 0%, rgba(94, 92, 230, 0.12) 0%, rgba(94, 92, 230, 0) 55%),
                #0b0b0f;
    --card: rgba(28, 28, 32, 0.66);
    --card-strong: rgba(30, 30, 35, 0.94);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f5f5f7;
    --text-2: #a1a1aa;
    --text-3: #7c7c85;
    --accent: #0a84ff;
    --accent-ink: #ffffff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 34px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-layer);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px calc(48px + env(safe-area-inset-bottom));
}

/* ------------------------------ 顶部栏 ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 4px 14px;
  margin-bottom: 4px;
  background: linear-gradient(to bottom, var(--bg) 55%, rgba(245, 245, 247, 0));
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

@media (prefers-color-scheme: dark) {
  .topbar {
    background: linear-gradient(to bottom, var(--bg) 55%, rgba(11, 11, 15, 0));
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  background: linear-gradient(160deg, #4aa8ff, var(--accent));
  color: #fff;
  box-shadow: 0 6px 16px rgba(10, 132, 255, 0.35);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text small {
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 46vw;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip .ico {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.chip-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chip.is-copied {
  color: var(--success);
  border-color: rgba(52, 199, 89, 0.4);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--text-2);
  cursor: pointer;
  transition: transform 160ms var(--ease), color 160ms var(--ease),
    border-color 160ms var(--ease), background 160ms var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn .ico {
  width: 18px;
  height: 18px;
}

.ico {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}

/* ------------------------------ 通用卡片 ------------------------------ */

.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  animation: rise 420ms var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.card-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.stat {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--card-strong);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
  transition: transform 140ms var(--ease), background 160ms var(--ease),
    border-color 160ms var(--ease), opacity 160ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.28);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}

.btn.ghost:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.small {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn.block {
  width: 100%;
}

.btn .ico {
  width: 16px;
  height: 16px;
}

/* ------------------------------ 上传区 ------------------------------ */

.send-card {
  padding: 14px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 168px;
  padding: 24px 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.03), rgba(10, 132, 255, 0));
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms var(--ease), background 200ms var(--ease),
    transform 200ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.005);
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.dz-icon svg {
  width: 24px;
  height: 24px;
}

.dz-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dz-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.compose {
  margin-top: 14px;
}

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-strong);
  color: var(--text);
  font: inherit;
  /* 16px 防止 iOS 聚焦时自动放大 */
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

textarea::placeholder,
input::placeholder {
  color: var(--text-3);
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.hint {
  font-size: 12px;
  color: var(--text-3);
}

/* ------------------------------ 传输队列 ------------------------------ */

.overall {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.overall-bar {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.overall-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #4aa8ff, var(--accent));
  transition: width 220ms var(--ease);
}

.overall-text {
  min-width: 40px;
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qitem {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-strong);
}

.qhead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.qname {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qstate {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.qbar {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.qbar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 180ms var(--ease);
}

.qitem.is-done .qbar span {
  background: var(--success);
}

.qitem.is-error .qbar span {
  background: var(--danger);
}

.qmeta {
  display: flex;
  gap: 12px;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.qmeta .qpct {
  color: var(--text-2);
}

.qbtn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.qbtn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.qbtn .ico {
  width: 14px;
  height: 14px;
}

/* ------------------------------ 文件列表 ------------------------------ */

.file-list,
.text-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-radius: var(--radius-md);
  transition: background 160ms var(--ease);
  animation: fadeIn 300ms var(--ease) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.file:hover {
  background: rgba(127, 127, 127, 0.06);
}

.file.is-new {
  animation: newPulse 2800ms var(--ease) both;
}

@keyframes newPulse {
  0% {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.25);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 11px;
  background: rgba(127, 127, 127, 0.1);
  color: var(--text-2);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb svg {
  width: 21px;
  height: 21px;
}

.file-main {
  flex: 1;
  min-width: 0;
}

/* 名称行：可容纳「新」角标 + 文件名 */
.file-namerow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.file-namerow .file-name {
  flex: 1;
  min-width: 0;
}

/* 新内容角标：本会话新收到的文件/文字 */
.new-badge {
  flex: 0 0 auto;
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  line-height: 1.4;
  font-weight: 600;
}

.file-name {
  display: block;
  font-size: 14px;
  font-weight: 520;
  letter-spacing: -0.005em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
}

.file-name:hover {
  color: var(--accent);
}

/* 常用软件卡片：名称仅作展示，只有「下载」按钮才触发下载 */
.app-name {
  cursor: default;
}

.app-name:hover {
  color: var(--text);
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta .sep {
  opacity: 0.5;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.file-actions .icon-btn {
  width: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.file-actions .icon-btn:hover {
  background: rgba(127, 127, 127, 0.12);
}

.file-actions .icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty {
  margin: 6px 0 2px;
  padding: 18px 6px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ------------------------------ 文字片段 ------------------------------ */

.text-item {
  position: relative;
  padding: 12px 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-strong);
  animation: fadeIn 300ms var(--ease) both;
}

.text-item + .text-item {
  margin-top: 8px;
}

.text-body {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  -webkit-overflow-scrolling: touch;
}

.text-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.text-meta {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-actions {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.text-actions .icon-btn {
  width: 32px;
  height: 32px;
  border-color: transparent;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.text-actions .icon-btn:hover {
  background: rgba(127, 127, 127, 0.12);
}

/* ------------------------------ 页脚 / 提示条 ------------------------------ */

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 26px 4px 8px;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
}

.foot .dot {
  opacity: 0.5;
}

.banner {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -20px;
  padding: 10px 20px;
  background: rgba(255, 149, 0, 0.14);
  color: #a35b00;
  font-size: 12.5px;
  text-align: center;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

@media (prefers-color-scheme: dark) {
  .banner {
    background: rgba(255, 149, 0, 0.18);
    color: #ffb340;
  }
}

.banner.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.banner-hint {
  display: block;
  margin-top: 2px;
  opacity: 0.8;
}

/* ------------------------------ PIN 门 ------------------------------ */

.gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-layer);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.gate-card {
  width: 100%;
  max-width: 340px;
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-strong);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.gate-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
}

.gate-card p.muted {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-2);
}

.gate-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gate-error {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--danger);
}

/* ------------------------------ 模态框 ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 14, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 200ms var(--ease) both;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card-strong);
  box-shadow: var(--shadow-lg);
  animation: pop 260ms var(--ease) both;
  -webkit-overflow-scrolling: touch;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-panel h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding-right: 34px;
}

.muted {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--text-3);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: rgba(127, 127, 127, 0.12);
  color: var(--text-2);
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.modal-close:hover {
  background: rgba(127, 127, 127, 0.2);
  color: var(--text);
}

.modal-close .ico {
  width: 15px;
  height: 15px;
}

.modal-qr {
  text-align: center;
}

.modal-qr h2 {
  padding-right: 0;
}

.qr-wrap {
  display: grid;
  place-items: center;
  margin: 6px auto 12px;
  padding: 12px;
  width: fit-content;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.qr-wrap canvas {
  display: block;
  width: 240px;
  height: 240px;
  max-width: 62vw;
  max-height: 62vw;
  image-rendering: pixelated;
}

.qr-url {
  margin: 0 0 14px;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.qr-actions {
  display: flex;
  justify-content: center;
}

.qr-fallback {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--danger);
}

/* ------------------------------ 设置 / 表单 ------------------------------ */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--text-2);
}

.field-row {
  display: flex;
  gap: 8px;
}

.field-row input {
  flex: 1;
  min-width: 0;
}

.field .hint {
  margin: 8px 0 0;
}

.info h3 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.info dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  margin: 0;
  font-size: 12.5px;
}

.info dt {
  color: var(--text-3);
  white-space: nowrap;
}

.info dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ 预览 ------------------------------ */

.modal-preview {
  max-width: 720px;
}

.preview-body {
  display: grid;
  place-items: center;
  min-height: 120px;
  max-height: 62vh;
  margin: 6px 0 14px;
  overflow: auto;
  border-radius: var(--radius-md);
  background: rgba(127, 127, 127, 0.08);
}

.preview-body img,
.preview-body video {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  border-radius: var(--radius-md);
}

.preview-body video {
  background: #000;
}

.preview-body audio {
  width: min(100%, 420px);
  margin: 24px 0;
}

.preview-body pre {
  width: 100%;
  margin: 0;
  padding: 14px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

.preview-foot {
  display: flex;
  justify-content: flex-end;
}

.modal-confirm {
  max-width: 360px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ------------------------------ Toast ------------------------------ */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  animation: toastIn 240ms var(--ease) both;
  max-width: 100%;
}

.toast.is-error {
  border-color: rgba(255, 59, 48, 0.35);
  color: var(--danger);
}

.toast.is-ok {
  border-color: rgba(52, 199, 89, 0.35);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toast.is-out {
  animation: toastOut 200ms var(--ease) both;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 720px) {
  .app {
    padding: 0 14px calc(36px + env(safe-area-inset-bottom));
  }

  .card {
    padding: 15px;
    border-radius: 18px;
  }

  .chip {
    max-width: 34vw;
  }

  .dropzone {
    min-height: 148px;
  }

  .file {
    padding: 8px 6px;
    gap: 10px;
  }

  .file-actions .icon-btn {
    width: 38px;
    height: 38px;
  }

  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-panel {
    max-height: calc(100vh - 24px);
    border-radius: 20px;
  }

  .btn {
    min-height: var(--tap);
  }

  .icon-btn,
  .chip {
    min-height: 40px;
  }

  .topbar .icon-btn {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 400px) {
  .chip {
    display: none;
  }

  .brand-text small {
    display: none;
  }
}

/* 触摸设备上保证点击区域足够大 */
@media (hover: none) {
  .file-actions .icon-btn,
  .text-actions .icon-btn,
  .qbtn {
    min-width: var(--tap);
    min-height: var(--tap);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------- 常驻软件管理弹窗 ---------------- */
.apps-admin .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 12px;
}
.apps-admin .field {
  margin: 0;
  min-width: 0;
}
.apps-admin .field.span2 {
  grid-column: span 2;
}
.apps-admin .field label {
  display: block;
  margin-bottom: 4px;
}
.apps-admin .field input,
.apps-admin .adm-item input {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line, #d9d9de);
  border-radius: 8px;
  background: var(--bg-input, #fff);
  color: inherit;
  font-size: 14px;
}
.apps-admin .adm-item input {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
}
.apps-admin .adm-sec {
  margin: 14px 0 8px;
  font-size: 14px;
  opacity: 0.75;
}
.apps-admin .adm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.08);
  margin-bottom: 8px;
}
.apps-admin .adm-item .file-main {
  flex: 1;
  min-width: 0;
}

/* ---------------- 常驻软件直达工具条 ---------------- */
.apps-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.apps-bar::-webkit-scrollbar {
  display: none;
}
.apps-label {
  font-size: 12px;
  opacity: 0.55;
  white-space: nowrap;
  letter-spacing: 0.05em;
}
.apps-spacer {
  flex: 1;
}
.pinned-chips {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.chip-app {
  text-decoration: none;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 配置的软件：小卡片网格 ---------------- */
#cfgList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.cfg-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(127, 127, 127, 0.08);
  cursor: pointer;
  transition: background 160ms var(--ease, ease);
}
.cfg-tile:hover {
  background: rgba(127, 127, 127, 0.16);
}
.cfg-tile-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cfg-tile-sub {
  font-size: 11px;
  opacity: 0.55;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cfg-tile {
  padding-right: 56px;
  min-height: 64px;
}
.cfg-tile-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  gap: 2px;
}
.cfg-tile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity 120ms ease, background 120ms ease;
}
.cfg-tile-btn:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.18);
}
.cfg-tile-btn.danger:hover {
  color: #ff453a;
}
.cfg-tile-btn .ico {
  width: 15px;
  height: 15px;
}
.cfg-add-tile {
  justify-content: center;
}

/* ---------------- 弹窗层级：编辑/新增必须压在管理弹窗之上 ---------------- */
.modal#editModal,
.modal#addModal {
  z-index: 95; /* 管理弹窗 80 之上、toast 100 之下 */
}

/* 文件保留时长提醒 */
.file-meta .ret-warn {
  color: #ff9f0a;
  font-weight: 600;
}

/* ---------------- 下载弹窗键值行 ---------------- */
.dl-rows {
  margin: 10px 0;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
}
.dl-row {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.14);
  font-size: 13px;
  line-height: 1.5;
  align-items: baseline;
}
.dl-label {
  flex: 0 0 64px;
  opacity: 0.55;
  white-space: nowrap;
}
.dl-row span:not(.dl-label) {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
