/* 日报转周报 Web 版 — 全局样式 v3（2026-09-29 AI 效率工具风格重构）
   定位：AI 工作记录 → 自动整理 → 生成周报 的企业效率工具。
   视觉：白卡片、浅冷灰背景、细边框、适度圆角、蓝色主色（减少大面积填充）、紧凑信息层级。 */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e3e6ea;
  --border-light: #eef0f3;
  --text: #1f2430;
  --text-secondary: #6b7280;
  --accent: #2f6bff;
  --accent-strong: #1e56e0;
  --accent-soft: #eef3ff;
  --danger: #e5484d;
  --success: #2fa669;
  --warning: #e0902a;
  --mask: rgba(28, 33, 44, 0.42);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 8px 40px rgba(16, 24, 40, 0.16);
  --transition: 0.18s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
}
button:hover { background: #f7f8fa; border-color: #d3d7dd; }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(47, 107, 255, 0.3);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); box-shadow: 0 2px 8px rgba(47, 107, 255, 0.35); }
.btn-secondary { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-secondary:hover { background: #f0f1f4; color: var(--text); }

/* ---- 认证页 ---- */
.page-box { max-width: 440px; margin: 12vh auto; padding: 20px; }
.auth-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 32px 36px;
}
.auth-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-secondary); text-align: center; margin-bottom: 24px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row > label { color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}
.form-row textarea { resize: vertical; line-height: 1.6; }

.form-hint { font-size: 12px; color: var(--text-secondary); min-height: 18px; }
.form-hint.ok { color: var(--success); }
.form-hint.warn { color: var(--warning); }

.form-error { color: var(--danger); font-size: 13px; white-space: pre-line; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---- 主界面 ---- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.toolbar-title { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: 0.2px; }
.btn-entry-inline { padding: 5px 14px; font-size: 13px; }

.main-area { display: flex; height: calc(100vh - 112px); }

/* ---- 日报列表面板（紧凑时间轴） ---- */
.daily-list-pane {
  width: 340px; min-width: 300px; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--border);
}
.pane-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.daily-list { flex: 1; overflow-y: auto; padding: 8px 12px; }

/* 日报列表日期筛选条 */
.daily-filter-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}
.daily-filter-bar .filter-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.daily-filter-bar input[type="date"] {
  flex: 1; min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.week-group { margin-bottom: 12px; }
.week-group-title {
  font-weight: 600; color: var(--text-secondary); font-size: 12px;
  padding: 4px 2px 6px; letter-spacing: 0.2px;
}

.daily-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.daily-item:hover {
  background: var(--accent-soft);
  border-color: rgba(47, 107, 255, 0.4);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
}
.daily-item.active {
  background: var(--accent-soft);
  border-color: rgba(47, 107, 255, 0.45);
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.1);
}
.daily-item-date { font-weight: 700; font-size: 13px; color: var(--text); display: inline-block; }
.daily-item-weekday { font-size: 12px; color: var(--text-secondary); margin-left: 6px; display: inline-block; }
.daily-item-preview { color: var(--text-secondary); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }

/* 日报展开详情 */
.daily-item-detail {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
}
.daily-item-detail.open { display: block; }
.detail-field { margin-bottom: 8px; }
.detail-field:last-child { margin-bottom: 0; }
.detail-field-label { font-weight: 600; color: var(--text-secondary); font-size: 12px; margin-bottom: 2px; }
.detail-field-value { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.detail-empty { color: #bbb; font-style: italic; }

/* ---- 周报预览面板 ---- */
.preview-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.preview-pane .pane-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.week-nav { background: transparent; border: 1px solid var(--border); padding: 5px 10px; }
.week-nav:hover { background: var(--accent-soft); border-color: var(--accent); }
.week-label { font-weight: 700; font-size: 15px; flex: 1; text-align: center; color: var(--text); }

.preview-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.preview-empty {
  color: var(--text-secondary); text-align: center;
  margin-top: 90px; font-size: 15px; line-height: 1.8;
}
.preview-content { display: flex; flex-direction: column; gap: 12px; }
.weekly-field-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: box-shadow var(--transition);
}
.weekly-field-row:focus-within { box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12); }
.weekly-field-title { font-weight: 600; margin-bottom: 8px; font-size: 13px; color: var(--text); }
.weekly-field {
  width: 100%; border: 1px solid var(--border-light); border-radius: 6px;
  padding: 8px 10px; background: #fbfcfe;
  resize: vertical; line-height: 1.6;
  transition: background var(--transition);
  font-size: 13px;
}
.weekly-field:focus { outline: none; background: #fff; border-color: rgba(47, 107, 255, 0.4); }

/* 结构化周报内容行（AI 整理感，可编辑） */
.weekly-lines { display: flex; flex-direction: column; gap: 4px; }
.weekly-line {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  cursor: text;
}
.weekly-line:hover { border-color: rgba(47, 107, 255, 0.3); }
.weekly-line:focus { outline: none; border-color: rgba(47, 107, 255, 0.5); box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.1); }
.weekly-line-dot {
  flex: none; width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
}
.weekly-line .weekly-line-dot { background: var(--accent); }

.preview-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.export-dropdown { position: relative; }
.export-menu {
  position: absolute; bottom: 42px; right: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; min-width: 150px; z-index: 20;
  overflow: hidden;
}
.export-menu button { border: none; border-radius: 0; text-align: left; padding: 10px 16px; }
.export-menu button:hover { background: var(--accent-light); }
.export-menu button + button { border-top: 1px solid var(--border-light); }

/* ---- 状态栏 ---- */
.statusbar {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.statusbar .status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); margin-right: 6px; }

/* ---- 模态面板 ---- */
.modal-mask {
  position: fixed; inset: 0;
  background: var(--mask);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.modal-dialog {
  width: 520px; max-width: 92vw; max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 24px 28px;
  animation: slideIn 0.2s ease;
}
.modal-dialog.modal-wide { width: 640px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 9px 18px; color: var(--text-secondary); background: transparent; font-weight: 500; }
.tab:hover { background: #f5f5f5; }
.tab.active { color: var(--accent); font-weight: 600; border-bottom: 2px solid var(--accent); background: var(--accent-light); }

/* ---- 日报详情模态（查看单条日报） ---- */
.detail-modal-content { line-height: 1.8; }
.detail-modal-field { margin-bottom: 16px; }
.detail-modal-field:last-child { margin-bottom: 0; }
.detail-modal-label { font-weight: 600; color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.detail-modal-value { color: var(--text); white-space: pre-wrap; word-break: break-word; padding: 8px 10px; background: #f8f9fa; border-radius: var(--radius-sm); border: 1px solid var(--border-light); }
.detail-modal-value:empty::before { content: '（无内容）'; color: #ccc; font-style: italic; }

/* ---- 历史视图 ---- */
.history-view { flex: 1; display: flex; flex-direction: column; background: var(--panel); min-height: 0; }
.history-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.history-toolbar input[type="date"] { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); height: 30px; }
.history-toolbar select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); height: 30px; }
.history-toolbar .period-switch, .history-toolbar .filter-label { display: inline-flex; align-items: center; gap: 8px; }
.history-toolbar button { height: 30px; }
.history-daily-filter, .history-weekly-filter { display: inline-flex; align-items: center; gap: 8px; }
.history-daily-filter .filter-label, .history-weekly-filter .filter-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; margin-right: 0; }
.history-list { flex: 1; overflow-y: auto; padding: 16px 20px; }
.history-empty { color: var(--text-secondary); text-align: center; margin-top: 60px; font-size: 15px; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; transition: all var(--transition); background: var(--panel); }
.history-item:hover { background: var(--accent-soft); border-color: rgba(47, 107, 255, 0.4); }
.history-item-week { font-weight: 600; min-width: 120px; }
.history-item-preview { flex: 1; min-width: 0; color: var(--text-secondary); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item-mode { font-size: 12px; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 2px 8px; }
.history-item-time { margin-left: auto; color: var(--text-secondary); font-size: 12px; white-space: nowrap; }

/* ---- 本周工作概览（W7 UI 重构） ---- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.overview-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.overview-card .ov-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.overview-card .ov-value { font-size: 22px; font-weight: 700; color: var(--text); }
.overview-card .ov-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.overview-card.accent .ov-value { color: var(--accent); }
.overview-card.success .ov-value { color: var(--success); }
.overview-card.warning .ov-value { color: var(--warning); }
.overview-card.danger .ov-value { color: var(--danger); }

/* ---- AI 状态反馈 ---- */
.ai-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(47, 107, 255, 0.2);
  margin-bottom: 12px;
}
.ai-status .ai-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(47, 107, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.ai-status.done { background: #f0f9f3; border-color: rgba(47, 166, 105, 0.25); }
.ai-status.done .ai-spinner { border-color: rgba(47, 166, 105, 0.25); border-top-color: var(--success); }

/* ---- Toast / 加载态 ---- */
.toast {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff; padding: 12px 24px; border-radius: 10px;
  font-size: 14px; z-index: 200;
  max-width: 75vw; text-align: center;
  animation: toastIn 0.25s ease;
  backdrop-filter: blur(8px);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
  z-index: 150; color: #fff; font-size: 15px;
  backdrop-filter: blur(2px);
}
.spinner { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }