:root {
  --bg: #fdf7fb;
  --card: #ffffff;
  --text: #2b2330;
  --muted: #7a6f80;
  --line: #eadfe8;
  --primary: #e0457b;
  --primary-dark: #c22f63;
  --primary-soft: #fde7ef;
  --ok: #1f9d6b;
  --ok-soft: #e3f6ee;
  --danger: #d0384b;
  --danger-soft: #fdecee;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18141b;
    --card: #231d27;
    --text: #f1e9f3;
    --muted: #ab9fb2;
    --line: #3a3140;
    --primary: #ff6b9b;
    --primary-dark: #ff8fb2;
    --primary-soft: #3d2030;
    --ok: #4cd39c;
    --ok-soft: #1c3a2e;
    --danger: #ff6b7d;
    --danger-soft: #3d1f24;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--primary); }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; line-height: 1.35; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }

.site-header { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.container { max-width: 960px; margin: 0 auto; padding: 16px; }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px 40px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 12px; }
.hero { padding: 16px 4px 8px; }
.hero h1 { font-size: 1.6rem; }
.hero p { color: var(--muted); }
.eyebrow { color: var(--primary); font-weight: 700; font-size: .8rem; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.req { font-size: .7rem; background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
.description { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.meta { margin: 8px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-block; font-size: .75rem; padding: 2px 10px; border-radius: 999px; font-weight: 700; vertical-align: middle; }
.badge-open { background: var(--ok-soft); color: var(--ok); }
.badge-closed { background: var(--danger-soft); color: var(--danger); }

label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=number], input[type=datetime-local], textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }

.entry-row { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 12px 4px; margin: 0 0 12px; min-width: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid .span-2 { grid-column: span 2; }
@media (min-width: 720px) {
  .grid { grid-template-columns: 2fr 1fr 1fr 90px 120px; }
  .grid .span-2:first-child { grid-column: span 1; }
  .grid .span-2:last-child { grid-column: 1 / -1; }
}
.row-foot { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; }
.row-total { color: var(--muted); font-size: .9rem; }
.row-total strong { color: var(--text); }
.form-total, .grand-total { text-align: right; font-size: 1.05rem; margin: 12px 0; }
.form-total strong, .grand-total strong { font-size: 1.4rem; color: var(--primary); margin-left: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: .95rem; font-weight: 700; font-family: inherit; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-block { width: 100%; margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions form { margin: 0; }

.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.flash ul { margin: 0; padding-left: 1.2em; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { font-size: .75rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tfoot th { border-bottom: 0; font-size: .95rem; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.done td { color: var(--muted); }
.table tr.done td:not(:first-child):not(:last-child) { text-decoration: line-through; }
.note { font-size: .78rem; color: var(--muted); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }

.check {
  width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line);
  background: var(--card); color: #fff; font-weight: 700; cursor: pointer; padding: 0;
}
.check.on { background: var(--ok); border-color: var(--ok); }

.url-box { margin: 12px 0; }
.url-box label { font-weight: 400; margin-bottom: 4px; }
.url-box-admin label { color: var(--muted); font-size: .8rem; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { margin: 0; flex: 1; min-width: 0; font-size: .85rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stats div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stats span { display: block; font-size: .75rem; color: var(--muted); }
.stats strong { font-size: 1.2rem; }

.tabs { display: flex; gap: 4px; margin: 0 0 12px; overflow-x: auto; }
.tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.tabs a.active { background: var(--primary); color: #fff; }

.person-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.person-head h2 { margin: 0; }
.person-total strong { font-size: 1.25rem; color: var(--primary); margin-left: 6px; }

.recent-list { list-style: none; padding: 0; margin: 0; }
.recent-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent-list li:last-child { border-bottom: 0; }
.how ol { padding-left: 1.3em; margin: 0; }
.danger-zone summary { color: var(--danger); }
.danger-zone form { display: flex; gap: 8px; }
.danger-zone input { margin: 0; }
[hidden] { display: none !important; }
.table { min-width: 560px; }
.badge-mine { background: var(--primary-soft); color: var(--primary); font-size: .7rem; padding: 1px 8px; }
.person-head-sub { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.person-head-sub h3 { margin: 0; }
.item-summary { margin-top: 18px; }
.item-summary summary { cursor: pointer; margin-bottom: 8px; }
label.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.checkbox input { width: 18px; height: 18px; margin: 0; }
.edit-url-box { background: var(--primary-soft); border-radius: 12px; padding: 12px; margin-top: 16px; }
.edit-url-box p { margin: 8px 0 0; }
input[type=url] {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text);
}
.event-url { margin: 8px 0; word-break: break-all; font-size: .9rem; }
.footer-links { display: flex; gap: 6px 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: .85rem; }
.footer-links a:hover { color: var(--primary); text-decoration: underline; }
.site-footer p { margin: 0; }
.consent-note { font-size: .8rem; color: var(--muted); margin: 8px 0; }
label.checkbox.consent { align-items: flex-start; font-size: .85rem; margin-top: 4px; }
label.checkbox.consent input { margin-top: 3px; flex: none; }
.doc h1 { font-size: 1.4rem; }
.doc h2 { font-size: 1.05rem; margin: 1.6rem 0 .5rem; padding-left: 10px; border-left: 4px solid var(--primary); }
.doc p, .doc li { font-size: .95rem; }
.doc ol, .doc ul { padding-left: 1.4em; }
.doc li { margin-bottom: .35rem; }
.doc .lead { background: var(--primary-soft); border-radius: 10px; padding: 12px 14px; }
.doc .dates { text-align: right; color: var(--muted); font-size: .85rem; margin-top: 2rem; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table th, .info-table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .95rem; }
.info-table th { width: 32%; color: var(--muted); font-weight: 600; white-space: nowrap; }
.info-table td { word-break: break-all; }
.aff-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.aff-links .pr { font-size: .65rem; border: 1px solid var(--muted); color: var(--muted); border-radius: 4px; padding: 0 4px; line-height: 1.5; }
.aff { font-size: .72rem; text-decoration: none; padding: 1px 8px; border-radius: 999px; white-space: nowrap; font-weight: 700; }
.aff-amazon { background: #fff4e0; color: #b35c00; }
.aff-rakuten { background: #ffe9e9; color: #bf0000; }
@media (prefers-color-scheme: dark) {
  .aff-amazon { background: #3a2a10; color: #ffb547; }
  .aff-rakuten { background: #3a1616; color: #ff7a7a; }
}
.aff-disclosure { font-size: .72rem; max-width: 640px; margin: 0 auto 8px !important; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.user-nav { display: flex; gap: 14px; align-items: center; font-size: .85rem; }
.user-nav form { margin: 0; }
.user-nav a { text-decoration: none; font-weight: 700; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linklike:hover { color: var(--primary); text-decoration: underline; }
.btn-google { background: var(--card); color: var(--text) !important; border-color: var(--line); }
.btn-google::before { content: "G"; font-weight: 800; color: #4285f4; margin-right: 4px; }
.btn-google:hover { background: var(--primary-soft); }
.login-box { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
.login-box p { margin: 0 0 8px; }
.login-box p:last-child { margin: 0; }
.login-note { font-size: .85rem; background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.session-list { list-style: none; padding: 0; margin: 0 0 12px; }
.session-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.session-list-main { min-width: 0; }
.session-title { font-weight: 700; margin-right: 6px; }
.report-link { text-align: right; font-size: .8rem; margin: 0 4px 8px; }
.report-link a { color: var(--muted); }
.radio-group { border: 0; padding: 0; margin: 0 0 12px; }
.radio-group legend { font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.radio-group label.checkbox { margin-bottom: 6px; font-size: .9rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.flag { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 1px 6px; margin: 1px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.stats strong.alert { color: var(--danger); }
.table tr.flagged td { background: var(--danger-soft); }
.search-row { display: flex; gap: 8px; }
.search-row input { margin: 0; }
.ng-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ng-list span { font-size: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li form { display: inline-block; margin-top: 6px; }
.console .row-actions form { display: inline-block; margin: 2px 0; }
input[type=password] { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
/* ---- 広告エリア ---- */
.layout { display: block; }
.ad-label { display: inline-block; font-size: .65rem; font-weight: 700; color: var(--muted); border: 1px solid var(--muted); border-radius: 4px; padding: 0 4px; line-height: 1.5; vertical-align: middle; }
.ad-body { overflow: hidden; }
.ad-body img, .ad-body iframe { max-width: 100%; height: auto; }
.ad-side { display: none; }
@media (min-width: 1320px) {
  .layout { display: grid; grid-template-columns: 180px minmax(0, 960px) 180px; grid-template-areas: "left main right"; justify-content: center; column-gap: 16px; }
  .layout > main.container { grid-area: main; margin: 0; width: 100%; }
  .ad-side { display: block; position: sticky; top: 16px; align-self: start; margin-top: 16px; text-align: center; }
  .ad-left { grid-area: left; }
  .ad-right { grid-area: right; }
  .ad-side .ad-label { margin-bottom: 6px; }
}
.ad-bottom { max-width: 960px; margin: 0 auto 8px; padding: 12px 16px 0; text-align: center; }
.ad-bottom .ad-label { margin-bottom: 6px; }
.related-box h2 { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.related-list { list-style: none; padding: 0; margin: 0 0 8px; }
.related-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.related-list li:last-child { border-bottom: 0; }
.related-name { font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.aff-links { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.related-group { padding: 10px 0 14px; border-bottom: 1px solid var(--line); }
.related-group:last-of-type { border-bottom: 0; }
.related-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.related-kw { font-weight: 700; font-size: .95rem; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.product { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--card); min-width: 0; }
.product:hover { border-color: var(--primary); }
.product img, .product .noimg { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; border-radius: 6px; }
.product .noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .75rem; background: var(--bg); }
.product-name { font-size: .78rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-weight: 700; color: var(--primary); font-size: .9rem; }
.product-shop { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rakuten-credit { font-size: .7rem; color: var(--muted); text-align: right; margin: 4px 0 0; }
.rakuten-credit a { color: var(--muted); }
.tbd { color: var(--muted); font-size: .85em; }
.tbd-note { display: inline-block; margin-left: 4px; font-size: .7rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stats .tbd-note { display: block; margin: 0; }

/* =====================================================================
   モダンレイヤー（テーマは assets/themes/*.css で下の変数を上書き）
   ===================================================================== */
:root {
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, -apple-system, sans-serif;
  --font-heading: var(--font);
  --radius: 18px;
  --radius-sm: 12px;
  --btn-radius: 999px;
  --shadow: 0 1px 2px rgba(60, 20, 40, .04), 0 8px 28px rgba(60, 20, 40, .07);
  --shadow-hover: 0 2px 4px rgba(60, 20, 40, .06), 0 12px 32px rgba(60, 20, 40, .12);
  --card-border: 1px solid rgba(0, 0, 0, .04);
  --header-bg: rgba(255, 255, 255, .78);
  --input-bg: var(--card);
  --focus-ring: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
  --btn-bg: var(--primary);
  --btn-bg-hover: var(--primary-dark);
  --btn-text: #fff;
  --hero-gradient: linear-gradient(120deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #7c3aed));
  --page-bg: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .45);
    --card-border: 1px solid rgba(255, 255, 255, .06);
    --header-bg: rgba(24, 20, 27, .78);
  }
}

body { font-family: var(--font); background: var(--page-bg); background-attachment: fixed; letter-spacing: .01em; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand { font-family: var(--font-heading); letter-spacing: .02em; }
h1 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.65rem); }

/* ヘッダー：スクロールしても上部に固定、すりガラス */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.brand { font-size: 1.05rem; font-weight: 800; }

/* ヒーロー */
.hero { padding: clamp(16px, 4vw, 40px) 4px clamp(8px, 2vw, 20px); }
.hero h1 { font-size: clamp(1.6rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.25; background: var(--hero-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: clamp(.95rem, .9rem + .3vw, 1.05rem); max-width: 40em; }

/* カード */
.card { border: var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 3vw, 24px); margin-bottom: 18px; }
.description, .login-note, .login-box, .stats div, .edit-url-box { border-radius: var(--radius-sm); }
.stats div { border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.stats strong { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); }

/* 入力 */
input[type=text], input[type=number], input[type=datetime-local], input[type=url], input[type=password], textarea {
  background: var(--input-bg); border-radius: var(--radius-sm); padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.entry-row { border-radius: var(--radius-sm); background: color-mix(in srgb, var(--bg) 55%, transparent); border-style: solid; }

/* ボタン */
.btn { border-radius: var(--btn-radius); padding: 11px 20px; transition: transform .12s, box-shadow .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn-primary:hover { background: var(--btn-bg-hover); box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 36%, transparent); }
.btn-sm { padding: 6px 12px; }
.btn-block { padding: 14px 20px; font-size: 1rem; }
.tabs { gap: 6px; padding: 4px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs a { padding: 8px 16px; }

/* 商品カード */
.product { border-radius: var(--radius-sm); transition: transform .15s, box-shadow .15s; }
.product:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

/* フォーカスが見えるように（キーボード操作） */
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* 動きを減らす設定の人には動きを止める */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- スマホ：表をカード型に組み替え（assets/app.js が data-label を付与） ---- */
@media (max-width: 640px) {
  .container { padding: 12px; }
  .table.stack { min-width: 0; }
  .table.stack thead { display: none; }
  .table.stack tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 12px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
  .table.stack tbody td { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border: 0; padding: 3px 0; text-align: left; }
  .table.stack tbody td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 600; white-space: nowrap; }
  .table.stack tbody td[data-label=""]::before, .table.stack tbody td:not([data-label])::before { content: none; }
  .table.stack tbody td.stack-title { grid-column: 1 / -1; display: block; font-weight: 700; font-size: .95rem; padding-bottom: 6px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
  .table.stack tbody td.stack-title::before { content: none; }
  .table.stack tbody td.row-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 8px; }
  .table.stack tbody td.row-actions::before { content: none; }
  .table.stack tbody tr.done td { text-decoration: none !important; }
  .table.stack tbody tr.done { opacity: .6; }
  .table.stack tfoot tr { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 8px 4px 0; }
  .table.stack tfoot th { padding: 0; }
  .table.stack tfoot th:empty { display: none; }
  .table-wrap { overflow: visible; margin: 0; }
  .tabs { width: 100%; }
  .tabs a { flex: 1; text-align: center; padding: 8px 10px; }
  .actions .btn { flex: 1 1 auto; }
  .copy-row { flex-wrap: wrap; }
  .copy-row input { flex-basis: 100%; }
  .copy-row .btn { width: 100%; }
}

/* ---- 似た商品まとめ（items.php） ---- */
.items-link { margin: 0 0 12px; }
.items-link .btn { width: 100%; }
@media (min-width: 641px) { .items-link .btn { width: auto; } }
.btn.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.group-card { scroll-margin-top: 70px; }
.group-card.is-done { opacity: .65; }
.group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.group-title { min-width: 0; }
.group-title h2 { margin: 0 0 6px; font-size: 1.15rem; overflow-wrap: anywhere; }
.group-total { text-align: right; flex: none; min-width: 120px; }
.group-total strong { font-size: 2.2rem; line-height: 1; color: var(--primary); font-variant-numeric: tabular-nums; }
.group-total > span { margin-left: 2px; font-weight: 700; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.spellings, .variant-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.spellings span { font-size: .75rem; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); border-radius: 999px; padding: 1px 10px; }
.variant-chips span { font-size: .8rem; background: var(--primary-soft); color: var(--text); border-radius: 8px; padding: 3px 10px; }
.variant-chips b { color: var(--primary); }
.badge-manual { background: var(--primary-soft); color: var(--primary); font-size: .65rem; }
.group-tools { margin-top: 10px; font-size: .85rem; }
.group-tools summary { cursor: pointer; color: var(--muted); }
.group-tools-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.group-tools-row input { margin: 0; flex: 1 1 220px; }
.regroup-bar {
  position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 8px -4px 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--header-bg, var(--card)); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -6px 24px rgba(0,0,0,.08);
  visibility: hidden; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s, visibility .2s;
}
.regroup-bar.is-active { visibility: visible; opacity: 1; transform: none; }
.regroup-bar select, .regroup-bar input { flex: 1 1 180px; margin: 0; padding: 9px 12px; font-size: 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg, var(--card)); color: var(--text); }
.regroup-count { font-size: .85rem; white-space: nowrap; }
@media (max-width: 640px) {
  .group-table.stack tbody td:nth-child(1) { grid-column: 1 / -1; justify-content: flex-end; order: -1; padding: 0; }
  .group-table.stack tbody td:nth-child(1)::before { content: "まとめ直す"; }
  .group-table.stack tbody td:nth-child(3) { grid-column: 1 / -1; }
  .group-head { flex-direction: column; gap: 4px; }
  .group-total { text-align: left; width: 100%; }
}
@media print {
  .site-header, .site-footer, .no-print, .ad, .layout > aside { display: none !important; }
  body { background: #fff !important; color: #000; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .group-total strong { color: #000; }
  .table.stack thead { display: table-header-group !important; }
}

/* ---- 入力項目の設定 ---- */
.ff-settings { margin: 8px 0 12px; }
.ff-grid { display: grid; gap: 8px; }
@media (min-width: 720px) { .ff-grid { grid-template-columns: 1fr 1fr; } }
.ff-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.ff-item.is-disabled { opacity: .5; }
.ff-label { display: flex; flex-direction: column; min-width: 0; flex: 1 1 160px; }
.ff-label strong { font-size: .9rem; }
.ff-label .small { font-size: .72rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.seg label { margin: 0; font-weight: 600; font-size: .78rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.seg input:checked + span { background: var(--primary); color: var(--btn-text, #fff); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.switch { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-size: .85rem; }
.ff-create { margin: 4px 0 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.ff-create summary { cursor: pointer; font-size: .9rem; font-weight: 600; }
.input-prefix { display: flex; align-items: stretch; margin-top: 4px; }
.input-prefix > span { display: flex; align-items: center; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 700; }
.input-prefix input { margin: 0 !important; border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }
.sns { font-size: .8em; font-weight: 600; color: var(--primary); }
/* 入力欄の並び（項目数が変わっても崩れないように） */
@media (min-width: 720px) {
  .entry-row .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .entry-row .grid .f-item { grid-column: span 2; }
  .entry-row .grid .f-note { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .tabs { overflow: hidden; }
  .tabs a { white-space: normal; line-height: 1.3; font-size: .8rem; padding: 8px 6px; min-width: 0; display: flex; align-items: center; justify-content: center; }
}
.items-link .btn, .btn-block { white-space: normal; text-align: center; line-height: 1.35; }
/* ---- SNSの種類 ---- */
.sns-field { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.sns-field legend { font-size: .9rem; font-weight: 600; margin-bottom: 6px; padding: 0; }
.sns-seg { margin-bottom: 6px; }
.sns-seg span { padding: 7px 16px; font-size: .85rem; }
.sns-field .input-prefix { margin-top: 0; }
a.sns { text-decoration: none; }
a.sns:hover { text-decoration: underline; }
.sns-type { display: inline-block; font-size: .7em; font-weight: 700; border-radius: 4px; padding: 0 5px; margin-right: 4px; vertical-align: 1px; color: #fff; background: #111; }
.sns-ig { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); }
.sns-th { background: #333; }
@media (prefers-color-scheme: dark) { .sns-x, .sns-th { background: #555; } }
/* ---- トップのイラスト ---- */
.hero-illust { margin: 0 -8px 8px; }
.hero-illust svg { display: block; width: 100%; height: auto; max-height: 360px; }
@media (max-width: 640px) { .hero-illust { margin: -4px -12px 4px; } }

/* ---- 広告枠用の商品カード（ads/*.html で使用） ---- */
.pr-cards { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pr-card { display: flex; align-items: center; gap: 14px; max-width: 520px; width: 100%; padding: 14px 16px; text-align: left; text-decoration: none; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm, 12px); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.pr-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover, var(--shadow)); }
.pr-card-icon { flex: none; width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: linear-gradient(135deg, #ffe7c2, #ffd08a); }
.pr-card-body { min-width: 0; flex: 1; }
.pr-card-title { display: block; font-weight: 700; font-size: .95rem; line-height: 1.4; }
.pr-card-desc { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.pr-card-btn { flex: none; font-size: .78rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: #ff9900; color: #111; white-space: nowrap; }
@media (max-width: 480px) { .pr-card { flex-wrap: wrap; } .pr-card-body { flex: 1 1 160px; } .pr-card-btn { margin-left: 66px; } }
.field-help { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); margin-top: 2px; line-height: 1.5; }
