/* ==========================================================================
   フリマ仕入れ管理 — app.css
   Mobile-first. 8 px grid (4 px half-steps), type scale 12/13/15/17/20/24/32.
   Light + dark themes via CSS variables (prefers-color-scheme + [data-theme] override).
   No web fonts, no remote assets.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Consolas", "Roboto Mono", "Menlo", monospace;

  --fs-12: 12px; --fs-13: 13px; --fs-15: 15px; --fs-17: 17px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  --r-xs: 6px; --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 150ms; --t: 200ms;

  --tabbar-h: 64px;
  --sidebar-w: 248px;
  --detail-w: 480px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* light theme */
  color-scheme: light;
  --bg: #F5F7FA;
  --bg-blur: rgba(245, 247, 250, .86);
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #F1F4F8;
  --surface-hover: #F6F8FB;
  --border: #E4E8EF;
  --border-strong: #D3DAE4;
  --text: #0F172A;
  --text-2: #334155;
  --text-muted: #5B6B81;   /* ≥ 4.5:1 on --bg and --surface-3 */
  --text-faint: #94A3B8;   /* decorative / disabled only (icons, placeholders) — never for information */

  --accent: #4F46E5;
  --accent-strong: #4338CA;
  --accent-soft: #EEF0FF;
  --accent-soft-2: #E0E3FF;
  --accent-text: #4338CA;
  --on-accent: #FFFFFF;

  --info: #2563EB;   --info-soft: #EEF4FF;   --info-text: #1D4ED8;
  --success: #059669; --success-soft: #EAF8F2; --success-text: #047857;
  --warn: #D97706;   --warn-soft: #FFF6E6;   --warn-text: #B45309;
  --danger: #DC2626; --danger-soft: #FEF0F0; --danger-text: #B91C1C;
  --neutral-soft: #F1F4F8; --neutral-text: #475569;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 4px rgba(15, 23, 42, .04);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14), 0 2px 8px rgba(15, 23, 42, .06);
  --scrim: rgba(15, 23, 42, .42);
  --focus: rgba(79, 70, 229, .55);
  --skeleton: #EDF0F5;
  --skeleton-shine: rgba(255, 255, 255, .7);

  --plat-mercari: #BD3622;       /* badge text ≥ 4.5:1 on its own 10% tint */
  --plat-mercari_shops: #B93C27;
  --plat-yahoo_flea: #C0266D;
  --plat-yahoo_auction: #8F5C09;
  --plat-rakuma: #A3263F;
  --plat-unknown: #64748B;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1120;
    --bg-blur: rgba(11, 17, 32, .84);
    --surface: #121A2B;
    --surface-2: #151E31;
    --surface-3: #1A2438;
    --surface-hover: #172136;
    --border: #222D42;
    --border-strong: #2E3A52;
    --text: #E7EBF3;
    --text-2: #C4CCDA;
    --text-muted: #8E9AB0;
    --text-faint: #5E6A80;
    --accent: #5B5EEA;
    --accent-strong: #818CF8;
    --accent-soft: rgba(99, 102, 241, .16);
    --accent-soft-2: rgba(99, 102, 241, .26);
    --accent-text: #A5B4FC;
    --info: #3B82F6;   --info-soft: rgba(59, 130, 246, .15);  --info-text: #93C5FD;
    --success: #10B981; --success-soft: rgba(16, 185, 129, .14); --success-text: #6EE7B7;
    --warn: #F59E0B;   --warn-soft: rgba(245, 158, 11, .14);  --warn-text: #FCD34D;
    --danger: #EF4444; --danger-soft: rgba(239, 68, 68, .15); --danger-text: #FCA5A5;
    --neutral-soft: #1C2538; --neutral-text: #AEB8C9;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 6px rgba(0, 0, 0, .18);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .35);
    --scrim: rgba(2, 6, 16, .62);
    --focus: rgba(129, 140, 248, .7);
    --skeleton: #1A2336;
    --skeleton-shine: rgba(255, 255, 255, .05);
    --plat-mercari: #F2735F;
    --plat-mercari_shops: #EE7A62;
    --plat-yahoo_flea: #EE6AA6;
    --plat-yahoo_auction: #E0A93F;
    --plat-rakuma: #F0728B;
    --plat-unknown: #94A3B8;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1120;
  --bg-blur: rgba(11, 17, 32, .84);
  --surface: #121A2B;
  --surface-2: #151E31;
  --surface-3: #1A2438;
  --surface-hover: #172136;
  --border: #222D42;
  --border-strong: #2E3A52;
  --text: #E7EBF3;
  --text-2: #C4CCDA;
  --text-muted: #8E9AB0;
  --text-faint: #5E6A80;
  --accent: #5B5EEA;
  --accent-strong: #818CF8;
  --accent-soft: rgba(99, 102, 241, .16);
  --accent-soft-2: rgba(99, 102, 241, .26);
  --accent-text: #A5B4FC;
  --info: #3B82F6;   --info-soft: rgba(59, 130, 246, .15);  --info-text: #93C5FD;
  --success: #10B981; --success-soft: rgba(16, 185, 129, .14); --success-text: #6EE7B7;
  --warn: #F59E0B;   --warn-soft: rgba(245, 158, 11, .14);  --warn-text: #FCD34D;
  --danger: #EF4444; --danger-soft: rgba(239, 68, 68, .15); --danger-text: #FCA5A5;
  --neutral-soft: #1C2538; --neutral-text: #AEB8C9;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 6px rgba(0, 0, 0, .18);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .35);
  --scrim: rgba(2, 6, 16, .62);
  --focus: rgba(129, 140, 248, .7);
  --skeleton: #1A2336;
  --skeleton-shine: rgba(255, 255, 255, .05);
  --plat-mercari: #F2735F;
  --plat-mercari_shops: #EE7A62;
  --plat-yahoo_flea: #EE6AA6;
  --plat-yahoo_auction: #E0A93F;
  --plat-rakuma: #F0728B;
  --plat-unknown: #94A3B8;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-15);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
html.ov-open, html.ov-open body { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; font-feature-settings: "palt"; font-weight: 700; line-height: 1.35; letter-spacing: .01em; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
svg.icon { flex: none; display: block; }
.num, time, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-13); }
.center { text-align: center; justify-content: center; }
.block { display: block; }
.fine { font-size: var(--fs-12); color: var(--text-muted); margin-top: var(--sp-4); }
.noscript { padding: 24px; text-align: center; color: #334155; font-family: var(--font); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft-2); }
.sr-copy { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Japanese line breaking: keep phrases together (BudouX-based `auto-phrase`, lang="ja") in headings,
   titles and short UI text, and avoid a lone character on the last line of paragraphs. Email bodies
   (.msg-body / .plain) and the 2-line-clamped product titles in lists (.tx-title / .ship-title /
   .msgd-item-title — there every character shown matters more than phrase-aligned breaks) keep the
   browser's default breaking. */
h1, h2, h3, h4, .alert-msg, .alert-line, .detail-alert, .hero-title, .msgd-subject,
.unp-subject, .empty-title, .empty-text, .callout-title, .callout-text, .confirm-title,
.confirm-text, .sys-title, .sys-text, .set-label, .set-sub, .status-title, .page-intro, .field-hint,
.field-label, .switch-title, .banner-text, .toast-msg, .market-note, .tile-sub, .hint-title, .hint-text,
.sheet-line, .track-none, .login-tagline, .login-fine, .bound-text, .steps li, .check-text, .tl-hint,
.profile-sub, .msgd-note {
  word-break: auto-phrase;
}
p, li, .empty-text, .callout-text, .page-intro, .field-hint, .banner-text, .alert-msg, .tl-hint { text-wrap: pretty; }

/* ---------- brand mark / splash ---------- */
.brand-mark {
  /* v1.16: the owner's logo (assets/icons/icon-192.png — a white rounded tile of its own) */
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  overflow: hidden; background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
}
.brand-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; }
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: var(--sp-6); padding: var(--sp-6); }
.splash .spinner { width: 22px; height: 22px; }

/* ---------- spinner / skeleton ---------- */
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none;
  border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  opacity: .8;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sk { display: block; background: var(--skeleton); border-radius: 6px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; }
.sk-sm { height: 11px; margin-top: 10px; }
.sk-pill { width: 56px; height: 22px; border-radius: var(--r-pill); }
.sk-list { padding: 0; }
.sk-row, .sk-msg, .sk-card { display: flex; align-items: center; gap: var(--sp-4); padding: 16px; border-bottom: 1px solid var(--border); }
.sk-row:last-child, .sk-msg:last-child, .sk-card:last-child { border-bottom: 0; }
.sk-card { padding: 22px 16px; }
.sk-col { flex: 1; min-width: 0; }
.sk-block { padding: 0; overflow: hidden; }
.sk-fill { height: 100%; border-radius: 0; background: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid transparent;
  font-size: var(--fs-15); font-weight: 600; line-height: 1.2; white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(49, 46, 129, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
/* dark: hover gets darker (not the light --accent-strong) so white text keeps ≥ 4.5:1 */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary:hover:not(:disabled) { background: #4F52DD; } }
:root[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: #4F52DD; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-subtle { background: var(--accent-soft); color: var(--accent-text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.95); }
.btn-danger-ghost { background: transparent; color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-13); border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 52px; font-size: var(--fs-17); border-radius: 14px; }
.btn-block { display: flex; width: 100%; }
.btn .btn-label { overflow: hidden; text-overflow: ellipsis; }
.btn.is-busy .icon { display: none; }
.btn-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.filter-btn { position: relative; flex: none; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px; background: transparent; color: var(--text-2);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:active:not(:disabled) { background: var(--border); }
.icon-btn.is-spinning .icon { animation: spin 1s linear infinite; }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px; border: 0; background: none;
  color: var(--accent-text); font-weight: 600; font-size: var(--fs-15);
  border-radius: 10px;
}
.link-btn:hover { background: var(--accent-soft); }
.link-btn.sm { min-height: 32px; padding: 0 8px; font-size: var(--fs-13); }
.more-btn, .text-more {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: none; color: var(--accent-text); font-weight: 600;
}
.more-btn { width: 100%; justify-content: center; min-height: 44px; margin-top: var(--sp-2); font-size: var(--fs-13); border-radius: 10px; }
.more-btn:hover { background: var(--accent-soft); }
.text-more { padding: 6px 0; font-size: var(--fs-13); min-height: 32px; }

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex; align-items: stretch; gap: 2px;
  padding: 3px; border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  max-width: 100%;
}
.seg-stretch { display: flex; width: 100%; }
.seg-stretch .seg-btn { flex: 1 1 0; }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; min-width: 0;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--text-muted); font-weight: 600; font-size: var(--fs-13); white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px var(--border); }
:root[data-theme="dark"] .seg-btn[aria-checked="true"] { background: var(--surface-hover); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-btn[aria-checked="true"] { background: #212C43; } }
:root[data-theme="dark"] .seg-btn[aria-checked="true"] { background: #212C43; }
.seg-label { overflow: hidden; text-overflow: ellipsis; }
.seg-short { display: none; }
.seg-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.seg-sm .seg-btn { min-height: 32px; padding: 0 10px; font-size: var(--fs-13); }
.seg-stretch.seg-sm .seg-btn { padding: 0 4px; }
/* segments carrying counts size to their content so no label gets truncated */
.seg-stretch.seg-ship .seg-btn { flex: 1 1 auto; padding: 0 8px; }

/* ---------- chips ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: -2px calc(-1 * var(--sp-4)); padding: 4px var(--sp-4);
  scroll-padding: 0 var(--sp-4);
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
/* edge fades while more chips are hidden (classes maintained by ui.js chipGroup) */
.chips.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.chips.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.chips.fade-l.fade-r {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2);
  font-size: var(--fs-13); font-weight: 600; white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--text-faint); }
.chip[aria-checked="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  display: inline-grid; place-items: center;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acc, var(--text-faint)); flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc, #64748B) 22%, transparent); }

/* ---------- badges & pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none; max-width: 100%;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: var(--fs-12); font-weight: 600; line-height: 1; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.plat { --pc: var(--plat-unknown); color: var(--pc); background: color-mix(in srgb, var(--pc) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 16%, transparent); }
.plat-mercari { --pc: var(--plat-mercari); }
.plat-mercari_shops { --pc: var(--plat-mercari_shops); background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 40%, transparent); }
.plat-yahoo_flea { --pc: var(--plat-yahoo_flea); }
.plat-yahoo_auction { --pc: var(--plat-yahoo_auction); }
.plat-rakuma { --pc: var(--plat-rakuma); }
.acct {
  color: color-mix(in srgb, var(--acc, #64748B) 78%, var(--text));
  background: color-mix(in srgb, var(--acc, #64748B) 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc, #64748B) 18%, transparent);
  padding-left: 7px;
}
.acct .acct-dot { width: 7px; height: 7px; box-shadow: none; }
.acct-dev { color: var(--text-muted); font-weight: 500; margin-left: 2px; }
.acct.is-admin { --acc: var(--accent); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: 700; line-height: 1; white-space: nowrap;
  color: var(--neutral-text); background: var(--neutral-soft);
}
.tone-neutral.pill { color: var(--neutral-text); background: var(--neutral-soft); }
.tone-info.pill { color: var(--info-text); background: var(--info-soft); }
.tone-accent.pill { color: var(--accent-text); background: var(--accent-soft); }
.tone-success.pill { color: var(--success-text); background: var(--success-soft); }
.tone-warn.pill { color: var(--warn-text); background: var(--warn-soft); }
.tone-danger.pill { color: var(--danger-text); background: var(--danger-soft); }
.tone-muted.pill { color: var(--text-muted); background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.new-chip {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
}
.unread-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.alert-line {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: var(--fs-13); font-weight: 600; line-height: 1.45;
}
.alert-line .icon { margin-top: 1px; }
.alert-line.lvl-danger { color: var(--danger-text); }
.alert-line.lvl-warn { color: var(--warn-text); }
.alert-line.lvl-info { color: var(--success-text); }

/* ---------- cards / sections ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: var(--sp-4); }
.card.list { overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-15); font-weight: 700; }
.card-title .icon { color: var(--text-muted); }
.card-title.sm { font-size: var(--fs-13); color: var(--text-muted); font-weight: 600; margin-top: var(--sp-1); }
.section { margin-top: var(--sp-6); }
.section-head { display: flex; align-items: baseline; gap: var(--sp-2); margin: 0 2px var(--sp-3); }
.section-title { font-size: var(--fs-17); display: inline-flex; align-items: center; gap: 8px; }
.section-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-12); font-weight: 700; font-variant-numeric: tabular-nums;
}
.section-sub { font-size: var(--fs-12); color: var(--text-muted); margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-5); }
.row-gap { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-gap.center { justify-content: center; }
.btn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-2); }
.home-cols { display: grid; gap: 0; }
.home-cols > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.grid-2 > * { min-width: 0; }
.grid-2.gap { gap: var(--sp-4); margin-top: var(--sp-6); }
@media (max-width: 639px) { .grid-2.gap { grid-template-columns: 1fr; } }
.page-intro { color: var(--text-muted); font-size: var(--fs-13); line-height: 1.7; margin: 0 2px var(--sp-4); }
.row-chevron { color: var(--text-faint); margin-left: auto; }

.kv { margin: 0; display: grid; gap: 0; }
.kv-row { display: flex; align-items: baseline; gap: var(--sp-3); padding: 9px 0; border-top: 1px solid var(--border); min-width: 0; }
.kv-row:first-child { border-top: 0; }
.kv dt { flex: none; width: 96px; color: var(--text-muted); font-size: var(--fs-13); }
.kv dd { margin: 0; flex: 1; min-width: 0; font-size: var(--fs-15); overflow-wrap: anywhere; }
.kv-compact .kv-row { padding: 7px 0; }
.kv-compact dd { font-size: var(--fs-13); }

/* ---------- empty / error ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-10) var(--sp-6); gap: var(--sp-2); }
.empty-icon {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; margin-bottom: var(--sp-2);
  background: var(--surface-3); color: var(--text-muted);
}
.empty-success .empty-icon { background: var(--success-soft); color: var(--success); }
.empty-error .empty-icon { background: var(--danger-soft); color: var(--danger); }
.empty-title { font-weight: 700; font-size: var(--fs-15); }
.empty-text { color: var(--text-muted); font-size: var(--fs-13); max-width: 320px; }
.empty .btn { margin-top: var(--sp-3); }

/* ---------- callouts ---------- */
.callout {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  background: var(--neutral-soft); color: var(--text-2);
  font-size: var(--fs-13); line-height: 1.65;
}
.callout > .icon { margin-top: 2px; }
.callout-body { min-width: 0; display: grid; gap: 2px; }
.callout-title { font-weight: 700; color: var(--text); }
.callout-info { background: var(--info-soft); }
.callout-info > .icon { color: var(--info); }
.callout-warn { background: var(--warn-soft); }
.callout-warn > .icon { color: var(--warn); }
.callout-danger { background: var(--danger-soft); }
.callout-danger > .icon { color: var(--danger); }
.callout-success { background: var(--success-soft); }
.callout-success > .icon { color: var(--success); }
.callout-neutral > .icon { color: var(--text-muted); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: var(--fs-13); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field-opt { font-size: 11px; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 5px; line-height: 16px; }
.field-hint { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.6; }
.field-error { font-size: var(--fs-13); color: var(--danger-text); font-weight: 600; }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.input, .select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-size: 16px; /* ≥16px prevents zoom-on-focus on mobile */
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); outline: none; }
.input[readonly] { background: var(--surface-2); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.select {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select-sm { min-height: 36px; width: auto; padding: 4px 32px 4px 10px; font-size: var(--fs-13); border-radius: 10px; background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; }
.input-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.input-wrap .input { padding-right: 44px; }
.input-icon { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; }
.input-affix {
  position: absolute; right: 4px; display: grid; place-items: center;
  width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted);
}
.input-affix:hover { background: var(--surface-3); color: var(--text); }
/* secret inputs (ui.js secretInput): hidden by type=password, or by CSS for mask 'css' (no password manager) */
.input-secret.is-masked { -webkit-text-security: disc; }
.input-secret.is-visible { font-family: var(--mono); font-size: 17px; letter-spacing: .06em; }
.input-secret::placeholder { font-family: var(--font); font-size: var(--fs-15); letter-spacing: 0; }
.input-login { min-height: 52px; font-size: 17px; }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit .input { flex: 1; min-width: 0; }
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
.unit { flex: none; color: var(--text-muted); font-size: var(--fs-13); min-width: 3em; }
.input-short { max-width: 96px; text-transform: uppercase; }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; }
.range-sep { padding-bottom: 12px; color: var(--text-muted); }
input[type="date"].input { min-height: 46px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.switch {
  position: relative; flex: none; width: 50px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r-pill); background: var(--border-strong);
  transition: background-color var(--t) var(--ease);
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform var(--t) var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(20px); }
.switch::before { content: ""; position: absolute; inset: -7px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.switch-title { font-weight: 600; font-size: var(--fs-15); }

.check { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--border); cursor: pointer; font-size: var(--fs-13); line-height: 1.65; }
.check-row:first-child { border-top: 0; }
.check-text { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-2); min-width: 0; }

.color-input { width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 6px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 7px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); position: relative; }
.swatch::before { content: ""; position: absolute; inset: -4px; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 90; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 12px; pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  width: min(460px, 100%); min-height: 48px; padding: 10px 10px 10px 14px;
  border-radius: 14px;
  background: #111827; color: #F3F4F6;
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-13); font-weight: 500; line-height: 1.5;
  opacity: 0; transform: translateY(8px) scale(.98);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show { opacity: 1; transform: none; }
/* While a bottom sheet / dialog is open, toasts appear at the top so they never cover its controls. */
html.ov-open .toasts { bottom: auto; top: calc(var(--safe-top) + 12px); z-index: 95; }
html.ov-open .toast { transform: translateY(-8px) scale(.98); }
html.ov-open .toast.show { transform: none; }
.toast .icon { color: #A5B4FC; }
.toast-success .icon { color: #34D399; }
.toast-error .icon { color: #F87171; }
.toast-warn .icon { color: #FBBF24; }
.toast-msg { flex: 1; min-width: 0; }
.toast-action {
  flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px;
  background: rgba(255, 255, 255, .1); color: #fff; font-weight: 700; font-size: var(--fs-13);
}
.toast-action:hover { background: rgba(255, 255, 255, .18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #253047; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), var(--shadow-lg); } }
:root[data-theme="dark"] .toast { background: #253047; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), var(--shadow-lg); }

/* ---------- overlays (bottom sheets / dialogs) ---------- */
.ov { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.ov-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t) var(--ease); }
.ov.open .ov-scrim { opacity: 1; }
.ov-panel {
  position: relative; width: 100%; max-height: min(92vh, calc(100dvh - 24px));
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px); opacity: 0;
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
  padding-bottom: var(--safe-bottom);
}
.ov.open .ov-panel { transform: none; opacity: 1; }
.ov-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; flex: none; }
.ov-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px 20px; flex: none; }
.ov-title { flex: 1; min-width: 0; font-size: var(--fs-17); }
.ov-body { padding: 8px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.ov-foot {
  display: flex; gap: 8px; justify-content: flex-end; flex: none;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.ov-foot .btn { flex: 1 1 0; }
.ov-confirm .ov-body { padding-top: 16px; }
.confirm { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 4px 4px 0; }
.confirm-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.confirm-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.confirm-title { font-size: var(--fs-17); }
.confirm-text { color: var(--text-muted); font-size: var(--fs-13); line-height: 1.7; }

@media (min-width: 768px) {
  .ov { align-items: center; padding: 24px; }
  .ov-panel { width: 100%; max-width: 520px; border-radius: 18px; transform: translateY(8px) scale(.98); max-height: min(86vh, 760px); padding-bottom: 0; }
  .ov-sm { max-width: 420px; }
  .ov-lg { max-width: 640px; }
  .ov-grip { display: none; }
  .ov-head { padding: 14px 12px 4px 24px; }
  .ov-body { padding: 8px 24px 24px; }
  .ov-foot { padding: 14px 20px; }
  .ov-foot .btn { flex: 0 0 auto; min-width: 120px; }
  .ov-confirm .ov-foot .btn { flex: 1 1 0; }
}

/* ---------- copy value ---------- */
.copyval { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-width: 0; vertical-align: middle; }
.copyval-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; -webkit-user-select: all; }
.copyval-btn {
  position: relative; z-index: 2;
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; margin: -6px -4px -6px 2px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted);
}
.copyval-btn::before { content: ""; position: absolute; inset: -6px; }
.copyval-btn:hover { background: var(--surface-3); color: var(--accent-text); }

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { min-height: 100vh; min-height: 100dvh; }
.main-col { min-width: 0; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-6)); }
.app-top { position: sticky; top: 0; z-index: 30; padding-top: var(--safe-top); background: var(--bg-blur); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); }
.view { outline: none; }
.page { padding: var(--sp-2) calc(var(--sp-4) + var(--safe-right)) var(--sp-4) calc(var(--sp-4) + var(--safe-left)); max-width: 1120px; margin: 0 auto; }
/* Narrow pages (設定) share the top bar's left edge instead of floating in the middle of wide screens. */
.page-narrow { max-width: 760px; margin-left: max(0px, calc((100% - 1120px) / 2)); margin-right: auto; }
/* vertical rhythm for stacked blocks on settings pages */
.page-narrow > * + *:not(.set-group):not(.section):not(.list-wrap) { margin-top: var(--sp-3); }
.page-narrow > .btn-block, .page-narrow > .row-gap { margin-top: var(--sp-5); }
.page.is-loading .list-wrap { opacity: .72; transition: opacity var(--t) var(--ease); }

/* top bar */
.topbar { padding: 0 calc(var(--sp-2) + var(--safe-right)) 0 calc(var(--sp-4) + var(--safe-left)); border-bottom: 1px solid transparent; }
.topbar-row { display: flex; align-items: center; gap: var(--sp-2); min-height: 56px; max-width: 1120px; margin: 0 auto; }
.topbar-back { margin-left: -10px; }
.topbar-heading { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar-title { font-size: var(--fs-20); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-ident { flex: none; min-width: 0; display: flex; }
.topbar-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.sync { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sync.is-offline { color: var(--warn-text); }
.topbar-scope { max-width: 1120px; margin: 0 auto; padding-bottom: 10px; }
.scope-chips .chip { min-height: 34px; }
.scope-chips { margin-left: calc(-1 * var(--sp-4)); margin-right: calc(-1 * var(--sp-2)); }

/* banners */
.banner {
  display: flex; align-items: center; gap: 8px;
  padding: 8px calc(var(--sp-4) + var(--safe-right)) 8px calc(var(--sp-4) + var(--safe-left));
  font-size: var(--fs-13); font-weight: 600; line-height: 1.45;
}
.banner-text { flex: 1; min-width: 0; }
.banner-offline { background: var(--warn-soft); color: var(--warn-text); }
.banner-update { background: var(--accent-soft); color: var(--accent-text); }
.banner-action { flex: none; min-height: 32px; padding: 0 12px; border-radius: 8px; border: 0; background: var(--surface); color: inherit; font-weight: 700; font-size: var(--fs-13); box-shadow: var(--shadow-xs); }

/* demo bar */
.demo-bar {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "tag exit" "seg seg";
  align-items: center; gap: 8px 8px;
  padding: 8px calc(var(--sp-3) + var(--safe-right)) 10px calc(var(--sp-4) + var(--safe-left));
  background: linear-gradient(90deg, #312E81, #4338CA);
  color: #EEF2FF;
}
.demo-tag { grid-area: tag; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); font-weight: 700; }
.demo-seg { grid-area: seg; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .12); display: flex; }
.demo-seg .seg-btn { flex: 1 1 0; color: rgba(238, 242, 255, .8); }
.demo-seg .seg-btn:hover { color: #fff; }
.demo-bar .demo-seg .seg-btn.seg-btn[aria-checked="true"] { background: #fff; color: #312E81; box-shadow: none; }
.demo-exit {
  grid-area: exit; display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .28);
  background: transparent; color: #fff; font-weight: 700; font-size: var(--fs-13);
}
.demo-exit:hover { background: rgba(255, 255, 255, .12); }
/* Sized by the column it sits in (not the viewport): with the 取引 detail docked on the right the
   main column is much narrower than the window. */
.app-top { container: apptop / inline-size; }
@container apptop (min-width: 720px) {
  .demo-bar { grid-template-columns: auto 1fr auto; grid-template-areas: "tag seg exit"; }
  .demo-seg { justify-self: center; display: inline-flex; }
  .demo-seg .seg-btn { flex: none; min-width: 84px; }
}

/* navigation: bottom tab bar (mobile) */
.nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.nav-brand, .nav-foot { display: none; }
.nav-items { display: flex; height: var(--tabbar-h); max-width: 640px; margin: 0 auto; }
.nav-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-muted); font-size: var(--fs-12); font-weight: 600; letter-spacing: .01em;
  transition: color var(--t-fast) var(--ease);
}
.nav-icon {
  position: relative; display: grid; place-items: center;
  width: 56px; height: 30px; border-radius: var(--r-pill);
  transition: background-color var(--t) var(--ease);
}
.nav-item[aria-current="page"] { color: var(--accent-text); }
.nav-item[aria-current="page"] .nav-icon { background: var(--accent-soft); }
.nav-label { white-space: nowrap; }
.nav-badge {
  position: absolute; top: -3px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ==========================================================================
   Login
   ========================================================================== */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--sp-6) + var(--safe-top)) var(--sp-4) calc(var(--sp-6) + var(--safe-bottom));
  background:
    radial-gradient(900px 420px at 50% -120px, var(--accent-soft-2), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: var(--sp-5);
  padding: var(--sp-8) var(--sp-5) var(--sp-6);
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow-md);
}
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.login-title { font-size: var(--fs-24); margin-top: 6px; }
.login-tagline { color: var(--text-muted); font-size: var(--fs-13); }
.login-form { display: flex; flex-direction: column; gap: var(--sp-5); }
.login-foot { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); margin-top: var(--sp-5); text-align: center; }
.login-fine { font-size: var(--fs-12); color: var(--text-muted); max-width: 360px; line-height: 1.7; }
.login-form .btn-lg { margin-top: calc(-1 * var(--sp-1)); }
.login-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.login-notes li { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-13); line-height: 1.6; color: var(--text-muted); word-break: auto-phrase; }
.login-notes .icon { flex: none; margin-top: 2px; color: var(--text-faint); }
.login-alt { display: flex; justify-content: center; padding-top: var(--sp-3); margin-top: calc(-1 * var(--sp-1)); border-top: 1px solid var(--border); }
.login-alt-btn { color: var(--text-muted); font-weight: 600; text-align: center; }
.login-alt-btn .nowrap { white-space: nowrap; }
.login-alt-btn:hover { color: var(--accent-text); }
.login-mode-head { display: flex; align-items: center; gap: 12px; }
.login-mode-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.login-mode-title { font-weight: 700; font-size: var(--fs-15); }
.login-mode-sub { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.5; word-break: auto-phrase; }
.bound { align-items: stretch; }
.bound-icon { align-self: center; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--danger-soft); color: var(--danger); }
.bound-title { font-size: var(--fs-20); text-align: center; }
.bound-text { color: var(--text-2); font-size: var(--fs-15); line-height: 1.75; }

.steps { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; gap: 14px; counter-reset: none; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-15); line-height: 1.65; color: var(--text-2); }
.steps.compact { gap: 10px; margin: 0; }
.steps.compact li { font-size: var(--fs-13); }
.step-num {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-12); font-weight: 800; margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Home
   ========================================================================== */
/* install hint: icon | text | ✕, the button under the text on phones, inline from 640 px */
.hint-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon body close" "icon action close";
  align-items: center; column-gap: 12px; row-gap: 10px; padding: 14px 6px 14px 14px; margin-bottom: var(--sp-4);
}
.hint-icon { grid-area: icon; align-self: start; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.hint-body { grid-area: body; min-width: 0; }
.hint-card > .btn { grid-area: action; justify-self: start; }
.hint-title { font-weight: 700; font-size: var(--fs-15); }
.hint-text { font-size: var(--fs-12); color: var(--text-muted); }
.hint-close { grid-area: close; align-self: start; width: 44px; height: 44px; margin-top: -6px; }
@media (min-width: 640px) {
  .hint-card { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "icon body action close"; padding: 12px 8px 12px 14px; }
  .hint-icon, .hint-close { align-self: center; margin-top: 0; }
}

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.kpi {
  --k: var(--text-muted); --ks: var(--surface-3);
  position: relative; text-align: left;
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 14px 14px 12px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi:active { transform: scale(.985); }
.kpi-accent { --k: var(--accent); --ks: var(--accent-soft); }
.kpi-info { --k: var(--info); --ks: var(--info-soft); }
.kpi-warn { --k: var(--warn); --ks: var(--warn-soft); }
.kpi-neutral { --k: var(--text-2); --ks: var(--surface-3); }
.kpi-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--ks); color: var(--k); flex: none; }
.kpi-label { font-size: var(--fs-13); font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: var(--fs-32); font-weight: 800; line-height: 1.1; letter-spacing: -.01em; margin-top: 2px; }
.kpi-sub { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-hl { border-color: color-mix(in srgb, var(--k) 45%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--k) 7%, var(--surface)), var(--surface) 70%); }
.kpi-hl .kpi-value { color: color-mix(in srgb, var(--k) 88%, var(--text)); }
.kpi-hl::after { content: ""; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--k); box-shadow: 0 0 0 4px color-mix(in srgb, var(--k) 18%, transparent); }
.kpi-sk { border-radius: var(--r); }

.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--sp-3); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat-label { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: var(--fs-17); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alert-list .alert-item + .alert-item { border-top: 1px solid var(--border); }
/* 要対応の行の下の「取引画面を開く」（v1.27。商品名の位置にそろえる） */
.alert-item.has-market > .alert-row { padding-bottom: 6px; }
.alert-actions { display: flex; padding: 0 12px 12px 84px; }
.alert-market { gap: 6px; }
.alert-row {
  position: relative; width: 100%; border: 0; background: transparent; text-align: left; color: var(--text);
  display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; min-height: 64px;
  transition: background-color var(--t-fast) var(--ease);
}
.alert-row:hover { background: var(--surface-hover); }
.alert-row::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lv, var(--border)); }
.alert-row.lvl-danger { --lv: var(--danger); --lvs: var(--danger-soft); --lvt: var(--danger-text); }
.alert-row.lvl-warn { --lv: var(--warn); --lvs: var(--warn-soft); --lvt: var(--warn-text); }
.alert-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--lvs); color: var(--lv); flex: none; }
.alert-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.alert-msg { font-weight: 700; font-size: var(--fs-15); color: var(--lvt); line-height: 1.4; }
.alert-sub { display: flex; align-items: center; gap: 6px; min-width: 0; }
.alert-title { color: var(--text-2); font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alert-sub:empty { display: none; }
.alert-days { flex: none; display: flex; flex-direction: column; align-items: flex-end; width: 56px; line-height: 1.15; }
.alert-days-cap { font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.alert-days-val { font-size: var(--fs-12); color: var(--text-muted); display: flex; align-items: baseline; gap: 1px; }
.alert-days b { font-size: var(--fs-20); color: var(--lvt); font-weight: 800; }
.alert-days b.is-today { font-size: var(--fs-15); }

.acct-grid { display: grid; gap: var(--sp-3); }
.acct-card {
  --acc: #64748B;
  display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: left; color: var(--text);
  padding: 14px 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.acct-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--acc); }
.acct-card:hover { box-shadow: var(--shadow-md); }
.acct-card:active { transform: scale(.99); }
.acct-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acct-avatar {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: color-mix(in srgb, var(--acc, #64748B) 14%, var(--surface)); color: color-mix(in srgb, var(--acc, #64748B) 85%, var(--text));
  font-weight: 800; font-size: var(--fs-17);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc, #64748B) 22%, transparent);
}
.acct-avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: var(--fs-15); }
.acct-avatar.is-admin { --acc: var(--accent); }
.acct-card-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acct-name { font-weight: 700; font-size: var(--fs-15); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-device { font-size: var(--fs-12); color: var(--text-muted); }
.acct-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.acct-stat { display: flex; flex-direction: column; font-size: var(--fs-12); color: var(--text-muted); padding: 6px 8px; border-radius: 9px; background: var(--surface-2); min-width: 0; white-space: nowrap; }
.acct-stat b { font-size: var(--fs-17); color: var(--text); font-weight: 700; line-height: 1.3; }
.acct-stat.is-warn b { color: var(--warn-text); }

.sys-grid { display: grid; gap: var(--sp-3); }
.sys-card { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 14px; color: var(--text); min-height: 72px; transition: box-shadow var(--t-fast) var(--ease); }
.link-card:hover { box-shadow: var(--shadow-md); }
.sys-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--surface-3); color: var(--text-muted); }
.sys-icon.tone-info, .status-icon.tone-info { background: var(--info-soft); color: var(--info); }
.sys-icon.tone-success, .status-icon.tone-success { background: var(--success-soft); color: var(--success); }
.sys-icon.tone-warn, .status-icon.tone-warn { background: var(--warn-soft); color: var(--warn); }
.sys-icon.tone-danger, .status-icon.tone-danger { background: var(--danger-soft); color: var(--danger); }
.sys-icon.tone-muted, .status-icon.tone-muted { background: var(--surface-3); color: var(--text-muted); }
.sys-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sys-title { font-weight: 700; font-size: var(--fs-15); display: flex; align-items: baseline; gap: 8px; }
.sys-meta { font-size: var(--fs-12); color: var(--text-muted); font-weight: 500; }
.sys-text { font-size: var(--fs-13); color: var(--text-muted); }

/* ==========================================================================
   Toolbars / lists
   ========================================================================== */
.toolbar { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.search-row { display: flex; gap: var(--sp-2); }
.search-wrap { flex: 1; }
.search-wrap .input { padding-left: 40px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 var(--sp-3); }
.filter-tag {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px 0 10px;
  border-radius: 9px; border: 1px solid var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-text);
  font-size: var(--fs-12); font-weight: 600; max-width: 100%;
}
.filter-tag:hover { border-color: var(--accent); }
.list-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: 0 2px var(--sp-2); min-height: 36px; }
.list-meta-text { font-size: var(--fs-13); color: var(--text-muted); }
.list-meta-text.center { text-align: center; margin: var(--sp-4) 0 var(--sp-2); }
.sort-label { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); }
.sort-ico { color: var(--text-faint); }

.tx-row {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 14px 16px; color: var(--text);
  border-top: 1px solid var(--border);
  transition: background-color var(--t-fast) var(--ease);
  position: relative;
}
.tx-row:first-child { border-top: 0; }
.tx-row:hover { background: var(--surface-hover); }
.tx-row.is-selected { background: var(--accent-soft); }
.tx-row.is-selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tx-title {
  font-size: var(--fs-15); font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere;
}
.tx-title .unread-dot { margin-right: 7px; vertical-align: 2px; }
.tx-row.is-unread .tx-title { font-weight: 700; }
.tx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.tx-date { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }
.tx-unread { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-12); color: var(--accent-text); font-weight: 700; }
.tx-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tx-price { font-size: var(--fs-15); font-weight: 700; white-space: nowrap; }
.tx-id { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; font-family: var(--mono); letter-spacing: .01em; }

/* The item's first image (SPEC §10.4: cut out of the transaction page by the extension, sent by the central server as a
   data: URL — never loaded from a marketplace). A quiet box when there is none. */
.thumb {
  flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); color: var(--text-faint);
  border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-sm { width: 52px; height: 52px; margin-top: 1px; }
.thumb-lg { width: 112px; height: 112px; border-radius: var(--r); }
.thumb.is-loading { background: var(--skeleton); }
.thumb.is-loading svg { opacity: .5; }
@media (max-width: 520px) { .thumb-sm { width: 44px; height: 44px; } .thumb-lg { width: 88px; height: 88px; } }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); }
.pager-nav { display: flex; align-items: center; gap: var(--sp-2); }
@media (max-width: 520px) {
  /* phone: 前へ ・ 1 / 3 ・ 次へ spread across the width, the page size centered below */
  .pager { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .pager-nav { justify-content: space-between; }
  .pager-nav .btn { min-width: 96px; min-height: 44px; }
  .pager-size { justify-content: center; }
}
.pager-pos { min-width: 64px; text-align: center; font-size: var(--fs-13); color: var(--text-2); font-weight: 600; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); color: var(--text-muted); }

/* messages */
.day-group + .day-group { margin-top: var(--sp-5); }
.day-head { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-13); color: var(--text-muted); font-weight: 700; margin: 0 2px var(--sp-2); letter-spacing: .02em; }
.day-count { font-weight: 500; font-size: var(--fs-12); color: var(--text-muted); }
.msg-row {
  width: 100%; border: 0; background: transparent; text-align: left; color: var(--text);
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border-top: 1px solid var(--border);
  transition: background-color var(--t-fast) var(--ease);
}
.msg-row:first-child { border-top: 0; }
.msg-row:hover { background: var(--surface-hover); }
.msg-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--surface-3); color: var(--text-muted); margin-top: 1px; }
.msg-row.kind-message .msg-avatar { background: var(--accent-soft); color: var(--accent-text); }
.msg-initial { font-size: var(--fs-15); font-weight: 800; line-height: 1; }
.msg-row.kind-reminder .msg-avatar { background: var(--warn-soft); color: var(--warn); }
.msg-row.kind-account .msg-avatar { background: var(--danger-soft); color: var(--danger); }
.msg-row.kind-shipped .msg-avatar { background: var(--info-soft); color: var(--info); }
.msg-row.kind-completed .msg-avatar, .msg-row.kind-delivered .msg-avatar { background: var(--success-soft); color: var(--success); }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msg-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.msg-who { font-weight: 600; font-size: var(--fs-15); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.msg-time { margin-left: auto; flex: none; font-size: var(--fs-12); color: var(--text-muted); }
.msg-title { font-size: var(--fs-13); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-text { font-size: var(--fs-13); color: var(--text-muted); line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.msg-text.is-faint { color: var(--text-muted); font-style: italic; }
.msg-row.is-unread .msg-who { font-weight: 800; }
.msg-row.is-unread .msg-title { color: var(--text); font-weight: 600; }
.msg-row.is-unread .msg-text { color: var(--text-2); }
.msg-row > .unread-dot { margin-top: 8px; }
.more-wrap .btn { margin-top: var(--sp-2); }

.msgd { display: flex; flex-direction: column; gap: var(--sp-3); }
.msgd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.msgd-time { margin-left: auto; font-size: var(--fs-13); color: var(--text-muted); }
.msgd-subject { font-size: var(--fs-17); line-height: 1.5; overflow-wrap: anywhere; }
.msgd-sender { display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--text-2); }
.msgd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 12px 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.msgd-item.is-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.msgd-item-title { flex: 1; min-width: 0; font-weight: 600; font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.msgd-text { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.msgd-note { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-muted); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; font-size: var(--fs-15); line-height: 1.75; color: var(--text); }
.msg-body.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }
.msg-body.is-clamped.clamp-3 { -webkit-line-clamp: 3; }

/* shipping */
.ship-grid { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); }
.ship-card {
  --tc: var(--info); --tcs: var(--info-soft); --tct: var(--info-text);
  position: relative; display: flex; gap: 14px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.ship-card:hover { box-shadow: var(--shadow-md); }
.ship-card.tone-danger { --tc: var(--danger); --tcs: var(--danger-soft); --tct: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.ship-card.tone-warn { --tc: var(--warn); --tcs: var(--warn-soft); --tct: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.ship-card.tone-accent { --tc: var(--accent); --tcs: var(--accent-soft); --tct: var(--accent-text); }
.ship-card.tone-success { --tc: var(--success); --tcs: var(--success-soft); --tct: var(--success-text); }
.ship-card.tone-muted { --tc: var(--text-muted); --tcs: var(--surface-3); --tct: var(--text-muted); }
.ship-counter {
  flex: none; width: 76px; align-self: stretch;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 12px; background: var(--tcs); color: var(--tct); padding: 8px 4px;
}
.ship-counter-label { font-size: 11px; font-weight: 700; letter-spacing: .02em; opacity: .9; white-space: nowrap; }
.ship-counter-num { font-size: var(--fs-32); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.ship-counter-num small { font-size: var(--fs-13); font-weight: 700; margin-left: 1px; }
.ship-counter-date { font-size: var(--fs-13); font-weight: 700; text-align: center; }
.ship-counter-num.is-today { font-size: var(--fs-20); letter-spacing: .02em; }
.ship-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.ship-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ship-title { color: var(--text); font-weight: 600; font-size: var(--fs-15); line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--r); z-index: 1; }
.stretched:focus-visible { outline: none; }
.stretched:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.ship-track { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); color: var(--text-2); min-width: 0; flex-wrap: wrap; }
.ship-track.is-none { color: var(--text-muted); gap: 6px; }
.ship-carrier { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); white-space: nowrap; }
.ship-status { font-size: var(--fs-13); color: var(--text-2); font-weight: 500; }
.ship-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: var(--fs-12); color: var(--text-muted); }
.ship-auto, .ship-sync { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ship-auto.is-warn { color: var(--warn-text); font-weight: 700; }
.ship-auto.is-danger { color: var(--danger-text); font-weight: 700; }
.ship-sync.tone-success { color: var(--success-text); }
.ship-sync.tone-danger { color: var(--danger-text); font-weight: 700; }
.ship-sync.tone-warn { color: var(--warn-text); }
.ship-sync.tone-info { color: var(--info-text); }

/* ==========================================================================
   Detail (full-screen sheet / right panel)
   ========================================================================== */
.detail-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.detail-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t) var(--ease); display: none; }
.detail {
  position: absolute; inset: 0; pointer-events: auto;
  display: flex; flex-direction: column;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 220ms var(--ease);
  outline: none;
}
.detail-layer.open .detail { transform: none; }
.detail-head {
  flex: none; display: flex; align-items: center; gap: 4px;
  padding: var(--safe-top) calc(4px + var(--safe-right)) 0 calc(4px + var(--safe-left));
  min-height: calc(56px + var(--safe-top));
  background: var(--bg-blur); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.detail-head-title { flex: 1; min-width: 0; font-size: var(--fs-17); padding-left: 4px; }
.detail-x { display: none; }
.detail-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-8) + var(--safe-bottom)) calc(var(--sp-4) + var(--safe-left));
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.detail-hero { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero-title { font-size: var(--fs-20); line-height: 1.45; overflow-wrap: anywhere; }
.hero-price { font-size: var(--fs-24); font-weight: 800; letter-spacing: -.01em; }
.hero-head { display: flex; gap: var(--sp-4); align-items: flex-start; }
.hero-headtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.detail-hero .kv { margin-top: 2px; }
.detail-alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; font-weight: 700; font-size: var(--fs-15); line-height: 1.45; }
.detail-alert.lvl-danger { background: var(--danger-soft); color: var(--danger-text); }
.detail-alert.lvl-warn { background: var(--warn-soft); color: var(--warn-text); }

.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.tile {
  --tc: var(--text); --tcs: var(--surface);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--tcs); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.tile.tone-danger { --tc: var(--danger-text); --tcs: var(--danger-soft); border-color: transparent; box-shadow: none; }
.tile.tone-warn { --tc: var(--warn-text); --tcs: var(--warn-soft); border-color: transparent; box-shadow: none; }
.tile.tone-success { --tc: var(--success-text); --tcs: var(--success-soft); border-color: transparent; box-shadow: none; }
.tile-big { grid-column: span 1; }
.tile-label { font-size: var(--fs-12); font-weight: 700; color: var(--tc); opacity: .85; }
.tile-value { font-size: var(--fs-17); font-weight: 800; color: var(--tc); line-height: 1.3; overflow-wrap: anywhere; }
.tile-big .tile-value { font-size: var(--fs-32); line-height: 1.1; letter-spacing: -.01em; }
.tile-unit { font-size: var(--fs-15); font-weight: 700; margin-left: 2px; }
.tile-sub { font-size: var(--fs-12); color: var(--text-muted); }
.tile-grid > .tile:only-child, .tile-wide { grid-column: 1 / -1; }
/* A lone counter tile reads as one line: label / sub on the left, the value on the right. */
.tile-grid > .tile:only-child {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "sub value";
  align-items: center; column-gap: var(--sp-3); row-gap: 2px; padding: 14px 16px;
}
.tile-grid > .tile:only-child .tile-label { grid-area: label; align-self: end; font-size: var(--fs-13); }
.tile-grid > .tile:only-child .tile-value { grid-area: value; }
.tile-grid > .tile:only-child .tile-sub { grid-area: sub; align-self: start; }
.tile-grid > .tile:only-child:not(:has(.tile-sub)) .tile-label { grid-row: 1 / -1; align-self: center; }

.market { display: flex; flex-direction: column; gap: 6px; }
.market-note { font-size: var(--fs-12); color: var(--text-muted); text-align: center; }

.detail-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dcard-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.dcard-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--text-muted); flex: none; }
.dcard-title { font-size: var(--fs-15); flex: 1; min-width: 0; }
.dcard-right { flex: none; display: flex; align-items: center; }
.dcard-actions { display: flex; }

.stepper { list-style: none; margin: 0; padding: 4px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; min-width: 0; }
.step::before { content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--border-strong); z-index: 0; }
.step:first-child::before { display: none; }
.step.is-reached::before { background: var(--accent); }
.step-dot {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-faint);
  font-size: var(--fs-12); font-weight: 700;
}
.step.is-reached .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.is-current .step-dot { box-shadow: 0 0 0 4px var(--accent-soft-2); }
.step-label { font-size: var(--fs-13); font-weight: 700; color: var(--text-muted); }
.step.is-reached .step-label { color: var(--text); }
.step-date { font-size: var(--fs-12); color: var(--text-muted); min-height: 18px; }
.stepper.is-cancelled { opacity: .45; filter: grayscale(1); }
.manual-note { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-muted); padding: 6px 10px; border-radius: 9px; background: var(--surface-2); }
.manual-note .link-btn { margin-left: auto; }

.track-none { font-weight: 600; }
.track-main { display: flex; flex-direction: column; gap: 4px; }
.track-carrier { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: var(--fs-13); }
.track-carrier-name { font-weight: 700; font-size: var(--fs-15); }
.track-no { font-size: var(--fs-20); font-weight: 700; }
.track-no .copyval-text { letter-spacing: .02em; }
.track-src { font-size: var(--fs-12); color: var(--text-muted); }
.track-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: var(--fs-15); }
.track-status.is-exception { background: var(--warn-soft); color: var(--warn-text); }
.track-at { margin-left: auto; font-size: var(--fs-12); color: var(--text-muted); font-weight: 500; }
.events { list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; }
.event { position: relative; display: flex; gap: 12px; padding: 0 0 14px; }
.event::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: -2px; width: 2px; background: var(--border); }
.event:last-child::before { display: none; }
.event:last-child { padding-bottom: 0; }
.event-dot { position: relative; z-index: 1; flex: none; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.event.is-latest .event-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.event-body { display: flex; flex-direction: column; min-width: 0; }
.event-text { font-size: var(--fs-15); font-weight: 600; }
.event:not(.is-latest) .event-text { font-weight: 500; color: var(--text-2); }
.event-meta { font-size: var(--fs-12); color: var(--text-muted); }
.track-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.sheet-line { font-size: var(--fs-13); color: var(--text-2); line-height: 1.65; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl-item { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-muted); }
.tl-item.kind-message .tl-dot { background: var(--accent-soft); color: var(--accent-text); }
.tl-item.kind-shipped .tl-dot { background: var(--info-soft); color: var(--info); }
.tl-item.kind-reminder .tl-dot { background: var(--warn-soft); color: var(--warn); }
.tl-item.kind-account .tl-dot, .tl-item.kind-cancelled .tl-dot { background: var(--danger-soft); color: var(--danger); }
.tl-item.kind-completed .tl-dot, .tl-item.kind-delivered .tl-dot { background: var(--success-soft); color: var(--success); }
.tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px; }
.tl-kind { font-weight: 700; font-size: var(--fs-13); }
.tl-sender { font-size: var(--fs-13); color: var(--text-2); }
.tl-time { margin-left: auto; font-size: var(--fs-12); color: var(--text-muted); }
.tl-subject { font-size: var(--fs-13); color: var(--text-muted); overflow-wrap: anywhere; }
.tl-item.kind-message .msg-body { padding: 12px 14px; border-radius: 4px 14px 14px 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-15); }
.tl-item.is-unread.kind-message .msg-body { border-color: var(--accent-soft-2); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.tl-item:not(.kind-message) .msg-body { font-size: var(--fs-13); color: var(--text-2); line-height: 1.7; }
.tl-hint { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-13); color: var(--text-muted); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); line-height: 1.6; }
.tl-hint .icon { margin-top: 3px; }

.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 80px; padding: 12px 8px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  text-align: center; font-weight: 600; font-size: var(--fs-13); line-height: 1.35;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.action:hover { border-color: var(--accent); background: var(--accent-soft); }
.action-label { white-space: nowrap; }
.action-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-xs); }
.action-sub { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.action-sub:empty { display: none; }
.detail-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: var(--fs-12); color: var(--text-muted); padding: var(--sp-2) 0; }

/* ==========================================================================
   Settings
   ========================================================================== */
.set-group { margin-top: var(--sp-5); }
.set-group:first-child { margin-top: 0; }
.set-group-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); font-weight: 700; color: var(--text-muted); margin: 0 4px var(--sp-2); letter-spacing: .02em; }
.set-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 10px 12px 10px 14px;
  border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; color: var(--text);
  transition: background-color var(--t-fast) var(--ease);
}
.set-row:first-child { border-top: 0; }
a.set-row:hover, button.set-row:hover { background: var(--surface-hover); }
.set-row.is-static { cursor: default; }
.set-row-wrap { flex-wrap: wrap; }
.set-row-wrap .set-main { flex: 1 1 120px; }
.set-row-wrap > .pill-stack { margin-left: auto; }
.set-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; background: var(--surface-3); color: var(--text-2); }
.set-icon.tone-accent { background: var(--accent-soft); color: var(--accent-text); }
.set-icon.tone-success { background: var(--success-soft); color: var(--success); }
.set-icon.tone-warn { background: var(--warn-soft); color: var(--warn); }
.set-icon.tone-danger { background: var(--danger-soft); color: var(--danger); }
.set-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.set-label { font-weight: 600; font-size: var(--fs-15); display: flex; align-items: center; gap: 8px; min-width: 0; }
.set-label.is-danger { color: var(--danger-text); }
.set-sub { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.5; }
.theme-seg { margin-left: auto; }

.profile { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: var(--sp-5); position: relative; overflow: hidden; }
.profile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, color-mix(in srgb, var(--acc, var(--accent)) 10%, transparent), transparent 60%); pointer-events: none; }
.profile.is-admin { --acc: var(--accent); }
.profile-avatar {
  position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 16px;
  background: var(--acc, var(--accent)); color: #fff; font-size: var(--fs-20); font-weight: 800;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--acc, var(--accent)) 35%, transparent);
}
.profile-main { position: relative; flex: 1; min-width: 0; }
.profile-name { font-size: var(--fs-17); font-weight: 800; }
.profile-sub { font-size: var(--fs-12); color: var(--text-muted); }
.profile .pill { position: relative; }

.status-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: var(--sp-2); }
.status-top { display: flex; align-items: center; gap: 12px; }
.status-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; flex: none; }
.status-title { font-weight: 700; font-size: var(--fs-15); }
.status-sub { font-size: var(--fs-12); color: var(--text-muted); }

.dev-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-top: 1px solid var(--border); }
.dev-row:first-child { border-top: 0; }
.dev-id { font-size: var(--fs-12); color: var(--text-muted); font-weight: 500; }
.page-narrow > .dev-foot { margin-top: var(--sp-5); }

/* パスワードの設定シート (settings → ユーザーとパスワード) */
.pw-list { margin-top: var(--sp-3); }
.pw-row { min-height: 68px; }
.pw-row .set-main { gap: 5px; }
.pw-dev { font-size: var(--fs-12); font-weight: 500; color: var(--text-muted); }
.pw-state { display: flex; }
.pw-edit { flex: none; min-width: 72px; }
.callout-link { justify-self: start; margin: 4px 0 0 -8px; }
.pw-sheet { display: flex; flex-direction: column; gap: var(--sp-4); }
.pw-target { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.pw-target-main { min-width: 0; }
.pw-target-name { font-weight: 700; font-size: var(--fs-15); }
.pw-target-sub { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.5; word-break: auto-phrase; }
.pw-gen { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.pw-gen-btn { flex: none; }
.pw-gen-hint { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.5; flex: 1 1 220px; min-width: 0; word-break: auto-phrase; }
/* the rules read as a short 「・」 list */
.pw-rules .callout-text { padding-left: 1em; text-indent: -1em; }
.pw-rules .callout-text::before { content: "・"; }
.pw-rules .callout-text + .callout-text { margin-top: 2px; }
.pw-gen-note:empty, .pw-error:empty { display: none; }
/* a password shown in groups of four (display only: the groups are spans, no spaces are copied or typed) */
.pw-groups { display: flex; flex-wrap: wrap; gap: 2px 0.7em; font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: .08em; line-height: 1.4; color: var(--text); word-break: break-all; }
.pw-gen-note .pw-groups { font-size: 17px; margin-top: 6px; }
.pw-done-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.pw-done-label { font-size: var(--fs-12); color: var(--text-muted); font-weight: 600; }
.pw-done-sub { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.5; }
/* 登録端末: devices per account against the limit */
.section-count.is-full { color: var(--warn-text); background: var(--warn-soft); }
.dev-cap { margin-top: var(--sp-2); }
/* ホーム: 未設定 callout (admin) */
.pw-alert, .pw-fail-alert {
  margin-bottom: var(--sp-4);
  border-color: color-mix(in srgb, var(--warn) 38%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 7%, var(--surface)), var(--surface) 85%);
}
.pw-alert .sys-title, .pw-fail-alert .sys-title { color: var(--warn-text); }

.stats-inline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; margin-bottom: var(--sp-4); }
.mini-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; min-width: 0; }
.mini-stat + .mini-stat { border-left: 1px solid var(--border); }
.mini-stat span { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }
.mini-stat b { font-size: var(--fs-17); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stat.is-danger b { color: var(--danger-text); }
.mini-stat.is-warn b { color: var(--warn-text); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid var(--border); }
.table-wrap.card { border-radius: var(--r); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: var(--fs-12); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
.table tr:first-child td { border-top: 0; }
.table .r { text-align: right; }
.table td.is-danger { color: var(--danger-text); font-weight: 700; }
.samples { display: flex; flex-direction: column; gap: 6px; }
.sample-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sample { padding: 3px 8px; border-radius: 7px; background: var(--surface-3); font-size: var(--fs-12); }

.gmail-target { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; word-break: break-all; }
.gmail-hint { display: flex; gap: 6px; align-items: flex-start; margin: var(--sp-3) 0 0; }
.gmail-hint svg { flex: none; margin-top: 2px; }
/* a long Gmail address wraps anywhere (steps, the device chooser, 「この端末」) instead of widening the page */
.steps li > span:last-child, .dev-opt-sub, .dev-acc-row .set-sub, .gmail-target .mono, .callout-text { overflow-wrap: anywhere; }

/* 設定 → 端末とアカウント (SPEC §4.1c): one card per device (端末A・B・C), one row per account used on it */
.term-card { margin-bottom: var(--sp-3); position: relative; overflow: hidden; }
.term-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--acc); }
.term-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.term-title { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.term-title b { font-size: var(--fs-17); font-weight: 800; }
.term-sub { color: var(--text-muted); font-size: var(--fs-13); overflow-wrap: anywhere; }
.term-rows { display: flex; flex-direction: column; gap: 10px; }
.term-row { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.term-row.is-shared { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.term-row .field { margin: 0; }
.term-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.term-row-title { font-size: var(--fs-13); font-weight: 700; color: var(--text-2); }
/* 表示名 | 使うフリマ, then Gmail | Gmail連携 on wide screens; one column (in that order) on phones */
.term-row-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--sp-3) var(--sp-4); align-items: end; }
.term-row-grid > * { min-width: 0; }
.term-row-link { display: flex; align-items: center; min-height: 48px; }
@media (max-width: 599px) {
  .term-row-grid { grid-template-columns: minmax(0, 1fr); }
  .term-row-link { min-height: 0; }
}
/* 使うフリマ: check chips */
.chk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chk-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: var(--fs-13); user-select: none; }
.chk-chip::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.chk-chip:has(.chk-input:checked) { border-color: var(--acc, var(--accent)); background: color-mix(in srgb, var(--acc, var(--accent)) 10%, transparent); font-weight: 700; }
.chk-chip:has(.chk-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chk-chip:has(.chk-input:disabled) { opacity: .45; cursor: not-allowed; }
.chk-input { margin: 0; width: 16px; height: 16px; accent-color: var(--acc, var(--accent)); }
.term-link-slot { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.term-note { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; font-size: var(--fs-12); color: var(--text-muted); }
.term-note:empty { display: none; }
.term-note-text { overflow-wrap: anywhere; }
.term-add { align-self: flex-start; }
.term-save { margin: var(--sp-2) 0 var(--sp-5); }
.dev-opt-gmail { font-family: var(--mono); font-size: var(--fs-12); }

/* job statistics (追跡チェック / シート連携 / システム状態) */
.stat-cells { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.stat-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.stat-cell dt { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-cell dd { margin: 0; font-size: var(--fs-15); font-weight: 700; color: var(--text); overflow-wrap: anywhere; line-height: 1.4; }
.stat-cell.is-zero dd { color: var(--text-muted); font-weight: 500; }
.stat-cell.is-wide { grid-column: 1 / -1; }
.stat-cell.is-wide dd { font-size: var(--fs-13); font-weight: 600; }

/* 注意 / 要対応 threshold labels */
.lvl-label { display: inline-flex; align-items: center; gap: 6px; }
.lvl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-faint); }
.lvl-label.lvl-warn .lvl-dot { background: var(--warn); }
.lvl-label.lvl-danger .lvl-dot { background: var(--danger); }

.unp-row { border-top: 1px solid var(--border); }
.unp-row:first-child { border-top: 0; }
.unp-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px 12px 16px; border: 0; background: transparent; text-align: left; color: var(--text); min-height: 60px; }
.unp-head:hover { background: var(--surface-hover); }
.unp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.unp-subject { font-weight: 600; font-size: var(--fs-13); overflow-wrap: anywhere; }
.unp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.unp-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.plain {
  margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font); font-size: var(--fs-13); line-height: 1.7; color: var(--text-2);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow-y: auto;
}

.checklist .platform { margin-right: 4px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 520px) {
  .stats-inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-inline .mini-stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--border); }
  .stats-inline .mini-stat:nth-child(4) { border-top: 1px solid var(--border); }
}
@media (max-width: 380px) {
  .topbar-title { font-size: var(--fs-17); }
  .kpi { padding: 12px 12px 10px; }
  .kpi-value { font-size: 28px; }
  .stat { padding: 10px; }
  .stat-value { font-size: var(--fs-15); }
  .ship-counter { width: 66px; }
  .ship-counter-num { font-size: 28px; }
  .hide-sm { display: none; }
  .filter-btn { padding: 0 12px; }
  .seg-btn { padding: 0 10px; }
}
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .table th, .table td { padding: 10px 8px; }
  .has-back .sync { display: none; }
  .seg-long { display: none; }
  .seg-short { display: inline; }
  .toolbar-row > .seg { flex: 1 1 auto; }
  .toolbar-row > .seg .seg-btn { flex: 1 1 0; }
  .theme-seg { width: 100%; margin-left: 48px; }
  .theme-seg .seg-btn { flex: 1 1 0; }
}

@media (min-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sys-grid { grid-template-columns: 1fr 1fr; }
  .ship-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .page { padding-top: var(--sp-4); padding-left: calc(var(--sp-6) + var(--safe-left)); padding-right: calc(var(--sp-6) + var(--safe-right)); }
  .topbar { padding-left: calc(var(--sp-6) + var(--safe-left)); padding-right: calc(var(--sp-5) + var(--safe-right)); }
  .chips { margin: -2px 0; padding: 4px 0; }
  .scope-chips { margin: 0; }
  .acct-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .toolbar > .search-row { flex: 1 1 100%; }
  .detail-body { padding-left: var(--sp-6); padding-right: var(--sp-6); }
  .toasts { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px); }
}

/* Wide: sidebar navigation + right-hand detail panel */
@media (min-width: 1024px) {
  .nav {
    top: 0; right: auto; bottom: 0; width: var(--sidebar-w);
    display: flex; flex-direction: column; gap: var(--sp-4);
    padding: calc(var(--sp-5) + var(--safe-top)) var(--sp-3) var(--sp-4);
    border-top: 0; border-right: 1px solid var(--border);
    background: var(--surface);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--sp-2) var(--sp-3); }
  .brand-text { display: flex; flex-direction: column; min-width: 0; }
  .brand-name { font-weight: 800; font-size: var(--fs-15); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-sub { font-size: var(--fs-12); color: var(--text-muted); }
  .nav-items { flex-direction: column; height: auto; gap: 2px; max-width: none; margin: 0; }
  .nav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 44px; padding: 0 10px 0 6px; border-radius: 10px; font-size: var(--fs-15); color: var(--text-2); }
  .nav-item:hover { background: var(--surface-hover); color: var(--text); }
  .nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
  .nav-item[aria-current="page"] .nav-icon { background: transparent; }
  .nav-icon { width: 32px; height: 32px; }
  .nav-item { position: relative; }
  .nav-item .nav-badge { position: absolute; right: 10px; left: auto; top: 50%; transform: translateY(-50%); box-shadow: none; }
  .nav-item .nav-icon { position: static; }
  .nav-foot { display: block; margin-top: auto; padding: var(--sp-3) var(--sp-2) 0; border-top: 1px solid var(--border); }
  .nav-ident { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
  .nav-ident-note { font-size: var(--fs-12); color: var(--text-muted); }
  .nav-version { font-size: 11px; color: var(--text-faint); margin-bottom: 8px; user-select: none; }
  /* 左のメニューがあるときは、版はメニューの中に出す（右下の端には出さない。v1.25） */
  .app-version { display: none; }

  .main-col { margin-left: var(--sidebar-w); padding-bottom: var(--sp-10); }
  .topbar { padding-left: calc(var(--sp-8)); padding-right: var(--sp-6); border-bottom-color: var(--border); }
  .topbar-row { min-height: 64px; }
  .topbar-title { font-size: var(--fs-24); }
  .topbar-scope { padding-bottom: 12px; }
  .page { padding: var(--sp-6) var(--sp-8) var(--sp-8); }
  .toasts { left: var(--sidebar-w); bottom: 24px; }
  .home-cols { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: var(--sp-6); align-items: start; }
  .home-aside .acct-grid { grid-template-columns: 1fr; }
  .home-aside .sys-grid { grid-template-columns: 1fr; }

  .detail-scrim { display: block; pointer-events: auto; }
  .detail-layer.open .detail-scrim { opacity: 1; }
  .detail { left: auto; width: var(--detail-w); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .detail-back { display: none; }
  .detail-x { display: inline-grid; }
  .detail-head { padding-left: var(--sp-5); }
  .detail-body { padding: var(--sp-5) var(--sp-5) var(--sp-10); }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-panel { max-width: 560px; }
}

/* Master/detail on the 取引 screen: the detail is docked instead of floating. */
@media (min-width: 1280px) {
  body.dock-detail .main-col { margin-right: var(--detail-w); }
  body.dock-detail .detail-scrim { display: none; }
  body.dock-detail .detail { box-shadow: none; transition: none; }
  body.dock-detail .detail-layer { left: auto; width: var(--detail-w); }
}
@media (min-width: 1600px) {
  .ship-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- isolation notes, disabled links, long jobs, new-device URLs ---------- */
/* A link-looking control that must not navigate (demo mode: no marketplace / script.google.com links). */
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: none; }
/* Persistent, muted advice on admin screens (e.g. 「このPCでフリマサイトを開かないでください」). */
.admin-note {
  display: flex; align-items: flex-start; gap: 6px; margin: 0;
  font-size: var(--fs-12); line-height: 1.6; color: var(--text-muted);
}
.admin-note > .icon { flex: none; margin-top: 2px; }
.page-settings > .admin-note { margin: 0 2px var(--sp-3); }
.job-note {
  display: flex; align-items: center; gap: 10px; margin: var(--sp-2) 0;
  font-size: var(--fs-13); color: var(--text-2);
}
.job-note .spinner { flex: none; }
.pair-urls { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.url-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.url-label { font-size: var(--fs-12); font-weight: 700; color: var(--text-muted); }
.url-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.url-value {
  flex: 1; min-width: 0; font-size: var(--fs-15); font-weight: 600; line-height: 1.5;
  overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.phone-guide { margin-bottom: var(--sp-4); }
.phone-guide-summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer;
  font-weight: 700; color: var(--text-2); list-style: none;
}
.phone-guide-summary::-webkit-details-marker { display: none; }
.phone-guide-summary::after { content: "＋"; margin-left: auto; color: var(--text-muted); font-weight: 400; }
.phone-guide[open] .phone-guide-summary::after { content: "－"; }
.phone-guide[open] .steps { margin-top: var(--sp-3); }
.ver-pill { margin-left: 6px; }
.pill-stack { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }

/* ==========================================================================
   v1.2 — users and 「この端末のアカウント」 (SPEC §4.9b)
   ========================================================================== */
/* header chip 「この端末: <name>」: under the title on phones, beside it from 640 px */
.dev-chip {
  --acc: #64748B;
  display: inline-flex; align-items: center; gap: 5px; flex: none; max-width: 100%; min-width: 0;
  height: 26px; padding: 0 10px 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: 700; line-height: 1; white-space: nowrap;
  color: color-mix(in srgb, var(--acc) 80%, var(--text));
  background: color-mix(in srgb, var(--acc) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 26%, transparent);
  transition: box-shadow var(--t-fast) var(--ease);
}
.dev-chip:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 50%, transparent); }
.dev-chip .acct-dot { width: 8px; height: 8px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 20%, transparent); }
.dev-chip-k { font-weight: 600; opacity: .82; }
.dev-chip-v { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-ident[hidden] { display: none; }
@media (max-width: 639px) {
  .topbar-heading.has-dev { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; padding: 4px 0; }
  .topbar-heading.has-dev .topbar-title { font-size: var(--fs-17); line-height: 1.3; max-width: 100%; }
  .topbar-heading.has-dev .dev-chip { height: 20px; padding: 0 8px 0 6px; font-size: 11.5px; background: transparent; box-shadow: none; padding-left: 0; }
  .topbar-heading.has-dev .dev-chip::after { content: ""; position: absolute; inset: -12px -8px; }
  .topbar-heading.has-dev .dev-chip { position: relative; }
}

/* sidebar: who is logged in and this device's account */
.nav-user { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); font-weight: 700; color: var(--text); min-width: 0; }
.nav-user .icon { color: var(--accent-text); flex: none; }
.nav-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-dev { display: inline-flex; align-items: center; gap: 6px; color: color-mix(in srgb, var(--acc, #64748B) 75%, var(--text)); font-weight: 600; }

/* 「この端末で使うアカウント」 — full screen (login look) and the settings sheet */
.chooser-card { gap: var(--sp-5); padding-top: var(--sp-6); }
.chooser-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.chooser-icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent-soft); color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-soft-2);
}
.chooser-title { font-size: var(--fs-20); margin-top: 2px; word-break: auto-phrase; }
.chooser-lead { color: var(--text-muted); font-size: var(--fs-13); line-height: 1.75; word-break: auto-phrase; text-wrap: pretty; }
.chooser-note { margin-top: -4px; font-size: var(--fs-12); color: var(--text-muted); line-height: 1.6; word-break: auto-phrase; text-wrap: balance; }
.chooser-note .icon { display: inline-block; vertical-align: -2px; margin-right: 4px; color: var(--text-faint); }
.dev-sheet .chooser-note { margin-top: -8px; text-wrap: wrap; }
.chooser .login-alt { margin-top: 0; }
.dev-later { color: var(--text-muted); }
.dev-later:hover { color: var(--accent-text); }
.dev-opts { display: flex; flex-direction: column; gap: 10px; }
.dev-opt {
  --acc: #64748B;
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px;
  padding: 12px 12px 12px 14px; border-radius: 16px; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.dev-opt::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--acc); }
.dev-opt:hover { border-color: color-mix(in srgb, var(--acc) 55%, var(--border-strong)); background: color-mix(in srgb, var(--acc) 5%, var(--surface)); box-shadow: var(--shadow-sm); }
.dev-opt:active { transform: scale(.99); }
.dev-opt.is-busy { opacity: .7; pointer-events: none; }
.dev-opt.is-none { --acc: transparent; border-style: dashed; box-shadow: none; background: var(--surface-2); }
.dev-opt.is-none::before { display: none; }
.dev-opt.is-none:hover { border-color: var(--text-faint); background: var(--surface-hover); }
.dev-opt-avatar {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px;
  background: var(--acc); color: #fff; font-size: var(--fs-20); font-weight: 800;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--acc) 32%, transparent);
}
.dev-opt-avatar.is-none { background: var(--surface-3); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }
.dev-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dev-opt-name { font-size: var(--fs-17); font-weight: 800; line-height: 1.35; word-break: auto-phrase; }
.dev-opt.is-none .dev-opt-name { font-size: var(--fs-15); font-weight: 700; }
.dev-opt-sub { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.5; word-break: auto-phrase; }
.dev-opt-chev { flex: none; color: var(--text-faint); }
.dev-opt:hover .dev-opt-chev { color: color-mix(in srgb, var(--acc) 70%, var(--text-muted)); }
.dev-opt.is-none:hover .dev-opt-chev { color: var(--text-muted); }
.dev-sheet { display: flex; flex-direction: column; gap: var(--sp-4); }

/* 取引詳細: another account's transaction on an account's device */
.market-hint {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--text-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 22%, transparent);
}
.market-hint > .icon { flex: none; margin-top: 1px; color: var(--warn); }
.market-hint-body { min-width: 0; display: grid; gap: 2px; }
.market-hint-title { font-size: var(--fs-13); font-weight: 700; color: var(--warn-text); line-height: 1.55; word-break: auto-phrase; }
.market-hint-text { font-size: var(--fs-12); color: var(--text-muted); line-height: 1.6; word-break: auto-phrase; }

/* 設定 → この端末 */
.dev-acc-row { flex-wrap: wrap; }
.dev-acc-row .set-main { flex: 1 1 200px; }
.dev-acc-row .set-sub { word-break: auto-phrase; }
.dev-acc-row .acct-avatar.sm { width: 36px; height: 36px; }
.dev-choose { flex: none; min-width: 72px; margin-left: auto; }
.dev-hint .hint-icon { background: var(--warn-soft); color: var(--warn); }

/* 設定 → ユーザーとパスワード */
.user-list { margin-top: var(--sp-3); }
.user-row { align-items: flex-start; min-height: 84px; padding-top: 14px; padding-bottom: 8px; }
.user-row > .pw-edit { margin-top: 2px; }
.user-row .set-main { gap: 6px; }
.user-avatar { --acc: var(--accent); }
.user-row .user-avatar { width: 36px; height: 36px; margin-top: 1px; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.user-self {
  flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 700;
}
.user-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.user-sessions { font-size: var(--fs-12); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.user-actions { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 0 -8px; }
.user-actions .link-btn { color: var(--text-muted); font-weight: 600; }
.user-actions .link-btn:hover { color: var(--accent-text); }
.user-actions .user-delete:hover { color: var(--danger-text); background: var(--danger-soft); }
.user-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.page-narrow > .user-add-row { margin-top: var(--sp-3); }

/* 設定 → 登録端末 */
.dev-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); padding: 0; overflow: hidden; }
.dev-sum-item { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; min-width: 0; }
.dev-sum-item + .dev-sum-item { border-left: 1px solid var(--border); }
.dev-sum-name { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); font-weight: 700; color: color-mix(in srgb, var(--acc) 78%, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-sum-count { font-size: var(--fs-17); font-weight: 800; }
.dev-sum-item.is-full .dev-sum-count { color: var(--warn-text); }
.page-narrow > .dev-list { margin-top: var(--sp-3); }
.dev-row.is-self { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.dev-row .set-main { gap: 4px; }
.dev-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dev-self {
  flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 700;
}
.dev-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.dev-acc { height: 22px; }
.dev-acc.is-none { color: var(--text-2); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border); }
.dev-acc.is-unset { color: var(--warn-text); background: var(--warn-soft); }
.dev-user { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.dev-user .icon { color: var(--text-muted); }
.set-icon.is-acc { background: color-mix(in srgb, var(--acc) 12%, var(--surface)); color: color-mix(in srgb, var(--acc) 85%, var(--text)); }

/* ---------- touch targets: compact controls get an invisible 44 px hit area ---------- */
.chip, .seg-btn, .btn-sm, .filter-tag, .link-btn.sm, .banner-action, .demo-exit, .text-more, .toast-action { position: relative; }
.chip::after, .seg-btn::after, .btn-sm::after, .filter-tag::after, .link-btn.sm::after,
.banner-action::after, .demo-exit::after, .text-more::after, .toast-action::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%);
}
.filter-btn { min-width: 44px; }
/* <select> cannot carry a hit-area pseudo element: on touch screens and phone-width layouts the
   compact selects get the full 44 px height. */
@media (pointer: coarse), (max-width: 767px) {
  .select-sm { min-height: 44px; }
}
.input-affix::before { content: ""; position: absolute; inset: -3px; }   /* 38 px button → 44 px target */
.link-btn.sm { min-width: 44px; justify-content: center; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- print (rarely used, but keep lists readable) ---------- */
@media print {
  .nav, .app-top, .toasts, .detail-scrim { display: none !important; }
  .main-col { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
}

/* 設定 → 取引画面の読み取り（拡張機能。SPEC §10） */
.reader-key { margin: 0; padding: var(--sp-3); border-radius: var(--r-sm); background: var(--surface-3); font-size: var(--fs-15); overflow-wrap: anywhere; user-select: all; }
.reader-step { display: grid; gap: var(--sp-2); min-width: 0; }
.reader-cmd { display: flex; gap: var(--sp-2); align-items: flex-start; min-width: 0; }
.reader-cmd code { flex: 1; min-width: 0; padding: var(--sp-2); border-radius: var(--r-xs); background: var(--surface-3); font-size: var(--fs-12); line-height: 1.5; overflow-wrap: anywhere; user-select: all; }
.reader-dev .set-sub + .set-sub { margin-top: 2px; }
.reader-hidden { color: var(--warn-text); }
.reader-now { white-space: normal; }
/* v1.14: the account as a solid tag, the marketplace + item ID as plain text */
.acct-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-size: var(--fs-12, 12px); font-weight: 700; color: #fff; background: var(--acc, #64748B); white-space: nowrap; flex: none; }
.market-line { color: var(--text-muted); font-size: var(--fs-12, 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-top { display: flex; align-items: flex-start; gap: 8px; }
.alert-top .alert-msg { display: inline-flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.alert-top .acct-tag { margin-top: 2px; }
.alert-row .thumb { flex: none; }
.alert-list.is-scroll { max-height: min(640px, 70vh); overflow-y: auto; overscroll-behavior: contain; }
.alert-list.is-scroll:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }
.thumb-md { width: 56px; height: 56px; }
.msg-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.msg-st { color: var(--text-faint); display: inline-flex; }
.msg-row.is-done { opacity: .55; }
.track-line { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12, 12px); color: var(--text-muted); min-width: 0; }
.track-line b { font-weight: 700; }
.track-line.is-waitno { color: var(--warn-text); }
.track-line.is-waitno b { color: var(--warn-text); background: var(--warn-soft); padding: 0 6px; border-radius: 4px; }
.track-line.tone-success b { color: var(--success-text); }
.track-line.tone-info b { color: var(--info-text, #1d4ed8); }
.tl-stamp { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--fs-13, 13px); color: var(--text-muted); }
.tl-stamp-emoji { font-size: 18px; }
.app-version { position: fixed; right: 10px; bottom: 6px; z-index: 5; font-size: 11px; color: var(--text-faint); pointer-events: none; user-select: none; }

.reader-state-row { display: flex; align-items: center; gap: 8px; }
.reader-state { font-weight: 700; font-size: var(--fs-16, 16px); padding: 4px 12px; border-radius: 999px; }
.reader-state.is-running { color: var(--success-text, #166534); background: var(--success-soft, #dcfce7); }
.reader-state.is-stopped { color: var(--text, #111); background: var(--surface-2, #e5e7eb); border: 1px solid var(--border, #cbd5e1); }
.reader-now.tone-warn { color: var(--warn-text); }
.reader-now.tone-danger { color: var(--danger-text); font-weight: 600; }
.reader-notes { margin-top: var(--sp-3); }
.reader-notes dt { width: 120px; }

/* スマホの通知（設定 → スマホの通知。SPEC §11） */
.notify-key { font-size: var(--fs-20); letter-spacing: .06em; text-align: center; }
.notify-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.notify-item { display: grid; gap: 2px; min-width: 0; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); }
.notify-item:last-child { border-bottom: 0; }
.notify-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); color: var(--text-muted); font-size: var(--fs-12); }
.notify-dev-tag { padding: 0 var(--sp-1); border-radius: var(--r-xs); background: var(--surface-3); }
.notify-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.notify-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-13); }

/* ---------- v1.15: 要チェック・読み込み中 ---------- */
.watch-star { display: inline-flex; vertical-align: -2px; margin-right: 5px; color: var(--warn); }
.watch-star .icon, .watch-toggle.is-on .icon, .watch-note .icon, .watch-empty .icon { fill: currentColor; }
/* the button itself is 44 px tall (touch target, §6.3); the visible pill inside stays small like the badges next to it */
.watch-toggle { margin-left: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.watch-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: var(--fs-13); font-weight: 600; }
.watch-toggle:hover .watch-pill { background: var(--surface-hover); }
.watch-toggle.is-on .watch-pill { border-color: var(--warn); background: var(--warn-soft); color: var(--warn-text); }
.watch-toggle.is-on .icon { color: var(--warn); }
.watch-note { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn-text); font-size: var(--fs-13); line-height: 1.5; }
.watch-note .icon { flex: none; margin-top: 2px; color: var(--warn); }
.watch-list .watch-item + .watch-item { border-top: 1px solid var(--border); }
.watch-item { display: flex; align-items: center; }
.watch-row.sheetw-row::before { background: var(--info, #2563eb); }
.sheetw-section .section-head { flex-wrap: wrap; row-gap: 4px; }
.sheetw-line { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: var(--fs-12); color: var(--text-muted); }
.sheetw-line .mono { color: var(--text); }
.sheetw-hint { margin: -4px 0 8px; }
.watch-item > .watch-row { flex: 1; min-width: 0; }
.watch-item > .watch-complete { flex: none; margin-right: 12px; white-space: nowrap; }
@media (max-width: 480px) { .watch-item { flex-wrap: wrap; } .watch-item > .watch-row { flex-basis: 100%; } .watch-item > .watch-complete { margin: -6px 14px 10px auto; } }
.watch-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; color: inherit; text-decoration: none; }
.watch-row:hover { background: var(--surface-hover); }
.watch-row::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--warn); }
.watch-row.is-done { opacity: .7; }
.watch-row.is-done::before { background: var(--border-strong); }
.watch-row .thumb { flex: none; }
.watch-title { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: var(--fs-15); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.watch-side { flex: none; width: 92px; display: flex; justify-content: flex-end; }
.watch-auto { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); color: var(--text-muted); }
.watch-list.is-scroll { max-height: min(460px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.watch-list.is-scroll:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }
.watch-empty { display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--text-muted); font-size: var(--fs-13); }
.watch-empty .icon { flex: none; color: var(--warn); }
.stale-pill { position: fixed; z-index: 70; top: calc(var(--safe-top) + 10px); left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 7px 14px; border-radius: 999px;
  background: var(--text); color: var(--surface); font-size: var(--fs-13); font-weight: 600; box-shadow: var(--shadow-lg); pointer-events: none; }
.stale-pill > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stale-pill[hidden] { display: none; }
.view.is-stale > *, .detail-root.is-stale .detail-body { opacity: .55; transition: opacity .2s; }
@media (max-width: 480px) { .watch-side { width: 76px; } .alert-days { width: 50px; } }

/* ---------- v1.16: 発送のカードの商品画像 ---------- */
/* 発送のリスト表示と、表示・並びの切り替え（v1.25） */
.ship-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 16px; margin: -4px 0 12px; }
.ship-opt { display: inline-flex; align-items: center; gap: 6px; }
.ship-opt-label { font-size: var(--fs-12); color: var(--text-muted); font-weight: 600; }
.ship-list { padding: 0; overflow: hidden; }
.ship-row { position: relative; display: grid; grid-template-columns: 92px 44px minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, auto); align-items: center;
  gap: 4px 14px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ship-row:first-child { border-top: 0; }
.ship-row:hover { background: var(--surface-hover); }
.ship-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.ship-row.tone-danger::before { background: var(--danger); }
.ship-row.tone-warn::before { background: var(--warn); }
.ship-row-date { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; font-size: var(--fs-12); color: var(--text-muted); }
.ship-row-date b { font-size: var(--fs-14); color: var(--text); font-weight: 700; }
.ship-row-date-label { font-size: 11px; font-weight: 700; }
.ship-row-days { font-weight: 600; }
.ship-row.tone-danger .ship-row-days { color: var(--danger-text); }
.ship-row.tone-warn .ship-row-days { color: var(--warn-text); }
.ship-row > .thumb { flex: none; }
.ship-row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ship-row-title { color: var(--text); font-weight: 600; font-size: var(--fs-14); line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; text-decoration: none; }
.ship-row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-12); min-width: 0; }
.ship-row-track { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ship-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }
.ship-row-alert { grid-column: 3 / -1; font-size: var(--fs-12); }
@media (max-width: 860px) {
  .ship-row { grid-template-columns: 44px minmax(0, 1fr); gap: 6px 10px; padding: 12px 12px 12px 14px; align-items: start; }
  .ship-row-date { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .ship-row-track, .ship-row-side, .ship-row-alert { grid-column: 2 / -1; }
  .ship-row-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 4px 10px; white-space: normal; }
  .ship-options { justify-content: flex-start; }
}
.ship-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.ship-head > .thumb { flex: none; }
.ship-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ship-market { display: flex; min-width: 0; font-size: var(--fs-12); }
.ship-track.is-none .track-line { white-space: normal; }

/* ---------- v1.16: 仕入れ登録（SPEC §12） ---------- */
.page-register { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-4); }
.reg-stats .reg-tab { font-size: var(--fs-13); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-list .reg-row + .reg-row, .reg-recent-list .reg-recent + .reg-recent { border-top: 1px solid var(--border); }
.reg-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
.reg-row:hover { background: var(--surface-hover); }
.reg-row > .thumb { flex: none; }
.reg-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.reg-row-title { font-weight: 700; font-size: var(--fs-15); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reg-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-muted); min-width: 0; }
.reg-row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.reg-row-price { font-weight: 700; }
.reg-row-go { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-12); font-weight: 700; color: var(--accent-text, var(--accent)); }
.reg-recent { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.reg-recent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.reg-recent-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-recent-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reg-recent-total { flex: none; font-weight: 700; }
.reg-tx { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.reg-tx > .thumb { flex: none; }
.reg-tx-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.reg-tx-title { font-weight: 700; font-size: var(--fs-17); line-height: 1.4; }
.reg-tx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reg-tx > .callout { flex-basis: 100%; }
.reg-product { display: flex; flex-direction: column; gap: var(--sp-3); }
.reg-chosen { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2, var(--surface)); }
.reg-chosen-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.reg-chosen-name { font-weight: 700; line-height: 1.4; }
.reg-pick-btn { justify-content: center; }
.reg-pic { position: relative; flex: none; width: 44px; height: 44px; border-radius: var(--r-xs); background: var(--surface-3, var(--bg)); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; color: var(--text-muted); }
.reg-pic-lg { width: 64px; height: 64px; border-radius: var(--r-sm); }
.reg-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; opacity: 0; transition: opacity .15s; }
.reg-pic.has-img img { opacity: 1; }
.reg-pic.has-img .reg-pic-ph { visibility: hidden; }
.reg-pic img:not([src]) { display: none; }
.reg-cond { flex-wrap: wrap; }
.reg-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-13); }
.reg-sum.is-ok { background: var(--success-soft); color: var(--success-text); }
.reg-sum.is-warn { background: var(--warn-soft); color: var(--warn-text); }
.reg-sum-note { font-weight: 700; }
.reg-bonus-section { display: flex; flex-direction: column; gap: var(--sp-3); }
.reg-bonus { border-left: 3px solid var(--warn); }
.reg-bonus-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reg-bonus-title { margin: 0; font-size: var(--fs-15); }
.reg-actions { position: sticky; bottom: calc(var(--tabbar-h, 0px) + 8px); z-index: 3; padding-top: 4px; }
.reg-submit { box-shadow: var(--shadow-lg); }
.reg-error { margin: 0; }
.reg-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-2); }
.reg-results { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.reg-results:empty { display: none; }
.reg-result { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.reg-result + .reg-result { border-top: 1px solid var(--border); }
.reg-result:hover, .reg-result:focus-visible { background: var(--surface-hover); }
.reg-result-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.reg-result-name { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reg-result-sub { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-result-target { flex: none; font-size: var(--fs-12); font-weight: 700; color: var(--text-2); }
.reg-count { margin: 0; }
.reg-done { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--success-text); }
.reg-go { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { .reg-row-side .reg-row-go { display: none; } }

/* ==========================================================================
   v1.18 トーク (views/talk.js, views/messages.js; SPEC §14)
   ========================================================================== */
:root {
  --talk-bg: #EDF1F7;
  --talk-theirs: #FFFFFF;
  --talk-mine: #D7F5C4;
  --talk-mine-text: #11280F;
  --talk-mine-border: #BCE7A3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --talk-bg: #0D1525; --talk-theirs: #1B2539; --talk-mine: #22472A; --talk-mine-text: #E6F7E0; --talk-mine-border: #2E5E37; }
}
:root[data-theme="dark"] { --talk-bg: #0D1525; --talk-theirs: #1B2539; --talk-mine: #22472A; --talk-mine-text: #E6F7E0; --talk-mine-border: #2E5E37; }

/* 取引: the トーク button under the row's status (a sibling of the row link; the row keeps room for it) */
.tx-item { position: relative; border-top: 1px solid var(--border); }
.tx-item:first-child { border-top: 0; }
.tx-item > .tx-row { border-top: 0; }
.tx-item .tx-side { padding-bottom: 40px; }
.tx-talk {
  position: absolute; right: 12px; bottom: 11px; width: 44px; height: 32px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-text);
  transition: background-color var(--t-fast) var(--ease);
}
.tx-talk:hover { background: var(--accent-soft-2); }
.tx-talk-dot { position: absolute; top: 4px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* メッセージ: the conversations */
.toolbar.talk-toolbar { flex-direction: column; align-items: stretch; }
.talk-toolbar .toolbar-row { gap: var(--sp-2); }
.talk-search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.talk-search > svg { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; }
.talk-search input { width: 100%; padding-left: 36px; }
.talk-counts { font-size: var(--fs-13); color: var(--text-muted); margin: 0 2px var(--sp-2); min-height: 1em; }
.talk-row {
  width: 100%; border: 0; background: transparent; text-align: left; color: var(--text); text-decoration: none;
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border-top: 1px solid var(--border); position: relative;
  transition: background-color var(--t-fast) var(--ease);
}
.talk-row:first-child { border-top: 0; }
.talk-row:hover { background: var(--surface-hover); }
.talk-row.is-selected { background: var(--accent-soft); }
.talk-row.is-selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.talk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.talk-row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.talk-row-title { flex: 1; min-width: 0; font-size: var(--fs-15); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-row-title .watch-star { margin-right: 4px; vertical-align: -1px; }
.talk-row.is-unread .talk-row-title { font-weight: 800; }
.talk-row.is-done .talk-row-title { color: var(--text-muted); }
.talk-row-time { flex: none; font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }
.talk-row.is-unread .talk-row-time { color: var(--accent-text); font-weight: 700; }
.talk-row-text {
  font-size: var(--fs-13); color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.talk-row-text.is-event { color: var(--text-muted); }
.talk-row-who { font-weight: 700; color: var(--text-muted); }
.talk-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.talk-row-meta .pill { height: 20px; font-size: 11px; padding: 0 7px; }
.talk-badge {
  flex: none; align-self: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  display: inline-grid; place-items: center; background: var(--success); color: #fff; font-size: 12px; font-weight: 800;
}
.talk-notice-icon { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger-text); }
.talk-row.is-notice .talk-row-title { color: var(--danger-text); }
.talk-row.is-notice > .unread-dot { align-self: center; }
.talk-list-foot { margin: var(--sp-3) 4px 0; font-size: var(--fs-12); color: var(--text-muted); text-align: center; line-height: 1.6; }
.talk-placeholder { display: none; }
.talk-placeholder-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent-text); box-shadow: 0 0 0 1px var(--border); }
.talk-placeholder-title { font-weight: 700; color: var(--text-2); }
.talk-placeholder-text { font-size: var(--fs-13); color: var(--text-muted); max-width: 300px; line-height: 1.6; }
.dcard-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* the トーク panel */
.detail.talk { background: var(--talk-bg); }
.talk-head { gap: 6px; }
.talk-headmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding-left: 2px; }
.talk-headtext { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.talk-title { font-size: var(--fs-15); font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-12); color: var(--text-muted); }
.talk-sub .pill { flex: none; height: 18px; font-size: 10.5px; padding: 0 6px; }
.talk-sub .acct-tag { flex: none; }
.talk-seller { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-xs { width: 36px; height: 36px; border-radius: 9px; }
.detail-body.talk-body { gap: 0; padding: var(--sp-3) calc(var(--sp-3) + var(--safe-right)) var(--sp-5) calc(var(--sp-3) + var(--safe-left)); }
.talk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.talk-day { display: flex; justify-content: center; margin: 12px 0 4px; }
.talk-day span { padding: 3px 12px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-muted); font-size: 11.5px; font-weight: 700; }
.talk-unread { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; color: var(--accent-text); font-size: 11.5px; font-weight: 800; }
.talk-unread::before, .talk-unread::after { content: ""; flex: 1; height: 1px; background: var(--accent-soft-2); }
.talk-msg { display: flex; align-items: flex-start; gap: 8px; max-width: 100%; }
.talk-msg.is-first { margin-top: 6px; }
.talk-msg.is-mine { justify-content: flex-end; }
.talk-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft-2); color: var(--accent-text); font-weight: 800; font-size: 14px; }
.talk-msg:not(.is-first) .talk-avatar { visibility: hidden; height: 1px; }
.talk-msg-col { min-width: 0; max-width: min(80%, 540px); display: flex; flex-direction: column; gap: 3px; }
.talk-msg.is-mine .talk-msg-col { align-items: flex-end; }
.talk-name { font-size: 11.5px; color: var(--text-muted); margin-left: 3px; }
.talk-msg-line { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.talk-msg.is-mine .talk-msg-line { flex-direction: row-reverse; }
.talk-bubble { min-width: 0; padding: 9px 12px; border-radius: 18px; background: var(--talk-theirs); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.talk-msg.is-theirs.is-first .talk-bubble { border-top-left-radius: 6px; }
.talk-msg.is-mine .talk-bubble { background: var(--talk-mine); color: var(--talk-mine-text); box-shadow: 0 0 0 1px var(--talk-mine-border); }
.talk-msg.is-mine.is-first .talk-bubble { border-top-right-radius: 6px; }
.talk-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-15); line-height: 1.55; }
.talk-meta { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-bottom: 2px; font-size: 10.5px; color: var(--text-muted); }
.talk-msg.is-mine .talk-meta { align-items: flex-end; }
.talk-meta .new-chip { height: 16px; font-size: 9.5px; padding: 0 5px; }
.talk-stamps { display: flex; flex-wrap: wrap; gap: 6px; }
.talk-stamp { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 4px; border-radius: var(--r-pill); background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-size: 11.5px; color: var(--text-muted); }
.talk-stamp-emoji { font-size: 18px; line-height: 1; }
.talk-note { align-self: center; max-width: min(94%, 560px); display: flex; flex-direction: column; align-items: center; margin: 4px 0; }
.talk-note-head {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 6px;
  padding: 5px 12px; border: 0; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-muted); font-size: 12px; line-height: 1.5; text-align: center;
}
button.talk-note-head { cursor: pointer; position: relative; }
/* 44 px touch targets (like .btn-sm / .link-btn.sm) */
.tx-talk::after, button.talk-note-head::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
button.talk-note-head:hover { background: var(--surface-hover); color: var(--text-2); }
.talk-note-label { font-weight: 700; color: var(--text-2); }
.talk-note-sub { overflow-wrap: anywhere; }
.talk-note-time { font-size: 11px; }
.talk-note.is-unread .talk-note-head { box-shadow: 0 0 0 1px var(--accent-soft-2); }
.talk-note-body { align-self: stretch; margin-top: 6px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-size: var(--fs-13); text-align: left; }
.talk-loading { display: flex; flex-direction: column; gap: 10px; padding: var(--sp-3) 0; }
.talk-loading .muted { text-align: center; }
.talk-foot {
  flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 10px calc(var(--sp-4) + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(var(--sp-4) + var(--safe-left));
  background: var(--bg-blur); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.talk-foot-read { display: flex; align-items: center; gap: 10px; }
.talk-foot-read .admin-note { flex: 1; margin: 0; }
.talk-market { display: flex; flex-direction: column; gap: 6px; }
.talk-foot-note { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: var(--fs-12); color: var(--text-muted); line-height: 1.55; }
.talk-foot-note svg { flex: none; margin-top: 2px; }
.talk-foot-note.is-elsewhere { color: var(--warn-text); }

/* メッセージ from 1024px: the conversations on the left, the トーク on the right (a placeholder until one is chosen) */
@media (min-width: 1024px) {
  :root { --chat-w: clamp(380px, calc(100vw - var(--sidebar-w) - 400px), 560px); }
  body.talk-split .page { padding-left: var(--sp-5); padding-right: var(--sp-5); }
  .detail.talk { width: var(--chat-w); }
  body.talk-split .main-col { margin-right: var(--chat-w); }
  body.talk-split .talk-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
    position: fixed; top: 0; right: 0; bottom: 0; width: var(--chat-w); padding: var(--sp-8);
    background: var(--talk-bg); border-left: 1px solid var(--border); z-index: 5;
  }
  body.talk-split .detail-layer.is-talk { left: auto; width: var(--chat-w); }
  body.talk-split .detail-layer.is-talk .detail-scrim { display: none; }
  body.talk-split .detail-layer.is-talk .detail { width: 100%; box-shadow: none; transition: none; }
}
@media (min-width: 1280px) {
  body.dock-detail .detail.talk { width: 100%; }
}
@media (max-width: 520px) {
  .talk-msg-col { max-width: 84%; }
  .tx-item .tx-side { padding-bottom: 38px; }
}

/* ==========================================================================
   v1.19 監視の異常（SPEC §15）— the monitors that stopped or fail, at the top of ホーム (administrators)
   ========================================================================== */
.monitor-card { padding: 0; overflow: hidden; border: 1px solid var(--danger); }
.monitor-card.is-warn { border-color: var(--warn); }
.monitor-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 10px; }
.monitor-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.monitor-title { font-weight: 700; font-size: var(--fs-15); color: var(--danger-text); }
.monitor-card.is-warn .monitor-title { color: var(--warn-text); }
.monitor-sub { font-size: var(--fs-13); color: var(--text-muted); }
.monitor-list { list-style: none; margin: 0; padding: 0 0 6px; }
.monitor-list li + li .monitor-row { border-top: 1px solid var(--border); }
.monitor-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px 10px 16px; color: var(--text); text-decoration: none; }
.monitor-row:hover { background: var(--surface-2); }
.monitor-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.monitor-row > svg:first-child { flex: none; margin-top: 2px; }
.monitor-row.lvl-danger > svg:first-child { color: var(--danger); }
.monitor-row.lvl-warn > svg:first-child { color: var(--warn); }
.monitor-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.monitor-row-title { font-weight: 600; font-size: var(--fs-15); overflow-wrap: anywhere; }
.monitor-row-text { font-size: var(--fs-13); color: var(--text-muted); overflow-wrap: anywhere; }
.monitor-row .row-chevron { flex: none; align-self: center; color: var(--text-muted); }

/* ==========================================================================
   v1.20 AI の判定（SPEC §16）— the トーク card, the メッセージ chip, ホーム 返信が必要
   ========================================================================== */
.talk-ai { margin: 0 0 8px; border-radius: var(--r); font-size: var(--fs-13); }
.talk-ai.is-none { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-muted); }
.talk-ai.is-reply { padding: 10px 12px; background: var(--warn-soft); border: 1px solid var(--warn); }
.talk-ai.is-reply.is-urgent { background: var(--danger-soft); border-color: var(--danger); }
.talk-ai-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; color: var(--warn-text); }
.talk-ai.is-urgent .talk-ai-head { color: var(--danger-text); }
.talk-ai-by { font-size: var(--fs-12); color: var(--text-muted); margin-left: auto; }
.talk-ai-reason, .talk-ai-note { margin: 6px 0 0; color: var(--text); overflow-wrap: anywhere; }
.talk-ai-note { color: var(--text-muted); }
.talk-ai-draft { margin-top: 8px; padding: 8px 10px; background: var(--surface); border-radius: calc(var(--r) - 4px); display: flex; flex-direction: column; gap: 6px; }
.talk-ai-draft-label { margin: 0; font-size: var(--fs-12); color: var(--text-muted); }
.talk-ai-draft-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.talk-ai-draft .btn { align-self: flex-start; min-height: 44px; }
.ai-chip { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: var(--fs-12); font-weight: 600;
  color: var(--warn-text); background: var(--warn-soft); margin-right: 6px; white-space: nowrap; }
.ai-chip.is-urgent { color: var(--danger-text); background: var(--danger-soft); }
.reply-list.is-scroll { max-height: 420px; overflow-y: auto; }
.reply-row { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; color: var(--text); text-decoration: none; }
.reply-list .reply-row + .reply-row { border-top: 1px solid var(--border); }
.reply-row:hover { background: var(--surface-2); }
.reply-row .row-chevron { flex: none; color: var(--text-muted); }
.ai-key { overflow-wrap: anywhere; }
