:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --paper: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }

/* iOSの「ダブルタップ拡大」の誤発動を防ぐ */
button, input, label, select, textarea { touch-action: manipulation; }

/* 日本語の折り返しは文節単位(ゼロ幅スペースと句読点の後)だけに制限する */
.lead, .note, .status, .field-label, .brand, .state-chip { word-break: keep-all; overflow-wrap: anywhere; }

.shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.brand {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  text-align: center;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.45;
  margin: 0 0 10px;
  text-align: center;
}

.lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  margin: 0 auto 20px;
  max-width: 440px;
  text-align: center;
}

/* ========== 打刻画面 ========== */

.clock-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 16px 18px;
  text-align: center;
}

.clock-date {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.clock-time {
  font-size: 58px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 4px 0 12px;
  font-variant-numeric: tabular-nums;
}

.state-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 16px;
}

.state-chip[data-state="working"] { border-color: var(--ok); color: var(--ok); }
.state-chip[data-state="break"] { border-color: var(--warn); color: var(--warn); }
.state-chip[data-state="done"] { border-color: var(--muted); color: var(--muted); }

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.action {
  border-radius: 14px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  min-height: 60px;
  padding: 16px;
  width: 100%;
}

.primary-action {
  background: var(--ink);
  border: 0;
  color: #ffffff;
}

.sub-action {
  background: #ffffff;
  border: 1px solid #cfcfcf;
  color: var(--ink);
  font-size: 16px;
  min-height: 50px;
}

.action:disabled { cursor: default; opacity: 0.42; }

.status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  min-height: 22px;
  padding-top: 14px;
  text-align: center;
  white-space: pre-line;
}

.status.error { color: var(--danger); }

/* ========== 共通パネル ========== */

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-top: 16px;
  padding: 18px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
}

.summary { display: grid; }

.summary-row {
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  line-height: 2;
}

.summary-row.total {
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 800;
  margin-top: 6px;
  padding-top: 8px;
}

.timeline {
  border-top: 1px dashed var(--line);
  list-style: none;
  margin: 12px 0 0;
  padding: 10px 0 0;
}

.timeline-item {
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  line-height: 1.9;
}

.links {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
}

.link-button {
  border: 1px solid #cfcfcf;
  border-radius: 12px;
  color: var(--ink);
  display: block;
  font-size: 14px;
  font-weight: 600;
  padding: 13px 8px;
  text-align: center;
  text-decoration: none;
}

.links .link-button:only-child { grid-column: 1 / -1; }

/* ========== 日報フォーム ========== */

.field { margin-bottom: 18px; }

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
}

.field-label .required {
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  background: #ffffff;
  border: 1px solid #cfcfcf;
  border-radius: 11px;
  padding: 12px;
  width: 100%;
}

.field textarea { line-height: 1.7; resize: vertical; }

.field-check {
  align-items: center;
  display: flex;
  gap: 10px;
  font-size: 14px;
}

.field-check input { height: 20px; width: 20px; }

.primary {
  background: var(--ink);
  border: 0;
  border-radius: 13px;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  min-height: 52px;
  padding: 14px 18px;
  width: 100%;
}

.primary:disabled { cursor: default; opacity: 0.42; }

.sticky-action {
  background: linear-gradient(to top, var(--paper) 74%, transparent);
  bottom: 0;
  margin: 0 -16px;
  padding: 22px 16px 14px;
  position: sticky;
}

.note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

/* ========== 履歴 ========== */

.month-nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.month-nav a {
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  color: var(--ink);
  font-size: 13px;
  padding: 8px 14px;
  text-decoration: none;
}

.month-nav .month-label { font-size: 16px; font-weight: 700; }

.day-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px 10px;
  grid-template-columns: 62px 1fr auto;
  padding: 11px 0;
}

.day-row:last-child { border-bottom: 0; }

.day-date { font-size: 14px; font-weight: 700; }
.day-date.holiday { color: var(--danger); }
.day-times { color: var(--muted); font-size: 13px; }
.day-total { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.day-flags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
}

.tag.warn { background: #fef0c7; color: var(--warn); }
.tag.done { background: #ecfdf3; color: var(--ok); }

@media (max-width: 380px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 15px; }
  .clock-time { font-size: 50px; }
}
