:root {
	--navy: #0a2c54;
	--navy2: #103a6b;
	--blue: #1565c0;
	--ink: #1f2733;
	--muted: #6b7480;
	--line: #e6e9ef;
	--bg: #f4f6fa;
	--radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
	color: var(--ink);
	background: var(--bg);
	line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); }

/* ---------- Flash ---------- */
.flashes { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(560px, 92vw); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(10,44,84,.12);
	cursor: pointer; transition: opacity .4s ease, transform .4s ease; }
.flash--hide { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.flash.success { background: #e7f7ee; color: #11633f; border: 1px solid #bfe8d2; }
.flash.error { background: #fdecec; color: #8a1f1f; border: 1px solid #f5c6c6; }
.flash.info { background: #e8f1fd; color: #134a8e; border: 1px solid #c5dbf6; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
	font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: .15s; }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: #0d51a0; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--block { width: 100%; justify-content: center; }

/* ---------- Topbar / app shell ---------- */
body.app { background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 60px; background: #fff; border-bottom: 1px solid var(--line);
	position: sticky; top: 0; z-index: 30; }
.topbar__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; }
.topbar__brand:hover { text-decoration: none; }
.topbar__brand em { color: var(--muted); font-style: normal; font-weight: 400; margin-left: 4px; }
.topbar__brand strong { margin-left: 1px; }
.org-switch { margin-left: 14px; }
.org-switch select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: #fff; cursor: pointer; }
.topbar__nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar__nav a { padding: 8px 14px; border-radius: 8px; color: var(--ink); font-weight: 600; font-size: 14px; }
.topbar__nav a:hover { background: #eef2f8; text-decoration: none; }
.topbar__nav a.active { background: #e8f1fd; color: var(--blue); }
.topbar__user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar__userinfo { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.topbar__userinfo strong { font-size: 13.5px; }
.topbar__userinfo small { color: var(--muted); font-size: 12px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
	background: linear-gradient(160deg, var(--navy), var(--blue)); color: #fff; font-weight: 700; }
.avatar--sm { width: 34px; height: 34px; font-size: 14px; }
img.avatar { object-fit: cover; }
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; }
.container--narrow { max-width: 760px; }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 18px; }
.card__title { margin: 0 0 14px; font-size: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; }
.muted { color: var(--muted); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat__num { font-size: 28px; font-weight: 700; color: var(--navy); }
.stat__label { color: var(--muted); font-size: 13px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.blue { background: #e8f1fd; color: #134a8e; }
.badge.indigo { background: #eae7fb; color: #4733b0; }
.badge.amber { background: #fdf0d9; color: #8a5a00; }
.badge.green { background: #e3f6ea; color: #136b3b; }
.badge.grey { background: #eef1f4; color: #5b6470; }
.badge.slate { background: #e6e9ef; color: #41495a; }
.badge.orange { background: #fde9d6; color: #9a4a06; }
.badge.red { background: #fde7e7; color: #9c1f1f; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
	padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: #fafbfd; }
.table .num { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=password], .form-row input[type=search], .form-row textarea, .form-row select {
	width: 100%; padding: 13px 15px; border: 1px solid #e9edf3; border-radius: 11px; font: inherit; font-size: 15px; color: var(--ink); background: #fff; }
.form-row textarea { resize: vertical; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.12); }
.form-error { color: #9c1f1f; font-size: 13px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }

/* tiles (typ požadavku) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; padding: 22px 12px; border: 1px solid var(--line);
	border-radius: 14px; cursor: pointer; text-align: center; transition: .15s; background: #fff; }
.tile:hover { border-color: #b9d2f1; background: #fafcff; }
.tile input { position: absolute; opacity: 0; }
.tile__icon { display: flex; justify-content: center; align-items: center; width: 100%; color: #64748b; transition: color .15s; }
.tile__icon svg { width: 28px; height: 28px; display: block; }
.tile__icon img.tile__brand { max-height: 30px; max-width: 86%; width: auto; height: auto; display: block; object-fit: contain; margin-top: 16px; }
.tile__icon img.tile__brand--square { max-height: 34px; max-width: 34px; }
.tile__name { font-size: 13.5px; font-weight: 600; color: #334155; }
.tile:hover .tile__icon, .tile:has(input:checked) .tile__icon { color: var(--blue); }
.tile:has(input:checked) { border-color: var(--blue); background: #eef5ff; box-shadow: 0 0 0 1px var(--blue) inset; }
.tile:has(input:checked) .tile__name { color: var(--blue); }

/* ---------- Dashboard / login ---------- */
.dash-hero { background: linear-gradient(160deg, var(--navy), var(--navy2) 60%, var(--blue)); color: #fff; border-radius: var(--radius);
	padding: 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dash-hero h1 { color: #fff; margin: 0 0 6px; font-size: 24px; }
.dash-hero p { margin: 0; color: rgba(255,255,255,.85); }
.dash-hero .btn--primary { background: #fff; color: var(--navy); }
.dash-hero .btn--primary:hover { background: #eaf1fb; }

/* ---------- Ticket detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.meta { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.meta li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.meta li:last-child { border-bottom: 0; }
.meta .k { color: var(--muted); }
.meta .v { font-weight: 600; text-align: right; }
.clamp { max-height: 7.8em; overflow: hidden; position: relative; }
.clamp.clamp--open { max-height: none; }
.clamp__toggle { background: none; border: 0; color: var(--blue); font-weight: 600; cursor: pointer; padding: 8px 0 2px; font-size: 13.5px; }
.dropzone { margin: 10px 0; border: 1.5px dashed #cfd6e2; border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; color: var(--muted); font-size: 13.5px; transition: .12s; }
.dropzone:hover { border-color: #b9d2f1; }
.dropzone--over { border-color: var(--blue); background: #eef5ff; color: var(--blue); }
.dropzone input[type=file] { display: none; }
.thread { list-style: none; margin: 0; padding: 0; }
.msg { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.msg.internal { background: #fffaf0; border-color: #f0e2c4; }
.msg__head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.msg__author { font-weight: 600; }
.msg__body { white-space: pre-wrap; }
.msg__body img { max-width: 100%; height: auto; border-radius: 6px; }
.ql-editor { min-height: 120px; font-size: 14px; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: #e9edf3; }
.ql-toolbar.ql-snow { border-radius: 10px 10px 0 0; }
.ql-container.ql-snow { border-radius: 0 0 10px 10px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 6px 0; color: var(--muted); border-bottom: 1px dashed var(--line); }
.attachments { list-style: none; margin: 0; padding: 0; }
.attachments li { padding: 6px 0; font-size: 14px; }

/* ---------- Login (plain) ---------- */
body.plain { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px;
	background: radial-gradient(1200px 600px at 10% -10%, #eaf1fb 0%, #f4f6fa 45%, #eef1f6 100%); }
.login-card { width: min(960px, 100%); display: grid; grid-template-columns: 1.15fr .85fr; background: #fff; border-radius: 22px;
	overflow: hidden; box-shadow: 0 30px 70px rgba(10,44,84,.18); }
.brand { position: relative; padding: 40px 38px; color: #fff; overflow: hidden;
	background: linear-gradient(160deg, var(--navy) 0%, var(--navy2) 55%, var(--blue) 130%); display: flex; flex-direction: column; gap: 22px; }
.brand .logo { display: inline-flex; align-items: center; gap: 11px; }
.brand .logo__text { font-size: 19px; letter-spacing: .5px; }
.brand .logo__text strong { margin-left: 2px; }
.brand__eyebrow { margin: 18px 0 0; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,.7); }
.brand__title { color: #fff; margin: 8px 0 0; font-size: 30px; line-height: 1.15; }
.brand__lead { margin: 12px 0 0; font-size: 15px; color: rgba(255,255,255,.82); max-width: 36ch; }
.brand .hero svg { width: 100%; height: auto; display: block; }
.chips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: 12.5px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.92); }
.login { padding: 44px 40px; display: flex; flex-direction: column; }
.login__inner { margin: auto 0; }
.login__title { margin: 0; font-size: 23px; }
.login__sub { margin: 8px 0 26px; font-size: 14.5px; color: var(--muted); }
.login__note { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); }
.login__footer { margin: 28px 0 0; font-size: 12px; color: #9aa3ae; }
.ms-btn { display: inline-flex; align-items: center; gap: 12px; width: 100%; justify-content: center; padding: 0 18px; height: 46px;
	background: #fff; color: #3b3b3b; border: 1px solid #d2d6dc; border-radius: 10px; font-size: 15px; font-weight: 600; transition: .15s; }
.ms-btn:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(21,101,192,.15); text-decoration: none; }
.login__email { margin: 2px 0 22px; font-size: 14px; color: var(--muted); }
.auth-card { max-width: 440px; margin: 8vh auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: 0 20px 50px rgba(10,44,84,.12); }
.auth-card h1 { font-size: 22px; margin: 0 0 8px; }
.addp__box { margin-top: 10px; }
.ac { position: relative; }
.ac__input { width: 100%; padding: 11px 13px; border: 1px solid #e9edf3; border-radius: 10px; font: inherit; font-size: 15px; }
.ac__input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.12); }
.ac__list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; box-shadow: 0 10px 30px rgba(10,44,84,.14); max-height: 240px; overflow: auto; }
.ac__item { padding: 9px 12px; cursor: pointer; font-size: 14px; }
.ac__item:hover { background: #eef5ff; }

@media (max-width: 820px) {
	.detail-grid { grid-template-columns: 1fr; }
	.login-card { grid-template-columns: 1fr; }
	.stats { grid-template-columns: 1fr 1fr; }
	.topbar__userinfo { display: none; }
}
