:root {
  --blue: #1759a7;
  --blue-dark: #0d417f;
  --blue-light: #e9f2ff;
  --text: #172033;
  --muted: #526174;
  --line: #cbd5e1;
  --surface: #ffffff;
  --background: #eef3f8;
  --red: #c62828;
  --red-light: #ffebee;
  --green: #18764b;
  --green-light: #e7f6ed;
  --orange-light: #fff8df;
  --shadow: 0 5px 18px rgba(15, 41, 72, 0.09);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.65;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-user-select: none;
  user-select: none;
}

button {
  cursor: pointer;
}

button:focus,
input:focus,
.timing-option input:focus + span {
  outline: 4px solid rgba(23, 89, 167, 0.28);
  outline-offset: 2px;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 28px);
  max-width: 620px;
  margin: 0 auto;
  padding: 9px 0 8px;
}

.app-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--blue);
}

.app-mark svg {
  width: 30px;
  height: 20px;
}

.app-mark path {
  fill: none;
  stroke: #fff;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-header h1 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.3;
}

.app-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.main-tabs {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: calc(100% - 24px);
  max-width: 620px;
  margin: 8px auto 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 12px rgba(15, 41, 72, 0.08);
}

.main-tab {
  min-width: 0;
  min-height: 48px;
  padding: 5px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.main-tab.is-active {
  border-color: #b9d4f5;
  background: var(--blue-light);
  color: var(--blue-dark);
}

.main-tab span {
  margin-right: 3px;
}

.app-main {
  width: calc(100% - 24px);
  max-width: 620px;
  min-width: 0;
  margin: 0 auto;
  padding: 10px 0 50px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

.view-panel {
  min-width: 0;
  animation: appear 180ms ease-out;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-card,
.form-card,
.test-mode-panel,
.period-card,
.analysis-card,
.health-alert,
.report-action-card,
.calendar-card,
.history-section,
.profile-card,
.backup-card,
.guideline-card,
.chart-card,
.chart-intro {
  border: 1px solid #dce4ed;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.test-mode-panel {
  margin-bottom: 13px;
  padding: 14px;
  border: 3px solid #a06b00;
  background: #fff7d6;
}

.test-mode-panel h2 {
  margin: 0;
  color: #704b00;
  font-size: 1.08rem;
}

.test-mode-panel > p {
  margin: 5px 0 11px;
  color: #5d4a1e;
  font-size: 0.78rem;
  font-weight: 750;
}

.test-scenario-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.test-scenario-buttons button {
  min-height: 50px;
  padding: 7px;
  border: 2px solid #9b761e;
  border-radius: 10px;
  background: #fff;
  color: #573d00;
  font-size: 0.79rem;
  font-weight: 900;
}

.test-checklist {
  margin-top: 10px;
  border-top: 1px solid #ddc67f;
}

.test-checklist summary {
  padding: 10px 2px 5px;
  color: #614500;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.test-checklist ul {
  margin: 5px 0 10px;
  padding-left: 22px;
  color: #50472f;
  font-size: 0.76rem;
  line-height: 1.65;
}

.test-exit-link {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  margin-top: 9px;
  border: 2px solid #6f7780;
  border-radius: 10px;
  background: #fff;
  color: #3d4650;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.intro-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: stretch;
  gap: 2px 10px;
  margin-bottom: 9px;
  padding: 8px 13px 8px 8px;
  border-left: 6px solid var(--blue);
}

.today-label {
  margin: 0;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.current-date-time {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  left: -35px;
  align-self: end;
  margin: 0;
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
}

.current-timing-label {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  min-height: 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 5px;
  border-radius: 13px;
  background: var(--blue-light);
  color: var(--blue-dark);
  line-height: 1.15;
}

.timing-icon {
  font-size: 1.35rem;
}

.timing-text {
  font-size: 1.03rem;
  font-weight: 900;
}

.intro-note {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.record-form {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.edit-notice {
  margin: 0;
  padding: 13px 15px;
  border: 2px solid #98bce4;
  border-radius: 13px;
  background: #eef6ff;
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.form-card {
  min-width: 0;
  padding: 19px 17px 20px;
}

.compact-measurements {
  padding: 10px 12px 12px;
}

.compact-card-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.compact-section + .compact-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #edf1f5;
}

.compact-section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 5px;
  font-size: 0.94rem;
  line-height: 1.25;
}

.compact-section h3 small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.compact-section .heading-icon {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.field-grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.compact-section .field-group {
  margin: 0;
}

.compact-section .field-group > label {
  margin-bottom: 3px;
  font-size: 0.84rem;
  line-height: 1.25;
}

.compact-section .field-group label small {
  display: block;
  font-size: 0.68rem;
  line-height: 1.2;
}

.compact-section .number-input {
  min-height: 53px;
  border-radius: 11px;
}

.compact-section .number-input input {
  padding: 4px;
  font-size: 1.42rem;
}

.compact-section .number-input > span {
  flex-basis: 52px;
  padding: 0 2px;
  font-size: 0.66rem;
}

.pulse-section {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.pulse-section h3 {
  margin: 0;
}

.morning-fields {
  margin-right: -4px;
  margin-left: -4px;
  padding-right: 4px;
  padding-left: 4px;
  border-radius: 10px;
  background: #fffdf6;
}

.form-card h2,
.history-section h2,
.backup-card h2,
.chart-intro h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.4;
}

.measurement-card h2,
.morning-card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 11px;
  border-bottom: 2px solid #edf1f5;
}

.heading-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.heading-icon.red {
  background: var(--red-light);
  color: var(--red);
}

.heading-icon.pink {
  background: #fdebf2;
  color: #ad2256;
}

.heading-icon.green {
  background: var(--green-light);
  color: var(--green);
}

.field-group {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.field-group > label,
.field-group legend {
  display: block;
  margin: 0 0 7px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.field-group label small {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

input[type="date"],
.number-input {
  width: 100%;
  min-height: 61px;
  border: 2px solid #9aa9bb;
  border-radius: 13px;
  background: #fff;
}

input[type="date"] {
  padding: 10px 14px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
}

.number-input {
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.number-input:focus-within,
input[type="date"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(23, 89, 167, 0.13);
}

.number-input input {
  min-width: 0;
  width: 100%;
  padding: 7px 8px 7px 70px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 900;
  text-align: center;
}

.number-input input::placeholder {
  color: #a5b0be;
  opacity: 1;
}

.number-input > span {
  display: flex;
  flex: 0 0 74px;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #d7dee7;
  background: #f7f9fb;
  color: #435164;
  font-size: 0.82rem;
  font-weight: 800;
}

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

.timing-option {
  position: relative;
  min-width: 0;
}

.timing-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.timing-option span {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 2px solid #9aa9bb;
  border-radius: 13px;
  background: #fff;
  color: #334155;
  font-size: 1.08rem;
  font-weight: 900;
}

.timing-option input:checked + span {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue-dark);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.morning-card {
  border-color: #dfd29b;
  background: #fffdf6;
}

.section-help {
  margin: 10px 0 0;
  color: #665929;
  font-size: 0.88rem;
  font-weight: 650;
}

.save-area {
  display: grid;
  gap: 10px;
  margin: 0;
}

.primary-button,
.secondary-button,
.danger-button,
.backup-button {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 15px;
  border-radius: 14px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.primary-button {
  border: 2px solid var(--blue);
  background: var(--blue);
  color: #fff;
  font-size: 1.12rem;
  box-shadow: 0 6px 13px rgba(23, 89, 167, 0.2);
}

.primary-button:active {
  transform: translateY(1px);
  background: var(--blue-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  border: 2px solid #9aa9bb;
  background: #fff;
  color: #344257;
}

.danger-button {
  border: 2px solid #ad1e1e;
  background: #c82e2e;
  color: #fff;
}

.form-message {
  padding: 13px 15px;
  border-radius: 12px;
  font-weight: 800;
}

.error-message {
  border: 2px solid #e1a4a4;
  background: #fff1f1;
  color: #8f1717;
}

.warning-message {
  border-color: #dbb34f;
  background: #fff8df;
  color: #654d10;
}

.history-section {
  margin-top: 18px;
  padding: 18px 16px;
}

.profile-card,
.backup-card,
.guideline-card {
  margin-top: 18px;
  padding: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 11px;
  border-bottom: 2px solid #edf1f5;
}

.record-count {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.empty-history {
  margin: 0;
  padding: 25px 8px;
  color: var(--muted);
  text-align: center;
}

.history-card {
  padding: 15px;
  border: 2px solid #d7e0e9;
  border-radius: 15px;
  background: #fff;
}

.history-card.is-caution {
  border: 3px solid #d2a729;
  background: #fff9df;
  box-shadow: inset 6px 0 0 #d2a729;
}

.history-card.is-danger {
  border: 3px solid #cf4242;
  background: #fff0f0;
  box-shadow: inset 6px 0 0 #cf4242;
}

.history-card.is-caution .vital-primary {
  color: #6d5100;
}

.history-card.is-danger .vital-primary {
  color: #991f1f;
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.history-date {
  font-size: 1rem;
  font-weight: 900;
}

.history-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.history-alert-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.history-alert-badge.caution {
  background: #e4b92f;
  color: #382900;
}

.history-alert-badge.danger {
  background: #b92727;
  color: #fff;
}

.timing-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 900;
}

.timing-badge.morning {
  background: #fff0bd;
  color: #755500;
}

.timing-badge.night {
  background: #e7e9ff;
  color: #30387c;
}

.vital-primary {
  margin: 0;
  color: #1f2937;
  font-size: 1.25rem;
  font-weight: 900;
}

.vital-primary small {
  color: var(--muted);
  font-size: 0.72rem;
}

.vital-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin: 5px 0 0;
  color: #415066;
  font-size: 0.88rem;
  font-weight: 700;
}

.history-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 13px;
}

.history-actions button {
  min-height: 50px;
  border-radius: 11px;
  font-weight: 850;
}

.edit-button {
  border: 2px solid #84acd9;
  background: #eef6ff;
  color: var(--blue-dark);
}

.delete-button {
  border: 2px solid #e3aaaa;
  background: #fff3f3;
  color: #a11f1f;
}

.profile-card summary,
.guideline-card summary,
.backup-card summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.profile-card summary::-webkit-details-marker,
.guideline-card summary::-webkit-details-marker,
.backup-card summary::-webkit-details-marker {
  display: none;
}

.profile-body {
  padding: 14px 16px 16px;
  border-top: 1px solid #e2e8f0;
}

.profile-note {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 0.8rem;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.profile-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 10px;
}

.profile-field label {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 850;
}

.profile-field > input,
.profile-number-input {
  width: 100%;
  min-height: 54px;
  border: 2px solid #9aa9bb;
  border-radius: 12px;
  background: #fff;
}

.profile-field > input {
  padding: 8px 10px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.profile-number-input {
  display: flex;
  overflow: hidden;
}

.profile-number-input input {
  min-width: 0;
  width: 100%;
  padding: 6px;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
}

.profile-number-input span {
  display: flex;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #d7dee7;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.profile-field > input:focus,
.profile-number-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(23, 89, 167, 0.13);
}

.profile-save-button {
  min-height: 54px;
  padding: 10px 14px;
  border: 2px solid var(--blue);
  border-radius: 13px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.profile-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 15px;
}

.profile-results > div {
  padding: 9px 5px;
  border: 1px solid #dbe4ee;
  border-radius: 11px;
  background: #f7fafc;
  text-align: center;
}

.profile-results span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
}

.profile-results strong {
  display: block;
  margin-top: 2px;
  color: var(--blue-dark);
  font-size: 0.88rem;
  line-height: 1.3;
}

.summary-state {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.76rem;
}

.backup-card[open] .summary-state,
.guideline-card[open] .summary-state {
  font-size: 0;
}

.backup-card[open] .summary-state::after,
.guideline-card[open] .summary-state::after {
  content: "閉じる";
  font-size: 0.76rem;
}

.backup-body {
  padding: 0 16px 16px;
  border-top: 1px solid #e2e8f0;
}

.backup-body > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.89rem;
}

.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.backup-button {
  border: 2px solid #80a9d7;
  background: #eef6ff;
  color: var(--blue-dark);
  font-size: 0.91rem;
}

.backup-button:active {
  background: #dcecff;
}

.backup-note {
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--orange-light);
  color: #63501d !important;
  font-weight: 700;
}

.backup-danger-zone {
  margin-top: 16px;
  border-top: 1px dashed #c5d0dc;
  padding-top: 12px;
}

.backup-danger-zone > summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}

.backup-danger-zone > summary::-webkit-details-marker {
  display: none;
}

.backup-danger-zone > summary::before {
  content: "▸ ";
  color: #9aa8b8;
}

.backup-danger-zone[open] > summary::before {
  content: "▾ ";
}

.backup-danger-body {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f7f8fa;
  border: 1px solid #e2e7ee;
}

.clear-all-button {
  width: 100%;
  margin-top: 10px;
  min-height: 2.6rem;
  border-radius: 10px;
  border: 1px solid #c9a4a4;
  background: #fff;
  color: #8a4b4b;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.clear-all-button:active {
  background: #f8eeee;
}

.backup-clear-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.period-card,
.analysis-card,
.health-alert {
  margin-top: 14px;
  padding: 15px 14px;
}

.period-card h3,
.analysis-card h3,
.health-alert h3 {
  margin: 0 0 11px;
  font-size: 1.05rem;
}

.period-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.period-buttons button {
  min-width: 0;
  min-height: 50px;
  padding: 7px 3px;
  border: 2px solid #8da5bf;
  border-radius: 11px;
  background: #f5f8fb;
  color: #34445a;
  font-size: 0.84rem;
  font-weight: 850;
}

.period-buttons button.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.custom-period {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding: 11px;
  border-radius: 12px;
  background: #f2f6fb;
}

.custom-period[hidden] {
  display: none;
}

.custom-period label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.custom-period input {
  width: 100%;
  min-height: 50px;
  padding: 6px;
  border: 2px solid #9aa9bb;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 800;
}

.custom-period button {
  grid-column: 1 / -1;
  min-height: 50px;
  border: 2px solid var(--blue);
  border-radius: 11px;
  background: #eef6ff;
  color: var(--blue-dark);
  font-weight: 900;
}

.period-summary {
  margin: 10px 0 0;
  color: var(--blue-dark);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.period-error {
  margin: 9px 0 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fff0f0;
  color: #921f1f;
  font-size: 0.8rem;
  font-weight: 800;
}

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

.analysis-grid > div {
  padding: 10px 7px;
  border: 1px solid #d8e2ed;
  border-radius: 11px;
  background: #f7fafc;
  text-align: center;
}

.analysis-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.analysis-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--blue-dark);
  font-size: 1rem;
  line-height: 1.3;
}

.analysis-grid > div > small {
  display: block;
  margin-top: 3px;
  color: #536174;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.3;
}

.bp-stack {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.bp-stack strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-top: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.bp-stack strong small {
  color: #536174;
  font-size: 0.68rem;
  font-weight: 800;
}

.bp-stack strong span {
  display: inline;
  color: var(--blue-dark);
  font-size: 1rem;
  font-weight: 900;
}

.bp-stack.bp-pressure {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
}

.bp-stack.bp-pressure .bp-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-top: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.bp-stack.bp-pressure .bp-number {
  display: inline-flex;
  align-items: baseline;
  color: var(--blue-dark);
  font-size: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.bp-stack.bp-pressure .bp-int,
.bp-stack.bp-pressure .bp-dot,
.bp-stack.bp-pressure .bp-frac {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.bp-stack.bp-pressure .bp-int {
  min-width: 3ch;
  text-align: right;
}

.bp-stack.bp-pressure .bp-number.is-empty .bp-int {
  min-width: 0;
  text-align: left;
}

.analysis-trend {
  margin: 11px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--blue-light);
  color: #263d58;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.55;
}

.report-action-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
  padding: 16px 14px;
  border-color: #9bbce1;
  background: #f3f8ff;
}

.report-action-card h3 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 1.05rem;
}

.report-action-card p {
  margin: 6px 0 0;
  color: #47566a;
  font-size: 0.78rem;
  line-height: 1.5;
}

.report-action-card button {
  min-height: 54px;
  padding: 9px 14px;
  border: 2px solid #15589f;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 0.94rem;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(23, 89, 167, 0.2);
}

.print-report {
  display: none;
}

.health-alert {
  border-width: 2px;
}

.health-alert.is-ok {
  border-color: #8ec9aa;
  background: #f1fbf5;
}

.health-alert.is-caution {
  border-color: #d7af42;
  background: #fff9e5;
}

.health-alert.is-danger {
  border-color: #d96868;
  background: #fff0f0;
}

.health-alert.is-ok h3 {
  color: #17643f;
}

.health-alert.is-caution h3 {
  color: #785b09;
}

.health-alert.is-danger h3 {
  color: #991f1f;
}

.health-alert-message {
  margin: 7px 0 0;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.55;
}

.health-alert-note {
  margin: 11px 0 0;
  padding-top: 9px;
  border-top: 1px solid rgba(80, 96, 114, 0.22);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.guideline-body {
  padding: 3px 16px 14px;
  border-top: 1px solid #e2e8f0;
}

.guideline-body p {
  margin: 10px 0 0;
  color: #445266;
  font-size: 0.78rem;
  line-height: 1.6;
}

.record-display-label {
  margin: 12px 4px 0;
  color: #34465b;
  font-size: 1rem;
  font-weight: 900;
}

.record-display-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 6px;
  padding: 5px;
  border: 1px solid #cfdae6;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.record-display-tabs button {
  display: flex;
  min-height: 58px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 8px 5px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f2f5f8;
  color: #435164;
  font-size: 0.9rem;
  font-weight: 900;
}

.record-display-tabs button.is-active {
  border-color: #73a8e3;
  background: var(--blue-light);
  color: var(--blue-dark);
}

.record-display-tabs button.is-active::after {
  content: "選択中";
  margin-top: 2px;
  font-size: 0.7rem;
  line-height: 1;
}

.calendar-panel {
  margin-top: 12px;
}

.calendar-card {
  padding: 13px 10px 12px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 7px;
}

.calendar-toolbar h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.12rem;
  text-align: center;
}

.calendar-toolbar button,
.current-month-button {
  min-height: 48px;
  border: 2px solid #8da5bf;
  border-radius: 10px;
  background: #f5f8fb;
  color: var(--blue-dark);
  font-weight: 900;
}

.calendar-toolbar button {
  padding: 0;
  font-size: 1.55rem;
}

.current-month-button {
  display: block;
  min-height: 42px;
  margin: 8px auto 10px;
  padding: 5px 18px;
  font-size: 0.78rem;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.calendar-weekdays {
  margin-bottom: 4px;
}

.calendar-weekdays span {
  color: #586579;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.calendar-weekdays span:first-child {
  color: #ad2f2f;
}

.calendar-weekdays span:last-child {
  color: #235fa2;
}

.calendar-day,
.calendar-empty-day {
  min-width: 0;
  min-height: 55px;
  border-radius: 9px;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 1px 3px;
  border: 2px solid #d8e1eb;
  background: #fff;
  color: var(--text);
}

.calendar-day:nth-child(7n + 1) .calendar-day-number {
  color: #ad2f2f;
}

.calendar-day:nth-child(7n) .calendar-day-number {
  color: #235fa2;
}

.calendar-day.has-records {
  border-color: #76a9df;
  background: #eef6ff;
}

.calendar-day.is-caution {
  border-color: #d2a729;
  background: #fff6cc;
}

.calendar-day.is-danger {
  border-color: #cf4242;
  background: #ffe7e7;
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.calendar-day.is-selected {
  outline: 3px solid #173e70;
  outline-offset: 1px;
}

.calendar-day-number {
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
}

.calendar-day-marks {
  min-height: 17px;
  font-size: 0.67rem;
  line-height: 1;
  letter-spacing: -2px;
  white-space: nowrap;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 11px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.calendar-legend .caution,
.calendar-legend .danger {
  padding: 1px 6px;
  border-radius: 999px;
}

.calendar-legend .caution {
  background: #e4b92f;
  color: #382900;
}

.calendar-legend .danger {
  background: #b92727;
  color: #fff;
}

.calendar-history {
  margin-top: 12px;
}

.selected-date-label {
  margin: 10px 0 0;
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
}

.chart-card {
  margin-top: 14px;
  padding: 17px 13px;
}

.chart-card h3 {
  margin: 0 4px;
  font-size: 1.08rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
  margin: 10px 4px;
  color: #435164;
  font-size: 0.78rem;
  font-weight: 750;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  display: inline-block;
  width: 22px;
  height: 4px;
  border-radius: 4px;
}

.legend-line.sys {
  background: #cf3030;
}

.legend-line.dia {
  background: #1769c2;
}

.legend-line.pulse {
  background: #a12a70;
}

.legend-line.morning-sys {
  background: #e32626;
}

.legend-line.morning-dia {
  height: 0;
  border-top: 4px dashed #f3a20a;
  background: transparent;
}

.legend-line.night-sys {
  background: #162d78;
}

.legend-line.night-dia {
  height: 0;
  border-top: 4px dashed #168a86;
  background: transparent;
}

.legend-line.morning-pulse {
  background: #2aa66a;
}

.legend-line.night-pulse {
  background: #1b2f78;
}

.canvas-wrap {
  position: relative;
  min-height: 285px;
  overflow-x: auto;
}

.canvas-wrap.pulse {
  min-height: 250px;
}

.canvas-wrap.small {
  min-height: 230px;
}

.canvas-wrap canvas {
  max-width: none;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.empty-chart {
  margin: 20px 0;
  color: var(--muted);
  text-align: center;
}

.back-to-form {
  width: 100%;
  margin-top: 17px;
}

.status-toast {
  position: fixed;
  z-index: 60;
  right: 14px;
  bottom: 18px;
  left: 14px;
  display: flex;
  max-width: 560px;
  min-height: 66px;
  align-items: center;
  gap: 11px;
  margin: auto;
  padding: 13px 17px;
  border: 2px solid #77c498;
  border-radius: 15px;
  background: #145b3c;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  font-size: 1rem;
  font-weight: 850;
}

.status-toast.is-error {
  border-color: #ef9999;
  background: #8f1d1d;
}

#statusIcon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.15rem;
}

.dialog-backdrop {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 25, 42, 0.62);
}

.confirm-dialog {
  width: 100%;
  max-width: 390px;
  padding: 24px 20px 20px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: var(--red-light);
  color: var(--red);
  font-size: 1.45rem;
  font-weight: 900;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.18rem;
}

.confirm-dialog p {
  margin: 7px 0 0;
  color: var(--muted);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.noscript-message {
  margin: 20px;
  padding: 16px;
  border: 2px solid #e3aaaa;
  background: #fff3f3;
  color: #8f1717;
  font-weight: 800;
}

@media (max-width: 360px) {
  html {
    font-size: 17px;
  }

  .header-inner,
  .main-tabs,
  .app-main {
    width: calc(100% - 18px);
  }

  .app-header h1 {
    font-size: 1.08rem;
  }

  .app-header p {
    display: none;
  }

  .app-mark {
    width: 38px;
    height: 38px;
  }

  .form-card,
  .history-section {
    padding-right: 13px;
    padding-left: 13px;
  }

  .intro-note {
    display: block;
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .compact-measurements.has-morning-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 6px;
  }

  .compact-measurements.has-morning-fields > .compact-section:first-of-type {
    grid-column: 1 / -1;
  }

  .compact-measurements.has-morning-fields .pulse-section {
    grid-column: 1;
    display: block;
  }

  .compact-measurements.has-morning-fields .pulse-section h3 {
    margin-bottom: 3px;
    font-size: 0.8rem;
  }

  .compact-measurements.has-morning-fields .morning-fields {
    grid-column: 2 / 4;
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
    background: transparent;
  }

  .compact-measurements.has-morning-fields .morning-fields h3 {
    display: none;
  }

  .compact-measurements.has-morning-fields .number-input {
    min-height: 48px;
  }

  .compact-measurements.has-morning-fields .number-input input {
    padding: 3px;
    font-size: 1.18rem;
  }

  .compact-measurements.has-morning-fields .number-input > span {
    flex-basis: 36px;
    font-size: 0.54rem;
  }

  .compact-measurements.has-morning-fields .field-grid-two {
    gap: 6px;
  }

  .number-input input {
    padding-left: 50px;
  }

  .backup-actions {
    grid-template-columns: 1fr;
  }

  .profile-fields,
  .profile-results {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  html,
  body {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: #fff;
    color: #172231;
    font-family: "Yu Gothic", "Meiryo", sans-serif;
    font-size: 10pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body > *:not(.print-report) {
    display: none !important;
  }

  .print-report {
    display: block !important;
    width: 190mm;
    max-width: 100%;
    margin: 0;
  }

  .print-report-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14mm;
    padding-bottom: 4mm;
    border-bottom: 2.5px solid #1759a7;
  }

  .print-report-kicker {
    margin: 0 0 1mm;
    color: #1759a7;
    font-size: 9pt;
    font-weight: 800;
  }

  .print-report-header h1 {
    margin: 0;
    color: #183b66;
    font-size: 20pt;
    line-height: 1.2;
  }

  .print-report-meta {
    flex: 0 0 auto;
    text-align: right;
  }

  .print-report-meta p {
    margin: 1mm 0 0;
    color: #4b596b;
    font-size: 8.5pt;
  }

  .print-report-section {
    margin-top: 5mm;
  }

  .print-report-section > h2 {
    margin: 0 0 2.5mm;
    padding: 1.7mm 2.5mm;
    border-left: 4px solid #1759a7;
    background: #edf5ff;
    color: #183b66;
    font-size: 12pt;
    line-height: 1.25;
  }

  .print-profile-grid,
  .print-summary-grid {
    display: grid;
    gap: 2mm;
  }

  .print-profile-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .print-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .print-profile-grid > div,
  .print-summary-grid > div {
    padding: 2.5mm;
    border: 1px solid #cdd8e5;
    border-radius: 2mm;
    background: #f8fafc;
    text-align: center;
  }

  .print-profile-grid span,
  .print-summary-grid span {
    display: block;
    color: #536174;
    font-size: 8pt;
    font-weight: 700;
  }

  .print-profile-grid strong,
  .print-summary-grid strong {
    display: block;
    margin-top: 1mm;
    color: #173e70;
    font-size: 11pt;
    line-height: 1.3;
  }

  .print-summary-grid small {
    display: block;
    margin-top: 0.8mm;
    color: #536174;
    font-size: 7.5pt;
    line-height: 1.3;
  }

  .print-summary-grid .bp-stack {
    display: grid;
    gap: 0.6mm;
    margin-top: 1mm;
  }

  .print-summary-grid .bp-stack strong {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1.2mm;
    margin-top: 0;
    font-size: 10.5pt;
    line-height: 1.2;
  }

  .print-summary-grid .bp-stack strong small {
    display: inline;
    margin-top: 0;
    color: #536174;
    font-size: 7.5pt;
    font-weight: 800;
  }

  .print-summary-grid .bp-stack strong span {
    display: inline;
    color: #173e70;
    font-size: 11pt;
    font-weight: 900;
  }

  .print-summary-grid .bp-stack.bp-pressure {
    display: grid;
    justify-items: center;
    gap: 0.5mm;
    width: 100%;
  }

  .print-summary-grid .bp-stack.bp-pressure .bp-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1.2mm;
    margin-top: 0;
    font-size: 10.5pt;
    line-height: 1.2;
  }

  .print-summary-grid .bp-stack.bp-pressure .bp-number {
    display: inline-flex;
    align-items: baseline;
    color: #173e70;
    font-size: 11pt;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
  }

  .print-summary-grid .bp-stack.bp-pressure .bp-int,
  .print-summary-grid .bp-stack.bp-pressure .bp-dot,
  .print-summary-grid .bp-stack.bp-pressure .bp-frac {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
  }

  .print-summary-grid .bp-stack.bp-pressure .bp-int {
    min-width: 3ch;
    text-align: right;
  }

  .print-summary-grid .bp-stack.bp-pressure .bp-number.is-empty .bp-int {
    min-width: 0;
    text-align: left;
  }

  .print-report-text {
    margin: 2.5mm 0 0;
    padding: 2.5mm 3mm;
    border-radius: 2mm;
    background: #f3f7fb;
    font-size: 9pt;
    font-weight: 700;
    line-height: 1.55;
  }

  .print-alert-section {
    padding: 0 3mm 3mm;
    border: 1.5px solid #91c7a9;
    border-radius: 2.5mm;
    background: #f2fbf6;
    break-inside: avoid;
  }

  .print-alert-section > h2 {
    margin-right: -3mm;
    margin-left: -3mm;
  }

  .print-alert-section.is-caution {
    border-color: #d0a52b;
    background: #fff9df;
  }

  .print-alert-section.is-danger {
    border-color: #cc4a4a;
    background: #fff0f0;
  }

  .print-alert-section p {
    margin: 2mm 0 0;
    font-size: 8.5pt;
    font-weight: 700;
    line-height: 1.5;
  }

  .print-chart-section {
    break-inside: avoid;
  }

  .print-chart-legend {
    display: flex;
    gap: 6mm;
    margin: 0 0 1.5mm 3mm;
    color: #425065;
    font-size: 8pt;
    font-weight: 700;
  }

  .print-chart-legend span {
    display: flex;
    align-items: center;
    gap: 1.5mm;
  }

  .print-chart-section img {
    display: block;
    width: 100%;
    max-height: 86mm;
    object-fit: contain;
    border: 1px solid #d6dfe9;
    border-radius: 2mm;
  }

  .print-table-section {
    break-before: page;
  }

  .print-table-section table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8pt;
  }

  .print-table-section thead {
    display: table-header-group;
  }

  .print-table-section tr {
    break-inside: avoid;
  }

  .print-table-section th,
  .print-table-section td {
    padding: 1.5mm 1mm;
    border: 1px solid #bfcbd8;
    text-align: center;
    vertical-align: middle;
  }

  .print-table-section th {
    background: #dcecff;
    color: #183b66;
    font-weight: 900;
  }

  .print-table-section tbody tr:nth-child(even) {
    background: #f7f9fb;
  }

  .print-table-section tbody tr.is-caution {
    background: #fff5c9;
  }

  .print-table-section tbody tr.is-danger {
    background: #ffe1e1;
    color: #8d1717;
    font-weight: 800;
  }

  .print-report-footer {
    margin-top: 5mm;
    padding-top: 3mm;
    border-top: 1px solid #9aa8b8;
    color: #536174;
    font-size: 7.5pt;
    line-height: 1.5;
  }

  .print-report-footer p {
    margin: 1mm 0 0;
  }
}
