﻿:root {
	--TABS-H: 74px;
	--PRIMARY: #198754;
	--PRIMARY-DARK: #0f5132;
	--SURFACE: #ffffff;
	--BORDER: #d7e1db;
	--TEXT: #1f2d2a;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	overflow-x: hidden;
	font-family: "Poppins", sans-serif;
	color: var(--TEXT);
	background-image: linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.9)), var(--BG-IMAGE);
	background-size: cover;
	background-position: center;
	background-attachment: fixed;
}

.section-inner {
	width: 100%;
	max-width: 860px;
	margin: 0 auto;
	padding-left: 12px;
	padding-right: 12px;
}

.portal-tabs {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: var(--TABS-H);
	z-index: 1040;
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(6px);
	border-bottom: 1px solid var(--BORDER);
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 6px;
	padding: 8px;
}

.tab-link {
	min-width: 0;
	height: 58px;
	border-radius: 12px;
	border: 1px solid #d6e4dc;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	text-decoration: none;
	color: var(--PRIMARY-DARK);
	font-size: 12px;
	font-weight: 600;
	padding: 6px 2px;
	text-align: center;
}

.tab-link span {
	display: block;
	width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tab-link ion-icon {
	font-size: 18px;
}

.tab-link.is-active {
	background: var(--PRIMARY);
	color: #ffffff;
	border-color: var(--PRIMARY);
	box-shadow: 0 4px 14px rgba(25, 135, 84, 0.2);
}

.diet-controls {
	position: relative;
	width: 100%;
	background: rgba(255, 255, 255, 0.97);
	border-bottom: 1px solid var(--BORDER);
	overflow-y: visible;
	overflow-x: hidden;
	margin-top: calc(var(--TABS-H) + 10px);
	padding-top: 10px;
	padding-bottom: 12px;
}

.control-label {
	font-weight: 700;
	font-size: 1rem;
	color: #203d32;
}

.dieta-select {
	border-radius: 12px;
	border-color: #cfdbd4;
	font-size: 0.98rem;
	font-weight: 600;
	min-height: 46px;
}

.mode-header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.mode-header-title {
	text-align: left;
	font-weight: 700;
	font-size: 1rem;
	color: #203d32;
}

.mode-header-text {
	flex: 1 1 auto;
	min-width: 0;
}

.mode-header-subtitle {
	font-size: 0.84rem;
	font-weight: 600;
	color: #198754;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

.mode-header-action {
	flex: 0 0 auto;
}

.mode-header-spacer {
	display: none;
}

.btn-alt-toggle {
	min-height: 38px;
	font-size: 0.86rem;
	font-weight: 700;
	border-radius: 10px;
	padding: 0.35rem 0.6rem;
	white-space: nowrap;
}

.alternative-header {
	background: rgba(25, 135, 84, 0.1);
	border: 1px solid rgba(25, 135, 84, 0.3);
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 0.94rem;
	font-weight: 700;
	color: #0f5132;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.menu-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 6px;
}

.meal-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
}

.menu-btn,
.meal-btn {
	width: 100%;
	background: var(--SURFACE);
	border: 1px solid #cfdbd4;
	border-radius: 10px;
	padding: 7px 4px;
	font-size: 0.84rem;
	font-weight: 600;
	color: #1d3a2f;
	min-height: 36px;
	text-align: center;
	word-break: break-word;
}

.menu-btn.active,
.meal-btn.active {
	background: var(--PRIMARY);
	color: #ffffff;
	border-color: var(--PRIMARY);
}

.diet-main {
	padding-top: 12px;
	padding-bottom: 18px;
}

.notes-box,
.meal-card,
.empty-box {
	background: rgba(255, 255, 255, 0.98);
	border: 1px solid var(--BORDER);
	border-radius: 14px;
}

.meal-cards {
	display: grid;
	gap: 10px;
	margin-top: 10px;
}

.meal-card {
	padding: 14px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.standard-card {
	background: #f2fbf6;
	border-color: #b7e3ca;
}

.standard-card h3 {
	color: #0f5132;
}

.meal-card h3 {
	margin: 0 0 10px;
	font-size: 1.2rem;
	font-weight: 700;
	color: #134331;
}

.food-grid {
	display: grid;
	gap: 8px;
}

.food-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 82px 82px;
	gap: 8px;
	align-items: center;
	padding: 10px;
	border: 1px solid #e0e6e3;
	border-radius: 10px;
	background: #ffffff;
}

.food-row.negative-delta {
	background: #fff1f1;
	border-color: #f0c7c7;
}

.food-main {
	min-width: 0;
}

.food-name {
	font-weight: 600;
	font-size: 0.98rem;
	line-height: 1.25;
	word-break: break-word;
}

.food-producer {
	margin-top: 2px;
	font-size: 0.75rem;
	font-weight: 600;
	color: #6b7d73;
	line-height: 1.15;
}

.food-meta {
	font-size: 0.84rem;
	font-weight: 700;
	text-align: center;
	color: #2c4d3f;
	background: #f4f7f5;
	border-radius: 8px;
	padding: 6px 4px;
}

.food-portion.empty {
	display: none;
}

.alternative-note {
	margin-top: 8px;
	padding-top: 7px;
	border-top: 1px solid #dfe7e2;
	font-size: 0.82rem;
	font-weight: 600;
	color: #52685d;
	line-height: 1.3;
}

.notes-box {
	padding: 14px;
}

.notes-title {
	margin: 0 0 10px;
	font-size: 1.15rem;
	font-weight: 700;
	color: #134331;
}

.notes-box li {
	font-size: 1rem;
	line-height: 1.5;
	margin-bottom: 6px;
}

.empty-box {
	padding: 14px;
	font-size: 1rem;
	font-weight: 600;
}

@media (max-width: 420px) {
	:root {
		--TABS-H: 72px;
	}

	.tab-link {
		font-size: 11px;
	}

	.tab-link ion-icon {
		font-size: 17px;
	}

	.menu-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}

	.meal-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.food-row {
		grid-template-columns: minmax(0, 1fr) auto auto;
		gap: 6px;
	}

	.food-meta {
		min-width: 64px;
		text-align: center;
	}
}

@media (min-width: 768px) {
	.menu-grid {
		grid-template-columns: repeat(10, minmax(0, 1fr));
	}

	.meal-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (min-width: 1200px) {
	.portal-tabs {
		max-width: 980px;
		left: 50%;
		transform: translateX(-50%);
	}

	.menu-grid {
		grid-template-columns: repeat(12, minmax(0, 1fr));
	}

	.meal-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

.portal-auth-body {
	min-height: 100vh;
	background-image: linear-gradient(rgba(255, 255, 255, 0.76), rgba(240, 250, 245, 0.92)), var(--BG-IMAGE);
	background-size: cover;
	background-position: center;
	background-attachment: fixed;
}

.portal-auth-shell {
	min-height: 100vh;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px 12px;
}

.portal-auth-card {
	width: 100%;
	max-width: 420px;
	background: rgba(255, 255, 255, 0.97);
	border: 1px solid rgba(215, 225, 219, 0.96);
	border-radius: 22px;
	box-shadow: 0 18px 50px rgba(22, 62, 45, 0.18);
	padding: 30px 22px 24px;
}

.portal-auth-logo-wrap {
	text-align: center;
	margin-bottom: 18px;
}

.portal-auth-logo {
	display: inline-block;
	width: min(260px, 82%);
	height: auto;
}

.portal-auth-title {
	margin: 0;
	text-align: center;
	font-size: 1.58rem;
	font-weight: 700;
	color: #163e2d;
}

.portal-auth-subtitle {
	margin: 8px auto 20px;
	max-width: 310px;
	text-align: center;
	font-size: 0.95rem;
	font-weight: 500;
	color: #577163;
	line-height: 1.35;
}

.portal-auth-alert {
	border-radius: 14px;
	font-size: 0.92rem;
	margin-bottom: 16px;
}

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

.bootbox .modal-content {
	border: 0;
	border-radius: 18px;
	box-shadow: 0 18px 44px rgba(20, 45, 31, 0.22);
	overflow: hidden;
}

.bootbox .modal-header {
	padding: 16px 18px 8px;
	border-bottom: 0;
}

.bootbox .modal-title {
	font-size: 1.05rem;
	font-weight: 800;
	color: #163e2d;
}

.bootbox .modal-body {
	padding: 8px 18px 12px;
}

.bootbox .modal-footer {
	padding: 8px 18px 18px;
	border-top: 0;
}

.portal-bootbox-message {
	border-radius: 14px;
	padding: 12px 14px;
	font-size: 0.94rem;
	font-weight: 600;
	line-height: 1.38;
}

.portal-bootbox-success {
	background: #e9f7ef;
	color: #146c43;
}

.portal-bootbox-warning {
	background: #fff5d6;
	color: #7a5300;
}

.portal-bootbox-danger {
	background: #fdecef;
	color: #b02a37;
}

.portal-bootbox-info {
	background: #eaf3ff;
	color: #24527a;
}

.portal-bootbox-ok {
	min-width: 96px;
	border-radius: 13px;
	font-weight: 800;
}

.portal-bootbox-ok-success,
.portal-bootbox-ok-info {
	background: var(--PRIMARY);
	border-color: var(--PRIMARY);
	color: #ffffff;
}

.portal-bootbox-ok-warning {
	background: #f0b429;
	border-color: #f0b429;
	color: #1f1f1f;
}

.portal-bootbox-ok-danger {
	background: #dc3545;
	border-color: #dc3545;
	color: #ffffff;
}

.portal-user-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.portal-logout-btn {
	border-radius: 13px;
	font-weight: 800;
	white-space: nowrap;
}

.portal-auth-label {
	font-size: 0.86rem;
	font-weight: 700;
	color: #244d3a;
}

.portal-auth-input {
	min-height: 48px;
	border-radius: 14px;
	border-color: #cfe0d6;
	font-size: 1rem;
	font-weight: 600;
	color: #18392c;
}

.portal-auth-input:focus {
	border-color: var(--PRIMARY);
	box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.12);
}

.portal-auth-actions-line {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 16px;
}

.portal-link-button {
	border: 0;
	background: transparent;
	color: #198754;
	font-size: 0.9rem;
	font-weight: 700;
	padding: 4px 0;
}

.portal-auth-submit {
	width: 100%;
	min-height: 50px;
	border-radius: 15px;
	background: var(--PRIMARY);
	border-color: var(--PRIMARY);
	color: #ffffff;
	font-size: 1.03rem;
	font-weight: 700;
	box-shadow: 0 8px 18px rgba(25, 135, 84, 0.2);
}

.portal-auth-submit:hover,
.portal-auth-submit:focus {
	background: #146c43;
	border-color: #146c43;
	color: #ffffff;
}

.portal-auth-secondary {
	margin-top: 18px;
}

.portal-auth-divider {
	border-top: 1px solid #dfebe4;
	margin: 6px 0 16px;
}

.portal-auth-help {
	font-size: 0.88rem;
	line-height: 1.4;
	color: #577163;
	margin-bottom: 12px;
}

.portal-auth-button-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.portal-auth-small-btn {
	min-height: 42px;
	border-radius: 12px;
	font-weight: 700;
}

.portal-auth-back-link {
	display: block;
	margin-top: 16px;
	text-align: center;
	color: #198754;
	font-weight: 700;
	text-decoration: none;
}

@media (max-width: 420px) {
	.portal-user-header {
		align-items: stretch;
		flex-direction: column;
	}

	.portal-logout-btn {
		width: 100%;
	}

	.portal-auth-card {
		border-radius: 18px;
		padding: 26px 16px 20px;
	}

	.portal-auth-title {
		font-size: 1.42rem;
	}
}
