* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* ── 登录页 ── */
.login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-card {
  background: #fff; border-radius: 12px; padding: 40px 36px;
  width: 360px; box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.login-card h1 { font-size: 22px; margin-bottom: 28px; text-align: center; color: #1a1a2e; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 12px;
  border: 1px solid #d9d9d9; border-radius: 8px;
  font-size: 14px; outline: none; transition: border .2s;
}
.form-group input:focus, .form-group select:focus { border-color: #4f6ef7; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: 14px; cursor: pointer; transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #4f6ef7; color: #fff; }
.btn-danger  { background: #ff4d4f; color: #fff; }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-success { background: #52c41a; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn.active { background: #4f6ef7; color: #fff; border-color: #4f6ef7; }
.error-msg { color: #ff4d4f; font-size: 13px; margin-top: 10px; text-align: center; }

/* ── 主布局 ── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }
.navbar {
  background: #1a1a2e; color: #fff;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.navbar .brand { font-size: 17px; font-weight: 600; }
.navbar .nav-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.navbar .nav-right span { opacity: .7; }
.navbar .nav-right button {
  background: transparent; border: 1px solid rgba(255,255,255,.3);
  color: #fff; border-radius: 6px; padding: 5px 12px;
  font-size: 13px; cursor: pointer;
}

.main { display: flex; flex: 1; min-height: 0; }

/* ── 侧边栏 ── */
.sidebar {
  width: 180px; background: #fff;
  border-right: 1px solid #e8e8e8; padding: 16px 0;
  flex-shrink: 0;
}
.sidebar-item {
  padding: 11px 20px; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  color: #555; transition: background .15s;
}
.sidebar-item:hover { background: #f5f7ff; }
.sidebar-item.active { background: #eef1ff; color: #4f6ef7; font-weight: 500; }

/* ── 内容区 ── */
.content { flex: 1; padding: 24px; overflow-y: auto; min-width: 0; }
.page { display: none; }
.page.active { display: block; }

.card {
  background: #fff; border-radius: 10px;
  padding: 24px; margin-bottom: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.card h2 { font-size: 16px; margin-bottom: 18px; color: #1a1a2e; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #fafafa; padding: 10px 12px; text-align: left; color: #666; font-weight: 500; border-bottom: 1px solid #e8e8e8; }
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
tr:hover td { background: #fafafa; }
.empty-tip { text-align: center; color: #aaa; padding: 40px; font-size: 14px; }

/* ── Tag ── */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-warning { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.tag-error   { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.tag-info    { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }

/* ── 结果面板 ── */
.result-panel { margin-top: 16px; }
.result-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}
.result-row:last-child { border-bottom: none; }
.result-label { color: #888; min-width: 90px; }

/* ── 日报链接 ── */
.report-link { color: #4f6ef7; text-decoration: none; font-weight: 500; }
.report-link:hover { text-decoration: underline; }

/* ── 编辑器页 ── */
.editor-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.editor-title-label { font-size: 16px; font-weight: 600; color: #1a1a2e; }

.editor-card { padding: 0; overflow: hidden; }

.editor-wrap {
  display: flex; min-height: 400px;
  max-height: calc(100vh - 280px);
}

/* ── 行号 ── */
.line-numbers {
  flex-shrink: 0; width: 44px;
  background: #fafafa; border-right: 1px solid #e8e8e8;
  padding: 12px 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  user-select: none;
  text-align: right;
}
.line-numbers::-webkit-scrollbar { display: none; }
.line-numbers span {
  display: block;
  padding: 0 8px 0 0;
  font-size: 13px; line-height: 20px;
  font-family: Consolas, "Courier New", monospace;
  color: #bbb;
  cursor: pointer;
  transition: background .1s, color .1s;
  min-height: 20px;
}
.line-numbers span:hover { background: #eef1ff; color: #4f6ef7; }
.line-numbers span.ln-error { background: #fff2f0; color: #ff4d4f; font-weight: 600; }
.line-numbers span.ln-warn  { background: #fffbe6; color: #faad14; font-weight: 600; }

/* ── 正文编辑区 ── */
#content-editor {
  flex: 1; min-width: 0;
  border: none;
  padding: 12px 16px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px; line-height: 20px;
  resize: none; outline: none;
  overflow-y: scroll; overflow-x: hidden;
  white-space: pre-wrap; word-wrap: break-word; overflow-x: hidden; tab-size: 4;
  min-height: 400px;
  background: #fff;
}

/* ── 编辑器内行号高亮同步指示条 ── */
.editor-wrap.review-active .line-numbers {
  box-shadow: inset -3px 0 0 rgba(255,77,79,.3);
}

/* ── 底部工具栏 ── */
.editor-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 12px 0;
  position: sticky; bottom: 0;
  background: #f0f2f5;
}
.editor-toolbar .btn { min-height: 44px; }

/* ── 审核问题面板 ── */
.review-panel {
  background: #fff; border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  margin-top: 16px; overflow: hidden;
}
.review-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #f0f0f0;
  font-size: 15px; font-weight: 500;
}
.review-issues { padding: 8px 0; max-height: 300px; overflow-y: auto; }
.review-issue-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 20px; cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background .1s;
}
.review-issue-item:hover { background: #fafafa; }
.review-issue-line {
  flex-shrink: 0; min-width: 52px;
  background: #fff2f0; color: #ff4d4f;
  font-size: 12px; font-weight: 500;
  padding: 2px 8px; border-radius: 4px; text-align: center;
}
.review-issue-msg { font-size: 13px; color: #555; line-height: 1.5; padding-top: 1px; }

/* ── 草稿历史 ── */
.draft-item {
  padding: 12px 0; border-bottom: 1px solid #f0f0f0;
}
.draft-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.draft-item-preview {
  font-size: 12px; color: #888; background: #fafafa;
  padding: 8px 12px; border-radius: 6px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 80px; overflow: hidden;
}

/* ── 加载 ── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.loading-box {
  background: #fff; border-radius: 10px;
  padding: 24px 32px; text-align: center; font-size: 14px;
}

/* ── Toast ── */
.toast-wrap {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 1000;
}
.toast {
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px; color: #fff; min-width: 200px;
  animation: slideIn .2s ease;
}
.toast-success { background: #52c41a; }
.toast-error   { background: #ff4d4f; }
.toast-info    { background: #1890ff; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── 模态弹窗 ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 12px;
  padding: 28px 24px; width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: #1a1a2e; }

.action-bar { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.issue-list { margin-top: 8px; }

/* ── 响应式：平板 ── */
@media (max-width: 768px) {
  .main { flex-direction: column; }
  .sidebar {
    width: 100%; display: flex; overflow-x: auto;
    border-right: none; border-bottom: 1px solid #e8e8e8;
    padding: 0;
  }
  .sidebar-item { white-space: nowrap; padding: 12px 16px; font-size: 13px; }
  .content { padding: 12px; }
  .navbar { padding: 0 12px; }
  .navbar .brand { font-size: 15px; }
  .login-card { width: 90%; padding: 24px 20px; }
  .modal-box { width: 90%; }

  .editor-wrap {
    max-height: calc(100vh - 340px);
    min-height: 300px;
  }
  #content-editor { min-height: 300px; }
  .line-numbers { width: 32px; }
  .line-numbers span { font-size: 11px; padding: 0 4px 0 0; }
  .review-panel { margin-top: 12px; }
  .editor-toolbar { gap: 6px; }
  .editor-toolbar .btn { flex: 1; min-width: 0; }
}

/* ── 响应式：手机 ── */
@media (max-width: 480px) {
  .card { padding: 16px; }
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
  .editor-header { gap: 8px; }
  .editor-title-label { font-size: 14px; }

  .editor-wrap {
    max-height: calc(100vh - 300px);
    min-height: 250px;
  }
  #content-editor {
    min-height: 250px;
    font-size: 12px; padding: 10px 12px;
  }
  .line-numbers { width: 28px; }
  .line-numbers span { font-size: 10px; padding: 0 3px 0 0; }

  .editor-toolbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 8px 12px; gap: 6px;
    background: #fff; border-top: 1px solid #e8e8e8;
    z-index: 100;
  }
  .editor-toolbar .btn { flex: 1; min-width: 0; font-size: 12px; padding: 10px 8px; }

  /* 审核面板手机端：底部抽屉 */
  .review-panel {
    position: fixed; bottom: 56px; left: 0; right: 0;
    max-height: 40vh; border-radius: 12px 12px 0 0;
    z-index: 99; overflow-y: auto;
    box-shadow: 0 -2px 16px rgba(0,0,0,.12);
  }
  .review-issue-item { padding: 10px 16px; }
}
