:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --text: #1f2937;
  --muted: #667085;
  --line: #e5e7eb;
  --nav: #111827;
  --nav-active: #1f2937;
  --danger: #d9363e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.sidebar {
  background: var(--nav);
  color: #d1d5db;
  padding: 18px 12px;
}

.brand {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  padding: 10px 12px 18px;
}

.nav-link {
  display: block;
  color: #d1d5db;
  padding: 11px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.nav-link:hover,
.nav-link.active {
  background: var(--nav-active);
  color: #fff;
}

.main {
  min-width: 0;
}

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.content {
  padding: 24px;
}

.page-title {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 650;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

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

.stat {
  font-size: 28px;
  font-weight: 700;
}

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

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

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #344054;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.65;
}

.editor textarea {
  min-height: 260px;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

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

.btn {
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: #344054;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  background: #fafafa;
  color: #475467;
  font-weight: 650;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
}

.flash {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.flash-success {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  color: #237804;
}

.flash-error {
  background: #fff1f0;
  border: 1px solid #ffa39e;
  color: #a8071a;
}

.inline-form {
  display: inline;
}

.paper {
  background: #fff;
  color: #111827;
  max-width: 900px;
  margin: 0 auto;
  padding: 38px 48px;
  border: 1px solid var(--line);
  line-height: 1.85;
}

.paper h1 {
  text-align: center;
  margin: 0 0 16px;
  font-size: 24px;
}

.paper-meta {
  display: flex;
  justify-content: center;
  gap: 32px;
  border-bottom: 2px solid #111827;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.paper-section {
  white-space: pre-wrap;
  margin-bottom: 28px;
}

@media print {
  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  body {
    background: #fff;
  }

  .paper {
    border: 0;
    max-width: none;
    padding: 0;
  }
}

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

  .sidebar {
    position: static;
  }

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