:root {
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --shell: #fff;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --accent: #18181b;
  --soft: #f4f4f5;
  --error: #b42334;
  --button-ink: #fff;
  --hover: #fafafa;
  --sidebar-width: 196px;
  --touch-target: 0px;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
:root.dark {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #15181d;
  --shell: #121419;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2a2d33;
  --accent: #f4f4f5;
  --button-ink: #18181b;
  --soft: #27272a;
  --hover: #20242a;
  --error: #ffabb7;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  min-width: var(--touch-target);
  background: var(--accent);
  color: var(--button-ink);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 500;
  min-height: max(var(--touch-target), 34px);
}
/* 手机使用统一点击下限；组件可以保留桌面密度，通过此变量扩展触摸区域。 */
@media (max-width: 600px) {
  :root {
    --touch-target: 44px;
  }
  summary {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    align-content: center;
  }
}
button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
button.secondary:hover {
  background: var(--hover);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  background: var(--surface);
  padding: 12px;
  z-index: 100;
  color: var(--ink);
}
.skip-link:focus {
  top: 8px;
}
.console-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
}
.console-shell.is-collapsed {
  --sidebar-width: 64px;
}
#sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  min-width: 0;
  background: var(--shell);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.sidebar-head {
  min-height: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}
.brand img {
  flex-shrink: 0;
  width: 30px;
  filter: brightness(0);
}
.dark .brand img {
  filter: brightness(0) invert(1);
}
.brand-copy {
  min-width: 0;
  line-height: 1.5;
}
.brand-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.brand-copy small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.icon-button {
  width: 32px;
  min-height: max(var(--touch-target), 32px);
  height: 32px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}
.nav-group h2 {
  margin: 0 0 5px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
}
nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: max(var(--touch-target), 40px);
  width: 100%;
  margin: 2px 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  font-size: 14px;
}
nav button svg {
  color: var(--muted);
}
nav button:hover {
  background: var(--hover);
}
nav button[aria-current] {
  background: var(--soft);
  color: var(--ink);
}
nav button[aria-current] svg {
  color: var(--ink);
}
.nav-copy {
  overflow-wrap: anywhere;
}
.is-collapsed .brand-copy,
.is-collapsed .brand,
.is-collapsed .nav-copy,
.is-collapsed .nav-group h2 {
  display: none;
}
.is-collapsed .sidebar-head {
  justify-content: center;
  padding: 0;
}
.is-collapsed nav {
  padding: 14px 8px;
}
.is-collapsed nav button {
  justify-content: center;
  padding: 9px;
}
.is-collapsed #sidebar-toggle svg {
  transform: rotate(180deg);
}
.main-column {
  min-width: 0;
}
header {
  height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--shell);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-start,
.header-actions,
.preferences {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#breadcrumb {
  color: var(--muted);
  font-size: 12px;
}
.header-actions {
  margin-left: auto;
}
.identity {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  padding: 6px 8px;
}
.preferences select {
  width: auto;
  max-width: 130px;
  padding: 5px 7px;
  font-size: 12px;
  height: 32px;
}
.theme-icon .sun {
  display: none;
}
[data-dark="true"] .theme-icon .sun {
  display: inline;
}
[data-dark="true"] .theme-icon .moon {
  display: none;
}
main {
  padding: 20px;
  width: 100%;
  min-width: 0;
}
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.title-row > div {
  min-width: 0;
}
.title-row button {
  flex-shrink: 0;
}
h1 {
  font-size: 17px;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 4px;
}
h2 {
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 16px;
  font-weight: 600;
}
p {
  color: var(--muted);
  line-height: 1.7;
  margin: 8px 0;
  font-size: 13px;
}
.title-row p {
  margin: 0;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 16px;
  margin-bottom: 12px;
  min-width: 0;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  min-width: 0;
  font-size: 13px;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
input[type="file"] {
  max-width: 100%;
}
.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  line-height: 1.6;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 13px;
}
th {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
}
tbody tr:last-child td {
  border-bottom: 0;
}
td button {
  padding: 5px 10px;
  margin: 3px;
  font-size: 12px;
}
td small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}
pre {
  max-width: 100%;
  overflow: auto;
  background: var(--hover);
  border-radius: 6px;
  padding: 14px;
  line-height: 1.6;
  font-size: 12px;
}
pre:empty {
  display: none;
}
#notice {
  margin: 0;
  color: var(--error);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
#notice:empty {
  display: none;
}
#notice:not(:empty) {
  padding: 4px 0 4px 10px;
  margin: 0 0 10px;
  border: 0;
  border-left: 2px solid var(--error);
  border-radius: 0;
  font-size: 12px;
}
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 70px 20px 24px;
}
.login > .preferences {
  position: absolute;
  right: 24px;
  top: 18px;
}
.login form {
  width: 100%;
  max-width: 420px;
  padding: 28px;
}
.login h1 {
  font-size: 23px;
  margin-top: 12px;
}
.login form > p {
  margin-bottom: 20px;
}
#login-error {
  color: var(--error);
}
#mobile-menu,
#mobile-close,
#nav-backdrop {
  display: none;
}
@media (max-width: 1023px) {
  .console-shell,
  .console-shell.is-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    max-width: 85vw;
    transform: translateX(-100%);
    visibility: hidden;
  }
  .nav-open #sidebar {
    transform: translateX(0);
    visibility: visible;
  }
  .nav-open {
    overflow: hidden;
  }
  .nav-open #nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 0.45);
    border: 0;
    border-radius: 0;
    z-index: 29;
  }
  #sidebar-toggle {
    display: none;
  }
  #mobile-menu,
  #mobile-close {
    display: inline-flex;
  }
  .is-collapsed .brand,
  .is-collapsed .brand-copy,
  .is-collapsed .nav-copy,
  .is-collapsed .nav-group h2 {
    display: revert;
  }
  .is-collapsed .brand {
    display: flex;
  }
  .is-collapsed .sidebar-head {
    justify-content: space-between;
    padding: 0 12px;
  }
  .is-collapsed nav {
    padding: 14px 12px;
  }
  .is-collapsed nav button {
    justify-content: flex-start;
    padding: 9px 10px;
  }
  header {
    padding: 0 14px;
  }
  main {
    padding: 16px;
  }
}
@media (max-width: 600px) {
  header {
    padding: 0 12px;
    gap: 6px;
  }
  #breadcrumb {
    display: none;
  }
  .header-actions {
    gap: 4px;
  }
  .identity {
    max-width: 56px;
    padding: 4px;
  }
  #logout {
    padding: 6px 8px;
    font-size: 12px;
  }
  .preferences select {
    max-width: 108px;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .title-row {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }
  .panel {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background-color 0.15s;
  }
  #sidebar {
    transition:
      transform 0.18s,
      visibility 0.18s;
  }
}
