/* Compare tray, Compare view, Rank view */
.linkish {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: 0.82rem;
}
.linkish.strong { font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.linkish.strong:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 0.8em; }
.warn-line { color: var(--warn); font-size: 0.85rem; margin: 0.4rem 0 0.8rem; }
.warn-txt { color: var(--warn); }

/* pin on cards */
.mcard { position: relative; }
.pin {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.72rem; font-weight: 600; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--card); border-radius: 999px; padding: 0.15rem 0.55rem;
  cursor: pointer; font-family: var(--mono);
}
.mcard .pin { position: absolute; top: 0.5rem; right: 0.5rem; opacity: 0; transition: opacity .12s; }
.mcard:hover .pin, .mcard:focus-within .pin, .mcard .pin.on, .mcard .pin:focus { opacity: 1; }
@media (hover: none) { .mcard .pin { opacity: 1; } }
.pin.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pin-here {
  border: 1px dashed var(--accent); background: transparent; color: var(--accent);
  border-radius: 8px; padding: 0.5rem 0.9rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px;
}
.pin-here.on { background: var(--accent); color: #fff; border-style: solid; }

/* tray */
.cmp-tray {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; z-index: 50;
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; max-width: calc(100vw - 2rem);
  background: var(--ink); color: #f3f1ea; padding: 0.55rem 0.7rem 0.55rem 1rem;
  border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.cmp-tray[hidden] { display: none; }
.cmp-tray-k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.cmp-tray .cmp-chip { background: rgba(255,255,255,.12); color: inherit; border-color: transparent; }
.cmp-tray .cmp-chip button { color: inherit; }
.cmp-tray .linkish { color: #cfe3dc; }
.cmp-tray button.action { min-height: 36px; padding: 0.35rem 0.9rem; }
@media (max-width: 760px) { .cmp-tray { bottom: 4.6rem; } }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid var(--line);
  border-radius: 999px; padding: 0.15rem 0.3rem 0.15rem 0.65rem; font-size: 0.82rem; background: var(--card);
}
.cmp-chip button { background: none; border: 0; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.25rem; color: var(--muted); }

/* toolbars */
.ux-slice { margin-bottom: 0.8rem; }
.cmp-toolbar, .rank-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 0.8rem;
}
.cmp-toolbar label, .rank-toolbar label { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; color: var(--muted); }
.rank-toolbar label.chk { gap: 0.3rem; }
.rank-toolbar .spacer { flex: 1; }
.cmp-part-form { display: inline-flex; gap: 0.35rem; }
.cmp-part-form input { width: 6.5rem; }
.cmp-base-switch { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; font-size: 0.85rem; color: var(--muted); }
.cmp-base-switch button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0.25rem 0.65rem;
  font: inherit; font-size: 0.8rem; cursor: pointer;
}
.cmp-base-switch button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.ux-empty { max-width: 720px; }

/* skeleton */
.skeleton { height: 220px; border-radius: 8px; background: linear-gradient(90deg, var(--bg-2), var(--card), var(--bg-2)); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }

/* tables */
.table-scroll { overflow-x: auto; }
.cmp-table, .rank-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.cmp-table th, .cmp-table td, .rank-table th, .rank-table td {
  padding: 0.45rem 0.6rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); text-align: left; vertical-align: middle;
}
.cmp-table thead th { position: sticky; top: 0; background: var(--card); z-index: 1; vertical-align: bottom; }
.cmp-table tbody th[scope=row] { font-weight: 500; white-space: nowrap; color: var(--ink); min-width: 10rem; }
.cmp-col { border-top: 4px solid var(--c); min-width: 11rem; }
.cmp-head-name { background: none; border: 0; padding: 0; font: inherit; font-family: var(--display); font-size: 1.15rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.cmp-head-name:hover { text-decoration: underline; }
.cmp-sub { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.cmp-head-tools { display: flex; gap: 0.6rem; margin-top: 0.2rem; font-weight: 400; }
.base-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; }
.ac-col { color: var(--muted); background: color-mix(in srgb, var(--bg-2) 40%, transparent); }
.cmp-table tr.sec th {
  background: var(--bg-2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-top: 0.6rem;
}
.cmp-table tr.sec .linkish { text-transform: none; letter-spacing: 0; margin-left: 0.6rem; }
.cmp-cell { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 0.4rem; }
.cmp-bar { height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; min-width: 50px; }
.cmp-bar > div { height: 100%; border-radius: 4px; }
.cmp-num { font-variant-numeric: tabular-nums; min-width: 3.4rem; text-align: right; }
.cmp-surn { margin: 0; padding-left: 1.1rem; font-size: 0.82rem; line-height: 1.5; }

.delta { font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: #0b6b3a; }
.delta.down { color: #a3361b; }
.delta.zero { color: var(--muted); }

.tone-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; background: #9aa49c; }
.tone-dot.tone-primary { background: var(--accent); }
.tone-dot.tone-caution { background: var(--accent-2); }
.tone-dot.tone-neutral { background: #3d6b5c; }

/* rank */
.rank-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.rank-table th.sortable:hover { color: var(--accent); }
.rank-table th.wide { min-width: 14rem; }
.rank-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rank-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.rank-table tr.small-n { opacity: 0.6; }
.rank-i { color: var(--muted); width: 2rem; font-variant-numeric: tabular-nums; }
.rank-table td:nth-child(3) { display: flex; align-items: center; gap: 0.5rem; }
.rank-bar { position: relative; flex: 1; height: 10px; background: var(--bg-2); border-radius: 5px; }
.rank-bar > div { height: 100%; background: var(--accent); border-radius: 5px; }
.rank-bar > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.rank-num { min-width: 3.4rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tag-small { font-size: 0.65rem; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 0.25rem; }
.row-tools { white-space: nowrap; text-align: right; }
.row-tools .pin { margin-left: 0.4rem; }

.rank-table td:nth-child(2) { white-space: nowrap; }
.cmp-table tbody th[scope=row], .rank-table th { text-transform: none; letter-spacing: 0; font-size: 0.86rem; }

.cmp-tray.cmp-tray-collapsed { opacity: 0.92; padding: 0.4rem 0.65rem; }
.cmp-tray.cmp-tray-collapsed .cmp-chip.muted { background: rgba(255,255,255,.08); padding: 0.15rem 0.55rem; }
body.dest-people .cmp-tray:not([hidden]) { bottom: 1.1rem; }
