/* Lawbot — 文件校对 · 简洁优雅 */
:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --border: #e8e6e3;
  --text: #2c2a28;
  --text-muted: #6b6560;
  --accent: #2d5a4a;
  --accent-hover: #234a3d;
  --danger: #a63d3d;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "DM Serif Display", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

h1, .title {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Layout：自适应宽度，大屏接近全屏 */
.container {
  max-width: min(1400px, 96vw);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* 登录页用较窄卡片，更紧凑 */
body.auth-page .container {
  max-width: 420px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.header .brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text);
}
.header .brand span {
  color: var(--accent);
}

/* Forms */
input[type="text"],
input[type="password"],
button,
.btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 90, 74, 0.12);
}

.btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

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

.btn-ghost {
  background: transparent;
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}
.btn-danger:hover {
  background: rgba(166, 61, 61, 0.08);
}

/* Login / Auth */
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem;
  margin-top: 3rem;
}

.auth-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.auth-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input {
  width: 100%;
}

.auth-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.auth-actions .btn {
  flex: 1;
  justify-content: center;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tabs a {
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* Workspace */
.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.workspace-toolbar .upload-wrap {
  position: relative;
}
.workspace-toolbar input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: visible;
}

.file-list table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.file-list th,
.file-list td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.file-list th:first-child,
.file-list td:first-child {
  width: 60%;
  min-width: 240px;
}

.file-list th:nth-child(2),
.file-list td:nth-child(2) {
  width: 100px;
  white-space: nowrap;
}

.file-list th:last-child,
.file-list td:last-child {
  width: auto;
  white-space: nowrap;
}

.file-list th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-list tr:last-child td {
  border-bottom: none;
}

.file-list tr:hover {
  background: rgba(0,0,0,0.02);
}

.file-name {
  font-weight: 500;
  word-break: break-all;
  overflow-wrap: break-word;
}

.file-size {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.file-actions .btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

/* Progress (proofread) */
.progress-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.progress-box p {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state p {
  margin: 0 0 1rem;
}

/* Admin */
.admin-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.log-table th,
.log-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.log-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.role-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}
.role-badge.admin {
  background: rgba(45, 90, 74, 0.12);
  color: var(--accent);
}
.role-badge.user {
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
}

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  word-break: break-all;
  overflow-wrap: break-word;
}
.message.error {
  background: rgba(166, 61, 61, 0.1);
  color: var(--danger);
}
.message.success {
  background: rgba(45, 90, 74, 0.1);
  color: var(--accent);
}

.loading {
  opacity: 0.7;
  pointer-events: none;
}
