/* Hooktrail drawer. Scoped under #hooktrail-root so themes cannot restyle it. */

#hooktrail-root,
#hooktrail-root * {
	box-sizing: border-box;
}

#hooktrail-root {
	--htrl-ink: #1d2327;
	--htrl-muted: #646970;
	--htrl-line: #dcdcde;
	--htrl-soft: #f6f7f7;
	--htrl-accent: #2271b1;
	font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: var(--htrl-ink);
}

#hooktrail-root[hidden] {
	display: none;
}

#hooktrail-root .htrl-drawer {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	height: 48vh;
	min-height: 240px;
	z-index: 999999;
	display: none;
	flex-direction: column;
	background: #fff;
	border-top: 3px solid var(--htrl-accent);
	box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18);
}

#hooktrail-root .htrl-drawer.is-open {
	display: flex;
}

#hooktrail-root .htrl-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	background: #1d2327;
	color: #f0f0f1;
}

#hooktrail-root .htrl-title {
	font-size: 14px;
}

#hooktrail-root .htrl-summary {
	color: #c3c4c7;
	font-size: 12px;
}

#hooktrail-root .htrl-search {
	flex: 1 1 220px;
	min-width: 160px;
	margin: 0;
	padding: 4px 8px;
	font: inherit;
	color: var(--htrl-ink);
	background: #fff;
	border: 1px solid #8c8f94;
	border-radius: 3px;
}

#hooktrail-root .htrl-check {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: #f0f0f1;
	cursor: pointer;
}

#hooktrail-root .htrl-btn {
	padding: 4px 10px;
	font: inherit;
	font-size: 12px;
	color: #f0f0f1;
	background: transparent;
	border: 1px solid #50575e;
	border-radius: 3px;
	cursor: pointer;
}

#hooktrail-root .htrl-btn:hover,
#hooktrail-root .htrl-btn:focus-visible {
	border-color: #f0f0f1;
}

#hooktrail-root .htrl-close {
	font-size: 16px;
	line-height: 1;
	padding: 2px 9px;
}

#hooktrail-root .htrl-tabs {
	display: flex;
	gap: 2px;
	overflow-x: auto;
	white-space: nowrap;
	padding: 0 12px;
	background: var(--htrl-soft);
	border-bottom: 1px solid var(--htrl-line);
}

#hooktrail-root .htrl-tab {
	padding: 8px 12px;
	font: inherit;
	color: var(--htrl-muted);
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	cursor: pointer;
}

#hooktrail-root .htrl-tab.is-active {
	color: var(--htrl-ink);
	border-bottom-color: var(--htrl-accent);
	font-weight: 600;
}

#hooktrail-root .htrl-body {
	flex: 1;
	overflow: auto;
	padding: 4px 0 12px;
}

#hooktrail-root .htrl-note {
	padding: 6px 12px;
	font-size: 11px;
	color: var(--htrl-muted);
	border-top: 1px solid var(--htrl-line);
}

#hooktrail-root .htrl-phase {
	position: sticky;
	top: 0;
	z-index: 1;
	margin-top: 6px;
	padding: 3px 12px;
	font-family: Menlo, Consolas, Monaco, "Liberation Mono", monospace;
	font-size: 11px;
	font-weight: 600;
	color: var(--htrl-accent);
	background: #f0f6fc;
	border-top: 1px solid #c5d9ed;
	border-bottom: 1px solid #c5d9ed;
}

#hooktrail-root .htrl-row {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 3px 12px 3px 8px;
	font: inherit;
	text-align: left;
	color: inherit;
	background: none;
	border: 0;
	border-bottom: 1px solid #f0f0f1;
	cursor: pointer;
}

#hooktrail-root .htrl-row:hover,
#hooktrail-root .htrl-row:focus-visible {
	background: var(--htrl-soft);
}

#hooktrail-root .htrl-row[aria-expanded="true"] {
	background: #f0f6fc;
}

#hooktrail-root .htrl-time {
	flex: 0 0 68px;
	font-size: 11px;
	color: var(--htrl-muted);
	font-variant-numeric: tabular-nums;
}

#hooktrail-root .htrl-name,
#hooktrail-root .htrl-code {
	font-family: Menlo, Consolas, Monaco, "Liberation Mono", monospace;
	font-size: 12px;
	overflow-wrap: anywhere;
}

#hooktrail-root .htrl-badge {
	padding: 0 5px;
	font-size: 10px;
	border-radius: 3px;
	border: 1px solid currentColor;
}

#hooktrail-root .htrl-badge-a {
	color: #996800;
}

#hooktrail-root .htrl-badge-f {
	color: #007017;
}

#hooktrail-root .htrl-count {
	font-size: 11px;
	color: var(--htrl-muted);
}

#hooktrail-root .htrl-chips {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-left: auto;
}

#hooktrail-root .htrl-chip {
	display: inline-block;
	padding: 0 6px;
	font-size: 11px;
	line-height: 18px;
	color: #fff;
	background: var(--htrl-chip, #50575e);
	border-radius: 9px;
	white-space: nowrap;
}

#hooktrail-root .htrl-detail {
	padding: 6px 12px 10px 40px;
	background: #fbfbfc;
	border-bottom: 1px solid var(--htrl-line);
}

#hooktrail-root .htrl-meta,
#hooktrail-root .htrl-intro,
#hooktrail-root .htrl-empty {
	margin: 6px 12px;
	color: var(--htrl-muted);
}

#hooktrail-root .htrl-detail .htrl-meta,
#hooktrail-root .htrl-detail .htrl-empty {
	margin: 0 0 6px;
}

#hooktrail-root .htrl-cbs {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid var(--htrl-line);
}

#hooktrail-root .htrl-cbs th,
#hooktrail-root .htrl-cbs td {
	padding: 4px 8px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid #f0f0f1;
}

#hooktrail-root .htrl-cbs th {
	font-size: 11px;
	font-weight: 600;
	color: var(--htrl-muted);
	background: var(--htrl-soft);
}

#hooktrail-root .htrl-num {
	width: 64px;
	font-variant-numeric: tabular-nums;
}

#hooktrail-root .htrl-file {
	color: var(--htrl-muted);
}

#hooktrail-root .htrl-last {
	display: inline-block;
	margin-left: 8px;
	padding: 0 6px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 10px;
	color: #8a2424;
	background: #fcf0f1;
	border: 1px solid #f0c3c7;
	border-radius: 3px;
}

#hooktrail-root .htrl-group,
#hooktrail-root .htrl-shared {
	margin: 6px 12px;
	border: 1px solid var(--htrl-line);
	border-radius: 4px;
	background: #fff;
}

#hooktrail-root .htrl-group summary {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	cursor: pointer;
}

#hooktrail-root .htrl-group-count {
	font-size: 12px;
	color: var(--htrl-muted);
}

#hooktrail-root .htrl-group-hook,
#hooktrail-root .htrl-shared {
	padding: 8px 10px;
}

#hooktrail-root .htrl-group-hook {
	border-top: 1px solid #f0f0f1;
}

#hooktrail-root .htrl-group-title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}

#hooktrail-root .htrl-more {
	display: block;
	margin: 8px auto;
	padding: 4px 14px;
	font: inherit;
	cursor: pointer;
}

#hooktrail-root .htrl-launcher {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 999998;
	padding: 6px 12px;
	font: 600 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #fff;
	background: #1d2327;
	border: 0;
	border-radius: 16px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

#hooktrail-root .htrl-launcher[hidden] {
	display: none;
}

/* ----- Shared pieces for the extra views ----- */

#hooktrail-root .htrl-btn-light {
	padding: 3px 10px;
	margin: 0 6px 6px 0;
	font: inherit;
	font-size: 12px;
	color: var(--htrl-accent);
	background: #fff;
	border: 1px solid var(--htrl-accent);
	border-radius: 3px;
	cursor: pointer;
}

#hooktrail-root .htrl-btn-light:hover,
#hooktrail-root .htrl-btn-light:focus-visible {
	background: #f0f6fc;
}

#hooktrail-root .htrl-btn-light[disabled] {
	color: var(--htrl-muted);
	border-color: var(--htrl-line);
	cursor: default;
}

#hooktrail-root .htrl-dur {
	font-size: 11px;
	font-variant-numeric: tabular-nums;
	color: #8a2424;
	white-space: nowrap;
}

#hooktrail-root .htrl-h {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 14px 12px 6px;
	font-size: 13px;
	font-weight: 600;
}

#hooktrail-root .htrl-pill {
	padding: 0 7px;
	font-size: 11px;
	font-weight: 400;
	color: var(--htrl-muted);
	background: var(--htrl-soft);
	border: 1px solid var(--htrl-line);
	border-radius: 9px;
}

#hooktrail-root .htrl-body > .htrl-cbs,
#hooktrail-root .htrl-body > div > .htrl-cbs,
#hooktrail-root .htrl-body > .htrl-pre,
#hooktrail-root .htrl-body > .htrl-value,
#hooktrail-root .htrl-body > .htrl-btn-light,
#hooktrail-root .htrl-body > .htrl-check,
#hooktrail-root .htrl-body > .htrl-chiprow {
	margin-left: 12px;
	margin-right: 12px;
	width: auto;
}

#hooktrail-root .htrl-body > .htrl-cbs {
	width: calc(100% - 24px);
}

#hooktrail-root .htrl-sql {
	max-width: 640px;
	white-space: pre-wrap;
}

#hooktrail-root .htrl-file {
	white-space: pre-wrap;
}

#hooktrail-root .htrl-chiprow {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 6px;
}

#hooktrail-root .htrl-notice {
	margin: 6px 12px;
	padding: 6px 10px;
	background: #f0f6fc;
	border-left: 3px solid var(--htrl-accent);
}

#hooktrail-root .htrl-viewing {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 12px;
	font-size: 12px;
	background: #fcf9e8;
	border-bottom: 1px solid #f0e6b3;
}

#hooktrail-root .htrl-viewing[hidden] {
	display: none;
}

#hooktrail-root .htrl-viewing .htrl-btn-light {
	margin: 0;
}

#hooktrail-root .htrl-check-dark {
	color: var(--htrl-ink);
	margin: 0 12px 6px;
}

/* Bars (slowest hooks, queries by plugin) */

#hooktrail-root .htrl-bars {
	margin: 0 12px 8px;
}

#hooktrail-root .htrl-bar-row {
	display: grid;
	grid-template-columns: minmax(140px, 260px) 1fr 70px;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 2px 0;
	font: inherit;
	text-align: left;
	color: inherit;
	background: none;
	border: 0;
}

#hooktrail-root button.htrl-bar-row {
	cursor: pointer;
}

#hooktrail-root button.htrl-bar-row:hover .htrl-bar-name {
	text-decoration: underline;
}

#hooktrail-root .htrl-bar-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#hooktrail-root .htrl-bar-track {
	height: 10px;
	background: var(--htrl-soft);
	border-radius: 2px;
}

#hooktrail-root .htrl-bar-fill {
	display: block;
	height: 100%;
	background: #d63638;
	border-radius: 2px;
}

/* Flame chart */

#hooktrail-root .htrl-flame-wrap {
	margin: 10px 12px;
	overflow-x: auto;
	border: 1px solid var(--htrl-line);
	border-radius: 4px;
}

#hooktrail-root .htrl-flame {
	position: relative;
	min-width: 900px;
	background: #fff;
}

#hooktrail-root .htrl-flame-axis {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 20px;
	border-bottom: 1px solid var(--htrl-line);
	background: var(--htrl-soft);
}

#hooktrail-root .htrl-flame-tick {
	position: absolute;
	top: 3px;
	font-size: 10px;
	color: var(--htrl-muted);
	transform: translateX(-50%);
	white-space: nowrap;
}

#hooktrail-root .htrl-flame-tick:first-child {
	transform: none;
	padding-left: 4px;
}

#hooktrail-root .htrl-flame-tick:last-child {
	transform: translateX(-100%);
	padding-right: 4px;
}

#hooktrail-root .htrl-flame-bar {
	position: absolute;
	height: 18px;
	min-width: 2px;
	padding: 0 4px;
	overflow: hidden;
	font: 10px/18px Menlo, Consolas, Monaco, monospace;
	text-align: left;
	color: #1d2327;
	white-space: nowrap;
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 2px;
	cursor: pointer;
}

#hooktrail-root .htrl-flame-bar.is-owned {
	color: #fff;
}

#hooktrail-root .htrl-flame-bar:hover,
#hooktrail-root .htrl-flame-bar:focus-visible {
	outline: 2px solid #1d2327;
	z-index: 2;
}

/* Trace */

#hooktrail-root .htrl-inline-form {
	display: flex;
	gap: 6px;
	margin: 0 12px 8px;
}

#hooktrail-root .htrl-input {
	padding: 3px 8px;
	font: 12px Menlo, Consolas, Monaco, monospace;
	border: 1px solid #8c8f94;
	border-radius: 3px;
}

#hooktrail-root .htrl-inline-form .htrl-btn-light {
	margin: 0;
}

#hooktrail-root .htrl-trace-tag {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 12px;
}

#hooktrail-root .htrl-trace-tag .htrl-btn-light {
	margin: 4px 0;
}

#hooktrail-root .htrl-step {
	margin: 4px 0;
	padding: 6px 8px;
	border: 1px solid #f0f0f1;
	border-radius: 3px;
}

#hooktrail-root .htrl-step.is-changed {
	border-color: #c5d9ed;
	background: #fbfdff;
}

#hooktrail-root .htrl-step-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

#hooktrail-root .htrl-changed {
	font-size: 11px;
	color: #8a2424;
}

#hooktrail-root .htrl-same {
	font-size: 11px;
	color: var(--htrl-muted);
}

#hooktrail-root .htrl-diff {
	margin-top: 6px;
	padding: 6px 8px;
	font: 12px/1.5 Menlo, Consolas, Monaco, monospace;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	background: #f6f7f7;
	border-radius: 3px;
	max-height: 260px;
	overflow: auto;
}

#hooktrail-root .htrl-diff del {
	color: #8a2424;
	background: #fcf0f1;
	text-decoration: line-through;
}

#hooktrail-root .htrl-diff ins {
	color: #00450c;
	background: #edfaef;
	text-decoration: none;
}

#hooktrail-root .htrl-diff-cut {
	color: var(--htrl-muted);
}

#hooktrail-root .htrl-value {
	margin: 4px 0;
}

#hooktrail-root .htrl-value summary {
	font-size: 12px;
	color: var(--htrl-muted);
	cursor: pointer;
}

#hooktrail-root .htrl-pre {
	margin: 4px 0;
	padding: 6px 8px;
	font: 12px/1.5 Menlo, Consolas, Monaco, monospace;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	background: #f6f7f7;
	border-radius: 3px;
	max-height: 240px;
	overflow: auto;
}

/* Compare */

#hooktrail-root .htrl-slots {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 10px;
	margin: 0 12px 8px;
}

#hooktrail-root .htrl-slot {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 8px 10px;
	border: 1px solid var(--htrl-line);
	border-radius: 4px;
}

#hooktrail-root .htrl-slot .htrl-btn-light {
	align-self: flex-start;
	margin: 0;
}

@media (max-width: 600px) {
	#hooktrail-root .htrl-drawer {
		height: 70vh;
	}

	#hooktrail-root .htrl-time {
		display: none;
	}

	#hooktrail-root .htrl-detail {
		padding-left: 12px;
	}
}
