:root {
  color-scheme: light;
  --dash-bg: #eef2f7;
  --dash-surface: #ffffff;
  --dash-border: #c4cedb;
  --dash-text: #202d40;
  --dash-muted: #52627a;
  --dash-primary: #4f46e5;
  --dash-on-primary: #fff;
  --dash-primary-hover: #4338ca;
  --dash-focus: #4f46e5;
  --dash-focus-ring: rgb(79 70 229 / 18%);
  --dash-danger: #b42332;
  --dash-danger-soft: #fff0f1;
  --dash-success: #147953;
  --dash-success-soft: #e8f6ee;
  --dash-warning: #946014;
  --dash-warning-soft: #fff6df;
  --dash-primary-soft: #eeedfc;
  --dash-control: #e9eff7;
  --dash-control-hover: #dce5f1;
  --dash-disabled: #52627a;
  --dash-link: #4338ca;
  --dash-shadow: rgb(22 35 52 / 4%);
  --dash-shadow-sm: 0 1px 2px rgb(28 45 70 / 6%), 0 6px 16px rgb(28 45 70 / 7%);
  --dash-shadow-md: 0 2px 4px rgb(28 45 70 / 6%), 0 14px 32px rgb(28 45 70 / 12%);
  --dash-shadow-lg: 0 24px 64px rgb(28 45 70 / 24%);
  --dash-shadow-inset: inset 0 1px 2px rgb(28 45 70 / 8%);
  --dash-motion: 180ms cubic-bezier(.2, .8, .2, 1);
  --dash-overlay: rgb(17 24 39 / 50%);
  --dash-transparent: transparent;
  --dash-nav-bg: #f8faff;
  --dash-nav-text: #273650;
  --dash-nav-muted: #52627a;
  --dash-nav-border: #cbd5e3;
  --dash-nav-active: #dde5f8;
  --dash-nav-mark: #6760e8;
  --dash-nav-width: 256px;
  --dash-radius: 12px;
  --dash-gap: 16px;
  --dash-edge: 24px;
  --dash-row-height: 64px;
  /* Conservative pagination estimate only; cards use content height. */
  --dash-tile-height: 220px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --dash-bg: #303a46;
  --dash-surface: #3a4552;
  --dash-border: #53606e;
  --dash-text: #eef0ed;
  --dash-muted: #bdc6ca;
  --dash-primary: #b9b1fa;
  --dash-on-primary: #292642;
  --dash-primary-hover: #ccc5ff;
  --dash-focus: #c5bdfa;
  --dash-focus-ring: rgb(197 189 250 / 24%);
  --dash-danger: #ffbec2;
  --dash-danger-soft: #563f49;
  --dash-success: #a8e2c5;
  --dash-success-soft: #344f4a;
  --dash-warning: #eed5a3;
  --dash-warning-soft: #514c3e;
  --dash-primary-soft: #4a4763;
  --dash-control: #333e4a;
  --dash-control-hover: #495563;
  --dash-disabled: #bdc6ca;
  --dash-link: #d3cafa;
  --dash-shadow: rgb(0 0 0 / 8%);
  --dash-shadow-sm: 0 1px 0 rgb(255 255 255 / 4%), 0 8px 20px rgb(0 0 0 / 22%), 0 2px 8px rgb(160 180 255 / 5%);
  --dash-shadow-md: 0 1px 0 rgb(255 255 255 / 7%), 0 18px 38px rgb(0 0 0 / 28%), 0 10px 30px rgb(160 180 255 / 10%);
  --dash-shadow-lg: 0 24px 70px rgb(0 0 0 / 44%), 0 0 0 1px rgb(255 255 255 / 4%);
  --dash-shadow-inset: inset 0 1px 2px rgb(0 0 0 / 26%);
  --dash-motion: 180ms cubic-bezier(.2, .8, .2, 1);
  --dash-nav-bg: #293540;
  --dash-nav-text: #f0f2ef;
  --dash-nav-muted: #bcc7cf;
  --dash-nav-border: #4c5966;
  --dash-nav-active: #455261;
}
/* Panes retain wheel/keyboard/touch access for long details, without visible chrome. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; }
html { overflow: hidden; overscroll-behavior: none; }
/* Compact help: the question mark occupies the heading line; details never
   participate in layout, so opening a hint cannot move panels or pages. */
.hint { position: relative; z-index: 90; display: inline-flex; align-items: center; margin-left: 6px; vertical-align: middle; }
.hint > summary { list-style: none; display: inline-grid; place-items: center; width: 17px; height: 17px; padding: 0; border: 1px solid var(--dash-border); border-radius: 50%; background: var(--dash-surface); color: var(--dash-muted); font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; }
.hint > summary::-webkit-details-marker { display: none; }
.hint > summary:hover, .hint[open] > summary { border-color: var(--dash-primary); color: var(--dash-primary); }
.hint-body { position: absolute; z-index: 80; top: calc(100% + 8px); left: 0; width: min(310px, calc(100vw - 48px)); padding: 10px 12px; border: 1px solid var(--dash-border); border-radius: 8px; background: var(--dash-surface); box-shadow: var(--dash-shadow-md); color: var(--dash-muted); font-size: 12px; font-weight: 400; line-height: 1.55; text-align: left; white-space: normal; }
.hint.right .hint-body { left: auto; right: 0; }
.hint[open] .hint-body { display: block; }
.hint:not([open]) .hint-body { display: none; }
.hint:hover .hint-body, .hint:focus-within .hint-body { display: block; }
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  overflow: hidden;
  background: var(--dash-bg);
  color: var(--dash-text);
  font:
    14px/1.6 "Segoe UI",
    "Microsoft YaHei UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--dash-focus);
  outline-offset: 3px;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
}
h1 {
  font-size: 24px;
}
h2 {
  font-size: 16px;
}
h3 {
  font-size: 15px;
}
code {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.card {
  min-width: 0;
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  background: var(--dash-surface);
  box-shadow: var(--dash-shadow-sm);
  padding: 24px;
  transition: border-color var(--dash-motion), box-shadow var(--dash-motion), transform var(--dash-motion);
}
.card:hover { box-shadow: var(--dash-shadow-md); }
.lead {
  max-width: 65ch;
  margin: 6px 0 0;
  color: var(--dash-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 20px;
}
.field > span {
  font-size: 12px;
  font-weight: 500;
}
.field input,
.field textarea,
.field select,
.input-narrow,
#search {
  min-width: 0;
  border: 1px solid var(--dash-border);
  border-radius: 8px;
  background: var(--dash-control);
  color: var(--dash-text);
  padding: 10px 12px;
  transition:
    border-color 150ms ease-out,
    box-shadow 150ms ease-out;
}
.field input,
.field textarea,
.field select {
  width: 100%;
}
.field textarea {
  min-height: 128px;
  resize: none;
}
.input-narrow {
  width: 80px;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--dash-primary);
}
input:focus,
textarea:focus,
.field select:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--dash-focus-ring);
  border-color: var(--dash-focus);
}
input[aria-invalid="true"] {
  border-color: var(--dash-danger);
}
input:disabled,
textarea:disabled,
.field select:disabled {
  background: var(--dash-control-hover);
  color: var(--dash-disabled);
  cursor: not-allowed;
}
::placeholder {
  color: var(--dash-muted);
}
.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition:
    background-color 150ms ease-out,
    border-color 150ms ease-out,
    transform 150ms ease-out;
}
.btn {
  margin-top: 20px;
  padding: 8px 14px;
  background: var(--dash-primary);
  color: var(--dash-on-primary);
}
.btn:hover:not(:disabled) {
  background: var(--dash-primary-hover);
}
.btn-secondary,
.icon-btn {
  border-color: var(--dash-border);
  background: var(--dash-surface);
  color: var(--dash-text);
}
.btn-danger { background: var(--dash-danger); color: var(--dash-on-primary); }
.btn-danger:hover:not(:disabled) { background: var(--dash-danger); filter: brightness(0.92); }
:root[data-theme="dark"] .btn-danger { color: #34232b; }
.btn-secondary:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
  background: var(--dash-control);
  border-color: var(--dash-muted);
}
.btn:active:not(:disabled),
.icon-btn:active:not(:disabled) {
  transform: scale(0.97);
}
.icon-btn {
  width: 36px;
  flex-shrink: 0;
  padding: 0;
}
.err,
.ok {
  margin: 12px 0 0;
  overflow-wrap: anywhere;
}
.err {
  color: var(--dash-danger);
}
.ok {
  color: var(--dash-success);
}
.err:empty,
.ok:empty {
  display: none;
}
.table-host {
  min-height: 0;
  min-width: 0;
  overflow: auto;
  margin-top: 16px;
}
.link {
  color: var(--dash-link);
  font-size: 11px;
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}
.link:hover {
  text-decoration-thickness: 2px;
}
.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
td .row,
th .row {
  width: 100%;
  justify-content: center;
}
.row .btn {
  margin-top: 0;
}
.row .err {
  margin: 0;
}
.empty {
  margin: 0;
  padding: 32px 12px;
  color: var(--dash-muted);
  font-size: 13px;
  text-align: center;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--dash-border);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
th {
  background: var(--dash-control);
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
tbody tr:hover {
  background: var(--dash-bg);
}
tbody tr:last-child td {
  border-bottom: 0;
}
dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px;
  overflow: auto;
  border: 1px solid var(--dash-border);
  border-radius: var(--dash-radius);
  background: var(--dash-surface);
  color: var(--dash-text);
  box-shadow: var(--dash-shadow-lg);
}
dialog::backdrop {
  background: var(--dash-overlay);
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 24px;
}
.status-badge.user-status-active { color: var(--dash-success); background: var(--dash-success-soft); }
.status-badge.user-status-pending { color: var(--dash-warning); background: var(--dash-warning-soft); }
.status-badge.user-status-rejected { color: var(--dash-danger); background: var(--dash-danger-soft); }
.status-badge.user-status-disabled { color: var(--dash-muted); background: var(--dash-control); }
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--dash-control-hover);
  color: var(--dash-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.status-ready,
.status-published {
  background: var(--dash-success-soft);
  color: var(--dash-success);
}
.status-draft {
  background: var(--dash-warning-soft);
  color: var(--dash-warning);
}
.status-withdrawn,
.status-rejected {
  background: var(--dash-danger-soft);
  color: var(--dash-danger);
}
.status-inactive { background: var(--dash-control); color: var(--dash-muted); border: 1px solid var(--dash-border); }
.status-current {
  background: var(--dash-primary-soft);
  color: var(--dash-primary);
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.section-head .btn {
  margin: 0;
  flex-shrink: 0;
}
@media (max-width: 767px) {
  .card {
    padding: 18px;
  }
  h1 {
    font-size: 22px;
  }
  th,
  td {
    padding: 12px 10px;
  }
}
html[data-motion="compact"] *,
html[data-motion="compact"] *::before,
html[data-motion="compact"] *::after {
  animation-duration: 60ms !important;
  transition-duration: 60ms !important;
}
