/* mor.Group デイリー — iPhoneファースト、清潔・高速・読みやすさ重視 */
:root {
  --bg: #f3f4f5;
  --surface: #ffffff;
  --ink: #26282c;
  --ink-2: #6a6e73;
  --ink-3: #a4a7ab;
  --line: #e6e7e9;
  --accent: #6e7278;       /* mor シルバー(グラファイト寄り・可読) */
  --accent-soft: #eef0f1;
  --gold: #978c76;
  --danger: #c0492f;
  --fc: #9298a0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(28,27,24,.04), 0 8px 24px rgba(28,27,24,.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; } /* display 指定のある要素でも hidden を効かせる */
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt" 1;
  line-height: 1.45;
}
button { font-family: inherit; cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--line); padding: 1px 6px; border-radius: 6px; }

/* ---------- 認証 ---------- */
.auth {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: 24px; background: radial-gradient(120% 80% at 50% 0%, #fff 0%, var(--bg) 60%);
}
.auth-card {
  width: 100%; max-width: 340px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px; padding: 34px 26px;
  box-shadow: var(--shadow); text-align: center;
  animation: pop .4s cubic-bezier(.2,.8,.2,1);
}
.auth-logo { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.auth-logo span, .brand span { color: var(--accent); }
.auth-sub { margin: 6px 0 24px; color: var(--ink-2); font-size: 13px; }
.auth-input {
  width: 100%; font-size: 22px; text-align: center; letter-spacing: .5em;
  padding: 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fcfbf8; outline: none; transition: border-color .15s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%; margin-top: 12px; padding: 14px; font-size: 16px; font-weight: 700;
  color: #fff; background: var(--accent); border: none; border-radius: 14px;
  transition: transform .08s, opacity .15s;
}
.auth-btn:active { transform: scale(.98); }
.auth-err { color: var(--danger); font-size: 13px; margin: 14px 0 0; }
.auth-hint { color: var(--ink-3); font-size: 12px; margin: 18px 0 0; }
.shake { animation: shake .35s; }

/* ---------- トップバー ---------- */
.dashboard { max-width: 760px; margin: 0 auto; padding: 0 16px calc(40px + var(--safe-bot)); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 2px 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.topbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; overflow: hidden; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.02em; flex-shrink: 0; }
.month-label { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.badge-sample { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 6px; padding: 2px 6px; }
.badge-offline { font-size: 10px; font-weight: 700; color: var(--ink-2);
  background: var(--line); border-radius: 6px; padding: 3px 7px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-size: 17px; color: var(--ink-2); line-height: 1;
  display: grid; place-items: center; transition: transform .2s;
}
.icon-btn.spin { animation: spin .7s linear; }

/* ---------- サマリ ---------- */
.summary { margin-top: 6px; }
.summary-hero {
  background: linear-gradient(135deg, #d6d8db 0%, #b7babe 55%, #aaadb2 100%);
  color: var(--ink); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.5);
}
.hero-label { font-size: 12px; color: #565a5f; letter-spacing: .02em; }
.hero-value { font-size: clamp(30px, 9vw, 42px); font-weight: 800; letter-spacing: -.03em; margin-top: 4px;
  font-variant-numeric: tabular-nums; white-space: nowrap; color: #2a2c30; }
.hero-progress { margin-top: 12px; height: 5px; border-radius: 99px; background: rgba(0,0,0,.13); overflow: hidden; }
.hero-progress > i { display: block; height: 100%; background: #5f636a; border-radius: 99px;
  transition: width .6s cubic-bezier(.2,.8,.2,1); }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 10px; text-align: center; min-width: 0; }
.kpi-label { font-size: 11px; color: var(--ink-2); }
.kpi-value { font-size: 17px; font-weight: 700; margin-top: 3px; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-accent { background: var(--accent-soft); border-color: transparent; }
.kpi-accent .kpi-value { color: var(--accent); }

/* ---------- 月セレクタ ---------- */
.month-selector { display: flex; gap: 7px; overflow-x: auto; padding: 14px 2px 4px; margin: 0 -16px;
  padding-left: 16px; padding-right: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.month-selector::-webkit-scrollbar { display: none; }
.month-chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 99px; white-space: nowrap;
  transition: all .15s; }
.month-chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 全店 月別売上推移 ---------- */
.trend-section { margin-top: 22px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 10px; box-shadow: var(--shadow); }
.trend-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.trend-caption { font-size: 11px; color: var(--ink-3); }
.trend-chart svg { width: 100%; height: auto; display: block; }

/* ---------- セクション見出し + トグル ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 12px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0; }
.toggle { display: inline-flex; background: var(--line); border-radius: 10px; padding: 3px; }
.toggle-btn { border: none; background: transparent; font-size: 13px; font-weight: 600;
  color: var(--ink-2); padding: 6px 14px; border-radius: 8px; transition: all .18s; }
.toggle-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- 店舗カード ---------- */
.store-list { display: grid; gap: 10px; }
.store-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  animation: rise .35s both;
}
.store-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.store-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tag-fc { font-size: 10px; font-weight: 800; color: var(--fc); border: 1px solid var(--fc);
  border-radius: 5px; padding: 1px 5px; letter-spacing: .05em; }
.store-sales { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.store-sub { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: 4px; color: var(--ink-2); font-size: 12px; }
.store-sub b { color: var(--ink); font-weight: 700; }
.store-sub .pill { color: var(--ink-2); background: var(--line); border-radius: 6px;
  padding: 1px 7px; font-weight: 700; }
/* 店舗カードの月別売上ミニ折れ線 (月次のときだけ表示・タップで拡大) */
.store-trend { display: flex; align-items: center; gap: 8px; margin-top: 10px; cursor: pointer; }
.store-trend svg { flex: 1; height: 30px; display: block; }
.store-trend-label { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.store-trend-label::after { content: " ⤢"; color: var(--accent); }
.store-recent { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px;
  padding-top: 12px; border-top: 1px dashed var(--line); }
.rcell { text-align: center; }
.rcell-date { font-size: 11px; color: var(--ink-3); }
.rcell-date .dow { margin-left: 2px; }
.rcell-sales { font-size: 14px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.rcell-meta { font-size: 10px; color: var(--ink-2); margin-top: 1px; }
.rcell.is-today .rcell-date { color: var(--ink-2); font-weight: 700; }
.rcell.zero .rcell-sales { color: var(--ink-3); }

/* metric=recent のときの強調 */
.store-card.metric-recent .store-recent { border-top-color: var(--accent-soft); }

.foot { text-align: center; color: var(--ink-3); font-size: 11px; margin-top: 24px; }
.foot-sep { margin: 0 6px; }

/* ---------- A2HS バナー ---------- */
.a2hs {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bot));
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 40px 12px 14px;
  font-size: 12.5px; line-height: 1.4; box-shadow: 0 8px 30px rgba(0,0,0,.3);
  display: flex; flex-direction: column; gap: 2px; z-index: 50; animation: rise .4s both;
}
.a2hs-how { color: #c9c6bf; }
.a2hs b { color: #fff; }
.a2hs-close { position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: #fff; font-size: 20px; line-height: 1; opacity: .7; }

/* ---------- グラフ拡大モーダル ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(33,26,29,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s; }
.modal-card { position: relative; width: 100%; max-width: 560px; background: var(--surface);
  border-radius: 20px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: modalIn .28s cubic-bezier(.2,.8,.2,1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-title { font-size: 16px; font-weight: 800; margin: 0; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-size: 18px; color: var(--ink-2); line-height: 1; }
.modal-chart svg { width: 100%; height: auto; display: block; }
.modal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mstat { text-align: center; background: var(--bg); border-radius: 10px; padding: 9px 6px; }
.mstat-label { font-size: 10px; color: var(--ink-2); }
.mstat-value { font-size: 15px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mstat .up { color: var(--accent); } .mstat .down { color: var(--danger); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- アニメーション ---------- */
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%,100%{transform:none} 20%{transform:translateX(-7px)} 40%{transform:translateX(7px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 広い画面 ---------- */
@media (min-width: 620px) {
  .store-list { grid-template-columns: 1fr 1fr; }
  .section-head { margin-top: 30px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
