/* 家庭冰箱 NFC 标签管理 — 原生 CSS，无框架、无 CDN */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #15803d;
  --green-soft: #dcfce7;
  --yellow: #b45309;
  --yellow-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --gray: #4b5563;
  --gray-soft: #f3f4f6;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
  --action-space: 108px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:active {
  opacity: 0.75;
}

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

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

.tiny {
  font-size: 12px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  word-break: break-all;
}

.app-shell {
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 12px 16px 24px;
}

body.has-action-bar .app-shell {
  padding-bottom: calc(var(--action-space) + env(safe-area-inset-bottom));
}

/* ---------------------------- 通用按钮与表单 ---------------------------- */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 17px;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn-primary {
  background: #111827;
  color: #fff;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
}

.btn-primary:active {
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.45;
  box-shadow: none;
}

.btn-secondary {
  min-height: 48px;
  padding: 0 16px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 15px;
  color: var(--text);
}

.btn-secondary:disabled,
.tag-actions .write-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary.small {
  min-height: 48px;
  padding: 0 12px;
  font-size: 14px;
}

.text-button {
  min-height: 48px;
  padding: 0 8px;
  color: var(--blue);
  font-weight: 600;
}

.text-input {
  width: 100%;
  min-height: 56px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 18px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.text-input::placeholder {
  color: #9ca3af;
  font-weight: 500;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.form-error {
  margin-top: 10px;
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
}

.form-error:empty {
  display: none;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.inline-form .text-input {
  flex: 1;
  min-width: 0;
}

.inline-form .btn-secondary {
  flex-shrink: 0;
}

/* ------------------------------ 加载 / 错误 ------------------------------ */

.center-box {
  min-height: 65dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 32px 12px;
}

.center-box h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.state-icon {
  font-size: 48px;
  line-height: 1;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ------------------------------ 登录视图 -------------------------------- */

.auth-card {
  width: min(100%, 420px);
  margin: 8dvh auto 0;
  padding: 24px 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.auth-card h1 {
  margin-top: 18px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.auth-card > .muted {
  margin-top: 6px;
  font-size: 14px;
}

.auth-card form {
  margin-top: 8px;
}

.auth-card .btn-primary {
  width: 100%;
  margin-top: 20px;
}

/* ------------------------------ 标签详情 -------------------------------- */

.status-strip {
  height: 10px;
  border-radius: 999px;
  margin: 4px 0 16px;
  background: var(--gray-soft);
  transition: background 0.2s ease;
}

.status-strip.ok {
  background: var(--green);
}

.status-strip.warn {
  background: #f59e0b;
}

.status-strip.danger {
  background: var(--red);
}

.status-strip.muted {
  background: var(--gray);
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 32px;
}

.status-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--gray-soft);
  color: var(--gray);
}

.status-label.ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-label.warn {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.status-label.danger {
  background: var(--red-soft);
  color: var(--red);
}

.status-label.free {
  background: var(--gray-soft);
  color: var(--gray);
}

.fridge-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.hero h1 {
  margin-top: 14px;
  font-size: clamp(34px, 10vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.hero.compact h1 {
  font-size: clamp(28px, 8vw, 38px);
}

.hero-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

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

.metric {
  padding: 16px 6px 14px;
  background: var(--card);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
  min-width: 0;
}

.metric-value {
  font-size: clamp(28px, 8.5vw, 38px);
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.metric-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.tip {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ------------------------------ 绑定表单 -------------------------------- */

.free-banner {
  margin: 2px 0 16px;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  background: var(--gray-soft);
  color: var(--gray);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.bind-form {
  padding: 20px 16px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.bind-form .field-label:first-child {
  margin-top: 0;
}

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

.chip {
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}

.chip.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #1d4ed8;
}

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

.chip.fridge-chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-shelf {
  margin-top: 4px;
}

.custom-shelf .text-input {
  font-size: 17px;
}

.bind-submit {
  width: 100%;
  margin-top: 24px;
  font-size: 18px;
}

#quick-fridge-form {
  margin-top: 8px;
}

#toggle-fridge-form {
  margin-top: 4px;
}

.bind-form .tiny {
  margin-top: 12px;
  text-align: center;
  line-height: 1.5;
}

/* ------------------------------ 底部操作栏 ------------------------------ */

.action-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(100%, 560px);
  transform: translateX(-50%);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(244, 245, 247, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

.action-row.confirm {
  grid-template-columns: 1.4fr 1fr;
}

.action-btn {
  min-height: 56px;
  padding: 0 8px;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  box-shadow: 0 3px 10px rgba(17, 24, 39, 0.08);
  white-space: nowrap;
}

.action-btn:active {
  transform: scale(0.98);
}

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

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

/* ------------------------------ Bottom sheet ---------------------------- */

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(17, 24, 39, 0.48);
}

.sheet {
  width: min(100%, 560px);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px rgba(17, 24, 39, 0.18);
  animation: sheet-up 0.2s ease-out;
}

@keyframes sheet-up {
  from {
    transform: translateY(30px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #d1d5db;
}

.sheet-title {
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.sheet-btn {
  min-height: 64px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  font-size: 18px;
  font-weight: 750;
}

.sheet-btn:active {
  background: var(--gray-soft);
}

.sheet-btn.full {
  grid-column: 1 / -1;
}

.sheet-btn.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #1d4ed8;
}

.sheet-help {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.custom-expiry {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.custom-expiry .btn-primary {
  width: 100%;
  margin-top: 12px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--action-space) + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: calc(100% - 40px);
  padding: 12px 20px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------ 登录独立页 ------------------------------ */

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-page .auth-card {
  margin: 0;
}

/* ------------------------------ 管理页 ---------------------------------- */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 18px;
}

.topbar .brand {
  font-size: 22px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.panel {
  margin-bottom: 14px;
  padding: 18px 16px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.panel h2,
.section-head h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.fridge-list {
  display: grid;
  gap: 12px;
}

.fridge-card {
  padding: 16px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

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

.fridge-title-wrap {
  flex: 1;
  min-width: 0;
}

.fridge-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.fridge-rename-input {
  min-height: 48px;
  font-size: 17px;
}

.fridge-meta {
  margin-top: 4px;
}

.food-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.food-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f9fafb;
}

.food-row .food-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.food-row .food-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.food-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warn {
  background: var(--yellow-soft);
  color: var(--yellow);
}

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

.food-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.empty {
  padding: 28px 16px;
  border: 1px dashed #d1d5db;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.empty-food {
  padding: 10px 0 2px;
}

/* ------------------------------ 清单首页 -------------------------------- */

.dashboard-page {
  padding-bottom: 48px;
}

.dash-summary {
  margin: 4px 0 18px;
}

.dash-summary .metric {
  min-height: 96px;
}

.metric-value.danger {
  color: var(--red);
}

.metric-value.warn {
  color: var(--yellow);
}

.metric-value.ok {
  color: var(--green);
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  padding: 14px 16px;
  background: var(--card);
  border-left: 5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.task-row.danger {
  border-left-color: var(--red);
}

.task-row.warn {
  border-left-color: #f59e0b;
}

.task-row.ok {
  border-left-color: var(--green);
}

.task-main {
  min-width: 0;
}

.task-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-title .food-name {
  font-size: 17px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.task-meta {
  margin-top: 4px;
}

.dash-empty {
  padding: 18px 16px;
  border: 1px dashed #d1d5db;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.reminder-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--yellow-soft);
  border: 1px solid #fcd34d;
  border-radius: 16px;
  color: #92400e;
}

.reminder-banner.danger {
  background: var(--red-soft);
  border-color: #fca5a5;
  color: #991b1b;
}

.reminder-title {
  font-size: 15px;
  font-weight: 800;
}

.reminder-detail {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.45;
}

.reminder-dismiss {
  flex-shrink: 0;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid currentColor;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: inherit;
}

.fridge-sections {
  display: grid;
  gap: 12px;
}

.fridge-sections .fridge-card {
  padding: 16px;
}

.fridge-sections .food-row {
  background: #f9fafb;
}

.tag-page-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.tag-page-actions .btn-primary,
.tag-page-actions .btn-secondary,
.tag-assign-button {
  width: 100%;
}

.tag-assign-button {
  margin-top: 18px;
}

.add-food-form {
  padding-top: 2px;
}

.add-food-sheet .field-label:first-child {
  margin-top: 12px;
}

.add-food-sheet .custom-shelf {
  margin-top: 4px;
}

.add-food-sheet .bind-submit {
  margin-top: 20px;
}

.food-row.has-actions {
  display: block;
}

.food-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.food-actions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.food-actions-row.confirm {
  grid-template-columns: 1.4fr 1fr;
}

.food-action-btn {
  min-height: 48px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}

.food-action-btn:active {
  background: var(--gray-soft);
}

.food-action-btn.danger {
  color: var(--red);
}

.food-action-btn.danger-solid {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.food-action-btn:disabled {
  opacity: 0.5;
}

.food-restore-btn {
  grid-column: 1 / -1;
  min-height: 48px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* ------------------------------ 标签 / 二维码 ---------------------------- */

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

.fridge-actions .text-button {
  padding: 0 6px;
  font-size: 14px;
}

.label-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.label-sheet-head .sheet-title {
  margin-bottom: 2px;
}

.label-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.label-card {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.label-qr {
  flex: 0 0 132px;
  width: 132px;
  height: 132px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.label-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.label-info {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.label-card-title {
  font-size: 16px;
  font-weight: 800;
}

.label-url {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.label-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.label-actions .btn-secondary {
  flex: 1;
  min-width: 100px;
}

.calendar-url {
  margin-top: 12px;
  padding: 12px;
  background: var(--gray-soft);
  border-radius: 12px;
  color: var(--gray);
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
}

.calendar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.calendar-actions .btn-secondary {
  flex: 1;
  min-width: 120px;
}

.print-area {
  display: none;
}

@media (max-width: 480px) {
  .label-card {
    flex-direction: column;
  }

  .label-qr {
    align-self: center;
    width: 160px;
    height: 160px;
    flex-basis: 160px;
  }

  .label-actions {
    margin-top: 10px;
  }
}

@media print {
  body > * {
    display: none !important;
  }

  body > #print-area {
    display: block !important;
  }

  .print-card {
    padding: 20px;
    text-align: center;
  }

  .print-card h1 {
    margin: 0 0 16px;
    font-size: 28px;
  }

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

  .print-qr svg {
    width: 280px;
    height: 280px;
  }

  .print-card p {
    margin: 10px 0 4px;
    color: #333;
    font-size: 14px;
  }

  .print-url {
    color: #555;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    word-break: break-all;
  }

  @page {
    margin: 12mm;
  }
}

@media (max-width: 380px) {
  .dash-summary .metric {
    min-height: 86px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .dash-summary .metric-label {
    font-size: 12px;
  }
}

/* ------------------------------ NFC 写入页 ------------------------------ */

.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: #1e3a8a;
  font-size: 14px;
  line-height: 1.55;
}

.notice.danger {
  background: var(--red-soft);
  color: #7f1d1d;
}

.notice strong {
  font-weight: 800;
}

.notice .mono {
  word-break: break-all;
}

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

.tag-row {
  padding: 12px 14px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.tag-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tag-index {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.tag-url {
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray);
  word-break: break-all;
}

.tag-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tag-actions .btn-secondary {
  flex: 1;
}

.tag-actions .write-btn {
  flex: 1.3;
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.tag-row.written {
  border: 2px solid var(--green-soft);
}

.tag-row.writing {
  border: 2px solid var(--blue);
}

.tag-row.failed {
  border: 2px solid var(--red-soft);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.writing {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.status-badge.failed {
  background: var(--red-soft);
  color: var(--red);
}

.init-actions {
  display: grid;
  gap: 10px;
  margin: 16px 0 4px;
}

.init-actions .btn-primary,
.init-actions .btn-secondary {
  width: 100%;
}

.result-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--gray);
  font-size: 13px;
  word-break: break-all;
}

.result-list li {
  margin: 4px 0;
}

/* ------------------------------ 小屏适配 -------------------------------- */

@media (max-width: 380px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .action-bar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .action-btn {
    font-size: 14px;
  }

  .chip {
    padding: 0 13px;
  }

  .cards {
    gap: 7px;
  }
}

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