:root {
	--ink: #20212a;
	--muted: #74717e;
	--line: #e7e3ec;
	--soft: #f7f5f9;
	--purple: #6d44d8;
	--purple-dark: #5530b8;
	--purple-soft: #f0ebff;
	--green: #19865c;
	--green-soft: #eaf8f2;
	--white: #ffffff;
	--shadow: 0 18px 55px rgba(46, 35, 73, 0.1);
	font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--ink);
	background: #f5f3f7;
	font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
	margin: 0;
	min-width: 320px;
	min-height: 100vh;
	background: #f5f3f7;
}

button, input { font: inherit; }
button { cursor: pointer; }

.privacy-note {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 28px;
	padding: 7px 10px;
	font-size: 0.86rem;
	color: var(--muted);
	background: var(--green-soft);
	border-radius: 999px;
}
.privacy-note span { color: var(--green); font-size: 0.65rem; }

main { width: min(1220px, calc(100% - 40px)); margin: 34px auto; }

.intro-card {
	display: grid;
	grid-template-columns: 1.05fr 0.95fr;
	gap: clamp(40px, 7vw, 100px);
	align-items: center;
	min-height: 560px;
	padding: clamp(38px, 6vw, 80px);
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: 26px;
	box-shadow: var(--shadow);
}

.eyebrow {
	margin: 0 0 14px;
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.18em;
	color: var(--purple);
}

h1 {
	margin: 0;
	max-width: 650px;
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(2.8rem, 5vw, 4.9rem);
	font-weight: 500;
	line-height: 0.99;
	letter-spacing: -0.045em;
}

.lede {
	max-width: 590px;
	margin: 26px 0 30px;
	font-size: 1.07rem;
	line-height: 1.7;
	color: var(--muted);
}

code {
	padding: 3px 7px;
	font-size: 0.9em;
	color: var(--purple-dark);
	background: var(--purple-soft);
	border-radius: 5px;
}

.how-it-works { display: flex; align-items: center; gap: 12px; color: #585560; font-size: 0.86rem; }
.how-it-works span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.how-it-works b { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #d6cfdf; border-radius: 50%; font-size: 0.75rem; color: var(--purple); }
.how-it-works i { width: 24px; height: 1px; background: #d6cfdf; }

.dropzone {
	min-height: 320px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 34px;
	text-align: center;
	background: #fbfaff;
	border: 1.5px dashed #bdb3d5;
	border-radius: 20px;
	transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging { border-color: var(--purple); background: var(--purple-soft); transform: translateY(-2px); outline: none; }
.file-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 20px; color: var(--purple); background: var(--white); border: 1px solid #ddd5ed; border-radius: 16px; box-shadow: 0 8px 18px rgba(70, 48, 124, .09); }
.file-icon svg { width: 31px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dropzone h2 { margin: 0 0 7px; font-size: 1.12rem; }
.dropzone p { margin: 0 0 18px; color: var(--muted); font-size: 0.92rem; }
.file-types { padding: 7px 11px; color: #5d5866; background: #f0edf4; border-radius: 7px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; }
.file-limit { grid-column: 2; margin: -48px 0 0; text-align: center; color: #8c8792; font-size: 0.78rem; }

.workspace { background: var(--white); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.workspace-head { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.file-summary { display: flex; align-items: center; gap: 13px; min-width: 0; }
.file-badge { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; color: var(--purple); background: var(--purple-soft); border-radius: 11px; }
.file-badge svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.file-summary p { max-width: 54vw; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.file-summary span { color: var(--muted); font-size: 0.82rem; }
.quiet-button { padding: 9px 13px; color: #5a5562; background: transparent; border: 1px solid var(--line); border-radius: 9px; font-size: 0.84rem; font-weight: 650; }
.quiet-button:hover { border-color: #c9bfd8; color: var(--purple-dark); }

.work-grid { display: grid; grid-template-columns: minmax(290px, .72fr) minmax(0, 1.45fr); min-height: 560px; }
.structure-panel, .preview-panel { padding: 28px; min-width: 0; }
.structure-panel { border-right: 1px solid var(--line); }
.preview-panel { background: #fcfbfd; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading .eyebrow { margin-bottom: 8px; }
.panel-heading h2 { margin: 0; font-size: 1.05rem; }
.panel-help { margin: 10px 0 20px; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.count-pill, .status-badge { flex: 0 0 auto; padding: 6px 9px; color: #6b6571; background: #f0edf3; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.status-badge.active { color: var(--green); background: var(--green-soft); }

.field-tree { max-height: 440px; overflow: auto; padding-right: 5px; }
.field-row { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 48px; padding: 7px 8px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid #f0edf3; border-radius: 7px; text-align: left; }
button.field-row:hover { background: var(--soft); }
.field-row.selected { color: var(--purple-dark); background: var(--purple-soft); }
.field-row .check { width: 18px; height: 18px; display: grid; place-items: center; border: 1.5px solid #c7c0cf; border-radius: 5px; font-size: 0.72rem; font-weight: 800; }
.field-row.selected .check { color: white; background: var(--purple); border-color: var(--purple); }
.field-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: 650; }
.field-details { min-width: 0; }
.field-details small { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8c8691; font-size: 0.7rem; }
.field-type { color: #8c8691; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; }

.preview-heading { margin-bottom: 20px; }
.table-wrap { max-height: 430px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { position: sticky; top: 0; z-index: 1; padding: 11px 13px; text-align: left; color: #625c69; background: #f5f2f7; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { max-width: 260px; padding: 11px 13px; border-bottom: 1px solid #f0edf3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4d4853; }
tr:last-child td { border-bottom: 0; }
td.hashed { color: var(--purple-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; background: #fbf9ff; }
.preview-caption { margin: 11px 2px 0; color: #8b8590; font-size: 0.76rem; }
.empty-table { min-height: 260px; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }

.action-bar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 17px 24px; border-top: 1px solid var(--line); background: white; }
.selection-summary { display: flex; align-items: center; gap: 11px; }
.selection-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--purple); background: var(--purple-soft); border-radius: 10px; font-weight: 800; }
.selection-summary strong, .selection-summary span { display: block; }
.selection-summary strong { margin-bottom: 2px; font-size: 0.86rem; }
.selection-summary div span { color: var(--muted); font-size: 0.76rem; }
.action-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.action-controls label { color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.action-controls input { width: 205px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 0.8rem; outline: none; }
.action-controls input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; gap: 8px; padding: 11px 17px; border-radius: 10px; font-size: 0.84rem; font-weight: 750; }
.primary-button { color: white; background: var(--purple); border: 0; box-shadow: 0 8px 16px rgba(109, 68, 216, .2); }
.primary-button:hover:not(:disabled) { background: var(--purple-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }
.secondary-button { color: var(--purple-dark); background: var(--white); border: 1px solid #cfc4e5; }
.secondary-button:hover { background: var(--purple-soft); border-color: #ad9bd4; }
.primary-button svg, .secondary-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.message { margin: 14px 24px 22px; padding: 11px 13px; color: var(--green); background: var(--green-soft); border-radius: 8px; font-size: 0.84rem; }
.message.error { color: #a1384c; background: #fff0f3; }
.intro-card > .message { grid-column: 1 / -1; margin: 0; }

@media (max-width: 900px) {
	main { width: min(100% - 28px, 760px); margin: 24px auto; }
	.intro-card { grid-template-columns: 1fr; min-height: auto; padding: 40px; }
	.file-limit { grid-column: auto; margin: -24px 0 0; }
	.work-grid { grid-template-columns: 1fr; }
	.structure-panel { border-right: 0; border-bottom: 1px solid var(--line); }
	.field-tree { max-height: 300px; }
	.action-bar { align-items: flex-start; flex-direction: column; }
	.action-controls { width: 100%; flex-wrap: wrap; }
	.primary-button { margin-left: auto; }
}

@media (max-width: 580px) {
	main { width: calc(100% - 20px); margin: 10px auto; }
	.intro-card { padding: 28px 20px; border-radius: 17px; gap: 32px; }
	h1 { font-size: 2.65rem; }
	.lede { font-size: 1rem; }
	.how-it-works { align-items: flex-start; flex-direction: column; }
	.how-it-works i { display: none; }
	.dropzone { min-height: 250px; padding: 24px; }
	.workspace { border-radius: 15px; }
	.workspace-head, .structure-panel, .preview-panel, .action-bar { padding-left: 17px; padding-right: 17px; }
	.workspace-head { align-items: flex-start; }
	.quiet-button { font-size: 0; padding: 9px; }
	.quiet-button::after { content: "Change"; font-size: .78rem; }
	.preview-heading { align-items: flex-start; flex-direction: column; }
	.action-controls { align-items: stretch; flex-direction: column; }
	.action-controls input { width: 100%; }
	.primary-button, .secondary-button { justify-content: center; width: 100%; margin: 3px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; transition: none !important; }
}
