:root {
  --bg: #f4effb;          /* 薄紫ベース */
  --surface: #ffffff;
  --surface-2: #f2ecfb;   /* ラベンダーの薄いグレー */
  --text: #2e2742;        /* 深い紫みのチャコール（上品） */
  --muted: #7d7595;
  --border: #e8e0f4;      /* 淡い紫の境界線 */
  --accent: #7c5cc4;      /* 上品な紫 */
  --accent-2: #674aae;
  --accent-soft: #efe8fb;
  --ok: #2f9e6b;
  --ok-soft: #e6f6ee;
  --err: #d2537e;         /* 紫寄りのローズ（エラーも上品に） */
  --err-soft: #fbeaf1;
  --money: #b8791b;
  --money-soft: #fcf3e3;
  --shadow: 0 1px 2px rgba(70,50,110,.05), 0 10px 28px rgba(70,50,110,.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 900px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo { font-size: 18px; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav-link:hover { color: var(--text); }
.nav-email { color: var(--muted); font-size: 13px; }

.plan-badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.plan-ad_free { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.plan-custom  { background: #eafaf1; color: var(--ok); border-color: transparent; }

/* ---------- Layout ---------- */
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 120px; }

.hero { padding: 4px 4px 10px; }
.hero h1 { font-size: 28px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.02em; }
.hero .lead { color: var(--muted); margin: 0; max-width: 640px; }
@media (max-width: 480px) { .hero h1 { font-size: 25px; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-narrow { max-width: 420px; margin-left: auto; margin-right: auto; margin-top: 32px; }
.card.center { text-align: center; }

h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 14px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 15px;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { background: var(--surface-2); color: var(--muted); }
/* チェックボックス・ラジオは幅100%/枠/余白の対象外（＝通常の小さな四角に戻す） */
input[type=checkbox], input[type=radio] {
  width: auto; padding: 0; margin: 0; border: none; border-radius: 0;
  background: none; box-shadow: none; accent-color: var(--accent); cursor: pointer;
  flex: 0 0 auto;
}
input[type=checkbox]:focus, input[type=radio]:focus { box-shadow: none; }

.alias-row {
  display: flex; align-items: stretch; border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: var(--surface);
}
.alias-prefix {
  display: flex; align-items: center; padding: 0 12px; color: var(--muted);
  font-size: 13px; background: var(--surface-2); white-space: nowrap;
}
.alias-row input { border: none; border-radius: 0; }
.alias-row input:focus { box-shadow: none; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.hint a { color: var(--accent); }
.domain-list { margin-top: 8px; font-size: 13px; }
.domain-list summary { cursor: pointer; color: var(--accent); font-weight: 700; width: fit-content; }
.domain-list ul { margin: 8px 0 4px; padding-left: 18px; }
.domain-list li { padding: 2px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; margin-top: 18px; width: 100%; padding: 12px;
  border: none; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { background: var(--surface-2); color: var(--muted); cursor: default; }
.btn-sm { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; border-radius: 9px; }
.btn-ghost { background: var(--surface); color: var(--accent); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-white { width: auto; margin: 0; padding: 9px 16px; background: #fff; color: var(--accent); }
.btn-white:hover { background: #f1ecfb; }

/* ---------- Tags ---------- */
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-lock { background: var(--surface-2); color: var(--muted); }
.tag-money { background: var(--money-soft); color: var(--money); }
.tag-progress { background: var(--accent-soft); color: var(--accent); }

/* ---------- Link cards ---------- */
.cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 620px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.linkcard {
  border: 1px solid var(--border); border-radius: 13px; padding: 14px; background: var(--surface);
  min-width: 0; /* グリッド内で中身の長いURL等に押し広げられないように */
}
.linkcard-img { margin: -14px -14px 12px; border-radius: 12px 12px 0 0; overflow: hidden; background: var(--surface-2); }
.linkcard-img img { display: block; width: 100%; height: 150px; object-fit: cover; }
.file-input { font-size: 14px; padding: 9px 11px; }
.file-input::file-selector-button {
  margin-right: 10px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font-size: 13px; cursor: pointer;
}
.file-input::file-selector-button:hover { background: var(--accent-soft); color: var(--accent); }
.image-preview { margin-top: 12px; }
.image-preview-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.image-preview-card { max-width: 280px; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.image-preview-card img { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--surface-2); }
.linkcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.linkcard-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkcard-url { display: flex; align-items: center; gap: 8px; }
a.short { color: var(--accent); text-decoration: none; font-weight: 700; font-size: 14px; word-break: break-all; }
a.short:hover { text-decoration: underline; }
.copy { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px; font-size: 12px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.copy:hover { color: var(--text); }
.linkcard-dest { color: var(--muted); font-size: 12px; margin: 6px 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkcard-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 10px; }
.clicks { font-size: 13px; color: var(--muted); font-weight: 600; }
.stats-link { font-size: 13px; color: var(--accent); text-decoration: none; }
.empty { color: var(--muted); }

/* ---------- 作成完了パネル ---------- */
.created {
  border: 1px solid #bfe8d1; background: var(--ok-soft);
  border-radius: 14px; padding: 16px 16px 14px; margin: 0 0 18px;
  box-shadow: var(--shadow);
}
.created-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.created-check {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ok); color: #fff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.created-lead { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.created-lead strong { font-size: 16px; color: #0f6b41; }
.created-lead span { font-size: 13px; color: var(--muted); }
.created-row { display: flex; gap: 8px; align-items: stretch; }
.created-url {
  flex: 1 1 auto; min-width: 0; padding: 12px 14px; font-size: 16px; font-weight: 700;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
}
.created-copy { flex: 0 0 auto; width: auto; margin-top: 0; white-space: nowrap; padding-left: 24px; padding-right: 24px; }
.created-copy.is-copied { background: var(--accent-2); }
.created-actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; }
.created-open { font-size: 14px; font-weight: 700; color: var(--accent); text-decoration: none; }
.created-open:hover { text-decoration: underline; }
.created-more { font-size: 14px; color: var(--muted); text-decoration: none; }
.created-more:hover { color: var(--text); }
@media (max-width: 480px) {
  .created-row { flex-direction: column; }
  .created-copy { width: 100%; padding-top: 12px; padding-bottom: 12px; }
}

/* ---------- 履歴タブ ---------- */
.htabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.htab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.htab:hover { color: var(--text); }
.htab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.htab-n {
  font-size: 12px; font-weight: 700; line-height: 1;
  padding: 2px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.htab.is-active .htab-n { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- 履歴の種類フィルタ（すべて/リンクカード/短縮リンク/オリジナルページ） ---------- */
.hist-filter { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; flex-wrap: wrap; }
.hist-filter label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0; }
.hist-select {
  flex: 1 1 200px; min-width: 0; max-width: 320px; width: auto;
  padding: 10px 38px 10px 14px; font-size: 15px; font-weight: 700; font-family: inherit;
  color: var(--text); background-color: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c5cc4' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.hist-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hist-group + .hist-group { margin-top: 22px; }
.hist-gtitle { font-size: 15px; margin: 0 0 10px; }
.hist-newpage { margin-top: 12px; }

/* リンクカードの編集・削除 */
.lc-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.lc-edit { flex: 0 0 auto; }
.lc-edit > summary { list-style: none; cursor: pointer; }
.lc-edit > summary::-webkit-details-marker { display: none; }
.lc-del { background: var(--err); border-color: var(--err); color: #fff; }
.lc-form { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.lc-form label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 0 0; }
.lc-form input[type=text] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
.lc-form input[type=file] { font-size: 13px; }
.lc-check { display: flex !important; align-items: center; gap: 7px; font-size: 13px !important; color: var(--text) !important; font-weight: 500 !important; margin-top: 8px !important; }
.lc-check input { flex: 0 0 auto; }
.lc-form .btn { margin-top: 10px; }

/* ---------- クリック推移グラフ ---------- */
.chart-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  background: var(--surface); box-shadow: var(--shadow); margin-bottom: 18px;
}
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h2 { margin: 0; font-size: 16px; }
.chart-tabs { margin: 0; }
.chart-tabs .htab { padding: 6px 12px; font-size: 13px; }
.chart-total { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 170px; }
.chart-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart-barwrap { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.chart-bar {
  position: relative; width: 72%; max-width: 26px; min-width: 4px;
  background: var(--accent); border-radius: 4px 4px 0 0;
}
.chart-bar:hover { background: var(--accent-2, #2f49d6); }
.chart-bar.is-zero { background: transparent; }
.chart-val {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--muted); line-height: 1; margin-bottom: 3px; white-space: nowrap;
}
.chart-lab { font-size: 10px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; }
.chart-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 24px 0; }

/* ---------- 決済ページ / 契約 ---------- */
.page-back { margin: 0 0 12px; }
.checkout-card { max-width: 480px; margin-left: auto; margin-right: auto; }
.checkout-summary { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); margin-bottom: 18px; }
.checkout-plan { font-weight: 700; font-size: 15px; }
.checkout-price { font-size: 26px; font-weight: 800; color: var(--accent); margin-top: 2px; }
.checkout-price span { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.sq-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); min-height: 44px; margin-bottom: 10px; }
.checkout-error { background: var(--err-soft); border: 1px solid #f4c7c7; color: #a12626; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
.checkout-note { margin-top: 10px; }
.pc-from { font-size: 13px; color: var(--muted); }
.pc-arrow { font-size: 20px; font-weight: 800; color: var(--muted); margin: 4px 0; }
.sub-box { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 16px; }
.sub-box h2 { font-size: 16px; margin: 0 0 10px; }
.sub-box form { margin-top: 12px; }
.sub-box .btn { width: auto; margin-top: 0; }

/* ---------- Flashes ---------- */
.flashes { margin-bottom: 16px; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; word-break: break-all; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); border-color: #bfe8d1; color: #0f6b41; }
.flash-error { background: var(--err-soft); border-color: #f4c7c7; color: #a12626; }

/* ---------- Stats ---------- */
.stat-grid { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 22px; text-align: center; min-width: 120px; }
.stat-num { font-size: 30px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); }
dl.detail { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; font-size: 14px; }
dl.detail dt { color: var(--muted); }
dl.detail dd { margin: 0; word-break: break-all; }
.back { text-decoration: none; }
.switch { text-align: center; color: var(--muted); font-size: 14px; margin-top: 16px; }

/* ---------- Pricing ---------- */
.pricing { margin: 26px 0 8px; }
.pricing-head { text-align: center; margin-bottom: 22px; }
.pricing-head h2 { font-size: 22px; margin: 0 0 6px; }
.pricing-head p { font-size: 14px; color: var(--muted); margin: 0; }
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: stretch; }
@media (max-width: 860px) { .plans { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .plans { grid-template-columns: 1fr; } }
.plan {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 16px; padding: 22px 18px 20px;
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.plan:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(20,28,50,.12); }
.plan-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 12px 32px rgba(124,92,196,.20);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 76px);
}
.plan-current { border-color: var(--ok); }
.plan-ribbon {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  padding: 4px 14px; border-radius: 999px; letter-spacing: .05em; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(124,92,196,.45);
}
.plan-now {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 800;
  color: var(--ok); background: var(--ok-soft); padding: 2px 9px; border-radius: 999px;
}
.plan-name { font-weight: 800; font-size: 16px; margin-top: 2px; }
.plan-tagline { font-size: 12px; color: var(--muted); margin-top: 3px; }
.plan-price { display: flex; align-items: baseline; gap: 1px; margin: 16px 0 2px; flex-wrap: wrap; }
.plan-price .cur { font-size: 17px; font-weight: 800; }
.plan-price .num { font-size: 32px; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.plan-price .per { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 5px; }
.plan-feats { list-style: none; padding: 0; margin: 16px 0 18px; font-size: 13px; color: var(--text); flex: 1; }
.plan-feats li { padding: 5px 0 5px 22px; position: relative; line-height: 1.55; }
.plan-feats li::before { content: "✓"; position: absolute; left: 0; top: 4px; color: var(--ok); font-weight: 900; }
.plan-feats strong { font-weight: 700; }
.plan-btn {
  display: block; width: 100%; padding: 12px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 800; cursor: pointer; text-align: center; font-family: inherit;
  transition: background .15s ease, color .15s ease;
}
.plan-btn.is-primary { background: var(--accent); color: #fff; }
.plan-btn.is-primary:hover { background: var(--accent-2); }
.plan-btn.is-ghost { background: var(--surface); color: var(--accent); border-color: var(--accent); }
.plan-btn.is-ghost:hover { background: var(--accent-soft); }
.plan-btn.is-current { background: var(--ok-soft); color: var(--ok); cursor: default; }
.pricing-foot { text-align: center; font-size: 12px; color: var(--muted); margin: 22px 0 0; }
.demo-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; text-align: center; }

/* ---------- Bottom bar ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--text);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 22px rgba(70,50,110,.08);
}
.bottombar-inner {
  max-width: 900px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bottombar-text { font-size: 14px; font-weight: 600; color: var(--text); }
.bottombar .btn-white { background: var(--accent); color: #fff; white-space: nowrap; flex-shrink: 0; }
.bottombar .btn-white:hover { background: var(--accent-2); }
@media (max-width: 480px) {
  .bottombar-inner { padding: 10px 14px; gap: 10px; }
  .bottombar-text { font-size: 12.5px; line-height: 1.35; }
  .bottombar .btn-white { padding: 9px 14px; font-size: 14px; }
}

/* ---------- Interstitial ---------- */
.interstitial-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.interstitial { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 28px; max-width: 440px; width: 100%; text-align: center; }
.inter-kicker { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.sponsor { display: block; text-decoration: none; border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--surface-2); margin-bottom: 18px; text-align: left; }
.sponsor:hover { border-color: var(--accent); }
.sponsor-badge { display: inline-block; font-size: 11px; font-weight: 800; color: var(--money); background: var(--money-soft); padding: 2px 8px; border-radius: 999px; }
.sponsor-title { display: block; font-weight: 800; color: var(--text); margin: 8px 0 2px; font-size: 16px; }
.sponsor-url { display: block; color: var(--muted); font-size: 12px; word-break: break-all; }
.sponsor-cta { display: inline-block; margin-top: 8px; color: var(--accent); font-weight: 800; font-size: 14px; }
.btn-continue { background: var(--surface-2); color: var(--muted); }
.btn-continue.ready { background: var(--accent); color: #fff; }
.inter-count { color: var(--text); font-size: 14px; font-weight: 700; margin: 4px 0 10px; }
.inter-count #count { color: var(--accent); }
.inter-skip { display: inline-block; color: var(--muted); font-size: 13px; text-decoration: none; }
.inter-skip:hover { color: var(--text); text-decoration: underline; }
.inter-note { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* ---------- Hamburger ---------- */
.hamburger {
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding: 0;
}
.hamburger span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: .2s; }
.hamburger:hover { background: var(--surface-2); }
.drawer-open .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.drawer-open .hamburger span:nth-child(2) { opacity: 0; }
.drawer-open .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Drawer (right slide-in) ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(20,28,50,.38);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 300px; max-width: 84vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -12px 0 30px rgba(20,28,50,.12);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  z-index: 50; display: flex; flex-direction: column;
}
.drawer-open .drawer-overlay { opacity: 1; visibility: visible; }
.drawer-open .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-title { font-weight: 800; }
.drawer-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer-close:hover { color: var(--text); }
.drawer-nav { padding: 8px; overflow-y: auto; }
.drawer-nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600;
}
.drawer-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.drawer-nav .di { width: 22px; text-align: center; font-size: 16px; }
.drawer-sep { height: 1px; background: var(--border); margin: 8px 6px; }

/* ---------- Stats bar ---------- */
.statsbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 480px) { .statsbar { gap: 8px; } }
.statbox {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.statbox-num { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1.2; }
.statbox-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Simple content pages ---------- */
.notice { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.notice-date { font-size: 12px; color: var(--muted); }
.notice-title { font-weight: 700; margin: 2px 0 4px; }
.notice-body { font-size: 14px; color: var(--muted); }
.doc h3 { font-size: 15px; margin: 18px 0 6px; }
.doc p, .doc li { color: var(--muted); font-size: 14px; line-height: 1.7; }
.doc ul { margin: 6px 0 10px; padding-left: 20px; }
.doc li { padding: 2px 0; }
.doc strong { color: var(--text); font-weight: 700; }
.doc-lead { color: var(--text) !important; }
.doc-date { color: var(--muted); font-size: 13px; margin-top: 18px; }
.doc-note { background: var(--money-soft); color: var(--money); border: 1px solid #f0dcb0; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 0 0 16px; }
.doc .law { grid-template-columns: 170px 1fr; gap: 12px 16px; font-size: 14px; }
.doc .law dt { font-weight: 700; color: var(--text); }
.doc .law dd { color: var(--muted); }
.doc .law .ph { color: var(--err); font-weight: 700; }
@media (max-width: 520px) { .doc .law { grid-template-columns: 1fr; gap: 2px 0; } .doc .law dt { margin-top: 14px; } }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.history-table th { color: var(--muted); font-size: 12px; }
.nav-hide-sm { }
@media (max-width: 420px) { .nav-hide-sm { display: none; } }

/* ---------- Original page editor ---------- */
.page-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.page-url-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.linkadd { margin-bottom: 14px; }
.linkadd-row { display: flex; gap: 8px; align-items: stretch; }
.linkadd-row input { flex: 1; }
.linkadd-row input:first-child { max-width: 220px; }
.linkadd-row .btn-sm { white-space: nowrap; align-self: center; }
@media (max-width: 560px) { .linkadd-row { flex-direction: column; } .linkadd-row input:first-child { max-width: none; } }
.pl-list { display: flex; flex-direction: column; gap: 10px; }
.pl-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); }
.pl-edit { display: flex; gap: 8px; align-items: center; }
.pl-edit input { flex: 1; }
.pl-edit input:first-child { max-width: 200px; }
.pl-edit .btn-sm { white-space: nowrap; }
@media (max-width: 560px) { .pl-edit { flex-direction: column; align-items: stretch; } .pl-edit input:first-child { max-width: none; } }
.pl-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.pl-actions { display: flex; gap: 6px; }
.pl-actions form { margin: 0; }
.pl-btn { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; }
.pl-btn:hover { background: var(--surface-2); color: var(--text); }
.pl-del:hover { background: var(--err-soft); color: var(--err); border-color: #f4c7c7; }

/* ---------- オリジナルページ編集（ビルダー・すっきり版） ---------- */
.pe-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pe-title h1 { margin: 0; }
.pe-url { display: flex; align-items: center; gap: 8px; margin-top: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.pe-url .short { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* アイコン・背景の行 */
.pe-avatar { display: flex; gap: 14px; align-items: center; margin: 4px 0 6px; }
.pe-av-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); flex: 0 0 auto; }
.pe-bg-img { width: 96px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); flex: 0 0 auto; }
.pe-av-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.pe-av-ctrl { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pe-av-opts { display: flex; gap: 16px; flex-wrap: wrap; }
.pe-check { font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.pe-color { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pe-color input[type=color] { width: 48px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }

/* デザイン（折りたたみ） */
.pe-more { margin: 14px 0 4px; border-top: 1px dashed var(--border); padding-top: 10px; }
.pe-more > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); list-style: none; }
.pe-more > summary::before { content: "▸ "; }
.pe-more[open] > summary::before { content: "▾ "; }

/* コンテンツ追加バー */
.pe-addbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pe-add { flex: 1 1 auto; }
.pe-add-btn { list-style: none; cursor: pointer; text-align: center; display: block;
  padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--accent); background: var(--surface); white-space: nowrap; }
.pe-add-btn::-webkit-details-marker { display: none; }
.pe-add[open] .pe-add-btn { background: var(--accent-soft); border-style: solid; }
.pe-add > form { margin-top: 10px; }
.pe-add > form .btn-sm { margin-top: 10px; }

/* ブロック一覧（すっきり） */
.pe-list { display: flex; flex-direction: column; gap: 8px; }
.pe-block { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.pe-block-row { display: flex; align-items: center; gap: 10px; }
.pe-ico { font-size: 16px; flex: 0 0 auto; }
.pe-mini { width: 40px; height: 28px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.pe-sum { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text); }
.pe-edit { margin-top: 8px; }
.pe-edit > summary { cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 700; }
.pe-edit > form { margin-top: 10px; }

/* 写真を選ぶ（ワンタップでピッカー） */
.pe-photo { display: block; text-align: center; cursor: pointer; padding: 20px; border: 2px dashed var(--accent); border-radius: 12px; color: var(--accent); font-weight: 800; font-size: 15px; background: var(--accent-soft); }
.pe-photo:hover { filter: brightness(0.98); }
/* 追加済み画像をカード表示 */
.pe-imgs { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.pe-imgcard { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.pe-imgcard-pic { display: block; width: 100%; max-height: 200px; object-fit: cover; background: var(--surface-2); }
.pe-imgcard-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.pe-imgcard-body .pe-edit { margin: 0; }
.pe-imgcard-body .pl-actions { justify-content: flex-end; }
.pe-add-solo { margin-bottom: 14px; }
.pe-finish { margin-top: 18px; }

/* 履歴のオリジナルページ一覧 */
.op-list { display: flex; flex-direction: column; gap: 10px; }
.op-hist { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.op-thumb { width: 72px; height: 44px; object-fit: cover; object-position: center 38%; border-radius: 8px; flex: 0 0 auto; }
.op-hist-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 220px; }
.op-hist-body .short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-hist-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.op-hist-act .btn-sm, .op-hist-act .copy { margin: 0; }
.op-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; }
.op-stat { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 3px 10px; }
.op-stat strong { color: var(--text); font-size: 13px; }
.op-stat-ico { font-size: 12px; }

/* ---------- Logout buttons (POST forms styled as links) ---------- */
.inline-form { display: inline; margin: 0; }
.linklike {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  color: var(--muted); font-size: 14px; font-family: inherit;
}
.linklike:hover { color: var(--text); }
.drawer-form { margin: 0; }
.drawer-form button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border: none; border-radius: 10px; background: none;
  color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600;
  font-family: inherit; cursor: pointer; text-align: left;
}
.drawer-form button:hover { background: var(--accent-soft); color: var(--accent); }
.drawer-form .di { width: 22px; text-align: center; font-size: 16px; }

/* ============================================================
   運営 管理画面
   ============================================================ */
.adm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.adm-title { font-size: 20px; margin: 0; }
.adm-exit { font-size: 13px; color: var(--accent-2); text-decoration: none; font-weight: 700; }
.adm-exit:hover { text-decoration: underline; }

.adm-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.adm-tab {
  display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.adm-tab:hover { color: var(--text); }
.adm-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.adm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.adm-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.adm-kpi-accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.adm-kpi-accent .adm-kpi-num, .adm-kpi-accent .adm-kpi-lab, .adm-kpi-accent .adm-kpi-sub { color: #fff; }
.adm-kpi-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.adm-kpi-lab { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 700; }
.adm-kpi-sub { font-weight: 500; opacity: .85; }

.adm-plandist { display: flex; flex-wrap: wrap; gap: 10px; }
.adm-plan { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; background: var(--surface-2); }
.adm-plan-name { font-weight: 700; }
.adm-plan-count { color: var(--accent-2); font-weight: 800; }
.adm-plan-price { font-size: 12px; color: var(--muted); }

.adm-count { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; }

.adm-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 460px; }
.adm-table th, .adm-table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.adm-table th { font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.adm-table td { color: var(--text); }
.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-r { text-align: right !important; white-space: nowrap; }
.adm-dim { color: var(--muted); }
.adm-ell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.adm-cell-main { min-width: 180px; }
.adm-ell .adm-dim { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.adm-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.adm-badge-pro { background: var(--accent); color: #fff; }
.adm-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 700; }
.adm-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.adm-dot-ok { background: var(--ok); }

.adm-status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.adm-status-active { background: rgba(47,158,107,.14); color: var(--ok); }
.adm-status-canceled, .adm-status-deactivated { background: rgba(210,83,126,.14); color: var(--err); }
.adm-status-pending { background: var(--accent-soft); color: var(--accent-2); }

.adm-search { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-search-input {
  flex: 1 1 220px; min-width: 0; padding: 10px 13px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
.adm-search .btn { margin: 0; flex: 0 0 auto; }

.adm-plan-select {
  padding: 6px 26px 6px 10px; font-size: 13px; font-family: inherit; font-weight: 700;
  color: var(--text); background-color: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='%237c5cc4' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.adm-plan-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
