:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --danger: #b91c1c;
  --ok: #047857;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
body { min-height: 100vh; min-height: 100dvh; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 8px; }
button, input, textarea, select { font: inherit; }
button { min-height: 44px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; padding: 0 14px; }
button.secondary { background: #e5e7eb; color: var(--text); }
button.danger { background: #fee2e2; color: var(--danger); }
button:disabled { opacity: .45; }
input, textarea, select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--text); font-size: 16px; }
textarea { resize: vertical; }
label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
label input { margin-top: 6px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: 13px; word-break: break-word; white-space: pre-wrap; }
#app { padding: 16px 14px calc(76px + var(--safe-bottom)); max-width: 720px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.icon-button { background: transparent; color: var(--accent); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.filters button { background: #eef2ff; color: #3730a3; min-height: 36px; white-space: nowrap; }
.filters button.active { background: var(--accent); color: #fff; }
.search { margin: 4px 0 10px; }
.item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.item-card h3 { font-size: 16px; margin: 0 0 6px; }
.item-card .sub, .item-card .meta { color: var(--muted); font-size: 13px; }
.item-card .row { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; align-items: center; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; white-space: nowrap; }
.badge.ready { background: #ecfdf5; color: var(--ok); }
.badge.transferred { background: #f3f4f6; color: #4b5563; }
.badge.paused, .badge.rejected, .badge.dropped { background: #fef3c7; color: #92400e; }
.fab { position: fixed; right: 18px; bottom: calc(76px + var(--safe-bottom)); width: 52px; height: 52px; min-height: 52px; border-radius: 50%; font-size: 28px; padding: 0; box-shadow: 0 6px 16px rgba(37, 99, 235, .35); z-index: 5; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); z-index: 10; }
.tabbar button { flex: 1; background: transparent; color: var(--muted); border-radius: 0; }
.tabbar button.active { color: var(--accent); font-weight: 600; }
.sheet { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: flex; align-items: flex-end; z-index: 20; }
.sheet-body { background: #fff; width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + var(--safe-bottom)); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.field { margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: #f3f4f6; color: var(--text); min-height: 38px; padding: 0 12px; border: 1px solid transparent; }
.chips button.selected { background: #eef2ff; border-color: var(--accent); color: #1d4ed8; }
.source-card { border-left: 3px solid var(--accent); padding: 8px 10px; background: #f8fafc; margin-bottom: 8px; font-size: 14px; }
.source-card .meta { color: var(--muted); font-size: 12px; }
.source-card .quote { margin-top: 4px; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; padding: 10px 0 2px; display: grid; gap: 8px; }
.d-title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.plain-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; font-size: 14px; }
.plain-list li .actions { display: flex; gap: 6px; }
.plain-list li button { min-height: 34px; padding: 0 10px; font-size: 13px; }
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: rgba(17, 24, 39, .92); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 86vw; z-index: 40; }
.external-link { display: inline-block; margin-top: 6px; color: var(--accent); font-size: 14px; }
