:root {
  --ink: #0b3b32;
  --deep: #073b31;
  --muted: #6d7d77;
  --line: #d7e1da;
  --paper: #fffefa;
  --canvas: #f2f4ed;
  --lime: #d8f64c;
  --shadow: 0 22px 55px rgba(22, 49, 39, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.editor-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 64px);
  background: rgba(255, 254, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.editor-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.editor-brand img { width: 40px; height: 40px; padding: 7px; background: var(--deep); border-radius: 12px; }
.editor-brand span { display: grid; gap: 2px; }
.editor-brand strong { font-size: 16px; }
.editor-brand small { color: var(--muted); font-size: 11px; }
.editor-top-actions { display: flex; align-items: center; gap: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 7px;
  padding: 0 16px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.button svg { width: 17px; }
.button.primary { color: white; background: var(--deep); border-color: var(--deep); }
.button.primary:hover { color: var(--deep); background: var(--lime); border-color: var(--lime); }
.button.secondary:hover { background: #f6f9f3; }
.save-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.save-state svg { width: 15px; }
.save-state.dirty { color: #9a5b18; }

.editor-shell { width: min(1480px, calc(100% - 36px)); margin: 0 auto; padding: 44px 0 70px; }
.editor-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 30px; }
.editor-intro p { margin: 0 0 9px; color: #16816c; font-size: 13px; font-weight: 800; letter-spacing: 0.12em; }
.editor-intro h1 { max-width: 800px; margin: 0; color: var(--ink); font-family: Georgia, "Songti SC", serif; font-size: clamp(28px, 3vw, 46px); line-height: 1.15; }
.editor-intro > span { color: var(--muted); font-size: 13px; }
.editor-layout { display: grid; grid-template-columns: minmax(520px, 0.86fr) minmax(560px, 1.14fr); gap: 28px; align-items: start; }
.resume-fields { display: grid; gap: 16px; }
.field-section { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 25px rgba(26, 55, 44, 0.04); }
.field-section-title { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 20px 22px; color: var(--ink); background: transparent; border: 0; cursor: pointer; }
.field-section-title > span { display: flex; align-items: center; gap: 13px; text-align: left; }
.field-section-title b { display: grid; place-items: center; width: 38px; height: 38px; color: var(--deep); background: var(--lime); border-radius: 11px; font-size: 12px; }
.field-section-title i { display: grid; gap: 3px; font-style: normal; }
.field-section-title strong { font-size: 17px; }
.field-section-title small { color: var(--muted); font-size: 11px; font-weight: 600; }
.field-section-title > svg { width: 18px; transition: transform 180ms ease; }
.field-section:not(.open) .field-section-title > svg { transform: rotate(-90deg); }
.field-section:not(.open) .field-section-body { display: none; }
.field-section-body { padding: 0 22px 24px; border-top: 1px solid #edf1ed; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding-top: 20px; }
.field-grid .wide { grid-column: 1 / -1; }
.repeater-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 0 13px; }
.repeater-heading > div { display: grid; gap: 4px; }
.repeater-heading strong { color: var(--ink); font-size: 14px; }
.repeater-heading small { color: var(--muted); font-size: 11px; }
.button.compact { min-height: 36px; padding: 0 12px; font-size: 12px; }
.entry-list { display: grid; gap: 13px; }
.repeat-entry { padding: 16px; background: #f8faf6; border: 1px solid #dbe5dc; border-radius: 14px; }
.repeat-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid #e3eae3; }
.repeat-entry-head > span { display: grid; gap: 2px; }
.repeat-entry-head b { color: var(--ink); font-size: 13px; }
.repeat-entry-head small { color: var(--muted); font-size: 10px; }
.entry-remove { display: inline-flex; align-items: center; gap: 5px; color: #9c4c3d; background: transparent; border: 0; font-size: 11px; font-weight: 750; cursor: pointer; }
.entry-remove svg { width: 14px; }
.entry-remove:disabled { opacity: .35; cursor: not-allowed; }
.repeat-entry-grid { padding-top: 14px; }
.advantage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.language-heading { margin-top: 4px; padding-top: 16px; border-top: 1px solid #edf1ed; }
.language-entry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 14px; }
.entry-empty { display: flex; align-items: center; gap: 12px; padding: 16px; color: var(--muted); background: #f8faf6; border: 1px dashed #becdc3; border-radius: 13px; }
.entry-empty > svg { width: 22px; color: #2a806d; }
.entry-empty > span { display: grid; gap: 3px; }
.entry-empty strong { color: var(--ink); font-size: 12px; }
.entry-empty small { font-size: 10px; }
label { display: grid; gap: 7px; color: #4f625b; font-size: 12px; font-weight: 750; }
input, textarea { width: 100%; color: #173b33; background: #fbfcf9; border: 1px solid #d6e1da; border-radius: 11px; outline: none; }
input { height: 46px; padding: 0 13px; }
textarea { min-height: 98px; padding: 12px 13px; line-height: 1.72; resize: vertical; }
input:focus, textarea:focus { background: white; border-color: #2a806d; box-shadow: 0 0 0 3px rgba(42, 128, 109, 0.12); }
.content-fields { display: grid; gap: 16px; padding-top: 20px; }
.photo-row { display: flex; align-items: center; gap: 14px; padding-top: 20px; }
.photo-upload { display: grid; grid-template-columns: 62px auto; grid-template-rows: auto auto; align-items: center; column-gap: 13px; cursor: pointer; }
.photo-upload > span { grid-row: 1 / 3; display: grid; place-items: center; width: 62px; height: 78px; overflow: hidden; color: #71817b; background: #edf2ed; border: 1px dashed #a8bdb3; border-radius: 9px; }
.photo-upload img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload b { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; }
.photo-upload b svg { width: 16px; }
.photo-upload small { color: var(--muted); font-size: 10px; font-weight: 600; }
.text-button { margin-left: auto; color: #a44d3d; background: transparent; border: 0; font-size: 12px; font-weight: 750; cursor: pointer; }

.preview-column { min-width: 0; }
.preview-sticky { position: sticky; top: 100px; }
.preview-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.preview-heading span { display: grid; gap: 3px; }
.preview-heading small { color: #16816c; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; }
.preview-heading strong { font-size: 19px; }
.preview-heading em { color: var(--muted); font-size: 11px; font-style: normal; }
.resume-sheet { width: 100%; min-height: 850px; padding: clamp(34px, 5vw, 64px); color: #25333d; background: white; border: 1px solid #dbe2df; box-shadow: var(--shadow); }
.sheet-eyebrow { margin: 0 0 21px; color: #7d878e; font: 700 12px/1 Georgia, serif; letter-spacing: 0.24em; text-transform: uppercase; }
.sheet-head { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 25px; align-items: start; padding-bottom: 22px; border-bottom: 3px solid #26363c; }
.sheet-head h2 { margin: 0 0 8px; color: #1d2b33; font-size: 36px; }
.sheet-head > div > p { margin: 0 0 14px; color: #364940; font-size: 17px; }
.sheet-contact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; font-size: 11px; line-height: 1.55; }
.sheet-contact span { overflow-wrap: anywhere; }
.sheet-photo { display: grid; place-items: center; width: 96px; height: 120px; overflow: hidden; color: #687972; background: #edf3ef; border: 1px solid #d5e1da; font-weight: 800; }
.sheet-photo img { width: 100%; height: 100%; object-fit: cover; }
.sheet-body section { padding-top: 21px; }
.sheet-body h3 { margin: 0 0 11px; padding-bottom: 7px; color: var(--deep); border-bottom: 1px solid #bcc9c5; font-size: 17px; }
.sheet-body p { position: relative; margin: 0 0 7px; padding-left: 14px; font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.sheet-body p::before { content: "•"; position: absolute; left: 0; color: #1f6758; }
.sheet-placeholder { color: #99a49f; }
.auth-notice { align-items: center; gap: 14px; margin-bottom: 22px; padding: 16px; background: #fff8df; border: 1px solid #eadca3; border-radius: 14px; }
.auth-notice:not([hidden]) { display: flex; }
.auth-notice > svg { width: 24px; }
.auth-notice div { flex: 1; }
.auth-notice p { margin: 4px 0 0; color: #766a48; font-size: 12px; }
.editor-toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: 340px; padding: 13px 17px; color: white; background: var(--deep); border-radius: 12px; box-shadow: 0 15px 35px rgba(7, 59, 49, 0.25); opacity: 0; transform: translateY(10px); pointer-events: none; transition: 180ms ease; }
.editor-toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: 1fr; }
  .preview-sticky { position: static; }
  .preview-column { order: -1; }
  .resume-sheet { max-width: 800px; margin: 0 auto; }
}
@media (max-width: 680px) {
  .editor-topbar { align-items: flex-start; padding: 10px 14px; }
  .editor-brand small, .save-state, .button.secondary { display: none; }
  .editor-top-actions { margin-left: 8px; }
  .editor-shell { width: min(100% - 22px, 1480px); padding-top: 26px; }
  .editor-intro { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .editor-intro h1 { font-size: 29px; }
  .editor-intro > span { display: none; }
  .preview-heading em { display: none; }
  .resume-sheet { min-height: 0; padding: 25px 20px; }
  .sheet-head { grid-template-columns: 1fr 64px; gap: 12px; }
  .sheet-head h2 { font-size: 28px; }
  .sheet-photo { width: 64px; height: 82px; }
  .sheet-contact, .field-grid, .advantage-grid, .language-entry-grid { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
  .field-section-title, .field-section-body { padding-left: 16px; padding-right: 16px; }
  .photo-upload { grid-template-columns: 54px auto; }
  .photo-upload > span { width: 54px; height: 68px; }
  .repeater-heading { align-items: flex-start; flex-direction: column; }
  .repeater-heading .button { width: 100%; }
}
