* {
  box-sizing: border-box;
}
:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Segoe UI", sans-serif;
  color: #1b3436;
  background: #f3f6f4;
  font-synthesis: none;
  line-height: 1.65;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #b76c12;
  outline-offset: 3px;
}
button {
  min-height: 46px;
  border: 1px solid #cbd7d2;
  border-radius: 12px;
  padding: 10px 16px;
  background: #fff;
  color: #1b3436;
  font-weight: 650;
}
button:hover:not(:disabled) {
  background: #e6eeea;
}
a {
  color: #0d6659;
}
.primary {
  background: #146b59;
  color: #fff;
  border-color: #146b59;
}
.primary:hover:not(:disabled) {
  background: #0c5546;
}
.secondary {
  background: #eef3ef;
}
.quiet {
  border: 0;
  background: transparent;
  padding: 5px 10px;
}
.full {
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: #146b59;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 21px;
  font-weight: 800;
}
.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.11em;
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #607873;
}
.header {
  max-width: 1020px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  gap: 10px;
}
.identity {
  font-size: 13px;
  color: #516762;
  text-align: right;
}
.demo-banner {
  background: #e7ede6;
  color: #4c614c;
  text-align: center;
  padding: 7px 18px;
  font-size: 12px;
  border-bottom: 1px solid #d9e2d8;
}
.shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px 24px 120px;
}
.eyebrow {
  font-size: 11px;
  color: #627f77;
  letter-spacing: 0.16em;
  font-weight: 750;
  margin: 0 0 7px;
}
h1 {
  font-size: 28px;
  letter-spacing: 0.03em;
  margin: 0 0 7px;
  line-height: 1.4;
}
h2 {
  font-size: 18px;
  margin: 0 0 15px;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
p {
  margin: 0 0 12px;
}
.muted {
  color: #5d746e;
  font-size: 13px;
}
.heading {
  margin-bottom: 24px;
}
.card {
  background: white;
  border: 1px solid #dfe7e1;
  border-radius: 18px;
  padding: 24px;
  margin: 0 0 18px;
  box-shadow: 0 4px 18px #213e3004;
}
.login {
  max-width: 440px;
  margin: 50px auto;
}
.login h1 {
  margin-bottom: 18px;
}
.login button {
  display: block;
  width: 100%;
  margin-top: 12px;
  text-align: left;
  padding: 15px 18px;
}
.badge {
  display: inline-block;
  border-radius: 7px;
  background: #e6f1e9;
  color: #17684b;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}
.steps {
  display: flex;
  gap: 8px;
  margin: 22px 0;
  list-style: none;
  padding: 0;
  font-size: 12px;
}
.steps li {
  flex: 1;
  padding: 10px 5px;
  border-bottom: 3px solid #dde5df;
  color: #6a7a72;
}
.steps .active {
  color: #146b59;
  border-color: #146b59;
  font-weight: 750;
}
.field {
  display: block;
  margin-bottom: 20px;
  min-width: 0;
}
.field-label,
legend {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
}
.field-hint {
  display: block;
  font-size: 12px;
  color: #66786f;
  margin-top: 5px;
}
input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid #becdc4;
  background: #fcfdfb;
  color: #233f33;
  border-radius: 10px;
  padding: 10px 12px;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
fieldset {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
  min-width: 0;
}
legend {
  padding: 0;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.segmented {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}
.segmented button {
  flex: 1;
  font-size: 13px;
  padding: 8px;
}
.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 10px 6px;
  background: #fafcf9;
  border: 1px solid #cbd7d2;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}
.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.choice:has(input:checked) {
  border: 2px solid #146b59;
  color: #146b59;
  background: #ecf5ed;
  font-weight: 750;
}
.choice:has(input:focus-visible) {
  outline: 3px solid #b76c12;
  outline-offset: 2px;
}
.check {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.check input {
  width: 23px;
  min-height: 23px;
  accent-color: #146b59;
}
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.actions > * {
  flex: 1;
}
.notice {
  border: 1px solid #dddfc9;
  background: #f8f8ee;
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 13px;
  color: #66602b;
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}
.error {
  color: #852f26;
  background: #fff2ee;
  border-color: #e9b7aa;
}
.success {
  color: #146b59;
  background: #eaf4ec;
  border-color: #afcfba;
}
.loading {
  padding: 18px;
  text-align: center;
  color: #527466;
}
.empty {
  text-align: center;
  padding: 30px 12px;
  color: #63786d;
}
.details {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  margin: 0;
}
.details dt {
  font-size: 13px;
  color: #64766d;
}
.details dd {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.metric {
  background: white;
  border: 1px solid #dfe7e1;
  border-radius: 14px;
  padding: 16px;
}
.metric:first-child {
  background: #146b59;
  color: white;
  border-color: #146b59;
}
.metric-label {
  font-size: 11px;
  opacity: 0.85;
}
.metric-value {
  font-size: 28px;
  font-weight: 750;
  line-height: 1.5;
}
.metric-unit {
  font-size: 12px;
  margin-left: 4px;
}
.metric-note {
  font-size: 11px;
  opacity: 0.85;
}
.record {
  padding: 16px 0;
  border-bottom: 1px solid #e3eae4;
}
.record:first-child {
  padding-top: 0;
}
.record:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.record-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}
.record p {
  font-size: 13px;
  margin: 5px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.record time {
  font-size: 15px;
  font-weight: 750;
}
.record details {
  margin-top: 8px;
  font-size: 13px;
}
.record summary {
  cursor: pointer;
  padding: 8px 0;
  min-height: 44px;
}
.invoice {
  padding: 18px 0;
  border-bottom: 1px solid #e3eae4;
}
.invoice:last-child {
  border: 0;
  padding-bottom: 0;
}
.invoice .primary {
  width: 100%;
  margin-top: 12px;
}
.invoice p {
  font-size: 13px;
  color: #627467;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.toolbar .field {
  flex: 1;
  min-width: 130px;
  margin-bottom: 14px;
}
.toolbar button {
  margin-bottom: 14px;
}
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid #dce6df;
  background: #fffffff2;
  backdrop-filter: blur(10px);
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}
.nav button {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  max-width: 210px;
  border: 0;
  background: none;
  color: #697d72;
  font-size: 13px;
  border-radius: 10px;
}
.nav button[aria-current="page"] {
  background: #e5f0e7;
  color: #12614d;
}
.nav-icon {
  display: block;
  font-size: 20px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.pdf-dialog {
  border: 1px solid #c4d7cc;
  border-radius: 16px;
  padding: 18px;
  width: min(860px, 94vw);
  max-height: 92vh;
}
.pdf-dialog::backdrop {
  background: #173a3266;
}
.pdf-dialog iframe {
  border: 0;
  width: 100%;
  height: 60vh;
  background: #edf1ed;
  margin: 16px 0;
}
.pdf-dialog a {
  display: inline-block;
  min-height: 44px;
  padding: 10px;
}
.staff-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #e4eae5;
  padding: 15px 0;
}
.staff-row p {
  font-size: 12px;
  margin: 3px 0;
}
.staff-row button {
  flex-shrink: 0;
}
.bottom-note {
  font-size: 11px;
  text-align: center;
  color: #6f8076;
  margin-top: 25px;
}
@media (max-width: 520px) {
  .header {
    padding: 16px;
  }
  .shell {
    padding: 24px 16px 115px;
  }
  .identity {
    font-size: 11px;
  }
  .identity button {
    font-size: 11px;
  }
  .card {
    padding: 19px 16px;
    border-radius: 15px;
  }
  .grid2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
  h1 {
    font-size: 25px;
  }
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 12px 9px;
  }
  .metric-value {
    font-size: 25px;
  }
  .metric-label {
    font-size: 10px;
  }
  .metric-note {
    font-size: 10px;
  }
  .details {
    grid-template-columns: 90px 1fr;
  }
  .choices {
    gap: 6px;
  }
  .choice {
    font-size: 12px;
  }
  .login {
    margin: 24px auto;
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar .field {
    min-width: 105px;
  }
  .toolbar button {
    font-size: 12px;
  }
  .staff-row button {
    padding: 8px 11px;
  }
  .actions {
    gap: 8px;
  }
  .actions button {
    font-size: 13px;
  }
  .record-top {
    flex-wrap: wrap;
  }
  .demo-banner {
    font-size: 11px;
  }
}
@media (max-width: 520px) {
  .toolbar .field {
    flex: 1 1 150px;
  }
  .toolbar > button {
    flex: 1 1 100%;
  }
  .field-label {
    cursor: pointer;
  }
  summary {
    min-height: 44px;
    padding: 8px 0;
  }
}

.help-dialog {
  width: min(660px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 1px solid #cbd7d2;
  border-radius: 16px;
  color: #1b3436;
  background: #f3f6f4;
  overflow-y: auto;
}
.help-dialog::backdrop {
  background: #173b3680;
}
.help-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.help-toolbar h2 {
  margin: 0;
}
.help-topic {
  border-top: 1px solid #cbd7d2;
  padding: 12px 0;
}
.help-topic summary {
  cursor: pointer;
  min-height: 44px;
  padding: 8px 0;
  font-weight: 650;
}
.help-topic p {
  margin: 10px 0;
}
.help-topic summary:focus-visible {
  outline: 3px solid #b76c12;
  outline-offset: 2px;
}

.toolbar .month-picker {
  flex: 1 1 220px;
  min-width: 0;
}
.month-picker .field {
  margin: 0;
}
.month-nav {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.month-nav button {
  margin-bottom: 0;
  flex: 1;
  min-height: 44px;
  padding: 10px 8px;
}

.badge.attendance-half {
  color: #744300;
  background: #fff0c9;
}
.badge.attendance-rain {
  color: #8c342c;
  background: #fce5df;
}
.badge.attendance-other {
  color: #4c5660;
  background: #edf0f2;
}
.attendance-filters {
  border-bottom: 1px solid #dfe7e1;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

/* Keep native date controls within their grid cell, including iOS WebKit. */
input[type="date"],
input[type="month"] {
  display: block;
  width: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
input::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.65em;
}
.toolbar > *, .month-picker, .action-grid > * {
  min-width: 0;
}
.pilot-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 16px;
  padding: 6px 16px;
  background: #fff4d9;
  color: #634714;
  border-bottom: 1px solid #e2c887;
  font-size: 13px;
}
.pilot-banner a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 650;
}
.attendance-scope {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 16px;
}
.attendance-scope .field, .attendance-scope > button {
  min-width: 0;
  margin: 0;
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.action-grid button {
  text-align: left;
  font-size: 15px;
}
.muted, .field-hint, .details dt, .empty, .invoice p {
  color: #485f58;
}
.nav button {
  color: #405950;
  font-weight: 700;
}
.nav button[aria-current="page"] {
  background: #146b59;
  color: #fff;
}
@media (max-width: 600px) {
  .header {
    padding: 12px 16px;
    align-items: flex-start;
    gap: 8px;
  }
  .brand { gap: 8px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 12px; letter-spacing: .06em; }
  .identity { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
  .identity button { font-size: 13px; padding: 6px; min-height: 44px; }
  .shell { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); }
  .heading { margin-bottom: 18px; }
  .heading .eyebrow { display: none; }
  h1 { font-size: 26px; line-height: 1.4; }
  h2 { font-size: 19px; }
  .muted, .field-hint, .details dt, .record p { font-size: 14px; }
  .field-label { font-size: 15px; }
  .card { padding: 18px 16px; }
  .toolbar, .attendance-scope {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .toolbar .field, .toolbar .month-picker, .toolbar > button {
    min-width: 0;
    width: 100%;
    margin: 0;
  }
  .toolbar button { font-size: 15px; }
  .month-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .month-nav button { font-size: 14px; }
  .attendance-actions h2 { font-size: 16px; }
  .action-grid button { padding: 12px 10px; font-size: 14px; }
  .attendance-filters .toolbar { margin-bottom: 14px; }
  .nav { padding: 6px 8px max(6px, env(safe-area-inset-bottom)); gap: 4px; }
  .nav button { min-height: 58px; padding: 8px 2px; font-size: 13px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-label, .metric-note { font-size: 12px; opacity: 1; }
  .metric-unit { margin-left: 2px; }
  .details { grid-template-columns: 100px minmax(0, 1fr); }
}
@media (max-width: 359px) {
  .header { flex-wrap: wrap; }
  .identity { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
  .action-grid { grid-template-columns: minmax(0, 1fr); }
  .metric { padding: 12px 6px; }
  .metric-value { font-size: 22px; }
}
