html {
  scroll-behavior: smooth;
}

/* ──────────────────────────────────────────────
   Page layout
   ────────────────────────────────────────────── */
.page {
  padding: 32px 0 56px;
  display: grid;
  gap: 24px;
}

/* ──────────────────────────────────────────────
   Navbar overrides for index page
   ────────────────────────────────────────────── */
.navbar-inner {
  min-height: 64px;
}

.brand-lockup {
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #7C3AED 100%);
  box-shadow: none;
}

.brand-kicker {
  margin: 0 0 2px;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
}

.brand-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.navbar-actions {
  gap: 8px;
}

.user-chip {
  max-width: 200px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.8125rem;
}

/* ──────────────────────────────────────────────
   Cards & Panels
   ────────────────────────────────────────────── */
.card,
.panel,
.modal-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-resting);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* ──────────────────────────────────────────────
   Hero — left accent stripe
   ────────────────────────────────────────────── */
.hero {
  border-radius: var(--radius-md);
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 32px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--panel);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 14px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 600;
}

.hero h2,
.panel-head h2,
.modal-head h2 {
  margin: 0;
}

.panel-head h2 {
  font-size: clamp(2rem, 2.4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.hero h2 {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  line-height: 1.2;
  font-weight: 700;
  max-width: 16ch;
  color: var(--text);
}

.hero-text {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.hero-actions,
.resume-toolbar,
.resume-footer,
.composer-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-aside {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: end;
}

/* ──────────────────────────────────────────────
   Stat cards — accent left border
   ────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  transition: box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.stat-card-wide {
  grid-column: 1 / -1;
}

.stat-value {
  display: block;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.stat-label {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ──────────────────────────────────────────────
   Workspace & Editor
   ────────────────────────────────────────────── */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 24px;
}

#mainWorkspaceGrid {
  grid-template-columns: 1fr;
}

.editor-page {
  border-radius: var(--radius-md);
  padding: 24px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.editor-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ──────────────────────────────────────────────
   Panels
   ────────────────────────────────────────────── */
.panel {
  border-radius: var(--radius-md);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.panel:hover {
  box-shadow: var(--shadow-card-hover);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-head h2 {
  font-size: clamp(1.55rem, 2vw, 1.9rem);
  font-weight: 700;
  margin: 0;
  color: var(--text);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.panel-note,
.hint-text,
.form-note {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ──────────────────────────────────────────────
   Empty state
   ────────────────────────────────────────────── */
.empty-state {
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--bg);
  border: 1px dashed var(--border-muted);
  color: var(--text-muted);
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 0.9375rem;
}

.empty-state p {
  margin: 0 0 12px;
  line-height: 1.6;
}

/* ──────────────────────────────────────────────
   Feed lock
   ────────────────────────────────────────────── */
.feed-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
  background: var(--accent-subtle);
  border: 1px solid rgba(79, 70, 229, 0.15);
}

.feed-lock[hidden] {
  display: none !important;
}

.resume-gate[hidden] {
  display: none !important;
}

.feed-lock h3 {
  margin: 0 0 2px;
  font-size: 0.9375rem;
}

.feed-lock p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ──────────────────────────────────────────────
   Composer (experience editor form)
   ────────────────────────────────────────────── */
.composer {
  display: grid;
  gap: 16px;
  border-radius: var(--radius-md);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.composer input,
.composer textarea,
.modal-form input,
.modal-form textarea {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 9px 16px;
  font: inherit;
  min-height: 42px;
  line-height: 22px;
}

.composer input {
  font-size: 0.9375rem;
  font-weight: 600;
}

.experience-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.experience-meta-grid input {
  font-size: 0.9375rem;
  font-weight: 500;
}

.month-field {
  display: grid;
  gap: 4px;
}

.month-field span {
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
}

.month-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.month-picker select {
  width: 100%;
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 9px 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
}

.composer textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.composer input:focus,
.composer textarea:focus,
.modal-form input:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.composer-actions,
.resume-footer {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ──────────────────────────────────────────────
   Feed list & Story cards
   ────────────────────────────────────────────── */
.feed-list {
  display: grid;
  gap: 14px;
}

.story-card {
  position: relative;
  border-radius: var(--radius-md);
  padding: 28px 24px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.story-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
  background: var(--accent);
}

.story-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.story-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.story-head h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.story-head span {
  white-space: nowrap;
  color: var(--text-subtle);
  font-size: 0.95rem;
}

.story-meta {
  margin-top: 8px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}

.story-body {
  margin: 14px 0 20px;
  color: var(--text-secondary, #5f5f5f);
  line-height: 1.85;
  white-space: pre-wrap;
  font-size: 1.03rem;
  letter-spacing: 0.01em;
}

.story-actions {
  display: flex;
  justify-content: flex-end;
}

/* ──────────────────────────────────────────────
   Buttons (index overrides — unified outline→fill)
   ────────────────────────────────────────────── */
.btn {
  border-radius: var(--radius);
}

.btn-primary {
  background: var(--panel);
  color: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-cta {
  background: var(--panel);
  color: var(--cta);
  border-color: var(--cta);
}
.btn-cta:hover {
  background: var(--cta);
  color: #ffffff;
  border-color: var(--cta);
}

.btn-default {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}
.btn-default:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-small {
  padding: 4px 14px;
  font-size: 0.8125rem;
}

/* ──────────────────────────────────────────────
   Status (index overrides)
   ────────────────────────────────────────────── */
.status {
  min-height: 36px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
}

.status.info {
  background: var(--accent-subtle);
  color: #3730A3;
  border-color: #C7D2FE;
}

.status.success {
  background: var(--success-subtle);
  color: #065F46;
  border-color: #A7F3D0;
}

.status.error {
  background: var(--danger-subtle);
  color: #991B1B;
  border-color: #FECACA;
}

/* ──────────────────────────────────────────────
   Modal system
   ────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(1040px, 94vw);
  margin: 4vh auto;
  border-radius: var(--radius-lg);
  padding: 32px;
  z-index: 1;
  box-shadow: var(--shadow-overlay);
}

.auth-panel {
  width: min(760px, 94vw);
}

.resume-panel {
  width: min(1400px, 98vw);
  max-height: calc(100vh - 6vh);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

/* ──────────────────────────────────────────────
   Tabs — bolder underline
   ────────────────────────────────────────────── */
.tab-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.tab {
  border: 0;
  background: transparent;
  padding: 10px 20px;
  border-radius: 0;
  font-weight: 500;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
  background: transparent;
  box-shadow: none;
}

.tab:hover {
  color: var(--text);
}

/* ──────────────────────────────────────────────
   Modal form
   ────────────────────────────────────────────── */
.modal-form {
  display: grid;
  gap: 14px;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
}

.profile-avatar-preview {
  width: 25mm;
  height: 35mm;
  flex: 0 0 25mm;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-muted);
  background: var(--panel);
  color: var(--text-subtle);
  font-size: 0.8125rem;
  overflow: hidden;
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-preview.has-image {
  border-style: solid;
}

.profile-avatar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.avatar-file-input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  padding: 0 !important;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0 !important;
}

.avatar-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.field label {
  display: block;
  margin: 0 0 5px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.modal-actions {
  justify-content: flex-end;
}

/* ──────────────────────────────────────────────
   Resume gate
   ────────────────────────────────────────────── */
.resume-gate {
  display: grid;
  gap: 12px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px dashed var(--border-muted);
}

.resume-gate h3 {
  margin: 0;
}

.resume-gate p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.resume-toolbar {
  margin-bottom: 14px;
}

/* ──────────────────────────────────────────────
   Resume template section
   ────────────────────────────────────────────── */
.resume-template-section {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: none;
}

.resume-template-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.resume-template-head h3 {
  margin: 2px 0 0;
  font-size: 0.9375rem;
  color: var(--text);
}

.template-selected-label {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid rgba(79, 70, 229, 0.15);
  font-size: 0.75rem;
  font-weight: 600;
}

.resume-template-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* ── Template cards (.tcard) ── */

.tcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 238px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  position: relative;
  box-shadow: none;
}

.tcard:hover {
  transform: translateY(-2px);
}

.tcard::before {
  content: "";
  position: absolute;
  inset: 10px 10px auto;
  height: 3px;
  border-radius: 999px;
  background: var(--template-card-accent);
}

.tcard-paper {
  height: 132px;
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.tcard-hero {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--template-card-accent) 10%, var(--panel));
}

.tcard-photo {
  width: 22px;
  height: 30px;
  border-radius: 3px;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--template-card-accent) 38%, var(--panel));
}

.tcard-id,
.tcard-section {
  display: grid;
  gap: 5px;
}

.tcard-id span,
.tcard-section b,
.tcard-section i,
.tcard-section p {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--template-card-accent) 70%, var(--panel));
}

.tcard-id span:first-child {
  width: 48%;
  height: 8px;
}

.tcard-id span:nth-child(2) { width: 72%; }
.tcard-id span:nth-child(3) { width: 58%; }

.tcard-section {
  position: relative;
  margin-top: 10px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--panel);
  border-left: 3px solid var(--template-card-accent);
}

.tcard-section b {
  width: 34%;
  height: 6px;
}

.tcard-section i {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 26%;
  background: var(--text-subtle);
}

.tcard-section p {
  width: 88%;
  background: var(--border);
}

.tcard-section-main p:last-child {
  width: 70%;
}

.tcard-project .tcard-paper {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 8px;
}

.tcard-project .tcard-hero {
  grid-column: 1 / -1;
  background: var(--template-card-accent);
}

.tcard-project .tcard-id span {
  background: #ffffff;
}

.tcard-project .tcard-section-main {
  grid-column: 2;
  grid-row: 2 / span 2;
}

.tcard-campus .tcard-section {
  border-left-color: color-mix(in srgb, var(--template-card-accent) 32%, var(--panel));
  background: transparent;
}

.tcard-academic .tcard-hero,
.tcard-academic .tcard-section {
  background: var(--panel);
  border-radius: 0;
  border-left: 0;
  border-bottom: 1px solid var(--border);
}

.tcard:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-floating);
}

.tcard-on,
.tcard-on:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  transform: none;
}

.tcard-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.tcard-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.template-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.template-card:hover {
  transform: translateY(-2px);
}

.template-card:hover,
.template-card.active {
  border-color: var(--accent);
  box-shadow: var(--shadow-floating);
}

.template-card.active {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  background: var(--accent-subtle);
}

.template-card .template-swatch {
  display: none;
}

.template-card-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-card-copy strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.template-card-copy span {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ── Template color indicator ── */

.template-card::before {
  content: "";
  display: block;
  height: 3px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.template-classic::before { background: #1f4e79; }
.template-project::before { background: #17365d; }
.template-campus::before  { background: #2f6f4e; }
.template-academic::before { background: #7a1f1f; }

/* ──────────────────────────────────────────────
   Template preview document variables
   ────────────────────────────────────────────── */
.template-project .template-swatch,
.preview-document.template-project {
  --template-accent: #17365d;
  --template-soft: #dceafa;
  --template-line: #9fb8d5;
  --doc-padding: 38px 42px;
  --header-bg: var(--template-accent);
  --header-color: #ffffff;
  --header-justify: flex-start;
  --header-align: left;
  --header-margin: -38px -42px 26px;
  --header-padding: 26px 42px;
  --header-radius: 0;
  --avatar-shadow: 0 0 0 2px rgba(255, 255, 255, 0.56);
  --body-columns: minmax(170px, 0.72fr) minmax(0, 1.28fr);
  --body-gap: 22px;
  --projects-column: 2;
  --projects-row: 1 / span 2;
  --side-column: 1;
  --section-padding-left: 0;
  --section-border-left: 0;
  --item-bg: #ffffff;
}

.template-campus .template-swatch,
.preview-document.template-campus {
  --template-accent: #2f6f4e;
  --template-soft: #eef7f2;
  --template-line: #a7d4b9;
  --doc-bg: linear-gradient(180deg, var(--template-soft) 0, #ffffff 210px);
  --header-bg: transparent;
  --header-justify: flex-start;
  --header-align: left;
  --header-padding: 0 0 18px;
  --header-radius: 0;
  --header-border-bottom: 2px solid var(--template-line);
  --section-padding-left: 18px;
  --section-border-left: 2px solid var(--template-line);
  --item-position: relative;
  --item-bg: transparent;
  --item-border: 0;
  --item-border-left: 0;
  --item-radius: 0;
  --item-padding: 4px 0 4px 12px;
  --item-dot-display: block;
}

.template-academic .template-swatch,
.preview-document.template-academic {
  --template-accent: #111827;
  --template-soft: #f7f4ef;
  --template-line: #c9bda9;
  --template-font: Georgia, "Times New Roman", "Noto Serif SC", SimSun, serif;
  --header-bg: transparent;
  --header-justify: space-between;
  --header-direction: row-reverse;
  --header-align: left;
  --header-padding: 0 0 16px;
  --header-radius: 0;
  --header-border-bottom: 1px solid #111827;
  --avatar-border: 1px solid #111827;
  --avatar-shadow: none;
  --name-size: 1.72rem;
  --name-transform: uppercase;
  --section-padding-left: 0;
  --section-border-left: 0;
  --section-title-color: #111827;
  --section-title-border: 1px solid #111827;
  --section-title-size: 0.86rem;
  --section-title-spacing: 0.08em;
  --section-title-transform: uppercase;
  --item-bg: transparent;
  --item-border: 0;
  --item-border-left: 0;
  --item-border-bottom: 1px solid #e5e7eb;
  --item-radius: 0;
  --item-padding: 0 0 8px;
}

.template-classic .template-swatch,
.preview-document.template-classic {
  --template-accent: #1f4e79;
  --template-soft: #edf4fb;
  --template-line: #b6cce1;
  --header-radius: 6px;
}

/* ──────────────────────────────────────────────
   Resume layout
   ────────────────────────────────────────────── */
.resume-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
}

.resume-editor-wrap textarea {
  min-height: 420px;
  max-height: 60vh;
  overflow-y: auto;
  resize: vertical;
  line-height: 1.6;
}

.resume-preview {
  min-height: 420px;
  max-height: 58vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 18px;
  overflow: auto;
  scrollbar-gutter: stable;
}

/* ──────────────────────────────────────────────
   Preview document
   ────────────────────────────────────────────── */
.preview-document {
  --template-accent: #1f4e79;
  --template-soft: #edf4fb;
  --template-line: #b6cce1;
  --template-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --doc-padding: 44px 48px;
  --doc-bg: #ffffff;
  --header-bg: var(--template-soft);
  --header-color: var(--template-accent);
  --header-justify: center;
  --header-direction: row;
  --header-align: center;
  --header-margin: 0 0 26px;
  --header-padding: 22px;
  --header-radius: 6px;
  --header-border-bottom: 0;
  --avatar-border: 3px solid #ffffff;
  --avatar-shadow: 0 0 0 2px var(--template-line);
  --name-size: 1.9rem;
  --name-transform: none;
  --body-columns: 1fr;
  --body-gap: 18px;
  --projects-column: auto;
  --projects-row: auto;
  --side-column: auto;
  --section-padding-left: 14px;
  --section-border-left: 4px solid var(--template-line);
  --section-title-color: var(--template-accent);
  --section-title-border: 1px solid var(--template-line);
  --section-title-size: 1rem;
  --section-title-spacing: 0;
  --section-title-transform: none;
  --item-position: static;
  --item-padding: 12px 14px;
  --item-border: 1px solid var(--template-line);
  --item-border-left: 4px solid var(--template-accent);
  --item-border-bottom: 0;
  --item-radius: 6px;
  --item-bg: var(--template-soft);
  --item-dot-display: none;
  width: min(100%, 900px);
  min-height: 860px;
  margin: 0 auto;
  color: #1f2328;
  font-family: var(--template-font);
  line-height: 1.5;
  padding: var(--doc-padding);
  border-radius: var(--radius-sm);
  background: var(--doc-bg);
  box-shadow: var(--shadow-floating);
}

.resume-doc-header {
  display: flex;
  align-items: center;
  justify-content: var(--header-justify);
  flex-direction: var(--header-direction);
  gap: 18px;
  margin: var(--header-margin);
  padding: var(--header-padding);
  border: 0;
  border-bottom: var(--header-border-bottom);
  border-radius: var(--header-radius);
  background: var(--header-bg);
  text-align: var(--header-align);
}

.resume-doc-identity {
  min-width: 0;
}

.resume-doc-avatar {
  width: 25mm;
  height: 35mm;
  flex: 0 0 25mm;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: var(--avatar-border);
  box-shadow: var(--avatar-shadow);
}

.resume-doc-header h2 {
  margin: 0;
  font-size: var(--name-size);
  line-height: 1.2;
  color: var(--header-color);
  text-transform: var(--name-transform);
}

.resume-doc-header p {
  margin: 6px 0 0;
  color: var(--header-color);
  font-family: var(--font-body);
  font-size: 0.875rem;
}

.resume-doc-body {
  display: grid;
  grid-template-columns: var(--body-columns);
  gap: var(--body-gap);
  align-items: start;
}

.resume-doc-section h3 {
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: var(--section-title-border);
  color: var(--section-title-color);
  font-size: var(--section-title-size);
  letter-spacing: var(--section-title-spacing);
  text-transform: var(--section-title-transform);
}

.resume-doc-items {
  display: grid;
  gap: 8px;
}

.resume-doc-items p {
  position: var(--item-position);
  margin: 0;
  padding: var(--item-padding);
  border: var(--item-border);
  border-left: var(--item-border-left);
  border-bottom: var(--item-border-bottom);
  border-radius: var(--item-radius);
  background: var(--item-bg);
  color: var(--text);
}

.resume-project-item {
  position: var(--item-position);
  margin: 0;
  padding: var(--item-padding);
  border: var(--item-border);
  border-left: var(--item-border-left);
  border-bottom: var(--item-border-bottom);
  border-radius: var(--item-radius);
  background: var(--item-bg);
  color: var(--text);
}

.resume-project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--section-title-color);
}

.resume-project-head strong {
  font-size: 0.875rem;
}

.resume-project-head span {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8125rem;
}

.resume-project-role {
  margin-top: 4px;
  color: var(--section-title-color);
  font-weight: 600;
}

.resume-project-item p {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.resume-doc-section {
  padding-left: var(--section-padding-left);
  border-left: var(--section-border-left);
}

.section-projects {
  grid-column: var(--projects-column);
  grid-row: var(--projects-row);
}

.section-education,
.section-skills {
  grid-column: var(--side-column);
}

.resume-doc-items p::before {
  content: "";
  display: var(--item-dot-display);
  position: absolute;
  left: -21px;
  top: 0.78em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--template-accent);
  box-shadow: 0 0 0 4px #ffffff;
}

.preview-gap {
  height: 14px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.modal-open {
  overflow: hidden;
}

.hint-text {
  color: var(--text-muted);
}

/* ──────────────────────────────────────────────
   Image Upload
   ────────────────────────────────────────────── */
.image-upload-area {
  position: relative;
  display: grid;
  gap: 14px;
}

.image-upload-label {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 100px;
  padding: 20px;
  border: 1px dashed rgba(79, 70, 229, 0.25);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text);
  font-size: 0;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.image-upload-label::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
}

.image-upload-label::after {
  content: "上传项目图片\A PNG / JPG / WebP · 最多 6 张 · 单张不超过 2MB";
  display: block;
  white-space: pre-line;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
  font-weight: 400;
}

.image-upload-label:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-floating);
}

.image-upload-area:has(.image-file-input:focus-visible) .image-upload-label {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.image-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 0;
}

.image-thumb {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  border: none;
  background: rgba(15,23,42,0.72);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.image-thumb-remove:hover {
  background: var(--danger);
}

/* ──────────────────────────────────────────────
   Feed image gallery
   ────────────────────────────────────────────── */
.story-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
}

.story-gallery-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.story-gallery-img:hover {
  transform: scale(1.05);
}

/* ──────────────────────────────────────────────
   Lightbox
   ────────────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15,23,42,0.8);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-overlay:not([hidden]) {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
}

/* ──────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────── */
@media (max-width: 1012px) {
  .hero,
  .workspace-grid,
  .resume-layout,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .resume-template-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .experience-meta-grid {
    grid-template-columns: 1fr;
  }

  .preview-document.template-project {
    --body-columns: 1fr;
    --projects-column: auto;
    --projects-row: auto;
    --side-column: auto;
  }

  .hero-aside {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card-wide {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  .navbar-inner,
  .panel-head,
  .composer-actions,
  .resume-footer,
  .resume-template-head,
  .profile-avatar-row,
  .modal-footer,
  .feed-lock,
  .story-head {
    flex-direction: column;
    align-items: stretch;
  }

  .navbar-inner {
    padding: 12px 0;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .hero,
  .panel,
  .modal-panel {
    padding: 20px;
    border-radius: var(--radius-md);
  }

  .hero h2 {
    max-width: none;
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .hero-aside {
    grid-template-columns: 1fr;
  }

  .btn,
  .tab,
  .icon-btn {
    width: 100%;
  }

  .navbar-actions {
    width: 100%;
  }

  .user-chip {
    width: 100%;
    max-width: none;
  }

  .story-head span {
    white-space: normal;
  }

  .resume-editor-wrap textarea,
  .resume-preview {
    min-height: 320px;
    max-height: 50vh;
  }

  .resume-preview {
    padding: 16px;
  }

  .preview-document {
    min-height: 660px;
    padding: 28px 24px;
  }

  .resume-doc-header {
    flex-direction: column;
    text-align: center;
  }

  .preview-document.template-project {
    --doc-padding: 28px 24px;
    --header-margin: -28px -24px 22px;
  }

  .preview-document.template-academic {
    --header-direction: column;
    --header-align: center;
  }

  .resume-template-grid {
    grid-template-columns: 1fr;
  }
}

/* ──────────────────────────────────────────────
   Animations
   ────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.anim-fade-in {
  animation: fadeInUp 0.4s ease both;
}

.anim-pulse {
  animation: pulse 1.8s ease-in-out infinite;
}

/* Apply staggered fade to feed items */
.story-card:nth-child(1) { animation-delay: 0.05s; }
.story-card:nth-child(2) { animation-delay: 0.1s; }
.story-card:nth-child(3) { animation-delay: 0.15s; }
.story-card:nth-child(4) { animation-delay: 0.2s; }
.story-card:nth-child(5) { animation-delay: 0.25s; }
