/* Claim-Ready visual v2 — Apple HID / System Blue landing
   Source: ../ui-proposal-v2/proposal.css (approved)
   Class names preserved for app.js / index.html.
   Print / #print-root block kept equivalent to pre-v2.
   Elder overrides: html[data-theme="elder"] — still switchable.
*/

:root {
  --page: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #1C1C1E;
  --ink-2: #3A3A3C;
  --ink-muted: #8E8E93;
  --sep: #E5E5EA;
  --sep-soft: #F2F2F7;
  --blue: #007AFF;
  --blue-press: #0066D6;
  --blue-soft: #E8F2FF;
  --blue-tint: #F0F7FF;
  --green: #34C759;
  --green-soft: #E8F8ED;
  --green-ink: #1B7A36;
  --warn: #B45309;
  --warn-bg: #FFFBEB;
  --warn-line: #F59E0B;
  --danger: #FF3B30;
  --shadow: 0 8px 28px rgba(28, 28, 30, 0.08);
  --shadow-card: 0 1px 3px rgba(28, 28, 30, 0.04);
  --shadow-sheet: 0 8px 28px rgba(28, 28, 30, 0.08);
  --phone-edge: #1C1C1E;
  --cs-bg: #F0F7FF;
  --radius-phone: 40px;
  --radius-card: 14px;
  --radius-btn: 14px;
  --radius-input: 10px;
  --radius-pill: 100px;
  --font: -apple-system, "SF Pro Text", "SF Pro Display", "PingFang TC",
    "Noto Sans TC", "Helvetica Neue", "Microsoft JhengHei", sans-serif;

  /* Aliases used by elder / legacy selectors */
  --bg-page: var(--page);
  --bg-surface: var(--surface);
  --line: var(--sep);
  --brand: var(--blue);
  --brand-deep: var(--blue-press);
  --brand-soft: var(--blue-soft);
  --brand-tint: var(--blue-tint);
}

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

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

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  padding: 16px 12px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 100vh;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* —— Guard strip (above phone) —— */
.guard {
  max-width: 390px;
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--sep);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-muted);
  box-shadow: var(--shadow-card);
  text-align: center;
}
.guard strong { color: var(--ink-2); font-weight: 600; }

/* —— Specimen banner (must stay readable) —— */
.specimen-banner {
  max-width: 390px;
  width: 100%;
  margin: 0 auto;
  padding: 10px 16px;
  background: var(--warn-bg);
  border: 1.5px solid var(--warn-line);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  border-radius: 10px;
  font-weight: 600;
}

.list-header .seed-note,
.seed-note {
  display: block;
  font-size: 11px;
  color: var(--warn);
  margin-top: 4px;
  font-weight: 500;
  width: 100%;
}

/* —— Phone chrome —— */
.phone {
  width: 390px;
  height: 844px;
  background: var(--surface);
  border: 3px solid var(--phone-edge);
  border-radius: var(--radius-phone);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.bezel-top {
  height: 44px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--surface);
  flex-shrink: 0;
  padding-top: 4px;
}
.notch {
  width: 110px;
  height: 28px;
  background: var(--phone-edge);
  border-radius: 18px;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.status {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  z-index: 1;
}

.screen-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(844px - 44px - 48px - 56px);
  background: var(--page);
}
.screen[hidden] { display: none !important; }
.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

/* —— Nav —— */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 4px;
  border-bottom: none;
  flex-shrink: 0;
  min-height: 44px;
  gap: 12px;
}
.nav-bar .title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.2;
}
.nav-bar .sub {
  display: none; /* kill bilingual clutter — proposal v2 */
}
.nav-link {
  font-size: 15px;
  color: var(--blue);
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  min-height: 36px;
}
.nav-link:active { background: var(--blue-tint); filter: brightness(0.97); }

/* —— Tab bar —— */
.tab-bar {
  min-height: 88px;
  border-top: 0.5px solid var(--sep);
  display: flex;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink-muted);
  gap: 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  padding: 4px;
  min-height: 48px;
  font-weight: 500;
}
.tab:last-child { border-right: none; }
.tab.active {
  color: var(--blue);
  font-weight: 600;
  background: transparent;
}
.tab.active::after { display: none; }
.tab .ico {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: var(--sep-soft);
}
.tab.active .ico {
  background: var(--blue-soft);
  border-color: transparent;
  box-shadow: none;
}

/* —— Cards / boxes —— */
.box {
  border: none;
  border-radius: 16px;
  background: var(--surface);
  padding: 4px 16px;
  box-shadow: var(--shadow-card);
}
.box.dashed {
  border: none;
  background: var(--sep-soft);
  box-shadow: none;
  padding: 14px 16px;
  border-radius: 16px;
}
.box.photo {
  height: auto;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 12px;
  position: relative;
  overflow: hidden;
  background: var(--sep-soft);
  border: none;
  border-radius: 18px;
  padding: 24px 16px;
  box-shadow: none;
  text-align: center;
}
.box.photo .cam {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  position: relative;
}
.box.photo .cam::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.box.photo #proof-caption {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.box.photo .hint {
  font-size: 12px;
  color: var(--ink-muted);
}
.box.photo img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
}
.box.photo.has-img .cam,
.box.photo.has-img #proof-caption,
.box.photo.has-img .hint { display: none; }

.file-hit {
  font-size: 13px;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--blue);
  margin-top: 2px;
  font-weight: 600;
  background: var(--blue-soft);
}
.file-hit:active { background: var(--blue-tint); }

/* —— Fields (iOS grouped list) —— */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--sep);
}
.field:last-child {
  margin-bottom: 0;
  border-bottom: none;
}
.field label {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.field label em {
  color: var(--blue);
  font-style: normal;
  font-weight: 700;
}
.field input {
  border: none;
  border-radius: 0;
  height: auto;
  min-height: 28px;
  background: transparent;
  padding: 2px 0;
  font-size: 17px;
  color: var(--ink);
  font-family: inherit;
  width: 100%;
  outline: none;
  font-weight: 400;
}
.field input::placeholder { color: #C7C7CC; }
.field input:focus {
  border: none;
  box-shadow: none;
}
.field input.invalid {
  color: var(--danger);
  background: transparent;
  box-shadow: none;
}
.field input.invalid:focus {
  box-shadow: none;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.row-2 .field {
  border-bottom: 0.5px solid var(--sep);
}

/* —— CTA —— */
.cta {
  margin-top: auto;
  border: none;
  background: var(--blue);
  border-radius: var(--radius-btn);
  min-height: 54px;
  height: auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.cta:active {
  background: var(--blue-press);
  box-shadow: none;
  transform: scale(0.98);
}
.cta.secondary,
.cta.ghost {
  background: transparent;
  border: none;
  min-height: 44px;
  height: auto;
  font-size: 16px;
  font-weight: 500;
  color: var(--blue);
  margin-top: 0;
  box-shadow: none;
}
.cta.secondary:active,
.cta.ghost:active {
  background: var(--blue-tint);
  transform: scale(0.98);
}
.cta.text-only {
  background: transparent;
  border: none;
  min-height: 40px;
  height: auto;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-top: 0;
  box-shadow: none;
}
.cta.text-only:active {
  background: transparent;
  color: var(--ink-2);
  transform: scale(0.98);
}

/* —— Badge —— */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  letter-spacing: -0.01em;
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.list-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  gap: 8px;
}

/* —— List rows (≥76px touch) —— */
.item-row {
  border: none;
  border-left: none;
  border-radius: 16px;
  padding: 14px 14px 14px 16px;
  min-height: 76px;
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: background 0.12s, transform 0.1s;
}
.item-row:active {
  background: var(--blue-tint);
  transform: scale(0.985);
}
.item-row .thumb {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--sep-soft);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ink-muted);
}
.item-row .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item-row .info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.item-row .name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.item-row .meta-line {
  font-size: 13px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0;
}
.item-row .meta-line:last-of-type {
  font-size: 12px;
  color: #AEAEB2;
}
.item-row .chev {
  font-size: 20px;
  color: #C7C7CC;
  font-weight: 300;
  flex-shrink: 0;
  margin-left: auto;
}
.item-open {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 14px;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.item-open:active { opacity: 0.82; }
.row-edit {
  flex-shrink: 0;
  border: none;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  min-height: 36px;
  cursor: pointer;
}
.row-edit:active { background: var(--blue-tint); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.library-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: -6px;
}
.text-action {
  border: none;
  background: transparent;
  color: var(--blue);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  padding: 6px 8px;
  min-height: 36px;
  cursor: pointer;
  border-radius: var(--radius-pill);
}
.text-action:active { background: var(--blue-tint); }
.text-action:disabled { opacity: 0.45; }
.library-status {
  font-size: 13px;
  line-height: 1.4;
  color: var(--green-ink);
  background: var(--green-soft);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: left;
}
.library-status.error {
  color: #991B1B;
  background: #FFF5F5;
  border: 1px solid var(--danger);
}
.danger-text { color: var(--danger) !important; }
.dialog {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(28, 28, 30, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px 20px;
}
.dialog[hidden] { display: none !important; }
.dialog-card {
  width: 100%;
  background: var(--surface);
  border-radius: 16px;
  padding: 20px 16px 14px;
  box-shadow: var(--shadow-sheet);
}
.dialog-card h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--ink);
}
.dialog-card p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dialog-btn {
  border: none;
  border-radius: var(--radius-btn);
  min-height: 48px;
  padding: 12px 16px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.dialog-btn.primary {
  background: var(--blue);
  color: #fff;
}
.dialog-btn.primary.danger {
  background: var(--danger);
}
.dialog-btn.secondary {
  background: var(--sep-soft);
  color: var(--ink);
}
.dialog-btn.quiet {
  background: transparent;
  color: var(--ink-muted);
  min-height: 40px;
  font-weight: 500;
  font-size: 15px;
}

.hint {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.45;
  text-align: center;
}
.spacer { flex: 1; min-height: 8px; }

.form-error {
  border: 1px solid var(--danger);
  background: #FFF5F5;
  color: #991B1B;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}

/* —— Claim Pack: paper sheet —— */
.preview-sheet {
  border: 1px solid var(--sep);
  border-top: none;
  border-radius: 4px 4px 12px 12px;
  background: var(--surface);
  padding: 20px 18px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
  position: relative;
}
.preview-sheet::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue) 40%, var(--sep) 40%);
  border-radius: 4px 4px 0 0;
}
.preview-sheet h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: none;
  padding-bottom: 0;
  padding-top: 4px;
  margin-bottom: 14px;
}
.preview-sheet .line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 0;
  padding: 10px 0;
  border-top: 0.5px solid var(--sep);
  font-size: 14px;
}
.preview-sheet .k {
  color: var(--ink-muted);
  min-width: auto;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}
.preview-sheet .v {
  color: var(--ink);
  font-weight: 600;
  word-break: break-word;
  font-size: 14px;
  text-align: right;
}
.preview-sheet .proof-box {
  margin-top: 14px;
  border: none;
  border-radius: 10px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--sep-soft);
}
.preview-sheet .proof-box img {
  max-height: 64px;
  max-width: 100%;
  object-fit: contain;
}

.cs-block {
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--blue-tint);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.cs-block .cs-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cs-text {
  margin: 0;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}

.copy-toast {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: var(--green-soft);
  color: var(--green-ink);
  padding: 6px 10px;
  border-radius: 8px;
}

/* Capture form: CTA spacing before tab */
#capture-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
#capture-form .cta {
  margin-top: auto;
  margin-bottom: 0;
}

/* Claim Pack CTA stack — one solid CTA */
#screen-claim .cta {
  margin-top: 8px;
}
#screen-claim .cta.secondary,
#screen-claim .cta.ghost,
#screen-claim .cta.text-only {
  margin-top: 0;
  margin-bottom: 0;
}

/* —— Claim-Ready / warn chips (list serial meta) —— */
.chip-ready {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  vertical-align: middle;
}
.chip-ready::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.chip-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--sep-soft);
  color: var(--ink-muted);
  border: none;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.chip-warn::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C7C7CC;
  flex-shrink: 0;
}

/* —— Theme switcher (above phone, near guard/specimen) —— */
.theme-switcher {
  max-width: 390px;
  width: 100%;
  display: flex;
  gap: 8px;
  justify-content: center;
}
.theme-pill {
  flex: 1;
  border: 1px solid var(--sep);
  background: var(--surface);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  line-height: 1.3;
  min-height: 44px;
}
.theme-pill:active { filter: brightness(0.97); }
.theme-pill.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: none;
}

/* ============================================================
   Elder theme — colorful, high-contrast, larger type/targets
   Activated via html[data-theme="elder"]
   ============================================================ */
html[data-theme="elder"] {
  --page: #FFF8F0;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #1E293B;
  --ink-muted: #334155;
  --sep: #CBD5E1;
  --sep-soft: #F1F5F9;
  --blue: #E85D4C;
  --blue-press: #C2410C;
  --blue-soft: #FFEDD5;
  --blue-tint: #FFF7ED;
  --green: #16A34A;
  --green-soft: #DCFCE7;
  --green-ink: #166534;
  --warn: #B45309;
  --warn-bg: #FFFBEB;
  --warn-line: #F59E0B;
  --danger: #DC2626;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-sheet: 0 4px 16px rgba(15, 23, 42, 0.12);
  --phone-edge: #1E293B;
  --cs-bg: #E0F2FE;
  --sky: #0284C7;
  --sky-soft: #BAE6FD;
  --sky-tint: #F0F9FF;
  --offline: #2563EB;
  --offline-soft: #DBEAFE;
  --success: #16A34A;
  --success-soft: #DCFCE7;

  --bg-page: var(--page);
  --bg-surface: var(--surface);
  --line: var(--sep);
  --brand: var(--blue);
  --brand-deep: var(--blue-press);
  --brand-soft: var(--blue-soft);
  --brand-tint: var(--blue-tint);
}

html[data-theme="elder"] body {
  line-height: 1.5;
}

html[data-theme="elder"] .guard {
  font-size: 13px;
  border-color: var(--sky);
  border-left: 4px solid var(--sky);
  color: var(--ink-muted);
  text-align: left;
}

html[data-theme="elder"] .specimen-banner {
  font-size: 14px;
  font-weight: 700;
}

html[data-theme="elder"] .theme-pill {
  font-size: 14px;
  padding: 10px 14px;
  min-height: 44px;
}
html[data-theme="elder"] .theme-pill.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-press);
}

html[data-theme="elder"] .bezel-top {
  background: var(--sky-tint);
}

html[data-theme="elder"] .status {
  font-size: 12px;
  color: var(--ink);
}

html[data-theme="elder"] .screen-body {
  gap: 14px;
  padding: 16px 16px 14px;
}

html[data-theme="elder"] .nav-bar {
  background: var(--sky);
  margin: -16px -16px 0;
  padding: 14px 16px 14px;
  border-bottom: none;
  border-radius: 0;
}
html[data-theme="elder"] .nav-bar .title {
  font-size: 21px;
  color: #FFFFFF;
  font-weight: 700;
}
html[data-theme="elder"] .nav-bar .sub {
  display: none;
}
html[data-theme="elder"] .nav-link {
  font-size: 15px;
  padding: 10px 16px;
  min-height: 44px;
  color: var(--sky);
  background: #FFFFFF;
  border: 2px solid #FFFFFF;
}
html[data-theme="elder"] .nav-link:active {
  background: var(--sky-soft);
  filter: none;
}

html[data-theme="elder"] .tab-bar {
  min-height: 64px;
  height: auto;
}
html[data-theme="elder"] .tab {
  font-size: 13px;
  gap: 4px;
  color: var(--ink-muted);
}
html[data-theme="elder"] .tab.active {
  color: var(--blue-press);
  background: var(--blue-tint);
}
html[data-theme="elder"] .tab.active::after {
  display: block;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--blue);
}
html[data-theme="elder"] .tab .ico {
  width: 26px;
  height: 26px;
}
html[data-theme="elder"] .tab.active .ico {
  background: var(--blue-soft);
}

html[data-theme="elder"] .box {
  padding: 8px 16px;
  border: 1.5px solid var(--sep);
  box-shadow: none;
}
html[data-theme="elder"] .box.dashed {
  background: var(--sky-tint);
  border: 1.5px solid var(--sky-soft);
  padding: 16px;
}
html[data-theme="elder"] .box.photo {
  min-height: 128px;
  font-size: 15px;
  color: var(--ink-muted);
  border: none;
  background: var(--sep-soft);
}
html[data-theme="elder"] .box.photo .cam {
  width: 48px;
  height: 48px;
}
html[data-theme="elder"] .box.photo .cam::after {
  border-color: var(--sky);
}
html[data-theme="elder"] .file-hit {
  font-size: 14px;
  padding: 8px 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--sky);
  background: var(--sky-soft);
}

html[data-theme="elder"] .field {
  gap: 6px;
  padding: 14px 0;
}
html[data-theme="elder"] .field label {
  font-size: 14px;
  color: #1E293B;
  font-weight: 700;
}
html[data-theme="elder"] .field label em {
  color: var(--blue);
}
html[data-theme="elder"] .field input {
  min-height: 32px;
  font-size: 17px;
}
html[data-theme="elder"] .field input:focus {
  border: none;
  box-shadow: none;
}

html[data-theme="elder"] .cta {
  min-height: 56px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(232, 93, 76, 0.35);
}
html[data-theme="elder"] .cta.secondary,
html[data-theme="elder"] .cta.ghost {
  min-height: 88px;
  font-size: 16px;
  color: var(--blue);
  box-shadow: none;
}
html[data-theme="elder"] .cta.text-only {
  min-height: 48px;
  font-size: 15px;
  color: var(--ink-muted);
}

/* Offline badge → bright blue block */
html[data-theme="elder"] .badge {
  border: none;
  color: #FFFFFF;
  background: var(--offline);
  font-size: 12px;
  padding: 6px 14px;
}
html[data-theme="elder"] .badge .dot {
  background: #FFFFFF;
  width: 7px;
  height: 7px;
  box-shadow: none;
}
/* Offline badge inside sky nav: keep white chip look */
html[data-theme="elder"] .nav-bar .badge {
  background: #FFFFFF;
  color: var(--offline);
}
html[data-theme="elder"] .nav-bar .badge .dot {
  background: var(--offline);
}

html[data-theme="elder"] .item-row {
  min-height: 72px;
  padding: 14px 16px;
  border: 1.5px solid var(--sep);
  border-left: 5px solid var(--sky);
  margin-bottom: 10px;
  box-shadow: none;
}
html[data-theme="elder"] .item-row:active {
  background: var(--sky-tint);
}
html[data-theme="elder"] .item-row .thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  font-size: 11px;
}
html[data-theme="elder"] .item-row .name {
  font-size: 18px;
}
html[data-theme="elder"] .item-row .meta-line {
  font-size: 14px;
  color: #475569;
}
html[data-theme="elder"] .item-row .meta-line:last-of-type {
  font-size: 13px;
  color: #64748B;
}
html[data-theme="elder"] .item-row .chev {
  font-size: 22px;
  color: var(--sky);
}

html[data-theme="elder"] .hint {
  font-size: 14px;
  color: #475569;
}

html[data-theme="elder"] .form-error {
  font-size: 14px;
  padding: 12px 14px;
}

html[data-theme="elder"] .preview-sheet {
  border: 1.5px solid var(--sep);
  border-top: none;
  font-size: 14px;
  padding: 18px;
}
html[data-theme="elder"] .preview-sheet::before {
  height: 4px;
  background: linear-gradient(90deg, var(--sky) 0%, var(--sky) 40%, var(--sep) 40%);
}
html[data-theme="elder"] .preview-sheet h4 {
  font-size: 13px;
  color: var(--sky);
  letter-spacing: 0.06em;
}
html[data-theme="elder"] .preview-sheet .k {
  font-size: 14px;
  color: #475569;
}
html[data-theme="elder"] .preview-sheet .v {
  font-size: 16px;
}
html[data-theme="elder"] .preview-sheet .proof-box {
  font-size: 13px;
  min-height: 64px;
  background: var(--sky-tint);
}

html[data-theme="elder"] .cs-block {
  font-size: 14px;
  padding: 14px 16px;
  background: var(--cs-bg);
  border: 1.5px solid var(--sky-soft);
}
html[data-theme="elder"] .cs-block .cs-label {
  font-size: 13px;
  color: var(--sky);
  font-weight: 700;
}
html[data-theme="elder"] .cs-text {
  font-size: 16px;
}

html[data-theme="elder"] .copy-toast {
  font-size: 14px;
  background: var(--success-soft);
  color: var(--success);
}

/* Success chip → bright green soft pill */
html[data-theme="elder"] .chip-ready {
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  padding: 5px 12px;
}
html[data-theme="elder"] .chip-ready::before {
  background: var(--success);
}
html[data-theme="elder"] .chip-warn {
  font-size: 12px;
  padding: 5px 12px;
  background: var(--sep-soft);
  color: var(--ink-muted);
}

html[data-theme="elder"] .list-header .seed-note,
html[data-theme="elder"] .seed-note {
  font-size: 13px;
}

html[data-theme="elder"] .list-header .hint {
  font-size: 14px;
}

/* Phone chrome height: taller tab bar under elder */
html[data-theme="elder"] .screen-body {
  height: calc(844px - 44px - 64px);
}

@media (max-width: 420px) {
  html[data-theme="elder"] .theme-switcher {
    max-width: none;
    padding: 0 8px;
  }
}


/* —— Proofy brand chrome (Guidelines v1 · light touch) —— */
.brand-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 8px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--sep);
  flex-shrink: 0;
  min-height: 52px;
}
.brand-mascot {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 50%;
}
.brand-lockup {
  height: 80px;
  width: auto;
  max-width: min(360px, 90vw);
  object-fit: contain;
  object-position: left center;
  display: block;
  flex-shrink: 0;
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px 24px;
  text-align: center;
}
.empty-state .empty-mascot {
  border-radius: 50%;
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin: 0 auto 4px; /* clear space around face */
}
.empty-state .hint {
  text-align: center;
  margin: 0;
  max-width: 240px;
}

.print-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.print-mascot {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 50%;
}
.print-brand-text h1 {
  font-size: 18pt;
  margin: 2px 0 0;
  line-height: 1.2;
}

/* —— Print / PDF one-pager —— keep visual; capture class for html2canvas —— */
#print-root { display: none; }
/* 下載 PDF 時暫時顯示（離屏），套用與 @media print 同等版式 */
#print-root.pdf-capture-active {
  display: block !important;
  position: fixed;
  left: 0;
  top: 0;
  width: 210mm;
  z-index: -1;
  opacity: 1;
  pointer-events: none;
  background: #fff;
}
#print-root.pdf-capture-active .print-page {
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 16mm;
  box-sizing: border-box;
  font-family: Arial, "Noto Sans TC", sans-serif;
  color: #17212b;
  background: #fff;
}
#print-root.pdf-capture-active .print-page header {
  border-bottom: 2px solid #17212b;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
#print-root.pdf-capture-active .print-page .pk {
  font-size: 9pt; letter-spacing: 0.12em; color: #4c5c68; font-weight: 700;
}
#print-root.pdf-capture-active .print-page .print-brand {
  display: flex; align-items: center; gap: 8px;
}
#print-root.pdf-capture-active .print-page .print-mascot {
  width: 32px; height: 32px; object-fit: contain; flex-shrink: 0;
}
#print-root.pdf-capture-active .print-page .print-brand-text h1 {
  font-size: 18pt; margin: 2px 0 0; line-height: 1.2;
}
#print-root.pdf-capture-active .print-page h1 { font-size: 18pt; margin: 2px 0 0; }
#print-root.pdf-capture-active .print-page .pd { font-size: 10pt; color: #4c5c68; }
#print-root.pdf-capture-active .print-page .pline {
  font-size: 11pt; margin: 6px 0; border-bottom: 1px solid #aaa; padding-bottom: 4px;
}
#print-root.pdf-capture-active .print-page .pline b {
  display: inline-block; min-width: 110px; color: #4c5c68; font-size: 9pt;
}
#print-root.pdf-capture-active .print-page .pproof {
  margin: 12px 0; border: 1.5px dashed #888; min-height: 45mm;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #666; font-size: 10pt;
}
#print-root.pdf-capture-active .print-page .pproof img {
  max-height: 40mm; max-width: 160mm; object-fit: contain;
}
#print-root.pdf-capture-active .print-page .ppaste {
  border: 1px solid #17212b; border-left: 4px solid #b34836;
  padding: 10px 12px; background: #f7f8f9; font-family: Consolas, monospace;
  font-size: 10pt; line-height: 1.6; margin-top: 12px;
}
#print-root.pdf-capture-active .print-page footer {
  margin-top: 20px; border-top: 1px solid #ccc; padding-top: 6px;
  font-size: 8pt; color: #6d7880;
}
@media print {
  body * { visibility: hidden; }
  #print-root, #print-root * { visibility: visible; }
  #print-root {
    display: block; position: absolute; left: 0; top: 0; width: 100%;
  }
  .print-page {
    width: 210mm; min-height: 297mm; padding: 14mm 16mm;
    font-family: Arial, "Noto Sans TC", sans-serif; color: #17212b;
  }
  .print-page header { border-bottom: 2px solid #17212b; padding-bottom: 8px; margin-bottom: 12px; }
  .print-page .pk { font-size: 9pt; letter-spacing: 0.12em; color: #4c5c68; font-weight: 700; }
  .print-page .print-brand { display: flex; align-items: center; gap: 8px; }
  .print-page .print-mascot { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
  .print-page .print-brand-text h1 { font-size: 18pt; margin: 2px 0 0; line-height: 1.2; }
  .print-page h1 { font-size: 18pt; margin: 2px 0 0; }
  .print-page .pd { font-size: 10pt; color: #4c5c68; }
  .print-page .pline { font-size: 11pt; margin: 6px 0; border-bottom: 1px solid #aaa; padding-bottom: 4px; }
  .print-page .pline b { display: inline-block; min-width: 110px; color: #4c5c68; font-size: 9pt; }
  .print-page .pproof {
    margin: 12px 0; border: 1.5px dashed #888; min-height: 45mm;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #666; font-size: 10pt;
  }
  .print-page .pproof img { max-height: 40mm; max-width: 160mm; object-fit: contain; }
  .print-page .ppaste {
    border: 1px solid #17212b; border-left: 4px solid #b34836;
    padding: 10px 12px; background: #f7f8f9; font-family: Consolas, monospace;
    font-size: 10pt; line-height: 1.6; margin-top: 12px;
  }
  .print-page footer {
    margin-top: 20px; border-top: 1px solid #ccc; padding-top: 6px;
    font-size: 8pt; color: #6d7880;
  }
  @page { size: A4; margin: 0; }
}

html[data-theme="elder"] .row-edit {
  font-size: 15px;
  min-height: 40px;
  padding: 8px 14px;
}
html[data-theme="elder"] .dialog-card h3 { font-size: 20px; }
html[data-theme="elder"] .dialog-card p { font-size: 16px; }
html[data-theme="elder"] .library-status { font-size: 15px; }

/* Author `display` rules must not keep [hidden] elements on screen. */
[hidden] { display: none !important; }

@media (max-width: 420px) {
  body { padding: 0; }
  .guard { border-radius: 0; max-width: none; }
  .specimen-banner { border-radius: 0; max-width: none; }
  .phone {
    width: 100%; max-width: 390px; height: 100vh; max-height: none;
    border-radius: 0; border-left: none; border-right: none;
  }
  .screen-body { height: auto; flex: 1; }
  html[data-theme="elder"] .screen-body { height: auto; }
}
