:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #eef2f7;
  color: #101828;
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #101828;
  --muted: #667085;
  --line: #d9e0ea;
  --line-strong: #b8c2d2;
  --primary: #1455d9;
  --primary-strong: #0f3f9e;
  --primary-soft: #e8f0ff;
  --green: #08745f;
  --green-soft: #e7f7f1;
  --red: #b42318;
  --red-soft: #fee7e4;
  --amber: #b54708;
  --amber-soft: #fff3df;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 16px 40px rgba(16, 24, 40, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 4%, rgba(31, 95, 255, 0.12), transparent 26%),
    radial-gradient(circle at 78% 14%, rgba(8, 116, 95, 0.12), transparent 26%),
    linear-gradient(180deg, #f7f9fd 0%, var(--bg) 48%, #e8edf5 100%);
}

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

button {
  border: 0;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(20, 85, 217, 0.18);
  border-color: var(--primary);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background:
    radial-gradient(circle at 16% 10%, rgba(20, 85, 217, 0.11), transparent 28%),
    radial-gradient(circle at 86% 88%, rgba(8, 116, 95, 0.1), transparent 32%),
    #eef3f8;
}

.login-layout {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(680px, 1.18fr) minmax(440px, 0.82fr);
  overflow: hidden;
  background: transparent;
}

.login-copy {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: clamp(44px, 5vw, 76px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 12% 14%, rgba(20, 85, 217, 0.1), transparent 28%),
    linear-gradient(135deg, #f7fbff 0%, #eef5ff 46%, #f5fbfb 100%);
  border-right: 1px solid rgba(184, 194, 210, 0.62);
}

.login-copy-inner {
  width: min(820px, 100%);
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #344054;
  font-weight: 800;
  font-size: 17px;
}

.brand-line small,
.version-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brand-line small {
  padding: 4px 8px;
  border: 1px solid rgba(184, 194, 210, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.version-note {
  margin: -4px 0 0;
}

.login-hero-copy {
  max-width: 700px;
  margin-top: clamp(54px, 9vh, 96px);
}

.login-copy h1 {
  margin: 12px 0 16px;
  font-size: clamp(46px, 5vw, 74px);
  line-height: 1.02;
  letter-spacing: 0;
  color: #111827;
}

.login-copy p {
  max-width: 720px;
  margin: 0;
  color: #38506d;
  font-size: 19px;
  line-height: 1.62;
}

.login-points {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.login-points span {
  padding: 10px 14px;
  border: 1px solid rgba(184, 194, 210, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #344054;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

.login-illustration {
  display: block;
  width: min(760px, 100%);
  margin-top: 38px;
}

.login-panel,
.loading-panel,
.modal,
.toolbar,
.doc-list,
.editor-shell,
.inspector,
.admin-section,
.admin-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.login-panel {
  align-self: center;
  justify-self: center;
  width: min(100% - 72px, 460px);
  padding: 36px;
  border-radius: 20px;
  border-color: rgba(200, 211, 226, 0.9);
  box-shadow: 0 28px 78px rgba(16, 24, 40, 0.13);
}

.login-panel h2 {
  font-size: 32px;
  letter-spacing: 0;
}

.login-panel h2,
.admin-section h2,
.modal h2 {
  margin: 0 0 8px;
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #0b7f67);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(20, 85, 217, 0.18);
}

.brand-mark.small {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.muted,
.hint {
  color: var(--muted);
  margin: 0 0 18px;
}

.hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.form {
  display: grid;
  gap: 14px;
}

label,
.compact-label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 40px;
  border-radius: 10px;
  padding: 9px 13px;
  white-space: nowrap;
  font-weight: 650;
}

.wide {
  width: 100%;
}

.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 9px 18px rgba(20, 85, 217, 0.16);
}

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

.secondary {
  background: var(--green-soft);
  color: var(--green);
}

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

.ghost {
  border: 1px solid transparent;
  background: #f1f4f9;
  color: #344054;
}

.ghost.active-action {
  border-color: rgba(20, 85, 217, 0.22);
  color: var(--primary);
  background: var(--primary-soft);
}

.icon-button {
  min-width: 56px;
}

.error {
  min-height: 20px;
  color: var(--red);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(217, 224, 234, 0.9);
  backdrop-filter: blur(18px);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
  font-size: 18px;
}

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

.role-badge,
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 700;
}

.user-avatar {
  width: 36px;
  height: 36px;
  color: #fff;
  background: #243b64;
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 18px;
}

.edit-workspace {
  grid-template-columns: 330px minmax(0, 1fr);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
}

.rail-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 0 4px;
}

.rail-heading strong {
  font-size: 28px;
}

.section-kicker {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.toolbar,
.doc-list,
.editor-shell,
.inspector,
.admin-section,
.admin-hero {
  padding: 14px;
}

.toolbar.stacked {
  display: grid;
  gap: 12px;
}

.toolbar-row,
.filter-row,
.editor-actions {
  display: flex;
  gap: 8px;
}

.doc-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.doc-item {
  width: 100%;
  text-align: left;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--ink);
}

.doc-item:hover {
  border-color: var(--line-strong);
  transform: none;
}

.doc-item.active {
  border-color: rgba(20, 85, 217, 0.42);
  background: linear-gradient(180deg, #f4f8ff, #eaf2ff);
}

.doc-title {
  font-weight: 750;
  line-height: 1.35;
}

.doc-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.editor-shell {
  min-height: calc(100vh - 104px);
  display: grid;
  grid-template-rows: auto minmax(560px, 1fr) auto;
  gap: 14px;
  padding: 18px;
}

.document-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.document-hero input {
  margin-top: 6px;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 820;
  line-height: 1.1;
}

.document-hero input:focus-visible {
  outline: none;
}

.paper {
  display: grid;
  min-height: 560px;
  padding: clamp(22px, 3vw, 44px);
  border: 1px solid #e7ebf2;
  border-radius: 14px;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(180deg, rgba(20, 85, 217, 0.14), rgba(8, 116, 95, 0.08)) border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.paper textarea {
  min-height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #1d2939;
  line-height: 1.9;
  font-size: 17px;
}

.paper textarea:focus-visible {
  outline: none;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.editor-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-meta-row span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.status-text {
  font-size: 13px;
  color: var(--muted);
}

.status-text[data-tone="pending"] {
  color: var(--amber);
}

.status-text[data-tone="success"] {
  color: var(--green);
}

.status-text[data-tone="error"] {
  color: var(--red);
}

.inspector {
  align-self: start;
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.metric-grid strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.metric-grid span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.info-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 12px;
}

.info-list dd {
  margin: -4px 0 4px;
  color: #344054;
  font-size: 14px;
}

.admin-page {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(20, 85, 217, 0.08), transparent 44%),
    #ffffff;
}

.admin-hero h1 {
  margin: 6px 0 8px;
  font-size: 38px;
  letter-spacing: 0;
}

.admin-hero p {
  margin: 0;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
}

.compact-metrics {
  width: min(460px, 100%);
  grid-template-columns: repeat(3, 1fr);
}

.admin-section {
  border-radius: 18px;
  padding: 20px;
}

.admin-section h2 {
  font-size: 22px;
  letter-spacing: 0;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-header .muted {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e4e7ec;
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #667085;
  font-size: 13px;
  font-weight: 750;
  background: #f8fafc;
}

thead th:first-child {
  border-top-left-radius: 12px;
}

thead th:last-child {
  border-top-right-radius: 12px;
}

tbody tr:hover {
  background: #f8fbff;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  width: min(100%, 480px);
  padding: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

.empty.compact {
  padding: 8px 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 1120px) {
  .workspace,
  .edit-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .inspector {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .login-layout,
  .workspace,
  .edit-workspace,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: auto;
    padding: 28px;
    border-right: 0;
    border-bottom: 1px solid rgba(184, 194, 210, 0.62);
  }

  .login-hero-copy {
    margin-top: 48px;
  }

  .login-copy h1 {
    font-size: 36px;
  }

  .login-preview {
    display: none;
  }

  .login-panel {
    width: calc(100% - 32px);
    margin: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .top-actions,
  .toolbar-row,
  .filter-row {
    width: 100%;
    flex-wrap: wrap;
  }

  .top-actions button,
  .toolbar-row button {
    flex: 1;
  }

  .document-hero,
  .admin-hero,
  .section-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .paper {
    padding: 18px;
    min-height: 520px;
  }

  .doc-list {
    max-height: 320px;
  }
}
