/* ============================================================
   ぐり・ぐら 売上カウント  スタイル
   ダークテーマ × シアンのアクセント / スマホ優先
   ============================================================ */
:root {
  --bg: #0b1020;
  --bg-elev: #141a2e;
  --bg-elev2: #1c2440;
  --line: #28304e;
  --text: #e8ecf6;
  --muted: #8d97b5;
  --accent: #22d3ee;       /* シアン */
  --accent-2: #a78bfa;     /* 補助（ぐら用紫） */
  --accent-ink: #04212a;
  --danger: #f0556f;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 16px;
  --tap: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* hidden属性は常に最優先（.tabbar/.modal-backdrop/.view-login の display 指定に勝たせる） */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ===== ヘッダー ===== */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(11,16,32,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; flex: none; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-name { letter-spacing: .02em; white-space: nowrap; }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-email { color: var(--muted); font-size: 11px; max-width: 24vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .btn-ghost { white-space: nowrap; flex: none; min-height: 36px; padding: 0 10px; font-size: 13px; }

/* ===== 共通 ===== */
.view { padding: 16px; max-width: 720px; margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.label { color: var(--muted); font-size: 13px; margin: 14px 0 8px; }
.panel { background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; }

/* ===== ボタン ===== */
button { font-family: inherit; cursor: pointer; }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: 12px; font-weight: 700; font-size: 16px;
  min-height: var(--tap); padding: 0 18px; width: 100%;
}
.btn-primary:active { filter: brightness(.92); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  min-height: 40px; padding: 0 12px; font-size: 14px;
}
.btn-ghost.small { min-height: 34px; font-size: 13px; }
.btn-danger { background: transparent; color: var(--danger);
  border: 1px solid var(--danger); border-radius: 10px; min-height: 44px; padding: 0 16px; }

/* ===== ログイン ===== */
.view-login { display: grid; place-items: center; min-height: 70vh; }
.login-card { text-align: center; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; max-width: 360px; width: 100%; }
.btn-google { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google .g { background: #fff; color: #4285f4; font-weight: 800;
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; }

/* ===== 店ボタン ===== */
.store-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.store-btn {
  min-height: var(--tap); border-radius: 12px; font-size: 18px; font-weight: 700;
  background: var(--bg-elev2); color: var(--text); border: 2px solid var(--line);
}
.store-btn.active { border-color: var(--accent); color: #fff;
  box-shadow: inset 0 0 0 9999px rgba(34,211,238,.10); }
.store-btn .swatch { display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 8px; vertical-align: middle; }

/* ===== 人数ボタン ===== */
.party-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.party-btn { min-height: var(--tap); border-radius: 12px; font-size: 20px; font-weight: 700;
  background: var(--bg-elev2); color: var(--text); border: 1px solid var(--line); }
.party-btn:active { border-color: var(--accent); }
.party-btn.more { font-size: 15px; color: var(--accent); }

/* ===== 当日サマリー ===== */
.today-summary { display: flex; gap: 10px; margin: 16px 0 8px; flex-wrap: wrap; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; flex: 1; min-width: 90px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; }
.stat .v.sales { color: var(--accent); }
.stat .v.pending { color: var(--warn); }

/* ===== リスト ===== */
.list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.ticket {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.ticket .time { color: var(--muted); font-size: 13px; width: 44px; flex: none; }
.ticket .badge { font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 8px;
  background: var(--bg-elev2); flex: none; }
.ticket .ppl { font-size: 15px; flex: none; }
.ticket .spacer { flex: 1; }
.ticket .amt { font-weight: 800; font-size: 16px; }
.ticket .pay-btn { background: var(--warn); color: #2a1d00; border: none;
  border-radius: 9px; min-height: 38px; padding: 0 14px; font-weight: 700; font-size: 14px; }
.ticket.confirmed .amt { color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }

/* ===== カレンダー ===== */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-nav .btn-ghost { min-width: 44px; font-size: 20px; }
.cal-weekrow { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px;
  color: var(--muted); font-size: 12px; text-align: center; margin-bottom: 4px; }
.cal-weekrow .sun { color: #ff8a9b; } .cal-weekrow .sat { color: #8ab4ff; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-cell { aspect-ratio: 1 / 1.15; border-radius: 10px; background: var(--bg-elev);
  border: 1px solid var(--line); padding: 4px 4px 2px; display: flex; flex-direction: column;
  overflow: hidden; }
.cal-cell.blank { background: transparent; border: none; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.selected { box-shadow: 0 0 0 2px var(--accent); }
.cal-cell .d { font-size: 12px; color: var(--muted); }
.cal-cell .s { font-size: 12px; font-weight: 800; color: var(--accent); margin-top: auto;
  line-height: 1.15; word-break: break-all; }
.cal-cell .p { font-size: 10px; color: var(--warn); }
.cal-cell.has::after { content: ""; }

.day-detail { margin-top: 16px; }
.day-detail h3 { font-size: 15px; margin: 0 0 10px; }

/* ===== 月集計 ===== */
.monthly { display: flex; flex-direction: column; gap: 10px; }
.mrow { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.mrow.total { border-color: var(--accent); }
.mrow .name { font-weight: 800; font-size: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.mrow .grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.mrow .cell .k { color: var(--muted); font-size: 12px; }
.mrow .cell .v { font-size: 18px; font-weight: 800; }
.mrow .cell .v.sales { color: var(--accent); }
.mrow .pendinfo { color: var(--warn); font-size: 12px; margin-top: 8px; }
.backup-area { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }

/* ===== タブバー ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3,1fr);
  background: rgba(20,26,46,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { background: transparent; border: none; color: var(--muted);
  min-height: 64px; font-size: 13px; font-weight: 700; }
.tab.active { color: var(--accent); }
.tab.active::before { content: ""; display: block; width: 28px; height: 3px;
  background: var(--accent); border-radius: 3px; margin: 0 auto 6px; }
.tab:not(.active)::before { content: ""; display: block; height: 3px; margin: 0 auto 6px; }

/* ===== モーダル ===== */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55);
  display: grid; place-items: end center; }
.modal { background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; width: 100%; max-width: 720px; padding: 20px 18px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 14px; }
.amount-input { width: 100%; font-size: 28px; text-align: center; padding: 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elev2); color: var(--text); }
.amount-input.slim { font-size: 20px; padding: 10px; text-align: right; }
.date-input { font-size: 16px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-elev2); color: var(--text); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions.spread { justify-content: space-between; align-items: center; }
.modal-actions .btn-primary { width: auto; }
.modal-actions > div { display: flex; gap: 8px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.field > span { color: var(--muted); font-size: 14px; flex: none; }
.seg { display: flex; gap: 8px; }
.seg button { background: var(--bg-elev2); border: 2px solid var(--line); color: var(--text);
  border-radius: 10px; min-height: 40px; padding: 0 14px; font-weight: 700; }
.seg button.active { border-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; font-size: 22px;
  background: var(--bg-elev2); border: 1px solid var(--line); color: var(--text); }
.stepper span { font-size: 20px; font-weight: 800; min-width: 28px; text-align: center; }

/* ===== トースト ===== */
.toast { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--bg-elev2); border: 1px solid var(--accent); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: 86vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.err { border-color: var(--danger); }
