.profile-page { padding-bottom: 80px; }
.profile-hero { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(260px,.65fr); gap: 36px; align-items: end; padding: 54px 0 34px; border-bottom: 1px solid var(--line-strong); }
.profile-hero h1 { max-width: 850px; margin: 0; font: 600 clamp(38px,5vw,68px)/1.12 var(--display); letter-spacing: -.035em; }
.profile-hero p { max-width: 760px; margin: 20px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; }
.profile-hero aside { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--brand-line); border-top: 3px solid var(--brand); background: var(--brand-soft); }
.profile-hero aside strong { font-size: 14px; }
.profile-hero aside span { color: var(--muted); font-size: 12px; line-height: 1.7; }

.profile-intake { margin-top: 28px; padding: 26px; border: 1px solid var(--line-strong); background: var(--card); }
.profile-intake-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.profile-intake h2,.profile-toolbar h2 { margin: 0 0 6px; font: 600 26px/1.3 var(--display); }
.profile-intake-heading p { max-width: 650px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.profile-start-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 20px; }
.profile-start-card { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 14px 18px; align-items: start; min-height: 210px; padding: 22px; border: 1px solid var(--line); background: var(--paper-deep); transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.profile-start-card:hover { transform: translateY(-2px); border-color: var(--brand-line); box-shadow: var(--shadow); }
.profile-start-number { color: var(--accent-seal); font: 700 11px/1 var(--mono); }
.profile-start-card h3 { margin: -5px 0 8px; font: 600 22px/1.3 var(--display); }
.profile-start-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.profile-start-card > button { grid-column: 2; justify-self: start; align-self: end; min-width: 170px; }
.profile-file { grid-column: 2; display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 42px; padding: 0 16px; border: 1px dashed var(--line-strong); border-radius: 3px; background: var(--card); color: var(--ink); font-size: 14px; cursor: pointer; }
.profile-file:hover { border-color: var(--brand); color: var(--brand); }
.profile-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.profile-file-name { grid-column: 2; overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-status { margin: 18px 0 0; padding: 12px 14px; border-left: 3px solid var(--line-strong); background: var(--paper-deep); color: var(--muted); font-size: 14px; line-height: 1.65; transition: background .2s ease, border-color .2s ease; }
.profile-status.selected { border-left-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.profile-status.working { border-left-color: var(--warning); color: var(--ink); }
.profile-status.ok { border-left-color: var(--success); color: var(--success); }
.profile-status.ok.strong { padding: 16px 18px; border: 1px solid var(--brand-line); border-left: 5px solid var(--success); background: linear-gradient(100deg,var(--brand-soft),var(--card)); color: var(--brand-strong); font-size: 13px; font-weight: 650; }
.profile-status.error { border-left-color: var(--danger); color: var(--danger); }

.profile-workspace { margin-top: 26px; border: 1px solid var(--line-strong); background: var(--card); box-shadow: var(--shadow); }
.profile-toolbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); background: var(--paper-deep); }
.profile-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }
.profile-toolbar .profile-kicker { margin-bottom: 7px; color: var(--brand); font: 700 12px/1 var(--mono); letter-spacing: .1em; }
.profile-toolbar > div:last-child { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.profile-library-layout { display: grid; grid-template-columns: 248px minmax(0,1fr); align-items: start; }
.profile-library-rail { position: sticky; top: 16px; display: grid; gap: 26px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px 16px; border-right: 1px solid var(--line); background: var(--paper-deep); scrollbar-width: thin; }
.profile-rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.profile-rail-heading h3 { margin: 0; font: 700 15px/1.3 var(--sans); }
.profile-rail-heading span { display: grid; place-items: center; min-width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 700 10px/1 var(--mono); }
.profile-version-group + .profile-version-group { margin-top: 15px; }
.profile-version-group h4 { margin: 0 0 7px; color: var(--muted); font: 700 12px/1.4 var(--sans); }
.profile-version-button { display: grid; gap: 3px; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid transparent; border-left: 3px solid transparent; background: transparent; text-align: left; cursor: pointer; }
.profile-version-button strong { overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.profile-version-button span { color: var(--muted); font-size: 12px; }
.profile-version-button:hover { border-color: var(--line); background: var(--card); }
.profile-version-button.is-active { border-color: var(--brand-line); border-left-color: var(--brand); background: var(--brand-soft); }
.profile-section-index { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.profile-section-index button { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 6px; align-items: center; width: 100%; min-height: 40px; padding: 7px 8px; overflow: hidden; border: 0; background: transparent; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer; }
.profile-section-index button span { color: var(--accent-seal); font: 700 11px/1 var(--mono); }
.profile-section-index button:hover,.profile-section-index button:focus-visible { background: var(--card); color: var(--brand); }
.profile-rail-empty { color: var(--muted); font-size: 11px; }
.profile-editor-panel { min-width: 0; }
.profile-identity { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin: 18px 20px 0; padding: 17px 18px; border: 1px solid var(--brand-line); background: var(--brand-soft); }
.profile-identity > div { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.profile-identity label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.profile-identity input { min-width: 220px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
.profile-identity > p { max-width: 390px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.profile-identity > div > span { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.profile-identity h3 { margin: 0; font: 600 23px/1.2 var(--display); }
.profile-identity > div > p { margin: 0; color: var(--brand); font-size: 13px; }
.profile-saved-badge { padding: 10px 13px; border: 1px solid var(--brand-line); background: var(--card); color: var(--brand); font-size: 13px; }
.profile-copy-note { margin: 0; padding: 14px 20px; color: var(--ink); border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.6; }
.profile-copy-note.is-warning { background: var(--warning-soft); color: var(--warning); }
.profile-blocks { display: grid; gap: 12px; padding: 18px 20px 24px; }
.profile-block { position: relative; display: grid; grid-template-columns: 42px minmax(0,1fr); border: 1px solid var(--line); background: #fff; scroll-margin: 90px; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.profile-block-order { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 6px; border-right: 1px solid var(--line); background: var(--paper-deep); }
.profile-block-order span { color: var(--accent-seal); font: 700 10px/1 var(--mono); }
.profile-block-order button { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.profile-block-order button:hover { color: var(--brand); }
.profile-block-body { min-width: 0; padding: 15px; }
.profile-block-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.profile-block-head { flex-wrap: wrap; }
.profile-block-head h3 { flex: 1; min-width: 220px; margin: 0; font: 600 22px/1.3 var(--display); }
.profile-block-title { flex: 1; min-width: 240px; padding: 10px 12px; border: 1px solid var(--line); background: var(--paper-deep); font: 600 19px/1.3 var(--display); }
.profile-block-head button { min-height: 40px; padding: 0 13px; border: 1px solid var(--line-strong); background: var(--card); font-size: 13px; cursor: pointer; }
.profile-block-head .profile-add-entry { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; }
.profile-completion { margin-left: auto; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.profile-entry-list { display: grid; gap: 12px; }
.profile-entry-editor { padding: 13px; border: 1px solid var(--line); background: var(--paper-deep); }
.profile-entry-editor > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 9px; }
.profile-entry-editor > header strong { color: var(--brand-strong); font-size: 14px; }
.profile-entry-editor > header label { display: grid; flex: 1; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-item-title { width: min(440px,100%); min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; }
.profile-item-title[readonly] { border-color: transparent; background: transparent; padding-left: 0; }
.profile-entry-editor > header button { min-height: 34px; padding: 0 10px; border: 1px solid #e3b6af; background: var(--card); color: var(--danger); font-size: 12px; cursor: pointer; }
.profile-block textarea { width: 100%; min-height: 126px; resize: vertical; padding: 13px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); font: 15px/1.75 var(--sans); }
.profile-structured-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.profile-structured-field { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.profile-structured-field input,.profile-structured-field textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 2px; background: var(--card); color: var(--ink); font: 14px/1.55 var(--sans); }
.profile-structured-field textarea { min-height: 88px; resize: vertical; }
.profile-date-field { align-content: start; }
.profile-date-control { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; }
.profile-date-control input[type="date"],.profile-date-control input[type="month"] { color-scheme: light; cursor: pointer; }
.profile-date-present { display: inline-flex; align-items: center; gap: 5px; min-height: 42px; padding: 0 9px; border: 1px solid var(--line); border-radius: 2px; background: var(--soft); color: var(--ink); white-space: nowrap; font-size: 13px; font-weight: 650; }
.profile-date-present input { width: 16px; min-height: 16px; height: 16px; margin: 0; padding: 0; }
.profile-date-warning { color: var(--warning); font-size: 12px; line-height: 1.5; }
.profile-custom-fields { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.profile-custom-fields-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.profile-custom-fields-head strong { color: var(--muted); font-size: 13px; }
.profile-custom-fields button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--card); color: var(--brand); cursor: pointer; }
.profile-custom-field { display: grid; grid-template-columns: minmax(140px,.4fr) minmax(0,1fr) auto; gap: 8px; margin-top: 8px; }
.profile-custom-field input { min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); background: var(--card); }
.profile-custom-field button { color: var(--danger); }
.profile-block input:focus,.profile-block textarea:focus,.profile-block-title:focus { outline: 2px solid var(--brand-line); outline-offset: 2px; }
.profile-block-preview { display: grid; gap: 12px; min-height: 68px; color: var(--ink); font-size: 15px; line-height: 1.8; }
.profile-preview-item { padding-top: 10px; border-top: 1px dashed var(--line); }
.profile-preview-item:first-child { padding-top: 0; border-top: 0; }
.profile-preview-item strong { display: block; margin-bottom: 4px; color: var(--brand); font-size: 13px; }
.profile-preview-item p { margin: 0; white-space: pre-wrap; }
.profile-field-preview { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 18px; margin: 0; }
.profile-field-preview div { display: grid; grid-template-columns: minmax(90px,.42fr) minmax(0,1fr); gap: 9px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.profile-field-preview dt { color: var(--muted); font-size: 13px; }
.profile-field-preview dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.profile-card-copy-hint { padding: 7px 10px; border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; font-weight: 700; }
.profile-block.is-copyable { cursor: pointer; }
.profile-block.is-copyable::after { content: "点击即可复制全部内容"; position: absolute; right: 18px; bottom: 16px; padding: 9px 13px; border: 1px solid var(--brand-line); border-radius: 2px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; opacity: 0; transform: translateY(5px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.profile-block.is-copyable:hover,.profile-block.is-copyable:focus-visible { border-color: var(--brand); box-shadow: 0 10px 24px rgba(19,91,69,.1); transform: translateY(-1px); outline: none; }
.profile-block.is-copyable:hover::after,.profile-block.is-copyable:focus-visible::after { opacity: 1; transform: translateY(0); }
.profile-block.did-copy { border-color: var(--success); background: var(--brand-soft); }

@media(max-width:1050px){
  .profile-library-layout { grid-template-columns: 210px minmax(0,1fr); }
  .profile-toolbar { align-items: flex-start; flex-direction: column; }
  .profile-toolbar > div:last-child { justify-content: flex-start; }
}
@media(max-width:820px){
  .profile-hero { grid-template-columns: 1fr; }
  .profile-start-options { grid-template-columns: 1fr; }
  .profile-intake-heading { align-items: flex-start; flex-direction: column; }
  .profile-library-layout { grid-template-columns: 1fr; }
  .profile-library-rail { position: static; display: grid; grid-template-columns: 1fr 1fr; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-section-index { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-identity { align-items: flex-start; flex-direction: column; }
  .profile-structured-grid,.profile-field-preview { grid-template-columns: 1fr; }
}
@media(max-width:560px){
  .profile-hero { padding-top: 32px; }
  .profile-hero h1 { font-size: 38px; }
  .profile-intake { padding: 16px; }
  .profile-start-card { grid-template-columns: 28px minmax(0,1fr); padding: 17px 14px; }
  .profile-start-card > button,.profile-file,.profile-file-name { grid-column: 1/-1; width: 100%; }
  .profile-library-rail { grid-template-columns: 1fr; }
  .profile-toolbar { padding: 18px 16px; }
  .profile-toolbar > div:last-child { width: 100%; }
  .profile-toolbar button { flex: 1 1 44%; }
  .profile-identity { margin: 14px; padding: 14px; }
  .profile-identity > div { width: 100%; }
  .profile-identity label,.profile-identity input { width: 100%; min-width: 0; }
  .profile-blocks { padding: 14px; }
  .profile-block { grid-template-columns: 36px minmax(0,1fr); }
  .profile-block-head { align-items: stretch; flex-wrap: wrap; }
  .profile-block-title,.profile-block-head h3 { flex-basis: 100%; }
  .profile-completion { margin-left: 0; }
  .profile-custom-field { grid-template-columns: 1fr; }
}
@media(prefers-reduced-motion:reduce){.profile-start-card,.profile-block,.profile-block.is-copyable::after{transition:none}.profile-start-card:hover,.profile-block.is-copyable:hover{transform:none}}
.profile-version-actions {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line, #e5e1d9);
}
.profile-version-actions .secondary-button { width: 100%; min-height: 40px; }
.profile-version-actions small { color: var(--muted, #716d65); font-size: 11px; line-height: 1.5; }
.profile-toolbar [hidden] { display: none !important; }
.profile-block-head > button,
.profile-block-head [data-edit-block] { min-height: 32px; }
