.character-search-panel {
  padding-top: 2px;
}

.character-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.character-control {
  display: grid;
  min-width: 0;
}

.character-control span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.character-filter-panel {
  padding-top: 4px;
}

.character-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.character-filter-control {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.character-filter-control span {
  color: #147b98;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
}

.character-filter-select,
.character-search {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--brand-light);
  border-radius: 12px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  font-weight: 700;
}

.character-filter-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--brand) 50%), linear-gradient(135deg, var(--brand) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.character-filter-select:focus,
.character-search:focus {
  outline: none;
  border-color: #147b98;
  box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.12);
}

.character-table-wrap {
  overflow-x: auto;
  border: 2px solid var(--brand-light);
  border-radius: 14px;
  background: #fff;
}

.character-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  table-layout: fixed;
}

.character-table th:nth-child(1),
.character-table td:nth-child(1) { width: 46%; }
.character-table th:nth-child(2),
.character-table td:nth-child(2) { width: 54%; }

.character-table--scoped {
  min-width: 0;
}

.character-table--scoped th:nth-child(1),
.character-table--scoped td:nth-child(1) { width: 100%; }

.character-table thead th {
  padding: 0;
  background: #eef9fb;
  border-bottom: 2px solid var(--brand-light);
  text-align: left;
}

.character-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--rule-line);
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.character-table tbody tr:last-child td {
  border-bottom: 0;
}


.character-sort-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 2.55rem;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: #147b98;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
}

.character-sort-button:hover,
.character-sort-button:focus-visible {
  background: rgba(244, 114, 182, 0.08);
  outline: none;
}

.character-sort-icon {
  color: var(--accent);
  font-size: 0.82rem;
}

.character-name-cell {
  color: var(--accent);
}

.character-name-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 900;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.character-name-static {
  display: inline-block;
  max-width: 100%;
  color: var(--accent);
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.character-name-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.character-name-button:hover,
.character-name-button:focus-visible {
  color: #147b98;
  text-decoration: underline;
  outline: none;
}

.character-open-icon {
  flex: 0 0 auto;
  color: #147b98;
  font-size: 0.76rem;
  text-decoration: none;
}

.character-detail-cell {
  padding: 0 !important;
  background: #f7fdff !important;
}

.character-detail-cell .character-detail {
  padding: 10px;
}

.character-list {
  display: grid;
  gap: 8px;
}

.character-card {
  border: 2px solid var(--brand-light);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.character-card.is-open {
  background: #f7fdff;
}

.character-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.character-card-summary::-webkit-details-marker {
  display: none;
}

.character-card-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.character-mobile-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 2px;
  padding: 0 12px;
}

.character-mobile-sort-button {
  min-width: 0;
  min-height: 2rem;
  padding: 5px 7px;
  border: 1px solid var(--brand-light);
  border-radius: 10px;
  background: #fff;
  color: #147b98;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  cursor: pointer;
}

.character-mobile-sort-button.is-active {
  border-color: #147b98;
  background: #eef9fb;
  color: var(--accent);
}

.character-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.character-card-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef9fb;
  color: #147b98;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.character-card-name-cell {
  min-width: 0;
}

.character-card-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 1.55rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef9fb;
  color: #147b98;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.character-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  padding: 0 14px 12px;
}

.character-detail-item {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 10px;
  border: 1px solid var(--brand-light);
  border-radius: 10px;
  background: #fff;
}

.character-detail-item h3 {
  margin: 0;
  color: #147b98;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: nowrap;
}

.character-detail-item p {
  margin: 0;
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.character-empty {
  margin: 0;
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
}

/* The original table/card layout is shared; these rules only support static twins. */
body[data-rendering="static"] [hidden] { display: none !important; }
[data-static-list] { min-width: 0; scroll-margin-top: 1rem; }
[data-static-list] .static-mobile { display: none; }
[data-static-list] .character-card-value { white-space: normal; overflow-wrap: anywhere; }
[data-static-list] [data-static-count] { font-size: .8rem; text-align: right; margin: .5rem 0; }
[data-static-list] [data-static-reset] { font: inherit; cursor: pointer; }
[data-static-list] button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-static-list] .character-detail { padding: 10px; }
@media (max-width: 850px) {
  [data-static-list] .static-desktop { display: none; }
  [data-static-list] .static-mobile { display: block; }
}

body[data-rendering="static"] .static-page-kind { display: inline-block; }
/* Keep the existing five columns and all profile fields readable. */
.character-table th:nth-child(1), .character-table td:nth-child(1) { width: 23%; }
.character-table th:nth-child(2), .character-table td:nth-child(2) { width: 10%; }
.character-table th:nth-child(3), .character-table td:nth-child(3) { width: 18%; }
.character-table th:nth-child(4), .character-table td:nth-child(4) { width: 31%; }
.character-table th:nth-child(5), .character-table td:nth-child(5) { width: 18%; }
.character-table thead th { padding: 8px 10px; color: #147b98; }
.character-table thead th:has(button) { padding: 0; }
.character-role, .character-card-role { display: block; margin-top: 4px; font-size: .78rem; }
.character-mobile-list-head { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.character-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.character-filter-control:has([data-static-filter="agency"]) { grid-column: 1 / -1; }
.character-filter-select[data-static-filter="agency"] { font-size: .85rem; }
.character-filter-panel [data-static-reset] { margin-top: 10px; }
.character-card-summary { grid-template-columns: minmax(0, 1fr); }
.character-card-value { display: grid; gap: 5px; justify-content: stretch; text-align: left; background: transparent; padding: 0; color: var(--text-main); font-size: .85rem; }
.character-card-meta { display: grid; gap: 4px; }
.character-card-meta span { border-radius: 4px; white-space: normal; overflow-wrap: anywhere; color: var(--text-main); font-size: .85rem; }
.character-detail-item:first-child { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.character-detail-item h3, .character-detail-item p { line-height: 1.6; }
.character-detail-item { grid-template-columns: 5rem minmax(0, 1fr); }
@media (max-width: 850px) {
  .character-filter-grid { grid-template-columns: minmax(0, 1fr); }
  .character-detail { grid-template-columns: minmax(0, 1fr); }
}
