:root {
  --bg: #f5f7fb;
  --paper: #fff;
  --ink: #20324b;
  --muted: #5f6f85;
  --line: #e5eaf2;
  --primary: #365fdf;
  --primary-soft: #edf2ff;
  --success: #10766d;
  --success-soft: #eaf7f2;
  --warning: #a46a13;
  --danger: #bd4651;
  --font:
    "Segoe UI Variable Text", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 var(--font);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: white;
}
button:hover {
  background: var(--primary-soft);
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
:focus-visible {
  outline: 3px solid #365fdf;
  outline-offset: 3px;
}
a {
  color: var(--primary);
  text-decoration: none;
}
.shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: white;
  border-right: 1px solid var(--line);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 700;
  font-size: 25px;
  color: var(--ink);
  padding: 0 10px 36px;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.logo {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: 12px;
  position: relative;
}
.logo i {
  display: block;
  position: absolute;
  width: 15px;
  height: 15px;
  border: 1.5px solid white;
  border-radius: 3px;
  top: 9px;
  left: 8px;
}
.logo i + i {
  top: 14px;
  left: 14px;
}
.nav-label {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
}
nav button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  margin: 3px 0;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
}
nav button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
nav button.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
nav .divider {
  height: 1px;
  background: var(--line);
  margin: 23px 12px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 16px 12px 0;
  color: var(--muted);
  font-size: 12px;
}
.sidebar-foot small {
  display: block;
  padding-left: 15px;
  margin-top: 5px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 6px;
}
.topbar {
  height: 74px;
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 0 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.topbar > div {
  display: flex;
  align-items: center;
  gap: 16px;
}
main {
  padding: 30px 36px;
}
.heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 600;
}
h1 {
  font-size: 28px;
  margin: 5px 0 4px;
  font-weight: 650;
  letter-spacing: 1px;
}
h2 {
  font-size: 18px;
  margin: 0;
}
h3 {
  font-size: 15px;
  margin: 20px 0 12px;
}
p {
  margin: 4px 0 16px;
  color: var(--muted);
}
.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.primary:hover {
  background: #274bc3;
}
.danger {
  color: var(--danger);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 17px 20px;
}
.stat small {
  color: var(--muted);
}
.stat strong {
  display: block;
  font-size: 28px;
  font-weight: 600;
  margin: 3px 0;
}
.stat span {
  font-size: 12px;
  color: var(--muted);
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(310px, 1fr);
  gap: 20px;
}
.panel-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.filters {
  padding: 16px 20px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
input,
select,
textarea {
  border: 1px solid #cfd7e4;
  border-radius: 7px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
}
.filters input {
  flex: 1;
  width: 100px;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  text-align: left;
}
th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  background: #fafbfd;
}
td,
th {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
tr[data-id] {
  cursor: pointer;
}
tr.selected {
  background: #f1f5ff;
}
tr.selected td:first-child {
  box-shadow: inset 3px 0 var(--primary);
}
tbody tr:hover {
  background: #f5f8ff;
}
.name {
  font-weight: 600;
}
.sub {
  font-size: 12px;
  color: var(--muted);
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  background: #f0f3f8;
  color: #53627a;
  font-size: 12px;
  white-space: nowrap;
}
.badge.on {
  color: var(--success);
  background: var(--success-soft);
}
.badge.voc {
  background: #edf2ff;
  color: #365fdf;
}
.badge.listening {
  background: #edf7f5;
  color: #19756f;
}
.badge.scheduling {
  background: #fbf3e6;
  color: #8c641c;
}
.badge.identity {
  background: #f2eefb;
  color: #7551a5;
}
.detail {
  padding: 22px;
}
.avatar {
  background: #edf2ff;
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 19px;
}
.person {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.person h2 {
  margin: 0;
}
.detail code {
  font:
    12px Consolas,
    monospace;
  overflow-wrap: anywhere;
  white-space: normal;
}
.tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin: 20px 0;
}
.tabs button {
  border: 0;
  padding: 10px 0;
  border-radius: 0;
  color: var(--muted);
}
.tabs button.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}
.grant {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
}
.grant p {
  font-size: 12px;
  margin: 8px 0;
}
.grant-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.grant code {
  display: block;
  margin: 6px 0;
}
.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
.pager {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
dialog {
  width: 570px;
  max-width: calc(100% - 32px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  color: var(--ink);
}
dialog::backdrop {
  background: #20324b66;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
label {
  display: block;
  margin: 12px 0;
}
label input,
label select,
label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
}
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
label.check input {
  width: auto;
}
footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
}
#form-error,
#error {
  color: var(--danger);
}
#error:not(:empty) {
  padding: 14px;
  background: #fff0f0;
  margin-bottom: 16px;
  border-radius: 8px;
}
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  display: none;
}
.login {
  max-width: 420px;
  margin: 10vh auto;
  padding: 32px;
}
.login button {
  width: 100%;
}
#menu {
  display: none;
}
.prose {
  padding: 26px;
}
.prose li {
  margin: 12px 0;
}
.prose code {
  overflow-wrap: anywhere;
}
.prose pre {
  overflow: auto;
}
.row {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.row.selected {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
}
@media (max-width: 1180px) {
  .split {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 720px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 10;
    width: 224px;
  }
  .sidebar.open {
    display: flex;
    box-shadow: 0 0 0 100vw #20324b55;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar > div {
    gap: 8px;
  }
  #admin-name {
    display: none;
  }
  #menu {
    display: block;
  }
  main {
    padding: 24px 16px;
  }
  .heading {
    align-items: flex-start;
  }
  .heading .primary {
    white-space: nowrap;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 12px;
  }
  .filters {
    flex-wrap: wrap;
  }
  .badge {
    font-size: 12px;
  }
  .topbar .badge {
    display: none;
  }
}

.schema-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.sidebar.open .brand {
  position: relative;
}
button {
  transition:
    background-color 0.15s,
    color 0.15s;
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .filters input {
    flex: 1 0 100%;
    width: 100%;
  }
  .filters select {
    flex: 1;
    min-width: 100px;
  }
  .panel-head .sub {
    max-width: 50%;
    text-align: right;
  }
}
