body { font-family: 'Segoe UI','Meiryo',sans-serif; color: #1A2E40; margin: 0; }
#setup-status-banner-host { position: sticky; top: 0; z-index: 1200; }
#setup-status-banner {
  display: none;
  background: linear-gradient(90deg, #f97316, #ea580c);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
#qr-modal, #user-config-modal, #site-config-modal {
  display:none;
  position:fixed; left:0; top:0; width:100vw; height:100vh;
  background:rgba(0,0,0,0.3); z-index:1000;
}
.modal-inner {
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  background:#fff; padding:24px; border-radius:12px;
  box-shadow:0 8px 32px rgba(0,0,0,0.2);
  max-width:90vw; max-height:90vh; overflow-y:auto;
}
ul { list-style-type: disc; margin-left:20px; }
input, button, select { margin:4px; }
#att-table th, #att-table td {
  white-space: nowrap; text-align: center; padding: 4px 6px;
}
#att-table th { background: #f3f3fa; }
.btn-sm {
  font-size:0.9em; padding:2px 8px; border-radius:4px;
  border:1px solid #bcd; background:#f8fafd; cursor:pointer;
}
.btn-sm:hover { background:#e8f3ff; }
.danger { color:#c00 !important; }
.edit-row input { width:90%; }
.section-label { font-weight: bold; margin-top: 12px; }
.rule-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.rule-row input[type="number"],
.rule-row input[type="time"],
.rule-row input[type="text"] {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.global-rule-row input[type="text"] { min-width: 140px; }
#site-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
#site-table th,
#site-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  min-width: 80px;
}
#site-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

.msg-error { color:#c00; font-weight:bold; }
.msg-success { color:green; font-weight:bold; }
.note-gray { color:#666; font-size:12px; }

.input-minutes, .input-site-code, .input-site-code-subno, .input-site-name, .input-site-name-search, .input-search-date, .input-search-month, .input-code-from, .input-code-to, .input-search-name {
  padding:6px; border:1px solid #ccc; border-radius:4px;
}

.btn-return, .btn-search, .btn-reset, .btn-search-attendance, .btn-reset-search, .btn-export-sites, .btn-generate-qrs, .btn-download-qr, .btn-close-modal, .btn-today, .btn-target-month, .btn-export-select-all, .btn-export-clear-all {
  padding:8px 16px; border:none; border-radius:6px; cursor:pointer; font-weight:bold;
}

.btn-return { background:#6c757d; color:#fff; }
.btn-search, .btn-search-attendance { background:#1A2E40; color:#fff; }
.btn-reset, .btn-reset-search { background:#adb5bd; color:#fff; }

.btn-monthly-summary {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.btn-monthly-summary:hover { filter: brightness(1.05); }
.btn-monthly-summary:active { transform: translateY(1px); }
.btn-monthly-preview { background: #1976d2; }
.btn-monthly-csv { background: #2e7d32; }
.btn-monthly-template { background: #1c2e4a; }

/* ----------------------------- */
/* 初回設定ウィザード           */
/* ----------------------------- */
#setup-wizard {
  display: none;
  padding: 24px 16px 32px;
  background: #f5f7fb;
  min-height: calc(100vh - 80px);
}

#setup-wizard.is-active {
  display: block;
}

.setup-card {
  max-width: 960px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  padding: 28px 32px 24px;
}

.setup-header {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.setup-label {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.setup-header h2 {
  margin: 8px 0 6px;
  color: #111827;
}

.setup-lead {
  margin: 0 0 6px;
  color: #1f2937;
  line-height: 1.6;
}

.setup-sub {
  margin: 0 0 8px;
  color: #4b5563;
  font-size: 14px;
}

.setup-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #111827;
}

.setup-progress-note {
  color: #6b7280;
  font-weight: 500;
  font-size: 13px;
}

.setup-body {
  min-height: 360px;
}

.setup-step h3 {
  margin: 0 0 8px;
  color: #111827;
}

.setup-step-desc {
  margin: 0 0 14px;
  color: #374151;
}

.setup-bullets {
  margin: 10px 0 0 16px;
  color: #1f2937;
  line-height: 1.6;
}

.setup-field {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.setup-field label,
.setup-label-inline {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: #111827;
}

.setup-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #1f2937;
}

.setup-help {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.setup-required {
  color: #dc2626;
  font-size: 12px;
  margin-left: 4px;
}

#setup-closing-day,
#setup-rounding-minutes {
  width: 100%;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 16px;
  box-sizing: border-box;
}

.setup-break-rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-break-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
}

.setup-break-row .setup-break-condition {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.setup-break-row input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 15px;
  box-sizing: border-box;
}

.setup-break-unit {
  white-space: nowrap;
  color: #4b5563;
}

.setup-break-row .setup-remove-break {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  color: #1f2937;
}

.setup-inline-button {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
  cursor: pointer;
  font-weight: 700;
}

.setup-summary {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
}

.setup-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: #111827;
}

.setup-summary-list {
  color: #111827;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setup-footer {
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
  margin-top: 10px;
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.setup-primary,
.setup-secondary {
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  min-width: 120px;
  font-size: 15px;
}

.setup-primary {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.setup-primary:disabled,
.setup-secondary:disabled,
.setup-inline-button:disabled,
.setup-break-row .setup-remove-break:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.setup-secondary {
  background: #e5e7eb;
  color: #111827;
}

.setup-error-message {
  color: #b91c1c;
  font-weight: 700;
  margin: 8px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .setup-card { padding: 24px 18px; }
  .setup-break-row { flex-direction: column; align-items: flex-start; }
  .setup-break-row .setup-break-condition { width: 100%; }
  .setup-actions { justify-content: center; }
}
.btn-export-sites, .btn-generate-qrs, .btn-download-qr { background:#4DA8DA; color:#fff; }

/* CSV出力ボタン用 */
.btn-csv-export {
  background:#007bff; /* 青系 */
  color:#fff;
}
/* PDF出力ボタン用 */
.btn-pdf-export {
  background:#dc3545; /* 赤系 */
  color:#fff;
}
.btn-csv-export:hover,
.btn-pdf-export:hover {
  opacity:0.85;
}
.btn-close-modal { background:#ccc; color:#000; }
.btn-today { background:#1A2E40; color:#fff; }
.btn-target-month { background:#28a745; color:#fff; }
.btn-export-select-all, .btn-export-clear-all { background:#1A2E40; color:#fff; }

.btn-return:hover, .btn-search:hover, .btn-search-attendance:hover, .btn-export-sites:hover, .btn-generate-qrs:hover, .btn-download-qr:hover, .btn-today:hover, .btn-target-month:hover, .btn-export-select-all:hover, .btn-export-clear-all:hover {
  opacity:0.85;
}

.site-form, .site-search-form, .search-form, .export-options {
  background:#fff; border:1px solid #ddd; padding:12px; margin-bottom:16px; border-radius:8px;
}

.export-options .export-field-option {
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin:4px 8px 4px 0;
}

.export-options .export-field-option .export-field-label-text {
  order:0;
}

.export-options .export-field-option input[type="checkbox"] {
  order:1;
  margin:0;
}

.table-responsive { overflow-x:auto; }

.table-header th { background:#f3f3fa; padding:8px; }

.table-loading { text-align:center; padding:20px; color:#666; }

.qr-label { text-align:center; margin-bottom:12px; font-weight:bold; }
.qr-img-wrap { text-align:center; margin-bottom:12px; }
.qr-img { max-width:300px; border:1px solid #ddd; }
.qr-content-box { background:#f8f9fa; padding:8px; margin-bottom:12px; font-size:12px; }
.qr-content { font-family:monospace; }

.attendance-summary { margin-top:16px; padding:12px; background:#e9ecef; border:1px solid #adb5bd; display:none; }

.global-setting-row { margin-top:12px; }

/* --- 従業員一覧設定 --- */
#user_settings,
#site_settings {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 180px;
}

.user-settings-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 0;
  margin-bottom: 0;
}

.user-settings-title {
  margin: 0;
  line-height: 1.2;
}

#user_settings .btn-return,
#site_settings .btn-return {
  position: static;
  right: auto;
  bottom: auto;
}

/* ===== Company profile screen ===== */
#company {
  padding: 24px 16px 120px;
}

.company-panel {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.company-card,
.company-password-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 24px 28px;
  box-sizing: border-box;
}

.company-card[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

.company-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.company-card-header h3 {
  margin: 0;
  font-size: 24px;
  color: #1a2e40;
}

.billing-banner-host {
  max-width: 1160px;
  margin: 18px auto 0;
  padding: 0 16px;
}

.paused-gate-banner-host {
  max-width: 1160px;
  margin: 18px auto 0;
  padding: 0 16px;
}

.paused-gate-banner-host[hidden] {
  display: none;
}

.paused-gate-banner {
  background: linear-gradient(120deg, #fef2f2, #fff7ed);
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 26px rgba(251, 113, 133, 0.18);
}

.paused-gate-banner__body {
  flex: 1;
  color: #9a3412;
}

.paused-gate-banner__message {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  white-space: pre-line;
}

.paused-gate-banner__action {
  flex-shrink: 0;
  white-space: nowrap;
}

.billing-banner {
  background: linear-gradient(120deg, #fff4e6, #fffaf5);
  border: 1px solid #ffd7a3;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 8px 26px rgba(255, 193, 93, 0.25);
}

.billing-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff0d9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b45309;
  font-size: 18px;
  flex-shrink: 0;
}

.billing-banner-body {
  flex: 1;
  color: #92400e;
}

.billing-banner-title {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
}

.billing-banner-message {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.billing-banner-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.billing-banner-action {
  white-space: nowrap;
}

.company-description {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

.company-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}

.company-field:first-of-type {
  margin-top: 12px;
}

.company-field label {
  font-weight: 600;
  color: #1a2e40;
}

.company-required {
  color: #d93025;
  font-size: 0.82rem;
  margin-left: 6px;
}

.company-optional {
  color: #64748b;
  font-size: 0.82rem;
  margin-left: 6px;
}

.company-field input {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  color: #1f2937;
}

.company-field input:disabled {
  background: #f1f5f9;
}

.billing-card .company-field:first-of-type {
  margin-top: 8px;
}

.cancel-card .cancel-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.cancel-card .cancel-status {
  margin: 0;
  color: #0f172a;
  font-weight: 700;
}

.cancel-card .cancel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cancel-card .cancel-button {
  min-width: 140px;
}

.billing-status {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.billing-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.billing-status-label {
  color: #475569;
  font-weight: 600;
}

.billing-status-value {
  color: #0f172a;
  font-weight: 700;
}

.billing-alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  line-height: 1.5;
}

.billing-action-note {
  margin: 6px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.billing-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.billing-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0;
}

.billing-legend {
  margin: 0;
  padding: 0 6px;
  font-weight: 700;
  color: #1e293b;
}

.billing-radio {
  display: flex;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
  align-items: flex-start;
}

.billing-radio:hover {
  background: #f8fafc;
}

.billing-radio input[type="radio"] {
  margin-top: 4px;
  accent-color: #2563eb;
}

.billing-radio-title {
  font-weight: 700;
  color: #0f172a;
}

.billing-radio-desc {
  margin: 4px 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
}

.billing-field-error {
  margin: 4px 0 0;
  color: #d32f2f;
  font-size: 13px;
}

.billing-invoice-fields {
  border-top: 1px solid #e2e8f0;
  padding-top: 4px;
}

.billing-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.billing-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.billing-form-status {
  margin: 0;
  color: #475569;
  font-size: 14px;
}

.company-field-error {
  min-height: 18px;
  font-size: 13px;
  color: #d93025;
  margin: 0;
}

.company-field-note {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

.company-field-note--pending {
  color: #0f4c81;
  font-weight: 500;
}

.company-field-note--pending strong {
  font-weight: 600;
}

.company-email-pending-expiry {
  display: inline-block;
  margin-top: 4px;
  font-weight: 400;
}

.company-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.company-form-status {
  min-height: 18px;
  font-size: 13px;
  color: #475569;
  margin-top: 16px;
}

.company-toast-host {
  position: fixed;
  top: 120px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1100;
  pointer-events: none;
}

.company-toast {
  min-width: 240px;
  max-width: 360px;
  background: rgba(26, 46, 64, 0.94);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  letter-spacing: 0.01em;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.company-toast[data-variant="success"] {
  background: rgba(22, 163, 74, 0.95);
}

.company-toast[data-variant="error"] {
  background: rgba(220, 38, 38, 0.95);
}

.company-toast[data-variant="info"] {
  background: rgba(37, 99, 235, 0.95);
}

.company-toast--hide {
  opacity: 0;
  transform: translateY(-8px);
}

.company-password-card {
  display: none;
}

.company-password-card.is-open {
  display: block;
}

.company-password-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.company-password-card-header h4 {
  margin: 0;
  font-size: 20px;
  color: #1a2e40;
}

.company-password-close {
  background: transparent;
  border: none;
  color: #475569;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.company-password-close:hover,
.company-password-close:focus-visible {
  background: rgba(148, 163, 184, 0.2);
  outline: none;
}

.company-password-note {
  margin: 0 0 8px;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.company-password-actions {
  margin-top: 18px;
}

@media (max-width: 768px) {
  #company {
    padding: 16px 12px 120px;
  }

  .company-card,
  .company-password-card {
    padding: 20px;
  }

  .company-card-header h3 {
    font-size: 22px;
  }

  .company-actions {
    justify-content: stretch;
  }

  .company-actions .btn {
    flex: 1 1 auto;
  }
}

.user-settings-bar-left,
.user-settings-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-settings-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 940;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid #d4dce7;
  background: rgba(248, 250, 252, 0.97);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.08);
}

.user-settings-status {
  font-size: 13px;
  color: #334155;
}

.user-settings-status.msg-error {
  color: #b91c1c;
}

.user-settings-status.msg-success {
  color: #166534;
}

.user-settings-table-container {
  position: relative;
  margin-top: 0;
  --user-settings-header-offset: 0px;
  --user-settings-header-height: 56px;
  --user-settings-col-1-width: 160px;
  --user-settings-col-2-width: 200px;
  --user-settings-sticky-col-1: calc(var(--user-settings-col-1-width, 160px) + 1px);
  --user-settings-sticky-shadow-1: 8px 0 18px -14px rgba(15, 23, 42, 0.45);
  --user-settings-sticky-shadow-2: 8px 0 18px -14px rgba(15, 23, 42, 0.3);
}

#site_settings .user-settings-table-container {
  --site-settings-col-3-width: 220px;
  --site-settings-sticky-col-2: calc(var(--user-settings-sticky-col-1, 160px) + var(--user-settings-col-2-width, 200px));
  --site-settings-sticky-shadow-3: 8px 0 18px -14px rgba(15, 23, 42, 0.24);
}

.user-settings-table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(72vh, 880px);
  scrollbar-gutter: stable both-edges;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  scroll-padding-top: calc(var(--user-settings-header-offset, 0px) + var(--user-settings-header-height, 56px));
  padding-bottom: 140px;
  position: relative;
}

.user-settings-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1200px;
  width: 100%;
  table-layout: fixed;
}

#site_settings .user-settings-table {
  min-width: 1350px;
}

.user-settings-col-code { width: var(--user-settings-col-1-width, 160px); }
.user-settings-col-name { width: var(--user-settings-col-2-width, 200px); }
.user-settings-col-rounding { width: 180px; }
.user-settings-col-break { width: 260px; }
.user-settings-col-night { width: 220px; }
.user-settings-col-special { width: 260px; }
.user-settings-col-ot-enabled { width: 190px; }
.user-settings-col-ot-policy { width: 220px; }
.user-settings-col-ot-detail { width: 360px; }
.user-settings-col-actions { width: 220px; }

.user-settings-table th,
.user-settings-table td {
  box-sizing: border-box;
  border: 1px solid #d0d7de;
  padding: 6px 10px;
  vertical-align: top;
  background: #fff;
  font-size: 13px;
  line-height: 1.45;
}

.user-settings-table tbody tr {
  --user-settings-row-bg: #fff;
  background-color: var(--user-settings-row-bg, #fff);
}

.user-settings-table tbody td {
  background-color: var(--user-settings-row-bg, #fff);
}

.user-settings-table thead th {
  position: sticky;
  top: var(--user-settings-header-offset, 0px);
  background: #e2e8f0;
  background-color: #e2e8f0;
  background-image: none;
  z-index: 60;
  text-align: left;
  font-weight: 600;
  border-bottom: 0;
  box-shadow: none;
}

.user-settings-table thead th:first-child {
  border-top-left-radius: 12px;
}

.user-settings-table thead th:last-child {
  border-top-right-radius: 12px;
}

.user-settings-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}

.user-settings-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

.user-settings-table thead th:first-child,
.user-settings-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 40;
  min-width: var(--user-settings-col-1-width, 160px);
  width: var(--user-settings-col-1-width, 160px);
}

.user-settings-table thead th:nth-child(2),
.user-settings-table tbody td:nth-child(2) {
  position: sticky;
  left: var(--user-settings-sticky-col-1, 180px);
  z-index: 35;
  min-width: var(--user-settings-col-2-width, 200px);
  width: var(--user-settings-col-2-width, 200px);
}

#site_settings .site-settings-table thead th:nth-child(3),
#site_settings .site-settings-table tbody td:nth-child(3) {
  position: sticky;
  left: calc(var(--site-settings-sticky-col-2, 360px));
  z-index: 34;
  min-width: var(--site-settings-col-3-width, 220px);
  width: var(--site-settings-col-3-width, 220px);
}

.user-settings-table thead th:first-child {
  z-index: 72;
  background: #e2e8f0;
  box-shadow: var(--user-settings-sticky-shadow-1, 8px 0 18px -14px rgba(15, 23, 42, 0.45));
  background-clip: padding-box;
}

.user-settings-table thead th:nth-child(2) {
  z-index: 71;
  background: #e2e8f0;
  box-shadow: var(--user-settings-sticky-shadow-2, 8px 0 18px -14px rgba(15, 23, 42, 0.3));
  background-clip: padding-box;
}

#site_settings .site-settings-table thead th:nth-child(3) {
  z-index: 70;
  background: #e2e8f0;
  box-shadow: var(--site-settings-sticky-shadow-3, 8px 0 18px -14px rgba(15, 23, 42, 0.24));
  background-clip: padding-box;
}

.user-settings-table tbody td:first-child,
.user-settings-table tbody td:nth-child(2) {
  background-color: var(--user-settings-row-bg, #fff);
  background-image: none;
  background-clip: padding-box;
}

.user-settings-table tbody tr:first-child td {
  border-top: 1px solid #d0d7de;
}

.user-settings-table tbody td:first-child {
  box-shadow: var(--user-settings-sticky-shadow-1, 8px 0 18px -14px rgba(15, 23, 42, 0.45));
}

.user-settings-table tbody td:nth-child(2) {
  box-shadow: var(--user-settings-sticky-shadow-2, 8px 0 18px -14px rgba(15, 23, 42, 0.3));
}

#site_settings .site-settings-table tbody td:nth-child(3) {
  box-shadow: var(--site-settings-sticky-shadow-3, 8px 0 18px -14px rgba(15, 23, 42, 0.24));
}

.user-settings-table tbody td:first-child::after,
.user-settings-table tbody td:nth-child(2)::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: -1px;
  right: -1px;
  width: 1px;
  background: #d0d7de;
}


.user-settings-row {
  transition: background-color 0.2s ease;
  --user-settings-row-bg: #fff;
  background-color: var(--user-settings-row-bg, #fff);
}

.user-settings-row.is-dirty {
  --user-settings-row-bg: #fff7e6;
}

.user-settings-row.is-busy {
  opacity: 0.6;
}

.user-settings-table input,
.user-settings-table select,
.user-settings-table button {
  margin: 0;
}

.user-settings-cell-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-settings-note {
  font-size: 11px;
  color: #6b7280;
}

.user-settings-summary {
  font-size: 12.5px;
  color: #1f2937;
  font-weight: 600;
}

.user-settings-code {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.user-settings-display-name {
  font-size: 14px;
  color: #1f2937;
}


.user-settings-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.user-settings-summary-row .user-settings-summary {
  flex: 1 1 160px;
  min-width: 140px;
}

.user-settings-summary-row .btn {
  flex: 0 0 auto;
  margin-left: auto;
}

.user-settings-list-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fbff;
  max-height: 180px;
  overflow-y: auto;
}

.user-settings-list-body.is-empty {
  display: none;
}

.user-settings-inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 12.5px;
}

.user-settings-inline-row label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-settings-inline-row input[type="number"],
.user-settings-inline-row input[type="time"],
.user-settings-inline-row input[type="text"],
.user-settings-cell-stack select,
.user-settings-cell-stack input[type="number"],
.user-settings-cell-stack input[type="date"],
.user-settings-cell-stack input[type="time"] {
  min-width: 80px;
}

.user-settings-rounding-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.user-settings-rounding-row .user-settings-note {
  margin-left: 2px;
}

.user-settings-empty-row {
  font-size: 12px;
  color: #6b7280;
}

.user-settings-ot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-settings-ot.is-disabled {
  opacity: 0.55;
}

.user-ot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}

.user-ot-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.user-ot-row.flex-only-note {
  font-size: 12px;
  color: #475569;
}

.user-ot-row.flex-only-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

details.user-ot-row {
  display: block;
}

details.user-ot-row summary {
  cursor: pointer;
  font-weight: 600;
}

details.user-ot-row .ot-adv-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
}

.user-settings-actions-cell {
  min-width: 220px;
}

.user-settings-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.user-settings-row-status {
  margin-top: 6px;
  font-size: 11.5px;
  color: #475569;
}

.user-settings-row-status.msg-error {
  color: #b91c1c;
}

.user-settings-row-status.msg-success {
  color: #166534;
}

.user-settings-message-row td {
  padding: 18px;
  text-align: center;
  background: #f8faff;
  color: #475569;
  font-size: 14px;
}

.user-settings-message-row td.msg-error {
  background: #fef2f2;
  color: #b91c1c;
}

.user-settings-message-row td.msg-success {
  background: #ecfdf3;
  color: #15803d;
}

.user-settings-back-bottom {
  align-self: flex-start;
}
.global-save-row { margin-top:20px; }

.section-label-night, .section-label-special { margin-top:16px; font-weight:bold; }

.monthly-report-row { margin-bottom:8px; }
.monthly-summary-row { margin-bottom:8px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.monthly-summary-label { font-weight:600; }
.monthly-summary-search .input-search-name { min-width: 160px; }
.monthly-summary-note { margin: 6px 0 12px; color:#b91c1c; font-size:14px; }

.correction-table, .att-table, .site-table {
  width:100%;
  border-collapse:collapse;
}
.correction-table th, .att-table th, .site-table th,
.correction-table td, .att-table td, .site-table td {
  border:1px solid #ccc; padding:6px 8px; text-align:center;
}

.init-frame {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: none;
  display: block;
}

@supports (height: 100dvh) {
  .init-frame {
    height: 100dvh;
    min-height: 100dvh;
  }
}

.login-container {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
}

.login-container h2 {
  margin-bottom: 20px;
}

.login-container input {
  padding: 8px;
  margin-right: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.login-logo {
  max-width: 120px;
  margin-bottom: 20px;
}

.login-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.login-form input {
  padding: 10px;
  width: 260px;
  max-width: 100%;
  margin-right: 0;
  align-self: center;
}

.login-form button {
  padding: 12px 20px;
  background-color: #1A2E40;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.login-form button:hover {
  opacity: 0.9;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  width: 100%;
}

.login-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 360px; /* 入力欄の横幅（必要に応じて 320–380） */
  display: block;   /* 絶対配置のトグルを内包するだけにする */
}

.login-input-wrapper input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  margin-right: 0;     /* 余計なはみ出しを防止 */
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  line-height: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  z-index: 1;
}

.password-toggle:hover { background: transparent; }

.password-toggle:focus-visible {
  outline: 2px solid #1A2E40;
  outline-offset: 2px;
  background: transparent;
}

.password-toggle img {
  width: 22px;
  height: 22px;
  display: block;
}

.pw-eye,
.eye-toggle,
.password-visibility,
.password-eye,
button[aria-label*="パスワード"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.input-with-eye {
  position: relative;
}

.input-with-eye input {
  padding-right: 44px;
}

.input-with-eye .pw-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pw-eye img {
  width: 22px;
  height: 22px;
  display: block;
}

.pw-eye:focus-visible {
  outline: 2px solid #2563eb;
  border-radius: 6px;
}

.login-field-note {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  max-width: 260px;
  width: 100%;
  text-align: left;
  line-height: 1.4;
}

.login-field-error {
  font-size: 12px;
  color: #d93025;
  margin: 0;
  min-height: 16px;
  max-width: 260px;
  width: 100%;
  text-align: left;
  line-height: 1.4;
}

.login-note {
  font-size: 13px;
  color: #1a2e40;
  margin: -6px 0 4px;
  text-align: left;
  align-self: center;
}

#password-reset-container {
  display: none;
}

.login-toast-host {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1200;
  pointer-events: none;
}

.login-toast {
  min-width: 240px;
  max-width: 90vw;
  background: rgba(26, 46, 64, 0.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.login-toast[data-variant="success"] {
  background: rgba(38, 128, 82, 0.95);
}

.login-toast[data-variant="error"] {
  background: rgba(176, 52, 52, 0.95);
}

.login-toast--hide {
  opacity: 0;
  transform: translateY(-10px);
}

#login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* 画面中央に配置 */
  background: linear-gradient(to bottom, #4DA8DA 0%, #ffffff 100%);
}
.hidden {
  display: none !important;
}

/* ===== 管理者メニュー ===== */
.company-contract-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 4px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  max-width: min(90vw, 720px);
  white-space: normal;
}

.company-contract-badge__name,
.company-contract-badge__status {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.company-contract-badge__name {
  max-width: 100%;
}

.company-contract-badge__status {
  max-width: 100%;
}

.menu-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* 中央寄せ */
  min-height: 80vh; /* 画面の縦方向中央に配置 */
  gap: 20px;
  margin-top: 12px;
}

.menu-row {
  display: flex;
  gap: 20px;
}

.menu-row button,
.menu-row a button {
  width: 200px;
  height: 140px;
  background: #fff;
  border: 2px solid #1A2E40;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  color: #1A2E40;
  cursor: pointer;
  transition: all 0.2s;
}

.menu-row button:hover,
.menu-row a button:hover {
  background: #1A2E40;
  color: #fff;
}

.logout-row {
  justify-content: flex-end;
  width: 100%;
  padding-right: 40px;
}

.logout-row button {
  width: 120px;
  height: 60px;
}

#menu {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  background: linear-gradient(to bottom, #4DA8DA 0%, #ffffff 100%);
  overflow: hidden;
  box-sizing: border-box;
}
/* Ensure full background coverage and remove default spacing */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body[data-prelogin-ready="0"] #login,
body[data-prelogin-ready="0"] .header-company-status {
  visibility: hidden;
}

/* ===== ヘッダー ===== */
.header {
  display: flex;
  align-items: center;
  background-color: #4DA8DA; /* 藍色から水色に変更 */
  color: #fff;
  padding: 12px 24px;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  gap: 16px;
  flex-wrap: wrap;
}

.header-logo {
  height: 40px;
  margin-right: 16px;
}

.header-title {
  font-size: 20px;
  font-weight: bold;
}

.header-company-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 320px;
  justify-content: flex-end;
}

.company-contract-badge--header {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.company-contract-badge--header .company-contract-badge__status[data-status="paused"],
.company-contract-badge--header .company-contract-badge__status[data-status="canceled"] {
  color: #ffe0b2;
}

.company-contract-badge--header .company-contract-badge__status[data-status="trial"] {
  color: #e0f7f4;
}

.company-contract-badge--header .company-contract-badge__status[data-status="error"] {
  color: #ffd1d1;
}

.billing-lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
}

.billing-lock-overlay[hidden] {
  display: none;
}

.billing-lock-overlay__card {
  background: #111827;
  color: #fff;
  padding: 24px 28px;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
}

.billing-lock-overlay__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.billing-lock-overlay__message {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

.billing-lock-disabled {
  pointer-events: none;
}

@media (max-width: 720px) {
  .header {
    padding: 10px 16px;
  }

  .company-contract-badge {
    font-size: 14px;
    gap: 8px;
    padding: 6px 12px;
  }

  .company-contract-badge__name {
    max-width: 100%;
  }

  .company-contract-badge__status {
    max-width: 100%;
  }
}

/* ===== 戻るボタン追従配置 ===== */
.btn-return {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999;
}

/* ===== Search UI polish & bottom spacing ===== */

/* Unify widths and look of code inputs (社員コード/現場コードとも) */
.input-code-from,
.input-code-to,
.input-site-code,
.input-site-code-subno {
  width: 64px;
  text-align: center;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Make the connector dropdowns (“から / のみ”) visually consistent */
.select-connector {
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Optional separator between inputs, if used */
.search-form .range-sep {
  margin: 0 4px;
  color: #666;
}

/* Extra bottom room so fixed footer buttons don't overlap last rows */
body {
  padding-bottom: 120px; /* allow scroll past the fixed return button */
}

/* Give tables some breathing room at the bottom as well */
#att-table {
  margin-bottom: 40px;
}
.table-responsive {
  padding-bottom: 40px;
}

.att-table-wrap {
  padding-bottom: 40px;
}
/* ===== Primary action buttons (blue) ===== */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: bold;
  cursor: pointer;
  line-height: 1.2;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #007bff; /* 青系 */
  border-color: #007bff;
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(0.95);
}
.btn-primary:active {
  filter: brightness(0.9);
}

.btn-secondary {
  background:#64748b;
  border-color:#64748b;
  color:#fff;
}
.btn-secondary:hover {
  filter:brightness(0.95);
}
.btn-secondary:active {
  filter:brightness(0.9);
}

/* Small variant stays consistent */
.btn.btn-sm {
  font-size: 0.9em;
  padding: 6px 12px;
  border-radius: 4px;
}

.employee-toolbar {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.employee-toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.employee-toolbar-row--primary {
  width: 100%;
}

.employee-toolbar-row--secondary {
  justify-content: flex-end;
}

.employee-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.employee-settings-button {
  margin-left: auto;
}

.employee-existing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.employee-existing-toggle input {
  width: 16px;
  height: 16px;
}

.employee-existing-toggle span {
  line-height: 1.2;
}
/* ===== 従業員管理テーブル ===== */
/* 外枠は wrap に付与（border-collapseと相性問題を避ける） */
.employee-table-wrap {
  max-width: 900px;
  margin: 12px auto;      /* 中央寄せ */
  border: 2px solid #bbb; /* 外枠 */
  border-radius: 6px;
  overflow: hidden;       /* 角丸を有効に */
  background: #fff;
}

#employee-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: none;           /* 外枠は wrap 側に任せる */
}

#employee-table th,
#employee-table td {
  border: 1px solid #ddd;
  padding: 8px 12px;     /* 列の余裕 */
  text-align: center;
  vertical-align: middle;
  min-width: 120px;      /* 列幅の最低サイズ */
}

#employee-table .th-employee-existing,
#employee-table .col-employee-existing {
  min-width: 140px;
}

#employee-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

#employee-table .btn-delete,
#employee-table .btn-danger {
  background: transparent;
  color: #dc3545 !important; /* 文字だけ赤 */
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
#employee-table .btn-delete:hover,
#employee-table .btn-danger:hover {
  color: #b52a37 !important; /* 少し濃く */
  text-decoration: underline;
}

/* ===== 従業員検索フォーム ===== */
#user-search-code,
#user-search-name {
  /* width は HTML で指定（260px）。ここでは高さと見た目のみ統一 */
  height: 40px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

/* ===== 勤怠集計：範囲セレクト(から/のみ)の見た目を統一 ===== */
select.input-connector {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #fff;
  border: 1px solid #ccc;      /* 他の検索ボックスと同じ枠線 */
  border-radius: 6px;           /* 角丸を揃える */
  padding: 6px 28px 6px 10px;   /* 右側はドロップダウンアイコン分を確保 */
  font-size: 14px;
  line-height: 1.4;
}

select.input-connector:focus {
  outline: none;
  border-color: #90caf9;
  box-shadow: 0 0 0 2px rgba(144,202,249,.2);
}
/* ===== 検索フォーム：コード入力の文字色を薄いグレーに統一 ===== */
.input-site-code,
.input-site-code-subno {
  color: #8a8f98;  /* 薄いグレー */
}

/* フォーカス時は読みやすい色に */
.input-site-code:focus,
.input-site-code-subno:focus {
  color: #263238;  /* 少し濃いグレーで視認性UP */
}

/* ===== 配布案内/QR発行（dashboard統合） ===== */
body.initd-active {
  padding-bottom: 0;
  overflow: hidden;
}

body.initd-active .btn-return-initd {
  display: inline-flex;
  z-index: 1200;
}

#init_distribution {
  position: relative;
}

#screen-init-distribution,
#screen-init-distribution * {
  box-sizing: border-box;
  font-family: inherit;
}

#screen-init-distribution {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #f7f9fa;
  padding: 24px 28px 32px;
  gap: 0;
}

#screen-init-distribution .main-wrapper {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 20px 38px rgba(15, 23, 42, 0.12);
}

#screen-init-distribution .sidebar {
  flex: 0 0 240px;
  width: 240px;
  min-width: 240px;
  background: #eaf2f9;
  padding: 28px 12px 12px;
  box-shadow: 1px 0 10px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  max-height: calc(100vh - 140px);
  height: 100%;
  align-items: stretch;
}

#screen-init-distribution .menu-back-sticky {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  padding: 8px;
  background: #eaf2f9;
  border-radius: 10px;
}

#screen-init-distribution .sidebar h3 {
  font-size: 1.22em;
  margin: 0 0 10px;
  font-weight: 700;
  color: #1854b3;
  letter-spacing: 0.02em;
}

#screen-init-distribution .sidebar button,
#screen-init-distribution .sidebar select {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 0;
  font-size: 1em;
  border-radius: 8px;
  border: none;
  background: #0c8be0;
  color: #fff;
  cursor: pointer;
  transition: background 0.16s ease;
}

#screen-init-distribution .sidebar button:active {
  background: #075eab;
}

#screen-init-distribution .sidebar label {
  display: block;
  margin-bottom: 4px;
  font-size: 1em;
}

#screen-init-distribution .sidebar .btn-return-inline {
  margin-top: auto;
  width: 100%;
  padding: 10px 0;
  font-size: 1em;
}

#screen-init-distribution .sidebar-main-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 96px;
  min-height: 0;
}

#screen-init-distribution .sidebar-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 8px;
}

#screen-init-distribution .sidebar .back-button {
  position: static;
  right: auto;
  bottom: auto;
  width: 100%;
  margin: 0;
}

#screen-init-distribution .center-panel {
  flex: 0 0 520px;
  width: 520px;
  max-width: 520px;
  min-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 24px 20px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
}

#screen-init-distribution .guide-editor-label {
  font-size: 1.22em;
  margin-bottom: 14px;
  font-weight: 500;
  color: #333;
  letter-spacing: 0.03em;
}

#screen-init-distribution .guide-editor {
  width: 100%;
  font-size: 1.06em;
  border-radius: 10px;
  border: 1.5px solid #bbb;
  resize: vertical;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.12);
  background: #fff;
  transition: font-size 0.2s ease;
  min-height: 25em;
  max-height: none;
  overflow: auto;
}

#screen-init-distribution .guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  margin-top: 12px;
}

#screen-init-distribution .guide-actions .ui-button {
  min-height: 34px;
  padding: 7px 14px;
}

#screen-init-distribution #previewArea {
  display: none !important;
}

#screen-init-distribution .preview-area {
  width: 100%;
  min-width: 310px;
  max-width: 520px;
  min-height: 380px;
  max-height: 600px;
  background: #fcfcff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 16px 16px 24px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  font-size: 1.18em;
  white-space: pre-wrap;
  overflow: auto;
}

#screen-init-distribution .guide-pages {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#screen-init-distribution .guide-sheet {
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
  padding: 16px;
}

#screen-init-distribution .guide-sheet__inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#screen-init-distribution .guide-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#screen-init-distribution .install-guide {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

#screen-init-distribution .install-guide__heading {
  font-weight: 700;
  font-size: 1.05em;
}

#screen-init-distribution .install-guide__text {
  font-size: 0.96em;
  line-height: 1.45em;
}

#screen-init-distribution .install-guide__qr-row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

#screen-init-distribution .install-guide__qr {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#screen-init-distribution .install-guide__qr img {
  width: clamp(150px, 26vw, 170px);
  height: clamp(150px, 26vw, 170px);
  object-fit: contain;
}

#screen-init-distribution .install-guide__qr figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  line-height: 1.25;
}

#screen-init-distribution .store-guide__label {
  font-weight: 700;
}

#screen-init-distribution .store-guide__sub {
  font-size: 0.84em;
  color: #475569;
}

#screen-init-distribution .setup-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

#screen-init-distribution .setup-steps__title {
  font-weight: 700;
}

#screen-init-distribution .setup-steps ol {
  margin: 0;
  padding-left: 1.3em;
  line-height: 1.5em;
}

#screen-init-distribution .qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(56px, 6vw, 72px);
  flex-shrink: 0;
}

#screen-init-distribution .qr-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(48px, 5vw, 64px);
  flex-wrap: nowrap;
}

#screen-init-distribution .qr-row--stack {
  width: 100%;
}

#screen-init-distribution .qr-box {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  width: min(100%, 340px);
}

#screen-init-distribution .qr-label {
  margin: 0;
  font-size: 1.02em;
  font-weight: 700;
  text-align: center;
}

#screen-init-distribution .qr-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  max-width: 320px;
  max-height: 320px;
}

#screen-init-distribution .qr-figure canvas,
#screen-init-distribution .qr-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#screen-init-distribution .right-panel {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  box-shadow: -2px 0 12px rgba(15, 23, 42, 0.05);
  padding: 20px 20px 26px;
  overflow: hidden;
  border-radius: 0 18px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  min-height: 0;
}

#screen-init-distribution .employee-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 12px;
  max-height: calc(100vh - 120px);
}

#screen-init-distribution .employee-panel-header {
  flex: 0 0 auto;
}

#screen-init-distribution .employee-panel-header .controls-stack {
  max-height: none;
  overflow: visible;
}

#screen-init-distribution .employee-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#screen-init-distribution .employee-panel-body .table-container {
  flex: 1 1 auto;
  min-height: 0;
}

#screen-init-distribution .controls-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: clamp(280px, 42vh, 360px);
  overflow: auto;
  padding-right: 2px;
}

#screen-init-distribution .search-block {
  background: #eaf2f9;
  border-radius: 14px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 0 0 1px rgba(24, 84, 179, 0.12);
  width: 100%;
  margin-bottom: 8px;
}

#screen-init-distribution .search-block__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #1854b3;
  text-align: center;
  letter-spacing: 0.04em;
}

#screen-init-distribution .search-block__fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#screen-init-distribution .search-field-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#screen-init-distribution .search-field-row--codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 680px) {
  #screen-init-distribution .search-field-row--codes {
    grid-template-columns: 1fr;
  }
}

#screen-init-distribution .search-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

#screen-init-distribution .search-field__label {
  font-size: 12.5px;
  color: #333;
}

#screen-init-distribution .search-field__input {
  width: 100%;
  max-width: 100%;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #c9d6e5;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
  color: #111;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#screen-init-distribution .search-field__input:focus {
  outline: none;
  border-color: #1854b3;
  box-shadow: 0 0 0 3px rgba(24, 84, 179, 0.15);
}

#screen-init-distribution .search-field--with-action .search-field__inline {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

#screen-init-distribution .search-field--with-action .search-field__input {
  flex: 1 1 auto;
  width: auto;
}

#screen-init-distribution .search-field--code .search-field__input,
#screen-init-distribution .search-field--existing .search-field__input {
  width: clamp(12ch, 11ch + 2vw, 16ch);
  min-width: 0;
  max-width: 100%;
}

#screen-init-distribution .search-field--name .search-field__inline {
  gap: 8px;
  flex-wrap: nowrap;
}

#screen-init-distribution .search-field--name .search-field__input {
  flex: 0 1 clamp(24ch, 22ch + 2vw, 28ch);
  min-width: 20ch;
  max-width: 28ch;
}

#screen-init-distribution .ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 112px;
  padding: 7px 16px;
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid #ccd6e0;
  background: #e5e8ef;
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

#screen-init-distribution .ui-button:disabled {
  background: #f0f1f4;
  color: #9aa2ad;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.85;
}

#screen-init-distribution .ui-button:hover {
  background: #f1f4f9;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16);
}

#screen-init-distribution .ui-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

#screen-init-distribution .button-row {
  display: grid;
  width: 100%;
  gap: 10px;
  justify-content: start;
}

#screen-init-distribution .button-row--csv {
  grid-template-columns: repeat(4, 136px);
  margin-top: 4px;
}

#screen-init-distribution .button-row--main-actions {
  grid-template-columns: repeat(3, 136px);
  margin: 6px 0 4px;
}

#screen-init-distribution .button-row--selection {
  grid-template-columns: repeat(2, 136px);
  margin-bottom: 4px;
}

#screen-init-distribution .button-row--csv .ui-button,
#screen-init-distribution .button-row--main-actions .ui-button,
#screen-init-distribution .button-row--selection .ui-button {
  width: 136px;
}

#screen-init-distribution .button-row--edit-save {
  grid-template-columns: repeat(3, 136px);
  margin-bottom: 4px;
}

#screen-init-distribution .button-row--edit-save .ui-button {
  width: 136px;
}

#screen-init-distribution .button-row__placeholder {
  display: block;
  width: 136px;
  height: 0;
}

#screen-init-distribution #resetSearchBtn.ui-button {
  width: 96px;
  min-width: 96px;
  padding: 6px 12px;
  min-height: 32px;
}

#screen-init-distribution #importErrors {
  min-height: 1.2em;
  color: #d32f2f;
  font-size: 13px;
  white-space: pre-wrap;
}

.initd-name-confirm {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
}

.initd-name-confirm.is-active {
  display: flex;
}

.initd-name-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 29, 37, 0.45);
}

.initd-name-confirm__dialog {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: min(440px, 92vw);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 4001;
}

.initd-name-confirm__message {
  font-size: 15px;
  line-height: 1.6;
  color: #111827;
  word-break: break-word;
}

.initd-name-confirm__meta {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

.initd-name-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.initd-name-confirm__btn {
  min-width: 104px;
}

.initd-name-confirm__btn--primary {
  background: #0c8be0;
  color: #fff;
}

.initd-name-confirm__btn--primary:hover {
  background: #2d9cf0;
}

#screen-init-distribution .table-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px #e5e8ef;
  padding-bottom: 12px;
  max-height: calc(100vh - 300px);
  display: flex;
  flex-direction: column;
}

#screen-init-distribution .employee-list-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
}

#screen-init-distribution .employee-selection-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
}

#screen-init-distribution .employee-selection-actions .ui-button {
  min-width: auto;
  padding: 6px 12px;
  min-height: 32px;
}

#screen-init-distribution .employee-edit-actions {
  display: inline-flex;
  align-items: center;
}

#screen-init-distribution .employee-edit-actions .ui-button {
  min-width: 104px;
  padding: 7px 14px;
}

#screen-init-distribution .employee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1em;
  background: #fff;
  table-layout: fixed;
}

#screen-init-distribution .employee-table th,
#screen-init-distribution .employee-table td {
  border: 1.1px solid #e3e3e3;
  padding: 8px 7px;
  text-align: center;
  white-space: nowrap;
}

#screen-init-distribution .employee-table th {
  background: #eaf2f9;
  font-weight: bold;
  font-size: 1.02em;
  color: #1854b3;
  letter-spacing: 0.03em;
}

#screen-init-distribution .employee-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

#screen-init-distribution .employee-table th:nth-child(1),
#screen-init-distribution .employee-table td:nth-child(1) {
  width: clamp(104px, 9.5vw, 120px);
}

#screen-init-distribution .employee-table th:nth-child(2),
#screen-init-distribution .employee-table td:nth-child(2) {
  width: clamp(120px, 10.5vw, 140px);
}

#screen-init-distribution .employee-table th:nth-child(3),
#screen-init-distribution .employee-table td:nth-child(3) {
  width: clamp(156px, 15vw, 196px);
  text-align: left;
}

#screen-init-distribution .employee-table th:nth-child(4),
#screen-init-distribution .employee-table td:nth-child(4) {
  width: clamp(56px, 6vw, 64px);
}

#screen-init-distribution .employee-table th:nth-child(5),
#screen-init-distribution .employee-table td:nth-child(5) {
  width: clamp(80px, 7vw, 96px);
}

#screen-init-distribution .employee-table td.name-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

#init_distribution_app.is-editing .employee-table td.editable-cell {
  background: #fff;
  text-align: left;
}

#init_distribution_app .editable-input-wrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

#init_distribution_app .editable-input {
  width: 100%;
  padding: 6px 10px;
  border: 1.2px solid #cfd8e3;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #1f2937;
}

#init_distribution_app .editable-input:focus {
  outline: none;
  border-color: #0c8be0;
  box-shadow: 0 0 0 3px rgba(12, 139, 224, 0.18);
}

#init_distribution_app .editable-input[aria-invalid="true"] {
  border-color: #d93025;
  background: #fff5f5;
  box-shadow: none;
}

#init_distribution_app .editable-error {
  min-height: 1.1em;
  font-size: 12px;
  color: #d93025;
  line-height: 1.3;
}

#init_distribution_app .editable-error:empty {
  display: block;
}

#init_distribution_app.is-editing .employee-table tbody tr:hover {
  background: #f4f9ff;
}

#init_distribution_app.is-editing .employee-table td:nth-child(4),
#init_distribution_app.is-editing .employee-table td:nth-child(5) {
  background: #f7f9fc;
}

#init_distribution_app.is-editing .employee-table td:nth-child(4) input[type="checkbox"],
#init_distribution_app.is-editing .employee-table td:nth-child(5) button {
  opacity: 0.55;
  pointer-events: none;
}

#init_distribution_app .initd-toast-host {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

#init_distribution_app .initd-toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(33, 43, 54, 0.92);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#init_distribution_app .initd-toast[data-variant="success"] {
  background: rgba(16, 122, 63, 0.94);
}

#init_distribution_app .initd-toast[data-variant="info"] {
  background: rgba(32, 72, 145, 0.94);
}

#init_distribution_app .initd-toast[data-variant="error"] {
  background: rgba(186, 26, 36, 0.94);
}

#init_distribution_app .initd-toast-message {
  flex: 1;
  line-height: 1.4;
}

#screen-init-distribution .employee-table td input[type="checkbox"] {
  width: 1.2em;
  height: 1.2em;
  accent-color: #0c8be0;
}

#screen-init-distribution .employee-table tbody tr:nth-child(odd) {
  background: #f8fcff;
}

#screen-init-distribution .employee-table tbody tr:hover {
  background: #e9f4ff;
}

#screen-init-distribution .right-panel {
  scrollbar-width: thin;
  scrollbar-color: #c3e0ff #fff;
}

#screen-init-distribution .right-panel::-webkit-scrollbar {
  width: 8px;
}

#screen-init-distribution .right-panel::-webkit-scrollbar-thumb {
  background: #c3e0ff;
  border-radius: 6px;
}

#screen-init-distribution .manual-entry-group button {
  padding: 7px 16px;
  font-size: 1em;
  background: #0c8be0;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#screen-init-distribution .manual-entry-group button:hover {
  background: #075eab;
}

@media (max-height: 800px) {
  #screen-init-distribution {
    padding: 16px 18px 22px;
  }

  #screen-init-distribution .main-wrapper {
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
  }

  #screen-init-distribution .sidebar {
    padding: 20px 10px 12px;
    gap: 14px;
  }

  #screen-init-distribution .sidebar button,
  #screen-init-distribution .sidebar select {
    padding: 8px 0;
    font-size: 0.95em;
  }

  #screen-init-distribution .guide-editor-label {
    font-size: 1.08em;
  }

  #screen-init-distribution .guide-editor {
    min-height: 20em;
  }

  #screen-init-distribution .controls-stack {
    max-height: 300px;
    gap: 10px;
  }

  #screen-init-distribution .ui-button {
    padding: 6px 14px;
    min-height: 32px;
    font-size: 13px;
  }

  #screen-init-distribution .button-row {
    gap: 8px;
  }

  #screen-init-distribution .search-field__input {
    height: 32px;
    padding: 0 12px;
  }

  #screen-init-distribution .search-field__label {
    font-size: 12px;
  }
}

/* 🆕 勤怠集計一覧：対象日再計算の状態表示 */
.attendance-result-info {
  display: block;
  min-height: 32px;
}

.attendance-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #1f2937;
  font-size: 14px;
}

.attendance-status__main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.attendance-status__meta {
  color: #6b7280;
  font-size: 12px;
}

.attendance-status__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  border-top-color: #1976d2;
  animation: attendance-spin 0.9s linear infinite;
}

.attendance-status.is-error {
  color: #b91c1c;
}

.attendance-status.is-error .attendance-status__meta {
  color: #b91c1c;
}

.attendance-status.is-success {
  color: #047857;
  font-weight: 700;
}

@keyframes attendance-spin {
  to {
    transform: rotate(360deg);
  }
}
