:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1a1a18;
  background: #f3f1ed;
  font-synthesis: none;
  --background: #f3f1ed;
  --surface: #fff;
  --border: #e8e6e1;
  --field: #fcfbf8;
  --field-border: #ddd9d0;
  --field-placeholder: #8d887e;
  --text: #1a1a18;
  --muted: #6b6963;
  --primary: #2c3e50;
  --primary-soft: #2c3e5012;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); }
.page { min-height: 100vh; }
.auth-page { display: grid; place-items: center; padding: 16px; }
.app-page { padding: 32px 16px 64px; }
.auth-card { width: min(100%, 384px); padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 10px 24px rgb(44 62 80 / 10%); }
.workspace-page { width: min(100%, 672px); margin: 0 auto; }
.workspace-page.wide-page { width: min(100%, 960px); }

.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; text-align: center; }
.auth-brand img { width: 128px; height: 128px; border-radius: 16px; object-fit: cover; }
.auth-brand h1 { margin: 0; font-size: 24px; line-height: 1.25; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.topbar-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
.topbar-brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.logout-form { margin: 0; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; letter-spacing: -.01em; }
p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
strong { color: var(--text); }
.page-heading { margin-bottom: 24px; }
.heading-with-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.count-badge { min-width: 28px; padding: 4px 8px; border-radius: 999px; color: var(--muted); background: #edece7; font-size: 12px; font-weight: 700; text-align: center; }

.form-card, .community-card, .empty-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(44 62 80 / 5%); }
.wide-page { display: flex; flex-direction: column; }
.wide-page > section[aria-labelledby="sheet-import-heading"] { order: 1; }
.wide-page > .result-card, .wide-page > .preview-card { order: 2; }
.wide-page > section[aria-labelledby="sheet-tools-heading"], .wide-page > section[aria-labelledby="linkedin-scrape-heading"] { order: 3; }
.form-card-header { padding: 24px; }
.form-card-header h2 { margin-bottom: 6px; }
.form-card-content { padding: 0 24px 24px; }
.create-community-card { margin-top: 24px; }
.stacked-form { display: grid; gap: 16px; }
.field-group { display: grid; gap: 8px; }
label { color: var(--text); font-size: 14px; font-weight: 600; }
input:not([type="checkbox"]), select, textarea {
  width: 100%;
  padding: 0 16px;
  border: 1px solid var(--field-border);
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: var(--field);
  box-shadow: 0 1px 2px rgb(44 62 80 / 4%);
  font: inherit;
  font-size: 14px;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
input:not([type="checkbox"]), select { height: 44px; }
textarea { min-height: 88px; padding-top: 12px; padding-bottom: 12px; resize: vertical; }
input:not([type="checkbox"]):hover, select:hover, textarea:hover { background: #fff; }
input:not([type="checkbox"]):focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgb(44 62 80 / 13%); background: #fff; }
input::placeholder { color: var(--field-placeholder); }
select { cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--primary); }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.checkbox-row > span { display: grid; gap: 2px; }
.checkbox-row strong { font-size: 14px; font-weight: 600; }
.checkbox-row small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.4; }
.hint { margin-top: -2px; font-size: 12px; }
.hint span { color: var(--text); }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 8px 16px; border: 1px solid transparent; border-radius: 6px; appearance: none; font: inherit; font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s, opacity .15s; }
.button-primary { border: 1px solid var(--primary); color: #fff; background: var(--primary); }
.button-primary:hover { opacity: .9; }
.button-secondary { border-color: #d7d3ca; color: var(--primary); background: #fff; }
.button-secondary:hover { border-color: #b9b3a8; background: #f7f6f2; }
.logout-link { min-height: 36px; padding: 8px 4px; border: 0; color: var(--muted); background: transparent; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.logout-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.button:focus-visible, .logout-link:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.community-grid { display: grid; gap: 12px; }
.community-card { display: flex; min-width: 0; align-items: center; gap: 16px; padding: 16px; }
.community-card-link { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.community-card-link:hover { border-color: #cbc6bb; box-shadow: 0 5px 14px rgb(44 62 80 / 8%); transform: translateY(-1px); }
.community-avatar { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 16px; font-weight: 700; }
.community-identity { min-width: 0; flex: 1; }
.community-identity h2, .community-identity p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-identity h2 { font-size: 15px; font-weight: 600; }
.community-identity p { margin-top: 3px; font-size: 13px; }
.status-badge { flex: 0 0 auto; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: #fafaf8; font-size: 11px; font-weight: 600; }
.empty-card { padding: 32px 24px; text-align: center; }
.empty-card h2 { margin: 12px 0 6px; }
.empty-icon { display: grid; width: 56px; height: 56px; margin: 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 13px; font-weight: 700; }

.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.breadcrumb a { color: var(--primary); font-weight: 600; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; text-underline-offset: 3px; }
.group-grid { display: grid; gap: 12px; }
.group-card { padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(44 62 80 / 5%); }
.group-card-heading { display: flex; min-width: 0; align-items: flex-start; gap: 12px; }
.group-type-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.group-identity { min-width: 0; flex: 1; }
.group-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.group-title-row h2 { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.group-identity p { margin-top: 4px; }
.group-meta { margin: 14px 0 0 52px; color: var(--muted); font-size: 13px; }
.group-members-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.group-members-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.edit-panel { margin: 16px 0 0 52px; border-top: 1px solid var(--border); padding-top: 12px; }
.edit-panel summary, .archived-section summary { color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer; }
.compact-form { margin-top: 14px; }
.form-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.form-actions form { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: #fafaf8; }
.form-actions .button { justify-self: start; }
.archive-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.button-danger { border: 1px solid #fecdd3; color: #9f1239; background: #fff1f2; }
.button-danger:hover { background: #ffe4e6; }
.archived-section { margin-top: 24px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: rgb(255 255 255 / 55%); }
.archived-list { display: grid; gap: 8px; margin-top: 12px; }
.archived-list > div { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 13px; }
.archived-list strong { font-weight: 600; }

.eyebrow { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.directory-section { margin-top: 24px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin-bottom: 3px; }
.member-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.member-card { display: flex; min-width: 0; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(44 62 80 / 5%); }
.member-card-link { position: relative; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.member-card-link:hover { border-color: #cbc6bb; box-shadow: 0 5px 14px rgb(44 62 80 / 8%); transform: translateY(-1px); }
.member-profile-link { color: inherit; text-decoration: none; }
.member-profile-link::after { position: absolute; inset: 0; content: ''; }
.member-avatar { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 14px; font-weight: 800; }
.member-identity { min-width: 0; flex: 1; }
.member-name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.member-name-row h3 { overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.member-identity > p { overflow: hidden; margin-top: 4px; text-overflow: ellipsis; white-space: nowrap; }
.member-details { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.member-details a { position: relative; z-index: 1; color: var(--primary); font-weight: 600; text-decoration: none; }
.member-details a:hover { text-decoration: underline; text-underline-offset: 2px; }
.compact-empty-card { padding: 24px; }
.notice { margin: 12px 0 0; padding: 10px 12px; border: 1px solid #bae6fd; border-radius: 8px; color: #0c4a6e; background: #f0f9ff; font-size: 12px; }
.flow3-list-card { margin-top: 24px; }
.flow3-list-options { display: grid; gap: 10px; }
.flow3-list-option { display: grid; grid-template-columns: minmax(0, 1fr) 92px; align-items: center; gap: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.flow3-list-option .checkbox-row { margin: 0; }
.flow3-order-field { margin: 0; }
.flow3-order-field label { font-size: 10px; }
.flow3-order-field input { min-width: 0; }
.field-help { margin-bottom: 12px; color: var(--muted); font-size: 12px; }

.profile-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.profile-heading > div:nth-child(2) { min-width: 0; flex: 1; }
.profile-heading h1 { overflow-wrap: anywhere; }
.profile-avatar { display: grid; width: 64px; height: 64px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 22px; font-weight: 800; }
.profile-section-grid, .profile-collection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-detail-card, .profile-collection { padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(44 62 80 / 5%); }
.profile-detail-card h2, .profile-collection > h2 { margin-bottom: 14px; }
.profile-detail-card h3 { margin: 0 0 14px; font-size: 15px; }
.profile-detail-list { display: grid; gap: 0; margin: 0; }
.profile-detail-list > div { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0, 1.4fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.profile-detail-list dt { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.profile-detail-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.profile-detail-list a { color: var(--primary); font-weight: 600; }
.profile-collection { margin-top: 12px; }
.profile-collection .profile-detail-card { padding: 16px; background: #fafaf8; box-shadow: none; }
.profile-empty-value { padding-top: 12px; border-top: 1px solid var(--border); }
.intro-avatar { border-radius: 14px; font-size: 14px; }
.status-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.status-filters a { padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 12px; text-decoration: none; }
.status-filters a.active, .status-filters a:hover { border-color: var(--primary); color: var(--primary); }
.status-filters strong { margin-left: 3px; }
.intro-list { display: grid; gap: 12px; }
.intro-card { display: block; padding: 18px; border: 1px solid var(--border); border-radius: 8px; color: inherit; background: var(--surface); box-shadow: 0 1px 2px rgb(44 62 80 / 5%); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.intro-card:hover { border-color: #cbc6bb; box-shadow: 0 5px 14px rgb(44 62 80 / 8%); transform: translateY(-1px); }
.intro-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.intro-card-heading h2 { font-size: 15px; }
.intro-card > p { margin-top: 7px; }
.intro-card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.preformatted-value { white-space: pre-wrap; }
.intro-approval-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 12px; padding: 18px 20px; border: 1px solid #bbdfc9; border-radius: 8px; background: #fbfffc; }
.intro-approval-card h2 { margin-bottom: 4px; }
.intro-approval-card form { flex: 0 0 auto; }

.import-card { margin-top: 24px; }
.field-group-short { max-width: 240px; }
.form-card-content > .stacked-form + .stacked-form { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
code { padding: 1px 4px; border-radius: 4px; color: var(--text); background: #eeece7; font-size: .9em; }
.format-reference { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.format-reference summary, .column-mapping summary, .error-details summary { color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer; }
.format-reference p { margin-top: 10px; }

.preview-card, .result-card { margin-top: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgb(44 62 80 / 5%); }
.preview-heading, .result-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.preview-heading h2, .result-card-heading h2 { margin-bottom: 4px; }
.preview-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.preview-summary span { padding: 4px 8px; border-radius: 999px; color: var(--muted); background: #f1f0ec; font-size: 11px; }
.preview-summary .preview-ready { color: #166534; background: #f0fdf4; }
.preview-summary .preview-error { color: #9f1239; background: #fff1f2; }
.column-mapping { margin-top: 18px; }
.mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.mapping-grid > div { display: flex; min-width: 0; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.mapping-grid code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--border); border-radius: 8px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th, .preview-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.preview-table tr:last-child td { border-bottom: 0; }
.preview-table th { color: var(--muted); background: #faf9f6; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.preview-table td small { display: block; max-width: 240px; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.row-status { display: inline-flex; padding: 2px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: capitalize; }
.row-status-ready { color: #166534; background: #dcfce7; }
.row-status-skipped { color: #57534e; background: #e7e5e4; }
.row-status-error { color: #9f1239; background: #ffe4e6; }
.preview-more { margin-top: 10px; }
.confirm-import { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.confirm-import p { max-width: 600px; }
.confirm-import .button { flex: 0 0 auto; }
.preview-blocked { margin: 18px 0 0; }

.result-card { border-color: #bbdfc9; background: #fbfffc; }
.result-card-heading { align-items: flex-start; justify-content: flex-start; }
.result-card-heading > div:last-child { min-width: 0; flex: 1; }
.result-card progress { width: min(28rem, 100%); height: 0.75rem; accent-color: #365f4c; }
.small-success-mark { width: 38px; height: 38px; margin: 0; font-size: 18px; }
.result-card > form { margin-top: 16px; }
.result-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px; }
.result-stats > div { display: grid; gap: 2px; padding: 10px; border-radius: 6px; background: #f2f8f4; text-align: center; }
.result-stats strong { font-size: 18px; }
.result-stats span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.error-details { margin-top: 12px; }
.error-details ul { margin: 8px 0 0; padding-left: 20px; color: #9f1239; font-size: 12px; }

.consent-list { display: grid; gap: 12px; margin-bottom: 20px; }
.consent-item { padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #faf9f6; }
.consent-item h3 { margin-bottom: 6px; font-size: 14px; }
.consent-item p + p { margin-top: 8px; }
.consent-item a { color: var(--primary); font-weight: 700; }

.error { margin: 0 0 16px; padding: 10px 12px; border: 1px solid #fecdd3; border-radius: 8px; color: #9f1239; background: #fff1f2; }
.success-card { text-align: center; }
.success-card .form-card-content { padding-top: 32px; }
.success-card h1 { margin-top: 16px; }
.success-card .button { margin-top: 24px; }
.success-mark { display: grid; width: 48px; height: 48px; margin: 0 auto; place-items: center; border-radius: 50%; color: #fff; background: #2d8a56; font-size: 24px; }
.legal { margin-top: 24px; text-align: center; font-size: 12px; }
.legal a { color: inherit; }

@media (max-width: 520px) {
  .app-page { padding: 20px 16px 48px; }
  .topbar { margin-bottom: 24px; }
  .form-card-header { padding: 20px; }
  .form-card-content { padding: 0 20px 20px; }
  .community-card { gap: 12px; }
  .member-list { grid-template-columns: 1fr; }
  .profile-section-grid, .profile-collection-grid { grid-template-columns: 1fr; }
  .profile-heading { align-items: flex-start; }
  .heading-with-meta { align-items: stretch; flex-direction: column; }
  .heading-actions { justify-content: space-between; }
  .intro-approval-card { align-items: stretch; flex-direction: column; }
  .intro-approval-card .button { width: 100%; }
  .profile-detail-list > div { grid-template-columns: 1fr; gap: 4px; }
  .flow3-list-option { grid-template-columns: 1fr; }
  .preview-heading, .confirm-import { align-items: stretch; flex-direction: column; }
  .preview-summary { justify-content: flex-start; }
  .mapping-grid { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .form-actions { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .auth-page { padding: 0; }
  .auth-card { min-height: 100vh; padding: 28px 22px; border: 0; border-radius: 0; box-shadow: none; }
}
