:root {
  color-scheme: dark;
  --bg: #0f1419;
  --panel: #171e27;
  --line: #2a3542;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d8bfd;
  --ok: #3dd68c;
  --warn: #f5c542;
  --bad: #f07178;
  --draft: #8b9aab;
  --hover: #1b2530;
  --banner-bg: #1d2a3d;
  --banner-text: #c5d4e8;
  --banner-line: #2d4a73;
  --banner-error-bg: #2a1719;
  --banner-error-text: #f3c1c4;
  --banner-error-line: #5c2a30;
  --code: #fff;
  --ok-bg: #163528;
  --warn-bg: #3a2f12;
  --bad-bg: #3a171b;
  --draft-bg: #232a33;
  --part-text: #d5deea;
  --ai-finding-bg: #241e10;
  --ai-finding-line: #5c4a12;
  --ai-finding-text: #e6d9b0;
  --group-head-bg: #121820;
  --chip-one: #f0a14a;
  --chip-one-bg: #3a2410;
  --chip-multi: #c4a7ff;
  --chip-multi-bg: #2a1f44;
  --chip-edit-bg: #1c2d44;
  --suspect-pending: #8a6d1f;
  --suspect-confirmed: #8a3038;
  --shadow: none;
}
html.theme-light,
:root.theme-light,
html[data-theme="light"] {
  color-scheme: only light;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --line: #d5dde6;
  --text: #1a2330;
  --muted: #5b6b7c;
  --accent: #2563eb;
  --ok: #0f8a4b;
  --warn: #b45309;
  --bad: #c62828;
  --draft: #5b6b7c;
  --hover: #e8eef5;
  --banner-bg: #e8f0fe;
  --banner-text: #1a365d;
  --banner-line: #c5d4f0;
  --banner-error-bg: #fdecea;
  --banner-error-text: #8a1f24;
  --banner-error-line: #f5c2c5;
  --code: #1a2330;
  --ok-bg: #e6f4ea;
  --warn-bg: #fff6dc;
  --bad-bg: #fdecea;
  --draft-bg: #eef1f4;
  --part-text: #2c3a4a;
  --ai-finding-bg: #fff8e8;
  --ai-finding-line: #ead9a0;
  --ai-finding-text: #5c4a12;
  --group-head-bg: #eef2f6;
  --chip-one: #c05612;
  --chip-one-bg: #fff1e0;
  --chip-multi: #6d28d9;
  --chip-multi-bg: #f3e8ff;
  --chip-edit-bg: #e8f0fe;
  --suspect-pending: #c58900;
  --suspect-confirmed: #c62828;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, sans-serif; }
body.page-fill {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
body.page-fill .top,
body.page-fill .stats,
body.page-fill .toolbar,
body.page-fill .banner {
  flex-shrink: 0;
}
body.page-fill .layout,
body.page-fill .partners-page {
  flex: 1;
  min-height: 0;
}
body.page-fill .partners-page {
  display: flex;
  flex-direction: column;
}
html.theme-light,
html.theme-light body {
  background: #f3f5f8;
  color: #1a2330;
  color-scheme: only light;
}
.top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  color: var(--muted); font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
.profile-menu { position: relative; }
button.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, 46vw);
  padding: 4px 10px 4px 4px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  text-align: left;
}
button.profile-chip:hover { border-color: var(--muted); }
.profile-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.profile-chip-name {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-chip-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-caret { flex-shrink: 0; color: var(--muted); }
.profile-menu.is-open .profile-caret { transform: rotate(180deg); }
.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #5bb8ae;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar-lg { width: 40px; height: 40px; font-size: 13px; }
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(320px, 92vw);
  padding: 8px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.profile-dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
button.profile-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  text-align: left;
}
button.profile-item:hover { background: var(--hover); }
.profile-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f6611a;
  background: var(--hover);
  flex-shrink: 0;
}
.profile-item-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.profile-item-title { font-size: 13px; }
.profile-item-sub { font-size: 11px; font-weight: 500; color: var(--muted); }
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 24px; display: grid; gap: 12px;
  box-shadow: var(--shadow);
}
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; }
.login-card button { margin-top: 4px; }
.login-card .banner { margin: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.brand-mark {
  width: 30px;
  height: 32px;
  flex-shrink: 0;
  display: block;
}
.brand-lockup {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  line-height: 1.05;
}
.brand-name {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
  display: block;
}
.brand-app {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #df7e18;
}
.sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.sub-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.sub-with-action .sub,
.sub-with-action > span { margin-top: 0; }
button.sub-refresh {
  min-width: 0;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  height: auto;
  color: var(--accent);
}
button.sub-refresh:disabled {
  opacity: 0.6;
  cursor: wait;
}
.sub-help { display: flex; align-items: center; gap: 8px; }
.help-tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border: 1px solid var(--muted); border-radius: 50%;
  color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; flex-shrink: 0; line-height: 1;
}
button.help-tip {
  background: transparent;
  color: var(--muted);
  padding: 0;
  min-width: 16px;
  box-shadow: none;
  font-weight: 700;
}
.help-tip:hover, .help-tip:focus { color: var(--text); border-color: var(--text); outline: none; }
.help-tip-text {
  display: none;
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 8;
  width: max-content; max-width: 280px;
  padding: 8px 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; font-weight: 400; white-space: normal;
  pointer-events: none;
  box-shadow: var(--shadow);
}
th .help-tip, label .help-tip, .sub .help-tip, .toolbar .help-tip { margin-left: 4px; }
.help-tip-text { display: none !important; }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-weight: 600;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.banner {
  margin: 16px 24px 0; padding: 12px 14px; border-radius: 8px;
  background: var(--banner-bg); color: var(--banner-text); border: 1px solid var(--banner-line);
}
.banner.error { background: var(--banner-error-bg); color: var(--banner-error-text); border-color: var(--banner-error-line); }
.banner code { color: var(--code); }
.theme-toggle {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle svg,
.theme-toggle * { pointer-events: none; }
.theme-toggle .theme-icon { width: 18px; height: 18px; display: none; }
html:not(.theme-light) .theme-icon-sun { display: block; }
html.theme-light .theme-icon-moon { display: block; }
.login-theme { position: fixed; top: 18px; right: 24px; z-index: 2; }
.hidden { display: none !important; }
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; padding: 16px 24px 0;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  box-shadow: var(--shadow);
}
button.stat {
  color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%;
}
button.stat.active { border-color: var(--accent); }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
.toolbar {
  display: flex; gap: 10px; padding: 16px 24px; flex-wrap: wrap;
  align-items: center;
}
.toolbar .col-menu { margin-left: auto; }
.icon-btn {
  min-width: 36px; width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.icon-btn svg { display: block; pointer-events: none; }
.col-settings-btn .btn-tip {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 13;
  width: max-content; max-width: 260px;
  padding: 8px 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px; font-weight: 400; white-space: normal;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.col-settings-btn:hover .btn-tip,
.col-settings-btn:focus-visible .btn-tip { display: block; }
.col-menu:has(.col-menu-panel:not(.hidden)) .btn-tip { display: none; }
input, select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
input[type="search"] { min-width: 280px; flex: 1; }
.layout { display: grid; grid-template-columns: 1fr minmax(320px, 42%); gap: 0; min-height: calc(100vh - 220px); }
body.page-fill .layout {
  min-height: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
}
.layout.single { grid-template-columns: 1fr; }
.table-wrap { overflow: auto; padding: 0 24px 24px; }
body.page-fill .table-wrap,
body.page-fill .drawer {
  min-height: 0;
  overflow: auto;
}
.table-wrap table { border-collapse: separate; border-spacing: 0; }
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg);
  box-shadow: inset 0 -1px 0 var(--line);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.active { background: var(--hover); }
.muted { color: var(--muted); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 650;
}
.s-3 { background: var(--ok-bg); color: var(--ok); }
.s-1, .s-2, .s-6, .s-60 { background: var(--warn-bg); color: var(--warn); }
.s-4, .s-5, .s-40, .s-50 { background: var(--bad-bg); color: var(--bad); }
.s-0, .s-55 { background: var(--draft-bg); color: var(--draft); }
.drawer { border-left: 1px solid var(--line); background: var(--panel); padding: 16px 18px; overflow: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { margin-top: 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; margin: 14px 0; }
.kv b { color: var(--muted); font-weight: 500; }
.products { margin-top: 16px; overflow: auto; }
.products table { min-width: 420px; }
.part { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; }
.part h3 { margin: 0 0 6px; font-size: 13px; }
.part p { margin: 0; white-space: pre-wrap; color: var(--part-text); }
.ai-actions,
.ai-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.ai-btn-label { display: inline-flex; align-items: center; gap: 8px; }
button.ai-thinking,
button.ai-thinking {
  pointer-events: none;
  cursor: wait;
  opacity: 1;
  color: #fff;
  background: linear-gradient(110deg, #2f6fd6 0%, #6aa6ff 45%, #2f6fd6 90%);
  background-size: 220% 100%;
  animation: gemini-wait 1.15s linear infinite;
  box-shadow: 0 0 0 1px #7bb0ff inset, 0 0 18px rgba(61, 139, 253, 0.35);
}
button.ai-thinking:disabled { opacity: 1; cursor: wait; }
.ai-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gemini-spin 0.7s linear infinite;
  flex: 0 0 14px;
}
@keyframes gemini-wait {
  0% { background-position: 0 0; }
  100% { background-position: 220% 0; }
}
@keyframes gemini-spin {
  to { transform: rotate(360deg); }
}
.ai-flag {
  background: #f5c542;
  color: #1a1400;
  padding: 0 3px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #c9a227;
  scroll-margin-top: 12px;
}
.ai-finding {
  border: 1px solid var(--ai-finding-line);
  background: var(--ai-finding-bg);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
}
.ai-finding p { margin: 6px 0 0; color: var(--ai-finding-text); }
.ai-finding q { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
a { color: var(--accent); }
.nav { display: flex; gap: 6px; margin-top: 8px; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 4px 10px;
  border-radius: 8px; font-size: 13px; border: 1px solid transparent;
}
.nav a:hover, .nav a.active {
  color: var(--text); background: var(--panel); border-color: var(--line);
}
.group-head td,
.group-head td,
.group-head td {
  color: var(--muted); font-size: 12px; font-weight: 650;
  background: var(--group-head-bg); cursor: default; letter-spacing: 0.01em;
}
.group-head, .group-head { cursor: default; }
.group-head { cursor: default; }
.admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 16px 24px 0;
}
.admin-tab {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  min-width: 0;
}
.admin-tab:hover,
.admin-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}
.admin-tab[aria-selected="true"] {
  border-color: var(--accent);
}
.panel[data-admin-panel] {
  margin: 12px 24px 24px;
}
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel h3 { margin: 18px 0 10px; font-size: 13px; color: var(--muted); font-weight: 650; }
.stack { display: grid; gap: 10px; margin-bottom: 16px; }
.stack label, .login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.resolution-box {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.resolution-box input { max-width: 240px; }
.resolution-box button { margin-right: 10px; }
.group-list { display: grid; gap: 8px; }
.group-item {
  display: grid; gap: 2px; text-align: left; background: var(--bg);
  border: 1px solid var(--line); color: var(--text); padding: 10px 12px; font-weight: 500;
}
.group-item span { color: var(--muted); font-size: 12px; font-weight: 400; }
.group-item.active { border-color: var(--accent); }
.partner-list, .catalog { display: grid; gap: 8px; }
.partner-chip, .catalog-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg);
  color: var(--text);
}
.partner-chip div, .catalog-item { display: grid; gap: 2px; }
.partner-chip span, .catalog-item span { color: var(--muted); font-size: 12px; }
.catalog-item { width: 100%; text-align: left; font-weight: 500; color: var(--text); }
.catalog-item:disabled,
.catalog-item.assigned { opacity: 0.7; color: var(--text); cursor: default; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.inline-form input { min-width: 160px; flex: 1; }
.sign-box,
.sign-box {
  display: grid; gap: 10px; margin: 14px 0;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.sign-box h3,
.sign-box h3 { margin: 0; font-size: 13px; color: var(--muted); }
.reject-row,
.reject-row { display: flex; gap: 8px; flex-wrap: wrap; }
.badge.assignee { background: var(--assignee-bg); color: var(--assignee-text); margin-left: 0; }
.reject-row input,
.reject-row input { flex: 1; min-width: 180px; }
.journal-block,
.journal-block { margin: 16px 0; }
.journal-block h3,
.journal-block h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.journal-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; background: var(--bg);
}
.journal-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.journal-panel { margin: 0 24px 24px; }
.settings-panel { margin: 16px 24px 0; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.inline-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.inline-form input { min-width: 180px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); margin-left: 6px; }
.panel .panel-toolbar { padding: 8px 0 12px; }
.panel .table-wrap { padding: 0; max-height: min(70vh, 720px); }
td[data-col="id"] {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}

.journal-panel .table-wrap { overflow: auto; }
.journal-panel table { width: 100%; border-collapse: collapse; }
.journal-panel th, .journal-panel td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.journal-panel th { color: var(--muted); font-size: 12px; }
button.danger, .ghost.danger { color: var(--bad); }
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .drawer { border-left: 0; border-top: 1px solid var(--line); }
  .admin-layout { grid-template-columns: 1fr; }
  .journal-panel { margin: 0 16px 16px; }
}

.badge.warn { background: var(--warn-bg); color: var(--warn); margin-left: 6px; }
.accountant-layout {
  display: grid; grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px; padding: 16px 24px; align-items: start;
}
.suspect-list { display: grid; gap: 8px; margin: 0 0 18px; }
.suspect-card {
  display: flex; justify-content: space-between; gap: 12px; align-items: start;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg);
}
.suspect-card > div:first-child { display: grid; gap: 4px; }
.suspect-card.pending { border-color: var(--suspect-pending); }
.suspect-card.confirmed { border-color: var(--suspect-confirmed); }
.suspect-actions { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 960px) {
  .accountant-layout { grid-template-columns: 1fr; }
}

.partners-page { padding: 0; }
.partners-page .table-wrap { overflow: auto; padding: 0 24px 24px; flex: 1; min-height: 0; }
.partners-page table { width: 100%; }
.partners-page th, .partners-page td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top;
}
.partners-page th { color: var(--muted); font-size: 12px; }
.assign-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.assign-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.assign-chips-head {
  flex-wrap: nowrap;
}
.assign-chips-head .chip {
  flex: 0 0 auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  border: 0;
  white-space: nowrap;
}
.chip-none { background: var(--warn-bg); color: var(--warn); }
.chip-one { background: var(--chip-one-bg); color: var(--chip-one); }
.chip-multi { background: var(--chip-multi-bg); color: var(--chip-multi); }
.chip-dept { background: var(--ok-bg); color: var(--ok); }
button.chip-edit {
  background: var(--chip-edit-bg);
  color: var(--accent);
  cursor: pointer;
  min-width: 0;
  box-shadow: none;
}
button.chip-edit:hover { filter: brightness(1.12); }
button.chip-edit svg { display: block; flex-shrink: 0; }
.partner-chip-mini {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--assignee-bg); color: var(--assignee-text);
  border-radius: 999px; padding: 2px 8px; font-size: 12px;
}
.partner-chip-mini button {
  min-width: auto; padding: 0 4px; border: 0; background: transparent;
  color: inherit; font-size: 16px; line-height: 1;
}
.assign-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.col-menu { position: relative; }
.col-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 12;
  min-width: 280px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  display: grid; gap: 2px;
}
.col-menu-panel.hidden { display: none; }
.col-menu-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 8px;
  cursor: grab;
}
.col-menu-row:hover { background: var(--hover); }
.col-menu-row.col-dragging { opacity: 0.45; }
.col-menu-row.col-drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.col-menu-row.col-drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.col-menu-row label {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  margin: 0; color: var(--text); font-size: 13px; font-weight: 400; cursor: pointer;
}
.col-menu-row label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-move { display: flex; flex-direction: column; gap: 0; }
.col-move-btn {
  width: 22px; height: 14px; min-width: 22px; padding: 0;
  border: 0; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.col-move-btn:hover:not(:disabled) { color: var(--text); }
.col-move-btn:disabled { opacity: 0.28; cursor: default; }
.col-drag {
  flex-shrink: 0;
  width: 8px; height: 14px;
  background-image: radial-gradient(circle, currentColor 1.15px, transparent 1.25px);
  background-size: 4px 4.6px;
  background-repeat: repeat;
  opacity: 0.38;
  cursor: grab;
}
.col-menu-row .col-drag { opacity: 0.5; }
table.col-setup { table-layout: fixed; min-width: 100%; }
table.col-setup th {
  position: sticky; top: 0; user-select: none; overflow: hidden;
}
table.col-setup .col-label {
  display: inline-block; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 4px; vertical-align: middle;
}
table.col-setup th .help-tip { vertical-align: middle; }
th.th-sort { cursor: pointer; }
th.th-sort .col-label { cursor: pointer; }
.sort-mark {
  display: inline-block;
  min-width: 10px;
  margin-left: 2px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.sort-mark:not(.is-on) { color: transparent; }
.col-resize {
  position: absolute; right: 0; top: 0; width: 8px; height: 100%;
  cursor: col-resize;
}

.visa-list { margin: 8px 0 16px; padding-left: 18px; display: grid; gap: 4px; }
.visa-list b { font-weight: 600; }
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 16px;
  overflow: hidden;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(440px, 100%);
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 18px 14px;
}
.modal-card h2 { margin: 0 0 6px; font-size: 16px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.modal-card > .muted { flex-shrink: 0; }
.modal-card #assignSearch {
  flex: 1;
  width: auto;
  min-width: 0;
  margin: 0;
}
.assign-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0 0;
  flex-shrink: 0;
}
.assign-toolbar .ghost {
  white-space: nowrap;
}
.check-list {
  display: grid; gap: 8px;
  margin: 12px 0 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.check-list label {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); cursor: pointer;
}
.check-list label[hidden] { display: none; }
.check-list input { width: 16px; height: 16px; accent-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

#peopleTable input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(1);
}
#peopleTable select.access-select {
  min-width: 0;
  width: 100%;
  max-width: 260px;
  padding: 6px 8px;
  font-size: 13px;
}
#peopleTable select.access-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--muted);
}
h2.with-help { display: flex; align-items: center; gap: 8px; }
.person-locked td { color: var(--muted); }
.person-locked td[data-col="name"] div:first-child { color: var(--text); }
.cell-copy {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
  vertical-align: top;
}
.cell-copy-text { min-width: 0; }
td[data-col="partner"] .cell-copy,
td[data-col="name"] .cell-copy {
  display: flex;
  width: 100%;
}
td[data-col="partner"] .cell-copy-text,
td[data-col="name"] .cell-copy-text {
  flex: 1 1 auto;
}
button.copy-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 2px;
  min-width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex: 0 0 auto;
  align-self: flex-start;
}
button.copy-btn:hover { color: var(--text); background: var(--hover); }
button.copy-btn.copied { color: var(--ok); }
.help-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 24px 48px;
}
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}
.help-toc a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--panel);
}
.help-toc a:hover { color: var(--text); border-color: var(--accent); }
.help-article {
  scroll-margin-top: 12px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
}
.help-article h2 { margin: 0 0 8px; font-size: 18px; }
.help-article p, .help-article li { color: var(--text); line-height: 1.45; }
.help-article ul { margin: 0; padding-left: 18px; }
.help-modal-card { max-width: 440px; }
.help-modal-body a, a.help-profile-link, a.person-profile-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 650;
}
.help-modal-body a:hover, a.help-profile-link:hover, a.person-profile-link:hover {
  text-decoration: underline;
}
.help-modal-body p { margin: 0; }
a.help-modal-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
