/* ═══════════════════════════════════════════════════════════
   somapoint — base.css  (structure only; colors come from themes.css)
   All visual tokens are CSS vars set per [data-theme].
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; background: var(--shell); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  /* iOS の overscroll/透け防止: body は shell 色（ダークグリーン）にする */
  background: var(--shell);
  color: var(--text);
  height: 100%;
  position: relative;
  overflow: hidden;
}
/* アプリ本体の背景は #app で適用 */
#app { background: var(--bg); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
::-webkit-scrollbar { width: 0; height: 0; }

/* tabular numerals everywhere figures matter */
.num, .value, .tv, .av, .day-pts, .dr-amount, .sr-amount, .ring-num { font-feature-settings: "tnum" 1; }

/* ─── App Shell ─────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.scroll-area {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg);
}

/* optional grain layer (themes toggle visibility via --grain-opacity) */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: var(--grain-opacity, 0);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Status bar (faux iOS) ─────────────────── */
.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 22px 2px; font-size: 13px; font-weight: 700;
  color: var(--header-fg);
  background: var(--header-bg); background-size: cover;
  letter-spacing: .02em;
}
.statusbar .sb-right { display: flex; align-items: center; gap: 5px; }
.statusbar svg { display: block; }

/* ─── Header ────────────────────────────────── */
.app-header {
  background: var(--header-bg); background-size: cover;
  padding: 10px 18px 0;
  position: relative;
}
.header-row1 {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.app-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  color: var(--header-fg);
  letter-spacing: var(--logo-tracking, .01em);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.app-logo .tree-icon { font-size: 19px; }
.app-logo .wordmark { line-height: 1; }
.header-name {
  font-size: 15px; font-weight: 600; color: var(--header-fg-dim);
  display: flex; align-items: center; gap: 5px;
}
.btn-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--header-fg-dim); transition: background .2s, color .2s;
}
.btn-icon:active { background: var(--header-press); color: var(--header-fg); }
.btn-icon svg { width: 21px; height: 21px; }
.hdr-right { display: flex; align-items: center; gap: 4px; }

.month-nav {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding-bottom: 12px;
}
.btn-month-nav {
  width: 48px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--header-fg-dim); font-size: 24px; transition: background .15s;
}
.btn-month-nav:active { background: var(--header-press); }
.month-label {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--header-fg);
  min-width: 150px; text-align: center; letter-spacing: .03em;
}
.month-label.tappable { cursor: pointer; border-radius: 8px; padding: 2px 6px; transition: background .15s; }
.month-label.tappable:active { background: var(--header-press); }

/* ─── Year/Month Picker ───────────────────────── */
.ym-picker-backdrop { position: fixed; inset: 0; z-index: 200; }
.ym-picker {
  position: fixed; top: 96px; left: 50%; transform: translateX(-50%);
  z-index: 201; background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sheet); border: 1px solid var(--border-strong);
  padding: 14px 16px 16px; min-width: 260px;
}
.ym-year-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ym-year-lbl { font-size: 17px; font-weight: 700; color: var(--text); }
.ym-yr-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--text); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ym-yr-btn:active { background: var(--accent-soft); }
.ym-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ym-m-btn { padding: 9px 4px; border-radius: 8px; border: none; background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; }
.ym-m-btn:active, .ym-m-btn.current { background: var(--accent); color: var(--accent-fg); }

/* ─── Tab Bar（ヘッダー直下）───────────────── */
.tab-bar {
  background: var(--tabbar-bg);
  display: flex;
  border-bottom: 1px solid var(--tabbar-border);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1; padding: 11px 4px; font-size: 14px; font-weight: 700;
  color: var(--tab-fg);
  border-bottom: 2.5px solid transparent;
  transition: color .2s, border-color .2s;
  letter-spacing: .01em;
}
.tab-btn.active { color: var(--tab-active); border-bottom-color: var(--tab-active); }

/* ─── Content ───────────────────────────────── */
.tab-content { display: none; padding: 16px 14px 32px; }
.tab-content.active { display: block; animation: fadeUp .35s var(--ease, cubic-bezier(.33,1,.68,1)); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── Cards ─────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.card-title {
  font-size: 13px; font-weight: 700; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 13px;
}

/* ─── Summary Card ──────────────────────────── */
.summary-card { background: var(--surface-hero); position: relative; overflow: hidden; }
.summary-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

/* progress ring */
.ring-wrap { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); display: block; }
.ring-track { stroke: var(--ring-track); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease, cubic-bezier(.33,1,.68,1)); }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-num { font-family: var(--font-num); font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.ring-lbl { font-size: 9px; color: var(--muted); margin-top: 2px; letter-spacing: .08em; }
.ring-side { flex: 1; }
.ring-side .rs-rate { font-size: 12px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ring-side .rs-frac { font-family: var(--font-num); font-size: 15px; font-weight: 700; color: var(--text-mid); }

/* progress bar (alt to ring) */
.progress-wrap { margin-bottom: 15px; }
.progress-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.progress-label .p-left { font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.progress-label .p-right { font-size: 11px; color: var(--muted); font-family: var(--font-num); }
.progress-track { height: 9px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 99px; background: var(--accent-grad, var(--accent));
  transition: width .8s var(--ease, cubic-bezier(.33,1,.68,1));
}

.summary-main { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.summary-stat .label { font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.summary-stat .value { font-family: var(--font-num); font-size: 25px; font-weight: 700; color: var(--text); line-height: 1.05; }
.summary-stat .value.accent { color: var(--accent-ink); }
.summary-stat .unit { font-size: 12px; color: var(--muted); margin-left: 2px; font-family: var(--font-body); }
.summary-stat .edit-link { font-size: 10px; color: var(--accent-ink); font-weight: 700; margin-left: 6px; }

.summary-badges { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.rs-badge-row { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.rs-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 99px; font-size: 11px; font-weight: 700;
}
.badge-ok { background: var(--st-full-bg); color: var(--st-full); }
.badge-ng { background: var(--st-abs-bg); color: var(--st-abs); }
.badge-bark { background: var(--accent-soft); color: var(--accent-ink); }
.badge-warn { background: var(--st-pm-bg); color: var(--st-pm); }
.provisional-label { font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 4px; vertical-align: middle; }

.summary-total {
  border-top: 1px dashed var(--divider); padding-top: 13px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.summary-total .tl { font-size: 12px; color: var(--muted); font-weight: 700; }
.summary-total .tv { font-family: var(--font-num); font-size: 28px; font-weight: 700; color: var(--accent-ink); }
.summary-total .tu { font-size: 13px; color: var(--muted); margin-left: 2px; font-family: var(--font-body); }

/* ─── Import button ─────────────────────────── */
.import-wrap { margin-bottom: 14px; }
.btn-import {
  width: 100%; padding: 13px 16px; background: var(--accent); color: var(--accent-fg);
  border-radius: var(--radius-md); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .2s, transform .1s; letter-spacing: .02em;
}
.btn-import:active { transform: scale(.98); filter: brightness(.92); }
.import-meta { font-size: 11px; color: var(--muted); margin-top: 7px; text-align: center; }
.import-meta .ok { color: var(--st-full); font-weight: 700; }

/* ─── Import status (adaptive) ──────────────── */
.import-status {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 14px;
  box-shadow: var(--shadow-row);
}
.import-status .is-ico { font-size: 16px; line-height: 1; }
.import-status .is-text { flex: 1; display: flex; flex-direction: column; gap: 1px; line-height: 1.3; min-width: 0; }
.import-status .is-text b { font-size: 13px; font-weight: 700; color: var(--text); }
.import-status .is-text span { font-size: 11px; color: var(--muted); }
.import-status .is-source {
  font-weight: 700; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 5px; padding: 0 5px;
}
.import-status .is-redo {
  font-size: 12px; font-weight: 700; color: var(--accent-ink);
  padding: 7px 12px; border-radius: 99px; background: var(--accent-soft); white-space: nowrap;
  transition: filter .15s, transform .1s;
}
.import-status .is-redo:active { filter: brightness(.94); transform: scale(.97); }

.import-cta {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 15px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.import-cta.warn { border-color: var(--st-pm); background: var(--st-pm-bg); }
.import-cta .ic-head { display: flex; gap: 12px; margin-bottom: 13px; }
.import-cta .ic-ico { font-size: 22px; line-height: 1.1; flex-shrink: 0; }
.import-cta .ic-title { font-size: 14px; font-weight: 700; color: var(--accent-ink); margin-bottom: 3px; }
.import-cta.warn .ic-title { color: var(--st-pm); }
.import-cta .ic-sub { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.import-cta .ic-sub b { color: var(--text-mid); font-weight: 700; }
.import-cta .btn-import.alt { background: var(--accent-soft); color: var(--accent-ink); }

/* ─── Empty month state ─────────────────────── */
.empty-month { text-align: center; padding: 30px 18px; }
.empty-month .em-ico { font-size: 30px; margin-bottom: 8px; }
.empty-month .em-text { font-size: 13px; color: var(--muted); line-height: 1.65; }
.empty-month .em-text b { color: var(--text-mid); font-weight: 700; }

/* ─── Comment card ──────────────────────────── */
.comment-card { background: var(--surface-quote); border-left: 3px solid var(--accent); }
.comment-text { font-size: 13px; line-height: 1.65; color: var(--text-mid); font-style: italic; }

/* ─── Section header ────────────────────────── */
.section-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.section-hd-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.section-hd-action { font-size: 11px; color: var(--muted); font-weight: 600; }

/* view toggle (list/grid) */
.view-toggle { display: flex; gap: 3px; background: var(--seg-bg); border-radius: 99px; padding: 3px; }
.view-toggle button {
  padding: 5px 12px; border-radius: 99px; font-size: 11px; font-weight: 700;
  color: var(--muted); transition: all .18s;
}
.view-toggle button.active { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ─── Day list ──────────────────────────────── */
.day-list { display: flex; flex-direction: column; gap: 7px; }
.day-row {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 12px 14px; display: flex; align-items: center; gap: 11px;
  box-shadow: var(--shadow-row); cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
  border: 1px solid var(--border); position: relative;
}
.day-row:active { transform: scale(.99); }
.day-row.cancelled { opacity: .55; }
.day-row.confirmed { border-color: var(--accent-ink); }
.day-row.official { border-color: var(--accent-ink); opacity: .92; }
.day-row.past-lock { cursor: default; }
.day-row.past-lock:active { transform: none; }
.cal-cell.official { border-color: var(--accent-ink); }
.day-row.manual::after {
  content: '✎'; position: absolute; top: 7px; right: 11px;
  font-size: 11px; color: var(--accent-ink);
}
.admin-month-row { display: flex; align-items: center; gap: 6px; }
.admin-month-check {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; cursor: pointer; padding: 4px 6px;
  background: var(--bg2); border-radius: 6px; user-select: none; flex: 1;
}
.admin-sched-input {
  width: 52px; font-size: 12px; text-align: center;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 4px; background: var(--surface); color: var(--text);
}
.day-date { width: 84px; flex-shrink: 0; white-space: nowrap; }
.day-date .md { font-family: var(--font-num); font-size: 16px; font-weight: 700; color: var(--text); }
.day-date .dow { font-size: inherit; color: var(--muted); }
.date-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 99px; margin-top: 2px;
}
.cc-conf-badge {
  font-size: 7px; font-weight: 700; vertical-align: middle;
  background: var(--st-full-bg); color: var(--st-full);
  border-radius: 99px; padding: 0 3px; margin-left: 2px;
}
.cc-pend-badge {
  font-size: 7px; font-weight: 700; vertical-align: middle;
  background: var(--st-pm-bg); color: var(--st-pm);
  border-radius: 99px; padding: 0 3px; margin-left: 2px;
}
.dow.sat { color: var(--sat); }
.dow.sun { color: var(--sun); }

.status-badge {
  width: 36px; height: 36px; border-radius: var(--badge-radius, 50%);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.s-full  { background: var(--st-full-bg); color: var(--st-full); }
.s-am    { background: var(--st-am-bg);   color: var(--st-am); }
.s-pm    { background: var(--st-pm-bg);   color: var(--st-pm); }
.s-abs   { background: var(--st-abs-bg);  color: var(--st-abs); }
.s-off   { background: var(--st-off-bg);  color: var(--st-off); }
.s-sched { background: var(--st-sched-bg, #eef2fb); color: var(--st-sched, #7a8fb8); border: 1.5px dashed currentColor; font-size: 13px; }

/* ─── Scheduled (default activity) day row ───── */
.day-row.sched-day { opacity: .85; }
.day-row.sched-day .day-grp { font-weight: 600; color: var(--st-sched, #7a8fb8); }

.day-info { flex: 1; min-width: 0; }
.day-grp { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.day-content { font-size: 10px; color: var(--muted); line-height: 1.4; margin-bottom: 1px; white-space: normal; word-break: break-all; }
.day-pts { font-family: var(--font-num); font-size: 17px; font-weight: 700; color: var(--accent-ink); }
.day-pts.zero { color: var(--muted); font-weight: 600; }
.day-icons { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.day-icon { font-size: 13px; }

/* ─── Calendar grid ─────────────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--cal-gap, 5px); }
.cal-dow { text-align: center; font-size: 10px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.cal-dow.sat { color: var(--sat); }
.cal-dow.sun { color: var(--sun); }
.cal-cell {
  aspect-ratio: 1 / 1.12; border-radius: var(--radius-sm);
  background: var(--cell-bg); border: 1px solid var(--border);
  padding: 4px 4px 3px; display: flex; flex-direction: column; position: relative;
  transition: transform .1s, box-shadow .15s; overflow: hidden;
}
.cal-cell.has:active { transform: scale(.96); }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.cancelled { opacity: .5; }
.cal-cell .cc-date { font-family: var(--font-num); font-size: 11px; font-weight: 700; color: var(--text-mid); }
.cal-cell.sat .cc-date { color: var(--sat); }
.cal-cell.sun .cc-date { color: var(--sun); }
.cal-cell .cc-mark {
  margin: auto; font-size: 17px; font-weight: 700; line-height: 1;
}
.cal-cell .cc-dot {
  width: var(--dot, 9px); height: var(--dot, 9px); border-radius: 50%; margin: auto auto 2px;
  box-shadow: var(--dot-glow, none);
}
.cal-cell .cc-pts { font-family: var(--font-num); font-size: 9px; font-weight: 700; color: var(--accent-ink); text-align: center; }
.cal-cell .cc-tags { position: absolute; top: 3px; right: 4px; display: flex; gap: 1px; font-size: 8px; }
.cal-d-full  { color: var(--st-full); } .cal-bg-full  { background: var(--st-full); }
.cal-d-am    { color: var(--st-am);   } .cal-bg-am    { background: var(--st-am);   }
.cal-d-pm    { color: var(--st-pm);   } .cal-bg-pm    { background: var(--st-pm);   }
.cal-d-abs   { color: var(--st-abs);  } .cal-bg-abs   { background: var(--st-abs);  }
.cal-d-off   { color: var(--st-off);  } .cal-bg-off   { background: var(--st-off);  }
.cal-d-sched { color: var(--st-sched, #7a8fb8); font-size: 13px; }
.cal-cell.sched-cell { border: 1px dashed var(--st-sched, #7a8fb8); opacity: .75; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding: 0 2px; }
.cal-legend span { font-size: 10px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.cal-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ─── Settlement tab ────────────────────────── */
.settle-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--divider); font-size: 13px;
}
.settle-row:last-child { border-bottom: none; }
.settle-row .sr-label { color: var(--text-mid); }
.settle-row .sr-detail { font-size: 11px; color: var(--muted); }
.settle-row .sr-amount { font-weight: 700; color: var(--text); font-size: 15px; font-family: var(--font-num); }
.settle-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 13px; margin-top: 4px; border-top: 2px solid var(--accent);
}
.settle-total .tl { font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.settle-total .tv { font-family: var(--font-num); font-size: 26px; font-weight: 700; color: var(--accent-ink); }

.detail-list { display: flex; flex-direction: column; gap: 7px; }
.detail-row {
  background: var(--surface); border-radius: var(--radius-md); padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow-row); border: 1px solid var(--border);
}
.detail-row .dr-date { font-size: 13px; font-weight: 700; color: var(--text); }
.detail-row .dr-items { font-size: 11px; color: var(--muted); margin-top: 2px; }
.detail-row .dr-amount { font-family: var(--font-num); font-size: 17px; font-weight: 700; color: var(--money); }

/* ─── Annual tab ────────────────────────────── */
.annual-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.astat { background: var(--surface-2); border-radius: var(--radius-md); padding: 11px 10px; border: 1px solid var(--border); }
.astat .al { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; white-space: nowrap; letter-spacing: .03em; }
.astat .av { font-family: var(--font-num); font-size: 20px; font-weight: 700; color: var(--text); }
.astat .au { font-size: 10px; color: var(--muted); margin-left: 1px; font-family: var(--font-body); }
.astat.highlight { background: var(--accent); border-color: transparent; }
.astat.highlight .al { color: var(--accent-fg); opacity: .7; }
.astat.highlight .av, .astat.highlight .au { color: var(--accent-fg); }
.astat.highlight .provisional-label { color: var(--accent-fg); opacity: .6; }
.annual-footnote-note { font-size: 13px; color: var(--muted); padding: 5px 14px 0; min-height: 1em; }

.month-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.month-table th {
  background: var(--surface-2); padding: 10px 4px; text-align: center; font-weight: 700;
  color: var(--muted); font-size: 13px; letter-spacing: .03em;
}
.month-table th:first-child { text-align: left; padding-left: 10px; width: 52px; }
.month-table th:nth-child(2) { width: 16%; }
.month-table th:nth-child(3) { width: 24%; }
.month-table th:nth-child(4) { width: 14%; }
.month-table td { padding: 11px 4px; text-align: center; border-bottom: 1px solid var(--divider); color: var(--text-mid); }
.month-table tr:last-child td { border-bottom: none; }
.month-table td.month-name { font-weight: 700; color: var(--text); text-align: left; padding-left: 10px; width: 52px; }
.month-table td.pts { font-family: var(--font-num); font-weight: 700; color: var(--accent-ink); }
.month-table td.rate-good { color: var(--st-full); font-weight: 700; }
.month-table td.rate-warn { color: var(--st-pm); font-weight: 700; }
.month-table td.rate-ng { color: var(--muted); }
.month-table td.felling-ok { color: var(--st-full); font-weight: 700; }
.month-table td.felling-ng { color: var(--muted); }
.month-table td.empty { color: var(--divider); }
.month-total-row td { border-top: 2px solid var(--border); font-weight: 700; background: var(--surface-2); }
.month-carryover-row td { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; border-bottom: 2px solid var(--border); }
.mini-bars { display: flex; flex-direction: column; gap: 9px; margin-bottom: 6px; }
.mini-bar-row { display: flex; align-items: center; gap: 10px; }
.mini-bar-row .mbm { font-size: 11px; color: var(--muted); width: 30px; font-weight: 700; }
.mini-bar-track { flex: 1; height: 22px; border-radius: var(--radius-sm); background: var(--ring-track); overflow: hidden; position: relative; }
.mini-bar-fill { height: 100%; background: var(--accent-grad, var(--accent)); border-radius: var(--radius-sm); transition: width .8s var(--ease); display: flex; align-items: center; }
.mini-bar-fill .mbp { font-family: var(--font-num); font-size: 10px; font-weight: 700; color: var(--accent-fg); padding-left: 8px; white-space: nowrap; }

.data-btns { display: flex; flex-direction: column; gap: 9px; }
.btn-data { width: 100%; padding: 15px; border-radius: var(--radius-md); font-size: 15px; font-weight: 700; text-align: center; transition: transform .1s, filter .2s; }
.btn-data:active { transform: scale(.98); }
.btn-export { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-csv { background: var(--accent-soft); color: var(--accent-ink); }

/* ─── Bottom sheet ──────────────────────────── */
.sheet-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 100; background: var(--scrim);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }
.bottom-sheet {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 101;
  transform: translateY(100%);
  background: var(--bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-sheet); max-height: 92dvh; overflow-y: auto;
  transition: transform .35s cubic-bezier(.32,0,.67,0);
}
.bottom-sheet.open { transform: translateY(0); transition-timing-function: cubic-bezier(.33,1,.68,1); }
.sheet-handle-wrap { padding: 10px 0 4px; display: flex; justify-content: center; position: sticky; top: 0; background: var(--bg); }
.sheet-handle { width: 38px; height: 4px; border-radius: 99px; background: var(--divider); }
.sheet-header { padding: 4px 18px 14px; border-bottom: 1px solid var(--divider); }
.sheet-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--accent-ink); }
.sheet-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sheet-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 18px; }
.field-group {}
.field-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; margin-bottom: 9px; }

.status-buttons { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.status-btn {
  padding: 11px 4px; border-radius: var(--radius-md); font-size: 13px; font-weight: 700;
  border: 2px solid var(--border-strong); color: var(--muted); background: var(--surface);
  transition: all .15s; text-align: center;
}
/* 作業中止ボタン: 全幅 */
.status-btn-cancel { grid-column: 1 / -1; font-size: 12px; padding: 9px 4px; }
.status-btn.sel-full   { border-color: var(--st-full); background: var(--st-full-bg); color: var(--st-full); }
.status-btn.sel-am     { border-color: var(--st-am);   background: var(--st-am-bg);   color: var(--st-am); }
.status-btn.sel-pm     { border-color: var(--st-pm);   background: var(--st-pm-bg);   color: var(--st-pm); }
.status-btn.sel-abs    { border-color: var(--st-abs);  background: var(--st-abs-bg);  color: var(--st-abs); }
.status-btn.sel-cancel { border-color: var(--st-off);  background: var(--st-off-bg);  color: var(--st-off); }

.grp-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grp-btn {
  padding: 11px 8px; border-radius: var(--radius-md); font-size: 12px; font-weight: 700;
  border: 2px solid var(--border-strong); color: var(--muted); background: var(--surface); transition: all .15s;
}
.grp-btn.sel { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }

.pts-row { display: flex; align-items: center; gap: 10px; }
.pts-display {
  flex: 1; padding: 12px 16px; background: var(--surface-2); border-radius: var(--radius-md);
  font-family: var(--font-num); font-size: 22px; font-weight: 700; color: var(--accent-ink);
  border: 2px solid transparent; transition: border-color .2s;
}
.pts-display.editing { border-color: var(--accent); background: var(--surface); }
.pts-display input { width: 100%; background: none; border: none; outline: none; font-family: var(--font-num); font-size: 22px; font-weight: 700; color: var(--accent-ink); }
.btn-pts-toggle { padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-mid); font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid var(--border); }

.scheduled-toggle { display: flex; align-items: center; gap: 10px; }
.scheduled-toggle label { font-size: 13px; color: var(--text-mid); cursor: pointer; flex: 1; }
.toggle-switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; border-radius: 99px; background: var(--toggle-off); transition: background .2s; cursor: pointer; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

.memo-area {
  width: 100%; min-height: 70px; resize: vertical; border: 2px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 10px 12px; font-size: 13px; color: var(--text);
  background: var(--surface); outline: none; transition: border-color .2s; line-height: 1.5;
}
.memo-area:focus { border-color: var(--accent); }

/* ─── Official day sheet (official-mode) ───── */
#official-info-panel { display: none; }
.bottom-sheet.official-mode #official-info-panel { display: block; }
.bottom-sheet.official-mode #field-status,
.bottom-sheet.official-mode #field-grp,
.bottom-sheet.official-mode #field-pts,
.bottom-sheet.official-mode #field-scheduled { display: none; }

/* ─── Confirmed local record (memo-only mode) ───── */
.bottom-sheet.confirmed-mode #field-status,
.bottom-sheet.confirmed-mode #field-grp,
.bottom-sheet.confirmed-mode #field-pts,
.bottom-sheet.confirmed-mode #field-scheduled { display: none; }
.official-info-card {
  background: var(--surface-2); border-radius: var(--radius-md);
  padding: 10px 12px; border: 1px solid var(--border);
}
.oi-row { display: flex; gap: 8px; font-size: 12px; color: var(--text-mid); padding: 3px 0; }
.oi-lbl { font-weight: 700; color: var(--muted); min-width: 32px; }
.status-note { font-size: 10px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.settle-inputs { display: flex; flex-direction: column; gap: 11px; }
.settle-input-row { display: flex; align-items: center; gap: 8px; }
.settle-input-row .sil { font-size: 12px; color: var(--text-mid); flex: 1; }
.settle-input-row .siu { font-size: 11px; color: var(--muted); }
.num-input, .money-input {
  padding: 8px; text-align: right; border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 700; color: var(--text);
  outline: none; transition: border-color .2s; background: var(--surface); font-family: var(--font-num);
}
.num-input { width: 60px; } .money-input { width: 96px; }
.num-input:focus, .money-input:focus { border-color: var(--accent); }
.tier-select { padding: 8px 8px; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12px; color: var(--text); background: var(--surface); outline: none; }
.tier-select:focus { border-color: var(--accent); }

.sheet-footer { padding: 12px 18px 18px; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; border-top: 1px solid var(--divider); position: sticky; bottom: 0; background: var(--bg); }
.btn-cancel { padding: 14px; border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-mid); font-size: 14px; font-weight: 700; }
.btn-save { padding: 14px; border-radius: var(--radius-md); background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 700; letter-spacing: .03em; transition: filter .2s, transform .1s; }
.btn-save:active { transform: scale(.98); filter: brightness(.92); }

/* ─── Settings ──────────────────────────────── */
#settings-screen { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 50; overflow-y: auto; }
#settings-screen.open { display: block; animation: slideIn .3s var(--ease); }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.settings-header { background: var(--header-bg); background-size: cover; padding: 14px 18px; display: flex; align-items: center; gap: 12px; }
.btn-back { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--header-fg); font-size: 20px; transition: background .2s; }
.btn-back:active { background: var(--header-press); }
.settings-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--header-fg); }
.settings-body { padding: 16px 14px 32px; display: flex; flex-direction: column; gap: 16px; }
.settings-section-title { font-size: 12px; font-weight: 700; letter-spacing: .13em; color: var(--muted); text-transform: uppercase; padding: 0 2px 8px; }
.settings-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); border: 1px solid var(--border); overflow: hidden; }
.admin-wide-card { margin-left: -6px; margin-right: -6px; }
.settings-row { display: flex; align-items: center; gap: 12px; padding: 16px 16px; border-bottom: 1px solid var(--divider); }
.settings-row:last-child { border-bottom: none; }
.settings-row .row-label { font-size: 16px; color: var(--text-mid); flex: 1; }
.settings-row .row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.settings-input { flex: 1; min-width: 0; padding: 11px 12px; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 16px; color: var(--text); outline: none; background: var(--surface-2); transition: border-color .2s; }
.settings-input:focus { border-color: var(--accent); background: var(--surface); }
.carry-input { width: 90px; padding: 9px 10px; text-align: right; border: 2px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 16px; font-weight: 700; color: var(--text); outline: none; background: var(--surface-2); font-family: var(--font-num); }
.carry-input:focus { border-color: var(--accent); background: var(--surface); }
.url-row { padding: 14px 16px; border-bottom: 1px solid var(--divider); display: flex; flex-direction: column; gap: 6px; }
.url-row:last-child { border-bottom: none; }
.url-row .url-month-label { font-size: 14px; font-weight: 700; color: var(--accent-ink); }
.url-row .url-field-wrap { display: flex; gap: 6px; }
.url-row .url-field-wrap input { flex: 1; padding: 9px 10px; font-size: 13px; color: var(--text-mid); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); outline: none; }
.url-row .url-field-wrap input:focus { border-color: var(--accent); background: var(--surface); }
.url-row .url-field-wrap input::placeholder { color: var(--muted); }
.btn-url-save { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-fg); font-size: 14px; font-weight: 700; flex-shrink: 0; }
.btn-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); }

/* ─── Admin password field ──────────────────── */
.admin-pw-field {
  display: flex; align-items: center; gap: 8px;
}
.admin-pw-wrap {
  position: relative; flex: 1; min-width: 0;
}
.admin-pw-input {
  width: 100%; box-sizing: border-box; padding-right: 44px;
}
.btn-show-pw {
  position: absolute; right: 0; top: 0; bottom: 0; width: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}

/* ─── Wizard ────────────────────────────────── */
#wizard-overlay { position: fixed; inset: 0; z-index: 200; background: var(--scrim-strong); display: none; align-items: center; justify-content: center; padding: 20px; }
#wizard-overlay.open { display: flex; }
.wizard-card { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden; }
.wizard-top { background: var(--header-bg); background-size: cover; padding: 26px 24px 18px; text-align: center; }
.wizard-top .wt-icon { font-size: 38px; margin-bottom: 6px; }
.wizard-top .wt-title { font-family: var(--font-display); font-size: 23px; font-weight: 700; color: var(--header-fg); }
.wizard-top .wt-sub { font-size: 13px; color: var(--header-fg-dim); margin-top: 4px; }
.wizard-steps { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.wizard-step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--header-press); transition: background .3s; }
.wizard-step-dot.active { background: var(--accent); }
.wizard-body { padding: 24px; }
.wizard-field-label { font-size: 14px; font-weight: 700; color: var(--accent-ink); margin-bottom: 6px; }
.wizard-sub { font-size: 11.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.wizard-sub strong { color: var(--accent-ink); }
.wizard-input { width: 100%; padding: 14px 16px; font-size: 16px; color: var(--text); border: 2px solid var(--border-strong); border-radius: var(--radius-md); outline: none; background: var(--surface-2); transition: border-color .2s; }
.wizard-input:focus { border-color: var(--accent); background: var(--surface); }
.wizard-check-wrap { display: flex; align-items: flex-start; gap: 12px; background: var(--surface-2); border-radius: var(--radius-md); padding: 16px; }
.wizard-check-wrap input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); margin-top: 1px; flex-shrink: 0; }
.wizard-check-wrap label { font-size: 14px; font-weight: 700; color: var(--accent-ink); cursor: pointer; }
.wizard-check-wrap .check-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.wizard-footer { padding: 0 24px 24px; display: flex; gap: 10px; }
.btn-wiz-back { padding: 14px 20px; border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-mid); font-size: 14px; font-weight: 700; }
.btn-wiz-next { flex: 1; padding: 14px; border-radius: var(--radius-md); background: var(--accent); color: var(--accent-fg); font-size: 15px; font-weight: 700; letter-spacing: .03em; transition: filter .2s, transform .1s; }
.btn-wiz-next:active { filter: brightness(.92); transform: scale(.98); }

/* ─── Toast ─────────────────────────────────── */
.toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); z-index: 300; background: var(--toast-bg); color: var(--toast-fg); padding: 11px 20px; border-radius: 99px; font-size: 13px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.mt14 { margin-top: 14px; } .mb14 { margin-bottom: 14px; }

/* ─── 所定日数 編集ボタン ───────────────────── */
.summary-stat .edit-link, .rs-rate .edit-link {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; font-family: var(--font-body);
  color: var(--accent-ink); background: var(--accent-soft);
  border: 1.5px solid var(--accent); border-radius: 99px;
  padding: 2px 8px; margin-left: 8px; cursor: pointer;
  vertical-align: middle; transition: background .15s, filter .15s;
  white-space: nowrap;
}
.summary-stat .edit-link:active, .rs-rate .edit-link:active { filter: brightness(.92); }

/* ─── 「伝助を開く」— import-status 内 ─────── */
.is-open-densuke {
  padding: 7px 10px; border-radius: 99px; font-size: 14px; line-height: 1;
  color: var(--accent-ink); transition: background .15s;
  display: inline-flex; align-items: center; text-decoration: none;
}
.import-status .is-open-densuke {
  padding: 7px 10px; border-radius: 99px; font-size: 14px; line-height: 1;
  color: var(--accent-ink); transition: background .15s;
  display: inline-flex; align-items: center; text-decoration: none;
}
.import-status .is-open-densuke:active { background: var(--accent-soft); }

/* ─── 「取り込み + 伝助を開く」横並び行 ────── */
.ic-btn-row { display: flex; gap: 8px; align-items: center; }
.ic-btn-row .btn-import { flex: 1; }

/* ─── URL 保存状態インジケーター ────────────── */
.url-row { padding: 10px 16px; border-bottom: 1px solid var(--divider); display: flex; flex-direction: column; gap: 5px; }
.url-row:last-child { border-bottom: none; }
.url-row .url-month-label { font-size: 12px; font-weight: 700; color: var(--accent-ink); display: flex; align-items: center; gap: 5px; }
.url-status-dot { font-size: 12px; width: 16px; display: inline-block; }
.url-status-dot.saved   { color: var(--st-full); }
.url-status-dot.pending { color: var(--st-pm); }
.url-status-dot.empty   { color: var(--muted); }
.url-row .url-field-wrap input.is-saved   { border-color: var(--st-full); }
.url-row .url-field-wrap input.is-pending { border-color: var(--st-pm); }
.btn-url-save.is-saved { background: var(--accent-soft); color: var(--st-full); }

/* ─── Wizard 免責 / 月 selector ─────────────── */
.wizard-disclaimer {
  font-size: 13px; line-height: 1.7; color: var(--text-mid);
  background: var(--surface-2); border-radius: var(--radius-md);
  padding: 14px 16px; border-left: 3px solid var(--accent);
}
.wiz-month-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.wiz-month-row select {
  padding: 9px 10px; border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; color: var(--text); background: var(--surface-2);
  outline: none; font-family: var(--font-num);
}
.wiz-month-row select:focus { border-color: var(--accent); background: var(--surface); }
.wiz-month-sep { font-size: 14px; color: var(--muted); }

/* ─── 設定画面 免責 ─────────────────────────── */
.settings-disclaimer {
  font-size: 13px; line-height: 1.65; color: var(--muted);
  text-align: center; padding: 0 4px 8px;
}
.settings-about-text {
  font-size: 15px; line-height: 1.7; color: var(--text-mid);
  padding: 2px 0 4px;
}

/* ─── ポイント・精算参照テーブル ────────────── */
.pt-table { padding-bottom: 2px; }
.pt-section-hd {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 10px 16px 4px;
}
.pt-cash-hd {
  font-size: 13px; font-weight: 700; color: var(--money);
  background: var(--pt-cash-hd-bg, rgba(139,105,20,.08));
  padding: 9px 16px; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
  margin-top: 6px; letter-spacing: .04em;
}
.pt-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--divider);
}
.pt-row:last-of-type { border-bottom: none; }
.pt-row-multi { flex-direction: column; gap: 6px; }
.pt-label { font-size: 15px; color: var(--text-mid); flex: 1; line-height: 1.4; }
.pt-cond  { font-size: 12px; color: var(--muted); margin-left: 2px; }
.pt-sup   { font-size: 10px; vertical-align: super; margin-left: 1px; color: var(--muted); }
.pt-val   { font-family: var(--font-num); font-size: 15px; font-weight: 700; white-space: nowrap; }
.pt-point { color: var(--accent-ink); }
.pt-cash  { color: var(--money); }
.pt-cash-note { font-size: 13px; }
.pt-tiers { display: flex; flex-direction: column; gap: 4px; width: 100%; padding-left: 4px; }
.pt-tier  {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-mid);
}
.pt-tier span:nth-child(2) { flex: 1; }
.pt-tier .pt-cash { text-align: right; white-space: nowrap; }
.pt-tier-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px; font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--money); border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.pt-footnotes {
  padding: 10px 16px 12px; border-top: 1px solid var(--divider);
  display: flex; flex-direction: column; gap: 4px;
}
.pt-fn { font-size: 12px; color: var(--muted); line-height: 1.55; }

/* ─── import button pulse (post-wizard) ─────── */
@keyframes importPulse { 0%,100%{filter:brightness(1)} 50%{filter:brightness(1.18)} }
.btn-import-highlight { animation: importPulse .9s ease-in-out 4; }

/* ─── 日別精算金額（リスト/グリッド） ──────── */
.day-settle { font-family: var(--font-num); font-size: 12px; font-weight: 700; color: var(--money); margin-top: 1px; }
.cc-settle { font-family: var(--font-num); font-size: 8px; font-weight: 700; color: var(--money); text-align: center; }

/* ─── URL一括読み込みストリップ ─────────────── */
.url-import-strip { padding: 10px 16px; border-bottom: 1px solid var(--divider); display: flex; align-items: center; gap: 8px; }
.btn-url-txt-import { padding: 9px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; font-weight: 700; transition: filter .15s; }
.btn-url-txt-import:active { filter: brightness(.92); }
.url-import-hint { font-size: 13px; color: var(--muted); }

/* ─── 年次テーブル 精算列 ───────────────────── */
.month-table td.amt { font-family: var(--font-num); font-weight: 700; color: var(--money); }
.month-table td.amt.empty { color: var(--divider); }
