/*
 * Ajustes visuais do REGIS
 * Mantido separado do tema original para facilitar atualizacoes e rollback.
 */

:root {
	--regis-brand: #00395a;
	--regis-brand-light: #0d6d9f;
	--regis-border: #e2e8f0;
	--regis-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

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

img {
	max-width: 100%;
}

/* Logo: o ficheiro e mais alto do que o cabecalho. Limitar pela altura
   preserva a proporcao e impede cortes/overflow. */
.brand-logo {
	overflow: hidden;
}

.brand-logo > a {
	justify-content: center;
	padding: 7px 16px;
	overflow: hidden;
}

.brand-logo > a > img,
.brand-logo > a > .svg {
	width: auto !important;
	height: auto !important;
	max-width: 150px !important;
	max-height: 54px !important;
	object-fit: contain;
	flex: 0 0 auto;
}

.left-side-bar .brand-logo > a {
	padding-left: 16px;
	padding-right: 16px;
	padding-top: 2px;
	padding-bottom: 2px;
}

.left-side-bar .brand-logo > a > img {
	max-height: 66px !important;
}

.login-header {
	min-height: 70px;
}

.login-header .brand-logo {
	height: 70px;
}

.login-header .brand-logo > a {
	justify-content: flex-start;
	padding: 8px 10px;
}

.login-header .brand-logo > a > img {
	max-width: 130px !important;
	max-height: 54px !important;
}

.loader-logo img {
	display: block;
	width: auto;
	height: auto;
	max-width: 150px;
	max-height: 70px;
	margin: 0 auto;
	object-fit: contain;
}

/* Cabecalho */
.header,
.header-left,
.header-right {
	min-width: 0;
}

.header-left[style] .menu-icon,
.header-right[style] .menu-icon {
	color: #fff;
}

.header-right[style] .user-info-dropdown .dropdown-toggle .user-name {
	color: #fff;
}

.user-info-dropdown .dropdown-toggle {
	display: flex;
	min-height: 60px;
	align-items: center;
}

.user-info-dropdown .dropdown-toggle .user-icon {
	width: 44px;
	height: 44px;
	line-height: 44px;
	flex: 0 0 44px;
	overflow: hidden;
}

.user-info-dropdown .dropdown-toggle .user-icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Estrutura e cartoes */
.main-container {
	min-height: calc(100vh - 70px);
	overflow-x: hidden;
}

.card-box {
	border: 1px solid rgba(226, 232, 240, 0.9);
	box-shadow: var(--regis-shadow);
}

.card-box > form.row {
	margin-right: 0;
	margin-left: 0;
	padding: 20px 20px 4px;
}

.card-box > .pb-20,
.table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.page-header .row {
	row-gap: 12px;
}

/* Formularios */
.form-control,
.custom-select {
	min-height: 42px;
}

textarea.form-control {
	min-height: 96px;
}

.form-group label,
.col-form-label {
	font-weight: 500;
	color: #334155;
}

.btn {
	min-height: 38px;
	white-space: normal;
}

.modal-dialog {
	max-width: min(92vw, 700px);
	margin-right: auto;
	margin-left: auto;
}

.modal-body {
	max-height: calc(100vh - 190px);
	overflow-y: auto;
}

/* Tabelas e DataTables */
table.table {
	margin-bottom: 0;
}

table.table th,
table.table td {
	vertical-align: middle;
}

table.table thead th {
	white-space: nowrap;
}

.minha-tabela tbody tr {
	font-size: 12px !important;
	line-height: 1.35 !important;
}

.minha-tabela.table-sm th,
.minha-tabela.table-sm td {
	padding: 0.45rem 0.55rem;
}

.dataTables_wrapper {
	width: 100%;
	max-width: 100%;
}

.dataTables_wrapper > .row {
	margin-right: 0;
	margin-left: 0;
}

.dataTables_wrapper > .row:first-child,
.dataTables_wrapper > .row:last-child {
	align-items: center;
	row-gap: 10px;
	padding: 12px 8px;
}

.dataTables_wrapper .dataTables_filter input[type="search"] {
	width: auto !important;
	min-width: 180px;
	max-width: 100%;
	margin-left: 8px;
}

.dataTables_wrapper .dataTables_length select {
	width: auto !important;
	min-width: 72px;
}

.dataTables_wrapper .pagination {
	flex-wrap: wrap;
	justify-content: flex-end;
	row-gap: 4px;
}

.dropdown-menu {
	max-width: calc(100vw - 24px);
}

/* A pagina de registo usava scale(0.7), o que desfocava texto e criava
   uma largura artificial de 142.85%. A tabela passa a ter scroll proprio. */
.scale-container {
	width: 100% !important;
	margin: 0 !important;
	transform: none !important;
	transform-origin: initial !important;
}

#tabela-registos {
	min-width: 1560px;
}

#tabela-registos th,
#tabela-registos td {
	min-width: 125px;
}

#tabela-registos th:nth-child(6),
#tabela-registos td:nth-child(6),
#tabela-registos th:nth-child(8),
#tabela-registos td:nth-child(8),
#tabela-registos th:nth-child(9),
#tabela-registos td:nth-child(9) {
	min-width: 105px;
}

#tabela-registos th:last-child,
#tabela-registos td:last-child {
	min-width: 130px;
}

#tabela-registos .form-control {
	width: 100%;
	min-width: 0;
}

#tabela-registos .error_message {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.3;
	white-space: normal;
}

#formRegistos > .btn {
	margin: 12px 8px 0 0;
}

/* Previsao a data: mantem as metricas dentro do espaco disponivel.
   As colunas de texto quebram de forma controlada e os cabecalhos podem
   ocupar mais de uma linha, evitando que um projeto longo alargue a tabela. */
.regis-index3 .regis-section-title {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 40px;
	margin: 10px 0 8px;
	text-align: center;
}

.regis-index3 .regis-section-title h5 {
	margin: 0;
	padding: 7px 18px;
	border: 1px solid rgba(226, 232, 240, 0.95);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
	font-size: 18px;
	line-height: 1.2;
}

.regis-index3 .regis-wide-table {
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
}

.regis-index3 .regis-wide-table > table {
	width: 100% !important;
	table-layout: fixed;
}

.regis-index3 .regis-wide-table > table:not(#my_roundb) {
	min-width: 1450px;
}

.regis-index3 .regis-wide-table > #my_roundb {
	min-width: 760px;
}

.regis-index3 .regis-wide-table > table tr {
	height: auto !important;
}

.regis-index3 .regis-wide-table > table th,
.regis-index3 .regis-wide-table > table td {
	width: auto;
	height: auto !important;
	max-height: none !important;
	padding: 5px 4px !important;
	font-size: 10.5px !important;
	line-height: 1.18;
	white-space: nowrap;
	vertical-align: middle !important;
}

.regis-index3 .regis-wide-table > table thead th {
	background: #fff;
	padding-top: 6px !important;
	padding-bottom: 6px !important;
	font-size: 9.5px !important;
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: 0;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: normal;
}

.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(1),
.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(1) {
	width: 38px;
}

.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(2),
.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(2) {
	width: 110px;
}

.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(3),
.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(3) {
	width: 230px;
}

.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(4),
.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(4) {
	width: 120px;
}

.regis-index3 .regis-wide-table > table:not(#my_roundb) tbody td:nth-child(2),
.regis-index3 .regis-wide-table > table:not(#my_roundb) tbody td:nth-child(3),
.regis-index3 .regis-wide-table > table:not(#my_roundb) tbody td:nth-child(4) {
	white-space: normal;
	overflow-wrap: anywhere;
}

.regis-index3 .regis-wide-table .toggle-details,
.regis-index3 .regis-wide-table .toggle-details_2 {
	padding: 0 !important;
	font-size: 1.05rem !important;
	line-height: 1 !important;
}

@media (max-width: 1300px) {
	.main-container {
		padding-right: 12px;
		padding-left: 12px;
	}

	.left-side-bar .brand-logo > a {
		justify-content: flex-start;
		padding-right: 42px;
	}

	.regis-index3 .regis-wide-table {
		border-radius: 8px;
	}
}

/* Modo compacto para portateis de 1280 px: apresenta as 16 colunas
   sem scroll horizontal, preservando scroll apenas nos ecras pequenos. */
@media (min-width: 768px) and (max-width: 1300px) {
	.regis-index3 .regis-wide-table > table:not(#my_roundb) {
		min-width: 1100px;
	}

	.regis-index3 .regis-wide-table > table:not(#my_roundb) th,
	.regis-index3 .regis-wide-table > table:not(#my_roundb) td {
		padding: 3px 2px !important;
		font-size: 9px !important;
		line-height: 1.08;
	}

	.regis-index3 .regis-wide-table > table:not(#my_roundb) thead th {
		padding-top: 4px !important;
		padding-bottom: 4px !important;
		font-size: 8px !important;
		line-height: 1.05;
	}

	.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(1),
	.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(1) {
		width: 30px;
	}

	.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(2),
	.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(2) {
		width: 85px;
	}

	.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(3),
	.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(3) {
		width: 180px;
	}

	.regis-index3 .regis-wide-table > table:not(#my_roundb) th:nth-child(4),
	.regis-index3 .regis-wide-table > table:not(#my_roundb) td:nth-child(4) {
		width: 95px;
	}

	.regis-index3 .regis-wide-table .toggle-details,
	.regis-index3 .regis-wide-table .toggle-details_2 {
		font-size: 0.9rem !important;
	}
}

@media (max-width: 767px) {
	.header-left {
		width: 30%;
	}

	.header-right {
		width: 70%;
	}

	.main-container {
		padding-right: 8px;
		padding-left: 8px;
	}

	.user-info-dropdown {
		padding-right: 6px;
	}

	.user-info-dropdown .dropdown-toggle .user-icon {
		width: 40px;
		height: 40px;
		line-height: 40px;
		flex-basis: 40px;
	}

	.card-box > form.row {
		padding: 16px 12px 0;
	}

	.page-header {
		padding: 16px;
		margin-bottom: 20px;
	}

	.dataTables_wrapper .dataTables_length,
	.dataTables_wrapper .dataTables_filter,
	.dataTables_wrapper .dataTables_info,
	.dataTables_wrapper .dataTables_paginate {
		text-align: left !important;
	}

	.dataTables_wrapper .dataTables_filter input[type="search"] {
		display: block;
		width: 100% !important;
		min-width: 0;
		margin: 6px 0 0;
	}

	.dataTables_wrapper .pagination {
		justify-content: flex-start;
	}

	.modal-dialog {
		max-width: calc(100vw - 20px);
		margin: 10px auto;
	}

	.regis-index3 .regis-section-title {
		margin-top: 4px;
	}

	.regis-index3 .regis-section-title h5 {
		font-size: 16px;
	}

	.regis-index3 .regis-wide-table > table th,
	.regis-index3 .regis-wide-table > table td {
		padding: 5px 4px !important;
	}

	.login-box {
		padding: 30px 20px;
	}
}

@media (max-width: 575px) {
	.login-wrap {
		padding: 20px 0;
	}

	.login-wrap > .container > .row.align-items-center > div:first-child {
		display: none;
	}

	.login-header .brand-logo > a > img {
		max-width: 115px !important;
		max-height: 52px !important;
	}

	.login-box .login-title {
		margin-bottom: 22px;
	}

	.login-box .login-title h2 {
		font-size: 22px;
	}
}
