/* OA 办公系统 - 简约浅色主题 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8a919f;
  --primary: #3370ff;
  --primary-hover: #295fd6;
  --primary-light: #e8f0ff;
  --red: #d83931;
  --red-light: #fdecea;
  --orange: #b25000;
  --orange-light: #fff1e3;
  --green: #1f7a3d;
  --green-light: #e6f6ec;
  --gray-light: #f0f1f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 41, 0.04);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px 36px;
  box-shadow: 0 4px 16px rgba(31, 35, 41, 0.06);
  text-align: center;
}
.login-logo {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 20px; font-weight: 600; }
.login-sub { color: var(--text-3); font-size: 13px; margin: 4px 0 26px; }
.login-card .form-item { text-align: left; margin-bottom: 16px; }
.login-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 8px;
  text-align: left;
}

/* ============ 表单元素 ============ */
label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--text-3); }

.btn-primary {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #a9c0ff; cursor: not-allowed; }
.btn-block { width: 100%; height: 38px; }
.btn-ghost {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ============ 应用骨架 ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
}
.brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 30px; height: 30px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 15px; font-weight: 600; }

.nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--gray-light); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.nav-ico { width: 18px; text-align: center; font-size: 14px; }
.badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
}
.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}

.main { flex: 1; margin-left: 200px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-date { color: var(--text-3); font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.role-tag {
  font-size: 11px;
  color: var(--orange);
  background: var(--orange-light);
  padding: 1px 6px;
  border-radius: 4px;
}

.content { padding: 20px 24px; flex: 1; }
.view { animation: fadein 0.15s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ============ 卡片 ============ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .more { font-size: 13px; }
.card-body { padding: 6px 18px 14px; }

/* ============ 首页统计 ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-ico {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.stat-ico.blue { background: var(--primary-light); color: var(--primary); }
.stat-ico.orange { background: var(--orange-light); color: var(--orange); }
.stat-ico.green { background: var(--green-light); color: var(--green); }
.stat-ico.red { background: var(--red-light); color: var(--red); }
.stat-num { font-size: 24px; font-weight: 600; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-2); }

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

/* ============ 列表行 ============ */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.row:last-child { border-bottom: none; }
.row:hover { background: #fafbfc; }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.row-side { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 36px 0;
  font-size: 13px;
}

/* ============ 标签 ============ */
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tag-red { color: var(--red); background: var(--red-light); }
.tag-blue { color: var(--primary); background: var(--primary-light); }
.tag-gray { color: var(--text-2); background: var(--gray-light); }
.tag-orange { color: var(--orange); background: var(--orange-light); }
.tag-green { color: var(--green); background: var(--green-light); }

/* ============ 选项卡 ============ */
.tabs { display: flex; gap: 4px; }
.tab {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.tab:hover { background: var(--gray-light); }
.tab.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }

/* ============ 消息中心 ============ */
.msg-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  align-items: start;
}
.msg-list-card { overflow: hidden; }
.msg-list-card .tabs { padding: 12px 14px 0; }
.msg-list { max-height: calc(100vh - 220px); overflow-y: auto; padding: 4px 14px 10px; }
.msg-row { display: flex; align-items: center; gap: 10px; padding: 11px 8px; border-radius: 8px; cursor: pointer; }
.msg-row:hover { background: #fafbfc; }
.msg-row.selected { background: var(--primary-light); }
.msg-detail-card { min-height: 420px; display: flex; flex-direction: column; }
.detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-3);
}
.detail-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.detail-title { font-size: 17px; font-weight: 600; }
.detail-meta { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.detail-body { padding: 18px 20px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg-form { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg-form .form-row { display: flex; gap: 10px; }
.msg-form .form-row select { width: 200px; }
.msg-form .actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============ 待办 ============ */
.todo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
}
.todo-add {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.todo-add input { flex: 1; }
.todo-add select { width: 90px; }
.todo-add input[type="date"] { width: 150px; }
.todo-list { padding: 4px 18px 12px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.todo-row:last-child { border-bottom: none; }
.todo-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 11px;
  background: #fff;
}
.todo-check.done { background: var(--green); border-color: var(--green); }
.todo-title { flex: 1; min-width: 0; }
.todo-row.done .todo-title { color: var(--text-3); text-decoration: line-through; }
.todo-due { font-size: 12px; color: var(--text-3); }
.todo-due.overdue { color: var(--red); }
.todo-del {
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  visibility: hidden;
}
.todo-row:hover .todo-del { visibility: visible; }
.todo-del:hover { color: var(--red); background: var(--red-light); }

/* ============ 研发 ============ */
.rd-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
}
.rd-form {
  margin: 14px 18px 0;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rd-form .full { grid-column: 1 / -1; }
.rd-form .actions { display: flex; gap: 10px; justify-content: flex-end; }
.rd-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 18px 18px;
}
.rd-card { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.rd-card:hover { border-color: #c9cdd4; }
.rd-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rd-card-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; }
.rd-card-content {
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 20px;
  margin-bottom: 10px;
}
.rd-card-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-3); }
.rd-card-foot select { height: 26px; font-size: 12px; width: 88px; padding: 0 6px; }
.rd-del { margin-left: auto; border: none; background: transparent; color: var(--text-3); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.rd-del:hover { color: var(--red); background: var(--red-light); }

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid, .rd-list { grid-template-columns: 1fr; }
  .msg-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { width: 64px; }
  .brand-name, .nav-text, .sidebar-foot { display: none; }
  .main { margin-left: 64px; }
  .nav-item { justify-content: center; }
  .badge { position: absolute; top: 4px; right: 4px; }
  .content { padding: 14px; }
  .stat-grid { grid-template-columns: 1fr; }
}
