:root{
  --mint:#a9e5d7;
  --mint-d:#63bfa8;
  --mint-l:#e7f7f2;
  --pink:#ffb0c4;
  --pink-l:#ffeef3;
  --ink:#3f5a55;
  --ink-2:#7f9a94;
  --bg:#f5fbf9;
  --card:#ffffff;
  --line:#dcede8;
  --danger:#e2708a;
  --sun:#e2708a;
  --sat:#5b93c9;
  --radius:18px;
  --shadow:0 2px 10px rgba(99,191,168,.14);
}

*{box-sizing:border-box}

html{-webkit-text-size-adjust:100%}

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic",system-ui,sans-serif;
  line-height:1.5;
  -webkit-tap-highlight-color:transparent;
}

button,input,textarea{font-family:inherit;color:inherit}

/* ---------- ヘッダー ---------- */
.topbar{
  position:sticky;
  top:0;
  z-index:5;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background:var(--mint);
  box-shadow:0 2px 8px rgba(99,191,168,.25);
}

.brand{display:flex;align-items:center;gap:8px}

.brand h1{margin:0;font-size:18px;letter-spacing:.04em}

.mascot{width:30px;height:30px;flex:none;filter:drop-shadow(0 1px 1px rgba(0,0,0,.08))}
.t-body{fill:#fff;stroke:var(--mint-d);stroke-width:3.5;stroke-linejoin:round}
.t-eye{fill:var(--ink)}
.t-blush{fill:var(--pink)}
.t-smile{fill:none;stroke:var(--ink);stroke-width:3.6;stroke-linecap:round}

.icon-btn{
  border:0;
  background:rgba(255,255,255,.65);
  width:38px;height:38px;
  border-radius:50%;
  font-size:17px;
  line-height:1;
  cursor:pointer;
}

.icon-btn:active{background:#fff}

/* ---------- レイアウト ---------- */
.wrap{
  max-width:520px;
  margin:0 auto;
  padding:14px 14px calc(env(safe-area-inset-bottom) + 28px);
}

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

.section-title{
  margin:18px 0 8px;
  font-size:14px;
  font-weight:700;
  color:var(--ink);
}

.card > .section-title:first-child{margin-top:0}

/* ---------- 月サマリー ---------- */
.summary{
  background:linear-gradient(160deg,#ffffff 0%,var(--mint-l) 100%);
}

.summary-title{
  font-size:13px;
  color:var(--ink-2);
  margin-bottom:10px;
  font-weight:700;
}

.summary-grid{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:8px;
}

.stat{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 8px;
  text-align:center;
  min-width:0;
}

.stat-label{display:block;font-size:11px;color:var(--ink-2);margin-bottom:2px}
.stat-value{display:block;font-size:15px;font-weight:700;letter-spacing:-.01em;word-break:break-all}
.stat-pay{background:var(--pink-l);border-color:#ffd9e2}
.stat-pay .stat-value{color:#d1567a}

/* ---------- 月ナビ ---------- */
.monthnav{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  margin:0 0 12px;
}

.nav-btn{
  width:44px;height:40px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  font-size:22px;
  line-height:1;
  cursor:pointer;
  box-shadow:var(--shadow);
}

.nav-btn:active{background:var(--mint-l)}

.today-btn{
  border:1px solid var(--mint-d);
  background:#fff;
  color:var(--mint-d);
  font-weight:700;
  font-size:13px;
  padding:10px 16px;
  border-radius:12px;
  cursor:pointer;
}

.today-btn:active{background:var(--mint-l)}

/* ---------- カレンダー ---------- */
.dow{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  text-align:center;
  font-size:11px;
  color:var(--ink-2);
  font-weight:700;
  margin-bottom:6px;
}

.dow .sun{color:var(--sun)}
.dow .sat{color:var(--sat)}

.grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:4px;
}

.cell{
  aspect-ratio:1/1.15;
  border:1px solid var(--line);
  background:#fff;
  border-radius:10px;
  padding:3px 2px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:1px;
  cursor:pointer;
  overflow:hidden;
  touch-action:manipulation;
}

.cell:active{background:var(--mint-l)}
.cell.empty{border:0;background:transparent;cursor:default;pointer-events:none}
.cell .d{font-size:13px;font-weight:700;line-height:1.2}
.cell.sun .d{color:var(--sun)}
.cell.sat .d{color:var(--sat)}

.cell.has{background:var(--mint-l);border-color:var(--mint-d)}
.cell.today{box-shadow:0 0 0 2px var(--pink) inset}

.cell .h{font-size:10px;font-weight:700;color:var(--mint-d);line-height:1.15}
.cell .p{font-size:9px;color:var(--ink-2);line-height:1.15}

.hint{
  margin:10px 0 0;
  text-align:center;
  font-size:11px;
  color:var(--ink-2);
}

/* ---------- 明細リスト ---------- */
.list{display:flex;flex-direction:column;gap:8px}

.item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:1px solid var(--line);
  border-radius:12px;
  padding:9px 11px;
  background:#fff;
  width:100%;
  text-align:left;
  cursor:pointer;
  touch-action:manipulation;
}

.item:active{background:var(--mint-l)}
.item .left{min-width:0}
.item .day{font-size:13px;font-weight:700}
.item .time{font-size:11px;color:var(--ink-2)}
.item .right{text-align:right;flex:none}
.item .hrs{font-size:12px;font-weight:700;color:var(--mint-d)}
.item .pay{font-size:14px;font-weight:700;color:#d1567a}

.empty-note{
  text-align:center;
  color:var(--ink-2);
  font-size:12px;
  padding:14px 0;
}

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

/* ---------- シート ---------- */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(63,90,85,.45);
  z-index:10;
}

.sheet{
  position:fixed;
  left:0;right:0;bottom:0;
  z-index:11;
  background:var(--card);
  border-radius:22px 22px 0 0;
  max-height:92vh;
  max-height:92dvh;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding-bottom:calc(env(safe-area-inset-bottom) + 18px);
  box-shadow:0 -6px 24px rgba(63,90,85,.2);
  margin:0 auto;
  max-width:520px;
}

.sheet-bar{
  width:42px;height:4px;
  background:var(--line);
  border-radius:99px;
  margin:9px auto 2px;
}

.sheet-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:6px 16px 4px;
  position:sticky;
  top:0;
  background:var(--card);
}

.sheet-head h2{margin:0;font-size:17px}

.sheet-body{padding:6px 16px 0}

.row{display:grid;grid-template-columns:1fr 1fr;gap:10px}

.field{display:block;margin-bottom:12px}

.field > span{
  display:block;
  font-size:12px;
  color:var(--ink-2);
  font-weight:700;
  margin-bottom:4px;
}

.field input{
  width:100%;
  font-size:16px; /* iOSの自動ズーム防止 */
  padding:11px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  min-height:46px;
}

.field input:focus{outline:2px solid var(--mint-d);outline-offset:1px}

.preview{
  background:var(--mint-l);
  border:1px solid var(--line);
  border-radius:14px;
  padding:11px 13px;
  margin:4px 0 12px;
}

.preview > div{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  font-size:13px;
  padding:3px 0;
}

.preview span{color:var(--ink-2)}
.preview strong{font-size:15px}

.pv-pay{
  border-top:1px dashed var(--mint-d);
  margin-top:5px;
  padding-top:7px !important;
}

.pv-pay strong{font-size:19px;color:#d1567a}

.primary-btn,.ghost-btn,.danger-btn{
  display:block;
  width:100%;
  border-radius:14px;
  font-size:15px;
  font-weight:700;
  padding:14px;
  cursor:pointer;
  margin-bottom:10px;
  touch-action:manipulation;
}

.primary-btn{border:0;background:var(--mint-d);color:#fff}
.primary-btn:active{background:#4fae97}

.ghost-btn{border:1px solid var(--mint-d);background:#fff;color:var(--mint-d);font-size:14px;padding:12px}
.ghost-btn:active{background:var(--mint-l)}

.danger-btn{border:1px solid var(--danger);background:#fff;color:var(--danger);font-size:14px;padding:12px}
.danger-btn:active{background:#fdeef2}

.msg{
  background:var(--pink-l);
  border:1px solid #ffd9e2;
  color:#c04a6d;
  border-radius:12px;
  padding:9px 12px;
  font-size:13px;
  margin:0 0 10px;
}

.msg.ok{background:var(--mint-l);border-color:var(--mint-d);color:#3d8d78}

.note{font-size:12px;color:var(--ink-2);margin:0 0 8px}

.ta{
  width:100%;
  font-size:13px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  resize:vertical;
  word-break:break-all;
  margin-bottom:8px;
}
