:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e6e9ef;
  --text: #1f2329;
  --text-2: #4e5969;
  --muted: #8a9099;
  --primary: #2f6bff;
  --primary-weak: #eef3ff;
  --danger: #e5484d;
  --ok: #12a150;
  --warn: #b7791f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.04);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 12.5px;
}

.small {
  font-size: 12.5px;
}

.tiny {
  font-size: 11.5px;
  line-height: 1.5;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.right {
  text-align: right;
}

/* ---------------- 登录 ---------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% 0%, #eaf0ff 0%, #f5f6f8 45%, #f5f6f8 100%);
  padding: 24px;
}

.login-card {
  width: 400px;
  max-width: 100%;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(16, 24, 40, 0.08);
  padding: 36px 34px 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2f6bff, #5b8bff);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand-mark.small {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 16px;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.login-form .field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

.input:disabled {
  background: #f7f8fa;
  color: var(--muted);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a9099' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-error {
  color: var(--danger);
  font-size: 12.5px;
  min-height: 18px;
  margin-bottom: 10px;
}

.login-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #a9aeb6;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  background: #fff;
  color: var(--text-2);
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #2559e0;
}

.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  border-color: #c9d2e3;
  color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #cf3b40;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-xs {
  height: 27px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

/* ---------------- 布局 ---------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 226px;
  flex: 0 0 226px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid #f1f3f7;
}

.sidebar-brand-text .brand-name {
  font-size: 14.5px;
}

.nav {
  padding: 14px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: #f5f7fb;
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-weak);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  opacity: 0.8;
}

.sidebar-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid #f1f3f7;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-weak);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.user-meta {
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11.5px;
  color: var(--muted);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 26px 32px 18px;
  background: var(--bg);
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.page-desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.view {
  padding: 0 32px 40px;
  flex: 1;
}

/* ---------------- 面板 ---------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f3f7;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
}

.panel-body {
  padding: 20px;
}

.panel-body.no-pad {
  padding: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toolbar .input {
  width: 220px;
  height: 34px;
}

/* ---------------- 统计卡 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
}

.stat-value {
  font-size: 27px;
  font-weight: 680;
  margin: 6px 0 2px;
  letter-spacing: -0.5px;
}

.stat-value.tone-bad {
  color: var(--danger);
}

.stat-sub {
  font-size: 12px;
  color: #a9aeb6;
}

.tip-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 2;
}

/* ---------------- 表格 ---------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 11px 16px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f4f6f9;
  color: var(--text-2);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: #fafbfe;
}

.table.compact td,
.table.compact th {
  padding: 9px 12px;
}

.table .empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.file-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 分页 ---------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid #f1f3f7;
  background: #fcfdff;
}

.pager-info {
  font-size: 12.5px;
  color: var(--muted);
}

.pager-btns {
  display: flex;
  gap: 8px;
}

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 19px;
  font-weight: 500;
}

.badge-ok {
  background: #e8f8ee;
  color: #0f8a44;
}

.badge-bad {
  background: #fdeceb;
  color: #c5343a;
}

.badge-warn {
  background: #fdf5e6;
  color: #a9761a;
}

.badge-muted {
  background: #f2f4f7;
  color: #6b7280;
}

.badge-info {
  background: var(--primary-weak);
  color: var(--primary);
}

/* ---------------- 表单 ---------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px 24px;
}

.form-field {
  min-width: 0;
}

.field-hint {
  font-size: 11.5px;
  color: #a2a8b2;
  margin-top: 5px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
}

.form-msg {
  font-size: 12.5px;
  color: var(--muted);
  word-break: break-all;
}

.form-msg.ok {
  color: var(--ok);
}

.form-msg.bad {
  color: var(--danger);
}

.form-msg.muted {
  color: var(--muted);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  cursor: pointer;
}

.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.inline-register {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}

.inline-register .input {
  flex: 1;
  min-width: 220px;
  height: 34px;
}

/* ---------------- 弹窗 ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 20px 40px;
  z-index: 1000;
  overflow-y: auto;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.2);
  animation: modal-in 0.16s ease-out;
}

@keyframes modal-in {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-sm {
  max-width: 430px;
}

.modal-md {
  max-width: 620px;
}

.modal-lg {
  max-width: 860px;
}

.modal-xl {
  max-width: 1000px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #f1f3f7;
}

.modal-head h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 620;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #b0b6bf;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
  max-height: 68vh;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #f1f3f7;
  background: #fcfdff;
  border-radius: 0 0 12px 12px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px 20px;
  margin-bottom: 8px;
}

.kv {
  min-width: 0;
}

.kv-label {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.kv-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.section-title {
  font-size: 13px;
  font-weight: 620;
  margin: 22px 0 10px;
  color: var(--text);
}

.confirm-text {
  font-size: 14px;
  color: var(--text);
}

.confirm-detail {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid #f8dedd;
  background: #fefaf9;
  border-radius: 8px;
}

.pre {
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  max-height: 240px;
  overflow: auto;
}

/* 报告正文 */
.report-box {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #2c3440;
  max-height: 56vh;
  overflow-y: auto;
  background: #fff;
}

.report-box h2 {
  font-size: 20px;
  margin: 8px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef1f6;
}

.report-box h3 {
  font-size: 15.5px;
  margin: 22px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
}

.report-box h4 {
  font-size: 14px;
  margin: 16px 0 6px;
}

.report-box p {
  margin: 6px 0;
}

.report-box ul {
  margin: 6px 0;
  padding-left: 20px;
}

.report-box li {
  margin: 3px 0;
}

.report-box table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12.5px;
}

.report-box th,
.report-box td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}

.report-box th {
  background: #f7f9fc;
}

.report-box hr {
  border: none;
  border-top: 1px solid #eef1f6;
  margin: 16px 0;
}

.report-box code {
  background: #f2f4f7;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
}

/* ---------------- 其它 ---------------- */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.error-box {
  background: #fff6f5;
  border: 1px solid #f8dedd;
  color: #b83a3f;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin: 12px 0;
}

.toast-root {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #1f2329;
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
  animation: toast-in 0.18s ease-out;
  max-width: 360px;
  word-break: break-all;
}

.toast-ok {
  background: #0f8a44;
}

.toast-bad {
  background: #c5343a;
}

.toast.out {
  opacity: 0;
  transform: translateY(-6px);
  transition: all 0.2s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .sidebar {
    width: 64px;
    flex: 0 0 64px;
  }
  .sidebar-brand-text,
  .nav-label,
  .user-meta {
    display: none;
  }
  .sidebar-brand {
    justify-content: center;
    padding: 16px 0;
  }
  .nav-item {
    justify-content: center;
  }
  .view,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}
