/* Mon Darts — админ / тэмцээний нийтлэг харанхуй зохиомж */
@import url("tokens.css");

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}

html,
body {
	min-height: 100%;
}

body.admin-body {
	background: var(--bg);
	color: var(--text);
	font-family: Arial, "Segoe UI", Helvetica, sans-serif;
	line-height: 1.4;
}

a {
	color: var(--yellow);
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 0.5rem;
	background: var(--green);
	padding: 0.55rem 0.7rem;
	padding-top: calc(0.55rem + env(safe-area-inset-top));
}

.topbar .title {
	text-align: center;
	min-width: 0;
}

.topbar .title strong {
	display: block;
	font-size: clamp(0.95rem, 3.6vw, 1.2rem);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.topbar .title small {
	display: block;
	font-size: 0.75rem;
	opacity: 0.9;
	font-weight: 400;
}

.pill-btn {
	font-family: inherit;
	font-size: 0.85rem;
	padding: 0.35rem 0.8rem;
	border: 1.5px solid rgba(255, 255, 255, 0.85);
	border-radius: 2em;
	background: transparent;
	color: var(--white);
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none;
}

.pill-btn.pill-danger {
	border-color: #f87171;
	color: #fecaca;
}

.wrap {
	max-width: 52rem;
	margin: 0 auto;
	padding: 0.9rem 0.85rem 3rem;
}

.section {
	border-bottom: 1px solid var(--line);
	padding: 1rem 0;
}

.section h2,
.section h3 {
	font-size: 1rem;
	margin-bottom: 0.65rem;
	font-weight: 700;
}

.muted {
	color: var(--muted);
	font-size: 0.85rem;
}

.flow-list {
	padding-left: 1.2rem;
	color: var(--muted);
	font-size: 0.9rem;
}

.flow-list li {
	margin: 0.25rem 0;
}

.flow-list .now {
	color: var(--yellow);
	font-weight: 700;
}

label.field .hint,
.hint {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.75rem;
	color: #8a9a96;
	font-weight: 400;
}

.hint-inline {
	font-size: 0.78rem;
	color: #8a9a96;
	font-weight: 400;
}

.choice-row {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	margin: 0.5rem 0;
}

.choice {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.55rem 0.7rem;
	border: 1px solid #444;
	border-radius: 0.4rem;
	background: rgba(255,255,255,0.03);
	cursor: pointer;
	font-size: 0.95rem;
}

.choice:has(input:checked) {
	border-color: var(--green-mid);
	background: rgba(0, 120, 90, 0.15);
}

.format-preview {
	margin-top: 0.85rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.fp-summary {
	font-size: 0.85rem;
	color: #9eb5ad;
	padding: 0.45rem 0.6rem;
	border-radius: 0.3rem;
	background: rgba(255,255,255,0.04);
}

.fp-summary b {
	color: #e8fff6;
}

.fp-block-title {
	font-size: 0.8rem;
	font-weight: 700;
	color: #c5ddd4;
	margin: 0 0 0.4rem;
	letter-spacing: 0.02em;
}

.fp-rr-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	gap: 0.55rem;
}

.fp-rr-card {
	border: 1px solid #3a5550;
	border-radius: 0.35rem;
	overflow: hidden;
	background: #0d1614;
}

.fp-rr-card header {
	padding: 0.3rem 0.45rem;
	font-size: 0.78rem;
	font-weight: 700;
	background: #1a332c;
	color: var(--yellow, #f5c542);
}

.fp-rr-card table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.72rem;
}

.fp-rr-card th,
.fp-rr-card td {
	border-top: 1px solid #2a3f3a;
	padding: 0.22rem 0.35rem;
	text-align: center;
	color: #a8beb6;
}

.fp-rr-card th {
	color: #7a9088;
	font-weight: 600;
}

.fp-rr-card td.name {
	text-align: left;
	color: #d0e4dc;
}

.fp-rr-card td.diag {
	background: #15221e;
	color: #3a4a46;
}

.fp-se-wrap {
	display: flex;
	align-items: stretch;
	gap: 0;
	overflow-x: auto;
}

.fp-se {
	--fp-se-link: 1.15rem;
	--fp-se-line: #5a7a70;
	display: flex;
	gap: 0;
	align-items: stretch;
	min-width: max-content;
	padding: 0.15rem 0 0.35rem;
}

.fp-se-col {
	display: flex;
	flex-direction: column;
	min-width: 6.4rem;
	flex: 0 0 auto;
}

.fp-se-col .fp-se-head {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--yellow, #f5c542);
	text-align: center;
	margin-bottom: 0.35rem;
	min-height: 2.4rem;
	padding: 0 var(--fp-se-link);
	line-height: 1.25;
}

.fp-se-body {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.fp-se-item {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	padding: 0.25rem var(--fp-se-link);
	min-height: 4.2rem;
}

.fp-se-col:first-child .fp-se-item {
	padding-left: 0;
}

.fp-se-col:last-child .fp-se-item {
	padding-right: 0;
}

/* хэвтээ гарц — дараагийн тойрог руу */
.fp-se-col:not(:last-child) .fp-se-item::after {
	content: "";
	position: absolute;
	right: 0;
	top: 50%;
	width: var(--fp-se-link);
	height: 2px;
	background: var(--fp-se-line);
}

/* хос тоглолтын гол — босоо шугам */
.fp-se-col:not(:last-child) .fp-se-item:nth-child(odd)::before {
	content: "";
	position: absolute;
	right: 0;
	top: 50%;
	width: 2px;
	height: 100%;
	background: var(--fp-se-line);
}

.fp-se-body.single .fp-se-item:nth-child(odd)::before {
	display: none;
}

.fp-se-col:not(:first-child) .fp-se-item > .fp-se-match {
	position: relative;
}

.fp-se-col:not(:first-child) .fp-se-item > .fp-se-match::before {
	content: "";
	position: absolute;
	left: calc(-1 * var(--fp-se-link));
	top: 50%;
	width: var(--fp-se-link);
	height: 2px;
	background: var(--fp-se-line);
}

.fp-se-third {
	margin-left: 0.85rem;
	padding: 0.15rem 0 0.35rem 0.85rem;
	border-left: 1px dashed #3a5550;
	min-width: 6.4rem;
	flex: 0 0 auto;
}

.fp-se-third .fp-se-head {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--yellow, #f5c542);
	text-align: center;
	margin-bottom: 0.35rem;
	min-height: 2.4rem;
	line-height: 1.25;
}

.fp-se-match {
	width: 100%;
	border: 1px solid #3a5550;
	border-radius: 0.25rem;
	padding: 0.28rem 0.35rem;
	background: #0d1614;
	font-size: 0.7rem;
	color: #b8cfc6;
	box-sizing: border-box;
}

.fp-se-match .slot {
	padding: 0.12rem 0;
	border-bottom: 1px dashed #2a3f3a;
}

.fp-se-match .slot:last-child {
	border-bottom: 0;
}

.fp-se-match .vs {
	text-align: center;
	font-size: 0.62rem;
	color: #5a7068;
	padding: 0.08rem 0;
}

.fp-seed-scheme {
	margin-top: 0.45rem;
	padding: 0.5rem 0.6rem;
	border-radius: 0.3rem;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid #2a3f3a;
	font-size: 0.72rem;
	color: #9eb5ad;
	line-height: 1.45;
	white-space: pre-wrap;
	font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.fp-seed-scheme strong {
	color: #e8fff6;
	font-family: inherit;
}

.fp-empty {
	font-size: 0.82rem;
	color: #7a9088;
	padding: 0.5rem 0;
}

.se-auto-size {
	margin: 0.55rem 0 0.75rem;
	padding: 0.55rem 0.7rem;
	border-radius: 0.35rem;
	background: rgba(0, 120, 90, 0.12);
	border: 1px solid #2a5a50;
	font-size: 0.92rem;
	color: #d7ebe4;
}

.se-auto-size strong {
	color: var(--yellow, #f5c542);
	font-size: 1.05rem;
}

.legs-by-round .legs-title {
	display: block;
	font-size: 0.95rem;
	color: #e8fff6;
}

.legs-by-round .leg-row {
	display: grid;
	grid-template-columns: minmax(7rem, 1fr) auto 4.5rem auto;
	gap: 0.45rem;
	align-items: center;
	margin: 0.45rem 0;
	font-size: 0.92rem;
}

.legs-by-round .leg-row .leg-tag {
	font-weight: 700;
	color: var(--yellow, #f5c542);
	letter-spacing: 0.02em;
}

.legs-by-round .leg-row input {
	margin-top: 0;
	text-align: center;
	width: 100%;
}

.legs-rows:empty::before {
	content: "Хэмжээ сонгоод үеүүд энд гарна…";
	display: block;
	color: #8a9a96;
	font-size: 0.82rem;
	padding: 0.3rem 0;
}

label.field > span,
label.field > .req {
	display: inline;
}

.req {
	color: #ff8a80;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
	display: block;
	width: 100%;
	margin-top: 0.3rem;
	font-family: inherit;
	font-size: 1rem;
	padding: 0.55rem 0.65rem;
	border: 1px solid #666;
	border-radius: 0.35rem;
	background: #111;
	color: var(--text);
}

textarea {
	min-height: 5rem;
	resize: vertical;
}

.row2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.7rem;
}

.check {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0.45rem 0;
	font-size: 0.92rem;
	cursor: pointer;
}

.check input {
	margin-top: 0.2rem;
}

.subbox {
	margin: 0.55rem 0 0.55rem 1.2rem;
	padding: 0.55rem 0.65rem;
	border-left: 3px solid var(--green-mid);
	background: rgba(255, 255, 255, 0.03);
}

.radio-line {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem 0.5rem;
	margin: 0.4rem 0;
	font-size: 0.9rem;
}

.radio-line input[type="number"] {
	display: inline-block;
	width: 3.2rem;
	margin: 0;
	padding: 0.25rem 0.35rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	font-size: 1rem;
	padding: 0.75rem 1rem;
	border: 0;
	border-radius: 0.45rem;
	cursor: pointer;
	text-decoration: none;
	color: var(--white);
	width: 100%;
}

.btn + .btn {
	margin-top: 0.55rem;
}

.btn-blue {
	background: var(--blue);
}

.btn-orange {
	background: var(--orange);
}

.btn-red {
	background: var(--red);
}

.btn-pink {
	background: var(--pink);
	width: auto;
	min-width: 4.5rem;
	padding: 0.75rem 0.9rem;
}

.btn-white {
	background: var(--white);
	color: #222;
}

.btn-row {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.55rem;
}

.btn-row .btn-blue {
	flex: 1;
}

.btn:disabled {
	opacity: 0.45;
	cursor: default;
}

.url-box {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}

.url-box input {
	font-size: 0.85rem;
}

.copy-btn {
	width: auto;
	align-self: flex-start;
	padding: 0.4rem 0.9rem;
	font-size: 0.9rem;
}

.footer-links {
	text-align: center;
	padding: 1.2rem 0 0.4rem;
	font-size: 0.85rem;
}

.footer-links a {
	margin: 0 0.2rem;
	color: var(--muted);
	text-decoration: none;
	font-size: 0.85rem;
}

/* Entry list */
.entry-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0.7rem 0;
}

.entry-table td {
	border-bottom: 1px solid var(--line);
	padding: 0.45rem 0.25rem;
	vertical-align: middle;
}

.entry-table .num {
	width: 2rem;
	color: var(--muted);
	text-align: center;
}

.entry-table input {
	margin: 0;
	border: 0;
	background: transparent;
	padding: 0.35rem 0.2rem;
}

.icon-btn {
	font-family: inherit;
	font-size: 1rem;
	width: 2rem;
	height: 2rem;
	border: 0;
	border-radius: 0.3rem;
	background: transparent;
	color: var(--blue2);
	cursor: pointer;
}

.icon-btn.del {
	color: var(--red);
}

.entry-actions td {
	color: var(--blue2);
	cursor: pointer;
	padding: 0.7rem 0.4rem;
}

.entry-actions.dim td {
	color: var(--muted);
	cursor: default;
}

/* Cards on home */
.card-list {
	display: grid;
	gap: 0.7rem;
}

.card {
	background: var(--bg2);
	border: 1px solid var(--line);
	border-radius: 0.55rem;
	padding: 0.9rem;
}

.card h3 {
	font-size: 1.05rem;
	margin-bottom: 0.25rem;
}

.card .meta {
	color: var(--muted);
	font-size: 0.82rem;
	margin-bottom: 0.7rem;
}

.card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.card-actions .btn {
	width: auto;
	padding: 0.45rem 0.8rem;
	font-size: 0.88rem;
	margin: 0;
}

/* ---------- нийтлэг навбар (archive / profile) ---------- */

.admin-header {
	position: sticky;
	top: 0;
	z-index: 30;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 0.5rem;
	background: var(--green);
	color: var(--white);
	padding: 0.55rem 0.75rem;
	padding-top: calc(0.55rem + env(safe-area-inset-top));
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-header .header-mid {
	text-align: center;
	min-width: 0;
}

.admin-header .title {
	font-weight: 800;
	font-size: clamp(0.9rem, 3.2vw, 1.1rem);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #fff;
}

.admin-header .sub {
	font-size: 0.72rem;
	opacity: 0.85;
	color: rgba(255, 255, 255, 0.88);
}

.admin-header .pill-btn {
	font-family: inherit;
	font-size: 0.82rem;
	padding: 0.32rem 0.75rem;
	border: 1.5px solid rgba(255, 255, 255, 0.85);
	border-radius: 2em;
	background: transparent;
	color: #fff;
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none;
}

.admin-header a.pill-btn:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.empty {
	text-align: center;
	color: var(--muted);
	padding: 2rem 1rem;
}

.toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	transform: translateX(-50%) translateY(1rem);
	background: rgba(0, 0, 0, 0.9);
	color: #fff;
	padding: 0.55rem 1rem;
	border-radius: 0.4rem;
	opacity: 0;
	pointer-events: none;
	transition: 0.18s;
	z-index: 50;
}

.toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.hidden {
	display: none !important;
}

@media (max-width: 520px) {
	.row2 {
		grid-template-columns: 1fr;
	}
}
