/* MINE — 打刻画面（S1）
   デザインの正本は common/design-md/highdef-tool.md（Direction A）。
   値は mock/screens.html の S1 と一致させてある。トークンは tokens.css。 */

@import url("tokens.css");

/* 端末側の強制ダーク反転を抑止する（ダークモードは提供しない） */
:root { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  /* ホーム画面起動時にフッタがホームインジケータに潜らないようにする */
  padding-bottom: env(safe-area-inset-bottom);
  min-height: 100dvh;
}

/* 数字は等幅に揃える。時刻が横に踊らない */
* { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

button { font-family: inherit; }

.s-center { text-align: center; }

/* ---- ヘッダ ---- */
.s-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 46px; padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: var(--surface); border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--ink-sub);
  position: sticky; top: 0; z-index: 10;
}
.s-head b { color: var(--ink-strong); font-weight: 700; letter-spacing: .04em; }
/* 戻る導線。ヘッダの高さいっぱいを当たり判定にする */
.s-head a {
  display: inline-flex; align-items: center; min-height: 46px;
  color: var(--ink-strong); font-weight: 700; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.s-body { padding: 16px; }

/* ---- 今日の状態 ---- */
.s-ctr { text-align: center; padding: 22px 0 8px; }
.s-date { font-size: 14px; color: var(--ink-muted); }
.s-clock { font-size: 52px; font-weight: 300; letter-spacing: -.02em; color: var(--ink-strong); line-height: 1.15; }

/* 色・記号・日本語ラベルの3点セット（FR-02）。色だけに意味を持たせない */
.s-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 5px 14px;
  border-radius: 999px; font-size: 14px; font-weight: 700;
}
.s-badge i { width: 10px; height: 10px; border-radius: 50%; flex: none; font-style: normal; }
.b-idle  { background: #F4F1EC; border: 1px solid var(--line-strong); color: var(--ink-sub); }
.b-idle i { background: #8A837A; }
.b-work  { background: var(--success-bg); border: 1px solid var(--success-line); color: var(--success-ink); }
.b-work i { background: var(--success); }
.b-break { background: var(--warning-bg); border: 1px solid var(--warning-line); color: var(--warning-ink); }
.b-break i { background: var(--warning); }
.b-done  { background: var(--info-bg); border: 1px solid var(--info-line); color: var(--info); }
.b-done i { background: var(--info); }

.s-lead { font-size: 22px; color: var(--ink-sub); margin-top: 10px; }
.s-note { font-size: 15px; color: var(--ink-sub); margin: 4px 0 0; }

/* ---- 打刻一覧 ---- */
.s-label {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  font-family: var(--font-mono); color: var(--ink-muted); margin: 26px 0 8px;
}
.s-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.s-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.s-row:last-child { border-bottom: 0; }
.s-row b { min-width: 3.8em; font-weight: 700; color: var(--ink-strong); }
.s-row span { flex: 1; color: var(--ink-sub); }
.s-row .s-empty { color: var(--ink-muted); }
.s-row button.s-undo {
  border: 0; background: none; padding: 6px 2px;
  font-size: 13px; color: var(--ink-sub); text-decoration: underline; cursor: pointer;
}

/* ---- 期のヘッダ（S2）----
   「今月」と書かない。締日が人ごとに違うので必ず範囲を併記する（FR-10） */
.s-period {
  background: var(--surface); padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  /* ヘッダは safe-area の分だけ背が伸びるので、その分を足さないと下に潜る */
  position: sticky; top: calc(46px + env(safe-area-inset-top)); z-index: 9;
}
.s-period b { font-size: 17px; color: var(--ink-strong); }
.s-period small { display: block; font-size: 13px; color: var(--warning-ink); margin-top: 2px; }
/* 期の選択。見た目は文字のまま、当たり判定だけ広げる。
   文字の高さ（約27px）のままでは親指に小さすぎるので、
   余白を足して負のマージンで打ち消し、レイアウトを動かさずに44px以上を確保する */
.s-period label {
  position: relative; display: inline-block;
  padding: 9px 4px; margin: -9px -4px;
}
.s-period select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; cursor: pointer; font-size: 16px; /* iOSの自動ズーム抑止 */
}

/* ---- 明細行 ---- */
.s-kv {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.s-kv:last-child { border-bottom: 0; }
.s-kv span { color: var(--ink-sub); }
.s-kv b { font-weight: 700; color: var(--ink-strong); }
.s-kv .sub { font-weight: 400; color: var(--ink-muted); font-size: 13px; margin-left: 8px; }
.s-fine { padding: 0 16px 14px; font-size: 13px; color: var(--ink-muted); line-height: 1.7; }

/* ---- 日次 ---- */
.s-day {
  display: flex; gap: 10px; align-items: baseline;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface); font-size: 15px;
}
.s-day:last-child { border-bottom: 0; }
.s-day b { min-width: 5.2em; color: var(--ink-strong); flex: none; }
.s-day > span { flex: 1; color: var(--ink-sub); }
.s-day.off, .s-day.off b { color: var(--ink-disabled); }
.s-day.miss { border-left: 4px solid var(--danger); background: var(--danger-bg); }
.s-day.lv { border-left: 4px solid var(--info); background: var(--info-bg); }
.s-day u { margin-left: auto; font-size: 13px; color: var(--ink-sub); flex: none; }

/* ---- アラート ---- */
.s-alert {
  padding: 14px 16px; border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface);
  font-size: 15px; margin-bottom: 12px;
}
.s-alert small { display: block; font-size: 13px; margin-top: 4px; opacity: .9; }
.s-alert.dg { border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger-ink); }
.s-alert.wn { border-left-color: var(--warning); background: var(--warning-bg); color: var(--warning-ink); }
.s-alert.sc { border-left-color: var(--success); background: var(--success-bg); color: var(--success-ink); }
.s-alert.if { border-left-color: var(--info); background: var(--info-bg); color: var(--ink-strong); }

/* ---- 打刻ボタン ---- */
.s-foot {
  display: flex; gap: 9px; padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(42, 39, 36, .06);
  position: sticky; bottom: 0;
}
.s-foot > * { flex: 1; }
.s-foot.stack { display: block; }
.s-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 92px; border: 0; border-radius: var(--radius);
  background: var(--primary); color: var(--ink-inverse);
  font-weight: 700; font-size: 20px; letter-spacing: .14em;
  box-shadow: var(--shadow-primary); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.s-btn.gh {
  background: var(--surface); color: var(--primary);
  border: 1.5px solid var(--primary-line);
  box-shadow: 0 1px 2px rgba(42, 39, 36, .05);
  letter-spacing: .05em; font-size: 17px;
}
/* 原則4「確認」: 押した瞬間に沈む。通信の完了を待たない */
.s-btn:active { transform: scale(.985); }
.s-btn[aria-busy="true"] { opacity: .7; pointer-events: none; }

.s-link {
  display: block; width: 100%; text-align: center; padding: 14px 0;
  border: 0; background: none;
  font-size: 13px; color: var(--ink-sub); text-decoration: underline; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
a.s-link { padding: 18px 0; }

/* ---- トースト ---- */
.s-toast {
  position: fixed; left: 10px; right: 10px;
  bottom: calc(112px + env(safe-area-inset-bottom));
  z-index: 30;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--ink-strong); color: #fff; font-size: 15px;
  box-shadow: 0 8px 24px rgba(42, 39, 36, .24);
}
.s-toast.danger { background: var(--danger-ink); }

@media (prefers-reduced-motion: reduce) {
  .s-btn:active { transform: none; }
}
