body {
  background-color: #f4f6f9;
  font-size: 0.9375rem;
}

/* Bootstrap's small text (hints, notes, form help) is 87.5 %, too small for Japanese at this base size */
.small, small, .form-text {
  font-size: 0.9em;
}

.sortable {
  cursor: pointer;
  user-select: none;
}
/* Tint through Bootstrap's table state variable: replacing the background would drop
   the dark header color and leave white text on a white card */
.sortable:hover {
  --bs-table-bg-state: rgba(255,255,255,0.15);
}
.sortable::after {
  content: ' ↕';
  opacity: 0.4;
  font-size: 0.75em;
}

.badge-read   { background-color: #0d6efd; }
.badge-write  { background-color: #198754; }
.badge-delete { background-color: #dc3545; }

.access-bar {
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  overflow: hidden;
  min-width: 60px;
}
.access-bar-fill {
  height: 100%;
  background: #0d6efd;
  transition: width 0.3s;
}

.table-sm td, .table-sm th {
  white-space: nowrap;
}
.path-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tabs .nav-link {
  color: #495057;
}
.nav-tabs .nav-link.active {
  font-weight: 600;
}

.detail-section-title {
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.3rem;
  margin-bottom: 0.75rem;
}

/* On Japanese Windows, system-ui resolves to a Japanese font that draws "\" as "¥".
   In English mode, prefer Segoe UI so paths show backslashes. */
html[lang="en"] {
  --bs-body-font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* The server column appears only when records come from more than one file server */
body.single-server .col-server {
  display: none;
}

/* Create (green-teal) and Permission (purple) have no Bootstrap colour of their own */
.badge-create     { background-color: #20c997; color: #000; }
.badge-permission { background-color: #6f42c1; color: #fff; }
.bg-purple-subtle     { background-color: #e2d9f3; }
.text-purple-emphasis { color: #432874; }
.border-purple-subtle { border-color: #cbbbe9 !important; }

/* The detail of a permission change (popover) */
.record-detail { --bs-popover-max-width: 520px; }
.record-detail .popover-body {
  white-space: pre-wrap;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  max-width: 480px;
  word-break: break-all;
}

/* The folder list of the Unused Files and Permissions tabs: long lists scroll */
.folder-menu { max-height: 20rem; overflow-y: auto; }

/* Settings: the menu on the left; on a narrow screen it wraps into a row of buttons above the page */
.settings-nav { position: sticky; top: 0.75rem; }
.settings-nav-group {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 0.35rem 0.25rem;
}
.settings-nav .list-group { border-radius: 0.5rem; overflow: hidden; border: 1px solid var(--bs-border-color); }
.settings-nav .list-group-item { padding: 0.45rem 0.75rem; }
.settings-nav .list-group-item.active { font-weight: 600; }
@media (max-width: 767.98px) {
  .settings-nav { position: static; }
  .settings-nav .list-group { flex-direction: row; flex-wrap: wrap; border: 0; gap: 0.25rem; }
  .settings-nav .list-group-item { border: 1px solid var(--bs-border-color); border-radius: 1rem; width: auto; }
}

/* A hint's details: one line first, the rest only when asked for */
details.hint-more { display: inline; }
details.hint-more > summary {
  display: inline;
  cursor: pointer;
  color: var(--bs-link-color);
  list-style: none;
  white-space: nowrap;
}
details.hint-more > summary::-webkit-details-marker { display: none; }
details.hint-more > summary::after { content: ' \25B8'; font-size: 0.8em; }
details.hint-more[open] > summary::after { content: ' \25BE'; }
details.hint-more[open] { display: block; }
details.hint-more > div {
  margin-top: 0.25rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  border-radius: 0 0.25rem 0.25rem 0;
}

/* The totals tab: the buttons for by file / folder / user */
#totalsBar .btn.active { font-weight: 600; }
