/* ── Layout ─────────────────────────────────────────────────────────────── */

.htl-wrap {
	max-width: 900px;
	margin: 2rem auto;
	padding: 0 1rem;
}

/* ── Header + Tabs ──────────────────────────────────────────────────────── */

.htl-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid #a2a9b1;
	margin-bottom: 1.5rem;
	gap: 1rem;
}

.htl-title {
	margin: 0 0 0.3rem;
	word-break: break-all;
	flex: 1;
	font-size: 1.5rem;
	line-height: 1.3;
}

.htl-back{
	text-decoration: none;
}

.htl-tabs {
	display: flex;
	align-items: flex-end;
	gap: 2px;
	flex-shrink: 0;
}

.htl-tab {
	display: block;
	padding: 0.35rem 0.9rem;
	border: 1px solid #a2a9b1;
	border-bottom-color: #a2a9b1;
	background: #eaecf0;
	color: #0645ad;
	text-decoration: none;
	font-size: 0.875rem;
	border-radius: 3px 3px 0 0;
	white-space: nowrap;
	position: relative;
	bottom: 0;
	line-height: 1.5;
}

.htl-tab:hover {
	background: #fff;
	text-decoration: none;
}

.htl-tab--active {
	background: #fff;
	color: #202122;
	border-bottom-color: #fff;
	bottom: -1px;
	cursor: default;
	pointer-events: none;
}

/* ── View ───────────────────────────────────────────────────────────────── */

.htl-content {
	font-family: monospace;
	font-size: 0.875rem;
	background: #f5f5f5;
	padding: 1rem;
	overflow-x: auto;
	white-space: pre-wrap;
	word-break: break-all;
}

.htl-not-found {
	color: #666;
}

/* ── Documentation content ──────────────────────────────────────────────── */

.htl-wrap .htl-doc-content blockquote {
	border-left: 4px solid #9fa1a4;
	margin: 0.75em 0 0.75em 1em;
	padding: 0.4em 0.75em;
	color: #54595d;
	background: none;
	font-style: normal;
	quotes: none;
}

.htl-wrap .htl-doc-content blockquote::before,
.htl-wrap .htl-doc-content blockquote::after {
	content: none;
}

.htl-wrap .htl-doc-content code {
	background: #f0f0f0;
	padding: 0.1em 0.35em;
	border-radius: 2px;
	font-family: monospace;
	font-size: 0.9em;
	color: inherit;
}

/* ── Edit ───────────────────────────────────────────────────────────────── */

.htl-textarea {
	display: block;
	width: 100%;
	font-family: monospace;
	font-size: 0.875rem;
	padding: 0.5rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
	resize: vertical;
}

.htl-comment-row {
	margin-top: 0.75rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.htl-comment-row label {
	font-size: 0.875rem;
	white-space: nowrap;
	flex-shrink: 0;
}

.htl-comment-input {
	flex: 1;
	max-width: 500px;
	padding: 0.35rem 0.5rem;
	border: 1px solid #ccc;
	font-size: 0.875rem;
}

.htl-actions-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 0.75rem;
}

.htl-save-button {
	padding: 0.5rem 1.5rem;
	background: #0073aa;
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 0.875rem;
}

.htl-save-button:hover {
	background: #005a87;
}

.htl-delete-form {
	margin: 0;
}

.htl-delete-button {
	padding: 0.5rem 1.5rem;
	background: #dc3545;
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 0.875rem;
}

.htl-delete-button:hover {
	background: #b02a37;
}

/* ── History ────────────────────────────────────────────────────────────── */

.htl-history-controls {
	margin-bottom: 0.75rem;
}

.htl-history-controls--bottom {
	margin-top: 0.75rem;
	margin-bottom: 0;
}

.htl-compare-btn {
	padding: 0.35rem 1rem;
	background: #f8f9fa;
	border: 1px solid #a2a9b1;
	cursor: pointer;
	font-size: 0.875rem;
	border-radius: 2px;
}

.htl-compare-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.htl-compare-btn:not(:disabled):hover {
	background: #eaecf0;
}

.htl-revisions {
	list-style: none;
	margin: 0;
	padding: 0;
}

.htl-revision {
	padding: 0.4rem 0;
	border-bottom: 1px solid #eaecf0;
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.4rem;
	font-size: 0.875rem;
}

.htl-rev-check {
	margin: 0;
	flex-shrink: 0;
	cursor: pointer;
}

.htl-rev-date {
	color: #202122;
	white-space: nowrap;
}

.htl-rev-sep {
	color: #72777d;
}

.htl-rev-author {
	color: #0645ad;
}

.htl-rev-size {
	font-weight: bold;
	white-space: nowrap;
	padding: 0 0.25rem;
	border-radius: 2px;
	font-size: 0.8rem;
}

.htl-rev-size--added   { color: #006400; background: #d5ffd5; }
.htl-rev-size--removed { color: #8b0000; background: #ffd5d5; }
.htl-rev-size--neutral { color: #555;    background: #f0f0f0; }

.htl-rev-comment {
	color: #72777d;
	font-style: italic;
}

.htl-rev-comment::before { content: '('; }
.htl-rev-comment::after  { content: ')'; }

/* ── Pagination ─────────────────────────────────────────────────────────── */

.htl-pagination {
	margin-top: 1rem;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.875rem;
}

.htl-page-link {
	color: #0645ad;
	text-decoration: none;
}

.htl-page-link:hover {
	text-decoration: underline;
}

.htl-page-current {
	color: #555;
}

/* ── Diff / Compare ─────────────────────────────────────────────────────── */

.htl-diff-header {
	font-size: 0.875rem;
	color: #202122;
	margin-bottom: 1rem;
}

.htl-diff {
	width: 100%;
	border-collapse: collapse;
	font-family: monospace;
	font-size: 0.8125rem;
	table-layout: fixed;
	margin-bottom: 2rem;
}

.htl-diff-col-old,
.htl-diff-col-new {
	width: 50%;
}

.htl-diff-th {
	background: #eaecf0;
	border: 1px solid #a2a9b1;
	padding: 0.35rem 0.5rem;
	text-align: left;
	font-size: 0.8125rem;
	font-weight: bold;
}

.htl-diff-cell {
	border: 1px solid #eaecf0;
	padding: 0.15rem 0.5rem;
	vertical-align: top;
	white-space: pre-wrap;
	word-break: break-all;
	line-height: 1.5;
}

.htl-diff-cell--del { background: #ffd5d5; }
.htl-diff-cell--ins { background: #d5ffd5; }

.htl-diff-skip-cell {
	text-align: center;
	color: #72777d;
	font-style: italic;
	font-size: 0.8125rem;
	padding: 0.3rem;
	background: #f8f9fa;
	border-top: 1px solid #eaecf0;
	border-bottom: 1px solid #eaecf0;
}

.htl-compare-edit {
	margin-top: 2rem;
	border-top: 1px solid #a2a9b1;
	padding-top: 1.5rem;
}

.htl-compare-edit-heading {
	font-size: 1.1rem;
	margin: 0 0 0.75rem;
}

/* ── List page ──────────────────────────────────────────────────────────── */

.htl-list-wrap {
	max-width: 1200px;
}

.htl-list-layout {
	display: flex;
	gap: 2rem;
	align-items: flex-start;
}

/* Sidebar */

.htl-list-sidebar {
	flex: 0 0 200px;
	min-width: 0;
}

.htl-list-nav {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid #a2a9b1;
	border-radius: 3px;
	overflow: hidden;
}

.htl-list-nav li {
	border-bottom: 1px solid #eaecf0;
}

.htl-list-nav li:last-child {
	border-bottom: none;
}

.htl-list-nav-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.45rem 0.75rem;
	font-size: 0.875rem;
	color: #0645ad;
	text-decoration: none;
	background: #f8f9fa;
}

.htl-list-nav-item:hover {
	background: #eaecf0;
	text-decoration: none;
}

.htl-list-nav-item--active {
	background: #fff;
	color: #202122;
	font-weight: bold;
	cursor: default;
	pointer-events: none;
}

.htl-list-nav-count {
	color: #72777d;
	font-size: 0.8rem;
	margin-left: 0.4rem;
	flex-shrink: 0;
}

/* Main content */

.htl-list-main {
	flex: 1;
	min-width: 0;
}

.htl-list-main .htl-title {
	margin-bottom: 1rem;
}

/* Search form */

.htl-list-search-form {
	margin-bottom: 1rem;
}

.htl-list-search-row {
	display: flex;
	gap: 0.5rem;
}

.htl-list-search-row input[type="search"] {
	flex: 1;
	max-width: 400px;
	padding: 0.35rem 0.5rem;
	border: 1px solid #a2a9b1;
	font-size: 0.875rem;
}

.htl-list-search-btn {
	padding: 0.35rem 1rem;
	background: #0073aa;
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 0.875rem;
	border-radius: 2px;
}

.htl-list-search-btn:hover {
	background: #005a87;
}

/* Results table */

.htl-list-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
	margin-bottom: 0.75rem;
}

.htl-list-table th {
	background: #eaecf0;
	border: 1px solid #a2a9b1;
	padding: 0.4rem 0.6rem;
	text-align: left;
	font-weight: bold;
}

.htl-list-table td {
	border: 1px solid #eaecf0;
	padding: 0.35rem 0.6rem;
	vertical-align: top;
}

.htl-list-table tbody tr:nth-child(even) td {
	background: #f8f9fa;
}

.htl-list-table a {
	color: #0645ad;
}

/* Total count */

.htl-list-total {
	font-size: 0.875rem;
	color: #72777d;
	margin-top: 0.5rem;
}

/* Responsive */

@media (max-width: 680px) {
	.htl-list-layout {
		flex-direction: column;
	}

	.htl-list-sidebar {
		flex: none;
		width: 100%;
	}

	.htl-list-nav {
		display: flex;
		flex-wrap: wrap;
	}

	.htl-list-nav li {
		border-bottom: none;
		border-right: 1px solid #eaecf0;
	}

	.htl-list-nav li:last-child {
		border-right: none;
	}
}
