/*
 * Design System do MVP — Fábrica de Papel.
 * Conforme docs/design.md.
 * Fase 2: tokens + tipografia + componentes base reutilizáveis.
 */

/* ---------------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------------- */
:root {
	/* Base */
	--bg-app: #f3f5f4;
	--surface: #ffffff;
	--surface-muted: #f7f8f7;
	--border: #e1e6e3;
	--border-strong: #cdd5d0;
	--text-primary: #17211d;
	--text-secondary: #64716b;
	--text-muted: #8a958f;

	/* Marca */
	--brand-900: #102d27;
	--brand-800: #173b33;
	--brand-700: #225145;
	--brand-100: #e4efeb;

	/* Destaque */
	--accent-600: #b87333;
	--accent-500: #ca8746;
	--accent-100: #f6e8d8;

	/* Semânticas */
	--success: #2f7d57;
	--success-bg: #e7f3ec;
	--success-border: #bfe3cf;
	--warning: #c58a22;
	--warning-bg: #faf0d8;
	--warning-border: #ecd9a6;
	--error: #b94a48;
	--error-bg: #fbeded;
	--error-border: #efcfcf;
	--info: #3978a8;
	--info-bg: #e7f0f7;
	--info-border: #c5d9ea;

	/* Estados — badges */
	--st-new-bg: #eef1f0;
	--st-new-fg: #5a6660;
	--st-new-border: #d7dedb;
	--st-planned-bg: #e7f0f7;
	--st-planned-fg: #2b5a82;
	--st-planned-border: #c5d9ea;
	--st-active-bg: #e7f3ec;
	--st-active-fg: #236645;
	--st-active-border: #bfe3cf;
	--st-blocked-bg: #fbeded;
	--st-blocked-fg: #973b39;
	--st-blocked-border: #efcfcf;
	--st-done-bg: #eef2f0;
	--st-done-fg: #566b62;
	--st-done-border: #d6ddd9;

	/* Prioridades — badges */
	--pr-low-bg: #eef1f0;
	--pr-low-fg: #5a6660;
	--pr-low-border: #d7dedb;
	--pr-normal-bg: #e7f0f7;
	--pr-normal-fg: #2b5a82;
	--pr-normal-border: #c5d9ea;
	--pr-high-bg: #faf0d8;
	--pr-high-fg: #8a6112;
	--pr-high-border: #ecd9a6;
	--pr-critical-bg: #fbeded;
	--pr-critical-fg: #973b39;
	--pr-critical-border: #efcfcf;

	/* Forma */
	--radius-card: 15px;
	--radius-input: 10px;
	--radius-btn: 10px;
	--radius-pill: 999px;
	--radius-sm: 8px;

	/* Sombras */
	--shadow-subtle:
		0 1px 2px rgba(16, 45, 39, 0.04), 0 1px 1px rgba(16, 45, 39, 0.03);
	--shadow-card: 0 1px 3px rgba(16, 45, 39, 0.06);
	--shadow-overlay: 0 8px 30px rgba(16, 45, 39, 0.18);

	/* Movimento */
	--transition: 150ms ease;
	--transition-fast: 120ms ease;

	/* Tipografia */
	--font-sans:
		"Inter", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

	/* Escala tipográfica (design.md) */
	--fs-page-title: 28px;
	--fs-section-title: 20px;
	--fs-card-title: 15px;
	--fs-body: 14px;
	--fs-caption: 12px;
	--fs-kpi: 32px;

	/* Layout */
	--sidebar-width: 248px;
	--topbar-height: 68px;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 24px;
	--space-6: 32px;
}

/* ---------------------------------------------------------------------------
   Reset base
   ------------------------------------------------------------------------- */
* {
	box-sizing: border-box;
}
html,
body {
	margin: 0;
	padding: 0;
}
body {
	font-family: var(--font-sans);
	font-size: var(--fs-body);
	color: var(--text-primary);
	background: var(--bg-app);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
a {
	color: inherit;
	text-decoration: none;
}
h1,
h2,
h3,
h4 {
	margin: 0;
	font-weight: 600;
	color: var(--text-primary);
}
p {
	margin: 0 0 var(--space-3);
}
p:last-child {
	margin-bottom: 0;
}
hr {
	border: none;
	border-top: 1px solid var(--border);
	margin: var(--space-5) 0;
}
code {
	font-family: var(--font-mono);
	background: var(--surface-muted);
	padding: 2px 6px;
	border-radius: 6px;
	font-size: 12px;
}

/* ---------------------------------------------------------------------------
   Focus visível — global
   ------------------------------------------------------------------------- */
:focus-visible {
	outline: 3px solid var(--accent-500);
	outline-offset: 1px;
	border-radius: 4px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
	outline: none;
}

/* ---------------------------------------------------------------------------
   Tipografia — escala
   ------------------------------------------------------------------------- */
.h-page {
	font-size: var(--fs-page-title);
	letter-spacing: -0.3px;
	font-weight: 600;
}
.h-section {
	font-size: var(--fs-section-title);
	letter-spacing: -0.2px;
	font-weight: 600;
}
.h-card {
	font-size: var(--fs-card-title);
	font-weight: 600;
}
.text-caption {
	font-size: var(--fs-caption);
	color: var(--text-secondary);
}
.text-secondary {
	color: var(--text-secondary);
}
.text-muted {
	color: var(--text-muted);
}
.text-mono {
	font-family: var(--font-mono);
	font-size: 12.5px;
}
.text-eyebrow {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.7px;
	color: var(--accent-600);
	font-weight: 600;
}
.kpi-value {
	font-size: var(--fs-kpi);
	font-weight: 700;
	letter-spacing: -0.5px;
	line-height: 1.1;
}

/* ---------------------------------------------------------------------------
   App shell — Fase 3 (sidebar final, topbar com toggle, responsividade).
   ------------------------------------------------------------------------- */
.app-shell {
	display: grid;
	grid-template-columns: var(--sidebar-width) 1fr;
	min-height: 100vh;
}

/* Skip link (acessibilidade) */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 2000;
	background: var(--brand-700);
	color: #fff;
	padding: 8px 14px;
	border-radius: 0 0 var(--radius-sm) 0;
	font-size: 13px;
}
.skip-link:focus {
	left: 0;
}

/* Sidebar */
.sidebar {
	background: var(--brand-900);
	color: var(--surface);
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	height: 100vh;
	padding: 16px 14px;
	gap: 14px;
	z-index: 1000;
}
.sidebar__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 4px 8px 14px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar__logo-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	flex-shrink: 0;
}
.sidebar__logo-text {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.2px;
}
.sidebar__nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}
.sidebar__item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 9px 12px;
	border-radius: 9px;
	color: rgba(255, 255, 255, 0.78);
	font-size: 14px;
	transition:
		background var(--transition),
		color var(--transition);
}
.sidebar__item::before {
	/* Marcador âmbar à esquerda do item ativo (design.md). */
	content: "";
	position: absolute;
	left: -14px;
	top: 50%;
	transform: translateY(-50%);
	width: 4px;
	height: 22px;
	border-radius: 0 4px 4px 0;
	background: var(--accent-500);
	opacity: 0;
	transition: opacity var(--transition);
}
.sidebar__item:hover {
	background: rgba(255, 255, 255, 0.06);
	color: #fff;
}
.sidebar__item.is-active {
	background: var(--brand-800);
	color: #fff;
}
.sidebar__item.is-active::before {
	opacity: 1;
}
.sidebar__item:focus-visible {
	outline: 3px solid var(--accent-500);
	outline-offset: -2px;
}
.sidebar__item-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	opacity: 0.85;
}
.sidebar__item.is-active .sidebar__item-icon {
	opacity: 1;
	color: var(--accent-500);
}
.sidebar__profile {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 10px;
	padding-top: 12px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar__profile-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.sidebar__profile-name {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.sidebar__profile-role {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.55);
}
.sidebar__logout {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.6);
	padding: 6px 8px;
	border-radius: var(--radius-sm);
	transition:
		background var(--transition),
		color var(--transition);
}
.sidebar__logout:hover {
	color: var(--accent-500);
	background: rgba(255, 255, 255, 0.06);
}
.sidebar__logout-text {
	white-space: nowrap;
}

.avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--brand-700);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
}
.avatar--sm {
	width: 28px;
	height: 28px;
	font-size: 11px;
}
.avatar--lg {
	width: 44px;
	height: 44px;
	font-size: 14px;
}
.avatar__img {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

/* Main */
.main {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.topbar {
	background: var(--surface);
	height: var(--topbar-height);
	border-bottom: 1px solid var(--border);
	padding: 0 var(--space-6);
	display: flex;
	align-items: center;
	gap: var(--space-4);
	position: sticky;
	top: 0;
	z-index: 900;
}
.topbar__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text-primary);
	cursor: pointer;
	flex-shrink: 0;
	transition: background var(--transition);
}
.topbar__toggle:hover {
	background: var(--surface-muted);
}
.topbar__toggle:focus-visible {
	outline: 3px solid var(--accent-500);
	outline-offset: 1px;
}
.topbar__title {
	min-width: 0;
}
.topbar__title h1 {
	font-size: 22px;
	letter-spacing: -0.2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.topbar__subtitle {
	margin: 3px 0 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--text-secondary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Breadcrumb (lista semântica) */
.breadcrumb {
	margin-top: 4px;
}
.breadcrumb__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 12px;
	color: var(--text-secondary);
}
.breadcrumb__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.breadcrumb__link {
	color: var(--text-secondary);
	transition: color var(--transition);
}
.breadcrumb__link:hover {
	color: var(--brand-700);
}
.breadcrumb__link:focus-visible {
	outline: 3px solid var(--accent-500);
	outline-offset: 1px;
	border-radius: 3px;
}
.breadcrumb__item > span[aria-current="page"] {
	color: var(--text-primary);
	font-weight: 500;
}
.breadcrumb__sep {
	color: var(--border-strong);
	flex-shrink: 0;
}

.content {
	padding: var(--space-5) var(--space-6);
}
.content--narrow {
	max-width: 960px;
	margin: 0 auto;
}

/* ---------------------------------------------------------------------------
   Grids utilitárias
   ------------------------------------------------------------------------- */
.row {
	display: flex;
	gap: var(--space-4);
	flex-wrap: wrap;
}
.row--tight {
	gap: var(--space-2);
}
.row--between {
	justify-content: space-between;
}
.row--center {
	align-items: center;
}
.row--end {
	justify-content: flex-end;
}
.stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}
.stack--tight {
	gap: var(--space-2);
}
.grid {
	display: grid;
	gap: var(--space-4);
}
.grid-2 {
	grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
	grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
	grid-template-columns: repeat(4, 1fr);
}
.grow {
	flex: 1 1 auto;
}
.mt-0 {
	margin-top: 0;
}
.mt-2 {
	margin-top: var(--space-2);
}
.mt-3 {
	margin-top: var(--space-3);
}
.mt-4 {
	margin-top: var(--space-4);
}
.mt-5 {
	margin-top: var(--space-5);
}
.mb-0 {
	margin-bottom: 0;
}
.mb-2 {
	margin-bottom: var(--space-2);
}
.mb-3 {
	margin-bottom: var(--space-3);
}
.mb-4 {
	margin-bottom: var(--space-4);
}
.mb-5 {
	margin-bottom: var(--space-5);
}

/* ---------------------------------------------------------------------------
   Placeholder card (mantém compat Fase 1)
   ------------------------------------------------------------------------- */
.placeholder-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	padding: 28px;
	max-width: 560px;
	box-shadow: var(--shadow-card);
}
.placeholder-card__eyebrow {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--accent-600);
	font-weight: 600;
	margin: 0 0 6px;
}
.placeholder-card__title {
	font-size: 20px;
	margin-bottom: 10px;
}
.placeholder-card__text {
	color: var(--text-secondary);
	margin: 0 0 12px;
}

/* ---------------------------------------------------------------------------
   Botões
   ------------------------------------------------------------------------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 1px solid transparent;
	border-radius: var(--radius-btn);
	padding: 9px 16px;
	font-size: 14px;
	font-weight: 500;
	font-family: inherit;
	line-height: 1.2;
	cursor: pointer;
	white-space: nowrap;
	transition:
		background var(--transition),
		border-color var(--transition),
		color var(--transition),
		box-shadow var(--transition);
}
.btn:disabled,
.btn.is-disabled {
	opacity: 0.55;
	cursor: not-allowed;
}
.btn--primary {
	background: var(--brand-700);
	color: #fff;
}
.btn--primary:hover:not(:disabled) {
	background: var(--brand-800);
}
.btn--secondary {
	background: var(--surface);
	border-color: var(--border-strong);
	color: var(--text-primary);
}
.btn--secondary:hover:not(:disabled) {
	background: var(--surface-muted);
	border-color: var(--brand-700);
}
.btn--ghost {
	background: transparent;
	color: var(--text-secondary);
}
.btn--ghost:hover:not(:disabled) {
	background: var(--surface-muted);
	color: var(--text-primary);
}
.btn--danger {
	background: var(--error-bg);
	color: var(--error);
	border-color: var(--error-border);
}
.btn--danger:hover:not(:disabled) {
	background: #f7dcdc;
	border-color: var(--error);
}
.btn--block {
	width: 100%;
}
.btn--sm {
	padding: 6px 11px;
	font-size: 13px;
	border-radius: var(--radius-sm);
}
.btn--icon {
	padding: 8px;
	width: 36px;
	height: 36px;
}
.btn--icon.btn--sm {
	width: 30px;
	height: 30px;
	padding: 5px;
}
.btn__icon {
	display: inline-flex;
	width: 16px;
	height: 16px;
}
.btn:focus-visible {
	outline: 3px solid var(--accent-600);
	outline-offset: 2px;
}

/* Grupos de botões */
.btn-group {
	display: inline-flex;
	gap: var(--space-2);
}
.btn-group--end {
	justify-content: flex-end;
}

/* ---------------------------------------------------------------------------
   Campos de formulário
   ------------------------------------------------------------------------- */
.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: var(--space-4);
}
.field__label {
	font-size: 13px;
	font-weight: 500;
	color: var(--text-primary);
	display: flex;
	align-items: center;
	gap: 6px;
}
.field__label .req {
	color: var(--error);
	font-weight: 600;
}
.field__hint {
	font-size: 12px;
	color: var(--text-secondary);
}
.field__error {
	font-size: 12px;
	color: var(--error);
}
.field--error .input,
.field--error .select,
.field--error .textarea {
	border-color: var(--error);
	box-shadow: 0 0 0 3px var(--error-bg);
}

.input,
.select,
.textarea {
	border: 1px solid var(--border);
	border-radius: var(--radius-input);
	padding: 10px 12px;
	font-size: 14px;
	font-family: inherit;
	color: var(--text-primary);
	background: var(--surface);
	width: 100%;
	transition:
		border-color var(--transition),
		box-shadow var(--transition);
}
.input::placeholder,
.textarea::placeholder {
	color: var(--text-muted);
}
.input:focus,
.select:focus,
.textarea:focus {
	outline: none;
	border-color: var(--brand-700);
	box-shadow: 0 0 0 3px var(--brand-100);
}
.input:disabled,
.select:disabled,
.textarea:disabled {
	background: var(--surface-muted);
	color: var(--text-muted);
	cursor: not-allowed;
}
.textarea {
	resize: vertical;
	min-height: 96px;
	line-height: 1.5;
}
.select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364716b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
	cursor: pointer;
}

/* Grupos de inputs (prefixo/sufixo) */
.input-group {
	display: flex;
	align-items: stretch;
}
.input-group .input {
	border-radius: 0;
}
.input-group__addon {
	display: inline-flex;
	align-items: center;
	padding: 0 12px;
	background: var(--surface-muted);
	border: 1px solid var(--border);
	color: var(--text-secondary);
	font-size: 13px;
}
.input-group__addon--left {
	border-radius: var(--radius-input) 0 0 var(--radius-input);
	border-right: none;
}
.input-group__addon--right {
	border-radius: 0 var(--radius-input) var(--radius-input) 0;
	border-left: none;
}
.input-group .input--addon-left {
	border-radius: 0 var(--radius-input) var(--radius-input) 0;
}
.input-group .input--addon-right {
	border-radius: var(--radius-input) 0 0 var(--radius-input);
}

/* Checkbox / radio */
.check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	cursor: pointer;
}
.check input {
	width: 16px;
	height: 16px;
	accent-color: var(--brand-700);
	cursor: pointer;
}

/* Switch */
.switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	cursor: pointer;
}
.switch__track {
	width: 36px;
	height: 20px;
	border-radius: var(--radius-pill);
	background: var(--border-strong);
	position: relative;
	transition: background var(--transition);
	flex-shrink: 0;
}
.switch__track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: transform var(--transition);
}
.switch input {
	display: none;
}
.switch input:checked + .switch__track {
	background: var(--brand-700);
}
.switch input:checked + .switch__track::after {
	transform: translateX(16px);
}

/* Form actions */
.form-actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-2);
	padding-top: var(--space-3);
	border-top: 1px solid var(--border);
	margin-top: var(--space-4);
}

/* ---------------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 9px;
	border-radius: var(--radius-pill);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	border: 1px solid transparent;
	white-space: nowrap;
}
.badge--dot::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
	flex-shrink: 0;
}

/* Estados */
.badge--st-new {
	background: var(--st-new-bg);
	color: var(--st-new-fg);
	border-color: var(--st-new-border);
}
.badge--st-planned {
	background: var(--st-planned-bg);
	color: var(--st-planned-fg);
	border-color: var(--st-planned-border);
}
.badge--st-active {
	background: var(--st-active-bg);
	color: var(--st-active-fg);
	border-color: var(--st-active-border);
}
.badge--st-blocked {
	background: var(--st-blocked-bg);
	color: var(--st-blocked-fg);
	border-color: var(--st-blocked-border);
}
.badge--st-done {
	background: var(--st-done-bg);
	color: var(--st-done-fg);
	border-color: var(--st-done-border);
}

/* Prioridades */
.badge--pr-low {
	background: var(--pr-low-bg);
	color: var(--pr-low-fg);
	border-color: var(--pr-low-border);
}
.badge--pr-normal {
	background: var(--pr-normal-bg);
	color: var(--pr-normal-fg);
	border-color: var(--pr-normal-border);
}
.badge--pr-high {
	background: var(--pr-high-bg);
	color: var(--pr-high-fg);
	border-color: var(--pr-high-border);
}
.badge--pr-critical {
	background: var(--pr-critical-bg);
	color: var(--pr-critical-fg);
	border-color: var(--pr-critical-border);
}

/* Badge neutra genérica */
.badge--neutral {
	background: var(--surface-muted);
	color: var(--text-secondary);
	border-color: var(--border);
}

/* ---------------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------------- */
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--border);
}
.card__title {
	font-size: var(--fs-card-title);
	font-weight: 600;
}
.card__subtitle {
	font-size: 12px;
	color: var(--text-secondary);
	margin-top: 2px;
}
.card__actions {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
}
.card__body {
	padding: var(--space-5);
}
.card__body--tight {
	padding: var(--space-4);
}
.card__footer {
	padding: var(--space-3) var(--space-5);
	border-top: 1px solid var(--border);
	background: var(--surface-muted);
	display: flex;
	justify-content: flex-end;
	gap: var(--space-2);
}
.card--flush .card__body {
	padding: 0;
}
.card--span-2 {
	grid-column: span 2;
}

/* Card simples sem cabeçalho (KPI) */
.kpi-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	padding: var(--space-4) var(--space-5);
	box-shadow: var(--shadow-card);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.kpi-card__label {
	font-size: 12px;
	color: var(--text-secondary);
	font-weight: 500;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.kpi-card__icon {
	width: 30px;
	height: 30px;
	border-radius: var(--radius-sm);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--brand-100);
	color: var(--brand-700);
}
.kpi-card__trend {
	font-size: 12px;
	font-weight: 600;
}
.kpi-card__trend--up {
	color: var(--success);
}
.kpi-card__trend--down {
	color: var(--error);
}
.kpi-card__trend--neutral {
	color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
   Tabelas
   ------------------------------------------------------------------------- */
.table-wrap {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
	overflow: hidden;
}
.table-scroll {
	overflow-x: auto;
}
.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}
.table thead th {
	background: var(--surface-muted);
	text-align: left;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.4px;
	padding: 11px var(--space-4);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}
.table tbody td {
	padding: 12px var(--space-4);
	border-bottom: 1px solid var(--border);
	color: var(--text-primary);
	vertical-align: middle;
}
.table tbody tr:last-child td {
	border-bottom: none;
}
.table tbody tr {
	transition: background var(--transition-fast);
}
.table tbody tr:hover {
	background: var(--surface-muted);
}
.table--clickable tbody tr {
	cursor: pointer;
}
.table__cell-mono {
	font-family: var(--font-mono);
	font-size: 12.5px;
	color: var(--text-secondary);
}
.table__cell-strong {
	font-weight: 600;
}
.table__cell-secondary {
	color: var(--text-secondary);
	font-size: 13px;
}
.table__actions {
	display: inline-flex;
	gap: var(--space-1);
	justify-content: flex-end;
}
.table th.table__col-actions,
.table td.table__col-actions {
	width: 1%;
	white-space: nowrap;
	text-align: right;
}
.table th.table__col-fit,
.table td.table__col-fit {
	width: 1%;
	white-space: nowrap;
}

/* Densidade média: linhas compactas alternativas */
.table--dense thead th {
	padding: 8px var(--space-4);
}
.table--dense tbody td {
	padding: 8px var(--space-4);
}

/* Ordenação */
th.is-sortable {
	cursor: pointer;
	user-select: none;
}
th.is-sortable:hover {
	color: var(--text-primary);
}
th .sort-ind {
	font-size: 10px;
	margin-left: 4px;
	opacity: 0.6;
}
th.is-sorted .sort-ind {
	opacity: 1;
	color: var(--accent-600);
}

/* ---------------------------------------------------------------------------
   Alerts
   ------------------------------------------------------------------------- */
.alert {
	border-radius: var(--radius-input);
	padding: 11px 14px 11px 12px;
	font-size: 13.5px;
	margin-bottom: var(--space-4);
	border: 1px solid transparent;
	display: flex;
	gap: 10px;
	align-items: flex-start;
}
.alert__icon {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin-top: 1px;
}
.alert__body {
	flex: 1;
}
.alert__title {
	font-weight: 600;
	margin: 0 0 2px;
}
.alert__close {
	background: none;
	border: none;
	color: inherit;
	opacity: 0.5;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 0 2px;
	transition: opacity var(--transition);
}
.alert__close:hover {
	opacity: 1;
}
.alert--success {
	background: var(--success-bg);
	border-color: var(--success-border);
	color: var(--success);
}
.alert--warning {
	background: var(--warning-bg);
	border-color: var(--warning-border);
	color: #7a5612;
}
.alert--error {
	background: var(--error-bg);
	border-color: var(--error-border);
	color: var(--error);
}
.alert--info {
	background: var(--info-bg);
	border-color: var(--info-border);
	color: #265a82;
}

/* ---------------------------------------------------------------------------
   Toasts
   ------------------------------------------------------------------------- */
.toast-region {
	position: fixed;
	top: var(--space-5);
	right: var(--space-5);
	z-index: 1000;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	max-width: 380px;
}
.toast {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid var(--text-secondary);
	border-radius: var(--radius-input);
	box-shadow: var(--shadow-overlay);
	padding: 12px 14px;
	display: flex;
	gap: 10px;
	align-items: flex-start;
	font-size: 13.5px;
	animation: toast-in var(--transition) ease;
}
.toast.is-leaving {
	animation: toast-out var(--transition) ease forwards;
}
.toast__icon {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin-top: 1px;
}
.toast__body {
	flex: 1;
}
.toast__title {
	font-weight: 600;
	margin: 0 0 2px;
}
.toast__text {
	color: var(--text-secondary);
	font-size: 12.5px;
	margin: 0;
}
.toast__close {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	padding: 0 2px;
	opacity: 0.6;
	transition: opacity var(--transition);
}
.toast__close:hover {
	opacity: 1;
}
.toast--success {
	border-left-color: var(--success);
}
.toast--success .toast__icon {
	color: var(--success);
}
.toast--error {
	border-left-color: var(--error);
}
.toast--error .toast__icon {
	color: var(--error);
}
.toast--warning {
	border-left-color: var(--warning);
}
.toast--warning .toast__icon {
	color: var(--warning);
}
.toast--info {
	border-left-color: var(--info);
}
.toast--info .toast__icon {
	color: var(--info);
}
@keyframes toast-in {
	from {
		opacity: 0;
		transform: translateX(12px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}
@keyframes toast-out {
	to {
		opacity: 0;
		transform: translateX(12px);
	}
}

/* ---------------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------------- */
.modal {
	position: fixed;
	inset: 0;
	z-index: 1100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-4);
}
.modal[hidden] {
	display: none;
}
.modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(16, 45, 39, 0.45);
	backdrop-filter: blur(1px);
	animation: fade-in var(--transition) ease;
}
.modal__dialog {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-overlay);
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 2 * var(--space-5));
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: modal-in var(--transition) ease;
}
.modal__dialog--sm {
	max-width: 380px;
}
.modal__dialog--lg {
	max-width: 720px;
}
.modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--border);
}
.modal__title {
	font-size: 16px;
	font-weight: 600;
}
.modal__body {
	padding: var(--space-5);
	overflow-y: auto;
}
.modal__footer {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-2);
	padding: var(--space-3) var(--space-5);
	border-top: 1px solid var(--border);
	background: var(--surface-muted);
}
.modal__close {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	width: 30px;
	height: 30px;
	border-radius: var(--radius-sm);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition:
		background var(--transition),
		color var(--transition);
}
.modal__close:hover {
	background: var(--surface-muted);
	color: var(--text-primary);
}
@keyframes fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
@keyframes modal-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* ---------------------------------------------------------------------------
   Empty states
   ------------------------------------------------------------------------- */
.empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: var(--space-6) var(--space-5);
	gap: var(--space-3);
	color: var(--text-secondary);
}
.empty__icon {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--surface-muted);
	border: 1px solid var(--border);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
}
.empty__title {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0;
}
.empty__text {
	font-size: 13px;
	max-width: 360px;
	margin: 0;
}
.empty__action {
	margin-top: var(--space-2);
}

/* Estado vazio dentro de tabela */
.table-empty {
	text-align: center;
	padding: var(--space-6) var(--space-4);
}
.table-empty__text {
	color: var(--text-secondary);
	font-size: 13px;
	margin: 0;
}

/* ---------------------------------------------------------------------------
   Loading / skeleton
   ------------------------------------------------------------------------- */
.skeleton {
	background: linear-gradient(
		90deg,
		var(--surface-muted) 25%,
		#eef1f0 37%,
		var(--surface-muted) 63%
	);
	background-size: 400% 100%;
	animation: skeleton 1.4s ease infinite;
	border-radius: var(--radius-sm);
}
@keyframes skeleton {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}
.skeleton--line {
	height: 12px;
	margin-bottom: 8px;
}
.skeleton--line:last-child {
	margin-bottom: 0;
	width: 60%;
}

/* Spinner */
.spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid var(--border-strong);
	border-top-color: var(--brand-700);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---------------------------------------------------------------------------
   Misc utilitárias
   ------------------------------------------------------------------------- */
.divider {
	height: 1px;
	background: var(--border);
	border: none;
	margin: var(--space-4) 0;
}
.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: var(--radius-pill);
	background: var(--surface-muted);
	border: 1px solid var(--border);
	font-size: 12px;
	color: var(--text-secondary);
}
.dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
}
.dot--success {
	background: var(--success);
}
.dot--warning {
	background: var(--warning);
}
.dot--error {
	background: var(--error);
}
.dot--info {
	background: var(--info);
}
.dot--muted {
	background: var(--text-muted);
}

.list-compact {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	list-style: none;
	padding: 0;
	margin: 0;
}
.list-compact__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: 8px 10px;
	border-radius: var(--radius-sm);
	transition: background var(--transition-fast);
}
.list-compact__item:hover {
	background: var(--surface-muted);
}

/* Progresso (uso futuro em detalhe/KPI) */
.progress {
	height: 6px;
	background: var(--border);
	border-radius: var(--radius-pill);
	overflow: hidden;
}
.progress__bar {
	height: 100%;
	background: var(--brand-700);
	border-radius: var(--radius-pill);
	transition: width var(--transition);
}
.progress__bar--success {
	background: var(--success);
}
.progress__bar--warning {
	background: var(--warning);
}
.progress__bar--error {
	background: var(--error);
}

/* ---------------------------------------------------------------------------
   Login — fotografia industrial com composição editorial.
   ------------------------------------------------------------------------- */
.login-body {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	isolation: isolate;
	min-height: 100vh;
	overflow: hidden;
	padding: var(--space-6) clamp(32px, 9vw, 156px);
	background:
		radial-gradient(
			circle at 82% 16%,
			rgba(202, 135, 70, 0.14),
			transparent 24rem
		),
		repeating-linear-gradient(
			135deg,
			rgba(255, 255, 255, 0.018) 0 1px,
			transparent 1px 7px
		),
		var(--brand-900);
}
.login-body::before {
	position: fixed;
	z-index: -1;
	inset: 0 43% 0 0;
	content: "";
	background:
		linear-gradient(90deg, rgba(16, 45, 39, 0.18), rgba(16, 45, 39, 0.54)),
		linear-gradient(0deg, rgba(16, 45, 39, 0.28), transparent 55%),
		url("../img/login-paper-mill.jpg") center / cover no-repeat;
	clip-path: polygon(0 0, 100% 0, 87% 100%, 0 100%);
}
.login-watermark {
	position: fixed;
	z-index: -1;
	left: clamp(28px, 5vw, 88px);
	bottom: clamp(28px, 5vw, 72px);
	width: min(29vw, 419px);
	height: auto;
	opacity: 0.2;
	filter: brightness(0) invert(1);
	user-select: none;
	pointer-events: none;
}
.login-card {
	position: relative;
	z-index: 1;
	background: var(--surface);
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: var(--radius-card);
	padding: var(--space-6);
	width: 100%;
	max-width: 400px;
	box-shadow: 0 24px 56px rgba(3, 20, 16, 0.28);
}
.login-card__brand {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 12px;
	margin-bottom: var(--space-5);
}
.login-card__logo {
	display: block;
	width: 140px;
	height: auto;
}
.login-card__mark {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
}
.login-card__subtitle {
	font-size: 13px;
	color: var(--text-secondary);
	margin: 0;
}
.login-form {
	margin-bottom: var(--space-5);
}
.login-card__demo {
	border-top: 1px solid var(--border);
	padding-top: var(--space-4);
	font-size: 12px;
}
.login-card__demo-title {
	font-weight: 600;
	margin: 0 0 var(--space-2);
	color: var(--text-secondary);
}
.login-card__demo-line {
	display: grid;
	grid-template-columns: 90px 1fr 1fr;
	gap: 8px;
	margin: 4px 0;
	color: var(--text-secondary);
}
@media (max-width: 768px) {
	.login-body {
		justify-content: center;
		padding: var(--space-5);
	}
	.login-body::before {
		inset: 0 0 52% 0;
		background-position: center 42%;
		clip-path: polygon(0 0, 100% 0, 100% 83%, 0 100%);
	}
	.login-watermark {
		left: var(--space-5);
		top: var(--space-5);
		bottom: auto;
		width: min(72vw, 300px);
	}
}

/* ---------------------------------------------------------------------------
   Responsividade — tablet (sidebar recolhível via toggle na topbar)
   design.md §8: desktop prioritário; tablet sidebar recolhível.
   Breakpoint principal em 1024px: toggle visível, sidebar off-canvas.
   ------------------------------------------------------------------------- */
@media (max-width: 1024px) {
	:root {
		--sidebar-width: 240px;
	}
	.app-shell {
		grid-template-columns: 1fr;
	}
	.sidebar {
		position: fixed;
		left: calc(-1 * var(--sidebar-width));
		top: 0;
		bottom: 0;
		height: 100vh;
		width: var(--sidebar-width);
		box-shadow: none;
		transition:
			left var(--transition),
			box-shadow var(--transition);
	}
	.sidebar.is-open {
		left: 0;
		box-shadow: var(--shadow-overlay);
	}
	.sidebar-backdrop {
		position: fixed;
		inset: 0;
		z-index: 950;
		background: rgba(16, 45, 39, 0.4);
		animation: fade-in var(--transition) ease;
	}
	.topbar__toggle {
		display: inline-flex;
	}
	.content {
		padding: var(--space-5);
	}
	.topbar {
		padding: 0 var(--space-5);
	}
	.grid-4 {
		grid-template-columns: repeat(2, 1fr);
	}
	.grid-3 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	:root {
		--fs-page-title: 24px;
		--fs-kpi: 28px;
	}
	.grid-2,
	.grid-3,
	.grid-4 {
		grid-template-columns: 1fr;
	}
	.card--span-2 {
		grid-column: span 1;
	}
	.toast-region {
		left: var(--space-4);
		right: var(--space-4);
		max-width: none;
		bottom: var(--space-4);
		top: auto;
	}
}

/* ---------------------------------------------------------------------------
   Dashboard Admin — Fase 4
   Conforme docs/design.md §6 (4 linhas: KPIs; Pulso+Prioridades; Riscos+Carga; Marcos+Atividade).
   Reutiliza tokens e componentes existentes; sem novas cores nem raios.
   ------------------------------------------------------------------------- */
.dashboard {
	gap: var(--space-5);
}

/* Linha 1 — KPIs: tons semânticos moderados no ícone + estado clickable */
.kpi-card--link {
	text-decoration: none;
	transition:
		border-color var(--transition),
		box-shadow var(--transition),
		transform var(--transition);
}
.kpi-card--link:hover {
	border-color: var(--border-strong);
	box-shadow: var(--shadow-overlay);
	transform: translateY(-1px);
}
.kpi-card__icon--success {
	background: var(--success-bg);
	color: var(--success);
}
.kpi-card__icon--warning {
	background: var(--warning-bg);
	color: #7a5612;
}
.kpi-card__icon--error {
	background: var(--error-bg);
	color: var(--error);
}
.kpi-card__icon--info {
	background: var(--info-bg);
	color: #265a82;
}
.kpi-card--success .kpi-value {
	color: var(--success);
}
.kpi-card--error .kpi-value {
	color: var(--error);
}
.kpi-card--warning .kpi-value {
	color: #7a5612;
}

/* Linha 2 — Pulso Operacional + Prioridades (Pulso maior) */
.dashboard__row2 {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: var(--space-4);
	align-items: start;
}
.pulse {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}
.pulse__stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-3);
}
.pulse__stat {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-3) var(--space-4);
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
.pulse__stat-value {
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.4px;
	line-height: 1.1;
}
.pulse__stat-value--success {
	color: var(--success);
}
.pulse__stat-value--warning {
	color: #7a5612;
}
.pulse__stat-label {
	font-size: 12px;
	color: var(--text-secondary);
}
.pulse__dist {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.pulse__dist-row {
	display: grid;
	grid-template-columns: 110px 1fr 32px;
	align-items: center;
	gap: var(--space-3);
}
.pulse__dist-bar {
	height: 8px;
	background: var(--surface-muted);
	border-radius: var(--radius-pill);
	overflow: hidden;
}
.pulse__dist-fill {
	display: block;
	height: 100%;
	opacity: 0.85;
	border-radius: var(--radius-pill);
}
.pulse__dist-fill.badge--st-new {
	background: var(--st-new-fg);
}
.pulse__dist-fill.badge--st-planned {
	background: var(--st-planned-fg);
}
.pulse__dist-fill.badge--st-active {
	background: var(--st-active-fg);
}
.pulse__dist-fill.badge--st-blocked {
	background: var(--st-blocked-fg);
}
.pulse__dist-fill.badge--st-done {
	background: var(--st-done-fg);
}
.pulse__dist-count {
	font-size: 13px;
	font-weight: 600;
	text-align: right;
}
.pulse__msg {
	font-size: 13px;
	color: var(--text-secondary);
	margin: 0;
	padding: var(--space-3) var(--space-4);
	background: var(--brand-100);
	border-radius: var(--radius-sm);
	border-left: 3px solid var(--brand-700);
}

/* Prioridades de Hoje — lista compacta */
.prio-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}
.prio-list__item {
	display: grid;
	grid-template-columns: 1fr auto auto auto;
	align-items: center;
	gap: var(--space-3);
	padding: 10px 4px;
	border-bottom: 1px solid var(--border);
}
.prio-list__item:last-child {
	border-bottom: none;
}
.prio-list__main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.prio-list__title {
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.prio-list__meta {
	font-size: 12px;
	color: var(--text-secondary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.prio-list__due {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: var(--text-secondary);
	white-space: nowrap;
}
.prio-list__due--over {
	color: var(--error);
	font-weight: 600;
}
.prio-list__due svg {
	width: 13px;
	height: 13px;
}
.prio-list__main:hover .prio-list__title {
	color: var(--brand-700);
}

/* Linha 3 — Riscos e Bloqueios */
.risk-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}
.risk-list__item {
	display: grid;
	grid-template-columns: 88px 1fr auto;
	align-items: center;
	gap: var(--space-3);
	padding: 10px 4px;
	border-bottom: 1px solid var(--border);
}
.risk-list__item:last-child {
	border-bottom: none;
}
.risk-list__sev {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	padding: 3px 8px;
	border-radius: var(--radius-pill);
	text-align: center;
	white-space: nowrap;
}
.risk-list__sev--blocked {
	background: var(--error-bg);
	color: var(--error);
}
.risk-list__sev--alto {
	background: var(--error-bg);
	color: var(--error);
}
.risk-list__sev--médio {
	background: var(--warning-bg);
	color: #7a5612;
}
.risk-list__sev--baixo {
	background: var(--info-bg);
	color: #265a82;
}
.risk-list__main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.risk-list__title {
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.risk-list__desc {
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.risk-list__main:hover .risk-list__title {
	color: var(--brand-700);
}
.risk-list__time {
	font-size: 12px;
	color: var(--text-secondary);
	white-space: nowrap;
}

/* Carga por Equipa */
.teamload-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}
.teamload-list__item {
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-areas:
		"head head"
		"bar state";
	gap: 6px var(--space-3);
	align-items: center;
}
.teamload-list__head {
	grid-area: head;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
}
.teamload-list__name {
	font-size: 14px;
	font-weight: 600;
}
.teamload-list__name .text-mono {
	font-size: 11px;
	margin-left: 4px;
}
.teamload-list__nums {
	font-size: 13px;
	color: var(--text-secondary);
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.teamload-list__nums strong {
	color: var(--text-primary);
}
.teamload-list__blocked {
	color: var(--error);
	font-size: 11px;
}
.teamload-list__bar {
	grid-area: bar;
	height: 8px;
	background: var(--surface-muted);
	border-radius: var(--radius-pill);
	overflow: hidden;
}
.teamload-list__fill {
	display: block;
	height: 100%;
	border-radius: var(--radius-pill);
}
.teamload-list__fill--ok {
	background: var(--success);
}
.teamload-list__fill--high {
	background: var(--warning);
}
.teamload-list__fill--over {
	background: var(--error);
}
.teamload-list__fill--low {
	background: var(--text-muted);
}
.teamload-list__state {
	grid-area: state;
	font-size: 11px;
	font-weight: 600;
	text-align: right;
}
.teamload-list__state--ok {
	color: var(--success);
}
.teamload-list__state--high {
	color: #7a5612;
}
.teamload-list__state--over {
	color: var(--error);
}
.teamload-list__state--low {
	color: var(--text-muted);
}

/* Linha 4 — Próximos Marcos (timeline cronológica) */
.milestones {
	list-style: none;
	margin: 0;
	padding: 0;
	position: relative;
	display: flex;
	flex-direction: column;
}
.milestones::before {
	content: "";
	position: absolute;
	left: 7px;
	top: 6px;
	bottom: 6px;
	width: 2px;
	background: var(--border);
}
.milestones__item {
	display: grid;
	grid-template-columns: 18px 1fr auto;
	align-items: start;
	gap: var(--space-3);
	padding: 8px 0;
	position: relative;
}
.milestones__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--brand-700);
	border: 2px solid var(--surface);
	margin-top: 4px;
	margin-left: 2px;
	z-index: 1;
}
.milestones__dot--late {
	background: var(--error);
}
.milestones__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.milestones__title {
	font-size: 14px;
	font-weight: 600;
}
.milestones__meta {
	font-size: 12px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.milestones__late {
	color: var(--error);
	font-weight: 600;
}
.milestones__date {
	font-size: 12px;
	color: var(--text-secondary);
	white-space: nowrap;
}
.milestones__item--late .milestones__title {
	color: var(--error);
}

/* Atividade Recente — feed */
.activity-feed {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}
.activity-feed__item {
	display: grid;
	grid-template-columns: 28px 1fr;
	gap: var(--space-3);
	padding: 9px 0;
	border-bottom: 1px solid var(--border);
}
.activity-feed__item:last-child {
	border-bottom: none;
}
.activity-feed__body {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}
.activity-feed__text {
	font-size: 13.5px;
	line-height: 1.4;
}
.activity-feed__job {
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--brand-700);
	font-weight: 600;
}
.activity-feed__job:hover {
	text-decoration: underline;
}
.activity-feed__details {
	font-size: 12px;
}
.activity-feed__time {
	font-size: 11px;
	color: var(--text-muted);
}

/* Indicadores operacionais da Fase 6. */
.workflow-dashboard {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}
.workflow-dashboard .section-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}
.workflow-dashboard__grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: var(--space-3);
}
.workflow-dashboard__grid .kpi-card {
	min-width: 0;
}
.workflow-dashboard__grid .kpi-card__trend {
	line-height: 1.35;
}
.workflow-flag {
	display: inline-block;
	padding: 2px 7px;
	border-radius: var(--radius-pill);
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
}
.workflow-flag--warning {
	color: var(--warning);
	background: var(--warning-bg);
}
.jobs-table__workflows {
	min-width: 150px;
}
.jobs-table__workflows .workflow-flag {
	margin: 2px 0;
}

/* Responsividade dashboard — tablet (<=1024px): grelhas a 2 colunas */
@media (max-width: 1024px) {
	.workflow-dashboard__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	.dashboard__kpis,
	.dashboard__row3,
	.dashboard__row4 {
		grid-template-columns: repeat(2, 1fr);
	}
	.dashboard__row2 {
		grid-template-columns: repeat(2, 1fr);
	}
	.pulse__stats {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* Mobile: largura estreita — listas colapsam, prioridades em pilha */
@media (max-width: 640px) {
	.workflow-dashboard .section-heading {
		align-items: flex-start;
		flex-direction: column;
	}
	.workflow-dashboard__grid {
		grid-template-columns: 1fr;
	}
	.dashboard__kpis,
	.dashboard__row2,
	.dashboard__row3,
	.dashboard__row4 {
		grid-template-columns: 1fr;
	}
	.prio-list__item {
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"main resp"
			"due prio";
		row-gap: 6px;
	}
	.prio-list__main {
		grid-area: main;
	}
	.prio-list__resp {
		grid-area: resp;
	}
	.prio-list .badge {
		grid-area: prio;
	}
	.prio-list__due {
		grid-area: due;
	}
}

/* Mobile: suporte mínimo funcional (design.md §8) */

/* ===========================================================================
   Fase 5 — Lista de Trabalhos
   =========================================================================== */

/* Utilitário: esconder visualmente mantendo acessibilidade. */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Campo inline (label + controlo na mesma linha, label escondida via .visually-hidden). */
.field--inline {
	display: flex;
	align-items: center;
	gap: 0;
	margin: 0;
}

/* Layout da lista de trabalhos. */
.jobs.stack {
	gap: var(--space-4);
}

/* Toolbar: pesquisa em cima, filtros em baixo. Empilha em ecrãs estreitos. */
.jobs-toolbar {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
	padding: var(--space-4);
}
.jobs-toolbar__search {
	max-width: 420px;
}
.jobs-toolbar__search .input-group {
	width: 100%;
}
.jobs-toolbar__search .input {
	width: 100%;
}
.jobs-toolbar__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
}
.jobs-toolbar__filters .field--inline {
	flex: 1 1 180px;
	min-width: 160px;
}
.jobs-toolbar__filters .select {
	width: 100%;
}
.jobs-toolbar__actions {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	flex: 0 0 auto;
}

/* Card flush: sem padding interno para a tabela ir às margens. */
.card--flush > .card__body--flush {
	padding: 0;
}

/* Tabela de trabalhos. */
.jobs-table {
	min-width: 960px;
}
.jobs-table th.is-sortable {
	padding: 0;
}
.jobs-table .sort-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 11px var(--space-4);
	color: inherit;
	text-decoration: none;
	width: 100%;
}
.jobs-table .sort-link:hover {
	color: var(--text-primary);
}
.jobs-table .sort-link:focus-visible {
	outline: 2px solid var(--accent-500);
	outline-offset: -2px;
	border-radius: 4px;
}

/* Linha clicável + acessível por teclado. */
.jobs-table__row {
	cursor: pointer;
}
.jobs-table__row:focus-visible {
	outline: 2px solid var(--accent-500);
	outline-offset: -2px;
}
.jobs-table__resp {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}
.jobs-table__due--over {
	color: var(--error);
	font-weight: 600;
}

/* Célula de progresso (variante inline com label). */
.jobs-table .progress,
.job-summary .progress {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	height: auto;
	background: transparent;
	overflow: visible;
	min-width: 92px;
}
.jobs-table .progress__bar,
.job-summary .progress__bar {
	flex: 1;
	height: 6px;
	min-width: 60px;
	background: var(--border);
	border-radius: var(--radius-pill);
	overflow: hidden;
}
.jobs-table .progress__fill,
.job-summary .progress__fill {
	display: block;
	height: 100%;
	background: var(--brand-700);
	border-radius: var(--radius-pill);
	transition: width var(--transition);
}
.jobs-table .progress__fill--done,
.job-summary .progress__fill--done {
	background: var(--success);
}
.jobs-table .progress__label,
.job-summary .progress__label {
	font-size: 12px;
	color: var(--text-secondary);
	font-variant-numeric: tabular-nums;
	min-width: 34px;
	text-align: right;
}

/* Empty state dentro da tabela. */
.jobs .table-empty {
	padding: var(--space-6) var(--space-4);
}

/* Paginação. */
.pagination {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}
.pagination__pages {
	display: inline-flex;
	gap: var(--space-1);
}
.pagination__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 var(--space-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-input);
	background: var(--surface);
	color: var(--text-primary);
	font-size: 13px;
	text-decoration: none;
	transition:
		background var(--transition),
		border-color var(--transition);
}
.pagination__link:hover {
	background: var(--surface-muted);
	border-color: var(--text-secondary);
}
.pagination__link:focus-visible {
	outline: 2px solid var(--accent-500);
	outline-offset: 2px;
}
.pagination__link--current {
	background: var(--brand-800);
	border-color: var(--brand-800);
	color: #fff;
	font-weight: 600;
}
.pagination__link--disabled {
	color: var(--text-secondary);
	opacity: 0.5;
	cursor: not-allowed;
}
.pagination__prev,
.pagination__next {
	padding: 0 var(--space-3);
}
.pagination__meta {
	margin-top: calc(var(--space-1) * -1);
}

/* Detalhe (placeholder Fase 5). */
.job-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: var(--space-4);
	margin: 0;
}
.job-summary__item {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.job-summary__item dt {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: var(--text-secondary);
	font-weight: 600;
}
.job-summary__item dd {
	margin: 0;
	font-size: 14px;
	color: var(--text-primary);
}
.job-summary__due--over {
	color: var(--error);
	font-weight: 600;
}

/* Responsividade: em ecrãs estreitos, filtros empilham plenamente. */
@media (max-width: 720px) {
	.jobs-toolbar__actions {
		width: 100%;
		justify-content: flex-end;
	}
}

/* ---------------------------------------------------------------------------
   Detalhe do trabalho — Fase 7
   ------------------------------------------------------------------------- */
.job-detail {
	gap: var(--space-5);
}
.job-detail__resp {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.job-detail__desc {
	margin-top: var(--space-4);
	padding-top: var(--space-4);
	border-top: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.job-detail__desc-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: var(--text-secondary);
	font-weight: 600;
	margin: 0;
}
.job-detail__desc-body {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--text-primary);
	white-space: pre-line;
}
.job-detail__blocker {
	margin-top: var(--space-4);
	padding: var(--space-3) var(--space-4);
	background: var(--error-bg);
	border: 1px solid var(--error-border);
	border-radius: var(--radius-sm);
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
}
.job-detail__blocker-icon {
	color: var(--error);
	flex-shrink: 0;
	margin-top: 2px;
}
.job-detail__blocker-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: var(--error);
	font-weight: 700;
	margin: 0 0 2px;
}
.job-detail__blocker-body {
	margin: 0;
	font-size: 14px;
	color: var(--text-primary);
	line-height: 1.5;
}
.job-detail__risk {
	display: inline-block;
	font-size: 13px;
	font-weight: 600;
	padding: 2px 10px;
	border-radius: var(--radius-pill);
}
.job-detail__risk--none {
	color: var(--text-secondary);
	background: var(--surface-muted);
	border: 1px solid var(--border);
}
.job-detail__risk--low {
	color: var(--success);
	background: var(--success-bg);
}
.job-detail__risk--medium {
	color: var(--warning);
	background: var(--warning-bg);
}
.job-detail__risk--high {
	color: var(--error);
	background: var(--error-bg);
}

/* Grelha: comentários (esquerda, maior) + atividade/marcos (direita). */
.job-detail__grid {
	display: grid;
	grid-template-columns: 1.6fr 1fr;
	gap: var(--space-5);
	align-items: start;
}
.job-detail__side {
	gap: var(--space-4);
}

/* Comentários — lista */
.comment-list {
	list-style: none;
	margin: 0 0 var(--space-4);
	padding: 0;
	display: flex;
	flex-direction: column;
}
.comment-list__item {
	display: grid;
	grid-template-columns: 28px 1fr;
	gap: var(--space-3);
	padding: var(--space-3) 0;
	border-bottom: 1px solid var(--border);
}
.comment-list__item:first-child {
	padding-top: 0;
}
.comment-list__item:last-child {
	border-bottom: none;
}
.comment-list__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.comment-list__head {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
}
.comment-list__author {
	font-size: 13.5px;
}
.comment-list__time {
	margin-left: auto;
	white-space: nowrap;
}
.comment-list__text {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: var(--text-primary);
	white-space: pre-line;
}

/* Formulário de comentário */
.comment-form {
	padding-top: var(--space-4);
	border-top: 1px solid var(--border);
}
.comment-form .field {
	margin-bottom: var(--space-3);
}
.comment-form__actions {
	display: flex;
	justify-content: flex-end;
}

/* Marco concluído: ponto verde. */
.milestones__dot--done {
	background: var(--success);
}

/* Responsividade: tablet > coluna única. */
@media (max-width: 1024px) {
	.job-detail__grid {
		grid-template-columns: 1fr;
	}
}

/* ---------------------------------------------------------------------------
   Fase 8 — Formulário de criação/edição de trabalho
   ------------------------------------------------------------------------- */
.job-form__card {
	overflow: hidden;
}
.job-form__error-summary {
	padding: var(--space-4) var(--space-5);
	background: var(--error-bg);
	border: 1px solid var(--error-border);
	border-left: 4px solid var(--error);
	border-radius: var(--radius-input);
}
.job-form__error-summary h2 {
	font-size: 15px;
	margin-bottom: var(--space-2);
}
.job-form__error-summary ul {
	margin: 0;
	padding-left: 20px;
}
.job-form__error-summary a {
	color: var(--error);
	text-decoration: underline;
}
.job-form__identity-code {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
	padding: var(--space-3) var(--space-4);
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
.job-form__identity-code .field__label {
	margin: 0;
}
.job-form__section-intro {
	margin: -4px 0 var(--space-4);
}
.job-workflow__semantic {
	display: block;
	font-size: 12px;
	font-weight: 400;
	color: var(--text-secondary);
}
.job-workflow__details dd strong {
	display: block;
}
.job-form .field--check .field__hint {
	margin-left: 26px;
}
.job-form input:disabled,
.job-form select:disabled {
	opacity: 0.7;
}
.job-form__group {
	border: none;
	padding: 0;
	margin: 0 0 var(--space-5);
}
.job-form__group:last-of-type {
	margin-bottom: 0;
}
.job-form__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1);
	margin-bottom: var(--space-5);
	padding-bottom: var(--space-2);
	border-bottom: 1px solid var(--border);
}
.job-form__tab {
	appearance: none;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	color: var(--text-secondary);
	background: transparent;
	border: 1px solid transparent;
	border-radius: var(--radius-pill);
	padding: var(--space-2) var(--space-4);
	cursor: pointer;
	white-space: nowrap;
	transition:
		background 0.15s,
		color 0.15s,
		border-color 0.15s;
}
.job-form__tab:hover {
	background: var(--surface-muted);
	color: var(--text-primary);
}
.job-form__tab.is-active {
	background: var(--accent-100);
	color: var(--accent-600);
	border-color: var(--accent-100);
}
.job-form__tab:focus-visible {
	outline: 3px solid var(--accent-500);
	outline-offset: 1px;
}
.job-form__legend {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--text-secondary);
	padding: 0;
	margin-bottom: var(--space-3);
}
.job-form__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-4);
}
.job-form__grid--3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
.job-form__footer {
	justify-content: space-between;
}
.job-form__footer .btn--ghost {
	margin-right: auto;
}

@media (max-width: 1024px) {
	.job-form__grid--3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.job-form__card .card__body {
		padding: var(--space-4);
	}
}
@media (max-width: 768px) {
	.job-form__grid,
	.job-form__grid--3 {
		grid-template-columns: 1fr;
	}
	.job-form__identity-code {
		align-items: flex-start;
		flex-direction: column;
		gap: var(--space-1);
	}
}
@media (max-width: 640px) {
	.job-form__footer {
		align-items: stretch;
		flex-direction: column-reverse;
	}
	.job-form__footer .btn,
	.job-form__footer .btn--ghost {
		width: 100%;
		margin: 0;
	}
}

/* ---------------------------------------------------------------------------
   Equipas — Fase 9
   Cartões de equipa: código, responsável, carga (barra), membros, trabalhos ativos.
   ------------------------------------------------------------------------- */
.teams {
	gap: var(--space-5);
}
.teams-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-4);
}
.teams-card {
	display: flex;
	flex-direction: column;
}
.teams-card__header {
	flex-wrap: wrap;
	gap: var(--space-3);
}
.teams-card__heading {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
}
.teams-card__code {
	display: inline-flex;
	align-items: center;
	height: 40px;
	padding: 0 var(--space-2);
	background: var(--brand-100);
	color: var(--brand-800);
	border-radius: var(--radius-input);
	font-weight: 700;
	letter-spacing: 0.04em;
	flex-shrink: 0;
}
.teams-card__name {
	font-size: 16px;
	font-weight: 700;
}
.teams-card__manager {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--text-secondary);
	font-size: 13px;
	margin-top: 2px;
}
.teams-card__manager-icon {
	opacity: 0.7;
}
.teams-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}
.teams-card__load {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding-bottom: var(--space-4);
	border-bottom: 1px solid var(--border);
}
.teams-card__load-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}
.teams-card__load-label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-secondary);
}
.teams-card__load-nums {
	font-size: 13px;
	color: var(--text-secondary);
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
}
.teams-card__load-nums strong {
	color: var(--text-primary);
	font-size: 18px;
	font-weight: 700;
}
.teams-card__bar {
	display: block;
	height: 10px;
	background: var(--border);
	border-radius: var(--radius-pill);
	overflow: hidden;
}
.teams-card__fill {
	display: block;
	height: 100%;
	border-radius: var(--radius-pill);
	transition: width var(--transition);
}
.teams-card__fill--ok {
	background: var(--success);
}
.teams-card__fill--high {
	background: var(--warning);
}
.teams-card__fill--over {
	background: var(--error);
}
.teams-card__fill--low {
	background: var(--text-muted);
}
.teams-card__load-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
}
.teams-card__state {
	font-size: 12px;
	font-weight: 600;
}
.teams-card__state--ok {
	color: var(--success);
}
.teams-card__state--high {
	color: #7a5612;
}
.teams-card__state--over {
	color: var(--error);
}
.teams-card__state--low {
	color: var(--text-muted);
}
.teams-card__blocked {
	color: var(--error);
	font-size: 11px;
	font-weight: 600;
}
.teams-card__section-title {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--text-secondary);
	margin: 0 0 var(--space-3);
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}
.teams-card__section-count {
	font-size: 12px;
	font-weight: 700;
	color: var(--text-primary);
	background: var(--surface-muted);
	border-radius: var(--radius-pill);
	padding: 1px 8px;
}
.teams-card__footer {
	justify-content: flex-start;
}

/* Membros */
.teams-members {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}
.teams-members__item {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: 5px var(--space-2) 5px 5px;
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	font-size: 13px;
}
.teams-members__name {
	font-weight: 500;
}

/* Trabalhos ativos */
.teams-jobs {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.teams-jobs__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-2) var(--space-3);
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-input);
}
.teams-jobs__link {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	color: inherit;
}
.teams-jobs__link:hover .teams-jobs__title {
	color: var(--brand-700);
	text-decoration: underline;
}
.teams-jobs__code {
	font-size: 11px;
	color: var(--text-secondary);
}
.teams-jobs__title {
	font-size: 13px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}
.teams-jobs__meta {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	flex-shrink: 0;
}
.teams-jobs__due {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	color: var(--text-secondary);
	white-space: nowrap;
}
.teams-jobs__due--over {
	color: var(--error);
	font-weight: 600;
}
.teams-jobs__more {
	text-align: center;
	padding-top: var(--space-1);
}
.teams-jobs__more a {
	font-size: 13px;
	font-weight: 600;
	color: var(--brand-700);
}
.teams-jobs__more a:hover {
	text-decoration: underline;
}

@media (max-width: 1024px) {
	.teams-grid {
		grid-template-columns: 1fr;
	}
}

/* ---------------------------------------------------------------------------
   O Meu Trabalho — Fase 11 (Dashboard Funcionário)
   Dashboard pessoal: KPIs, Prioridades, Prazos próximos, Bloqueios,
   Trabalhos atribuídos (com atualização de estado), Atividade recente.
   Reutiliza tokens, .card, .badge, .kpi-card, .prio-list, .risk-list,
   .activity-feed, .progress, .avatar, .table, .btn, icon(), helpers pt-PT.
   CSS novo isolado sob .mywork-*, sem estilos inline.
   ------------------------------------------------------------------------- */
.mywork {
	gap: var(--space-5);
}

/* KPIs pessoais reutilizam .grid-4; linhas seguintes usam .grid-2 */
.mywork__row2,
.mywork__row3 {
	gap: var(--space-4);
	align-items: stretch;
}

/* Altura consistente: cards esticam à mesma altura na linha; corpo preenche e
   paginação fixa no rodapé do card (cabeçalho + corpo + paginação). */
.mywork__row2 > .card,
.mywork__row3 > .card {
	display: flex;
	flex-direction: column;
}
.mywork__row2 > .card > .card__body,
.mywork__row3 > .card > .card__body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}
.mywork__row2 > .card > .card__body > :first-child,
.mywork__row3 > .card > .card__body > :first-child {
	flex: 1 1 auto;
}
.card__pagination {
	margin-top: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-top: 1px solid var(--border);
	justify-content: center;
}
/* Tabela de atribuídos com scroll horizontal em ecrãs estreitos */
.mywork__table-wrap {
	overflow-x: auto;
}

.mywork__table-wrap .table {
	min-width: 820px;
}

/* Destaque de prazo atrasado na coluna de prazo */
.mywork__due--over {
	color: var(--error);
	font-weight: 600;
	white-space: nowrap;
}

/* Formulário de atualização de estado: ocupa modal em coluna. */
.mywork__status-form {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
	margin: 0;
}

/* Responsividade: tablet (≤1024px) — linhas empilham via .grid-2/.grid-4
   já definidos globalmente; aqui só ajustes finos. */
@media (max-width: 1100px) {
	.mywork__row2,
	.mywork__row3 {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.mywork__status-form .btn span {
		display: none;
	}
}

/* ---------------------------------------------------------------------------
   Administração — Fase 12 (Administração Demonstrativa)
   Listas de utilizadores (com toggle ativo/inativo), equipas (capacidade +
   carga), e configuração (estados/prioridades como listas fechadas do MVP).
   Reutiliza tokens, .card, .table, .badge, .avatar, .switch, .progress,
   .empty, icon(). CSS isolado sob .admin-*, sem estilos inline além do
   width:% do progresso (herdado do padrão das fases anteriores).
   ------------------------------------------------------------------------- */
.admin {
	gap: var(--space-5);
}
.admin-actions {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.admin-actions .btn--icon {
	width: 30px;
	height: 30px;
	padding: 5px;
}
.admin-form__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-3);
}
.admin-form__grid .field {
	margin-bottom: 0;
}
.admin-form__full {
	grid-column: 1 / -1;
}
.admin-color-picker {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	height: 42px;
	padding: 5px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-input);
	background: var(--surface);
}
.admin-color-picker:focus-within {
	border-color: var(--brand-700);
	box-shadow: 0 0 0 3px var(--brand-100);
}
.admin-color-picker input[type="color"] {
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 7px;
	background: none;
	cursor: pointer;
}
.admin-color-picker output {
	font-family: var(--font-mono, monospace);
	font-size: 13px;
	color: var(--text-secondary);
}
.admin-modal-form .modal__body {
	padding-bottom: var(--space-5);
}
@media (max-width: 560px) {
	.admin-form__grid {
		grid-template-columns: 1fr;
	}
}

/* Tabelas com scroll horizontal em ecrãs estreitos */
.admin__table-wrap {
	overflow-x: auto;
}
.admin__table-wrap .table {
	min-width: 720px;
}

/* Modal “Alterar estado” (dashboard Funcionário) — D-MW-STATUS */
.mywork__status-header {
	align-items: flex-start;
}
.mywork__status-header > div {
	display: grid;
	gap: 2px;
}
.mywork__status-eyebrow,
.mywork__status-caption {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--text-muted);
}
.mywork__status-body {
	display: grid;
	gap: var(--space-4);
}
.mywork__status-job {
	display: grid;
	gap: 3px;
	margin: 0;
	padding: var(--space-3);
	border-left: 3px solid var(--accent-600);
	border-radius: 0 var(--radius-input) var(--radius-input) 0;
	background: var(--surface-muted);
}
.mywork__status-job .text-mono {
	font-size: 12px;
	color: var(--text-secondary);
}
.mywork__status-job strong {
	font-size: 14px;
	line-height: 1.35;
	color: var(--text-primary);
}
.mywork__status-flow {
	display: grid;
	grid-template-columns: minmax(0, 0.85fr) auto minmax(0, 1.15fr);
	align-items: end;
	gap: var(--space-3);
	padding: var(--space-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-input);
	background: var(--surface);
}
.mywork__status-current,
.mywork__status-target {
	display: grid;
	gap: 7px;
	margin: 0;
}
.mywork__status-current .badge {
	justify-self: start;
}
.mywork__status-arrow {
	align-self: center;
	padding-top: 18px;
	font-size: 20px;
	line-height: 1;
	color: var(--accent-600);
}
.mywork__status-target .select {
	min-height: 38px;
	padding-block: 8px;
}
.mywork__status-guidance {
	position: relative;
	margin: calc(-1 * var(--space-2)) 0 0;
	padding: 0 0 0 var(--space-3);
	font-size: 13px;
	line-height: 1.45;
	color: var(--text-secondary);
}
.mywork__status-guidance::before {
	position: absolute;
	left: 0;
	top: 0.45em;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--accent-600);
	content: "";
}
.mywork__status-extra {
	margin: 0;
	padding-top: var(--space-3);
	border-top: 1px solid var(--border);
}
.mywork__status-extra .textarea {
	min-height: 88px;
}
.mywork__status-footer {
	justify-content: space-between;
}
.mywork__status-footer .btn {
	width: auto;
}
@media (max-width: 560px) {
	.mywork__status-flow {
		grid-template-columns: 1fr;
		gap: var(--space-2);
	}
	.mywork__status-arrow {
		display: none;
	}
}
@media (max-width: 640px) {
	.mywork__status-footer {
		align-items: stretch;
	}
	.mywork__status-footer .btn {
		width: 100%;
	}
}

/* Utilizadores */
.admin-user__name {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}
.admin-user__name-text {
	font-weight: 600;
}
.admin-user__team {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.admin-user__toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
}
.admin-user__self {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}
.admin-user__state {
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}
.admin-user__state--on {
	color: var(--success);
}
.admin-user__state--off {
	color: var(--text-muted);
}
/* Switch só de leitura (a própria conta): tom de marca mas com knob no
   estado "ligado" para coerência visual com os switches ativos. */
.switch--locked {
	cursor: not-allowed;
	opacity: 0.9;
}
.switch--locked .switch__track {
	background: var(--success);
}
.switch--locked .switch__track::after {
	transform: translateX(16px);
}

/* Equipas — coluna de carga */
.admin-team__manager {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.admin-team__manager svg {
	opacity: 0.7;
}
.admin-team__load {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 180px;
}
.admin-team__bar {
	display: block;
	height: 8px;
}
.admin-team__fill {
	display: block;
	height: 100%;
	border-radius: var(--radius-pill);
	transition: width var(--transition);
}
.admin-team__fill--ok {
	background: var(--success);
}
.admin-team__fill--high {
	background: var(--warning);
}
.admin-team__fill--over {
	background: var(--error);
}
.admin-team__fill--low {
	background: var(--text-muted);
}
.admin-team__load-nums {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	font-size: 12px;
	color: var(--text-secondary);
}
.admin-team__load-nums strong {
	color: var(--text-primary);
	font-size: 14px;
	font-weight: 700;
}
.admin-team__state {
	font-size: 11px;
	font-weight: 600;
	padding: 1px 8px;
	border-radius: var(--radius-pill);
	border: 1px solid transparent;
}
.admin-team__state--ok {
	color: var(--success);
	background: var(--success-bg);
	border-color: var(--success-border);
}
.admin-team__state--high {
	color: #7a5612;
	background: var(--warning-bg);
	border-color: var(--warning-border);
}
.admin-team__state--over {
	color: var(--error);
	background: var(--error-bg);
	border-color: var(--error-border);
}
.admin-team__state--low {
	color: var(--text-muted);
	background: var(--surface-muted);
	border-color: var(--border);
}

/* Upload de foto de perfil (modal editar utilizador) */
.admin-avatar-upload {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	flex-wrap: wrap;
}
.admin-avatar-upload__controls {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}
.admin-avatar-upload__hint {
	width: 100%;
	color: var(--text-muted);
	font-size: 0.8rem;
}

/* Configuração — listas fechadas (estados / prioridades) */
.admin__config {
	align-items: start;
}
.admin__config-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.admin__config-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-2) var(--space-3);
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

@media (max-width: 1024px) {
	.admin__config {
		grid-template-columns: 1fr;
	}
}

/* Fase 3 — Aprovação e FSC */
.job-workflow {
	margin-top: var(--space-5);
	padding: var(--space-4);
	background: var(--surface-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
.job-workflow__header,
.job-workflow__details {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--space-4);
}
.job-workflow__details {
	justify-content: flex-start;
	flex-wrap: wrap;
	margin: var(--space-4) 0 0;
}
.job-workflow__details > div {
	min-width: 160px;
}
.job-workflow__details dt {
	font-size: 12px;
	color: var(--text-secondary);
}
.job-workflow__details dd {
	margin: 2px 0 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}
.job-workflow__badge {
	display: inline-block;
	margin-top: var(--space-2);
	padding: 3px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	background: var(--surface);
	color: var(--text-secondary);
	font-weight: 600;
}
.job-workflow__badge--pending {
	color: var(--warning);
	border-color: var(--warning-border);
	background: var(--warning-bg);
}
.job-workflow__badge--done {
	color: var(--success);
	border-color: var(--success-border);
	background: var(--success-bg);
}
.job-workflow__actions {
	flex-shrink: 0;
}
.field--check {
	margin-bottom: var(--space-4);
}
.field__check {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}
.field__check input {
	width: 18px;
	height: 18px;
	accent-color: var(--brand-700);
}
@media (max-width: 640px) {
	.job-workflow__header {
		flex-direction: column;
	}
	.job-workflow__actions,
	.job-workflow__actions form,
	.job-workflow__actions .btn {
		width: 100%;
	}
	.job-workflow__details {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-3);
	}
	.job-workflow__details > div {
		min-width: 0;
	}
}

/* ===========================================================================
   Modernização (Preserve) — dials: V3 / M3 / D7
   Acrescentos não-destrutivos sobre tokens e componentes existentes.
   Sem novas cores de marca, sem alterar raios ou navegação.
   =========================================================================== */

/* Reduced motion global — qualquer animação acima de MOTION 3 cai para estático. */
@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;
	}
}

/* Tátil: botões e cartões clicáveis simulam pressão física. */
.btn:active:not(:disabled),
.pagination__link:active {
	transform: translateY(1px);
}
.kpi-card--link:active {
	transform: translateY(0);
	box-shadow: var(--shadow-card);
}

/* Foco mais consistente em superfícies de marca. */
.sidebar__item:focus-visible,
.breadcrumb__link:focus-visible,
.jobs-table__row:focus-visible,
.pagination__link:focus-visible,
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.teams-jobs__link:focus-visible,
.prio-list__main:focus-visible,
.risk-list__main:focus-visible {
	outline: 3px solid var(--accent-500);
	outline-offset: 2px;
}

/* Hierarquia de cartões: card de prioridade visualmente acima dos comuns. */
.card--priority {
	border-color: var(--brand-700);
	box-shadow:
		0 1px 3px rgba(16, 45, 39, 0.08),
		0 0 0 1px var(--brand-100);
}
.card--priority .card__header {
	background: var(--brand-100);
	border-bottom-color: var(--brand-100);
}

/* Estado atual + próxima ação do detalhe: barra de estado acima do resumo. */
.job-status-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-5);
	background: linear-gradient(180deg, var(--surface-muted), var(--surface));
	border: 1px solid var(--border);
	border-bottom: none;
	border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.job-status-bar + .card {
	border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.job-status-bar__title {
	flex: 1 1 100%;
	display: flex;
	align-items: baseline;
	gap: var(--space-3);
	flex-wrap: wrap;
}
.job-status-bar__code {
	font-family: var(--font-mono);
	font-size: 12.5px;
	color: var(--text-secondary);
}
.job-status-bar__name {
	font-size: 20px;
	font-weight: 600;
	letter-spacing: -0.2px;
}
.job-status-bar__badges {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	margin-left: auto;
}
.job-status-bar__action {
	display: inline-flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}
.job-status-bar__hint {
	font-size: 12px;
	color: var(--text-secondary);
}
@media (max-width: 640px) {
	.job-status-bar__badges {
		margin-left: 0;
		flex: 1 1 100%;
	}
}

/* Agrupamento visual de secções da lista: primário vs avançado. */
.jobs-toolbar__group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
}
.jobs-toolbar__group + .jobs-toolbar__group {
	padding-top: var(--space-3);
	border-top: 1px dashed var(--border);
}
.jobs-toolbar__group-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--text-muted);
	flex: 0 0 auto;
}

/* Navegação ativa por prefixo (detalhe/criar/editar mantêm Trabalhos ativo). */
.sidebar__item.is-active-trunk {
	color: #fff;
}
.sidebar__item.is-active-trunk::before {
	opacity: 0.55;
}

/* Linha clicável: sublinhado de foco discreto. */
.jobs-table__row:focus-visible {
	outline-offset: -2px;
}
.jobs-table__row:hover .table__cell-strong {
	color: var(--brand-700);
}

/* Separador de emissão reduzido para dados em falta (substitui em-dash visível). */
.data-nil {
	color: var(--text-muted);
	font-weight: 400;
}

/* Hierarquia tipográfica mais limpa: legendas de secção de formulário menos gritantes. */
.job-form__legend {
	letter-spacing: 0;
	text-transform: none;
	color: var(--text-primary);
	font-size: 15px;
}
.job-form__legend::before {
	content: "";
	display: inline-block;
	width: 3px;
	height: 14px;
	background: var(--accent-500);
	border-radius: 2px;
	margin-right: var(--space-2);
	vertical-align: -2px;
}

/* ---------------------------------------------------------------------------
   Clientes — Fase 13 (Gestão de Clientes).
   Toolbar de pesquisa (reutiliza tokens de .jobs-toolbar), tabela densa com
   toggle ativo/inativo (padrão switch do Admin) e ações inline de edição.
   Sem eliminação. CSS isolado sob .clients-* / .client-*.
   ------------------------------------------------------------------------- */
.clients {
	gap: var(--space-5);
}
.clients-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--space-3);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
	padding: var(--space-4);
}
.clients-toolbar__search {
	flex: 1 1 320px;
	max-width: 460px;
}
.clients-toolbar__search .input-group {
	width: 100%;
}
.clients-toolbar__search .input {
	width: 100%;
}
.clients-toolbar__actions {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	flex: 0 0 auto;
}
.clients-table .table__col-actions {
	white-space: nowrap;
}
.supplier-capability {
	text-align: center;
}
.supplier-capability__yes {
	display: inline-flex;
	color: var(--success);
}
.supplier-capability__no {
	color: var(--text-muted);
}
@media (max-width: 720px) {
	.clients-toolbar {
		flex-direction: column;
		align-items: stretch;
	}
	.clients-toolbar__search {
		max-width: none;
	}
	.clients-toolbar__actions {
		justify-content: flex-end;
	}
}

/* =========================================================================
   Relatórios — Fase Relatórios (docs/reports-plan.md)
   Gráficos SVG + HTML/CSS, card financeiro, donut, barras, linha.
   Tokens existentes; sem novos tokens.
   ========================================================================= */
.reports {
	gap: 1.5rem;
}
.reports figure {
	margin: 0;
}

/* Barra de filtros */
.reports-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	align-items: flex-end;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 1rem;
}
.reports-toolbar__group {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: flex-end;
}
.reports-toolbar__group .field--inline {
	margin: 0;
}
.reports-toolbar .field__label {
	font-size: 0.72rem;
	color: var(--text-secondary);
	margin-bottom: 2px;
}
.reports-toolbar__actions {
	display: flex;
	gap: 0.5rem;
	margin-left: auto;
	align-items: center;
}

/* KPIs */
.reports__kpis {
	gap: 1rem;
}

/* Card financeiro principal */
.finance-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem;
	margin-bottom: 1.25rem;
}
.finance-stat {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}
.finance-stat__label {
	font-size: 0.78rem;
	color: var(--text-secondary);
}
.finance-stat__value {
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--text-primary);
	font-variant-numeric: tabular-nums;
}
.finance-stat__pct {
	font-size: 0.8rem;
	color: var(--text-secondary);
}
.finance-stat--favorable .finance-stat__value {
	color: var(--success);
}
.finance-stat--unfavorable .finance-stat__value {
	color: var(--error);
}
.finance-stat--inline .finance-stat__value {
	color: var(--text-secondary);
}
.finance-state--favorable {
	background: var(--success);
	color: #fff;
	border-color: var(--success);
}
.finance-state--unfavorable {
	background: var(--error);
	color: #fff;
	border-color: var(--error);
}
.finance-state--inline {
	background: var(--surface-muted);
	color: var(--text-secondary);
	border-color: var(--border);
}
.finance-state--none {
	background: var(--surface-muted);
	color: var(--text-secondary);
	border-color: var(--border);
}
.finance-bars {
	margin: 1rem 0 0.75rem;
}
.finance-bars__row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}
.finance-bars__lbl {
	width: 5.5rem;
	font-size: 0.8rem;
	color: var(--text-secondary);
}
.finance-bars__track {
	flex: 1;
	height: 18px;
	background: var(--surface-muted);
	border-radius: 6px;
	overflow: hidden;
}
.finance-bars__fill {
	display: block;
	height: 100%;
	border-radius: 6px;
}
.finance-bars__fill--budget {
	background: var(--info);
}
.finance-bars__fill--cost {
	background: var(--accent-600);
}
.finance-note {
	font-size: 0.82rem;
	margin: 0.25rem 0 0;
}

/* Donut */
.donut-wrap {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	flex-wrap: wrap;
}
.donut__total {
	font-size: 1.4rem;
	font-weight: 700;
	fill: var(--text-primary);
}
.donut__total-label {
	font-size: 0.7rem;
	fill: var(--text-secondary);
}
.donut-legend {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}
.donut-legend li {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
}
.donut-legend__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}
.donut-legend__count {
	color: var(--text-secondary);
	margin-left: auto;
}

/* Barras (concluídos vs não) */
.bars {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.bars__row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.bars__label {
	width: 7rem;
	font-size: 0.85rem;
}
.bars__track {
	flex: 1;
	height: 22px;
	background: var(--surface-muted);
	border-radius: 6px;
	position: relative;
}
.bars__fill {
	display: block;
	height: 100%;
	border-radius: 6px;
	min-width: 2px;
}
.bars__val {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.78rem;
	color: #fff;
	font-weight: 600;
}

/* Coortes de registo — conclusão atual */
.cohort-chart__intro {
	margin: 0 0 0.75rem;
	font-size: 0.82rem;
	color: var(--text-secondary);
	line-height: 1.45;
}
.cohort-chart__legend {
	list-style: none;
	display: flex;
	gap: 1rem;
	margin: 0 0 0.75rem;
	font-size: 0.8rem;
}
.cohort-chart__legend li {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}
.cohort-chart__swatch {
	width: 10px;
	height: 10px;
	border-radius: 2px;
}
.cohort-chart__swatch--completed,
.cohort-chart__segment--completed {
	background: var(--success);
}
.cohort-chart__swatch--open,
.cohort-chart__segment--open {
	background: var(--warning);
}
.cohort-chart {
	display: flex;
	flex-direction: column;
	gap: 0.7rem;
}
.cohort-chart__row {
	display: grid;
	grid-template-columns: 5.5rem minmax(0, 1fr) 4.4rem;
	gap: 0.65rem;
	align-items: center;
}
.cohort-chart__month {
	display: flex;
	flex-direction: column;
	font-size: 0.8rem;
	line-height: 1.25;
}
.cohort-chart__month span,
.cohort-chart__rate span {
	font-size: 0.72rem;
	color: var(--text-secondary);
}
.cohort-chart__track {
	display: flex;
	height: 24px;
	min-width: 0;
	background: var(--surface-muted);
	border-radius: 5px;
	overflow: hidden;
}
.cohort-chart__segment {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.cohort-chart__track--empty {
	align-items: center;
	padding: 0 0.5rem;
	color: var(--text-muted);
	font-size: 0.75rem;
}
.cohort-chart__rate {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-size: 0.88rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

/* Barras agrupadas (orçamento vs custo) */
.groupbars {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}
.groupbars__group {
	display: grid;
	grid-template-columns: 8rem 1fr 6rem;
	gap: 0.5rem;
	align-items: center;
}
.groupbars__name {
	font-size: 0.85rem;
	font-weight: 500;
}
.groupbars__bars {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}
.groupbars__row {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}
.groupbars__lbl {
	width: 2.5rem;
	font-size: 0.72rem;
	color: var(--text-secondary);
}
.groupbars__track {
	flex: 1;
	height: 12px;
	background: var(--surface-muted);
	border-radius: 4px;
	overflow: hidden;
}
.groupbars__fill {
	display: block;
	height: 100%;
	border-radius: 4px;
}
.groupbars__fill--budget {
	background: var(--info);
}
.groupbars__fill--cost {
	background: var(--accent-600);
}
.groupbars__dev {
	font-size: 0.8rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
}
.groupbars__dev--over {
	color: var(--success);
}
.groupbars__dev--under {
	color: var(--error);
}

/* Desvios orçamentais — ranking visual para decisão imediata. */
.deviation-card {
	min-width: 0;
	overflow: hidden;
}
.deviation-card__header {
	align-items: flex-start;
}
.deviation-card__count {
	flex: 0 0 auto;
	padding: 3px 8px;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	background: var(--surface-muted);
	color: var(--text-secondary);
	font-size: 0.72rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.deviation-tabs {
	display: flex;
	gap: 0.25rem;
	padding: 0 1rem 0.75rem;
	border-bottom: 1px solid var(--border);
	overflow-x: auto;
}
.deviation-tabs__link {
	flex: 0 0 auto;
	padding: 0.35rem 0.6rem;
	border-radius: var(--radius-pill);
	color: var(--text-secondary);
	font-size: 0.76rem;
	font-weight: 600;
	white-space: nowrap;
}
.deviation-tabs__link:hover {
	background: var(--surface-muted);
	color: var(--text-primary);
}
.deviation-tabs__link:focus-visible {
	outline: 2px solid var(--brand-700);
	outline-offset: 1px;
}
.deviation-tabs__link--current {
	background: var(--brand-100);
	color: var(--brand-800);
}
.deviation-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.deviation-list__item + .deviation-list__item {
	border-top: 1px solid var(--border);
}
.deviation-list__link {
	display: grid;
	grid-template-columns: 2rem minmax(0, 1fr) auto 1rem;
	gap: 0.75rem;
	align-items: center;
	padding: 0.85rem 1rem;
	color: inherit;
	transition:
		background var(--transition-fast),
		box-shadow var(--transition-fast);
}
.deviation-list__item--over .deviation-list__link:hover {
	background: var(--success-bg);
}
.deviation-list__item--under .deviation-list__link:hover {
	background: var(--error-bg);
}
.deviation-list__link:focus-visible {
	position: relative;
	z-index: 1;
	outline: 2px solid var(--brand-700);
	outline-offset: -2px;
}
.deviation-list__rank {
	display: grid;
	width: 2rem;
	height: 2rem;
	place-items: center;
	border-radius: 50%;
	background: var(--surface-muted);
	color: var(--text-secondary);
	font-size: 0.78rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.deviation-list__item:first-child .deviation-list__rank {
	background: var(--accent-100);
	color: var(--accent-600);
}
.deviation-list__item--over .deviation-list__loss {
	color: var(--success);
}
.deviation-list__item--under .deviation-list__loss {
	color: var(--error);
}
.deviation-list__job,
.deviation-list__finance,
.deviation-list__loss,
.deviation-list__comparison {
	display: flex;
	min-width: 0;
}
.deviation-list__job {
	flex-direction: column;
	gap: 0.15rem;
}
.deviation-list__title {
	overflow: hidden;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.deviation-list__meta {
	display: flex;
	gap: 0.35rem;
	overflow: hidden;
	color: var(--text-secondary);
	font-size: 0.78rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.deviation-list__finance {
	align-items: flex-end;
	gap: 0.8rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
}
.deviation-list__loss {
	flex-direction: column;
	align-items: flex-end;
	line-height: 1.15;
}
.deviation-list__loss-label {
	margin-bottom: 0.15rem;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
.deviation-list__loss strong {
	font-size: 1.05rem;
}
.deviation-list__loss > span:last-child {
	font-size: 0.75rem;
	font-weight: 600;
}
.deviation-list__comparison {
	flex-direction: column;
	gap: 0.1rem;
	color: var(--text-secondary);
	font-size: 0.72rem;
	line-height: 1.3;
	white-space: nowrap;
}
.deviation-list__comparison strong {
	color: var(--text-primary);
	font-weight: 600;
}
.deviation-list__arrow {
	color: var(--text-muted);
	font-size: 1.5rem;
	line-height: 1;
}
.deviation-pagination {
	justify-content: center;
	padding: 0.85rem 1rem 0;
	border-top: 1px solid var(--border);
}
.deviation-pagination__meta {
	margin: 0.35rem 1rem 0.85rem;
	text-align: center;
}

/* Barras de bloqueio */
.blockbars {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.blockbars__row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.blockbars__label {
	width: 16rem;
	font-size: 0.85rem;
	overflow: hidden;
	text-overflow: ellipsis;
}
.blockbars__track {
	flex: 1;
	height: 16px;
	background: var(--surface-muted);
	border-radius: 4px;
	overflow: hidden;
}
.blockbars__fill {
	display: block;
	height: 100%;
	background: var(--error);
	border-radius: 4px;
}
.blockbars__count {
	width: 2rem;
	text-align: right;
	font-size: 0.85rem;
	font-weight: 600;
}

/* Conteúdo apenas na impressão (oculto no ecrã) */
.report-print {
	display: none;
}
.report-print-cap {
	display: none;
}

/* Responsividade tablet */
@media (max-width: 1024px) {
	.reports-toolbar {
		flex-direction: column;
		align-items: stretch;
	}
	.reports-toolbar__actions {
		margin-left: 0;
		justify-content: flex-end;
	}
	.finance-grid {
		grid-template-columns: 1fr;
	}
	.groupbars__group {
		grid-template-columns: 6rem 1fr 5rem;
	}
	.blockbars__label {
		width: 11rem;
	}
}
@media (max-width: 768px) {
	.deviation-list__link {
		grid-template-columns: 2rem minmax(0, 1fr) 1rem;
		gap: 0.6rem;
	}
	.deviation-list__finance {
		grid-column: 2 / -1;
		justify-content: space-between;
		align-items: center;
		padding-top: 0.35rem;
		border-top: 1px dashed var(--border);
	}
	.deviation-list__loss {
		align-items: flex-start;
		text-align: left;
	}
	.deviation-list__comparison {
		align-items: flex-end;
	}
	.donut-wrap {
		flex-direction: column;
		align-items: stretch;
	}
	.donut-legend {
		flex-direction: row;
		flex-wrap: wrap;
	}
	.groupbars__group {
		grid-template-columns: 1fr;
	}
	.groupbars__name {
		font-weight: 600;
	}
	.cohort-chart__row {
		grid-template-columns: 4.5rem minmax(0, 1fr) 3.8rem;
		gap: 0.4rem;
	}
	.cohort-chart__month span,
	.cohort-chart__rate span {
		font-size: 0.67rem;
	}
}

/* ===== Impressão / Guardar como PDF ===== */
@media print {
	@page {
		size: A4;
		margin: 14mm;
	}
	.app-shell {
		display: block;
	}
	.sidebar,
	.sidebar-backdrop,
	.topbar__toggle {
		display: none !important;
	}
	.main {
		margin: 0;
		padding: 0;
	}
	.content {
		padding: 0 !important;
		background: #fff;
	}
	.reports-toolbar {
		display: none !important;
	}
	.card,
	.kpi-card {
		box-shadow: none;
		border: 1px solid #ccc;
		break-inside: avoid;
	}
	.grid {
		display: block;
	}
	.grid > * {
		margin-bottom: 10px;
		break-inside: avoid;
	}

	/* Capa de impressão */
	.report-print-cap {
		display: block;
		margin-bottom: 16px;
		padding-bottom: 10px;
		border-bottom: 2px solid #225145;
	}
	.report-print-cap__brand {
		font-size: 1.1rem;
		font-weight: 700;
		color: #225145;
	}
	.report-print-cap__title {
		font-size: 1.4rem;
		font-weight: 700;
		margin: 2px 0;
	}
	.report-print-cap__meta {
		display: flex;
		justify-content: space-between;
		font-size: 0.8rem;
		color: #64716b;
	}

	/* Conteúdo detalhado apenas na impressão */
	.report-print {
		display: block;
	}
	.report-print__title {
		font-size: 1.1rem;
		font-weight: 600;
		margin: 16px 0 6px;
		break-after: avoid;
	}
	.report-print__footer {
		margin-top: 20px;
		padding-top: 8px;
		border-top: 1px solid #ccc;
		font-size: 0.78rem;
		color: #64716b;
		text-align: center;
	}

	/* Tabelas: cabeçalhos repetidos por página */
	thead {
		display: table-header-group;
	}
	tr {
		break-inside: avoid;
	}
	.table-scroll {
		overflow: visible;
	}
	.table--compact {
		font-size: 0.72rem;
	}
	.table--compact th,
	.table--compact td {
		padding: 4px 6px;
	}

	/* Cores mantêm legibilidade a preto e branco */
	.bars__fill,
	.groupbars__fill,
	.blockbars__fill,
	.finance-bars__fill {
		print-color-adjust: exact;
		-webkit-print-color-adjust: exact;
	}
	.data-nil {
		color: #64716b;
	}
}

/* ---------------------------------------------------------------------------
   Demonstração guiada — highlight com foco operacional.
   ------------------------------------------------------------------------- */
.topbar__demo {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border: 1px solid var(--border);
	border-radius: var(--radius-btn);
	padding: 8px 11px;
	background: var(--surface-muted);
	color: var(--brand-700);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition:
		background var(--transition),
		border-color var(--transition),
		transform var(--transition);
}
.topbar__demo:hover {
	background: var(--brand-100);
	border-color: var(--brand-700);
	transform: translateY(-1px);
}
.topbar__demo svg {
	width: 15px;
	height: 15px;
}
.demo-open {
	overflow: hidden;
}
.demo-tour {
	position: fixed;
	inset: 0;
	z-index: 3000;
	pointer-events: none;
}
.demo-tour__backdrop {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: transparent;
	pointer-events: auto;
}
.demo-tour__spotlight {
	position: absolute;
	left: var(--demo-x, 0);
	top: var(--demo-y, 0);
	width: var(--demo-w, 0);
	height: var(--demo-h, 0);
	border: 2px solid var(--accent-500);
	border-radius: calc(var(--radius-card) + 2px);
	box-shadow:
		0 0 0 4px rgba(202, 135, 70, 0.2),
		0 0 0 9999px rgba(8, 29, 24, 0.8);
	z-index: 1;
	pointer-events: none;
	transition:
		left 180ms ease,
		top 180ms ease,
		width 180ms ease,
		height 180ms ease;
}
.demo-target {
	border-radius: var(--radius-card);
}
.demo-tour__page-title {
	position: fixed;
	display: grid;
	gap: 3px;
	padding: 5px 10px;
	border-radius: var(--radius-btn);
	background: var(--brand-900);
	box-shadow:
		0 0 0 2px var(--accent-500),
		0 0 0 6px rgba(202, 135, 70, 0.25);
	color: #fff;
	pointer-events: none;
	z-index: 2;
}
.demo-tour__page-title-heading {
	font-size: 20px;
	line-height: 1.2;
}
.demo-tour__page-title-subtitle {
	overflow: hidden;
	color: rgba(255, 255, 255, 0.78);
	font-size: 12px;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.demo-tour__page-title-subtitle:empty {
	display: none;
}
.demo-tour__dialog {
	position: fixed;
	right: clamp(16px, 3vw, 40px);
	bottom: clamp(16px, 4vh, 40px);
	width: min(390px, calc(100vw - 32px));
	padding: 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	background: var(--surface);
	z-index: 2;
	box-shadow: var(--shadow-overlay);
	pointer-events: auto;
}
.demo-tour__counter {
	margin: 0 0 8px;
	color: var(--accent-600);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.demo-tour__title {
	font-size: 20px;
	letter-spacing: -0.2px;
}
.demo-tour__text {
	margin: 8px 0 0;
	color: var(--text-secondary);
}
.demo-tour__action:empty {
	display: none;
}
.demo-tour__action {
	margin-top: 14px;
}
.demo-tour__footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 18px;
}
.demo-tour__footer .btn:first-child {
	margin-right: auto;
}
@media (max-width: 768px) {
	.topbar__demo span {
		display: none;
	}
	.topbar__demo {
		padding: 8px;
	}
	.demo-tour__dialog {
		left: 16px;
		right: 16px;
		bottom: 16px;
		width: auto;
	}
}
@media (prefers-reduced-motion: reduce) {
	.topbar__demo,
	.demo-tour__spotlight {
		transition: none;
	}
}
@media print {
	.topbar__demo,
	.demo-tour {
		display: none !important;
	}
}

/* ===========================================================================
   Responsividade mobile — 100% compatível (≤640px e ≤480px)
   Complementa os breakpoints existentes (1024/768/720/640/560/1100).
   Não altera desktop. Tabelas → cards empilhados, modais full-screen,
   toolbars empilham, navegação tátil, alvos de toque ≥44px.
   =========================================================================== */

/* Alvos de toque confortáveis em mobile. */
@media (max-width: 640px) {
	.btn--sm,
	.pagination__link,
	.topbar__toggle {
		min-height: 40px;
	}
	.btn--icon.btn--sm {
		min-width: 40px;
	}
	/* Topbar mais compacta. */
	.topbar {
		height: 56px;
		padding: 0 var(--space-4);
		gap: var(--space-2);
	}
	:root {
		--topbar-height: 56px;
	}
	.topbar__title h1 {
		font-size: 18px;
	}
	.topbar__subtitle {
		font-size: 12px;
	}
	.breadcrumb {
		margin-top: 2px;
	}
	.content {
		padding: var(--space-4);
	}
	/* Conteúdo das cards mais arejado em mobile. */
	.card__header {
		padding: var(--space-3) var(--space-4);
		gap: var(--space-2);
		flex-wrap: wrap;
	}
	.card__body {
		padding: var(--space-4);
	}
	.card__body--tight {
		padding: var(--space-3);
	}
	.card__footer {
		padding: var(--space-3) var(--space-4);
		flex-wrap: wrap;
		gap: var(--space-2);
	}
	.card__actions {
		flex-wrap: wrap;
	}
	/* Botões de cabeçalho de card: quebram linha se necessário. */
	.card__actions .btn {
		flex: 1 1 auto;
	}
	/* Rodapé de formulário: botões full-width empilhados. */
	.form-actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}
	.form-actions .btn {
		width: 100%;
	}
	/* Row util: empilha em mobile. */
	.row--between,
	.row--center {
		flex-direction: column;
		align-items: stretch;
		gap: var(--space-3);
	}
	.row--center {
		flex-direction: row;
		flex-wrap: wrap;
	}
	/* KPI cards: 2 colunas em telemóvel largo, 1 em estreito. */
	.grid-2,
	.grid-3,
	.grid-4,
	.dashboard__kpis,
	.dashboard__row2,
	.dashboard__row3,
	.dashboard__row4,
	.mywork__kpis,
	.mywork__row2,
	.mywork__row3,
	.reports__kpis,
	.reports__row3,
	.reports__row4,
	.reports__row5,
	.workflow-dashboard__grid,
	.teams-grid,
	.admin__config,
	.finance-grid {
		grid-template-columns: 1fr;
	}
	.mywork__kpis,
	.reports__kpis,
	.dashboard__kpis,
	.workflow-dashboard__grid,
	.finance-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	/* Pulso: 3 stats mantêm-se em linha se couberem. */
	.pulse__stats {
		grid-template-columns: repeat(3, 1fr);
	}
	/* Distribuição do pulso: label + barra + conta empilham de forma legível. */
	.pulse__dist-row {
		grid-template-columns: 92px 1fr 28px;
		gap: var(--space-2);
	}
	/* Prioridades / riscos / marcos: linhas mais compactas. */
	.prio-list__item,
	.risk-list__item {
		gap: var(--space-2);
	}
	.milestones__item {
		gap: var(--space-2);
	}
	.milestones__date {
		font-size: 11px;
	}
	/* Detalhe do trabalho: grelha colapsa (já via 1024). */
	.job-detail__grid {
		grid-template-columns: 1fr;
	}
	.job-summary {
		grid-template-columns: repeat(2, 1fr);
	}
	/* Status bar do detalhe: empilha badges/acções. */
	.job-status-bar {
		padding: var(--space-3) var(--space-4);
	}
	.job-status-bar__name {
		font-size: 17px;
	}
	.job-status-bar__badges {
		margin-left: 0;
	}
	.job-status-bar__action {
		flex: 1 1 100%;
		justify-content: flex-start;
	}
	/* Workflow details: 2 colunas em mobile. */
	.job-workflow__details {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-3);
	}
	.job-workflow__details > div {
		min-width: 0;
	}
	/* Form de trabalho: grids a 1 coluna. */
	.job-form__grid,
	.job-form__grid--3 {
		grid-template-columns: 1fr;
	}
	.job-form__identity-code {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-2);
	}
	.job-form__footer {
		flex-direction: column-reverse;
		align-items: stretch;
	}
	.job-form__footer .btn,
	.job-form__footer .btn--ghost {
		width: 100%;
		margin: 0;
	}
	/* Equipas: cartões a 1 coluna (já via 1024). */
	.teams-grid {
		grid-template-columns: 1fr;
	}
	.teams-card__header {
		flex-direction: column;
		align-items: flex-start;
	}
	/* Clientes/Fornecedores: toolbar empilha. */
	.clients-toolbar,
	.jobs-toolbar {
		padding: var(--space-3);
	}
	.jobs-toolbar__search {
		max-width: none;
	}
	.jobs-toolbar__actions {
		width: 100%;
		justify-content: flex-end;
	}
	.jobs-toolbar__group-label {
		flex: 1 1 100%;
	}
	/* Admin: grids de form e config a 1 col. */
	.admin-form__grid {
		grid-template-columns: 1fr;
	}
	.admin__config-list {
		gap: var(--space-2);
	}
	/* Relatórios: toolbars e gráficos empilham. */
	.reports-toolbar {
		flex-direction: column;
		align-items: stretch;
		padding: var(--space-3);
	}
	.reports-toolbar__actions {
		margin-left: 0;
		justify-content: flex-end;
		flex-wrap: wrap;
	}
	.cohort-chart__row {
		grid-template-columns: 4.5rem minmax(0, 1fr) 3.4rem;
		gap: var(--space-2);
	}
	.blockbars__label {
		width: 8rem;
	}
	.groupbars__group {
		grid-template-columns: 1fr;
	}
	.deviation-list__link {
		grid-template-columns: 2rem minmax(0, 1fr) 1rem;
		gap: var(--space-2);
		padding: var(--space-3) var(--space-4);
	}
	.deviation-list__finance {
		grid-column: 2 / -1;
		justify-content: space-between;
		align-items: center;
		padding-top: var(--space-2);
		border-top: 1px dashed var(--border);
	}
	/* Login: linhas demo empilham. */
	.login-card__demo-line {
		grid-template-columns: 1fr;
		gap: 2px;
	}
	.login-card__demo-line code {
		font-size: 11px;
	}
	/* Demo tour: diálogo full-width em mobile. */
	.demo-tour__dialog {
		left: var(--space-4);
		right: var(--space-4);
		bottom: var(--space-4);
		width: auto;
		padding: var(--space-4);
	}
	.demo-tour__title {
		font-size: 17px;
	}
	/* Toasts: já empilham bottom (768). */
	.toast-region {
		left: var(--space-3);
		right: var(--space-3);
		max-width: none;
	}
	/* Paginação: quebra em linhas. */
	.pagination {
		justify-content: center;
	}
	.pagination__pages {
		flex-wrap: wrap;
		justify-content: center;
	}
	.pagination__meta {
		text-align: center;
	}
	/* Estado vazio e empty: padding reduzido. */
	.empty {
		padding: var(--space-5) var(--space-4);
	}
	/* Switch: alvo maior. */
	.switch__track {
		width: 40px;
		height: 22px;
	}
	.switch__track::after {
		width: 18px;
		height: 18px;
	}
	.switch input:checked + .switch__track::after {
		transform: translateX(18px);
	}
	/* Campos: inputs com altura mínima confortável. */
	.input,
	.select,
	.textarea {
		min-height: 44px;
		font-size: 16px; /* evita zoom iOS ao focar */
	}
	.select {
		background-position: right 12px center;
	}
	/* Modal: full-screen em mobile. */
	.modal {
		padding: 0;
	}
	.modal__dialog,
	.modal__dialog--sm,
	.modal__dialog--lg {
		max-width: none;
		width: 100%;
		max-height: 100vh;
		height: 100vh;
		border-radius: 0;
	}
	.modal__dialog {
		max-height: 100dvh;
	}
	.modal__header {
		padding: var(--space-3) var(--space-4);
	}
	.modal__body {
		padding: var(--space-4);
	}
	.modal__footer {
		flex-direction: column-reverse;
		align-items: stretch;
		padding: var(--space-3) var(--space-4);
	}
	.modal__footer .btn {
		width: 100%;
	}
	.admin-modal-form .modal__body {
		padding-bottom: var(--space-4);
	}
	.admin-avatar-upload {
		flex-direction: column;
		align-items: flex-start;
	}
	.admin-avatar-upload__controls {
		width: 100%;
		justify-content: flex-start;
	}
	/* Equipas: itens de trabalhos ativos empilham em mobile. */
	.teams-jobs__item {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-2);
	}
	.teams-jobs__meta {
		flex-wrap: wrap;
	}
	.teams-members__item {
		max-width: 100%;
	}
	.teams-members__name {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

/* Telemóveis estreitos (≤480px): KPIs e stats a 1 coluna. */
@media (max-width: 480px) {
	.mywork__kpis,
	.reports__kpis,
	.dashboard__kpis,
	.workflow-dashboard__grid,
	.finance-grid {
		grid-template-columns: 1fr;
	}
	.pulse__stats {
		grid-template-columns: 1fr;
	}
	.job-summary {
		grid-template-columns: 1fr;
	}
	.job-workflow__details {
		grid-template-columns: 1fr;
	}
	.teams-card__heading {
		flex-direction: column;
		align-items: flex-start;
	}
	.teams-card__code {
		height: 32px;
		font-size: 13px;
	}
}

/* ---------------------------------------------------------------------------
   Tabelas responsivas — card stack em mobile (≤640px).
   Tabelas com classe .table--responsive: em mobile, cada <tr> vira card,
   cada <td> mostra o título da coluna via data-label="..." antes do valor.
   Requer <td data-label="..."> nas views. Cabeçalho fica oculto.
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
	.table--responsive {
		min-width: 0;
	}
	.table--responsive thead {
		display: none;
	}
	.table--responsive,
	.table--responsive tbody,
	.table--responsive tr,
	.table--responsive td {
		display: block;
		width: 100%;
	}
	.table--responsive tr {
		margin-bottom: var(--space-3);
		border: 1px solid var(--border);
		border-radius: var(--radius-card);
		background: var(--surface);
		box-shadow: var(--shadow-card);
		padding: var(--space-3) var(--space-4);
	}
	.table--responsive tbody tr:last-child {
		margin-bottom: 0;
	}
	.table--responsive tbody tr:hover {
		background: var(--surface);
	}
	.table--responsive td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: var(--space-3);
		padding: 8px 0;
		border-bottom: 1px solid var(--border);
		text-align: right;
	}
	.table--responsive tr:last-child td {
		border-bottom: none;
	}
	/* Coluna-chave (primeira): destaque de cabeçalho do card. */
	.table--responsive td[data-label]::before {
		content: attr(data-label);
		font-size: 12px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.4px;
		color: var(--text-secondary);
		text-align: left;
		flex-shrink: 0;
		max-width: 45%;
	}
	/* Coluna de ações: alarga à direita. */
	.table--responsive td.table__col-actions {
		justify-content: flex-end;
	}
	.table--responsive td.table__col-actions::before {
		display: none;
	}
	/* Linha clicável: remove cursor e mantém focus visível. */
	.table--responsive .jobs-table__row {
		cursor: pointer;
	}
	/* Mantém progresso e badges legíveis. */
	.table--responsive .progress {
		justify-content: flex-end;
	}
	.table--responsive .badge {
		white-space: nowrap;
	}
}

/* Tabelas com scroll horizontal preservado: min-width适度 para evitar corte
   em tabelas não-card (impressão). Reduzido em mobile. */
@media (max-width: 640px) {
	.jobs-table {
		min-width: 0;
	}
	.mywork__table-wrap .table,
	.admin__table-wrap .table {
		min-width: 0;
	}
	/* Em tabelas não responsivas, scroll horizontal mantém-se com min-width. */
	.table-scroll {
		-webkit-overflow-scrolling: touch;
	}
	.table-scroll .table {
		min-width: 520px;
	}
	.admin__table-wrap .table {
		min-width: 520px;
	}
}

/* Safe area iOS (notch) para toasts e barra inferior. */
@supports (padding: max(0px)) {
	.toast-region {
		padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
	}
	.demo-tour__dialog {
		bottom: max(var(--space-4), env(safe-area-inset-bottom));
	}
	.topbar {
		padding-top: max(0px, env(safe-area-inset-top));
	}
}

/* Evita zoom ao focar inputs em mobile (font-size:16px já no bloco 640).
   viewport já define initial-scale=1; mantém user-scalable. */
@media (max-width: 640px) {
	.input,
	.textarea,
	.select {
		font-size: 16px;
	}
}
