/* Paneo's own pieces on top of GeoI's frame: the page area's views, the empty home page, the services card. */

/* ---- a view in the page area (home, a new service) ---- */

.pane {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	height: 100dvh;
	background: var(--chat-bg);
}

.pane-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

.pane-body > * {
	max-width: 680px;
	margin-inline: auto;
}

.pane-body > :first-child {
	margin-top: 28px;
}

.pane-body {
	padding: 0 20px 80px;
}

.page-title-icon {
	display: flex;
	align-items: center;
	gap: 10px;
}

.page-title-icon svg {
	color: var(--muted);
}

/* ---- home: the logo, wide, with 「Paneo 服务」 under it ---- */

.home-mark {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	min-height: 0;
	padding: 24px 24px 12vh;
}

.home-logo.brand-logo {
	justify-content: center;
	width: min(560px, 80%);
	height: clamp(72px, 14vw, 140px);
}

.home-logo.brand-logo img {
	object-position: center;
}

.home-logo.brand-text {
	max-width: 100%;
	font-size: clamp(40px, 7vw, 72px);
	line-height: 1.15;
	color: var(--text-strong);
	text-align: center;
	white-space: normal;
	overflow-wrap: anywhere;
}

.home-caption {
	margin: 0;
	color: var(--muted);
	font-size: calc(15px * var(--ui-scale));
	letter-spacing: 0.2em;
}

/* the caption alone (no logo set): a little stronger, it is all there is */
.home-mark > .home-caption:first-child {
	color: var(--text);
	font-size: calc(18px * var(--ui-scale));
}

/* ---- the sidebar: one card of services (GeoI's deck had two) ---- */

.sb-deck-single {
	--sb-peek: 0px;
}

.sb-services-empty {
	padding: 28px 16px;
	text-align: center;
}

.sb-services-empty p {
	margin: 0;
}

.sb-services-empty .sb-empty-hint {
	margin-top: 6px;
	font-size: calc(12px * var(--ui-scale));
}

/* 「新建服务」's card: each kind with its icon */
.sb-kinds .set-nav-item {
	justify-content: flex-start;
	gap: 10px;
}

.sb-kinds .set-nav-item svg {
	flex: none;
	color: var(--muted);
}

.sb-kinds .set-nav-item.is-current svg {
	color: var(--text-strong);
}

/* ---- card 2: the sites ---- */

.sb-svc {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	border-radius: var(--radius);
	color: var(--text);
	text-decoration: none;
}

.sb-svc:hover {
	background: var(--surface-2);
}

.sb-svc.is-current {
	background: var(--surface-2);
	box-shadow: var(--edge-light), var(--elev-1);
	color: var(--text-strong);
}

.sb-svc-icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 1px solid var(--border);
	border-radius: 9px;
	background-color: var(--surface);
	background-image: var(--face);
	box-shadow: var(--edge-light), var(--elev-1);
	color: var(--muted);
}

.sb-svc.is-current .sb-svc-icon {
	color: var(--text-strong);
}

.sb-svc-text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.sb-svc-name,
.sb-svc-sub {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sb-svc.is-current .sb-svc-name {
	font-weight: 500;
}

.sb-svc-sub {
	color: var(--faint);
	font-size: calc(12px * var(--ui-scale));
}

.sb-svc-warn {
	display: flex;
	flex: none;
	color: var(--danger);
}

/* ---- 新建服务 › a site: one card ---- */

.set-below.new-folder {
	flex-direction: row;
	align-items: center;
	gap: 6px;
}

.new-folder > .input {
	flex: 1;
	min-width: 0;
}

.new-root {
	flex: none;
	color: var(--muted);
	font-family: var(--mono);
	font-size: calc(13px * var(--ui-scale));
}

.new-folder-pick {
	display: flex;
	align-items: center;
	gap: 8px;
}

.new-found {
	margin: 0;
	color: var(--ok);
}

.new-form .set-status,
.new-form + .set-status {
	margin-top: 12px;
}

.input.is-invalid {
	border-color: var(--danger);
	box-shadow: 0 0 0 3px var(--danger-bg);
}

/* ---- a site's page: the bar, and the site under it ---- */

.site-pane {
	background: var(--bg);
}

.site-bar {
	display: flex;
	flex: none;
	align-items: center;
	gap: 10px;
	min-height: 56px;
	padding: 8px 70px 8px 18px; /* the account sits in the top-right corner */
	border-bottom: 1px solid var(--border);
	background: var(--chat-bg);
	box-shadow: var(--elev-1);
	position: relative;
	z-index: 1;
}

.site-menu {
	display: none;
}

.site-bar-icon {
	display: flex;
	color: var(--muted);
}

.site-bar-name {
	overflow: hidden;
	margin: 0;
	color: var(--text-strong);
	font-size: calc(16px * var(--ui-scale));
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.site-bar-url {
	overflow: hidden;
	color: var(--muted);
	font-size: calc(13px * var(--ui-scale));
	text-overflow: ellipsis;
	text-underline-offset: 3px;
	white-space: nowrap;
}

.site-bar-url.is-none {
	color: var(--faint);
}

.site-bar-warn {
	display: flex;
	flex: none;
	align-items: center;
	gap: 4px;
	color: var(--danger);
	font-size: calc(13px * var(--ui-scale));
}

.site-bar-spacer {
	flex: 1;
}

.site-scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

.site-frame {
	flex: 1;
	width: 100%;
	min-height: 0;
	border: 0;
	background: #fff;
}

@media (max-width: 767px) {
	.site-bar {
		padding-left: 8px;
	}

	.site-menu {
		display: grid;
	}

	.site-bar-url {
		display: none;
	}
}

/* ---- the dialogs of a site (settings) and of a homepage (a news item, the company's words) ---- */

.modal.he-dialog,
.modal.site-settings {
	width: min(560px, 100%);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
}

.he-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.he-form .modal-title {
	margin-bottom: 2px;
}

.he-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.he-label {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	color: var(--text-strong);
	font-size: calc(13px * var(--ui-scale));
	font-weight: 500;
}

.he-label-hint {
	color: var(--faint);
	font-weight: 400;
}

.he-row {
	display: flex;
	align-items: flex-end;
	gap: 16px;
}

.he-row > :first-child {
	flex: 1;
}

.he-pin {
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
}

.he-body {
	min-height: 180px;
	font-family: var(--mono);
	font-size: calc(13px * var(--ui-scale));
}

.he-picture {
	display: flex;
	align-items: center;
	gap: 14px;
}

.he-picture img,
.he-picture-none {
	flex: none;
	width: 132px;
	height: 74px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	object-fit: cover;
}

.he-picture-none {
	display: grid;
	place-items: center;
	background: var(--surface-2);
	color: var(--faint);
	font-size: calc(12px * var(--ui-scale));
}

.he-picture-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.he-picture-tools .btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.site-folder {
	margin: 0;
	color: var(--muted);
}

.site-folder a {
	margin-left: 8px;
	color: var(--text);
	text-underline-offset: 3px;
}

.site-settings-actions .btn-danger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ---- a site's service: the dot (sidebar, bar), the state, the actions, the log ---- */

.svc-dot {
	display: inline-block;
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--faint);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 0 0 2px var(--surface);
}

.is-running > .svc-dot,
.svc-dot.is-running {
	background: var(--ok);
}

.is-failed > .svc-dot,
.svc-dot.is-failed {
	background: var(--danger);
}

.is-starting > .svc-dot,
.svc-dot.is-starting {
	background: #d99a1e;
	animation: svc-pulse 1.2s ease-in-out infinite;
}

.is-none > .svc-dot,
.svc-dot.is-none {
	background: transparent;
	box-shadow: inset 0 0 0 1.5px var(--faint), 0 0 0 2px var(--surface);
}

@keyframes svc-pulse {
	50% {
		opacity: 0.35;
	}
}

/* the sidebar: the dot sits on the icon's bottom-right corner */
.sb-svc-icon {
	position: relative;
}

.sb-svc-icon .svc-dot {
	position: absolute;
	right: -3px;
	bottom: -3px;
}

.site-status {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 7px;
	padding: 3px 10px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--muted);
	font-size: calc(12.5px * var(--ui-scale));
	white-space: nowrap;
}

.site-status.is-running {
	color: var(--text);
}

.site-status.is-failed {
	border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
	color: var(--danger);
}

.site-act {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 6px;
}

.site-act.is-pressed {
	background: var(--surface-2);
	box-shadow: inset 1px 2px 4px rgb(0 0 0 / 0.12);
}

.site-note {
	display: flex;
	flex: none;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border-bottom: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--text);
	font-size: calc(13px * var(--ui-scale));
}

.site-note svg {
	color: #d99a1e;
}

.site-cmd {
	padding: 2px 8px;
	border-radius: 6px;
	background: var(--surface);
	font-family: var(--mono);
	user-select: all;
}

.site-log {
	display: flex;
	flex: none;
	flex-direction: column;
	max-height: 40vh;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
	box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.06);
}

.site-log-head {
	display: flex;
	align-items: center;
	padding: 6px 12px 6px 18px;
	color: var(--muted);
	font-size: calc(12.5px * var(--ui-scale));
}

.site-log-text,
.site-log-failure {
	margin: 0;
	padding: 0 18px 12px;
	overflow: auto;
	font-family: var(--mono);
	font-size: calc(12px * var(--ui-scale));
	line-height: 1.55;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.site-log-text {
	flex: 1;
	min-height: 0;
}

.site-log-failure {
	flex: none;
	max-height: 30%;
	margin: 0 18px 10px;
	padding: 8px 10px;
	border-radius: var(--radius);
	background: var(--danger-bg);
	color: var(--danger);
}

.site-log-hint {
	font-family: var(--font);
}

.site-bar-actions {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
}

/* phones: the name and state on the first line (the account in the corner), the buttons on a line of their own */
@media (max-width: 767px) {
	.site-bar {
		flex-wrap: wrap;
		row-gap: 8px;
		padding-right: 60px;
	}

	.site-bar-actions {
		flex-basis: 100%;
		margin-right: -52px;
	}

	.site-bar-actions .site-gear {
		margin-left: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.is-starting > .svc-dot,
	.svc-dot.is-starting {
		animation: none;
	}
}

/* ---- a service already on the machine: what it is tied to, and its log ---- */

.svc-body > * {
	max-width: 860px;
}

.svc-value {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	min-width: 0;
	color: var(--text);
	font-size: calc(14px * var(--ui-scale));
	overflow-wrap: anywhere;
}

.svc-value code,
.svc-unit {
	font-family: var(--mono);
	font-size: calc(13px * var(--ui-scale));
}

.svc-none {
	color: var(--faint);
}

.svc-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	color: var(--text-strong);
	font-weight: 500;
	text-underline-offset: 3px;
	overflow-wrap: anywhere;
}

.svc-link svg {
	flex: none;
}

/* allowed or not: a small raised label */
.svc-badge {
	padding: 2px 9px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--muted);
	font-size: calc(12px * var(--ui-scale));
	box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 1px 1px rgb(0 0 0 / 0.06);
}

.svc-badge.is-ok {
	border-color: color-mix(in srgb, var(--ok) 35%, transparent);
	background: var(--ok-bg);
	color: var(--ok);
}

/* the log: a card of its own under the other, always open */
.svc-log {
	display: flex;
	flex-direction: column;
	height: min(62vh, 560px);
	padding: 0;
	overflow: hidden;
}

.svc-log[hidden] {
	display: none;
}

.svc-log-head {
	flex: none;
	padding-top: 10px;
	border-bottom: 1px solid var(--border);
}

.svc-log-text {
	padding-top: 10px;
	box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.05);
}

.svc-log .site-log-failure {
	margin-top: 10px;
}

/* ---- GeoI's or Meol's source: the drop area, the upload, the build ---- */

.src {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.src-drop {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border: 1.5px dashed var(--border-strong, var(--border));
	border-radius: var(--radius-lg);
	background: var(--surface-2);
	box-shadow: inset 1px 2px 5px rgb(0 0 0 / 0.06);
	color: var(--muted);
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s;
}

.src-drop:hover,
.src-drop.is-over {
	border-color: var(--text-strong);
	background: var(--surface);
}

.src-drop-icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.6), 0 1px 2px rgb(0 0 0 / 0.08), 0 2px 6px rgb(0 0 0 / 0.05);
	color: var(--text-strong);
}

.src-drop-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: calc(13px * var(--ui-scale));
}

.src-drop-text strong {
	color: var(--text-strong);
	font-size: calc(14px * var(--ui-scale));
	font-weight: 600;
}

.src-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	min-width: 0;
	font-size: calc(14px * var(--ui-scale));
}

.src-ok {
	color: var(--ok);
}

.src-fail {
	color: var(--danger);
}

.src-last {
	flex: 1 1 10em;
	min-width: 0;
	overflow: hidden;
	color: var(--muted);
	font-family: var(--mono);
	font-size: calc(12px * var(--ui-scale));
	text-overflow: ellipsis;
	white-space: nowrap;
}

.src-toggle {
	margin-left: auto;
}

/* a dot going round: the build (or the upload) under way */
.src-spin {
	flex: none;
	width: 14px;
	height: 14px;
	border: 2px solid color-mix(in srgb, var(--text-strong) 18%, transparent);
	border-top-color: var(--text-strong);
	border-radius: 50%;
	animation: src-spin 0.8s linear infinite;
}

@keyframes src-spin {
	to {
		transform: rotate(360deg);
	}
}

.src-bar {
	flex: 1 1 8em;
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--surface-2);
	box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.12);
}

.src-bar-fill {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(to bottom, color-mix(in srgb, var(--text-strong) 75%, white), var(--text-strong));
	transition: width 0.2s;
}

.src-bar-pct {
	min-width: 3em;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.src-tail {
	max-height: 240px;
	margin: 0;
	padding: 10px 12px;
	overflow: auto;
	border-radius: var(--radius);
	background: var(--surface-2);
	box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.06);
	font-family: var(--mono);
	font-size: calc(12px * var(--ui-scale));
	line-height: 1.5;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.new-form > .src-tail {
	margin-bottom: 12px;
}

@media (prefers-reduced-motion: reduce) {
	.src-spin {
		animation-duration: 2.4s;
	}
}

/* two forms on one new-service page (taking over, or afresh): room between them */
.new-form + .new-form {
	margin-top: 32px;
}

/* 指定账户 in a service's settings: the default switch and how many are allowed */
.he-picked {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.he-picked[hidden] {
	display: none;
}

.he-picked-count {
	margin: 0;
}

.he-picked-count a {
	color: var(--accent);
	text-decoration: none;
}
