body {
  font-size: 0.95rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.page-description {
  margin-bottom: 0;
  color: var(--bs-secondary-color);
}

.table td,
.table th {
  vertical-align: middle;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--bs-secondary-color);
  border: 1px dashed var(--bs-border-color);
  border-radius: 0.75rem;
  background: var(--bs-tertiary-bg);
}

.detail-list dt {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

.detail-list dd {
  margin-bottom: 1rem;
  font-weight: 500;
}

/*
 * Theme-aware table header.
 *
 * Do not use Bootstrap's table-light for app tables because it is a fixed
 * light table variant. Use app-table-head instead.
 */
.table > thead.app-table-head {
  --bs-table-color: var(--bs-emphasis-color);
  --bs-table-bg: var(--bs-tertiary-bg);
  --bs-table-border-color: var(--bs-border-color);
}

.table > thead.app-table-head > tr > * {
  color: var(--bs-table-color);
  background-color: var(--bs-table-bg);
  border-color: var(--bs-table-border-color);
}

/*
 * Business action color policy
 *
 * These classes are used across the system for business-object actions.
 * Do not choose colors per screen.
 *
 * customer: green
 * vehicle: blue
 * call log: yellow
 * work order: red
 * reservation: pink
 */

/* action-color-policy:start */
:root {
  --action-customer: #198754;
  --action-vehicle: #0d6efd;
  --action-call-log: #ffc107;
  --action-call-log-text: #5f4700;
  --action-work-order: #dc3545;
  --action-reservation: #d63384;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.btn-action-customer {
  --bs-btn-color: var(--action-customer);
  --bs-btn-border-color: var(--action-customer);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--action-customer);
  --bs-btn-hover-border-color: var(--action-customer);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--action-customer);
  --bs-btn-active-border-color: var(--action-customer);
}

.btn-action-vehicle {
  --bs-btn-color: var(--action-vehicle);
  --bs-btn-border-color: var(--action-vehicle);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--action-vehicle);
  --bs-btn-hover-border-color: var(--action-vehicle);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--action-vehicle);
  --bs-btn-active-border-color: var(--action-vehicle);
}

.btn-action-call-log {
  --bs-btn-color: var(--action-call-log-text);
  --bs-btn-border-color: var(--action-call-log);
  --bs-btn-hover-color: #212529;
  --bs-btn-hover-bg: var(--action-call-log);
  --bs-btn-hover-border-color: var(--action-call-log);
  --bs-btn-active-color: #212529;
  --bs-btn-active-bg: var(--action-call-log);
  --bs-btn-active-border-color: var(--action-call-log);
}

.btn-action-work-order {
  --bs-btn-color: var(--action-work-order);
  --bs-btn-border-color: var(--action-work-order);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--action-work-order);
  --bs-btn-hover-border-color: var(--action-work-order);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--action-work-order);
  --bs-btn-active-border-color: var(--action-work-order);
}

.btn-action-reservation {
  --bs-btn-color: var(--action-reservation);
  --bs-btn-border-color: var(--action-reservation);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--action-reservation);
  --bs-btn-hover-border-color: var(--action-reservation);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--action-reservation);
  --bs-btn-active-border-color: var(--action-reservation);
}

.action-list-customer {
  border-left: 0.3rem solid var(--action-customer);
  color: var(--action-customer);
  font-weight: 600;
}

.action-list-vehicle {
  border-left: 0.3rem solid var(--action-vehicle);
  color: var(--action-vehicle);
  font-weight: 600;
}

.action-list-call-log {
  border-left: 0.3rem solid var(--action-call-log);
  color: var(--action-call-log-text);
  font-weight: 600;
}

.action-list-work-order {
  border-left: 0.3rem solid var(--action-work-order);
  color: var(--action-work-order);
  font-weight: 600;
}

.action-list-reservation {
  border-left: 0.3rem solid var(--action-reservation);
  color: var(--action-reservation);
  font-weight: 600;
}
/* action-color-policy:end */


/*
 * Global header.
 * Daily operations are kept minimal: brand, workbench entry, global search,
 * theme toggle, and account menu.
 */
.global-header {
  min-height: 3.5rem;
}

.global-header .navbar-brand {
  white-space: nowrap;
}

.global-header-spacer {
  flex: 1 1 auto;
}

.global-header-search {
  width: min(38vw, 440px);
  min-width: 240px;
}

.global-header-search-input {
  border-radius: 999px;
}

.theme-icon-toggle {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.account-menu-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  line-height: 1;
}

.account-avatar {
  position: relative;
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
}

.account-caret {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  transform: translateY(-1px);
}

.account-notification-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: calc(1rem - 4px);
  text-align: center;
}

@media (max-width: 991.98px) {
  .global-header-search {
    width: 100%;
    min-width: 0;
  }

  .theme-icon-toggle,
  .account-menu-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  line-height: 1;
}
}



.account-menu-label {
  font-weight: 600;
  white-space: nowrap;
}

.account-menu {
  position: relative;
}

.account-menu .dropdown-menu {
  right: 0;
  left: auto;
  min-width: 14rem;
  max-width: min(20rem, calc(100vw - 1rem));
}

.account-notification-badge {
  position: absolute;
  top: -0.35rem;
  right: 1.2rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: calc(1rem - 4px);
  text-align: center;
}

@media (max-width: 991.98px) {
  .account-menu {
    align-self: flex-start;
  }

  .account-menu .dropdown-menu {
    position: absolute;
    right: 0;
    left: auto;
    min-width: 12rem;
    max-width: calc(100vw - 1rem);
  }
}

/* Header interaction refinements */
.global-navbar-toggler {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--bs-navbar-color, #fff);
}

.global-navbar-toggler:hover {
  background: rgba(255, 255, 255, 0.08);
}

.global-navbar-toggler:focus,
.global-navbar-toggler:focus-visible,
.theme-icon-toggle:focus,
.theme-icon-toggle:focus-visible,
.account-menu-toggle:focus,
.account-menu-toggle:focus-visible {
  outline: none;
  box-shadow: none;
}

.global-navbar-toggle-icon {
  width: 1.55rem;
  height: 1.15rem;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}

.global-navbar-toggle-icon span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.global-navbar-toggler.is-open .global-navbar-toggle-icon span:nth-child(1) {
  transform: translateY(0.575rem) rotate(45deg);
}

.global-navbar-toggler.is-open .global-navbar-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.global-navbar-toggler.is-open .global-navbar-toggle-icon span:nth-child(3) {
  transform: translateY(-0.575rem) rotate(-45deg);
}

.theme-icon-toggle {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  line-height: 1;
}

.theme-icon-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.account-menu-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.25rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1;
}

.account-menu-toggle:hover {
  background: transparent;
}

.account-avatar {
  display: none;
}

.account-menu-label {
  font-weight: 600;
  white-space: nowrap;
}

.account-caret {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  transform: translateY(-1px);
}

.account-menu {
  position: relative;
}

.account-menu .dropdown-menu {
  right: 0;
  left: auto;
  min-width: 12rem;
  max-width: min(20rem, calc(100vw - 1rem));
}

.account-notification-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: calc(1rem - 4px);
  text-align: center;
}

@media (max-width: 991.98px) {
  .account-menu {
    align-self: flex-start;
  }

  .account-menu .dropdown-menu {
    position: absolute;
    right: auto;
    left: 0;
    min-width: 12rem;
    max-width: calc(100vw - 2rem);
  }
}
/* Theme toggle label visibility */
.theme-toggle-label {
  display: none;
}

@media (max-width: 991.98px) {
  .theme-icon-toggle {
    width: auto;
    justify-content: flex-start;
    gap: 0.4rem;
    padding-inline: 0.25rem;
  }

  .theme-toggle-label {
    display: inline;
    white-space: nowrap;
    font-weight: 600;
  }
}

/* Enhanced opt-in tables: sort, resize, and row selection. */
.app-enhanced-table th {
  white-space: nowrap;
}

.app-table-sortable-header {
  user-select: none;
}

.app-table-sort-button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font: inherit;
  font-weight: 600;
  padding: 0;
  text-align: left;
}

.app-table-sort-button:hover {
  text-decoration: underline;
}

.app-table-resizable-header {
  position: relative;
}

.app-table-resize-handle {
  cursor: col-resize;
  display: inline-block;
  height: 70%;
  position: absolute;
  right: 0;
  top: 15%;
  width: 0.45rem;
  z-index: 1;
}

.app-table-resize-handle::after {
  background: var(--bs-border-color);
  content: "";
  display: block;
  height: 100%;
  margin-left: 0.2rem;
  width: 1px;
}

.app-table-resizing {
  cursor: col-resize;
  user-select: none;
}

.app-table-select-cell {
  width: 2.75rem;
}

.app-enhanced-table-wrapper {
  min-height: 28rem;
}

.app-table-header-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.app-table-filterable-header.is-filter-active-column {
  background: rgba(var(--bs-primary-rgb), 0.14);
  box-shadow: inset 0 -0.2rem 0 var(--bs-primary);
}

.app-table-filter-button {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  line-height: 1;
  padding: 0.15rem 0.25rem;
}

.app-table-filter-button svg {
  display: block;
  height: 1rem;
  width: 1rem;
}

.app-table-filter-button:hover,
.app-table-filter-button.is-filter-active {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
}

.app-table-filter-button.is-filter-active {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.app-table-filter-menu {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.22);
  color: var(--bs-body-color);
  max-width: calc(100vw - 1rem);
  min-width: 16rem;
  padding: 0.75rem;
  position: fixed;
  z-index: 1050;
}

.app-table-filter-menu[hidden] {
  display: none;
}

.app-table-filter-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.app-table-filter-values {
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  max-height: 18rem;
  overflow: auto;
  padding: 0.35rem 0.5rem;
}

.app-table-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.app-table-filter-kept-selected > td {
  background: rgba(var(--bs-warning-rgb), 0.12);
  box-shadow: none;
}

.app-table-filter-kept-selected > td:nth-child(2)::after {
  content: "フィルタ外";
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--bs-warning);
  border-radius: 999px;
  color: var(--bs-warning-text-emphasis);
  background: var(--bs-warning-bg-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}
/* Header theme SVG icons */
.theme-toggle-icon {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: currentColor;
}

.theme-toggle-icon.d-none {
  display: none !important;
}

.theme-toggle-icon svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.theme-toggle-icon-sun svg {
  width: 1.35rem;
  height: 1.35rem;
}

.theme-icon-toggle {
  min-width: 2.25rem;
}

@media (max-width: 991.98px) {
  .theme-icon-toggle {
    min-width: 0;
  }
}
