/* =============================================================================
   ダッシュボード (index.php)
   モバイル優先のヒーロー型レイアウト。「公開中の記事数」を大きく見せ、
   小さなブレークダウンと CTA を続けて、その下に最近更新された記事の
   iOS 設定アプリ風リスト。デスクトップでも中央寄せの細レイアウトで統一。
   ============================================================================= */

/* このページだけ縦長レイアウトに絞る (デスクトップでも iPhone アプリ風) */
.app-main { max-width: 600px; }

/* 読み上げ専用見出し (視覚的には dash-hero__label が見出し役) */
.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- ヒーロー (大きな KPI ブロック) ---------- */
.dash-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    border-radius: 18px;
    padding: 28px 24px 24px;
    margin-bottom: 18px;
    text-align: center;
    box-shadow: 0 10px 28px rgba(45, 106, 79, .22);
}
/* 装飾の薄い円 (右上) */
.dash-hero::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 160px; height: 160px; border-radius: 50%;
    background: rgba(255, 255, 255, .08); pointer-events: none;
}
.dash-hero__greeting {
    position: relative; z-index: 1;
    font-size: 13px; font-weight: 500; opacity: .85;
    margin-bottom: 18px;
}
.dash-hero__greeting strong { font-weight: 700; opacity: 1; }

.dash-hero__metric { position: relative; z-index: 1; margin-bottom: 16px; }
.dash-hero__value {
    font-family: 'Inter', sans-serif;
    font-size: 68px; font-weight: 800; line-height: 1;
    letter-spacing: -.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.dash-hero__label {
    font-size: 13.5px; font-weight: 600; opacity: .9; margin-top: 8px;
}

/* ブレークダウン: 下書き/アーカイブ/合計 を iOS 風の薄いチップで横並び */
.dash-hero__breakdown {
    position: relative; z-index: 1;
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 6px; margin-bottom: 22px;
}
.dash-hero__breakdown > span {
    background: rgba(255, 255, 255, .15);
    backdrop-filter: blur(4px);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 500;
}
.dash-hero__breakdown b {
    font-family: 'Inter', sans-serif;
    font-weight: 700; margin-left: 4px;
}

/* CTA: 白ボタンでヒーローの中で最も目立つ */
.dash-hero__cta {
    position: relative; z-index: 1;
    background: #fff; color: var(--brand-dark);
    width: 100%; justify-content: center;
    font-size: 14px; padding: 12px; font-weight: 700;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transition: transform .12s ease, box-shadow .12s ease;
}
.dash-hero__cta:hover {
    background: var(--brand-soft); color: var(--brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}
.dash-hero__cta:active { transform: translateY(0); }

/* ---------- blog OFF プラン用 クイックアクセスタイル (ヒーロー内) ----------
   Free プラン等で blog が OFF のとき、KPI の代わりに利用可能機能への
   ショートカットを並べる。dash-hero の白いボタンと同じトーンで揃える。 */
.dash-quick {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.dash-quick__tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, .92);
    color: var(--brand-dark);
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.dash-quick__tile:hover {
    background: #fff; transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .14);
}
.dash-quick__icon { font-size: 28px; line-height: 1; }
.dash-quick__label { font-size: 12.5px; }

/* ---------- 最近の記事 リスト ---------- */
.dash-recent {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.dash-recent__head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px 10px;
}
.dash-recent__title {
    font-size: 14px; font-weight: 700; margin: 0;
}
.dash-recent__more {
    font-size: 12.5px; font-weight: 600;
    color: var(--brand-dark); text-decoration: none;
}
.dash-recent__more:hover { text-decoration: underline; }

.dash-list { display: flex; flex-direction: column; }
.dash-list__loading,
.dash-list__empty {
    text-align: center; padding: 36px 18px;
    color: var(--ink-mute); font-size: 13px; line-height: 1.7;
}
.dash-list__empty-icon { font-size: 42px; margin-bottom: 10px; }
.dash-list__empty strong { color: var(--ink); }

/* リスト行 (タップで遷移する <a>) */
.dash-list__row {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    border-top: 1px solid var(--border);
    color: var(--ink); text-decoration: none;
    transition: background .12s ease;
}
.dash-list__row:hover { background: #FAFBFC; }
.dash-list__row:active { background: #F3F4F6; }
.dash-list__main { flex: 1; min-width: 0; }
.dash-list__title {
    font-size: 13.5px; font-weight: 600; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.dash-list__meta {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 5px 10px; margin-top: 6px; font-size: 11.5px;
}
.dash-list__date { font-family: 'Inter', sans-serif; color: var(--ink-mute); }
.dash-list__slug { font-size: 10.5px; color: var(--ink-soft); }
.dash-list__chev {
    color: var(--ink-soft); font-size: 22px;
    font-weight: 300; line-height: 1; flex-shrink: 0;
}

/* ---------- スマホ (≤640px): 余白を詰める ---------- */
@media (max-width: 640px) {
    .dash-hero { padding: 24px 18px 22px; margin-bottom: 14px; border-radius: 16px; }
    .dash-hero__greeting { font-size: 12px; margin-bottom: 14px; }
    .dash-hero__value { font-size: 58px; }
    .dash-hero__label { font-size: 12.5px; }
    .dash-hero__breakdown { gap: 5px; margin-bottom: 18px; }
    .dash-hero__breakdown > span { padding: 4px 10px; font-size: 11px; }
    .dash-hero__cta { padding: 11px; font-size: 13.5px; }

    .dash-recent__head { padding: 12px 14px 8px; }
    .dash-list__row { padding: 12px 14px; }
}

/* =============================================================================
   ダッシュボード ウィジェット
   ============================================================================= */

/* ---------- ウィジェット共通 (.dash-w) ---------- */
.dash-w {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dash-w__head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px 6px; gap: 8px;
}
.dash-w__title { font-size: 14px; font-weight: 700; margin: 0; }
.dash-w__sub { font-size: 11px; color: var(--ink-mute); font-weight: 500; margin-left: 4px; }
.dash-w__more {
    font-size: 12px; font-weight: 600; color: var(--brand-dark);
    text-decoration: none; white-space: nowrap;
}
.dash-w__more:hover { text-decoration: underline; }
.dash-w__body { flex: 1; padding: 6px 18px 16px; }
.dash-w__loading,
.dash-w__empty {
    text-align: center; padding: 24px 12px;
    font-size: 12.5px; color: var(--ink-soft);
}

/* ---------- 📊 サイト訪問サマリー ---------- */
.dash-v__top { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.dash-v__num { font-family: 'Inter', sans-serif; font-size: 38px; font-weight: 800; line-height: 1; color: var(--ink); }
.dash-v__trend {
    font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
    color: var(--ink-mute); background: #F3F4F6;
}
.dash-v__trend--up   { color: #047857; background: #D1FAE5; }
.dash-v__trend--down { color: #B91C1C; background: #FEE2E2; }
.dash-v__sub { font-size: 11px; color: var(--ink-soft); margin: 2px 0 10px; }
.dash-v__spark { width: 100%; height: 30px; display: block; margin-bottom: 8px; }
.dash-v__bar { fill: var(--brand-soft); }
.dash-v__bar--last { fill: var(--brand); }
.dash-v__meta {
    font-size: 11.5px; color: var(--ink-mute);
    padding-top: 8px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.dash-v__meta b { color: var(--ink); font-weight: 700; font-family: 'Inter', sans-serif; }
.dash-v__meta .mono { font-size: 11px; padding: 1px 6px; }

/* ---------- 📋 採用ファネル ---------- */
.dash-f__row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.dash-f__l { width: 36px; color: var(--ink-mute); font-weight: 600; flex-shrink: 0; }
.dash-f__track { flex: 1; height: 16px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.dash-f__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-light), var(--brand));
    border-radius: 4px; transition: width .4s ease;
}
.dash-f__n { width: 44px; text-align: right; font-weight: 700; color: var(--ink); font-size: 12px; flex-shrink: 0; }
.dash-f__rate {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11.5px; color: var(--ink-mute);
}
.dash-f__rate b { color: var(--brand-dark); font-weight: 700; }

/* ---------- 📅 直近の予定 ---------- */
.dash-u__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.dash-u__item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dash-u__date {
    font-family: 'Inter', sans-serif; font-weight: 700; color: var(--ink);
    width: 76px; flex-shrink: 0; font-size: 12px;
}
.dash-u__type {
    font-size: 10px; font-weight: 700; color: #fff;
    padding: 1px 7px; border-radius: 4px; flex-shrink: 0;
}
.dash-u__title { color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- 💡 ブログ提案 ---------- */
.dash-s__list { display: flex; flex-direction: column; gap: 12px; }
.dash-s__item { display: flex; align-items: flex-start; gap: 10px; }
.dash-s__prio {
    font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px;
    flex-shrink: 0; margin-top: 1px; font-family: 'Inter', sans-serif; letter-spacing: .04em;
}
.dash-s__prio--high   { background: var(--brand); color: #fff; }
.dash-s__prio--medium { background: var(--card); color: var(--brand-dark); border: 1px solid var(--brand); }
.dash-s__prio--low    { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--border); }
.dash-s__main { flex: 1; min-width: 0; }
.dash-s__title { font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.dash-s__theme { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- デスクトップ (≥960px): bento 配置 (3行 × 2列 + 最近の記事) ----------
   レイアウト:
     Row 1: hero        | 📊 visits
     Row 2: 📋 funnel    | 📅 upcoming
     Row 3: 💡 suggest   | 📝 recent
   :has(.dash-hero) でダッシュボード以外には波及しない。 */
@media (min-width: 960px) {
    .app-main:has(.dash-hero) {
        max-width: 1100px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "alert    alert"
            "hero     visits"
            "funnel   upcoming"
            "suggest  recent";
        column-gap: 18px;
        row-gap: 16px;
        align-items: start;
    }
    .app-main:has(.dash-hero) > #alert-area { grid-area: alert; margin: 0; }
    .app-main:has(.dash-hero) > .dash-hero { grid-area: hero; margin-bottom: 0; }
    .app-main:has(.dash-hero) > #dash-visits { grid-area: visits; margin-bottom: 0; }
    .app-main:has(.dash-hero) > #dash-funnel { grid-area: funnel; margin-bottom: 0; }
    .app-main:has(.dash-hero) > #dash-upcoming { grid-area: upcoming; margin-bottom: 0; }
    .app-main:has(.dash-hero) > #dash-suggest { grid-area: suggest; margin-bottom: 0; }
    .app-main:has(.dash-hero) > .dash-recent { grid-area: recent; }

    /* ヒーロー: 中身も横並びに組み替え (数字を左 / 内訳・CTA を右) */
    .dash-hero {
        text-align: left;
        padding: 32px 34px 26px;
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 24px;
        row-gap: 12px;
    }
    .dash-hero::before {
        width: 220px; height: 220px;
        top: -50px; right: -50px;
    }
    .dash-hero__greeting {
        grid-column: 1 / -1; grid-row: 1;
        font-size: 13px; margin-bottom: 0;
    }
    .dash-hero__metric {
        grid-column: 1; grid-row: 2 / 4;
        align-self: center; margin: 0;
    }
    .dash-hero__value { font-size: 80px; }
    .dash-hero__label { font-size: 14px; margin-top: 4px; }
    .dash-hero__breakdown {
        grid-column: 2; grid-row: 2;
        justify-content: flex-end; align-self: end;
        margin: 0;
    }
    .dash-hero__breakdown > span { padding: 5px 11px; font-size: 11.5px; }
    .dash-hero__cta {
        grid-column: 2; grid-row: 3;
        width: auto; justify-self: end;
        padding: 11px 24px; font-size: 13px;
    }

    /* 最近の記事 */
    .dash-recent__head { padding: 14px 18px 8px; }
    .dash-recent__title { font-size: 14px; }
    .dash-list__row { padding: 12px 18px; }
}

/* ---------- スマホ (≤640px): ウィジェットの余白圧縮 ---------- */
@media (max-width: 640px) {
    .dash-w { margin-bottom: 12px; border-radius: 12px; }
    .dash-w__head { padding: 12px 14px 6px; }
    .dash-w__body { padding: 4px 14px 14px; }
    .dash-w__title { font-size: 13.5px; }
    .dash-v__num { font-size: 32px; }
    .dash-u__date { width: 70px; font-size: 11.5px; }
}
