:root {
	--tm-primary: #5b4cf0;
	--tm-primary-dark: #4535d6;
	--tm-ink: #0f1020;
	--tm-ink-2: #1b1d36;
	--tm-muted: #6b6f86;
	--tm-bg: #f5f6fb;
	--tm-line: #e6e8f0;
	--bs-primary: #5b4cf0;
	--bs-primary-rgb: 91, 76, 240;
	--bs-link-color: #4535d6;
	--bs-link-color-rgb: 69, 53, 214;
	--bs-link-hover-color: #2f20b0;
	--bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--bs-border-radius: .6rem;
}
body { background: var(--tm-bg); color: #1d1f33; }
.btn-primary { --bs-btn-bg: var(--tm-primary); --bs-btn-border-color: var(--tm-primary); --bs-btn-hover-bg: var(--tm-primary-dark); --bs-btn-hover-border-color: var(--tm-primary-dark); --bs-btn-active-bg: #3a2bc0; --bs-btn-disabled-bg: var(--tm-primary); --bs-btn-disabled-border-color: var(--tm-primary); }
.btn-outline-primary { --bs-btn-color: var(--tm-primary); --bs-btn-border-color: var(--tm-primary); --bs-btn-hover-bg: var(--tm-primary); --bs-btn-hover-border-color: var(--tm-primary); --bs-btn-active-bg: var(--tm-primary-dark); }
.text-primary { color: var(--tm-primary) !important; }
.bg-primary-subtle { background: #ecebff !important; }
.form-control:focus, .form-select:focus { border-color: #a79ef8; box-shadow: 0 0 0 .2rem rgba(91,76,240,.18); }
.form-check-input:checked { background-color: var(--tm-primary); border-color: var(--tm-primary); }
.page-link { color: var(--tm-primary); }
.active > .page-link, .page-link.active { background: var(--tm-primary); border-color: var(--tm-primary); }

/* rozloženie */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: var(--tm-ink); color: #c9cbe0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar a { color: #c9cbe0; text-decoration: none; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; font-weight: 700; color: #fff; font-size: 1.1rem; }
.sidebar .brand img { width: 32px; height: 32px; }
.org-switch { margin: 6px 12px 12px; }
.org-switch .btn { width: 100%; text-align: left; background: var(--tm-ink-2); color: #fff; border: 1px solid #2c2f52; display: flex; align-items: center; gap: 8px; }
.org-switch .btn .small { color: #8f93b8; }
.nav-side { list-style: none; padding: 0 10px; margin: 0; flex: 1; overflow-y: auto; }
.nav-side .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6f7398; padding: 14px 10px 6px; }
.nav-side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: .93rem; }
.nav-side a:hover { background: var(--tm-ink-2); color: #fff; }
.nav-side a.active { background: var(--tm-primary); color: #fff; }
.nav-side i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar .me { border-top: 1px solid #23264a; padding: 12px 18px; font-size: .85rem; }
.sidebar .me .name { color: #fff; font-weight: 600; }
.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.content { padding: 28px 32px 60px; max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--tm-muted); font-size: .92rem; }
.crumb { font-size: .85rem; color: var(--tm-muted); margin-bottom: 4px; }
.crumb a { color: var(--tm-muted); text-decoration: none; }
.crumb a:hover { color: var(--tm-primary); }

@media (max-width: 991.98px) {
	.sidebar { position: fixed; left: -260px; z-index: 1050; transition: left .2s; }
	.sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
	.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--tm-ink); color: #fff; position: sticky; top: 0; z-index: 1040; }
	.topbar img { width: 28px; }
	.content { padding: 18px 16px 50px; }
}

/* karty */
.card { border: 1px solid var(--tm-line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--tm-line); font-weight: 600; border-radius: 14px 14px 0 0 !important; padding: .85rem 1.1rem; }
.stat { padding: 18px 20px; }
.stat .v { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--tm-muted); font-size: .85rem; }
.stat .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }

/* podujatie */
.event-tabs { border-bottom: 1px solid var(--tm-line); margin-bottom: 22px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.event-tabs a { padding: 10px 14px; color: var(--tm-muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; font-size: .93rem; }
.event-tabs a:hover { color: #1d1f33; }
.event-tabs a.active { color: var(--tm-primary); border-bottom-color: var(--tm-primary); }
.event-card { transition: transform .12s, box-shadow .12s; text-decoration: none; color: inherit; display: block; height: 100%; }
.event-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(16,24,40,.08); color: inherit; }
.event-date { width: 56px; text-align: center; border-radius: 12px; background: #ecebff; color: var(--tm-primary-dark); padding: 6px 0; flex-shrink: 0; }
.event-date .d { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.event-date .m { font-size: .7rem; text-transform: uppercase; font-weight: 600; letter-spacing: .05em; }

.type-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.type-badge { display: inline-block; padding: .2em .6em; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.state-valid { background: #dcfce7; color: #166534; }
.state-used { background: #fef3c7; color: #92400e; }
.state-invalid { background: #fee2e2; color: #991b1b; }
.badge-soft { background: #eef0f6; color: #3b3f5c; font-weight: 500; }
.code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .88rem; letter-spacing: .02em; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tm-muted); font-weight: 600; background: #fafbfe; }
.table-hover tbody tr:hover > * { background: #f8f8ff; }
.progress { height: 8px; border-radius: 99px; background: #eceef5; }
.progress-bar { background: var(--tm-primary); }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; background: linear-gradient(180deg, #7c6cff, #5b4cf0); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .b:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--tm-ink); color: #fff; font-size: .72rem; padding: 2px 6px; border-radius: 4px; white-space: nowrap; margin-bottom: 4px; }
.bars-x { display: flex; gap: 3px; font-size: .68rem; color: var(--tm-muted); }
.bars-x span { flex: 1; text-align: center; overflow: hidden; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.scan-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f1f6; font-size: .88rem; }
.scan-row:last-child { border-bottom: 0; }
.scan-row .t { color: var(--tm-muted); font-variant-numeric: tabular-nums; width: 64px; }
.r-ok { color: #16a34a; } .r-used { color: #d97706; } .r-invalid, .r-not_found, .r-other_event, .r-outside_window { color: #dc2626; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--tm-muted); }
.empty-state i { font-size: 2.6rem; color: #b6b2f5; }
.help { background: #f4f3ff; border: 1px solid #e0ddff; border-radius: 12px; padding: 14px 16px; font-size: .9rem; }
.help i { color: var(--tm-primary); }
.sticky-actions { position: sticky; bottom: 0; background: rgba(245,246,251,.95); backdrop-filter: blur(4px); padding: 12px 0; border-top: 1px solid var(--tm-line); z-index: 5; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: radial-gradient(120% 90% at 0% 0%, #2a2470 0%, var(--tm-ink) 60%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 2rem; font-weight: 700; max-width: 440px; }
.auth-side li { margin-bottom: 10px; color: #c9cbe0; }
.auth-side li i { color: #a99fff; margin-right: 8px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 420px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* editor šablóny */
.tpl-editor { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .tpl-editor { grid-template-columns: 1fr; } }
.tpl-stage { background: #e9eaf2; border-radius: 14px; padding: 24px; overflow: auto; }
.tpl-page { position: relative; margin: 0 auto; box-shadow: 0 10px 40px rgba(16,24,40,.18); background: #fff; user-select: none; }
.tpl-page canvas { display: block; width: 100%; height: 100%; }
.tpl-trim { position: absolute; border: 1px dashed rgba(255,0,90,.8); pointer-events: none; }
.tpl-el { position: absolute; outline: 1px dashed rgba(91,76,240,.9); cursor: move; display: flex; align-items: center; justify-content: center; }
.tpl-el.sel { outline: 2px solid #5b4cf0; z-index: 3; }
.tpl-el .inner { display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; color: #000; pointer-events: none; }
.tpl-el .inner svg { width: 100%; height: 100%; display: block; }
.tpl-el .h { position: absolute; width: 10px; height: 10px; background: #fff; border: 2px solid #5b4cf0; border-radius: 2px; right: -6px; bottom: -6px; cursor: nwse-resize; display: none; }
.tpl-el.sel .h { display: block; }
.tpl-panel .form-label { font-size: .8rem; margin-bottom: 2px; color: var(--tm-muted); }
td .code, td a.code { white-space: nowrap; }
