:root {
	--surface: rgba(255, 255, 255, 0.72);
	--surface-border: rgba(17, 29, 36, 0.14);
	--text: #152229;
	--muted: #5d6a70;
	--accent: #1d7f73;
	--accent-hover: #14675d;
	--danger: #8c2a24;
	--danger-hover: #77221d;
	--success: #1f7a43;
	--shadow: 0 14px 48px rgba(17, 29, 36, 0.1);
}

html {
	overflow-y: scroll;
	scrollbar-gutter: stable;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	color: var(--text);
	background: #f4f1eb;
	display: grid;
	place-items: center;
	padding: 28px;
	position: relative;
	overflow-x: hidden;
}

body::before {
	content: '';
	position: fixed;
	inset: -12px;
	background-image: var(--hero-bg, none);
	background-size: cover;
	background-position: center;
	filter: blur(50px);
	transform: scale(1.2);
	z-index: -2;
}

body::after {
	content: '';
	position: fixed;
	inset: 0;
	z-index: -1;
}

.shell {
	width: 100%;
	max-width: 980px;
	min-width: 0;
	display: grid;
	gap: 16px;
}

.card {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	background: var(--surface);
	border: 1px solid var(--surface-border);
	border-radius: 22px;
	box-shadow: var(--shadow);
	backdrop-filter: blur(8px);
	padding: 24px;
	animation: fadeUp 0.5s ease both;
}

h1 {
	margin: 0;
	font-size: clamp(1.5rem, 2vw + 1rem, 2.2rem);
	letter-spacing: 0.04em;
	font-weight: 700;
}

.sub {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 0.95rem;
}

.toolbar {
	margin-top: 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
}

.auth-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	width: 100%;
	max-width: 520px;
}

.control-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	width: 100%;
    margin-top: 15px;
    margin-bottom: 15px;
}

.button-form {
    display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	width: 100%;
}

.pagination {
	margin-top: 14px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.stats-summary {
	margin-top: 14px;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

.stats-card {
	padding: 12px;
	border: 1px solid rgba(17, 29, 36, 0.16);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.58);
}

.stats-label {
	font-size: 0.82rem;
	color: var(--muted);
	margin: 0;
}

.stats-value {
	margin: 6px 0 0;
	font-size: 1.1rem;
	font-weight: 700;
	color: #163039;
}

.chart-wrap {
	margin-top: 12px;
	border: 1px solid rgba(17, 29, 36, 0.16);
	border-radius: 14px;
	padding: 12px;
	background: rgba(255, 255, 255, 0.48);
	max-width: 100%;
	overflow: hidden;
}

.chart-scroll {
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 8px;
	scrollbar-gutter: stable both-edges;
	-webkit-overflow-scrolling: touch;
}

.chart {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	min-height: 270px;
	min-width: 100%;
	width: max-content;
	padding: 10px 6px 0;
}

.bar-item {
	display: grid;
	justify-items: center;
	gap: 6px;
	min-width: 54px;
	max-width: 54px;
	flex: 0 0 54px;
}

.bar-value {
	font-size: 0.78rem;
	color: #2d4951;
	font-weight: 600;
}

.bar {
	width: 100%;
	height: 190px;
	display: flex;
	align-items: flex-end;
	border-radius: 10px;
	background: rgba(21, 34, 41, 0.08);
	overflow: hidden;
	border: 1px solid rgba(17, 29, 36, 0.14);
}

.bar-fill {
	width: 100%;
	background: linear-gradient(180deg, #1d7f73 0%, #14675d 100%);
	transition: height 0.25s ease;
}

.bar-index {
	font-size: 0.74rem;
	color: #48636b;
	line-height: 1.2;
	text-align: center;
	word-break: break-word;
}

.stats-list {
	margin-top: 12px;
	display: grid;
	gap: 8px;
}

.stats-row {
	display: grid;
	grid-template-columns: 90px minmax(0, 1fr) 80px;
	gap: 10px;
	align-items: center;
	padding: 8px 10px;
	border: 1px solid rgba(17, 29, 36, 0.12);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.52);
}

.stats-row .id {
	font-size: 0.82rem;
	color: #3b5960;
}

.stats-row .text {
	font-size: 0.88rem;
	color: #183139;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.stats-row .freq {
	font-size: 0.86rem;
	font-weight: 700;
	color: #1d7f73;
	text-align: right;
}

.hidden {
	display: none !important;
}

.page-btn {
	border: 1px solid rgba(17, 29, 36, 0.2);
	background: rgba(255, 255, 255, 0.8);
	color: #1f333a;
	border-radius: 999px;
	padding: 6px 12px;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.page-btn:hover {
	transform: translateY(-1px);
	border-color: rgba(17, 29, 36, 0.35);
	background: rgba(255, 255, 255, 0.95);
}

.page-btn.active {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.page-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}

.ellipsis {
	color: #4a5c63;
	padding: 0 2px;
}

.page-info {
	margin-left: 4px;
	font-size: 0.86rem;
	color: #35515a;
}

.submit-form {
	margin-top: 18px;
	display: grid;
	gap: 14px;
}

.grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
	display: grid;
	gap: 6px;
}

.full {
	grid-column: 1 / -1;
}

label {
	font-size: 0.86rem;
	color: var(--muted);
	font-weight: 600;
	letter-spacing: 0.02em;
}

input,
textarea,
select {
	width: 100%;
	border: 1px solid rgba(17, 29, 36, 0.22);
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
	color: var(--text);
	background: rgba(255, 255, 255, 0.82);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input {
	flex: 1;
	min-width: 180px;
}

select {
	min-width: 160px;
}

textarea {
	resize: vertical;
	min-height: 116px;
	line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(29, 127, 115, 0.16);
}

.row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.hint {
	font-size: 0.84rem;
	color: var(--muted);
}

.btn {
	border: 0;
	border-radius: 999px;
	padding: 9px 16px;
	font-weight: 600;
	font-size: 0.9rem;
	cursor: pointer;
	color: #fff;
	background: var(--accent);
	transition: transform 0.15s ease, background-color 0.2s ease;
	white-space: nowrap;

    /* margin-left: 10px; */
}

.btn:hover {
	background: var(--accent-hover);
	transform: translateY(-1px);
}

.btn.secondary {
	background: #36515a;
}

.btn.secondary:hover {
	background: #284048;
}

.btn.danger {
	background: var(--danger);
}

.btn.danger:hover {
	background: var(--danger-hover);
}

.btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

.badge {
	padding: 6px 11px;
	border-radius: 999px;
	border: 1px solid rgba(21, 34, 41, 0.25);
	font-size: 0.84rem;
	color: #233940;
	background: rgba(255, 255, 255, 0.55);
}

.message {
	margin-top: 10px;
	min-height: 22px;
	font-size: 0.9rem;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.message.show {
	opacity: 1;
	transform: translateY(0);
}

.message.success {
	color: var(--success);
}

.message.error {
	color: #ba3b30;
}

.list {
	display: grid;
	gap: 12px;
}

.item {
	border: 1px solid rgba(17, 29, 36, 0.16);
	border-radius: 16px;
	padding: 14px;
	background: rgba(255, 255, 255, 0.58);
	animation: fadeUp 0.35s ease both;
}

.quote {
	margin: 0;
	font-size: 1.02rem;
	line-height: 1.6;
	color: #13242b;
	white-space: pre-wrap;
	word-break: break-word;
}

.meta {
	margin-top: 10px;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px 12px;
	font-size: 0.84rem;
	color: #35515a;
}

.meta span {
	overflow-wrap: anywhere;
}

.item-actions {
	margin-top: 12px;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.empty {
	text-align: center;
	padding: 20px 10px;
	color: var(--muted);
	font-size: 0.95rem;
	border: 1px dashed rgba(17, 29, 36, 0.24);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.42);
}

details {
	border: 1px dashed rgba(17, 29, 36, 0.25);
	border-radius: 14px;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.38);
}

summary {
	cursor: pointer;
	color: #22343c;
	font-weight: 600;
	font-size: 0.9rem;
	list-style: none;
}

summary::-webkit-details-marker {
	display: none;
}

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 720px) {
	body {
		padding: 14px;
	}

	.card {
		border-radius: 18px;
		padding: 18px;
	}

	.grid {
		grid-template-columns: 1fr;
	}

	.toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.auth-form,
	.control-form {
		max-width: 100%;
	}

	.pagination {
		gap: 6px;
	}

	.stats-summary {
		grid-template-columns: 1fr;
	}

	.chart {
		min-height: 230px;
	}

	.page-btn {
		padding: 6px 10px;
	}

	.meta {
		grid-template-columns: 1fr;
	}
}
