html {
  font-size: 14px;
}

.brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 64px;
  max-width: 280px;
  object-fit: contain;
}

@media (max-width: 575.98px) {
  .brand-logo {
    max-height: 44px;
    max-width: calc(100vw - 96px);
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ---- Application shell and navigation (r27-ED) ---- */

:root {
  --app-header-height: 68px;
  --app-sidebar-width: 264px;
  --app-sidebar-collapsed-width: 76px;
  --app-sidebar-background: #f7f8fa;
  --app-sidebar-border: #dfe3e8;
  --app-nav-text: #24292f;
  --app-nav-muted: #59636e;
  --app-nav-hover: #e9ecef;
  --app-nav-active: #e7f1ff;
  --app-nav-active-border: #0d6efd;
  --app-focus: #0a58ca;
}

body.app-layout-body {
  margin-bottom: 0;
  overflow-x: hidden;
  background: #fff;
  color: #212529;
}

body.app-drawer-open {
  overflow: hidden;
}

.app-skip-link {
  position: fixed;
  z-index: 1100;
  top: .5rem;
  left: .5rem;
  padding: .625rem .875rem;
  background: #fff;
  border: 2px solid var(--app-focus);
  border-radius: 4px;
}

.app-header {
  position: fixed;
  z-index: 1040;
  top: 0;
  right: 0;
  left: 0;
  height: var(--app-header-height);
  display: grid;
  grid-template-columns: minmax(210px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  background: #fff;
  border-bottom: 1px solid var(--app-sidebar-border);
  box-shadow: 0 1px 5px rgba(33, 37, 41, .08);
}

.app-header-brand,
.app-header-account,
.app-header-location {
  min-width: 0;
  display: flex;
  align-items: center;
}

.app-header-brand {
  gap: .625rem;
}

.app-brand-link {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
}

.app-brand-logo {
  width: auto;
  height: 38px;
  max-width: 192px;
  object-fit: contain;
}

.app-icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #343a40;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.app-icon-button:hover {
  background: #edf0f2;
  border-color: #d8dde2;
}

.app-icon-button:focus-visible,
.app-nav-section-toggle:focus-visible,
.app-nav-link:focus-visible,
.app-header-action:focus-visible {
  outline: 3px solid rgba(13, 110, 253, .35);
  outline-offset: 2px;
}

.app-menu-icon {
  width: 21px;
  display: grid;
  gap: 4px;
}

.app-menu-icon > span {
  height: 2px;
  display: block;
  background: currentColor;
  border-radius: 1px;
}

.app-header-location {
  gap: .5rem;
  overflow: hidden;
  white-space: nowrap;
}

.app-header-section {
  color: var(--app-nav-muted);
  font-size: .875rem;
}

.app-header-separator {
  color: #adb5bd;
}

.app-header-title {
  overflow: hidden;
  color: #202428;
  font-weight: 600;
  text-overflow: ellipsis;
}

.app-header-account {
  justify-content: flex-end;
  gap: .25rem;
  white-space: nowrap;
}

.app-user-name {
  max-width: 12rem;
  margin-right: .375rem;
  overflow: hidden;
  color: #59636e;
  font-size: .875rem;
  text-overflow: ellipsis;
}

.app-header-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem .625rem;
  color: #343a40;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font: inherit;
  text-decoration: none;
}

.app-header-action:hover {
  color: #0a58ca;
  background: #edf4ff;
}

.app-header-action-icon {
  min-width: 1.25rem;
  color: #495057;
  font-weight: 700;
  text-align: center;
}

.app-logout-form {
  margin: 0;
}

.app-sidebar {
  position: fixed;
  z-index: 1030;
  top: var(--app-header-height);
  bottom: 0;
  left: 0;
  width: var(--app-sidebar-width);
  overflow: hidden;
  color: var(--app-nav-text);
  background: var(--app-sidebar-background);
  border-right: 1px solid var(--app-sidebar-border);
  transition: width .18s ease, transform .2s ease;
}

.app-sidebar-mobile-header {
  display: none;
}

.app-sidebar-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: .75rem .625rem 1.5rem;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.app-nav-section {
  padding: .125rem 0 .375rem;
  border-bottom: 1px solid #e6e9ec;
}

.app-nav-section:last-child {
  border-bottom: 0;
}

.app-nav-section-heading {
  margin: 0;
  font-size: inherit;
}

.app-nav-section-toggle,
.app-nav-link {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: .625rem;
  color: var(--app-nav-text);
  border: 0;
  border-radius: 4px;
  text-align: left;
}

.app-nav-section-toggle {
  padding: .5rem .625rem;
  background: transparent;
  font-weight: 700;
}

.app-nav-section-toggle:hover {
  background: var(--app-nav-hover);
}

.app-nav-link {
  position: relative;
  margin: 1px 0;
  padding: .5rem .625rem .5rem .875rem;
  border-left: 4px solid transparent;
  font-size: .925rem;
  text-decoration: none;
}

.app-nav-link:hover {
  color: #084298;
  background: var(--app-nav-hover);
}

.app-nav-link.active {
  color: #084298;
  background: var(--app-nav-active);
  border-left-color: var(--app-nav-active-border);
  font-weight: 700;
}

.app-nav-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #3e4a56;
  background: #e2e6ea;
  border: 1px solid #cbd1d7;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
}

.app-nav-section-icon {
  color: #fff;
  background: #4f5d6a;
  border-color: #4f5d6a;
}

.app-nav-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.app-nav-chevron {
  width: .55rem;
  height: .55rem;
  flex: 0 0 .55rem;
  border-right: 2px solid #6c757d;
  border-bottom: 2px solid #6c757d;
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.app-nav-section-toggle[aria-expanded="true"] .app-nav-chevron {
  transform: rotate(225deg);
}

.app-nav-section-panel {
  padding: .125rem 0 .25rem;
}

.app-nav-badge {
  flex: 0 0 auto;
}

.app-nav-badge:empty {
  display: none;
}

.app-sidebar-overlay {
  position: fixed;
  z-index: 1020;
  inset: var(--app-header-height) 0 0;
  visibility: hidden;
  padding: 0;
  background: rgba(20, 27, 34, .48);
  border: 0;
  opacity: 0;
  transition: opacity .2s ease, visibility .2s ease;
}

.app-content {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--app-header-height);
  transition: margin-left .18s ease;
}

.app-content.has-sidebar {
  margin-left: var(--app-sidebar-width);
}

.app-main {
  min-width: 0;
  min-height: calc(100vh - var(--app-header-height) - 53px);
  flex: 1 0 auto;
  padding: 1rem 1.5rem 2rem;
}

.app-footer {
  position: static;
  width: 100%;
  min-height: 53px;
  flex: 0 0 auto;
  padding: 1rem 1.5rem;
  line-height: 1.35;
  white-space: normal;
  background: #fff;
}

body.app-sidebar-collapsed .app-sidebar {
  width: var(--app-sidebar-collapsed-width);
}

body.app-sidebar-collapsed .app-content.has-sidebar {
  margin-left: var(--app-sidebar-collapsed-width);
}

body.app-sidebar-collapsed .app-sidebar-scroll {
  padding-right: .45rem;
  padding-left: .45rem;
}

body.app-sidebar-collapsed .app-nav-section-toggle,
body.app-sidebar-collapsed .app-nav-link {
  justify-content: center;
  gap: 0;
  padding-right: .25rem;
  padding-left: .25rem;
}

body.app-sidebar-collapsed .app-nav-label,
body.app-sidebar-collapsed .app-nav-chevron,
body.app-sidebar-collapsed .app-nav-badge {
  display: none;
}

body.app-sidebar-collapsed .app-nav-link {
  border-left-width: 3px;
}

@media (max-width: 991.98px) {
  .app-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .625rem;
    padding-right: .75rem;
    padding-left: .75rem;
  }

  .app-brand-logo {
    height: 34px;
    max-width: 170px;
  }

  .app-sidebar {
    width: min(86vw, 304px);
    visibility: hidden;
    transform: translateX(-100%);
    box-shadow: 4px 0 18px rgba(24, 31, 38, .2);
  }

  .app-sidebar-mobile-header {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .25rem .75rem .25rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--app-sidebar-border);
  }

  .app-sidebar-scroll {
    height: calc(100% - 52px);
  }

  .app-content.has-sidebar,
  body.app-sidebar-collapsed .app-content.has-sidebar {
    margin-left: 0;
  }

  body.app-sidebar-collapsed .app-sidebar {
    width: min(86vw, 304px);
  }

  body.app-sidebar-collapsed .app-sidebar-scroll {
    padding: .75rem .625rem 1.5rem;
  }

  body.app-sidebar-collapsed .app-nav-section-toggle,
  body.app-sidebar-collapsed .app-nav-link {
    justify-content: flex-start;
    gap: .625rem;
    padding-right: .625rem;
  }

  body.app-sidebar-collapsed .app-nav-section-toggle {
    padding-left: .625rem;
  }

  body.app-sidebar-collapsed .app-nav-link {
    padding-left: .875rem;
    border-left-width: 4px;
  }

  body.app-sidebar-collapsed .app-nav-label,
  body.app-sidebar-collapsed .app-nav-chevron {
    display: initial;
  }

  body.app-sidebar-collapsed .app-nav-label {
    display: block;
  }

  body.app-drawer-open .app-sidebar {
    visibility: visible;
    transform: translateX(0);
  }

  body.app-drawer-open .app-sidebar-overlay {
    visibility: visible;
    opacity: 1;
  }
}

@media (max-width: 767.98px) {
  .app-header-location {
    display: block;
  }

  .app-header-section,
  .app-header-separator {
    display: none;
  }

  .app-header-title {
    display: block;
    font-size: .925rem;
  }

  .app-user-name {
    display: none;
  }

  .app-main {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

@media (max-width: 575.98px) {
  :root {
    --app-header-height: 60px;
  }

  .app-header {
    gap: .25rem;
    padding-right: .375rem;
    padding-left: .375rem;
  }

  .app-header-brand {
    gap: .25rem;
  }

  .app-brand-logo {
    height: 29px;
    max-width: 124px;
  }

  .app-header-title {
    font-size: .875rem;
  }

  .app-header-action {
    width: 42px;
    min-height: 44px;
    justify-content: center;
    padding: .375rem;
  }

  .app-header-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .app-main {
    min-height: calc(100vh - var(--app-header-height) - 63px);
    padding: .75rem .75rem 1.5rem;
  }

  .app-footer {
    min-height: 63px;
    padding: .875rem .75rem;
    font-size: .8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .app-content,
  .app-sidebar-overlay,
  .app-nav-chevron {
    transition: none;
  }
}

/* ---- スマホ実機UX（r21） ---- */

/* iOS で入力フォーカス時に自動ズームさせない（16px 未満だとズームする） */
@media (max-width: 575.98px) {
  .form-control,
  .form-select,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* タップしやすいボタン高さ（小サイズでも指で押しやすく） */
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn-sm {
    min-height: 40px;
  }
  /* リンクボタン（キャンセル等）は高さ指定から除外 */
  .btn-link {
    min-height: 0;
  }

  /* ナビの各項目もタップ領域を確保 */
  .navbar-nav .nav-link {
    padding-top: .5rem;
    padding-bottom: .5rem;
  }
}

/* 横スクロールする表は慣性スクロール＋端が切れていることが分かるように */
.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* 現在地が分かるナビのアクティブ表示 */
.navbar-nav .nav-link.active {
  color: #0d6efd !important;
  border-bottom: 2px solid #0d6efd;
}

/* 検索付き Worker 選択（カード型） */
.worker-picker-list {
  max-height: 15rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.worker-option {
  cursor: pointer;
  margin: 0;
}
.worker-option:last-child {
  border-bottom: 0 !important;
}
.worker-option:hover {
  background-color: #f2f6ff;
}
.worker-option:has(input:checked) {
  background-color: #e7f1ff;
}

/* カード内の操作ボタンが折り返しても間隔を保つ */
.card .btn + .btn,
.card .btn + form,
.card form + .btn,
.card form + form {
  margin-top: .25rem;
}

/* 全員シフトカレンダー: 日付セル全体をタップ対象にする */
.shift-calendar-day {
  cursor: pointer;
  transition: background-color .12s ease, box-shadow .12s ease;
}

.shift-calendar-day:hover,
.shift-calendar-day:focus {
  background-color: rgba(13, 110, 253, .08);
  box-shadow: inset 0 0 0 2px rgba(13, 110, 253, .2);
  outline: none;
}

@media (max-width: 575.98px) {
  .shift-calendar-day {
    min-height: 5.5rem;
  }
}

.portal-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.portal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  background: linear-gradient(135deg, #f7fbff 0%, #f8fafc 46%, #fff8f1 100%);
  border: 1px solid #dbe4ee;
  border-radius: 8px;
}

.portal-hero h1 {
  margin: .15rem 0 .25rem;
  color: #16202a;
  font-size: 1.55rem;
  font-weight: 800;
}

.portal-hero p {
  max-width: 42rem;
  margin: 0;
  color: #5f6b78;
  font-size: .95rem;
}

.portal-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
}

.portal-kicker {
  color: #516070;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.portal-section {
  margin-top: 1.4rem;
}

.portal-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
}

.portal-section-heading h2 {
  margin: 0;
  color: #1f2933;
  font-size: 1rem;
  font-weight: 800;
}

.portal-section-heading p {
  margin: .15rem 0 0;
  color: #667789;
  font-size: .86rem;
}

.portal-system-section {
  padding-top: 1rem;
  border-top: 1px solid #e1e7ef;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .75rem;
}

.portal-grid-featured {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.portal-card {
  display: grid;
  min-height: 7.25rem;
  align-content: start;
  gap: .35rem;
  padding: 1rem;
  color: #212529;
  text-decoration: none;
  background: #fff;
  border: 1px solid #d8e0ea;
  border-left: 4px solid #6c757d;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(20, 29, 38, .04);
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease, background-color .12s ease;
}

.portal-card-featured {
  min-height: 8.5rem;
  grid-template-columns: auto 1fr;
  column-gap: .8rem;
  align-items: start;
}

.portal-card-featured .portal-card-title,
.portal-card-featured .portal-card-text {
  grid-column: 2;
}

.portal-card:hover,
.portal-card:focus {
  color: #111827;
  border-color: #9ab0c8;
  background: #fcfdff;
  box-shadow: 0 .5rem 1.25rem rgba(20, 29, 38, .1);
  transform: translateY(-1px);
  outline: none;
}

.portal-app-mark {
  display: inline-grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  color: #fff;
  background: #2d6cdf;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 800;
}

.portal-card-title {
  font-size: 1rem;
  font-weight: 800;
}

.portal-card-text {
  color: #617083;
  font-size: .86rem;
  line-height: 1.45;
}

.portal-accent-schedule { border-left-color: #2f80ed; }
.portal-accent-work { border-left-color: #16856f; }
.portal-accent-sales { border-left-color: #c47f16; }
.portal-accent-commerce { border-left-color: #8a63d2; }
.portal-accent-review { border-left-color: #d14d72; }
.portal-accent-payroll { border-left-color: #227093; }
.portal-accent-risk { border-left-color: #d9480f; }
.portal-accent-adjust { border-left-color: #6f42c1; }
.portal-accent-analytics { border-left-color: #0f766e; }
.portal-accent-flow { border-left-color: #375a7f; }
.portal-accent-log { border-left-color: #495057; }
.portal-accent-delivery { border-left-color: #0b7285; }
.portal-accent-notify { border-left-color: #e67700; }
.portal-accent-message { border-left-color: #2b8a3e; }
.portal-accent-master { border-left-color: #5c7cfa; }
.portal-accent-admin { border-left-color: #862e9c; }
.portal-accent-system { border-left-color: #343a40; }

.portal-accent-schedule .portal-app-mark { background: #2f80ed; }
.portal-accent-work .portal-app-mark { background: #16856f; }
.portal-accent-payroll .portal-app-mark { background: #227093; }
.portal-accent-flow .portal-app-mark { background: #375a7f; }

@media (max-width: 575.98px) {
  .portal-hero {
    display: block;
    padding: 1rem;
  }

  .portal-hero h1 {
    font-size: 1.32rem;
  }

  .portal-hero-actions {
    justify-content: flex-start;
    margin-top: .85rem;
  }

  .portal-section-heading {
    display: block;
  }

  .portal-grid,
  .portal-grid-featured {
    grid-template-columns: 1fr;
  }

  .portal-card,
  .portal-card-featured {
    min-height: auto;
  }
}

/* Bootstrap 5.2 text/background helpers used by the app, for bundled Bootstrap 5.1. */
.text-bg-primary {
  color: #fff;
  background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-secondary {
  color: #fff;
  background-color: rgba(var(--bs-secondary-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-success {
  color: #fff;
  background-color: rgba(var(--bs-success-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-danger {
  color: #fff;
  background-color: rgba(var(--bs-danger-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-warning {
  color: #212529;
  background-color: rgba(var(--bs-warning-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-info {
  color: #212529;
  background-color: rgba(var(--bs-info-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-light {
  color: #212529;
  background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity, 1));
}

.text-bg-dark {
  color: #fff;
  background-color: rgba(var(--bs-dark-rgb), var(--bs-bg-opacity, 1));
}

.my-payroll-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.my-payroll-period {
  border-radius: 6px;
}

.my-payroll-summary > .col {
  min-width: 0;
}

.my-payroll-summary dt {
  color: #5b6570;
  font-size: .78rem;
  font-weight: 600;
}

.my-payroll-summary dd {
  margin-bottom: 0;
  font-weight: 700;
}

.my-payroll-net {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid #dee2e6;
  padding-top: .75rem;
}

.my-payroll-net strong {
  font-size: 1.35rem;
}

.my-payroll-empty {
  max-width: 42rem;
}

@media (max-width: 575.98px) {
  .my-payroll-heading {
    display: block;
  }

  .my-payroll-net strong {
    font-size: 1.18rem;
  }

  .my-payroll-period .card-footer .btn {
    flex: 1 1 9rem;
  }

  details > summary {
    overflow-wrap: anywhere;
  }
}
