/* =====================================================================
   app.css —— 工作台外壳（顶栏 / 板块面板 / 预览台 / AI 对话）
   只负责界面本身，简历本体的样式在 resume.css
   ===================================================================== */

:root {
  --navy: #1B3459;
  --navy2: #2F5E9C;
  --ink: #1F2733;
  --ink2: #4B5768;
  --ink3: #8A94A3;
  --bg: #EEF1F5;
  --panel: #FFFFFF;
  --line: #DCE2EA;
  --line2: #EDF1F6;
  --tint: #F6F8FB;
  --ok: #1E7A4B;
  --warn: #B4551A;
  --err: #B02A2A;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 6px 18px rgba(16, 32, 56, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy2); }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  height: 54px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: var(--navy);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .5px; }
.brand .dot {
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(140deg, #4C86C6, #2F5E9C);
  display: grid; place-items: center; font-size: 13px;
}
.topbar .spacer { flex: 1; }
.doc-title-input {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff; border-radius: 7px;
  padding: 5px 10px; width: 190px;
}
.doc-title-input::placeholder { color: rgba(255,255,255,.55); }
.doc-title-input:focus { outline: 2px solid rgba(120,175,235,.55); }

.tb-btn {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff; border-radius: 7px;
  padding: 6px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: background .15s;
}
.tb-btn:hover { background: rgba(255,255,255,.2); }
.tb-btn:disabled { opacity: .45; cursor: not-allowed; }
.tb-btn.primary { background: #fff; color: var(--navy); border-color: #fff; font-weight: 700; }
.tb-btn.primary:hover { background: #EAF1FA; }
.tb-select {
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16);
  color: #fff; border-radius: 7px; padding: 6px 8px; cursor: pointer;
}
.tb-select option { color: #1F2733; }

.save-state { font-size: 12px; color: rgba(255,255,255,.7); min-width: 68px; }
.save-state.err { color: #FFC9C9; }

/* ------------------------------ 布局 ------------------------------ */
.workspace {
  height: calc(100% - 54px);
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr) 372px;
  gap: 0;
  overflow: hidden;
}
.pane { background: var(--panel); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.pane + .pane { border-left: 1px solid var(--line); }
.pane-head {
  flex-shrink: 0; height: 44px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--tint);
}
.pane-head h2 { font-size: 13.5px; margin: 0; font-weight: 700; letter-spacing: .3px; }
.pane-head .spacer { flex: 1; }
.pane-body { flex: 1; overflow: auto; min-height: 0; }

.collapse-btn {
  border: none; background: none; cursor: pointer; color: var(--ink3);
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center;
}
.collapse-btn:hover { background: var(--line2); color: var(--navy2); }

/* ------------------------- 左：板块列表 ------------------------- */
.block-list { padding: 8px; }
.block-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; background: #fff;
}
.block-row:hover { background: var(--tint); }
.block-row.is-open { background: #EAF1FA; border-color: #BFD3EA; }
.block-row .label { flex: 1; font-weight: 600; font-size: 13.5px; min-width: 0; }
.block-row .meta { font-size: 11.5px; color: var(--ink3); }
.block-row .acts { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.block-row:hover .acts, .block-row.is-open .acts { opacity: 1; }
.mini-btn {
  width: 22px; height: 22px; border-radius: 5px;
  border: 1px solid var(--line); background: #fff;
  cursor: pointer; color: var(--ink2);
  display: grid; place-items: center; font-size: 12px; line-height: 1;
}
.mini-btn:hover { background: var(--navy2); border-color: var(--navy2); color: #fff; }
.mini-btn.danger:hover { background: var(--err); border-color: var(--err); }
.mini-btn:disabled { opacity: .3; cursor: not-allowed; }
.mini-btn:disabled:hover { background: #fff; color: var(--ink2); border-color: var(--line); }

.block-editor {
  margin: 0 8px 10px; padding: 12px;
  border: 1px solid #BFD3EA; border-radius: 8px;
  background: #FBFDFF;
}
.block-editor .hint { font-size: 12px; color: var(--ink3); margin: -2px 0 10px; }

.field { margin-bottom: 10px; }
.field > label { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 4px; font-weight: 600; }
/* 注意：不能只写 input[type="text"]，否则 type="password" 的输入框拿不到 width:100%，
   在登录页上会明显比账号框窄一截。统一用「排除掉勾选框/单选框」的写法。 */
.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select {
  width: 100%; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  resize: vertical;
}
.field textarea { min-height: 64px; line-height: 1.6; }
.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field textarea:focus, .field select:focus {
  outline: none; border-color: var(--navy2); box-shadow: 0 0 0 3px rgba(47,94,156,.12);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.item-card {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 10px; margin-bottom: 10px;
}
.item-card-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  font-size: 12px; color: var(--ink3);
}
.item-card-head .spacer { flex: 1; }
.lines-editor { display: flex; flex-direction: column; gap: 6px; }
.line-row { display: flex; gap: 6px; align-items: flex-start; }
.line-row textarea { flex: 1; min-height: 42px; }
.empty-note { font-size: 12px; color: var(--ink3); padding: 6px 0; }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 6px 11px; cursor: pointer; color: var(--ink2);
}
.btn:hover { border-color: var(--navy2); color: var(--navy2); }
.btn.solid { background: var(--navy2); border-color: var(--navy2); color: #fff; font-weight: 600; }
.btn.solid:hover { background: var(--navy); border-color: var(--navy); }
.btn.sm { padding: 4px 8px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------- 中：预览台 ------------------------- */
.stage {
  background: #E4E8EE;
  overflow: auto;
  padding: 22px 0 60px;
  display: flex; flex-direction: column; align-items: center;
  position: relative;
}
.paper-zoom { transform-origin: top center; transition: transform .12s; }
.paper {
  width: 210mm;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16,32,56,.10), 0 16px 40px rgba(16,32,56,.10);
  position: relative;
  /* 屏幕上每 297mm 画一条虚线，大致标出 A4 分页位置 */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(297mm - 1px),
    #D9E2EC calc(297mm - 1px),
    #D9E2EC 297mm
  );
}
.zoom-bar {
  position: sticky; top: 0; z-index: 5; align-self: flex-end;
  margin: 0 16px 10px 0;
  display: flex; gap: 4px; align-items: center;
  background: rgba(255,255,255,.92); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 6px;
  font-size: 12px; color: var(--ink2);
  box-shadow: var(--shadow);
}
.zoom-bar button {
  border: none; background: none; cursor: pointer; color: var(--ink2);
  width: 24px; height: 24px; border-radius: 5px; font-size: 14px;
}
.zoom-bar button:hover { background: var(--line2); color: var(--navy2); }
.stage-tip {
  position: sticky; bottom: 12px; align-self: center; z-index: 5;
  background: rgba(31,39,51,.86); color: #fff;
  font-size: 12px; padding: 6px 12px; border-radius: 20px;
  margin-top: 20px; pointer-events: none;
  /* 它是给第一次用的人看的，看几秒就该让开，不要一直压着简历内容 */
  animation: tipAway .7s ease 12s forwards;
}
@keyframes tipAway {
  to { opacity: 0; visibility: hidden; transform: translateY(6px); }
}
.stage-tip:hover { animation-play-state: paused; }

/* ------------------------- 右：AI 对话 ------------------------- */
.chat-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; max-width: 100%; }
.msg .bubble {
  padding: 8px 11px; border-radius: 10px; font-size: 13px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; max-width: 100%;
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--navy2); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant .bubble { background: var(--tint); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.assistant .bubble.streaming::after {
  content: "▍"; color: var(--navy2); animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.msg.system .bubble {
  background: #FFF8E8; border: 1px solid #F0DFB4; color: #6B551A; font-size: 12.5px;
}
.msg.error .bubble { background: #FDECEC; border: 1px solid #F3C9C9; color: var(--err); font-size: 12.5px; }

.tool-chip {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12px; padding: 6px 9px; border-radius: 8px;
  background: #EDF7F0; border: 1px solid #C6E6D3; color: #1E6B45;
  margin: 2px 0;
}
.tool-chip.bad { background: #FDECEC; border-color: #F3C9C9; color: var(--err); }
.tool-chip .t { font-weight: 700; }

.chat-input {
  flex-shrink: 0; border-top: 1px solid var(--line);
  padding: 10px; background: var(--tint);
}
.chat-input textarea {
  width: 100%; min-height: 66px; max-height: 180px; resize: vertical;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; line-height: 1.55;
}
.chat-input textarea:focus { outline: none; border-color: var(--navy2); box-shadow: 0 0 0 3px rgba(47,94,156,.12); }
.chat-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.chat-actions .tip { flex: 1; font-size: 11.5px; color: var(--ink3); }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.quick-chips button {
  border: 1px solid var(--line); background: #fff; border-radius: 20px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--ink2);
}
.quick-chips button:hover { border-color: var(--navy2); color: var(--navy2); }

/* ------------------------------ 弹窗 ------------------------------ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,28,40,.45);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: min(560px, 100%);
  max-height: 84vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(16,32,56,.28); overflow: hidden;
}
.modal-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-body { padding: 14px 16px; overflow: auto; }
.modal-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px; background: var(--tint);
}
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-card {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px;
  cursor: pointer; background: #fff; text-align: left;
}
.type-card:hover { border-color: var(--navy2); background: #F7FAFE; }
.type-card.disabled { opacity: .42; cursor: not-allowed; }
.type-card .n { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.type-card .d { font-size: 12px; color: var(--ink3); line-height: 1.5; }

/* ------------------------------ 登录页 ------------------------------ */
.auth-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #DCE9F7 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 110%, #E4EAF3 0%, transparent 55%),
    var(--bg);
}
.auth-card {
  width: min(400px, 100%); background: #fff; border-radius: 14px;
  padding: 28px 26px; box-shadow: 0 2px 4px rgba(16,32,56,.05), 0 20px 50px rgba(16,32,56,.12);
}
.auth-card .logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.auth-card .logo .dot {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, #4C86C6, #1B3459);
  display: grid; place-items: center; color: #fff; font-size: 16px;
}
.auth-card h1 { font-size: 18px; margin: 0 0 2px; letter-spacing: .5px; }
.auth-card .sub { color: var(--ink3); font-size: 12.5px; margin-bottom: 20px; }
.auth-card .field input { padding: 10px 12px; }
.auth-card .btn.solid { width: 100%; padding: 10px; margin-top: 4px; font-size: 14px; }
.auth-msg {
  margin-top: 12px; font-size: 12.5px; padding: 8px 10px; border-radius: 7px;
  background: #FDECEC; color: var(--err); border: 1px solid #F3C9C9;
  line-height: 1.6;
}
.auth-msg.ok { background: #EDF7F0; color: var(--ok); border-color: #C6E6D3; }
.auth-foot { margin-top: 16px; font-size: 12px; color: var(--ink3); text-align: center; line-height: 1.7; }
.auth-foot a { font-weight: 600; }

/* --------------------- 注册页：步骤条 / 验证码 --------------------- */
.steps { display: flex; gap: 8px; margin: 0 0 18px; }
.step {
  flex: 1; display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink3);
  padding: 8px 10px; border-radius: 8px;
  background: var(--tint); border: 1px solid var(--line);
}
.step .n {
  width: 19px; height: 19px; border-radius: 50%; flex-shrink: 0;
  background: var(--line); color: #fff;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
}
.step.is-active { color: var(--navy); border-color: #BFD3EA; background: #EAF1FA; }
.step.is-active .n { background: var(--navy2); }

.sent-to {
  font-size: 13px; color: var(--ink2); background: var(--tint);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 14px; line-height: 1.6;
  word-break: break-all;
}
.sent-to b { color: var(--navy); }
.link-btn {
  border: none; background: none; color: var(--navy2);
  cursor: pointer; font-size: 12.5px; padding: 0; text-decoration: underline;
  float: right;
}
.link-btn:hover { color: var(--navy); }
.link-btn:disabled { color: var(--ink3); cursor: not-allowed; text-decoration: none; }

.code-input {
  text-align: center;
  font-size: 26px !important;
  letter-spacing: 12px;
  text-indent: 12px;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  padding: 12px 10px !important;
}
.resend-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 12px; font-size: 12.5px; color: var(--ink3);
}

/* ------------------------------ 管理端 ------------------------------ */
.page-wrap { max-width: 1080px; margin: 0 auto; padding: 22px 20px 60px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; margin: 0 0 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--tint);
}
.stat .n { font-size: 22px; font-weight: 700; color: var(--navy); }
.stat .l { font-size: 12px; color: var(--ink3); margin-top: 2px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line2);
  vertical-align: middle;
}
table.data th { color: var(--ink3); font-weight: 600; font-size: 12px; }
table.data tr:hover td { background: #FAFCFE; }
.tag-pill {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 20px;
  background: var(--line2); color: var(--ink2);
}
.tag-pill.admin { background: #E7F0FB; color: var(--navy2); }
.tag-pill.off { background: #FDECEC; color: var(--err); }
.tag-pill.on { background: #EDF7F0; color: var(--ok); }

/* 开关 */
.switch-row { display: flex; align-items: flex-start; gap: 12px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #C7D0DC; border-radius: 24px; transition: background .18s;
}
.switch .slider::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .18s; box-shadow: 0 1px 3px rgba(16,32,56,.3);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: .45; cursor: not-allowed; }

/* ------------------------------ 通用 ------------------------------ */
.toast-host {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90; align-items: center;
}
.toast {
  background: rgba(31,39,51,.92); color: #fff; font-size: 13px;
  padding: 9px 15px; border-radius: 9px; box-shadow: var(--shadow);
  animation: rise .18s ease-out;
}
.toast.ok { background: rgba(24,110,70,.95); }
.toast.err { background: rgba(176,42,42,.95); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------ 打印 ------------------------------ */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; height: auto !important; }
  .topbar, .pane:first-child, .pane:last-child, .zoom-bar, .stage-tip, .toast-host,
  .modal-mask, .sidebar, .block-list, .no-print { display: none !important; }
  .workspace { display: block !important; height: auto !important; overflow: visible !important; }
  .pane { display: block !important; border: none !important; overflow: visible !important; }
  .stage {
    display: block !important; padding: 0 !important; overflow: visible !important;
    background: #fff !important;
  }
  .paper-zoom { transform: none !important; }
  .paper {
    width: 210mm !important; box-shadow: none !important; margin: 0 !important;
    background-image: none !important;
  }
  .rb-doc { box-shadow: none !important; min-height: 0 !important; }
  .rb-doc.editing [data-block-id].is-active { box-shadow: none !important; background: none !important; }
  .rb-doc.editing .is-empty { outline: none !important; }
}

/* 小屏时三栏折叠 */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 320px minmax(0, 1fr) 320px; }
}
