/**
 * KE Ticino Portal — foundation.
 *
 * Tokens, reset, layout primitives and the components shared across every
 * screen. Loaded on all pages; screen-specific stylesheets layer on top.
 *
 * Organised ITCSS-style, broadest to most specific: settings, generic,
 * elements, objects, components, utilities. Specificity climbs in one direction
 * only, so nothing here needs `!important` to win.
 *
 * The palette mirrors `theme.json`. Tokens are re-declared as custom properties
 * because WordPress only emits its preset variables when global styles load —
 * which `Cleanup` dequeues on portal screens, since blocks do not render there.
 *
 * Light-only by design: the mockups define a single approved appearance, and a
 * dark variant nobody has reviewed is a liability on a branded internal tool.
 */

/* ==========================================================================
   Settings — design tokens
   ========================================================================== */

:root {
	/* Brand */
	--ke-brand: #c1121f;
	--ke-brand-dark: #9a0e19;
	--ke-brand-tint: #fdf2f3;

	/* Ink */
	--ke-ink: #18181b;
	--ke-ink-soft: #3f3f46;
	--ke-ink-muted: #71717a;
	--ke-ink-faint: #a1a1aa;

	/* Surfaces */
	--ke-surface: #ffffff;
	--ke-surface-sunken: #f4f4f5;
	--ke-surface-raised: #fafafa;
	--ke-footer: #27272a;

	/* Lines */
	--ke-border: #e4e4e7;
	--ke-border-strong: #d4d4d8;

	/* Status. Shared by pills, calendar cells, legend swatches and stat tiles
	   so a status reads identically everywhere it appears. */
	--ke-success: #16a34a;
	--ke-success-bg: #dcfce7;
	--ke-warning: #b45309;
	--ke-warning-bg: #fef3c7;
	--ke-danger: #b91c1c;
	--ke-danger-bg: #fee2e2;
	--ke-info: #1d4ed8;
	--ke-info-bg: #dbeafe;
	--ke-neutral: #52525b;
	--ke-neutral-bg: #f4f4f5;

	/* Type */
	--ke-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--ke-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--ke-text-xs: 0.8125rem;
	--ke-text-sm: 0.875rem;
	--ke-text-base: 1rem;
	--ke-text-lg: 1.125rem;
	--ke-text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
	--ke-text-2xl: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);

	/* Space */
	--ke-space-1: 0.25rem;
	--ke-space-2: 0.5rem;
	--ke-space-3: 0.75rem;
	--ke-space-4: 1rem;
	--ke-space-5: 1.25rem;
	--ke-space-6: 1.5rem;
	--ke-space-8: 2rem;
	--ke-space-12: 3rem;

	/* Shape */
	--ke-radius-sm: 6px;
	--ke-radius: 10px;
	--ke-radius-lg: 14px;
	--ke-radius-pill: 999px;

	--ke-shadow-card: 0 1px 2px rgb(24 24 27 / 4%);
	--ke-shadow-raised: 0 8px 30px rgb(24 24 27 / 12%);

	/* Layout.
	   The manager shell is `var(--ke-sidebar) minmax(0, 1fr)`, so narrowing the
	   rail hands every millimetre straight to the content column; widening the
	   container then adds to both edges. The rail only ever holds seven short
	   nav labels and does not earn more than this. */
	--ke-container: 88rem;
	--ke-rail: 22rem;
	--ke-sidebar: 12.5rem;
	/* Matches the mockup's header band: a ~50px logo in an ~88px bar. */
	--ke-header-height: 5.5rem;
}

/* ==========================================================================
   Generic — reset
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	font-family: var(--ke-font);
	font-size: var(--ke-text-base);
	line-height: 1.6;
	color: var(--ke-ink);
	background: var(--ke-surface-sunken);
	-webkit-font-smoothing: antialiased;
}

img,
svg {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

h1, h2, h3, h4 {
	margin: 0 0 var(--ke-space-3);
	line-height: 1.25;
	font-weight: 700;
}

p { margin: 0 0 var(--ke-space-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--ke-brand); }
a:hover { text-decoration: underline; }

/* A single, consistent focus ring. Never removed — this is an internal tool
   used daily, and keyboard navigation is how power users move through it. */
:focus-visible {
	outline: 2px solid var(--ke-brand);
	outline-offset: 2px;
	border-radius: 3px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.ke-skip-link {
	position: absolute;
	top: -100%;
	left: var(--ke-space-4);
	z-index: 200;
	padding: var(--ke-space-3) var(--ke-space-4);
	background: var(--ke-surface);
	border-radius: 0 0 var(--ke-radius-sm) var(--ke-radius-sm);
	box-shadow: var(--ke-shadow-raised);
	text-decoration: none;
	font-weight: 600;
}

.ke-skip-link:focus { top: 0; }

/* ==========================================================================
   Objects — layout
   ========================================================================== */

.ke-main {
	flex: 1 0 auto;
	width: 100%;
}

.ke-shell {
	max-width: var(--ke-container);
	margin-inline: auto;
	padding: var(--ke-space-6) var(--ke-space-4);
}

.ke-shell__content { min-width: 0; }

/* Manager screens gain the persistent left rail from the dashboard mockup. */
@media (min-width: 64rem) {
	.ke-shell--manager {
		display: grid;
		grid-template-columns: var(--ke-sidebar) minmax(0, 1fr);
		gap: var(--ke-space-6);
		align-items: start;
	}
}

/* Content plus a right-hand rail — the calendar and dashboard layouts. */
.ke-layout { display: grid; gap: var(--ke-space-5); }

@media (min-width: 64rem) {
	.ke-layout--rail {
		grid-template-columns: minmax(0, 1fr) var(--ke-rail);
		align-items: start;
	}
}

.ke-rail,
.ke-stack {
	display: grid;
	gap: var(--ke-space-5);
	align-content: start;
	min-width: 0;
}

.ke-screen__header { margin-bottom: var(--ke-space-5); }
.ke-screen__title { font-size: var(--ke-text-2xl); margin-bottom: var(--ke-space-1); }
.ke-screen__subtitle { color: var(--ke-ink-muted); font-size: var(--ke-text-sm); margin: 0; }

.ke-page__header { margin-bottom: var(--ke-space-5); }
.ke-page__title { font-size: var(--ke-text-2xl); }

.ke-prose { max-width: 45rem; }
.ke-prose h2 { margin-top: var(--ke-space-8); font-size: var(--ke-text-xl); }
.ke-prose ul, .ke-prose ol { padding-left: 1.4em; }
.ke-prose li { margin-bottom: var(--ke-space-2); }

/* ==========================================================================
   Components — header
   ========================================================================== */

.ke-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--ke-surface);
	border-bottom: 1px solid var(--ke-border);
}

.ke-header__inner {
	max-width: var(--ke-container);
	margin-inline: auto;
	min-height: var(--ke-header-height);
	padding: var(--ke-space-3) var(--ke-space-4);
	display: flex;
	align-items: center;
	gap: var(--ke-space-4);
	flex-wrap: wrap;
}

/* Generous gap either side of the divider, as in the mockup. */
.ke-brand { display: flex; align-items: center; gap: var(--ke-space-5); min-width: 0; }
.ke-brand__link { display: inline-flex; flex: none; }

/*
 * Constrained on both axes so the bundled wide mark and an arbitrary uploaded
 * logo of any proportion both sit correctly in the header. `height: auto`
 * overrides the intrinsic height attribute, which is present purely to reserve
 * space and prevent the header reflowing as the image decodes.
 */
.ke-brand__logo {
	max-height: 3.125rem;
	max-width: 15rem;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Fallback mark when no custom logo is set. */
.ke-brand__mark {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	background: var(--ke-brand);
	color: #fff;
	font-weight: 700;
	letter-spacing: 0.04em;
	border-radius: var(--ke-radius-sm);
}

/*
 * Full-height hairline between the company mark and the portal name, keeping
 * the two identities visually separate — this is the Keys.Express logo applied
 * to a system called Ticino Flat Booking, not one combined lockup.
 */
.ke-brand__divider {
	width: 1px;
	align-self: stretch;
	min-height: 3rem;
	margin-block: var(--ke-space-1);
	background: var(--ke-border);
}

.ke-brand__titles { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }

/*
 * Medium weight, not bold. In the mockup the portal name reads as a calm
 * wordmark beside the logo; at 700 it competes with the logo for attention.
 */
.ke-brand__title {
	font-size: 1.375rem;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #636363;
}

.ke-brand__subtitle {
	font-size: 0.9375rem;
	color: var(--ke-ink-muted);
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 47.999rem) {
	.ke-brand { gap: var(--ke-space-3); }
	.ke-brand__logo { max-height: 2.5rem; max-width: 10rem; }
	.ke-brand__title { font-size: var(--ke-text-lg); }
	.ke-brand__subtitle { font-size: var(--ke-text-xs); }
}

/* Narrower than this the two identities crowd each other; drop the rule
   rather than shrink it to a stub. */
@media (max-width: 35.999rem) {
	.ke-brand__divider { display: none; }
	.ke-brand__logo { max-height: 2.25rem; max-width: 8.5rem; }
}

.ke-header__meta {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: var(--ke-space-5);
}

/* Trust strip */
.ke-trust {
	display: none;
	align-items: center;
	gap: var(--ke-space-2);
	margin: 0;
	font-size: var(--ke-text-sm);
	color: var(--ke-ink-soft);
	white-space: nowrap;
}

.ke-trust__icon { color: var(--ke-brand); flex: none; }
.ke-trust__dot { color: var(--ke-brand); }

@media (min-width: 60rem) {
	.ke-trust { display: flex; }
}

/* Navigation */
.ke-nav__list {
	display: flex;
	gap: var(--ke-space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ke-nav__link {
	display: inline-flex;
	align-items: center;
	gap: var(--ke-space-2);
	padding: var(--ke-space-2) var(--ke-space-3);
	border-radius: var(--ke-radius-sm);
	color: var(--ke-ink-soft);
	font-size: var(--ke-text-sm);
	font-weight: 500;
	text-decoration: none;
}

.ke-nav__link:hover { background: var(--ke-surface-sunken); text-decoration: none; }

.ke-nav__link.is-current {
	color: var(--ke-brand);
	background: var(--ke-brand-tint);
	font-weight: 600;
}

/* Collapsed navigation on small screens. */
.ke-header__toggle {
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	background: none;
	border: 1px solid var(--ke-border);
	border-radius: var(--ke-radius-sm);
	cursor: pointer;
}

.ke-header__toggle-bars,
.ke-header__toggle-bars::before,
.ke-header__toggle-bars::after {
	display: block;
	width: 1rem;
	height: 2px;
	background: var(--ke-ink);
	border-radius: 2px;
}

.ke-header__toggle-bars { position: relative; }
.ke-header__toggle-bars::before,
.ke-header__toggle-bars::after { content: ""; position: absolute; }
.ke-header__toggle-bars::before { top: -5px; }
.ke-header__toggle-bars::after { top: 5px; }

@media (max-width: 47.999rem) {
	.ke-nav {
		order: 10;
		flex-basis: 100%;
		display: none;
	}

	.ke-nav.is-open { display: block; }
	.ke-nav__list { flex-direction: column; }
}

@media (min-width: 48rem) {
	.ke-header__toggle { display: none; }
}

/* Account menu */
.ke-account { position: relative; }
.ke-account > summary::-webkit-details-marker { display: none; }

.ke-account__trigger {
	display: flex;
	align-items: center;
	gap: var(--ke-space-2);
	padding: var(--ke-space-1) var(--ke-space-2);
	border-radius: var(--ke-radius-pill);
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.ke-account__trigger:hover { background: var(--ke-surface-sunken); }

.ke-account__avatar {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: var(--ke-surface-sunken);
	color: var(--ke-ink-soft);
	font-weight: 600;
	font-size: var(--ke-text-sm);
	flex: none;
}

.ke-account__name { font-size: var(--ke-text-sm); font-weight: 500; }
.ke-account[open] .ke-account__chevron { transform: rotate(180deg); }

@media (max-width: 35.999rem) {
	.ke-account__name { display: none; }
}

.ke-account__menu {
	position: absolute;
	right: 0;
	top: calc(100% + var(--ke-space-2));
	min-width: 15rem;
	padding: var(--ke-space-2);
	background: var(--ke-surface);
	border: 1px solid var(--ke-border);
	border-radius: var(--ke-radius);
	box-shadow: var(--ke-shadow-raised);
	z-index: 120;
}

.ke-account__identity {
	padding: var(--ke-space-2) var(--ke-space-3) var(--ke-space-3);
	border-bottom: 1px solid var(--ke-border);
	margin-bottom: var(--ke-space-2);
	display: flex;
	flex-direction: column;
}

.ke-account__full-name { font-weight: 600; font-size: var(--ke-text-sm); }
.ke-account__email { font-size: var(--ke-text-xs); color: var(--ke-ink-muted); overflow-wrap: anywhere; }

.ke-account__item {
	display: block;
	padding: var(--ke-space-2) var(--ke-space-3);
	border-radius: var(--ke-radius-sm);
	color: var(--ke-ink-soft);
	font-size: var(--ke-text-sm);
	text-decoration: none;
}

.ke-account__item:hover { background: var(--ke-surface-sunken); text-decoration: none; }
.ke-account__item--signout { color: var(--ke-brand); font-weight: 600; }

/* ==========================================================================
   Components — cards
   ========================================================================== */

.ke-card {
	background: var(--ke-surface);
	border: 1px solid var(--ke-border);
	border-radius: var(--ke-radius);
	box-shadow: var(--ke-shadow-card);
	padding: var(--ke-space-5);
}

.ke-card--flush { padding: 0; overflow: hidden; }
.ke-card--accent { border-left: 3px solid var(--ke-brand); }

.ke-card__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ke-space-4);
	flex-wrap: wrap;
	margin-bottom: var(--ke-space-4);
}

.ke-card--flush .ke-card__bar {
	padding: var(--ke-space-5) var(--ke-space-5) 0;
	margin-bottom: var(--ke-space-4);
}

.ke-card__header {
	display: flex;
	align-items: flex-start;
	gap: var(--ke-space-3);
	margin-bottom: var(--ke-space-3);
}

.ke-card__icon {
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: var(--ke-surface-sunken);
	color: var(--ke-ink-soft);
	flex: none;
}

.ke-card__heading { font-size: var(--ke-text-lg); margin: 0; }

.ke-card__rule {
	display: block;
	width: 2rem;
	height: 2px;
	margin-top: var(--ke-space-2);
	background: var(--ke-brand);
	border-radius: 2px;
}

.ke-card__note {
	display: flex;
	align-items: center;
	gap: var(--ke-space-2);
	padding: var(--ke-space-3) var(--ke-space-5);
	border-top: 1px solid var(--ke-border);
	background: var(--ke-surface-raised);
	color: var(--ke-ink-muted);
	font-size: var(--ke-text-xs);
}

/* ==========================================================================
   Components — buttons
   ========================================================================== */

.ke-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ke-space-2);
	padding: 0.65rem 1.15rem;
	border: 1px solid transparent;
	border-radius: var(--ke-radius-sm);
	background: var(--ke-brand);
	color: #fff;
	font-size: var(--ke-text-sm);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ke-button:hover:not(:disabled) { background: var(--ke-brand-dark); color: #fff; text-decoration: none; }
.ke-button:disabled { opacity: 0.45; cursor: not-allowed; }

.ke-button--block { width: 100%; }
.ke-button--sm { padding: 0.4rem 0.75rem; font-size: var(--ke-text-xs); }

.ke-button--secondary {
	background: var(--ke-surface);
	border-color: var(--ke-border-strong);
	color: var(--ke-ink);
}

.ke-button--secondary:hover:not(:disabled) { background: var(--ke-surface-sunken); color: var(--ke-ink); }

.ke-button--ghost {
	background: transparent;
	border-color: var(--ke-border);
	color: var(--ke-ink-soft);
}

.ke-button--ghost:hover:not(:disabled) { background: var(--ke-surface-sunken); color: var(--ke-ink); }

.ke-button--approve {
	background: var(--ke-surface);
	border-color: var(--ke-success);
	color: var(--ke-success);
}

.ke-button--approve:hover:not(:disabled) { background: var(--ke-success-bg); color: var(--ke-success); }

.ke-button--reject {
	background: var(--ke-surface);
	border-color: var(--ke-danger);
	color: var(--ke-danger);
}

.ke-button--reject:hover:not(:disabled) { background: var(--ke-danger-bg); color: var(--ke-danger); }

/* ==========================================================================
   Components — forms
   ========================================================================== */

.ke-field { display: flex; flex-direction: column; gap: var(--ke-space-2); margin-bottom: var(--ke-space-4); }

.ke-field > label { font-size: var(--ke-text-sm); font-weight: 600; }

.ke-field input,
.ke-field select,
.ke-field textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	background: var(--ke-surface);
	border: 1px solid var(--ke-border-strong);
	border-radius: var(--ke-radius-sm);
	font-size: var(--ke-text-sm);
}

.ke-field input:focus-visible,
.ke-field select:focus-visible,
.ke-field textarea:focus-visible { border-color: var(--ke-brand); outline-offset: 0; }

.ke-field input[readonly] { background: var(--ke-surface-sunken); color: var(--ke-ink-muted); }

.ke-field.has-error input,
.ke-field.has-error select,
.ke-field.has-error textarea { border-color: var(--ke-danger); }

.ke-field-error { margin: 0; font-size: var(--ke-text-xs); color: var(--ke-danger); }

.ke-field--inline { flex-direction: row; align-items: flex-start; gap: var(--ke-space-3); }
.ke-field--inline input[type="checkbox"] { width: 1.05rem; height: 1.05rem; margin-top: 0.2rem; flex: none; accent-color: var(--ke-brand); }
.ke-field--inline label { font-weight: 400; font-size: var(--ke-text-sm); }

.ke-grid { display: grid; gap: 0 var(--ke-space-4); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }

/* Input with a leading icon — the sign-in fields. */
.ke-input-group { position: relative; display: flex; align-items: center; }

.ke-input-group__icon {
	position: absolute;
	left: 0.75rem;
	color: var(--ke-ink-faint);
	pointer-events: none;
}

.ke-input-group input { padding-left: 2.5rem; }

.ke-input-group__reveal {
	position: absolute;
	right: 0.5rem;
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	background: none;
	border: 0;
	border-radius: var(--ke-radius-sm);
	color: var(--ke-ink-faint);
	cursor: pointer;
}

.ke-input-group__reveal:hover { color: var(--ke-ink); }
.ke-input-group__reveal[aria-pressed="true"] { color: var(--ke-brand); }

/* ==========================================================================
   Components — pills, badges, dots
   ========================================================================== */

.ke-pill {
	display: inline-block;
	padding: 0.15em 0.7em;
	border-radius: var(--ke-radius-pill);
	font-size: var(--ke-text-xs);
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
}

.ke-pill--sm { font-size: 0.75rem; padding: 0.1em 0.55em; }

.ke-pill--success { color: var(--ke-success); background: var(--ke-success-bg); }
.ke-pill--warning { color: var(--ke-warning); background: var(--ke-warning-bg); }
.ke-pill--danger  { color: var(--ke-danger);  background: var(--ke-danger-bg); }
.ke-pill--info    { color: var(--ke-info);    background: var(--ke-info-bg); }
.ke-pill--neutral { color: var(--ke-neutral); background: var(--ke-neutral-bg); }
.ke-pill--muted   { color: var(--ke-ink-muted); background: var(--ke-neutral-bg); }

.ke-badge {
	display: inline-grid;
	place-items: center;
	min-width: 1.35rem;
	height: 1.35rem;
	padding: 0 0.35rem;
	border-radius: var(--ke-radius-pill);
	background: var(--ke-neutral-bg);
	color: var(--ke-ink-soft);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

.ke-badge--danger { background: var(--ke-brand); color: #fff; }

.ke-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.ke-dot--info { background: var(--ke-info); }
.ke-dot--danger { background: var(--ke-brand); }
.ke-dot--success { background: var(--ke-success); }

/* ==========================================================================
   Components — notices, toasts, empty states
   ========================================================================== */

.ke-notice {
	padding: var(--ke-space-3) var(--ke-space-4);
	border-left: 3px solid var(--ke-ink-muted);
	border-radius: var(--ke-radius-sm);
	background: var(--ke-surface-raised);
	font-size: var(--ke-text-sm);
	margin-bottom: var(--ke-space-4);
}

.ke-notice--info    { border-left-color: var(--ke-info); background: var(--ke-info-bg); color: #1e3a8a; }
.ke-notice--warning { border-left-color: var(--ke-warning); background: var(--ke-warning-bg); color: #78350f; }
.ke-notice--danger  { border-left-color: var(--ke-danger); background: var(--ke-danger-bg); color: #7f1d1d; }

.ke-empty { text-align: center; padding: var(--ke-space-6) var(--ke-space-4); }
.ke-empty__code { font-size: var(--ke-text-2xl); font-weight: 700; color: var(--ke-border-strong); margin: 0; }
.ke-empty__title { font-size: var(--ke-text-base); font-weight: 600; margin: 0 0 var(--ke-space-1); }
.ke-empty__body { color: var(--ke-ink-muted); font-size: var(--ke-text-sm); }
.ke-empty--success .ke-empty__title { color: var(--ke-success); }

.ke-toasts {
	position: fixed;
	right: var(--ke-space-4);
	bottom: var(--ke-space-4);
	z-index: 300;
	display: flex;
	flex-direction: column;
	gap: var(--ke-space-2);
	max-width: min(24rem, calc(100vw - 2rem));
}

.ke-toast {
	padding: var(--ke-space-3) var(--ke-space-4);
	border-radius: var(--ke-radius-sm);
	background: var(--ke-ink);
	color: #fff;
	font-size: var(--ke-text-sm);
	box-shadow: var(--ke-shadow-raised);
}

.ke-toast--success { background: var(--ke-success); }
.ke-toast--warning { background: var(--ke-warning); }
.ke-toast--danger  { background: var(--ke-danger); }

/* ==========================================================================
   Components — tables
   ========================================================================== */

/* Tables scroll inside their own container so the page body never scrolls
   sideways — the report grid has nine columns and will not fit a phone. */
.ke-table-wrap { overflow-x: auto; margin-inline: calc(var(--ke-space-5) * -1); padding-inline: var(--ke-space-5); }

.ke-table { width: 100%; border-collapse: collapse; font-size: var(--ke-text-sm); }

.ke-table th,
.ke-table td {
	padding: var(--ke-space-3);
	text-align: left;
	border-bottom: 1px solid var(--ke-border);
	white-space: nowrap;
}

.ke-table thead th {
	font-size: var(--ke-text-xs);
	font-weight: 600;
	color: var(--ke-ink-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	background: var(--ke-surface-raised);
	border-bottom-color: var(--ke-border-strong);
}

.ke-table tbody tr:hover { background: var(--ke-surface-raised); }
.ke-table tbody tr:last-child td { border-bottom: 0; }

/* ==========================================================================
   Components — definition summary
   ========================================================================== */

.ke-summary { margin: 0 0 var(--ke-space-4); }

.ke-summary__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--ke-space-4);
	padding: var(--ke-space-2) 0;
	border-bottom: 1px solid var(--ke-border);
	font-size: var(--ke-text-sm);
}

.ke-summary__row:last-child { border-bottom: 0; }
.ke-summary__label { color: var(--ke-ink-muted); margin: 0; }
.ke-summary__value { margin: 0; font-weight: 600; text-align: right; }

/* ==========================================================================
   Components — footer
   ========================================================================== */

.ke-footer {
	flex: none;
	background: var(--ke-footer);
	color: #d4d4d8;
	font-size: var(--ke-text-xs);
}

.ke-footer__inner {
	max-width: var(--ke-container);
	margin-inline: auto;
	padding: var(--ke-space-4);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ke-space-4);
	flex-wrap: wrap;
}

.ke-footer__notice { display: flex; align-items: center; gap: var(--ke-space-2); margin: 0; }
.ke-footer__icon { color: #a1a1aa; flex: none; }
.ke-footer__copyright { margin: 0; color: #a1a1aa; }

.ke-footer__menu { display: flex; gap: var(--ke-space-4); margin: 0; padding: 0; list-style: none; }
.ke-footer a { color: #e4e4e7; text-decoration: none; }
.ke-footer a:hover { color: #fff; text-decoration: underline; }

/* ==========================================================================
   Utilities
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.ke-header,
	.ke-footer,
	.ke-sidebar,
	.ke-toasts,
	.ke-button { display: none !important; }

	body { background: #fff; }
	.ke-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
}
