/* ============================================================
   SPlusOne  デザインシステム
   可愛らしくキラキラ・パステル調 / スマホ縦持ち前提
   ============================================================ */

:root {
  /* ---- 色 ---- */
  --pink:        #FF9EC4;
  --pink-soft:   #FFD6E8;
  --pink-wash:   #FFF2F8;
  --lavender:    #B8A9FF;
  --lav-soft:    #E4DEFF;
  --mint:        #8FE3E8;
  --mint-soft:   #D8F6F8;
  --gold:        #FFC978;
  --gold-soft:   #FFEED2;

  --bg:          #FFF8FC;
  --surface:     #FFFFFF;
  --surface-2:   #FDF4FA;
  --ink:         #4A3B52;
  --ink-mid:     #7C6A87;
  --ink-soft:    #A897B2;
  --line:        #F2E3EE;
  --danger:      #FF7A8A;
  --ok:          #6FD3A8;

  /* ---- 顧客ランクの色分け ---- */
  --rank-vip:    #FFC978;
  --rank-gold:   #FFDFA8;
  --rank-silver: #D9CFEA;
  --rank-normal: #E9E2EF;

  /* ---- 影 ---- */
  --shadow-sm: 0 2px 8px rgba(196, 141, 176, .12);
  --shadow:    0 6px 20px rgba(196, 141, 176, .16);
  --shadow-lg: 0 12px 32px rgba(170, 130, 190, .20);

  --radius:    20px;
  --radius-sm: 14px;
  --tap:       48px;

  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI",
          "Zen Maru Gothic", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* キラキラの下地。派手すぎない程度に。 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(680px 380px at 8% -6%,  #FFE3F1 0%, transparent 62%),
    radial-gradient(620px 340px at 96% 4%,  #E7E0FF 0%, transparent 60%),
    radial-gradient(560px 420px at 50% 104%, #DDF6F8 0%, transparent 62%),
    var(--bg);
}

/* ============================================================
   レイアウト
   ============================================================ */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: 0 16px calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px;
  background: rgba(255, 248, 252, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
  flex: 1;
}

.topbar .spacer { flex: 1; }

.brand {
  font-weight: 800;
  font-size: 19px;
  background: linear-gradient(96deg, var(--pink), var(--lavender) 58%, var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: .04em;
}

/* ============================================================
   カード
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin: 12px 0;
  border: 1px solid var(--line);
}

.card.flat { box-shadow: none; }

.card-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-label {
  margin: 22px 4px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .06em;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
  appearance: none;
  border: none;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--pink), var(--lavender));
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, filter .12s ease;
}

.btn:active { transform: scale(.97); filter: brightness(1.05); }
.btn:disabled { opacity: .5; box-shadow: none; cursor: default; transform: none; }
.btn.block { width: 100%; }

.btn.ghost {
  background: var(--surface);
  color: var(--ink-mid);
  border: 1.5px solid var(--line);
  box-shadow: none;
}

.btn.soft {
  background: var(--pink-wash);
  color: #C9578C;
  box-shadow: none;
}

.btn.danger { background: linear-gradient(120deg, #FF9AA6, var(--danger)); }

.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* 右下の追加ボタン */
.fab {
  position: fixed;
  right: max(16px, calc(50vw - 240px + 16px));
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 30;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   フォーム
   ============================================================ */
.field { margin: 14px 0; }

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-mid);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 5px;
  line-height: 1.5;
}

input[type=text], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=url], input[type=tel],
input[type=datetime-local], textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 16px;   /* 16px 未満だと iOS が拡大するので下げない */
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px var(--pink-wash);
}

textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A897B2' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 38px;
}

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* チップ選択（種別など） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink-mid);
  border-radius: 999px;
  padding: 8px 15px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.chip[aria-pressed="true"] {
  background: linear-gradient(120deg, var(--pink-soft), var(--lav-soft));
  border-color: transparent;
  color: #A24C79;
}

/* ============================================================
   リスト
   ============================================================ */
.list { margin: 12px 0; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  min-height: var(--tap);
}

.item:active { transform: scale(.99); }

.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.item .trail { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }

/* 顧客ランクの丸 */
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex: none;
  background: var(--rank-normal);
  box-shadow: inset 0 -2px 6px rgba(0,0,0,.06);
}

.avatar.vip    { background: linear-gradient(135deg, #FFDCA1, var(--rank-vip)); color: #8A5A12; }
.avatar.gold   { background: linear-gradient(135deg, #FFEFD2, var(--rank-gold)); color: #9A6C22; }
.avatar.silver { background: linear-gradient(135deg, #EDE7F7, var(--rank-silver)); color: #6B5D85; }
.avatar.normal { background: linear-gradient(135deg, #F4EFF8, var(--rank-normal)); color: #8A7C96; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--pink-wash);
  color: #C9578C;
  white-space: nowrap;
}

.badge.vip    { background: var(--gold-soft); color: #96601A; }
.badge.mint   { background: var(--mint-soft); color: #2C7C82; }
.badge.lav    { background: var(--lav-soft);  color: #6250B0; }
.badge.danger { background: #FFE6E9; color: #C4404F; }

/* ============================================================
   下部タブ
   ============================================================ */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  z-index: 40;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar button {
  appearance: none;
  border: none;
  background: none;
  padding: 9px 2px 7px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 58px;
}

.tabbar button .ic { font-size: 21px; line-height: 1; }
.tabbar button[aria-current="page"] { color: #D2649B; }

/* ============================================================
   状態表示
   ============================================================ */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--ink-soft);
}

.empty .big { font-size: 40px; margin-bottom: 10px; }
.empty p { margin: 6px 0; font-size: 14px; }

.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 12px 0;
  background: var(--mint-soft);
  color: #26696E;
  border: 1px solid #BEEBEE;
}

.notice.warn   { background: var(--gold-soft); color: #8A5A12; border-color: #FFDFAE; }
.notice.danger { background: #FFE9EC; color: #B93A4B; border-color: #FFCBD3; }

.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--pink-soft);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 32px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  background: rgba(74, 59, 82, .95);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in .25s ease;
  max-width: 88vw;
  text-align: center;
}

.toast.err { background: rgba(190, 60, 78, .96); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   ログイン画面
   ============================================================ */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
}

.auth-logo {
  text-align: center;
  margin-bottom: 26px;
}

.auth-logo .mark {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: .04em;
  background: linear-gradient(96deg, var(--pink), var(--lavender) 55%, var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-logo .tag {
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: .16em;
  margin-top: 2px;
}

/* ============================================================
   ボトムシート（詳細・入力）
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(74, 59, 82, .34);
  backdrop-filter: blur(2px);
  animation: fade-in .18s ease;
}

.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  z-index: 70;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 92dvh;
  overflow-y: auto;
  padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up .26s cubic-bezier(.2, .9, .3, 1);
}

.sheet .grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 6px auto 12px;
}

.sheet h2 { margin: 0 0 6px; font-size: 18px; }

@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   小物
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat .n { font-size: 22px; font-weight: 800; color: #D2649B; line-height: 1.2; }
.stat .l { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; }

.muted { color: var(--ink-soft); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.nowrap { white-space: nowrap; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.demo-banner {
  background: linear-gradient(120deg, var(--gold-soft), var(--pink-wash));
  color: #8A5A12;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  padding: 7px 12px;
  border-bottom: 1px solid #FFE2B8;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
