/* ==========================================================================
   LINEでええやんボード デザインシステム v2 — "未来の和モダン"
   ブランド: 深緑 #0e5c31 × 金 #c9a227 × LINEグリーン #06c755
   方針: ガラス質のレイヤー・金のヘアライン・ドットグリッドの奥行き。
         紫系ホログラム（AIクリシェ）は使わない。動きは軽く、触って楽しく。
   ========================================================================== */

:root {
  --green: #0e5c31;
  --green-2: #12924c;
  --green-3: #29b866;
  --green-soft: rgba(18, 146, 76, .10);
  --gold: #c9a227;
  --gold-2: #e6c65a;
  --gold-soft: rgba(201, 162, 39, .12);
  --line-green: #06c755;

  --bg: #eef2ec;
  --card: rgba(255, 255, 255, .92);
  --card-solid: #ffffff;
  --glass: rgba(255, 255, 255, .68);
  --text: #16211a;
  --text-2: #61705f;
  --text-3: #7a8a7c; /* 補助テキスト。旧#94a394はコントラスト不足（WCAG未達）のため濃く */
  --border: rgba(20, 60, 35, .10);
  --hairline: linear-gradient(90deg, transparent, rgba(18,146,76,.4), rgba(201,162,39,.5), transparent);
  --overlay: rgba(12, 24, 16, .48);
  --dot: rgba(14, 92, 49, .07);

  --red: #c7452e;
  --danger: #c7452e; /* バッジ・破壊系ボタン用の別名 */
  --blue: #1f6feb;
  --gold-text: #9a7b1c; /* 明背景で読めるゴールド（期限「今日」等のテキスト用） */

  --st-inbox: #8a94a6;
  --st-todo: #5b7c99;
  --st-doing: #c9a227;
  --st-done: #12924c;

  --shadow-1: 0 1px 2px rgba(16, 42, 25, .05), 0 3px 10px rgba(16, 42, 25, .06);
  --shadow-2: 0 4px 12px rgba(16, 42, 25, .10), 0 14px 40px rgba(16, 42, 25, .14);
  --glow-green: 0 0 18px rgba(18, 146, 76, .35);
  --glow-gold: 0 0 14px rgba(201, 162, 39, .45);

  --radius: 18px;
  --radius-s: 14px;
  --nav-h: 76px;   /* フローティングドック(60px)＋浮かせ分 */
  --appbar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --spring: cubic-bezier(.32, 1.25, .38, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a100b;
    --card: rgba(24, 34, 27, .92);
    --card-solid: #18221b;
    --glass: rgba(20, 30, 23, .62);
    --text: #e9efe9;
    --text-2: #9fb1a1;
    --text-3: #8a9a8e; /* ライト側と同程度のコントラストへ（旧#66766a） */
    --gold-text: #e0c25a; /* 暗背景で読めるゴールド */
    --border: rgba(140, 200, 160, .12);
    --overlay: rgba(0, 0, 0, .62);
    --dot: rgba(110, 180, 140, .07);
    --green-soft: rgba(18, 146, 76, .18);
    --gold-soft: rgba(201, 162, 39, .16);
    --st-inbox: #7d8798;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 3px 12px rgba(0, 0, 0, .3);
    --shadow-2: 0 6px 16px rgba(0, 0, 0, .45), 0 18px 48px rgba(0, 0, 0, .5);
  }
}

/* ---------- リセット・ベース ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  overscroll-behavior-y: none;
  position: relative;
}

/* 奥行きレイヤー: グラデーションメッシュ＋ドットグリッド */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(58% 42% at 12% -6%, rgba(18, 146, 76, .13), transparent 62%),
    radial-gradient(46% 36% at 108% 10%, rgba(201, 162, 39, .14), transparent 60%),
    radial-gradient(70% 50% at 50% 115%, rgba(14, 92, 49, .09), transparent 55%),
    radial-gradient(circle, var(--dot) 1px, transparent 1.3px);
  background-size: auto, auto, auto, 23px 23px;
}
@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(60% 44% at 10% -8%, rgba(18, 146, 76, .28), transparent 62%),
      radial-gradient(48% 38% at 110% 8%, rgba(201, 162, 39, .16), transparent 60%),
      radial-gradient(70% 50% at 50% 118%, rgba(18, 146, 76, .12), transparent 55%),
      radial-gradient(circle, var(--dot) 1px, transparent 1.3px);
    background-size: auto, auto, auto, 23px 23px;
  }
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--green-2); text-decoration: none; }
img { max-width: 100%; }

/* グラデーション文字（大きな数字・見出しの強調） */
.grad-num {
  background: linear-gradient(118deg, var(--green-3), var(--green-2) 40%, var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- アプリバー ---------- */

.appbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--appbar-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 8px;
  padding-left: 16px; padding-right: 8px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.appbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--hairline); opacity: .5;
}
.appbar__title {
  font-size: 19px; font-weight: 800; letter-spacing: .02em;
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
}
.appbar__title .accent {
  width: 4px; height: 19px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--gold-2), var(--gold), var(--green-2));
  background-size: 100% 220%;
  animation: accentFlow 5s ease-in-out infinite alternate;
  box-shadow: var(--glow-gold);
}
@keyframes accentFlow { from { background-position: 0 0; } to { background-position: 0 100%; } }
.appbar__btn {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; color: var(--text-2); flex: none;
  transition: transform .12s;
}
.appbar__btn:active { transform: scale(.9); background: var(--green-soft); }
.appbar__btn svg { width: 23px; height: 23px; }
.appbar__btn[disabled] { opacity: .5; pointer-events: none; }

/* ドロワー専用ページの ← 戻る（GB.mountが自動表示・46pxヒット領域） */
.appbar__btn--back { width: 46px; height: 46px; margin-left: -10px; color: var(--text); }

/* appbar 右の ↻ 更新ボタン（GB.mount({refresh})・46pxヒット領域・実行中はスピン） */
.appbar__btn--refresh { width: 46px; height: 46px; }
.appbar__btn--refresh.is-loading svg { animation: spin .8s linear infinite; color: var(--green-2); }

/* ヘッダ直下の一言サブタイトル（そのタブの役割＝入口/保管庫 を明示） */
.appbar-sub {
  font-size: 12px; line-height: 1.5; color: var(--text-2);
  padding: 7px 16px 8px;
  background: color-mix(in srgb, var(--green-soft) 55%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--text-2) 16%, transparent);
}
.appbar-sub b { color: var(--text); font-weight: 800; letter-spacing: .01em; }

/* スクラップ詳細「📁 資料に保管」＝ストックへの昇格ボタン（目立たせる） */
.sd-promote {
  background: color-mix(in srgb, var(--gold) 15%, var(--card));
  border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent);
  color: var(--text); font-weight: 800;
}
.sd-promote:active { transform: scale(.98); }

/* ---------- 下部ナビ = フローティングドック ---------- */

.tabbar {
  position: fixed; left: 14px; right: 14px;
  bottom: calc(var(--safe-b) + 12px);
  z-index: 50;
  height: 62px;
  display: flex;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  gap: 4px;
  touch-action: none; /* バー上のスワイプで背後ページをスクロールさせない（タップ遷移は有効） */
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: 10px; font-weight: 700;
  border-radius: 17px;
  transition: color .18s, background .18s, transform .18s var(--spring);
  position: relative;
}
.tabbar__item svg { width: 23px; height: 23px; }
/* ラベルは常に1行。長い名前（家計簿・経理 等）でも折り返さず省略し、固定高ドックを崩さない */
.tabbar__lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar__item:active { transform: scale(.92); }
.tabbar__item.is-active {
  color: var(--green-2);
  background: linear-gradient(160deg, var(--green-soft), var(--gold-soft));
}
.tabbar__item.is-active::after {
  content: ''; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold); box-shadow: var(--glow-gold);
}
/* 右端「その他」タブ＝ページではないので選択ドットは出さない */
.tabbar__item--more { color: var(--text-3); }

/* ---------- 件数バッジ（GB.setBadge・tabbar/ドロワー共通） ---------- */

.navbadge {
  position: absolute;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
  pointer-events: none; z-index: 2;
}
/* 下部ドック: アイコンの右上に重ねる */
.tabbar__item .navbadge { top: 2px; left: 50%; margin-left: 8px; }
/* ドロワー行: 右端（>アイコンの左）に置く */
.drawer__item { position: relative; }
.drawer__item .navbadge { top: 50%; transform: translateY(-50%); right: 44px; }

/* 全ページ一覧（「その他」タップ／どのタブもダブルタップで開く） */
.moregrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 2px 0 6px; }
.morecell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 16px 8px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-1);
  color: var(--text); text-align: center; -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; transition: transform .12s;
}
.morecell:active { transform: scale(.95); }
.morecell.is-active { outline: 2px solid var(--green); background: linear-gradient(160deg, var(--green-soft), var(--gold-soft)); }
.morecell__ic { display: grid; place-items: center; }
.morecell svg { width: 25px; height: 25px; }
.morecell__nm { font-size: 12px; font-weight: 700; line-height: 1.3; word-break: break-word; }
/* 「その他」対象ページが無いとき（全ページを下のバーに配置済み） */
.morenone { text-align: center; font-size: 12.5px; color: var(--text-3); padding: 14px 8px 4px; }
/* 「その他」内の外部リンク（Googleカレンダー／スプレッドシート／Drive） */
.morelinks { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.morelink {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 10px;
  border: 0; background: transparent; border-radius: 12px; color: var(--text); text-align: left;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.morelink:active { background: var(--green-soft); }
.morelink > svg { flex: none; width: 20px; height: 20px; color: var(--green-2); }
.morelink__tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.morelink__tx b { font-size: 13.5px; font-weight: 700; }
.morelink__tx em { font-size: 11px; color: var(--text-3); font-style: normal; }
.morelink > svg:last-child { width: 16px; height: 16px; color: var(--text-3); }

/* ---------- ドロワー ---------- */

.drawer-overlay {
  position: fixed; inset: 0; z-index: 90; background: var(--overlay);
  opacity: 0; pointer-events: none; transition: opacity .22s;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 10px; right: 10px; bottom: calc(var(--safe-b) + 10px); z-index: 91;
  width: min(78vw, 300px);
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 24px;
  transform: translateX(110%); transition: transform .3s var(--spring);
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 14px) 0 16px;
  box-shadow: var(--shadow-2);
}
.drawer.is-open { transform: translateX(0); }
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer__brand { padding: 6px 22px 15px; margin-bottom: 8px; position: relative; }
.drawer__brand::after { content: ''; position: absolute; left: 18px; right: 18px; bottom: 0; height: 1px; background: var(--hairline); }
.drawer__brand b { font-size: 17px; }
.drawer__brand span { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.drawer__item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; font-size: 15px; font-weight: 600; color: var(--text);
  width: 100%; text-align: left; border-radius: 14px; margin: 0 6px; width: calc(100% - 12px);
  transition: background .15s;
}
.drawer__item:active { background: var(--green-soft); }
.drawer__item svg { width: 21px; height: 21px; color: var(--green-2); flex: none; }
.drawer__item .sub { font-size: 11px; color: var(--text-3); font-weight: 400; display: block; }
.drawer__list { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.drawer__foot { margin-top: auto; padding: 14px 22px 0; font-size: 11px; color: var(--text-3); }

/* ドロワー内「下のバーを編集」＝操作項目として目立たせる */
.drawer__item--edit { background: var(--green-soft); color: var(--green-2); font-weight: 800; }
.drawer__item--edit .sub { color: var(--green-2); opacity: .72; font-weight: 600; }

/* 「下のバーを編集」ピッカー（トグルスイッチ式・分かりやすい版） */
.fp2-lead { font-size: 13px; color: var(--text-2); line-height: 1.85; margin: 2px 0 16px; }
.fp2-lead b { color: var(--text); font-weight: 800; }
.fp2-on { color: var(--green-2); font-weight: 800; }
.fp2-off { color: var(--text-3); font-weight: 800; }
.fp2-prevlabel { font-size: 11px; font-weight: 800; color: var(--text-3); margin: 0 0 6px; }
.fp2-preview { display: flex; gap: 4px; justify-content: space-around; align-items: center; background: var(--card); border: 1.5px solid var(--border); border-radius: 16px; padding: 9px 6px; min-height: 54px; }
.fp2-prevcell { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; min-width: 0; font-size: 10px; font-weight: 700; color: var(--green-2); }
.fp2-prevcell svg { width: 21px; height: 21px; }
.fp2-prevcell span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp2-prevempty { font-size: 12px; color: var(--text-3); }
.fp2-count { font-size: 12px; font-weight: 700; color: var(--text-2); margin: 12px 2px 6px; }
.fp2-count b { color: var(--green-2); font-size: 14px; }
.fp2-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 4px; border: none; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.fp2-ic { flex: none; display: grid; place-items: center; }
.fp2-ic svg { width: 22px; height: 22px; color: var(--text-3); }
.fp2-row.is-on .fp2-ic svg { color: var(--green-2); }
.fp2-txt { flex: 1; min-width: 0; }
.fp2-txt b { display: block; font-size: 14.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp2-txt em { display: block; font-size: 11px; font-style: normal; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp2-place { flex: none; font-size: 10.5px; font-weight: 800; color: var(--text-3); width: 62px; text-align: right; }
.fp2-row.is-on .fp2-place { color: var(--green-2); }
.fp2-sw { flex: none; position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--border); transition: background .2s; }
.fp2-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform .2s; }
.fp2-row.is-on .fp2-sw { background: var(--green-2); }
.fp2-row.is-on .fp2-sw::after { transform: translateX(18px); }
.fp2-reset { width: 100%; background: none; border: none; color: var(--text-3); font-size: 12.5px; padding: 6px; text-decoration: underline; cursor: pointer; }

/* 下のバーの「束（グループ）」＝上スワイプ/⌃タップで開く */
.tabbar__more { position: absolute; top: 1px; left: 0; right: 0; display: flex; justify-content: center; color: var(--green-2); opacity: .75; pointer-events: auto; }
.tabbar__more svg { width: 13px; height: 13px; stroke-width: 2.4; }
.slotpop-overlay { position: fixed; inset: 0; z-index: 82; opacity: 0; pointer-events: none; transition: opacity .2s; }
.slotpop-overlay.is-open { opacity: 1; pointer-events: auto; }
.slotpop { position: fixed; z-index: 83; background: var(--card-solid); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-2); padding: 6px; min-width: 156px; max-width: 240px; opacity: 0; transform: translateY(8px) scale(.96); transition: opacity .18s, transform .18s var(--spring); }
.slotpop.is-open { opacity: 1; transform: translateY(0) scale(1); }
.slotpop__item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 12px; color: var(--text); font-size: 14px; font-weight: 700; }
.slotpop__item svg { width: 20px; height: 20px; color: var(--green-2); flex: none; }
.slotpop__item:active { background: var(--green-soft); }
.slotpop__item.is-active { background: var(--green-soft); color: var(--green-2); }

/* 「下のバーを編集」＝枠に束ねるエディタ（.fpg-*） */
.fpg-lead { font-size: 13px; color: var(--text-2); line-height: 1.85; margin: 2px 0 14px; }
.fpg-lead b { color: var(--text); font-weight: 800; }
.fpg-chev { display: inline-block; color: var(--green-2); font-weight: 900; }
.fpg-badge2 { color: var(--green-2); font-weight: 800; }
.fpg-prevlabel { font-size: 11px; font-weight: 800; color: var(--text-3); margin: 0 0 6px; }
.fpg-prevmore { display: inline-flex; color: var(--green-2); }
.fpg-prevmore svg { width: 12px; height: 12px; stroke-width: 2.4; }
.fpg-slot { border: 1.5px solid var(--border); border-radius: 15px; padding: 10px 11px; margin: 10px 0; }
.fpg-slot__hd { font-size: 11.5px; font-weight: 800; color: var(--text-3); margin-bottom: 9px; }
.fpg-slot__hd em { font-style: normal; color: var(--green-2); font-weight: 700; }
.fpg-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fpg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px 7px 10px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.fpg-chip svg { width: 17px; height: 17px; color: var(--text-3); }
.fpg-chip.is-primary { border-color: var(--green-2); background: var(--green-soft); color: var(--green-2); }
.fpg-chip.is-primary svg { color: var(--green-2); }
.fpg-badge { font-size: 9.5px; font-weight: 800; background: var(--green-2); color: #fff; border-radius: 6px; padding: 1px 5px; }
.fpg-x { display: inline-flex; margin-left: 1px; color: var(--text-3); }
.fpg-x svg { width: 14px; height: 14px; }
.fpg-chip.is-primary .fpg-x { color: var(--green-2); }
.fpg-add { display: inline-flex; align-items: center; gap: 3px; padding: 7px 11px; border-radius: 12px; background: none; border: 1.5px dashed var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.fpg-add svg { width: 15px; height: 15px; }
.fpg-addslot { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; margin: 4px 0 2px; padding: 12px; border-radius: 14px; background: var(--green-soft); border: 1.5px dashed var(--green-2); color: var(--green-2); font-size: 13.5px; font-weight: 800; cursor: pointer; }
.fpg-addslot svg { width: 17px; height: 17px; }
.fpg-pool { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.fpg-pool__hd { font-size: 11.5px; font-weight: 800; color: var(--text-3); margin-bottom: 9px; }
.fpg-poolchip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 11px; background: var(--card); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-3); }
.fpg-poolchip svg { width: 15px; height: 15px; color: var(--text-3); }
.fpg-poolnone { font-size: 12px; color: var(--text-3); }
.fpg-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 4px; border: none; border-bottom: 1px solid var(--border); background: none; text-align: left; cursor: pointer; }
.fpg-pick > svg { width: 22px; height: 22px; color: var(--green-2); flex: none; }
.fpg-pick__tx { flex: 1; min-width: 0; }
.fpg-pick__tx b { display: block; font-size: 14.5px; font-weight: 700; color: var(--text); }
.fpg-pick__tx em { display: block; font-size: 11px; font-style: normal; color: var(--text-3); }

/* ---------- カード・チップ ---------- */

.card {
  background: var(--card); border-radius: var(--radius-s);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1); padding: 12px 14px;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  transition: transform .12s;
}
.chip:active { transform: scale(.94); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.pill svg { width: 13px; height: 13px; }
.pill.is-over { color: var(--red); font-weight: 700; }
.pill.is-today { color: var(--gold-text); font-weight: 700; }

.pri { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pri--高 { background: var(--red); box-shadow: 0 0 6px rgba(199, 69, 46, .5); }
.pri--中 { background: var(--gold); }
.pri--低 { background: var(--text-3); }

/* ---------- ボタン ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 20px; border-radius: 14px;
  font-size: 15px; font-weight: 700;
  transition: transform .14s var(--spring), box-shadow .2s, opacity .15s;
}
.btn:active { transform: scale(.96); }
.btn--primary {
  background: linear-gradient(135deg, var(--green-3), var(--green-2) 45%, var(--green));
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 92, 49, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn--line { background: var(--line-green); color: #fff; box-shadow: 0 6px 16px rgba(6, 199, 85, .3); }
.btn--ghost { background: var(--green-soft); color: var(--green-2); border: 1px solid rgba(18, 146, 76, .18); }
.btn--danger { background: transparent; color: var(--red); }
/* 破壊操作の実行ボタン（GB.confirmSheet danger:true 等）＝塗りつぶし赤 */
.btn--danger-solid {
  background: linear-gradient(135deg, #d95c45, var(--danger) 55%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(199, 69, 46, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 45;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-3), var(--green-2) 45%, var(--green));
  color: #fff;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, .5), 0 10px 26px rgba(14, 92, 49, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
  display: grid; place-items: center;
  transition: transform .18s var(--spring), box-shadow .2s;
}
.fab:active { transform: scale(.88) rotate(90deg); box-shadow: 0 0 0 5px rgba(201, 162, 39, .35), var(--glow-green); }
.fab svg { width: 26px; height: 26px; transition: transform .18s; }

/* ---------- フォーム ---------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; letter-spacing: .02em; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-s);
  background: var(--card-solid); font-size: 16px; /* 16px以上でiOSズーム防止 */
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(18, 146, 76, .14);
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }

.seg { display: flex; background: rgba(20, 60, 35, .06); border-radius: var(--radius-s); padding: 3px; gap: 3px; }
@media (prefers-color-scheme: dark) { .seg { background: rgba(0, 0, 0, .3); } }
.seg__btn {
  flex: 1; min-height: 40px; border-radius: 11px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all .18s var(--spring);
}
.seg__btn.is-on { background: var(--card-solid); color: var(--text); box-shadow: var(--shadow-1); transform: scale(1.02); }
.seg__dot { width: 8px; height: 8px; border-radius: 50%; }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chiprow .chip { min-height: 34px; padding: 0 13px; font-size: 12.5px; border: 1.5px solid transparent; }
.chiprow .chip:not(.is-on) { background: rgba(20, 60, 35, .06) !important; color: var(--text-2) !important; }
@media (prefers-color-scheme: dark) { .chiprow .chip:not(.is-on) { background: rgba(255, 255, 255, .07) !important; } }
.chiprow .chip.is-on { box-shadow: 0 0 0 1.5px currentColor inset; }
.chiprow .chip--new { border: 1.5px dashed var(--border) !important; background: transparent !important; color: var(--text-3) !important; }

/* 新規追加のインライン入力行（タグ・案件 共通） */
.tagnew { display: flex; gap: 8px; margin-top: 8px; }
.tagnew .input { min-height: 42px; flex: 1; }
.tagnew .btn { min-height: 42px; padding: 0 16px; flex: none; }

/* ---------- ボトムシート ---------- */

.no-scroll { overflow: hidden; }

/* ハブ切替セグメント（スクラップ⇔資料を1つの資料庫として往復） */
.hubseg { padding: 8px 16px 4px; }
.hubseg .seg { display: flex; gap: 4px; }
.hubseg .seg__btn { flex: 1; min-height: 40px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* クイックオープン（全画面・資料/スクラップを名前で開く） */
.qopen {
  position: fixed; inset: 0; z-index: 95; background: var(--overlay);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: calc(var(--safe-t) + 44px) 12px 12px;
}
.qopen__panel {
  width: 100%; max-width: 560px; max-height: 100%; display: flex; flex-direction: column;
  background: var(--card-solid); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-2); overflow: hidden;
}
.qopen__bar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--border); }
.qopen__ic { color: var(--text-3); display: inline-flex; }
.qopen__ic svg { width: 20px; height: 20px; }
.qopen__in { flex: 1; border: 0; background: transparent; font-size: 16px; color: var(--text-1); outline: none; padding: 6px 0; }
.qopen__x { color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.qopen__x svg { width: 20px; height: 20px; }
.qopen__list { overflow-y: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.qopen__hint { padding: 24px 14px; text-align: center; color: var(--text-3); font-size: 13px; }
.qopen__row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 12px; background: transparent; min-height: 52px;
}
.qopen__row.is-sel, .qopen__row:active { background: var(--green-soft); }
.qopen__emoji { font-size: 20px; flex: 0 0 auto; width: 26px; text-align: center; }
.qopen__meta { display: flex; flex-direction: column; min-width: 0; }
.qopen__t { font-size: 14px; font-weight: 700; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qopen__s { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet-overlay {
  position: fixed; inset: 0; z-index: 80; background: var(--overlay);
  opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet-overlay.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  background: var(--card-solid);
  border-radius: 26px 26px 0 0;
  border-top: 1px solid var(--border);
  transform: translateY(105%); transition: transform .34s var(--spring);
  max-height: 88vh; display: flex; flex-direction: column;
  padding-bottom: calc(var(--safe-b) + 12px);
  box-shadow: var(--shadow-2);
}
.sheet::before {
  content: ''; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: var(--hairline); opacity: .6;
}
.sheet.is-open { transform: translateY(0); }
.sheet__grip { width: 42px; height: 4px; border-radius: 2px; background: var(--border); margin: 10px auto 4px; flex: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 10px; flex: none; }
.sheet__title { font-size: 17px; font-weight: 800; }
.sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 20px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet__foot { flex: none; padding: 12px 20px 0; display: flex; gap: 10px; border-top: 1px solid var(--border); }

/* ---------- 確認ダイアログ（GB.confirmSheet・GB.sheetの見た目に揃える） ---------- */

.confirm-sheet__text { font-size: 14px; color: var(--text-2); line-height: 1.75; margin: 2px 0 6px; white-space: pre-wrap; word-break: break-word; }
.confirm-sheet__btns { width: 100%; display: flex; gap: 10px; }
.confirm-sheet__btns .btn { flex: 1; }

/* ---------- トースト ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 99;
  transform: translate(-50%, 20px) scale(.95); opacity: 0;
  background: linear-gradient(135deg, #133d24, #0e2b1a);
  color: #ecf3ec;
  border: 1px solid rgba(201, 162, 39, .4);
  font-size: 13.5px; font-weight: 600;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow-2), var(--glow-green);
  transition: transform .28s var(--spring), opacity .2s;
  max-width: 86vw; text-align: center;
  pointer-events: none;
}
.toast.is-show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* ---------- スケルトン・空状態 ---------- */

.skel { border-radius: var(--radius-s); background: linear-gradient(100deg, var(--border) 40%, color-mix(in srgb, var(--border) 40%, var(--card-solid)) 50%, var(--border) 60%); background-size: 200% 100%; animation: skel 1.3s infinite linear; }
@keyframes skel { from { background-position: 120% 0; } to { background-position: -80% 0; } }

.empty { text-align: center; padding: 44px 24px; color: var(--text-3); }
.empty svg { width: 56px; height: 56px; margin-bottom: 10px; color: var(--border); }
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 3px; }
.empty span { font-size: 12.5px; }

/* ---------- 起動画面 ---------- */

.boot {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 32px; text-align: center;
}
.boot__logo {
  width: 158px;
  display: grid; place-items: center;
  position: relative;
  animation: bootFloat 3s ease-in-out infinite alternate;
}
.boot__logo img {
  width: 100%; height: auto;
  filter: drop-shadow(0 6px 14px rgba(16, 42, 25, .18));
  animation: bootPulse 2.2s ease-in-out infinite;
}
/* ロゴの背後で金×緑の光がゆっくり呼吸する */
.boot__logo::before {
  content: ''; position: absolute; inset: -22% ;
  border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(201,162,39,.34), rgba(18,146,76,.14) 45%, transparent 70%);
  animation: bootGlow 2.2s ease-in-out infinite;
}
/* ロード開始時にロゴがふわっと現れる */
.boot__logo { animation: bootFloat 3s ease-in-out infinite alternate, bootLogoIn .7s var(--spring) both; }
@media (prefers-color-scheme: dark) {
  .boot__logo img { filter: drop-shadow(0 0 16px rgba(255, 255, 255, .3)); }
}
@keyframes bootFloat { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes bootPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes bootGlow { 0%,100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes bootLogoIn { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }
.boot__name { font-size: 21px; font-weight: 800; letter-spacing: .06em; }
.boot__sub { font-size: 13px; color: var(--text-2); font-weight: 600; }
.boot .spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s infinite linear; }
@keyframes spin { to { transform: rotate(360deg); } }
/* boot をフェードアウトで閉じる（reduced-motion時のフォールバック） */
.boot.is-hiding { animation: bootOut .5s ease forwards; }
@keyframes bootOut { to { opacity: 0; transform: scale(1.04); visibility: hidden; } }

/* ガラス割れトランジション（スプラッシュ→アプリ）: JS(GB.shatter)が破片を生成 */
.shatter { position: fixed; inset: 0; z-index: 101; pointer-events: none; overflow: hidden; }
.shatter .shard {
  position: fixed; will-change: transform, opacity; backface-visibility: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18); /* 破片の厚み感 */
}
.shatter-flash {
  position: fixed; width: 44vmin; height: 44vmin; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 68%);
  pointer-events: none; mix-blend-mode: screen;
}

/* ロード完了後のページオープン演出（今日ページの各ウィジェットが下から立ち上がる） */
@keyframes revealUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.reveal > * { animation: revealUp .5s var(--spring) both; }
.reveal > *:nth-child(1) { animation-delay: .02s; }
.reveal > *:nth-child(2) { animation-delay: .08s; }
.reveal > *:nth-child(3) { animation-delay: .14s; }
.reveal > *:nth-child(4) { animation-delay: .20s; }
.reveal > *:nth-child(5) { animation-delay: .26s; }
.reveal > *:nth-child(6) { animation-delay: .32s; }
.reveal > *:nth-child(7) { animation-delay: .38s; }
.reveal > *:nth-child(n+8) { animation-delay: .42s; }

/* ---------- タスクカード ---------- */

.task {
  background: var(--card); border-radius: var(--radius-s);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  padding: 11px 13px 10px;
  display: flex; gap: 11px; align-items: flex-start;
  position: relative;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: transform .15s var(--spring), box-shadow .15s, opacity .2s;
  animation: cardIn .32s var(--spring) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.tasklist .task:nth-child(2), .col__list .task:nth-child(2) { animation-delay: .04s; }
.tasklist .task:nth-child(3), .col__list .task:nth-child(3) { animation-delay: .08s; }
.tasklist .task:nth-child(4), .col__list .task:nth-child(4) { animation-delay: .12s; }
.tasklist .task:nth-child(5), .col__list .task:nth-child(5) { animation-delay: .16s; }
.tasklist .task:nth-child(n+6), .col__list .task:nth-child(n+6) { animation-delay: .2s; }

.task__check {
  width: 27px; height: 27px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 2px solid var(--border);
  display: grid; place-items: center; color: transparent;
  transition: all .2s var(--spring);
  background: var(--card-solid);
}
.task__check svg { width: 15px; height: 15px; }
.task__check:active { transform: scale(.85); border-color: var(--green-2); }
.task__check.is-done {
  background: linear-gradient(135deg, var(--green-3), var(--st-done));
  border-color: var(--st-done); color: #fff;
  box-shadow: var(--glow-green);
}
.task__main { flex: 1; min-width: 0; }
.task__title { font-size: 14.5px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.task.is-done-style .task__title { color: var(--text-3); text-decoration: line-through; }
.task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.task.is-dragging { opacity: .3; }

.ghost {
  position: fixed; z-index: 95; pointer-events: none;
  transform: rotate(2.5deg) scale(1.05);
  box-shadow: var(--shadow-2), var(--glow-green);
  opacity: .96;
  animation: none;
}

@keyframes donePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1); }
}
.task__check.anim { animation: donePop .4s var(--spring); }
@keyframes taskOut {
  to { opacity: 0; transform: translateX(30px) scale(.96); height: 0; margin: 0; padding-top: 0; padding-bottom: 0; }
}
.task.anim-out { animation: taskOut .4s ease .3s forwards; overflow: hidden; }

/* 完了パーティクル */
.spark {
  position: fixed; z-index: 130; pointer-events: none;
  width: 7px; height: 7px; border-radius: 2px;
}

/* ---------- ユーティリティ ---------- */

.container { padding: 4px 16px 16px; max-width: 640px; margin: 0 auto; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.muted { color: var(--text-2); font-size: 12.5px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 800; color: var(--text-2);
  margin: 22px 0 10px; letter-spacing: .03em;
}
.section-title .count {
  background: linear-gradient(135deg, var(--green-soft), var(--gold-soft));
  color: var(--green-2);
  border-radius: 999px; font-size: 11px; padding: 1px 9px;
  border: 1px solid rgba(18, 146, 76, .15);
}
.hidden { display: none !important; }

/* タップ領域トークン: 標準46px / 小40px。要素自体を大きくするユーティリティ */
.tt-46 { min-width: 46px; min-height: 46px; }
.tt-40 { min-width: 40px; min-height: 40px; }
/* 見た目は小さいまま、ヒット領域だけ44px四方に広げるパターン
   （親要素で overflow:hidden されていると効かない点に注意） */
.hit-44 { position: relative; }
.hit-44::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: max(100%, 44px); height: max(100%, 44px);
  transform: translate(-50%, -50%);
}

/* ---------- チェックリスト（サブタスク） ---------- */

.sublist { display: flex; flex-direction: column; gap: 6px; }
.sublist:not(:empty) { margin-bottom: 8px; }
.subitem {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 8px 10px;
}
.subitem__check {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  border: 2px solid var(--border); background: var(--card);
  display: grid; place-items: center; color: transparent;
  transition: background .15s, border-color .15s;
}
.subitem__check svg { width: 13px; height: 13px; }
.subitem.is-done .subitem__check {
  background: linear-gradient(135deg, var(--green-3), var(--st-done));
  border-color: var(--st-done); color: #fff;
}
.subitem__text { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-word; }
.subitem.is-done .subitem__text { color: var(--text-3); text-decoration: line-through; }
.subitem__del { color: var(--text-3); flex: none; padding: 4px; }
.subitem__del svg { width: 14px; height: 14px; }

/* ---------- 空き時間サジェスト ---------- */

.slotrow { display: flex; flex-wrap: wrap; gap: 8px; }
.slotrow:not(:empty) { margin-top: 10px; }
.slotrow .chip.is-on { outline: 2px solid var(--green-2); }

/* ---------- 引っ張って更新（全ページ共通・GB.pullToRefresh） ---------- */
/* ページ最下部でさらに上へスワイプ→2秒キープ or 離すと更新。下引っ張りはLINEブラウザの縮小と競合するため上引っ張りにしている */

.ptr { height: 0; overflow: hidden; display: grid; place-items: center; transition: height .18s; }
.ptr__inner { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--green-2); }
.ptr__icon { transition: transform .2s; }
@keyframes ptrHold { from { transform: scale(1); } to { transform: scale(1.18); } }
.ptr.ready .ptr__inner { color: var(--gold); animation: ptrHold 2s ease forwards; }
.ptr.ready .ptr__icon { transform: scale(1.35); }
.ptr__spin { width: 18px; height: 18px; border: 2.5px solid var(--border); border-top-color: var(--green-2); border-radius: 50%; animation: spin .7s infinite linear; }

/* ---------- 行スワイプ（右=肯定 / 左=削除・GB.swipeRow） ---------- */

.swrap { position: relative; }
.swrap .swbg {
  position: absolute; inset: 0; border-radius: var(--radius-s);
  display: flex; align-items: center; padding: 0 18px;
  font-weight: 800; font-size: 13.5px; color: #fff; opacity: 0; transition: opacity .12s;
}
.swbg--ok { background: linear-gradient(90deg, var(--st-done), #29b866); justify-content: flex-start; }
.swbg--del { background: linear-gradient(270deg, #e05252, #c0392b); justify-content: flex-end; }
.swrap .swipe-content { position: relative; z-index: 1; }
.swipe-content.swiping { transition: none; animation: none; }

/* ==========================================================================
   PC最適化（デスクトップ）: 下部ドック → 左サイドバー・ナビ ＋ 中央寄せの本文。
   モバイル(<900px)は一切変更しない（すべて min-width で上書き）。
   ========================================================================== */
@media (min-width: 900px) {
  :root { --sidebar-w: 226px; --content-w: 900px; }

  body { padding-left: var(--sidebar-w); padding-bottom: 32px; }

  /* 下部フローティングドック → 左サイドバー */
  .tabbar {
    left: 0; right: auto; top: 0; bottom: 0;
    width: var(--sidebar-w); height: 100vh;
    flex-direction: column; justify-content: flex-start; align-items: stretch;
    gap: 4px; padding: 22px 14px calc(var(--safe-b) + 18px);
    border: none; border-right: 1px solid var(--border);
    border-radius: 0; box-shadow: none;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
    overflow-y: auto;
    touch-action: pan-y; /* サイドバー化時はタッチ縦スクロールを許可（モバイルの none を上書き） */
  }
  .tabbar::before {
    content: '🌱 LINEでええやん株式会社';
    display: block; padding: 2px 14px 18px;
    font-size: 16px; font-weight: 800; color: var(--green-2); letter-spacing: .02em;
  }
  .tabbar__item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 13px;
    min-height: 46px; padding: 0 15px; border-radius: 13px;
    font-size: 13.5px; font-weight: 700; color: var(--text-2);
  }
  .tabbar__item svg { width: 21px; height: 21px; }
  .tabbar__item.is-active { color: var(--green-2); }
  .tabbar__item.is-active::after { display: none; }
  .tabbar__item:hover:not(.is-active) { background: var(--green-soft); color: var(--text); }
  /* サイドバー(PC)では⌃ヒントを行の右端・縦中央へ（タップで束を開く） */
  .tabbar__more { top: 50%; left: auto; right: 12px; transform: translateY(-50%); justify-content: flex-end; }
  /* サイドバー(PC)では件数バッジも行の右端・縦中央へ */
  .tabbar__item .navbadge { top: 50%; left: auto; right: 34px; margin-left: 0; transform: translateY(-50%); }

  /* 本文を中央寄せ・幅を確保（全ページ共通の in-flow ブロック） */
  .container, main#main, .ptr { max-width: var(--content-w); margin-left: auto; margin-right: auto; }
  main#main:not(.container) { padding-left: 20px; padding-right: 20px; }

  /* scrap/news の全幅フィルタ帯も本文幅に揃える */
  .filters { max-width: var(--content-w); margin-left: auto; margin-right: auto; }

  /* トップバー: 全幅グラス維持のまま、中身だけ本文幅に中央寄せ */
  .appbar {
    padding-left: max(16px, calc((100% - var(--content-w)) / 2));
    padding-right: max(8px, calc((100% - var(--content-w)) / 2));
  }

  /* FAB: 本文カラムの右下に寄せる */
  .fab {
    right: max(24px, calc((100vw - var(--sidebar-w) - var(--content-w)) / 2 + 24px));
    bottom: 30px;
  }

  /* トースト: 本文エリアの中央へ */
  .toast { left: calc(50% + var(--sidebar-w) / 2); }

  /* ボトムシート → 中央モーダル（PCで見やすく・グリップ非表示） */
  .sheet {
    left: calc(50% + var(--sidebar-w) / 2); right: auto;
    width: min(560px, calc(100vw - var(--sidebar-w) - 48px));
    top: 50%; bottom: auto; max-height: 86vh;
    border-radius: 20px; border: 1px solid var(--border);
    padding-bottom: 12px;
    transform: translate(-50%, calc(-50% + 16px));
  }
  .sheet.is-open { transform: translate(-50%, -50%); }
  .sheet::before, .sheet__grip { display: none; }
}

/* ==========================================================================
   PC: コンテンツ・グリッド（ページ別）— 横幅を活かした多列レイアウトで見やすく。
   マソンリー(CSS multi-column)で高さ差を吸収し、順序も保つ。
   ========================================================================== */
@media (min-width: 900px) {
  /* --- 今日: 2列マソンリー・ダッシュボード ---
     .greet は全幅・各ウィジェットは分割禁止。並べ替え(編集モード)中だけ1列に戻す
     （D&Dが縦位置判定のため）。 */
  .page-today main#main { max-width: 968px; column-count: 2; column-gap: 20px; }
  .page-today main#main > .greet { column-span: all; margin-bottom: 6px; }
  .page-today .widget { margin: 0 0 20px; break-inside: avoid; -webkit-column-break-inside: avoid; }
  .page-today main#main.edit-mode { column-count: 1; }

  /* --- 情報: カードを2列マソンリー（日付見出しは全幅）＋やや広い本文 --- */
  .page-news main#main, .page-news .filters { max-width: 1080px; }
  .page-news .newslist { column-count: 2; column-gap: 16px; }
  .page-news .newslist .dayhead { column-span: all; }
  .page-news .newslist .news { break-inside: avoid; -webkit-column-break-inside: avoid; margin-bottom: 12px; }

  /* --- スクラップ: マソンリーを3列に・本文を広く --- */
  .page-scrap main#main, .page-scrap .filters { max-width: 1080px; }
  .page-scrap .wall { column-count: 3; }
}

/* 今日: 広い画面では3列ダッシュボード（本文幅も拡張して詰まりを防ぐ。編集モードは1列のまま） */
@media (min-width: 1200px) {
  .page-today main#main { max-width: 1240px; column-count: 3; }
}

/* ワイド画面ではさらに列を増やす */
@media (min-width: 1400px) {
  .page-news main#main, .page-news .filters,
  .page-scrap main#main, .page-scrap .filters { max-width: 1300px; }
  .page-news .newslist { column-count: 3; }
  .page-scrap .wall { column-count: 4; }
}
