:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-strong: #eef3f8;
  --ink: #111827;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #d8e0ea;
  --line-soft: #e8edf3;
  --accent: #1456f0;
  --accent-ink: #0f3fb3;
  --accent-soft: #e9f0ff;
  --success: #047857;
  --success-soft: #e7f6ef;
  --warning: #a16207;
  --warning-soft: #fff4d8;
  --danger: #c0262d;
  --danger-soft: #fdebed;
  --shadow: 0 12px 28px rgb(15 23 42 / 0.06);
  --radius: 8px;
  --sidebar-width: 256px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family:
    "Segoe UI",
    "Microsoft YaHei",
    -apple-system,
    BlinkMacSystemFont,
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 48px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-name {
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 760;
  text-align: left;
}

.nav-item:hover {
  border-color: var(--line-soft);
  background: #ffffff;
}

.nav-item.is-active {
  border-color: #cddcff;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.nav-glyph {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.nav-item.is-active .nav-glyph {
  border-color: #b8ccff;
  background: #ffffff;
  color: var(--accent);
}

.sidebar-section {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.sidebar-label {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
}

.side-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 720;
}

.side-link:hover {
  border-color: #cddcff;
  color: var(--accent-ink);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.note-title {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.note-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.workspace {
  min-width: 0;
  padding: 22px 24px 32px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

h1 {
  color: var(--ink);
  font-size: 24px;
  font-weight: 850;
  line-height: 1.2;
}

#pageSubtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 36px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
}

.primary-button {
  padding: 0 14px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: #0f49cf;
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
}

.secondary-button:hover,
.icon-button:hover {
  border-color: #cddcff;
  color: var(--accent-ink);
}

.compact-action {
  min-width: 64px;
}

.icon-button {
  min-width: 52px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink-soft);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active,
.nav-item:active,
.side-link:active,
.link-button:active {
  transform: translateY(1px);
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(20 86 240 / 0.18);
  outline-offset: 1px;
}

.alert-row {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #f5c27a;
  border-radius: var(--radius);
  background: #fff8e8;
  color: #7c4a03;
  font-size: 13px;
  line-height: 1.5;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}

.ops-item {
  min-height: 70px;
  padding: 14px 16px;
  background: var(--surface);
}

.ops-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.ops-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 840;
  line-height: 1.25;
}

.ops-value.is-good {
  color: var(--success);
}

.ops-value.is-warn {
  color: var(--warning);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 112px;
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.metric-value {
  margin-top: 11px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 66px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.panel-head h2 {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.25;
}

.panel-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.bar-list,
.source-level-list {
  display: grid;
  gap: 11px;
  padding: 15px 16px 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px minmax(150px, 1fr) 58px;
  align-items: center;
  gap: 12px;
  min-height: 28px;
  font-size: 13px;
}

.bar-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bar-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.level-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.level-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-count {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(136px, 1fr)) auto;
  gap: 11px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
}

input,
select {
  height: 36px;
}

textarea {
  min-height: 88px;
  padding-top: 9px;
  padding-bottom: 9px;
  line-height: 1.5;
  resize: vertical;
}

input::placeholder {
  color: var(--muted-2);
}

.users-toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.35fr) minmax(150px, 0.35fr) auto;
}

.table-panel {
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fb;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

tbody tr {
  background: #ffffff;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.compact-table {
  overflow: auto;
}

.status-chip,
.date-chip,
.priority-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.date-chip {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.status-chip {
  background: #eef2f7;
  color: var(--ink-soft);
}

.status-success {
  background: var(--success-soft);
  color: var(--success);
}

.status-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority-medium {
  background: var(--warning-soft);
  color: var(--warning);
}

.priority-low {
  background: var(--success-soft);
  color: var(--success);
}

.cell-title {
  max-width: 540px;
  color: var(--ink);
  font-weight: 780;
  line-height: 1.45;
}

.cell-subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-weight: 820;
  text-align: left;
}

.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.review-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #ffffff;
}

.review-item:hover {
  border-color: #cddcff;
}

.review-title {
  color: var(--ink);
  font-weight: 840;
  line-height: 1.4;
}

.review-reason {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.timeline {
  display: grid;
  gap: 0;
  padding: 6px 16px 16px;
}

.log-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.log-item:last-child {
  border-bottom: 0;
}

.log-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.log-title {
  color: var(--ink);
  font-weight: 840;
}

.log-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(480px, 100vw);
  height: 100dvh;
  overflow: auto;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -18px 0 42px rgb(15 23 42 / 0.13);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.drawer-label {
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 850;
}

.drawer-head h2 {
  margin-top: 7px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.35;
}

.drawer-body {
  margin-top: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line-soft);
}

.detail-list dt,
.detail-list dd {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.5;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 820;
}

.detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.drawer-form {
  display: grid;
  gap: 16px;
}

.form-section {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.72), #ffffff 35%);
}

.avatar-cell {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.avatar-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 850;
}

.empty {
  padding: 22px;
  color: var(--muted);
  font-size: 13px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #e9eef5;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.68), transparent);
  animation: shimmer 1.2s infinite;
}

.skeleton-card {
  min-height: 112px;
  border-radius: var(--radius);
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1220px) {
  .metric-grid,
  .ops-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 5px;
    min-height: 58px;
    padding: 7px 5px;
    font-size: 12px;
    text-align: center;
  }

  .nav-glyph {
    width: 24px;
    height: 24px;
  }

  .sidebar-section,
  .sidebar-note {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .primary-button {
    flex: 1;
  }

  .metric-grid,
  .ops-strip,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .ops-item {
    min-height: 62px;
  }

  .bar-row {
    grid-template-columns: minmax(80px, 0.8fr) minmax(100px, 1fr) 48px;
  }

  .review-item {
    grid-template-columns: 1fr;
  }
}
