.markdown-table-card {
	padding: 24px;
}

.markdown-table-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 20px 0;
}

.markdown-table-card .secondary-button,
.markdown-table-card .primary-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 8px 14px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--surface);
	color: var(--ink);
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.markdown-table-card .secondary-button:hover {
	background: var(--soft);
	border-color: var(--blue);
	color: var(--blue);
}

.markdown-table-card .primary-button {
	border-color: var(--blue);
	background: var(--blue);
	color: #fff;
}

.markdown-table-card .primary-button:hover {
	border-color: var(--blue-dark);
	background: var(--blue-dark);
}

.markdown-table-card button:active {
	transform: translateY(1px);
}

.markdown-table-card button:focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 2px;
}

.markdown-table-editor-wrapper {
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
}

.markdown-table-editor {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	table-layout: fixed;
}

.markdown-table-editor th,
.markdown-table-editor td {
    min-width: 120px;
    height: 48px;
    padding: 12px 14px;
    box-sizing: border-box;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
    empty-cells: show;
}

/* .markdown-table-editor td:empty::after {
    content: "\\00a0";
}

.markdown-table-editor th:empty::after {
    content: "\\00a0";
} */

.markdown-table-editor th {
	background: var(--bg);
	font-weight: 600;
}

.markdown-table-editor td {
	background: var(--surface);
}

.markdown-table-editor th:last-child,
.markdown-table-editor td:last-child {
	border-right: 0;
}

.markdown-table-editor tbody tr:last-child td {
	border-bottom: 0;
}

.markdown-table-editor [contenteditable="true"] {
	outline: none;
	cursor: text;
}

.markdown-table-editor [contenteditable="true"]:focus {
	background: var(--soft);
	box-shadow: inset 0 0 0 2px var(--blue);
}

.markdown-table-output-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 28px;
	margin-bottom: 12px;
}

.markdown-table-output-header label {
	color: var(--ink);
	font-size: 14px;
	font-weight: 600;
}

.markdown-table-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.markdown-table-output {
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	min-height: 220px;
	padding: 16px;
	box-sizing: border-box;
	border: 1px solid var(--line);
	border-radius: 10px;
	outline: none;
	resize: vertical;
	background: var(--bg);
	color: var(--ink);
	font-family: Consolas, Monaco, "Courier New", monospace;
	font-size: 13px;
	line-height: 1.7;
	white-space: pre;
	overflow: auto;
}

.markdown-table-output:focus {
	border-color: var(--blue);
	box-shadow: 0 0 0 2px rgba(49, 94, 232, 0.12);
}

.markdown-table-stats {
	margin-top: 8px;
	color: var(--muted);
	font-size: 12px;
	text-align: right;
}

.markdown-table-card .status-message {
	margin-top: 14px;
}

@media (max-width: 600px) {
	.markdown-table-card {
		padding: 14px;
	}

	.markdown-table-toolbar {
		gap: 8px;
	}

	.markdown-table-toolbar button {
		flex: 1 1 calc(50% - 8px);
	}

	.markdown-table-output-header {
		align-items: flex-start;
		flex-direction: column;
	}

	.markdown-table-actions {
		width: 100%;
	}

	.markdown-table-actions button {
		flex: 1;
	}

	.markdown-table-output {
		min-height: 180px;
		font-size: 12px;
	}
}