/*! CSS Portal — Source Code Viewer (builds on code-tool.css) */
.sv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sv [hidden] { display: none !important; }
.sv span, .sv small, .sv b, .sv i, .sv a { line-height: inherit; }
.sv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* form */
.sv-form { display: flex; gap: 8px; margin: 14px 0 4px; padding: 8px; background: var(--ct-bg); border: 2px solid var(--ct-accent); border-radius: 16px; box-shadow: 0 8px 28px -10px color-mix(in srgb, var(--ct-accent) 55%, transparent); transition: box-shadow .15s ease; }
.sv-form:focus-within { box-shadow: 0 0 0 4px var(--ct-accent-soft), 0 8px 28px -10px color-mix(in srgb, var(--ct-accent) 55%, transparent); }
.sv-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 56px; margin: 0; padding: 0 16px; background: var(--ct-surface); border: 0; border-radius: 10px; }
.sv-field:focus-within { background: var(--ct-bg); }
.sv-field > i { font-size: 22px; color: var(--ct-accent); }
.sv-field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ct-text); font: inherit; font-size: 17px; }
.sv-form .ct-btn { flex: none; height: 56px; padding: 0 28px; border-radius: 10px; font-size: 16px; font-weight: 700; }
.sv-form .ct-btn:disabled { opacity: .6; cursor: progress; }
.sv-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -4px 0 0; font-size: 13px; color: var(--ct-muted); }
.sv-hint button { padding: 2px 9px; font: inherit; font-size: 12.5px; color: var(--ct-accent); background: var(--ct-accent-soft); border: 0; border-radius: 99px; cursor: pointer; }
.sv-hint button:hover { text-decoration: underline; }
.sv-status { margin: 0; }
.sv-status.is-warn i { color: var(--ct-warn); }
.sv-status.is-warn span { white-space: normal; }

/* page summary */
.sv-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sv-page { display: grid; gap: 6px; padding: 14px 16px; background: var(--ct-surface); border: 1px solid var(--ct-border); border-radius: var(--ct-radius); min-width: 0; }
.sv-page__title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--ct-text); overflow-wrap: anywhere; }
.sv-page__link { font: 13px/1.4 var(--ct-mono); color: var(--ct-accent); text-decoration: none; overflow-wrap: anywhere; }
.sv-page__link:hover { text-decoration: underline; }
.sv-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sv-badge { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: 600; line-height: 1.6; color: var(--ct-muted); background: var(--ct-bg); border: 1px solid var(--ct-border); border-radius: 99px; font-variant-numeric: tabular-nums; }
.sv-badge.is-ok { color: var(--ct-ok); border-color: color-mix(in srgb, var(--ct-ok) 35%, transparent); }
.sv-badge.is-warn { color: var(--ct-warn); border-color: color-mix(in srgb, var(--ct-warn) 35%, transparent); }
.sv-badge.is-err { color: var(--ct-err); border-color: color-mix(in srgb, var(--ct-err) 35%, transparent); }

/* layout */
.sv-main { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px; align-items: start; }

/* file list */
.sv-files { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; min-width: 0; max-height: calc(clamp(320px, 58vh, 620px) + 92px); overflow: auto; background: var(--ct-bg); border: 1px solid var(--ct-border); border-radius: var(--ct-radius); }
.sv-filter { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--ct-border); position: sticky; top: 0; background: var(--ct-bg); z-index: 1; }
.sv-filter i { color: var(--ct-muted); }
.sv-filter input { flex: 1; min-width: 0; height: 30px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ct-text); font: inherit; font-size: 13.5px; }
.sv-group { padding: 6px 0; border-bottom: 1px solid var(--ct-border); }
.sv-group:last-child { border-bottom: 0; }
.sv-group__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ct-muted); }
.sv-count { padding: 0 7px; border-radius: 99px; background: var(--ct-surface-2); font-size: 11px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.sv-empty { margin: 2px 14px 6px; font-size: 13px; color: var(--ct-muted); }
.sv-list { margin: 0; padding: 0 6px; list-style: none; }
.sv-list li { margin: 0; padding: 0; }
.sv-file { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; margin: 0; padding: 7px 8px; text-align: left; font: inherit; color: var(--ct-text); background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.sv-file:hover { background: var(--ct-surface); }
.sv-file:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ct-accent); }
.sv-file.is-active { background: var(--ct-accent-soft); }
.sv-file > i:first-child { flex: none; font-size: 18px; color: var(--ct-muted); }
.sv-file.is-active > i:first-child { color: var(--ct-accent); }
.sv-file__text { display: grid; flex: 1; min-width: 0; }
.sv-file__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-file__sub { font-size: 11.5px; color: var(--ct-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-file__err { flex: none; color: var(--ct-err); }
.sv-spin { flex: none; color: var(--ct-accent); animation: ct-spin .9s linear infinite; }

/* tabs */
.sv-pane { min-width: 0; }
.sv-tabs { display: flex; gap: 2px; padding: 6px 6px 0; overflow-x: auto; scrollbar-width: thin; background: var(--ct-surface-2); border-bottom: 1px solid var(--ct-border); }
.sv-tab { position: relative; display: flex; align-items: center; flex: none; max-width: 220px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--ct-muted); }
.sv-tab:hover { color: var(--ct-text); background: color-mix(in srgb, var(--ct-bg) 50%, transparent); }
.sv-tab.is-active { color: var(--ct-text); background: var(--ct-surface); border-color: var(--ct-border); /*margin-bottom: -1px;*/ padding-bottom: 1px; }
.sv-tab__btn { display: flex; align-items: center; gap: 7px; min-width: 0; height: 34px; padding: 0 6px 0 12px; font: inherit; font-size: 13px; font-weight: 500; color: inherit; background: transparent; border: 0; cursor: pointer; }
.sv-tab:not(:has(.sv-tab__close)) .sv-tab__btn { padding-right: 12px; }
.sv-tab__btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ct-accent); border-radius: 6px; }
.sv-tab__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-tab__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ct-muted); }
.sv-tab__dot--html { background: #e8590c; }
.sv-tab__dot--css { background: #1c7ed6; }
.sv-tab__dot--js { background: #e5b400; }
.sv-tab.is-loading .sv-tab__dot { background: transparent; border: 2px solid var(--ct-accent); border-right-color: transparent; animation: ct-spin .9s linear infinite; }
.sv-tab.is-error .sv-tab__dot { background: var(--ct-err); }
.sv-tab__close { display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin-right: 6px; padding: 0; font-size: 12px; color: var(--ct-muted); background: transparent; border: 0; border-radius: 5px; cursor: pointer; }
.sv-tab__close:hover { color: var(--ct-text); background: var(--ct-surface-2); }
.sv-tab__close:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ct-accent); }

/* pane head */
.sv-pane .ct-pane__head { flex-wrap: wrap; row-gap: 4px; }
.sv-head__file { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 200px; }
.sv-head__name { min-width: 0; font-size: 14px; font-weight: 600; color: var(--ct-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-pane .ct-pane__tools { flex-wrap: wrap; justify-content: flex-end; }
.sv .ct-tool { text-decoration: none; }
.sv .ct-tool:disabled { opacity: .45; cursor: default; background: transparent; }
.sv .ct-tool.is-on { color: var(--ct-accent); background: var(--ct-accent-soft); }
.sv .ct-tool.is-done { color: var(--ct-ok); }
.sv .ct-tool.is-fail { color: var(--ct-err); }

/* find bar */
.sv-findbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; background: var(--ct-surface); border-bottom: 1px solid var(--ct-border); }
.sv-findbar__field { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; height: 32px; margin: 0; padding: 0 10px; background: var(--ct-bg); border: 1px solid var(--ct-border-strong); border-radius: 8px; }
.sv-findbar__field:focus-within { border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.sv-findbar__field i { color: var(--ct-muted); }
.sv-findbar__field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ct-text); font: 13px var(--ct-mono); }
.sv-findbar__field input.is-none { color: var(--ct-err); }
.sv-findbar__count { min-width: 74px; font-size: 12.5px; color: var(--ct-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sv-case { display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.sv-case input { position: absolute; opacity: 0; pointer-events: none; }
.sv-case span { display: grid; place-items: center; height: 30px; padding: 0 9px; font: 600 12.5px var(--ct-mono); color: var(--ct-muted); border: 1px solid transparent; border-radius: 7px; }
.sv-case input:checked + span { color: var(--ct-accent); background: var(--ct-accent-soft); }
.sv-case input:focus-visible + span { border-color: var(--ct-accent); }
.sv-findbar .ct-tool { padding: 0 8px; }

/* notice */
.sv-notice { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13.5px; line-height: 1.45; border-bottom: 1px solid var(--ct-border); }
.sv-notice > i { flex: none; font-size: 17px; }
.sv-notice > span { flex: 1; min-width: 0; }
.sv-notice.is-warn { color: var(--ct-warn); background: color-mix(in srgb, var(--ct-warn) 9%, var(--ct-bg)); }
.sv-notice.is-error { color: var(--ct-err); background: color-mix(in srgb, var(--ct-err) 8%, var(--ct-bg)); }
.sv-notice__btn { flex: none; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 600; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 7px; cursor: pointer; }

.sv-pane .ce { height: clamp(360px, 62vh, 680px); border-radius: 0; }

@media (max-width: 991.98px) {
	.sv-main { grid-template-columns: minmax(0, 1fr); }
	.sv-files { max-height: 260px; }
}
@media (max-width: 575.98px) {
	.sv-form { flex-direction: column; padding: 6px; }
	.sv-field { flex: none; height: 52px; }
	.sv-form .ct-btn { height: 52px; }
	.sv-form .ct-btn { width: 100%; justify-content: center; }
	.sv-page { padding: 12px 14px; }
	.sv-pane .ce { height: 420px; }
	.sv-tab { max-width: 160px; }
	.sv-findbar__count { min-width: 0; }
	.sv-findbar { gap: 4px; padding: 6px 6px 6px 8px; }
	.sv-findbar__field { flex-basis: 100%; }
	.sv-findbar__count { flex: 1; }
}