/* SAM app layout – the sidebar design. */
html, body.sam-app-body { margin: 0; padding: 0; background: var(--sam-page, #F5F6F8); }
body.sam-app-body {
	font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
	color: #0F1B2D;
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
body.sam-app-body *, body.sam-app-body *::before, body.sam-app-body *::after { box-sizing: border-box; }
body.sam-app-body h1, body.sam-app-body h2, body.sam-app-body h3 { font-family: inherit; color: #0F1B2D; letter-spacing: -0.3px; }

.sam-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 10px 14px; background: #FFFFFF; color: #0F1B2D; border-radius: 8px; }
.sam-skip:focus { left: 8px; }

.sam-app { display: flex; flex-wrap: wrap; min-height: 100vh; }
body.admin-bar .sam-app { min-height: calc(100vh - 32px); }

/* Sidebar */
.sam-side {
	flex: 1 1 240px;
	max-width: 100%;
	background: var(--sam-side, #0F1B2D);
	color: var(--sam-side-text, #FFFFFF);
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}
@media (min-width: 900px) { .sam-side { flex: 0 0 240px; } }
.sam-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: var(--sam-side-text, #FFFFFF); text-decoration: none; }
.sam-brand-mark {
	width: 36px; height: 36px; border-radius: 9px; background: var(--sam-accent, #0B6E6E);
	display: inline-flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 14px; letter-spacing: 0.5px; color: #FFFFFF;
}
.sam-brand-name { font-weight: 600; font-size: 16px; }
.sam-nav { display: flex; flex-direction: column; gap: 2px; }
.sam-nav a {
	display: block; padding: 11px 12px; border-radius: 8px;
	color: var(--sam-side-link, #C6CEDA); text-decoration: none; font-size: 15px; font-weight: 500;
}
.sam-nav a:hover { background: var(--sam-side-hover, #1A2940); color: var(--sam-side-text, #FFFFFF); }
.sam-nav a.is-active { background: var(--sam-side-active, #1F2E44); color: var(--sam-side-text, #FFFFFF); font-weight: 600; }
.sam-nav a:focus-visible { outline: 2px solid var(--sam-side-focus, #5FC4C4); outline-offset: 2px; }
.sam-nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.sam-nav-group-btn {
	display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px;
	background: transparent; color: var(--sam-side-muted, #8C98AA); font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; text-align: left; cursor: pointer;
}
.sam-nav-group-btn:hover { background: var(--sam-side-hover, #1A2940); color: var(--sam-side-text, #FFFFFF); }
.sam-nav-group-btn:focus-visible { outline: 2px solid var(--sam-side-focus, #5FC4C4); outline-offset: 2px; }
.sam-nav-group-btn svg { flex: 0 0 auto; transition: transform 0.15s; transform: rotate(-90deg); }
.sam-nav-group.is-open .sam-nav-group-btn svg { transform: none; }
.sam-nav-group.has-active:not(.is-open) .sam-nav-group-btn { color: var(--sam-side-text, #FFFFFF); }
.sam-nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.sam-nav-group:not(.is-open) .sam-nav-group-items { display: none; }
.sam-nav-group-items a { padding-left: 20px; }
.sam-nav-label { padding: 16px 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--sam-side-muted, #8C98AA); }
/* An open group stands out (1.71): a tinted panel, its heading in the highlight colour with a bar on the left, and a guide line beside its links. */
@media all {
	.sam-nav-group { border-radius: 10px; transition: background-color 0.15s; }
	.sam-nav-group.is-open { background: var(--sam-side-hover, #1A2940); padding-bottom: 6px; }
	.sam-nav-group.is-open .sam-nav-group-btn { background: var(--sam-side-active, #1F2E44); color: var(--sam-side-focus, #5FC4C4); box-shadow: inset 3px 0 0 var(--sam-side-focus, #5FC4C4); border-radius: 10px 10px 4px 4px; }
	.sam-nav-group.is-open .sam-nav-group-btn:hover { color: var(--sam-side-text, #FFFFFF); }
	.sam-nav-group.is-open .sam-nav-group-items { margin: 4px 6px 0 18px; padding-left: 6px; border-left: 1px solid var(--sam-side-active, #2A3A52); }
	.sam-nav-group.is-open .sam-nav-group-items a { padding-left: 12px; }
	.sam-nav-group.is-open .sam-nav-group-items a.is-active { box-shadow: inset 2px 0 0 var(--sam-side-focus, #5FC4C4); }
}
/* The logo row; on phones it also holds the menu button. */
.sam-side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sam-menu-btn { display: none; }
.sam-menu-backdrop { display: none; }

/*
 * Phones and narrow windows (1.71): a slim bar with the logo and a menu button. The button slides the whole sidebar
 * in from the left – the same groups and links as on a computer – over a dimmed page.
 */
@media (max-width: 899px) {
	.sam-side { position: sticky; top: 0; z-index: 50; padding: 10px 12px 10px 16px; gap: 0; }
	.sam-side > .sam-nav, .sam-side > .sam-side-version { display: none; }
	.sam-menu-btn {
		display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1px solid var(--sam-side-active, #2A3A52); border-radius: 10px;
		background: var(--sam-side-hover, #1A2940); color: var(--sam-side-text, #FFFFFF); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
	}
	.sam-menu-btn:focus-visible { outline: 2px solid var(--sam-side-focus, #5FC4C4); outline-offset: 2px; }
	.sam-menu-btn .sam-menu-x { display: none; }
	/* Open */
	body.sam-menu-open { overflow: hidden; }
	body.sam-menu-open .sam-side {
		position: fixed; top: 0; bottom: 0; left: 0; z-index: 1001; width: min(300px, 86vw); max-width: none;
		overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 20px 16px; gap: 20px;
		box-shadow: 12px 0 40px rgba(8, 15, 28, 0.35); animation: sam-menu-in 0.18s ease-out;
	}
	body.admin-bar.sam-menu-open .sam-side { top: 46px; }
	body.sam-menu-open .sam-side > .sam-nav { display: flex; }
	body.sam-menu-open .sam-side > .sam-side-version { display: block; }
	body.sam-menu-open .sam-menu-btn { border-color: transparent; background: transparent; padding: 0 10px; }
	body.sam-menu-open .sam-menu-btn .sam-menu-bars, body.sam-menu-open .sam-menu-btn .sam-menu-word { display: none; }
	body.sam-menu-open .sam-menu-btn .sam-menu-x { display: block; }
	body.sam-menu-open .sam-menu-backdrop { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(15, 27, 45, 0.5); }
	/* Keep the page from jumping when the bar leaves the flow. */
	body.sam-menu-open .sam-body { padding-top: var(--sam-bar-h, 64px); }
}
@keyframes sam-menu-in { from { transform: translateX(-24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body.sam-menu-open .sam-side { animation: none; } }

/* Main column */
.sam-body { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.sam-top {
	background: #FFFFFF; border-bottom: 1px solid var(--sam-line, #E3E6EB);
	padding: 14px 32px;
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.sam-switch { display: flex; align-items: center; gap: 10px; margin: 0; }
.sam-switch label { font-size: 14px; font-weight: 600; color: #5A6474; }
.sam-switch select {
	height: 44px; padding: 0 12px; border: 1px solid #C9CFD8; border-radius: 8px;
	font: inherit; font-size: 15px; background: #FFFFFF; color: #0F1B2D;
}
.sam-switch-one { font-weight: 600; }
.sam-me { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.sam-avatar {
	width: 36px; height: 36px; border-radius: 999px; background: var(--sam-accent-soft, #DDF1EF); color: var(--sam-accent-ink, #0A5C5C);
	display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.sam-me-name { font-weight: 500; }
.sam-me a { color: var(--sam-accent, #0B6E6E); font-size: 14px; font-weight: 500; }

.sam-main { padding: 32px; width: 100%; max-width: 1080px; }
.sam-page-title { margin: 0 0 24px; font-size: 30px; font-weight: 700; }
@media (max-width: 600px) {
	.sam-top, .sam-main { padding-left: 16px; padding-right: 16px; }
}

/* Dashboard */
.sam-dashboard { display: flex; flex-direction: column; gap: 32px; }
.sam-dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.sam-dash-title { margin: 0 0 6px; font-size: 30px; font-weight: 700; line-height: 1.2; }
.sam-dash-sub { margin: 0; font-size: 16px; color: #5A6474; }
.sam-dash-section { display: flex; flex-direction: column; gap: 16px; }
.sam-dash-section h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sam-dash-section .sam { margin: 0; }

.sam-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.sam-card {
	background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); padding: 20px;
	display: flex; flex-direction: column; gap: 10px;
	color: #0F1B2D; text-decoration: none;
	transition: border-color .15s, box-shadow .15s;
}
.sam a.sam-card, .sam a.sam-card:hover { color: #0F1B2D; }
a.sam-card:hover { border-color: #B9C2CE; box-shadow: 0 2px 8px rgba(15, 27, 45, 0.06); }
a.sam-card:focus-visible { outline: 2px solid var(--sam-accent, #0B6E6E); outline-offset: 2px; }
.sam-card-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.sam-card-title { font-size: 16px; font-weight: 600; }
.sam-card-desc { font-size: 14px; color: #5A6474; line-height: 1.5; }
/* Dashboard quick links: smaller boxes, icon beside the title */
.sam-cards-quick { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.sam-cards-quick .sam-card { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; align-items: center; padding: 12px 14px; }
.sam-cards-quick .sam-card-icon { grid-row: span 2; width: 36px; height: 36px; }
.sam-cards-quick .sam-card-title { font-size: 15px; line-height: 1.3; }
.sam-cards-quick .sam-card-desc { font-size: 13px; line-height: 1.35; }
.sam-cards-quick .sam-card:not(:has(.sam-card-desc)) .sam-card-icon { grid-row: auto; }
@media (max-width: 600px) { .sam-cards-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .sam-cards-quick .sam-card { padding: 10px 12px; column-gap: 10px; } .sam-cards-quick .sam-card-desc { display: none; } .sam-cards-quick .sam-card-icon { grid-row: auto; width: 32px; height: 32px; } }
.sam-tone-teal { background: var(--sam-tone-teal-soft, #DDF1EF); color: var(--sam-tone-teal-ink, #0A5C5C); }
.sam-tone-blue { background: var(--sam-tone-blue-soft, #E4ECFB); color: var(--sam-tone-blue-ink, #1D4ED8); }
.sam-tone-amber { background: var(--sam-tone-amber-soft, #FFF1D6); color: var(--sam-tone-amber-ink, #7A4F00); }
.sam-tone-grey { background: var(--sam-tone-grey-soft, #EEF0F3); color: var(--sam-tone-grey-ink, #3E4858); }

/* Sign-in page */
body.sam-login-body { min-height: 100vh; display: flex; flex-direction: column; }
.sam-login-top { background: #FFFFFF; border-bottom: 1px solid var(--sam-line, #E3E6EB); padding: 16px 24px; }
.sam-brand-dark { color: #0F1B2D; }
.sam-brand-dark .sam-brand-mark { color: #FFFFFF; }
.sam-brand-dark:hover { color: #0F1B2D; }
.sam-login-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px; }
.sam-login-card {
	width: 100%; max-width: 440px; background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius-lg, 16px);
	padding: 32px; display: flex; flex-direction: column; gap: 20px;
}
.sam-login-card h1 { margin: 0; font-size: 24px; font-weight: 700; }
.sam-login-intro { margin: -14px 0 0; font-size: 15px; color: #5A6474; }
.sam-login-error { margin: 0; padding: 12px 14px; border-radius: 10px; background: #FDECEC; color: #8A1C1C; font-size: 14px; font-weight: 500; }
.sam-login-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.sam-field { display: flex; flex-direction: column; gap: 6px; }
.sam-field label { font-size: 14px; font-weight: 600; }
.sam-field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sam-field-row a { font-size: 14px; font-weight: 500; }
.sam-field input {
	height: 48px; padding: 0 14px; border: 1px solid #C9CFD8; border-radius: 10px;
	font: inherit; font-size: 16px; color: #0F1B2D; background: #FFFFFF; width: 100%;
}
.sam-field input:focus { outline: none; border-color: var(--sam-accent, #0B6E6E); box-shadow: 0 0 0 3px var(--sam-accent-ring, rgba(11, 110, 110, 0.2)); }
.sam-check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #3E4858; }
.sam-check input { width: 18px; height: 18px; margin: 0; }
.sam-btn-block { width: 100%; height: 48px; font-size: 16px; }
.sam-login-foot { margin: 0; font-size: 14px; color: #5A6474; }
.sam-login-note { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--sam-accent-soft, #DDF1EF); color: var(--sam-accent-ink, #0A5C5C); font-size: 14px; font-weight: 500; }

/* Public pages (Open Forms) */
body.sam-public-body { min-height: 100vh; }
.sam-public-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.sam .sam-btn-dark, .sam-btn.sam-btn-dark { background: #0F1B2D; }
.sam-btn.sam-btn-dark:hover { background: #1F2E44; }
.sam-public-main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 48px 24px 64px; }
.sam-public-main > p { margin: -12px 0 24px; font-size: 17px; color: #4A5464; max-width: 640px; }
.sam-open-forms { margin: 0; }
@media (max-width: 600px) { .sam-public-main { padding: 32px 16px 48px; } }

/* Card icons using your own image */
.sam-card-icon-img { background: #F0F2F5; overflow: hidden; }
.sam-card-icon-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* "Open form" link at the foot of the sign-in card */
.sam a.sam-login-open, a.sam-login-open {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	margin-top: -4px; padding: 14px 16px; border-radius: 10px;
	background: var(--sam-page, #F5F6F8); border: 1px solid var(--sam-line, #E3E6EB);
	color: #0F1B2D; text-decoration: none; font-size: 15px;
}
.sam a.sam-login-open:hover { border-color: #B9C2CE; color: #0F1B2D; }
.sam a.sam-login-open strong { color: var(--sam-accent, #0B6E6E); }

/* Energy dashboard */
.sam-energy { display: flex; flex-direction: column; gap: 28px; }
.sam-en-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.sam-en-h2 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.sam-en-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.sam-en-row .sam-en-h2 { margin: 0; }
.sam a.sam-btn-ghost, .sam-btn.sam-btn-ghost { background: #FFFFFF; color: #0F1B2D !important; border: 1px solid #D5DAE1; }
.sam a.sam-btn-ghost:hover { background: var(--sam-page, #F5F6F8); }

.sam-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--sam-line, #E3E6EB); }
.sam .sam-tabs a { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: #5A6474; text-decoration: none; font-weight: 500; }
.sam .sam-tabs a:hover { color: #0F1B2D; }
.sam .sam-tabs a.is-active { color: #0F1B2D; border-bottom-color: var(--sam-accent, #0B6E6E); font-weight: 600; }

.sam-seg { display: inline-flex; gap: 4px; padding: 4px; background: #EEF0F3; border-radius: 10px; }
.sam .sam-seg a { padding: 8px 14px; border-radius: 8px; color: #5A6474; text-decoration: none; font-size: 14px; font-weight: 600; }
.sam .sam-seg a.is-active { background: #FFFFFF; color: #0F1B2D; box-shadow: 0 1px 2px rgba(15, 27, 45, 0.12); }

.sam-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.sam-tile { background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.sam-tile-name { font-weight: 600; font-size: 15px; }
.sam-tile-kind { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: #5A6474; }
.sam-tile-value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.sam-tile-value small { font-size: 15px; font-weight: 500; color: #5A6474; letter-spacing: 0; }
.sam-tile-use { font-size: 14px; color: #3E4858; }
.sam-tile-use strong { color: #0F1B2D; font-variant-numeric: tabular-nums; }
.sam-tile-time { font-size: 13px; color: #5A6474; margin-top: 6px; }

.sam-en-group { font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: #5A6474; margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--sam-line, #E3E6EB); }
.sam-en-h2 + .sam-en-group, .sam-en-row + .sam-en-group, .sam-en-day + .sam-en-group { margin-top: 6px; }
.sam-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.sam-chart { margin: 0; background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); padding: 18px 20px; }
.sam-chart figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.sam-chart-name { font-weight: 600; font-size: 15px; }
.sam-chart-sub { font-size: 13px; color: #5A6474; }
.sam-chart-total { margin-left: auto; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sam-chart-empty { margin: 24px 0; color: #5A6474; font-size: 14px; }
.sam-bars { display: block; width: 100%; height: auto; overflow: visible; }
.sam-bars .sam-grid { stroke: #EEF0F3; stroke-width: 1; }
.sam-bars .sam-base { stroke: #C9CFD8; stroke-width: 1; }
.sam-bars .sam-axis { fill: #5A6474; font-size: 14px; font-family: inherit; }
.sam-bars .sam-bar-fill { fill: var(--sam-accent, #0B6E6E); }
.sam-bars .sam-hit { fill: transparent; }
.sam-bars .sam-bar:hover .sam-bar-fill { fill: var(--sam-accent-dark, #085454); }
.sam-bars .sam-bar:hover .sam-hit { fill: rgba(15, 27, 45, 0.04); }
.sam-chart-table { margin-top: 10px; font-size: 14px; }
.sam-chart-table summary { cursor: pointer; color: var(--sam-accent, #0B6E6E); font-weight: 500; }
.sam-chart-table .sam-table { margin-top: 8px; min-width: 0; }
.sam-chart-table .sam-table th, .sam-chart-table .sam-table td { padding: 8px 12px; }

/* CHP manual readings panel */
.sam-chp { background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); }
.sam-chp > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 16px 20px; font-weight: 600; font-size: 16px; }
.sam-chp > summary::-webkit-details-marker { display: none; }
.sam-chp > summary::before { content: "+"; display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 6px; background: var(--sam-accent-soft, #DDF1EF); color: var(--sam-accent-ink, #0A5C5C); font-weight: 700; }
.sam-chp[open] > summary::before { content: "–"; }
.sam-chp-hint { font-weight: 400; font-size: 14px; color: #5A6474; }
.sam-chp .sam-notice { margin: 0 20px 12px; }
.sam-chp-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 0 20px 20px; margin: 0; }
.sam-chp-form .sam-field input { height: 48px; padding: 0 14px; border: 1px solid #C9CFD8; border-radius: 10px; font: inherit; font-size: 16px; width: 100%; background: #FFFFFF; color: #0F1B2D; }
.sam-chp-form .sam-field input:focus { outline: none; border-color: var(--sam-accent, #0B6E6E); box-shadow: 0 0 0 3px var(--sam-accent-ring, rgba(11, 110, 110, 0.2)); }
.sam-chp-form .sam-field label { font-size: 14px; font-weight: 600; }
.sam-chp-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px; }

/* Appearance: logos */
.sam-brand-logo { display: block; height: var(--sam-logo-h, 36px); width: auto; max-width: 180px; object-fit: contain; }
.sam-brand-mark { background: var(--sam-accent, #0B6E6E); min-width: 36px; width: auto; padding: 0 6px; }
.sam-top-site { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sam-site-logo { display: block; height: 36px; width: auto; max-width: 140px; object-fit: contain; }
.sam-login-logo { display: block; height: calc(var(--sam-logo-h, 36px) * 1.5); width: auto; max-width: 100%; object-fit: contain; align-self: flex-start; }
.sam-en-title { display: flex; align-items: center; gap: 14px; }
.sam-en-logo { display: block; height: 40px; width: auto; max-width: 160px; object-fit: contain; }

/* Appearance: box colours (one set of variables per colour name) */
.sam-card-tone-teal   { --t-soft: var(--sam-tone-teal-soft, #DDF1EF);   --t-ink: var(--sam-tone-teal-ink, #0A5C5C);   --t-solid: var(--sam-tone-teal-solid, #0B6E6E);   --t-on: var(--sam-tone-teal-on, #FFFFFF); }
.sam-card-tone-blue   { --t-soft: var(--sam-tone-blue-soft, #E4ECFB);   --t-ink: var(--sam-tone-blue-ink, #1D4ED8);   --t-solid: var(--sam-tone-blue-solid, #1D4ED8);   --t-on: var(--sam-tone-blue-on, #FFFFFF); }
.sam-card-tone-amber  { --t-soft: var(--sam-tone-amber-soft, #FFF1D6);  --t-ink: var(--sam-tone-amber-ink, #7A4F00);  --t-solid: var(--sam-tone-amber-solid, #B45309);  --t-on: var(--sam-tone-amber-on, #FFFFFF); }
.sam-card-tone-grey   { --t-soft: var(--sam-tone-grey-soft, #EEF0F3);   --t-ink: var(--sam-tone-grey-ink, #3E4858);   --t-solid: var(--sam-tone-grey-solid, #4A5464);   --t-on: var(--sam-tone-grey-on, #FFFFFF); }
.sam-card-tone-green  { --t-soft: var(--sam-tone-green-soft, #DCEFE2);  --t-ink: var(--sam-tone-green-ink, #12652F);  --t-solid: var(--sam-tone-green-solid, #15803D);  --t-on: var(--sam-tone-green-on, #FFFFFF); }
.sam-card-tone-purple { --t-soft: var(--sam-tone-purple-soft, #EAE1F9); --t-ink: var(--sam-tone-purple-ink, #5B21B6); --t-solid: var(--sam-tone-purple-solid, #6D28D9); --t-on: var(--sam-tone-purple-on, #FFFFFF); }
.sam-card-tone-red    { --t-soft: var(--sam-tone-red-soft, #F6DEDE);    --t-ink: var(--sam-tone-red-ink, #991B1B);    --t-solid: var(--sam-tone-red-solid, #B91C1C);    --t-on: var(--sam-tone-red-on, #FFFFFF); }
.sam-tone-green  { background: var(--sam-tone-green-soft, #DCEFE2);  color: var(--sam-tone-green-ink, #12652F); }
.sam-tone-purple { background: var(--sam-tone-purple-soft, #EAE1F9); color: var(--sam-tone-purple-ink, #5B21B6); }
.sam-tone-red    { background: var(--sam-tone-red-soft, #F6DEDE);    color: var(--sam-tone-red-ink, #991B1B); }

/* Tinted boxes: the whole box takes the light shade */
.sam-cards-tinted .sam-card { background: var(--t-soft); border-color: transparent; }
.sam .sam-cards-tinted a.sam-card, .sam .sam-cards-tinted a.sam-card:hover, .sam-cards-tinted .sam-card { color: var(--t-ink); }
.sam-cards-tinted .sam-card-desc { color: var(--t-ink); }
.sam-cards-tinted .sam-card-icon { background: var(--sam-surface, #FFFFFF); color: var(--t-ink); }
.sam-cards-tinted a.sam-card:hover { border-color: var(--t-ink); box-shadow: none; }

/* Solid boxes: the whole box is filled with the colour */
.sam-cards-solid .sam-card { background: var(--t-solid); border-color: transparent; }
.sam .sam-cards-solid a.sam-card, .sam .sam-cards-solid a.sam-card:hover, .sam-cards-solid .sam-card { color: var(--t-on); }
.sam-cards-solid .sam-card-desc { color: var(--t-on); }
.sam-cards-solid .sam-card-icon { background: rgba(255, 255, 255, 0.18); color: var(--t-on); }
.sam-cards-solid .sam-card-icon-img { background: #FFFFFF; }
.sam-cards-solid a.sam-card:hover { box-shadow: 0 4px 14px rgba(15, 27, 45, 0.18); }
.sam-cards-solid a.sam-card:focus-visible { outline-color: var(--t-solid); outline-offset: 3px; }

/* Dashboard: headline numbers, projects and H&S panels */
.sam-dash-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sam-dash-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
a.sam-kpi { text-decoration: none; color: var(--sam-ink, #0F1B2D); transition: border-color .15s, box-shadow .15s; }
.sam a.sam-kpi, .sam a.sam-kpi:hover { color: var(--sam-ink, #0F1B2D); }
a.sam-kpi:hover { border-color: #B9C2CE; box-shadow: 0 2px 8px rgba(15, 27, 45, 0.06); }
a.sam-kpi:focus-visible { outline: 2px solid var(--sam-accent, #0B6E6E); outline-offset: 2px; }
.sam-kpi .sam-hs-chip { margin: -2px 0 2px; }
.sam-kpi.is-warn .sam-tile-use { color: #8A1C1C; font-weight: 600; }

.sam-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.sam-dash-panel { background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sam-dash-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sam-dash-panel-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sam-dash-panel-head a { font-size: 14px; font-weight: 600; }
.sam-dash-h3 { margin: 8px 0 0; font-size: 13px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--sam-muted, #5A6474); }
.sam-dash-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #EEF0F3; color: #3E4858; font-size: 12px; text-align: center; letter-spacing: 0; }
.sam-dash-none { margin: 0; font-size: 14px; color: var(--sam-muted, #5A6474); }

.sam-dash-status { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0 0 4px; list-style: none; font-size: 14px; }
.sam-dash-status a { color: var(--sam-ink, #0F1B2D); text-decoration: none; }
.sam-dash-status a:hover { text-decoration: underline; }
.sam-dash-status strong { font-variant-numeric: tabular-nums; }

.sam-dash-tasks, .sam-dash-hs { margin: 0; padding: 0; list-style: none; }
.sam-dash-tasks li, .sam-dash-hs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--sam-line-soft, #EEF0F3); }
.sam-dash-tasks li:first-child, .sam-dash-hs li:first-child { border-top: 0; }
.sam a.sam-dash-task { display: flex; flex-direction: column; min-width: 0; text-decoration: none; color: var(--sam-ink, #0F1B2D); }
.sam a.sam-dash-task:hover .sam-dash-task-t { text-decoration: underline; }
.sam-dash-task-t { font-weight: 600; font-size: 15px; }
.sam-dash-task-p { display: block; font-size: 13px; color: var(--sam-muted, #5A6474); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sam-dash-due { flex: 0 0 auto; font-size: 13px; font-weight: 600; color: #3E4858; white-space: nowrap; }
.sam-dash-due.is-late { color: #B42318; }

.sam-dash-hs-site { min-width: 0; font-weight: 600; font-size: 15px; }
.sam-dash-hs-score { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sam-dash-hs-score > a { font-size: 20px; font-weight: 700; text-decoration: none; color: var(--sam-ink, #0F1B2D); font-variant-numeric: tabular-nums; }
.sam .sam-dash-hs-score > a:hover { text-decoration: underline; color: var(--sam-ink, #0F1B2D); }
.sam-dash-delta { font-size: 13px; color: var(--sam-muted, #5A6474); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sam .sam-dash-start { font-size: 14px; font-weight: 600; }
@media (max-width: 600px) {
	.sam-dash-hs li { flex-wrap: wrap; }
	.sam-dash-delta { display: none; }
}
.sam .sam-dash-hs-score > a.sam-dash-start { font-size: 14px; font-weight: 600; color: var(--sam-accent, #0B6E6E); text-decoration: underline; }
@media (max-width: 600px) { .sam-dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .sam-dash-kpis .sam-tile { padding: 14px; } .sam-dash-kpis .sam-tile-value { font-size: 24px; } }

/* "Admin" sub-heading in the sidebar: bolder, brighter, with a dividing line above */
.sam-nav-label {
	margin-top: 14px; padding: 16px 12px 8px;
	border-top: 1px solid var(--sam-side-active, #1F2E44);
	font-size: 13px; font-weight: 800; letter-spacing: 1px;
	color: var(--sam-side-text, #FFFFFF);
}

/* Energy contracts & rates */
.sam-rates .sam-tile-name { font-size: 16px; }
.sam-rate-supplier { font-weight: 500; color: #5A6474; }
.sam-rate-list { margin: 6px 0 2px; display: flex; flex-direction: column; gap: 6px; }
.sam-rate-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--sam-line-soft, #EEF0F3); padding-bottom: 6px; }
.sam-rate-list dt { font-size: 14px; color: #3E4858; }
.sam-rate-list dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sam-rate-list dd small { font-size: 13px; font-weight: 500; color: #5A6474; }
.sam-rate-chip { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.sam-rate-chip.is-green { background: #DCEFE2; color: #12652F; }
.sam-rate-chip.is-amber { background: #FFF1D6; color: #7A4F00; }
.sam-rate-chip.is-red { background: #FDECEC; color: #8A1C1C; }
.sam-rate-chip.is-blue { background: #E3EDFA; color: #1D4F91; }
.sam-rate-edit { margin-top: 16px; background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); padding: 14px 20px; }
.sam-rate-edit > summary { cursor: pointer; font-weight: 600; color: var(--sam-accent, #0B6E6E); }
.sam-rate-edit form { display: flex; flex-direction: column; gap: 18px; margin: 16px 0 4px; }
.sam-rate-edit form > .sam-btn { align-self: flex-start; }
.sam-rate-set { margin: 0; padding: 14px 16px; border: 1px solid var(--sam-line, #E3E6EB); border-radius: 12px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sam-rate-set legend { padding: 0 6px; font-weight: 700; }
.sam-rate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px 16px; }
.sam-rate-pair { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.sam-rate-edit .sam-field { font-size: 14px; font-weight: 600; }
.sam-rate-edit .sam-field input { min-height: 44px; padding: 8px 12px; border: 1px solid #C9CFD8; border-radius: 10px; font: inherit; font-weight: 400; font-size: 16px; width: 100%; background: #FFFFFF; }
.sam-rate-edit .sam-field input:focus { outline: none; border-color: var(--sam-accent, #0B6E6E); box-shadow: 0 0 0 3px var(--sam-accent-ring, rgba(11, 110, 110, 0.2)); }
.sam-en-day { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 14px; }
.sam-en-day input[type=date] { min-height: 40px; padding: 6px 10px; border: 1px solid #C9CFD8; border-radius: 8px; font: inherit; background: #FFFFFF; }
.sam-en-day .sam-btn { min-width: 44px; justify-content: center; }
.sam-en-dayname { font-weight: 600; color: var(--sam-ink, #0F1B2D); }
.sam-dash-sub-h { margin: 14px 0 4px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--sam-muted, #5A6474); }
.sam-rate-chip.is-grey { background: #EEF0F3; color: #3E4858; }
.sam-rate-next { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #F1F6FD; border: 1px solid #D3E1F5; display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: #1F2A3A; }
.sam-rate-next strong { color: #1D4F91; }
.sam-rate-history { margin-top: 16px; background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-radius: var(--sam-radius, 14px); padding: 14px 20px; }
.sam-rate-history > summary { cursor: pointer; font-weight: 600; color: var(--sam-accent, #0B6E6E); }
.sam-rate-history .sam-table td { vertical-align: top; }
.sam-rate-history .sam-rate-chip { margin-top: 0; white-space: nowrap; }
.sam-rate-add > summary, .sam-rate-one > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.sam-rate-add > summary { color: var(--sam-accent, #0B6E6E); }
.sam-rate-one { border-top: 1px solid var(--sam-line-soft, #EEF0F3); padding-top: 4px; }
.sam-rate-edit .sam-rate-form { display: flex; flex-direction: column; gap: 14px; margin: 10px 0 8px; }
.sam-rate-edit .sam-rate-form .sam-pr-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sam-notice.is-warn { background: #FFF1D6; color: #7A4F00; }
.sam-rate-edit .sam-field input { box-sizing: border-box; min-width: 0; }
.sam-choose .sam-cards { margin-top: 8px; }
.sam-card-go { margin-top: auto; font-size: 14px; font-weight: 600; color: var(--sam-accent, #0B6E6E); }
.sam-rates-all td, .sam-rates-all th { vertical-align: top; }
.sam-rates-all .sam-rate-chip { margin-top: 6px; }
.sam-rates-next-note { display: inline-block; margin-top: 6px; font-size: 13px; color: #1D4F91; font-weight: 600; }
.sam-rates-all tbody th { font-size: 15px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--sam-line-soft, #EEF0F3); }

/* Version number at the foot of the sidebar */
.sam-side-version { margin-top: auto; padding: 18px 12px 6px; font-size: 11px; letter-spacing: .4px; color: var(--sam-side-muted, #8C98AA); }
.sam-side-version a { color: inherit; text-decoration: none; }
.sam-side-version a:hover { text-decoration: underline; }

/* Capitalisation: field labels, table headings, buttons, tabs, menu items and page headings in Title Case.
   Wrapped in :where() so any heading styled in capitals (e.g. section headers) keeps that style. */
:where(.sam .sam-field > label, .sam .sam-filters > label, .sam .sam-po-ml, .sam th, .sam .sam-tabs a, .sam .sam-btn,
	.sam .sam-dash-title, .sam .sam-stock-h2, .sam .sam-stock-h3, .sam .sam-sf-h2, .sam .sam-card-title, .sam-page-title, .sam-nav a) { text-transform: capitalize; }
/* …but not the small notes inside labels, ticked-box sentences, or anything typed by people. */
.sam .sam-field > label .sam-muted,
.sam .sam-filters > label .sam-muted,
.sam th .sam-muted,
.sam .sam-check { text-transform: none; }
.sam label input, .sam label select, .sam label textarea { text-transform: none; }

/* Install SAM as an app (dashboard hint, assets/pwa.js) */
.sam-install { display: flex; align-items: center; gap: 12px; background: var(--sam-surface, #FFFFFF); border: 1px solid var(--sam-line, #E3E6EB); border-left: 4px solid var(--sam-accent, #0B6E6E); border-radius: var(--sam-radius, 14px); padding: 12px 12px 12px 16px; }
.sam-install[hidden] { display: none; }
.sam-install-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.sam-install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: #5A6474; }
.sam-install-text strong { color: var(--sam-ink, #0F1B2D); }
.sam-install-text > strong { font-size: 15px; }
.sam button.sam-install-go { flex: none; min-height: 40px; padding: 0 18px; }
.sam button.sam-install-go[hidden] { display: none; }
.sam button.sam-install-x { flex: none; width: 40px; height: 40px; border: 0; background: transparent; color: #5A6474 !important; font-size: 24px; line-height: 1; border-radius: 10px; cursor: pointer; padding: 0; }
.sam button.sam-install-x:hover { background: #F0F2F5; }
@media (max-width: 480px) { .sam-install { flex-wrap: wrap; } .sam-install-text { flex-basis: calc(100% - 104px); } .sam button.sam-install-go { order: 3; width: 100%; } }
