/* ==========================================================================
   个人 AI 工作台 · 淡墨留白（宋画感）UI 样式
   规范来源：第六章 UI 设计规范
   ========================================================================== */

:root {
  /* 色彩 */
  --paper: #F7F4EE;          /* 宣纸米白（页面底色） */
  --card: #FDFCF9;           /* 卡片底色 */
  --ink: #1F1F1F;            /* 墨黑（主文字） */
  --ink-light: #6B6B6B;      /* 淡墨灰（次文字） */
  --line: #D9D4C8;           /* 极淡墨线（辅助线） */
  --accent: #B03A2E;         /* 朱砂红（强调/未完成/异常） */
  --progress-bg: #E8E3D8;    /* 进度条底 */
  --progress-fill: #3A3A3A;  /* 进度条填充（墨色） */

  /* 字体 */
  --font-title: "Songti SC", "STSong", "SimSun", serif;
  --font-body: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  --font-num: -apple-system, "Segoe UI", sans-serif;

  /* 尺寸 */
  --nav-width: 200px;
  --content-max: 1200px;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* --------------------------------------------------------------------------
   布局：左侧固定导航 + 右侧内容区
   -------------------------------------------------------------------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--nav-width);
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  font-family: var(--font-title);
  font-size: 20px;
  padding: 0 20px 20px;
  letter-spacing: 2px;
}

.sidebar .logo span { display: block; font-size: 12px; color: var(--ink-light); letter-spacing: 1px; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  color: var(--ink);
  border-left: 3px solid transparent;
  font-size: 14px;
  transition: background 0.15s;
}

.nav-item:hover { background: #F3EFE6; }

.nav-item.active {
  border-left-color: var(--accent);
  font-weight: 700;
  background: #F3EFE6;
}

.nav-badge {
  background: var(--accent);
  color: #fff;
  font-family: var(--font-num);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar .logout {
  margin-top: auto;
  padding: 12px 20px;
  color: var(--ink-light);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

.sidebar .logout:hover { color: var(--accent); }

.main {
  flex: 1;
  margin-left: var(--nav-width);
  padding: 32px 40px;
  max-width: calc(var(--nav-width) + var(--content-max));
}

/* --------------------------------------------------------------------------
   通用元素
   -------------------------------------------------------------------------- */
.page-title {
  font-family: var(--font-title);
  font-size: 24px;
  margin-bottom: 4px;
}

.page-sub { color: var(--ink-light); font-size: 13px; margin-bottom: 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-title);
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 7px 18px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  transition: all 0.15s;
}

.btn:hover { background: var(--progress-bg); }

.btn-primary {
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn-sm { padding: 4px 12px; font-size: 13px; }

/* 表单 */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-light);
  margin-bottom: 5px;
}

.field input, .field textarea, .field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.field textarea { resize: vertical; min-height: 70px; }

/* 进度条 */
.progress {
  height: 8px;
  background: var(--progress-bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--progress-fill);
  transition: width 0.3s;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--ink-light);
  margin-top: 5px;
}

/* 异常/朱砂红强调 */
.accent { color: var(--accent); }
.accent-dot::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-right: 6px; }
.tag-red { color: var(--accent); font-size: 12px; }

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

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

th { color: var(--ink-light); font-weight: normal; font-size: 13px; }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
  color: var(--ink-light);
}

.tag.pinned { border-color: var(--accent); color: var(--accent); }

/* 状态徽标 */
.badge { font-size: 12px; padding: 2px 8px; border-radius: 3px; }

/* 模态框 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 28px;
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}

.modal h3 { font-family: var(--font-title); margin-bottom: 16px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 空状态 */
.empty { color: var(--ink-light); text-align: center; padding: 30px; font-size: 14px; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; }
  .main { margin-left: 0; padding: 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 40px;
  width: 380px;
  text-align: center;
}

.login-card h1 { font-family: var(--font-title); font-size: 26px; letter-spacing: 3px; margin-bottom: 6px; }
.login-card .sub { color: var(--ink-light); font-size: 13px; margin-bottom: 24px; }
