:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eef2ff;
  --border: #dde3ea;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 4px 20px rgba(26, 35, 50, 0.08);
  --radius: 12px;
  --touch-min: 48px;
  --bottom-nav-h: 64px;
  --sticky-submit-h: 72px;
}

/* 文字サイズ：標準（デフォルト） */
html.font-size-standard {
  font-size: 16px;
}

/* 文字サイズ：大 */
html.font-size-large {
  font-size: 19px;
  --touch-min: 54px;
  --bottom-nav-h: 72px;
  --sticky-submit-h: 80px;
}

/* 文字サイズ：特大 */
html.font-size-xlarge {
  font-size: 22px;
  --touch-min: 62px;
  --bottom-nav-h: 80px;
  --sticky-submit-h: 90px;
  --header-control-min-h: 44px;
}

/* 文字サイズ：超特大 */
html.font-size-xxlarge {
  font-size: 26px;
  --touch-min: 62px;
  --bottom-nav-h: 80px;
  --sticky-submit-h: 90px;
  --header-control-min-h: 42px;
}

html.font-size-xlarge .font-size-control,
html.font-size-xxlarge .font-size-control {
  margin-top: 0.35rem;
  gap: 0.3rem;
}

html.font-size-xlarge .font-size-btn,
html.font-size-xxlarge .font-size-btn {
  min-height: var(--header-control-min-h, 44px);
  padding: 0.35rem 0.25rem;
  font-size: 0.72rem;
}

html.font-size-xlarge .logout-btn,
html.font-size-xxlarge .logout-btn {
  min-height: var(--header-control-min-h, 44px);
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
}

html.font-size-xxlarge .subtitle {
  display: none;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body.has-bottom-nav {
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

.header {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: 0.75rem 1rem 0.85rem;
  position: static;
  z-index: 50;
}

.header-inner {
  max-width: 880px;
  margin: 0 auto;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.subtitle {
  margin: 0.35rem 0 0;
  opacity: 0.9;
  font-size: 0.82rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.82rem;
  opacity: 0.95;
  max-width: 7em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  min-height: var(--touch-min);
}

.font-size-control {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.font-size-label {
  font-size: 0.78rem;
  opacity: 0.9;
}

.font-size-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

@media (max-width: 400px) {
  .font-size-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}

.font-size-btn {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.5rem 0.35rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  touch-action: manipulation;
}

.font-size-btn.active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}

.font-size-control-login {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.font-size-control-login .font-size-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.font-size-control-login .font-size-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.9rem;
}

.font-size-control-login .font-size-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.fixed-value {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--primary-light);
  border-radius: 10px;
  font-weight: 600;
  font-size: 1.1rem;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.5rem 0.75rem 0.75rem;
}

/* デスクトップ用タブ（スマホでは非表示） */
.tabs-desktop {
  display: none;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: var(--surface);
  color: var(--muted);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  min-height: var(--touch-min);
  font-family: inherit;
}

.tab .icon {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

/* スマホ用 下部ナビ */
.bottom-nav {
  display: flex;
  align-items: stretch;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(26, 35, 50, 0.08);
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: var(--bottom-nav-h);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.35rem 0.25rem;
}

.bottom-tab .icon {
  font-size: 1.5rem;
  line-height: 1;
}

.bottom-tab span:last-child {
  font-size: 0.68rem;
  line-height: 1.15;
  text-align: center;
}

.panel-hub.active .card {
  margin-bottom: 0;
}

body.has-bottom-nav .container {
  padding-bottom: 0.75rem;
}

.clocklog-ym-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.clocklog-select {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.clocklog-result-header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.clocklog-result-title {
  margin: 0;
  font-size: 1.15rem;
}

.clocklog-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.clocklog-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.clocklog-time-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.5rem 0.35rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
  text-align: center;
  background: #fff;
  box-sizing: border-box;
}

.clocklog-row-edit .clocklog-in,
.clocklog-row-edit .clocklog-out {
  background: #fff;
  padding: 0.4rem 0.3rem;
}

.clocklog-table-wrap.is-editing .clocklog-row,
.clocklog-table-wrap.is-editing .clocklog-head {
  grid-template-columns: 4.25rem minmax(0, 1fr) minmax(0, 1fr);
}

.clocklog-table-wrap.is-editing .clocklog-date {
  padding: 0.55rem 0.35rem;
  font-size: 0.8rem;
}

.clocklog-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.clocklog-table {
  min-width: 100%;
}

.clocklog-body .empty {
  padding: 1rem;
  margin: 0;
}

.clocklog-row {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--border);
}

.clocklog-row:last-child {
  border-bottom: none;
}

.clocklog-head {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.clocklog-head .clocklog-cell {
  padding: 0.7rem 0.85rem;
}

.clocklog-cell {
  padding: 0.8rem 0.85rem;
  font-size: 0.95rem;
}

.clocklog-date {
  color: var(--text);
  font-weight: 600;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 0.65rem 0.4rem;
}

.clocklog-in {
  text-align: center;
  color: #047857;
  font-weight: 600;
  border-right: 1px solid var(--border);
  background: #f0fdf4;
}

.clocklog-out {
  text-align: center;
  color: #1d4ed8;
  font-weight: 600;
  background: #eff6ff;
}

.clocklog-head .clocklog-in,
.clocklog-head .clocklog-out {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 600;
}

.bottom-tab.active {
  color: var(--primary);
  font-weight: 600;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.task-sub-panel .btn-back-tasks,
.attendance-sub-panel .btn-back-attendance {
  margin-bottom: 0.75rem;
}

.attendance-success-card {
  text-align: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.attendance-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.attendance-success-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.attendance-success-datetime {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.attendance-success-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.attendance-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.attendance-dialog.hidden {
  display: none;
}

.attendance-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.attendance-dialog-box {
  position: relative;
  z-index: 1;
  width: min(100%, 22rem);
  margin: 0;
}

.attendance-dialog-message {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
}

.attendance-dialog-hint {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.attendance-dialog-existing {
  margin: 0 0 1.25rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: var(--surface-muted, #f8fafc);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.attendance-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.attendance-dialog-actions .btn {
  flex: 1 1 0;
}

.task-app-list {
  display: grid;
  gap: 0.65rem;
}

.task-app-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: var(--touch-min);
  touch-action: manipulation;
}

.task-app-card:active,
.task-app-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.task-app-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.task-app-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.task-app-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.task-app-desc {
  font-size: 0.82rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.card h3 {
  margin: 1.25rem 0 0.65rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.card-header h2 {
  margin: 0;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.password-policy-list {
  margin: 0 0 1rem 1.1rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.password-policy-list li {
  margin-bottom: 0.25rem;
}

.field {
  display: block;
  margin-bottom: 1.1rem;
  border: none;
  padding: 0;
  min-width: 0;
}

.label,
legend.label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="date"],
.field input[type="datetime-local"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
  background: #fff;
  min-height: var(--touch-min);
}

.field input[type="date"],
.field input[type="datetime-local"] {
  position: relative;
  cursor: pointer;
}

.field input[type="date"]::-webkit-calendar-picker-indicator,
.field input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.field textarea {
  min-height: 100px;
  margin-top: 0.5rem;
  resize: vertical;
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-with-action input {
  flex: 1;
  min-width: 0;
}

.help {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

/* 出勤/退勤：大きなタップボタン */
.punch-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.punch-toggle label {
  display: block;
  margin: 0;
  font-weight: normal;
}

.punch-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.punch-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--touch-min) + 8px);
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.punch-toggle input[value="出勤"]:checked + .punch-option {
  border-color: #dc2626;
  background: #fee2e2;
  color: #dc2626;
}

.punch-toggle input[value="退勤"]:checked + .punch-option {
  border-color: #059669;
  background: #d1fae5;
  color: #059669;
}

.punch-toggle input[value="出勤"]:focus-visible + .punch-option {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.punch-toggle input[value="退勤"]:focus-visible + .punch-option {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* 支援内容：カード型ラジオ */
.radio-list {
  display: grid;
  gap: 0.55rem;
}

.radio-item {
  display: block;
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.radio-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
}

.radio-item input:checked + .radio-card {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.radio-item input:focus-visible + .radio-card {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: normal;
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.checkbox-field input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

/* 新規顧客登録フォーム */
.badge-required {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #b91c1c;
  background: #fee2e2;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.15rem;
}

.badge-optional {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.15rem;
}

.label-note {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--text);
}

.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 400px) {
  .name-row {
    grid-template-columns: 1fr;
  }
}

.checkbox-list {
  display: grid;
  gap: 0.5rem;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 999px;
  cursor: pointer;
  font-weight: normal;
}

.radio-chip input {
  margin: 0;
}

.feedback-form fieldset {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
}

.feedback-form legend.label {
  margin-bottom: 0.5rem;
}

.survey-response-item .record-head {
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.survey-response-details {
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.65rem;
}

.survey-response-details > div {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
}

.survey-response-details dt {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.88rem;
}

.survey-response-details dd {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.checkbox-item {
  display: block;
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-card {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 0.92rem;
  line-height: 1.4;
}

.checkbox-item input:checked + .checkbox-card {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.radio-inline {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.radio-inline label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: normal;
  min-height: var(--touch-min);
}

.conditional-block {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.field input[type="file"] {
  width: 100%;
  font-size: 0.9rem;
  min-height: auto;
  padding: 0.5rem 0;
}

.pdf-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
}

.pdf-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pdf-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.pdf-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  border-style: solid;
}

.pdf-dropzone-inner {
  padding: 1.25rem 1rem;
  text-align: center;
  pointer-events: none;
}

.pdf-dropzone-icon {
  font-size: 2rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.5rem;
}

.pdf-dropzone-title {
  margin: 0 0 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.pdf-dropzone-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── 顧客サブメニュー ── */
.customer-hub {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.task-subnav,
.customer-subnav {
  display: grid;
  gap: 0.5rem;
}

.task-subnav {
  grid-template-columns: repeat(2, 1fr);
}

#panel-fee-payment .task-subnav {
  grid-template-columns: repeat(3, 1fr);
}

.fee-check-summary {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--primary-light);
  font-weight: 600;
  line-height: 1.6;
}

.fee-check-summary.has-unpaid {
  background: linear-gradient(180deg, #fecaca 0%, #fee2e2 100%);
  border: 2px solid #ef4444;
  color: #991b1b;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.fee-check-summary.has-unpaid strong {
  color: #7f1d1d;
}

.fee-check-target-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0 0.35rem;
  padding: 0.55rem 0.75rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  border-radius: 0 10px 10px 0;
}

.fee-check-target-label {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
}

.fee-check-target-count {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.fee-check-target-count.hint {
  font-weight: 500;
  color: var(--muted, #64748b);
}

.fee-check-member-meta {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: #b91c1c;
  font-weight: 600;
}

.fee-check-member-info {
  margin: 0.85rem 0 0.5rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.fee-check-member-name {
  margin: 0;
  font-size: 1.05rem;
}

.fee-check-member-sub {
  margin: 0.35rem 0 0;
  color: var(--muted, #64748b);
  font-size: 0.9rem;
}

.fee-check-unpaid-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.fee-check-unpaid-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.fee-check-unpaid-row:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.fee-check-unpaid-row input {
  width: 1.15rem;
  height: 1.15rem;
}

.fee-check-unpaid-month {
  font-weight: 700;
}

.fee-check-unpaid-amount {
  font-weight: 700;
  color: #b45309;
}

.fee-check-unpaid-tier {
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}

.fee-check-bank-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.fee-check-bank-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.fee-check-bank-btn {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  min-height: var(--touch-min);
  cursor: pointer;
}

.fee-check-bank-btn:hover,
.fee-check-bank-btn:active {
  border-color: var(--primary);
}

.fee-check-bank-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.fee-check-invoice-actions {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.65rem;
}

.fee-check-select-all {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.fee-check-select-all input {
  width: 1.15rem;
  height: 1.15rem;
}

#btn-fee-check-back {
  margin-bottom: 0.35rem;
}

.fee-check-filters {
  margin-top: 0.35rem;
}

.fee-check-tier-group {
  position: relative;
  margin-top: 0.85rem;
  padding: 1.65rem 0.75rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.fee-check-tier-group + .fee-check-tier-group {
  margin-top: 1rem;
}

.fee-check-tier-mark {
  position: absolute;
  top: 0;
  left: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 0 0 10px 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.fee-check-tier-group[data-tier="2000"] .fee-check-tier-mark {
  background: #2563eb;
}

.fee-check-tier-group[data-tier="3000"] .fee-check-tier-mark {
  background: #7c3aed;
}

.fee-check-tier-group[data-tier="5000"] .fee-check-tier-mark {
  background: #b45309;
}

.fee-check-tier-items {
  display: grid;
  gap: 0.5rem;
}

.fee-check-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.fee-check-item:hover,
.fee-check-item:active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.fee-check-item + .fee-check-item {
  margin-top: 0;
}

.fee-check-tier-items .fee-check-item + .fee-check-item {
  margin-top: 0;
}

.fee-status-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.fee-status-badge.paid {
  background: #d1fae5;
  color: #047857;
}

.fee-status-badge.unpaid {
  background: #fee2e2;
  color: #b91c1c;
}

.customer-subnav {
  grid-template-columns: repeat(2, 1fr);
}

.task-subnav-btn,
.customer-subnav-btn {
  padding: 0.65rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.customer-subnav-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.task-subnav-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.task-subnav-btn.active,
.customer-subnav-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.customer-search-panel {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.customer-search-message {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.customer-result-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.customer-result-tab {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 100%;
  text-align: left;
  line-height: 1.35;
}

.customer-result-tab:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.customer-result-tab.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.task-app-hub {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.task-form-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-edit-panel {
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.task-edit-search-btn {
  width: 100%;
  margin-top: 0.25rem;
}

.task-edit-message {
  margin: 0.65rem 0 0;
}

.task-edit-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.65rem;
  max-height: 280px;
  overflow-y: auto;
}

.task-edit-item {
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: var(--touch-min);
}

.task-edit-item:hover,
.task-edit-item:active,
.task-edit-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.task-edit-item.active {
  background: var(--primary);
  color: #fff;
}

.fee-member-picker {
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.fee-month-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.fee-year-btn {
  min-width: 52px;
}

.fee-year-label {
  min-width: 5.5em;
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.fee-month-select {
  margin-top: 0.6rem;
}

.fee-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.fee-type-btn {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  min-height: var(--touch-min);
  cursor: pointer;
}

.fee-type-btn:hover,
.fee-type-btn:active {
  border-color: var(--primary);
}

.fee-type-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.fee-type-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.fee-member-search-field {
  margin: 0.5rem 0 0.75rem;
}

.fee-member-search {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.fee-prorated-fields .btn.secondary {
  margin-bottom: 0.75rem;
}

.expense-hub {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.expense-subnav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.expense-subnav-btn {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 0.85rem;
  min-height: var(--touch-min);
  cursor: pointer;
}

.expense-subnav-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.expense-form-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.expense-required-note {
  margin: 0 0 0.25rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.expense-account-open {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.expense-account-open.hidden {
  display: none;
}

.expense-account-picker {
  display: grid;
  gap: 0.5rem;
}

.expense-account-search {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.expense-account-list {
  display: grid;
  gap: 0.45rem;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.expense-account-item {
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.expense-account-item:hover,
.expense-account-item:active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.expense-account-item.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.expense-account-selected {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

.fee-member-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.fee-member-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: var(--touch-min);
  touch-action: manipulation;
}

.fee-member-item:hover,
.fee-member-item:active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.fee-member-item.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.fee-member-item.active .fee-member-meta {
  color: rgba(255, 255, 255, 0.9);
}

.fee-member-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.fee-member-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.fee-member-selected {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

.field-hint {
  margin: 0.35rem 0 0;
}

.customer-form-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.customer-form-body.hidden {
  display: none;
}

.customer-pdf-existing {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #eef2ff;
  font-size: 0.92rem;
}

#form-customer.form-readonly input:not([type="hidden"]),
#form-customer.form-readonly textarea,
#form-customer.form-readonly select {
  background: #f1f5f9;
  color: var(--text);
}

#form-customer.form-readonly .checkbox-card,
#form-customer.form-readonly .radio-card {
  opacity: 0.95;
}

#customer-form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.address-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.address-group .label {
  margin-bottom: 0.25rem;
}

.postal-address-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.25rem 0 0.75rem;
}

.postal-address-picker.hidden {
  display: none;
}

.postal-address-option {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.35;
  text-align: left;
}

.postal-address-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

@media (min-width: 640px) {
  .customer-subnav {
    grid-template-columns: repeat(4, 1fr);
  }
}

.pdf-file-name {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}

.form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.form-errors ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.form-errors li {
  margin-bottom: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.2rem;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  min-height: var(--touch-min);
  touch-action: manipulation;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:active {
  background: var(--primary-hover);
}

.btn.secondary {
  background: var(--primary-light);
  color: var(--primary);
}

.btn.small {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  min-height: 40px;
  flex-shrink: 0;
}

.btn.danger {
  background: #fee2e2;
  color: var(--danger);
  width: 100%;
  margin-top: 0.5rem;
}

.btn.full-width {
  width: 100%;
}

.button-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.button-row .btn {
  width: 100%;
}

/* フォーム下部の固定送信バー（スマホ） */
.form-sticky-submit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.form-sticky-submit .btn {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 600;
  min-height: 52px;
}

body.has-sticky-submit {
  padding-bottom: calc(var(--bottom-nav-h) + var(--sticky-submit-h) + env(safe-area-inset-bottom, 0px));
}

.panel-form-spacer {
  height: 1rem;
}

.record-list {
  display: grid;
  gap: 0.65rem;
}

.record-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fff;
}

.record-item .meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.export-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.card-spaced {
  margin-top: 1rem;
}

.daily-report-export-controls .inline-fields {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.daily-report-year-select {
  width: 100%;
  max-width: 14rem;
}

#panel-daily-report-export .btn-back-export {
  margin-bottom: 0.75rem;
}

#panel-daily-report-export .card {
  margin-bottom: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.daily-report-employee-hint {
  margin: 0.25rem 0 0.75rem;
}

.daily-report-employee-list {
  display: grid;
  gap: 0.5rem;
}

.daily-report-employee-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg, #fff);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.daily-report-employee-item:has(input:checked) {
  border-color: var(--primary, #2563eb);
  background: color-mix(in srgb, var(--primary, #2563eb) 8%, white);
}

.daily-report-employee-check {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.daily-report-employee-name {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
}

.daily-report-employee-mark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: var(--border);
  opacity: 0.35;
}

.daily-report-employee-item:has(input:checked) .daily-report-employee-mark {
  background: var(--primary, #2563eb);
  opacity: 1;
}

.success {
  color: var(--success);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.form-sticky-submit.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-h) + 1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 110;
  max-width: calc(100% - 2rem);
  text-align: center;
  font-size: 0.9rem;
}

body.no-bottom-nav .toast {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

code {
  background: var(--primary-light);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
  word-break: break-all;
}

/* ログイン */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.error-msg {
  background: #fee2e2;
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.login-unlock-page .login-card {
  border-top: 4px solid var(--primary, #2563eb);
}

.login-unlock-page--sse .login-card {
  border-top: 4px solid #ca8a04;
  box-shadow: 0 0 0 2px #1f2937, 0 8px 24px rgba(0, 0, 0, 0.12);
}

.login-unlock-page--sse .login-card h1 {
  background: linear-gradient(90deg, #facc15 0%, #eab308 50%, #1f2937 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.unlock-target-hint {
  font-weight: 600;
}

.account-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.account-record-item .body {
  flex: 1;
  min-width: 0;
}

.account-create-form h3 {
  margin: 1rem 0 0.75rem;
  font-size: 1rem;
}

.account-create-form h3:first-child {
  margin-top: 0;
}

.account-create-form .field {
  margin-bottom: 0.75rem;
}

.account-id-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.account-id-prefix {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
}

.account-id-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.account-id-preview {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

.account-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.account-name-row .field {
  margin-bottom: 0;
  min-width: 0;
}

.account-name-row input {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 479px) {
  .account-name-row {
    grid-template-columns: 1fr;
  }
}

/* 監査ログ */
.audit-log-filters {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.audit-log-filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .audit-log-filter-row--dates,
  .audit-log-filter-row--times {
    grid-template-columns: 1fr 1fr;
  }
}

.audit-log-field {
  margin: 0;
  min-width: 0;
}

.audit-log-field .label {
  display: block;
  margin-bottom: 0.35rem;
}

.audit-log-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.3;
  background: #fff;
}

.audit-log-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.audit-log-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.audit-log-table-head,
.audit-log-row {
  display: grid;
  grid-template-columns: 6.5rem 4.5rem 1fr 1fr 1fr;
  gap: 0.35rem;
  align-items: start;
}

.audit-log-table-head {
  background: #f1f5f9;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.audit-log-row {
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}

.audit-log-row:last-child {
  border-bottom: none;
}

.audit-log-row:nth-child(even) {
  background: #fafafa;
}

.audit-log-cell {
  word-break: break-word;
}

@media (max-width: 767px) {
  .audit-log-table-head,
  .audit-log-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .audit-log-table-head {
    display: none;
  }

  .audit-log-row {
    padding: 0.75rem 0.65rem;
  }

  .audit-log-cell::before {
    display: block;
    font-size: 0.72rem;
    color: var(--muted, #64748b);
    margin-bottom: 0.1rem;
  }

  .audit-log-col-date::before { content: "年月日"; }
  .audit-log-col-time::before { content: "時刻"; }
  .audit-log-col-target::before { content: "対象者"; }
  .audit-log-col-action::before { content: "操作種目"; }
  .audit-log-col-detail::before { content: "詳細"; }
}

.badge.danger {
  display: inline-block;
  background: #fee2e2;
  color: var(--danger);
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  margin-left: 0.35rem;
}

/* スマホ：ヘッダー＋本文＋下部メニューを画面内に収める */
@media (max-width: 767px) {
  .phone-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    min-height: 100vh;
  }

  .phone-shell > .header {
    flex: 0 0 auto;
    max-height: 42vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  html.font-size-xlarge .phone-shell > .header {
    max-height: 38vh;
  }

  html.font-size-xxlarge .phone-shell > .header {
    max-height: 34vh;
  }

  .phone-shell > .container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .phone-shell > .bottom-nav {
    flex: 0 0 auto;
    position: static;
    width: 100%;
    margin-top: auto;
  }

  body.has-bottom-nav {
    padding-bottom: 0;
  }
}

/* タブレット以上 */
@media (min-width: 768px) {
  .header {
    padding: 1.5rem 1rem 2rem;
    position: static;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .user-name {
    font-size: 0.95rem;
    max-width: none;
  }

  .form-sticky-submit {
    display: none;
  }

  .container {
    margin-top: -1rem;
    padding: 0 1rem 0.75rem;
  }

  .card {
    padding: 1.5rem;
  }

  .card h2 {
    font-size: 1.25rem;
  }

  .button-row {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .button-row .btn {
    width: auto;
  }

  .btn.danger {
    width: auto;
    margin-top: 0;
  }

  .record-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
  }

  .record-item .body {
    flex: 1;
  }

  form .btn.primary.full-width-submit {
    width: auto;
  }
}

/* PCレイアウト（上部タブ）: PCブラウザでは既定表示。スマホ実機は下部ナビ */
@media (min-width: 768px) {
  html.boot-pc .tabs-desktop,
  body.view-pc-preview .tabs-desktop {
    display: flex;
  }

  html.boot-pc .bottom-nav,
  body.view-pc-preview .bottom-nav {
    display: none !important;
  }

  html.boot-pc body.has-bottom-nav,
  body.view-pc-preview.has-bottom-nav {
    padding-bottom: 0;
  }
}

/* ============================================================
   PC 上でスマホ版をプレビュー（?view=mobile または切替ボタン）
   ============================================================ */
.preview-bar {
  display: none;
}

@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .preview-bar:not(.hidden) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 1rem;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .preview-label {
    font-weight: 600;
  }

  .preview-btn {
    border: 1px solid #475569;
    background: #334155;
    color: #e2e8f0;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    min-height: 36px;
  }

  .preview-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }

  .preview-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .preview-link {
    color: #93c5fd;
    font-size: 0.82rem;
    text-decoration: none;
    font-family: Consolas, "Courier New", monospace;
  }

  .preview-link:hover {
    text-decoration: underline;
    color: #bfdbfe;
  }

  .preview-sep {
    color: #64748b;
    font-size: 0.82rem;
  }

  .preview-hint {
    color: #94a3b8;
    font-size: 0.78rem;
    width: 100%;
  }

  @media (min-width: 900px) {
    .preview-hint {
      width: auto;
      margin-left: auto;
    }
  }

  /* スマホプレビュー：中央に iPhone サイズの枠 */
  body.view-mobile-preview {
    background: #0f172a;
  }

  body.view-mobile-preview .preview-bar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
  }

  body.view-mobile-preview .phone-shell {
    width: 390px;
    height: calc(100vh - 52px);
    height: calc(100dvh - 52px);
    max-height: calc(100dvh - 52px);
    margin: 52px auto 1.5rem;
    background: var(--bg);
    border-radius: 28px;
    border: 10px solid #1e293b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
  }

  body.view-mobile-preview .phone-shell > .header {
    flex: 0 0 auto;
    max-height: 42vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  html.font-size-xlarge body.view-mobile-preview .phone-shell > .header {
    max-height: 38vh;
  }

  html.font-size-xxlarge body.view-mobile-preview .phone-shell > .header {
    max-height: 34vh;
  }

  body.view-mobile-preview .phone-shell > .container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.view-mobile-preview .phone-shell > .bottom-nav {
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-top: auto;
  }

  body.view-mobile-preview.force-mobile.has-bottom-nav {
    padding-bottom: 0;
  }

  body.view-mobile-preview.force-mobile .tabs-desktop {
    display: none !important;
  }

  body.view-mobile-preview.force-mobile .bottom-nav {
    display: flex !important;
    position: static;
    width: 100%;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 100;
  }

  body.view-mobile-preview.force-mobile form .panel-form-spacer {
    display: block !important;
    height: calc(var(--bottom-nav-h) + 0.25rem);
  }

  body.view-mobile-preview.force-mobile .panel-hub .panel-form-spacer {
    height: 1rem;
  }

  body.view-mobile-preview.force-mobile.has-bottom-nav .phone-shell {
    padding-bottom: 0;
  }

  body.view-mobile-preview.force-mobile .header {
    position: static;
    padding: 0.75rem 1rem 0.85rem;
  }

  body.view-mobile-preview.force-mobile .header h1 {
    font-size: 1.25rem;
  }

  body.view-mobile-preview.force-mobile.has-sticky-submit .container {
    margin-top: 0;
    padding: 0.75rem;
    padding-bottom: 1rem;
  }

  body.view-mobile-preview.force-mobile:not(.has-sticky-submit) .container {
    margin-top: 0;
    padding: 0.75rem;
    padding-bottom: 1rem;
  }

  body.view-mobile-preview.force-mobile .toast {
    position: absolute;
    bottom: calc(var(--bottom-nav-h) + 1rem);
    left: 50%;
    transform: translateX(-50%);
  }

  body.view-mobile-preview.force-mobile .record-item {
    flex-direction: column;
  }

  body.view-mobile-preview.force-mobile .btn.danger {
    width: 100%;
    margin-top: 0.5rem;
  }

  body.view-mobile-preview.force-mobile .button-row {
    flex-direction: column;
  }

  body.view-mobile-preview.force-mobile .button-row .btn {
    width: 100%;
  }

  /* PC表示モード */
  body.view-pc-preview .phone-shell {
    max-width: 880px;
    margin: 0 auto;
  }

  body.view-pc-preview .tabs-desktop {
    display: flex;
  }

  body.view-pc-preview .bottom-nav {
    display: none !important;
  }

  body.view-pc-preview.has-bottom-nav {
    padding-bottom: 0;
  }

  body.view-pc-preview .preview-bar .preview-hint {
    display: none;
  }
}
