/* Farby: maltsky vapenec, more a farby rybarskych lodiek luzzu */
:root {
	--bg: #f6efe2;
	--card: #fffaf0;
	--ink: #1f2a37;
	--muted: #6b6558;
	--line: #e9dfcb;
	--sea: #0f5e8c;
	--sea-deep: #0b3c5d;
	--sea-light: #1479a8;
	--accent: #c8102e;
	--pos: #1d7a4f;
	--neg: #b3261e;
	--shadow: 0 1px 2px rgb(70 45 10 / 6%), 0 8px 24px -10px rgb(70 45 10 / 18%);
	--serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #12171c;
		--card: #1c232a;
		--ink: #ece6da;
		--muted: #9a958a;
		--line: #2a323b;
		--sea: #6bb6e0;
		--sea-deep: #071f33;
		--sea-light: #0e4d70;
		--accent: #e5475d;
		--pos: #4fbf87;
		--neg: #f0766c;
		--shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px -10px rgb(0 0 0 / 60%);
	}
}

* {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

main {
	max-width: 560px;
	margin: 0 auto;
	padding: 0 16px;
}

/* Hlavicka: more, zapadajuce slnko a silueta Valletty */
.hero {
	position: relative;
	padding-top: env(safe-area-inset-top);
	background:
		radial-gradient(circle at 76% 72%, rgb(255 208 105 / 90%) 0 30px, rgb(255 208 105 / 28%) 31px, transparent 96px),
		linear-gradient(165deg, var(--sea-deep), var(--sea-light) 75%);
	color: #fff;
}

.hero-in {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	max-width: 560px;
	margin: 0 auto;
	padding: 22px 16px 84px;
}

.skyline {
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	display: block;
	width: 100%;
	height: 60px;
	fill: var(--bg);
}

h1 {
	margin: 0;
	font: 700 46px/1 var(--serif);
	letter-spacing: -0.01em;
}

.dates {
	margin: 6px 0 0;
	font-size: 14px;
	font-weight: 500;
	opacity: 0.85;
}

h2 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 26px 0 10px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

h2 .ico {
	color: var(--sea);
}

h3 {
	margin: 0;
	font-size: 16px;
}

p {
	margin: 4px 0 0;
}

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

button {
	cursor: pointer;
}

.ico {
	flex: none;
	width: 20px;
	height: 20px;
}

.note {
	color: var(--muted);
	font-size: 14px;
}

.card {
	margin-bottom: 12px;
	padding: 16px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: var(--shadow);
}

.map {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	padding: 8px 14px 8px 10px;
	background: var(--sea);
	border-radius: 999px;
	color: var(--bg);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

/* Stav synchronizacie */
#sync {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	background: rgb(255 255 255 / 14%);
	border: 0;
	border-radius: 999px;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

#sync::before {
	width: 7px;
	height: 7px;
	background: #ffd069;
	border-radius: 50%;
	content: '';
}

#sync.ok::before {
	background: #6fe0a4;
}

#sync.offline::before,
#sync.key::before {
	background: #ff8a80;
}

/* Prehlad */
.lines {
	margin: 0;
	padding: 0;
	list-style: none;
}

.lines li {
	position: relative;
	padding-left: 16px;
}

.lines li::before {
	position: absolute;
	top: 0.62em;
	left: 0;
	width: 6px;
	height: 6px;
	background: var(--accent);
	border-radius: 50%;
	content: '';
}

.lines li + li {
	margin-top: 10px;
}

.flight + .flight,
.flight + .lines {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px dashed var(--line);
}

.flight-head {
	display: flex;
	justify-content: space-between;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.flight-head b {
	color: var(--accent);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.flight-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 6px;
}

.flight-row b {
	display: block;
	font: 700 28px/1.1 var(--serif);
	font-variant-numeric: tabular-nums;
}

.flight-row small {
	color: var(--muted);
	font-size: 13px;
}

.flight-row > div:last-child {
	text-align: right;
}

.flight-path {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 8px;
	color: var(--sea);
}

.flight-path::before,
.flight-path::after {
	flex: 1;
	border-top: 2px dotted var(--line);
	content: '';
}

/* Ludia: kazdy ma farbu jednej lodky */
.avatar {
	display: grid;
	flex: none;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chip {
	position: relative;
	padding: 8px 14px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
}

.chip:has(input:checked) {
	background: var(--sea);
	border-color: var(--sea);
	color: var(--bg);
}

.chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

/* Vydavky */
#view-money {
	padding-top: 18px;
}

.card.mine {
	border: 0;
	color: #fff;
}

.mine.neg {
	background: linear-gradient(150deg, #d8243f, #a30d26);
}

.mine.pos {
	background: linear-gradient(150deg, #2a9a66, #17694a);
}

.mine.even {
	background: linear-gradient(150deg, var(--sea-light), var(--sea-deep));
}

.mine span {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.85;
}

.mine strong {
	display: block;
	font: 700 40px/1.15 var(--serif);
	font-variant-numeric: tabular-nums;
}

.mine p {
	font-size: 14px;
	opacity: 0.9;
}

.total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--line);
}

.total span {
	color: var(--muted);
}

.total strong {
	font: 700 26px/1 var(--serif);
	font-variant-numeric: tabular-nums;
}

.balances {
	margin: 0;
	padding: 0;
	list-style: none;
}

.balances li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-top: 12px;
}

.balances span:not(.avatar) {
	flex: 1;
	font-weight: 600;
}

.balances b,
.line strong {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pos {
	color: var(--pos);
}

.neg {
	color: var(--neg);
}

.line {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
}

.line > div {
	flex: 1;
	min-width: 0;
}

.line p {
	margin-top: 2px;
	color: var(--muted);
	font-size: 13px;
}

.del {
	width: 30px;
	height: 30px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--muted);
	font-size: 22px;
	line-height: 1;
}

/* Formulare */
form label {
	display: block;
	margin-bottom: 12px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

form label.chip {
	margin: 0;
	color: var(--ink);
	font-size: 15px;
}

form label.chip:has(input:checked) {
	color: var(--bg);
}

input[name]:not([type='radio'], [type='checkbox']) {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 11px 12px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 12px;
	color: var(--ink);
	font-size: 17px;
}

input[name='amount'] {
	font: 700 26px/1.2 var(--serif);
}

input:focus-visible,
button:focus-visible,
.chip:has(input:focus-visible) {
	outline: 2px solid var(--sea);
	outline-offset: 2px;
}

fieldset {
	margin: 0 0 14px;
	padding: 0;
	border: 0;
}

legend {
	width: 100%;
	margin-bottom: 6px;
	padding: 0;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

/* Rozpis sum na ludi */
form label.share {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.share span:not(.avatar) {
	flex: 1;
	color: var(--ink);
	font-size: 16px;
}

.share input[name] {
	width: 120px;
	margin: 0;
	text-align: right;
}

#shares-total {
	float: right;
	color: var(--ink);
}

.row {
	display: flex;
	gap: 8px;
}

.row .btn {
	flex: 1;
}

.btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 12px 16px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 14px;
	font-weight: 600;
}

.btn.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	box-shadow: 0 8px 18px -10px var(--accent);
}

.btn.small {
	padding: 7px 12px;
	border-radius: 999px;
	font-size: 14px;
}

.btn.wide {
	width: 100%;
	margin-bottom: 12px;
}

/* Navigacia na konci obsahu, aby pri zadavani nezaberala miesto */
#tabs {
	display: flex;
	gap: 4px;
	width: calc(100% - 32px);
	max-width: 528px;
	margin: 28px auto calc(24px + env(safe-area-inset-bottom));
	padding: 5px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 999px;
	box-shadow: var(--shadow);
}

#tabs button {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 0;
	background: none;
	border: 0;
	border-radius: 999px;
	color: var(--muted);
	font-weight: 600;
}

#tabs button.on {
	background: var(--sea);
	color: var(--bg);
}

/* Vyber mena pri prvom otvoreni */
.overlay {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgb(7 31 51 / 70%);
}

.overlay .card {
	width: 100%;
	max-width: 320px;
}

.overlay h2 {
	margin: 0 0 14px;
	color: var(--ink);
	font: 700 26px/1.1 var(--serif);
	letter-spacing: 0;
	text-transform: none;
}

.overlay .btn:last-child {
	margin-bottom: 0;
}
