@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --orange: #f18c15;
  --orange-dark: #db7713;
  --orange-soft: #fdf1e3;
  --ink: #17191c;
  --gray: #8a8f96;
  --gray-2: #b2b6bc;
  --line: #e6e7e9;
  --bg: #ededee;
  --card: #ffffff;
  --green: #1e7a4f;
  --green-soft: #e5f5ec;
  --red: #c02626;
  --red-soft: #fdeaea;
  --r-xl: 26px;
  --r-l: 20px;
  --r-pill: 999px;
  --shadow: 0 6px 24px rgba(23, 25, 28, .06);
  --shadow-hover: 0 12px 32px rgba(23, 25, 28, .10);
  font-family: Poppins, -apple-system, system-ui, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 13.5px; -webkit-font-smoothing: antialiased; }

/* ===== Levý tmavý sidebar (plovoucí, zaoblený) ===== */
.layout { display: flex; min-height: 100vh; padding: 12px; gap: 14px; }
#sidebar {
  width: 228px; flex-shrink: 0; background: var(--ink); border-radius: var(--r-xl);
  display: flex; flex-direction: column; padding: 18px 12px 12px;
  position: sticky; top: 12px; height: calc(100vh - 24px);
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.logo-chip {
  width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #f7a03c, #f18c15 55%, #db7713);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-chip img { width: 24px; height: 24px; filter: brightness(0) invert(1); }
.sb-brand .t { font-weight: 600; font-size: 15px; line-height: 1.1; color: #fff; }
.sb-brand .t .wm { height: 22px; display: block; filter: brightness(0) invert(1); }
.sb-brand .t small { display: block; font-weight: 500; font-size: 9px; letter-spacing: .16em; color: #f18c15; padding-top: 2px; margin-left: 2px; }

/* Přepínač prostorů (divizí) */
#sb-space { position: relative; margin: 0 2px 12px; }
.space-btn {
  width: 100%; display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.06);
  border-radius: 13px; padding: 10px 12px; cursor: pointer; color: #fff; box-shadow: none; font-weight: 600; font-size: 13px;
}
.space-btn:hover { background: rgba(255,255,255,.1); transform: none; }
.space-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.space-btn .chev { margin-left: auto; color: #8b9097; font-size: 10px; }
#space-menu {
  position: absolute; left: 0; right: 0; top: 110%; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow-hover); display: none; z-index: 40; overflow: hidden; padding: 5px;
}
#space-menu a { display: flex; align-items: center; gap: 9px; padding: 10px 12px; font-size: 12.5px; color: var(--ink); text-decoration: none; border-radius: 9px; font-weight: 500; }
#space-menu a:hover { background: var(--bg); }
#space-menu a.active { background: var(--orange-soft); }
#space-menu a small { margin-left: auto; color: var(--gray-2); font-size: 10px; }

.space-hero { border-top: 4px solid; }
.module-tile { opacity: .75; }
.module-tile .badge { background: var(--orange-soft); color: var(--orange-dark); }

#nav { flex: 1; overflow-y: auto; display: block; }
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: 13px;
  color: #b9bdc3; text-decoration: none; font-size: 13px; font-weight: 500; margin-bottom: 3px;
  transition: background .15s, color .15s;
}
#nav a .ic { width: 19px; text-align: center; font-size: 14px; opacity: .9; }
#nav a.active { background: var(--orange); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(241,140,21,.35); }
#nav a:hover:not(.active) { background: rgba(255,255,255,.07); color: #fff; }
#nav .nav-sep { display: block; font-size: 9.5px; font-weight: 600; text-transform: uppercase; color: #6c7178; margin: 16px 13px 7px; letter-spacing: .16em; }

#content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { display: flex; align-items: flex-start; gap: 12px; padding: 14px 8px 10px; position: sticky; top: 0; z-index: 35; background: var(--bg); margin-top: -12px; border-radius: 0 0 14px 14px; }
#hdr-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }
#status-bar { display: flex; gap: 4px; align-items: center; background: var(--card); border-radius: var(--r-pill); padding: 8px 12px; box-shadow: var(--shadow); }
.chip { font-size: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--gray-2); position: relative; cursor: default; }
.chip.on { background: #35b96e; }
.chip.off { background: #e25555; }
.chip:hover::after {
  content: attr(data-tip); position: absolute; top: 165%; right: -8px; background: var(--ink); color: #fff;
  padding: 6px 11px; border-radius: 9px; font-size: 11px; font-weight: 500; white-space: nowrap;
  box-shadow: var(--shadow-hover); z-index: 60; animation: authIn .15s both;
}
.chip:hover::before {
  content: ''; position: absolute; top: 120%; right: 0; border: 5px solid transparent; border-bottom-color: var(--ink); z-index: 60;
}
/* Segmentový přepínač jazyků */
.lang-switch { display: flex; background: var(--card); border-radius: var(--r-pill); padding: 3px; box-shadow: var(--shadow); }
.lang-switch button {
  background: transparent; box-shadow: none; color: var(--gray); border-radius: var(--r-pill);
  padding: 6px 13px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.lang-switch button:hover { background: transparent; color: var(--ink); transform: none; }
.lang-switch button.active { background: #f18c15; color: #fff; box-shadow: 0 3px 10px rgba(241,140,21,.35); }
.lang-switch.dark { background: rgba(255,255,255,.08); box-shadow: none; }
.lang-switch.dark button { color: #9aa0a6; }
.lang-switch.dark button:hover { color: #fff; }
.lang-switch.dark button.active { color: #fff; }

.sb-user {
  margin-top: 10px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06);
  border-radius: 16px; padding: 10px 12px; cursor: pointer; position: relative;
}
.sb-user:hover { background: rgba(255,255,255,.1); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12.5px; flex-shrink: 0;
}
.sb-user .u { min-width: 0; }
.sb-user .u b { font-size: 12.5px; display: block; font-weight: 600; line-height: 1.15; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 4px; }
.sb-user .u span { color: #8b9097; font-size: 10.5px; text-transform: capitalize; }
#user-dropdown {
  position: absolute; left: 6px; bottom: 108%; background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-hover); min-width: 170px; display: none; z-index: 30; overflow: hidden; padding: 6px;
}
#user-dropdown a { display: block; padding: 10px 14px; font-size: 12.5px; color: var(--ink); text-decoration: none; border-radius: 10px; font-weight: 500; }
#user-dropdown a:hover { background: var(--bg); }

/* ===== Obsah ===== */
main { flex: 1; max-width: none; padding: 8px 8px 0; width: 100%; }
#page-title { font-size: 23px; margin: 0 0 8px; font-weight: 600; letter-spacing: -.01em; }
#page-title .wave { margin-right: 6px; }
#page-title small { display: block; font-size: 14px; color: var(--gray); font-weight: 300; margin-top: 2px; }

.card {
  background: var(--card); border: 0; border-radius: var(--r-xl);
  padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow);
}
h2 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }

/* KPI — plovoucí bílé dlaždice s kruhovým čipem a tenkým velkým číslem */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: var(--r-xl); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.kpi .ic {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; position: static;
}
.kpi:nth-child(2) .ic { background: var(--orange); }
.kpi:nth-child(3) .ic { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.kpi .n { font-size: 30px; font-weight: 300; letter-spacing: -.02em; line-height: 1; margin: 0; }
.kpi .l { font-size: 11.5px; color: var(--gray); font-weight: 500; margin-top: 4px; }
.kpi .sub { display: none; }

/* Formuláře */
label { display: block; font-size: 12px; font-weight: 500; margin: 12px 0 5px; color: #4a4e54; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=month], input[type=color], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid #d3d7dc; border-radius: 12px; font-size: 13px;
  background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 15%, transparent); }
input::placeholder, textarea::placeholder { color: #b2b6bc; }
textarea { min-height: 58px; resize: vertical; }
.card input[type=text], .card input[type=password], .card input[type=email], .card input[type=number], .card input[type=month], .card textarea, .card select { background: #f3f4f5; }
.hint { font-size: 11.5px; color: var(--gray); margin-top: 5px; line-height: 1.55; font-weight: 400; }

/* Tlačítka — pilulky */
button {
  background: var(--orange); color: #fff; border: 0; border-radius: var(--r-pill); padding: 10px 20px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .12s, transform .1s, box-shadow .12s; box-shadow: 0 6px 18px rgba(241,140,21,.30);
}
button:hover { background: var(--orange-dark); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.secondary { background: #e6eaf1; color: #35404f; box-shadow: 0 4px 14px rgba(53,64,79,.14); }
button.secondary:hover { background: #d9dfe9; color: #232c38; }
button.danger { background: var(--red); box-shadow: 0 6px 18px rgba(192,38,38,.25); }
button.small { padding: 6px 14px; font-size: 11.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

/* Dlaždice */
.tile {
  background: var(--card); border-radius: var(--r-xl); padding: 20px 22px;
  cursor: pointer; transition: transform .12s, box-shadow .15s; box-shadow: var(--shadow);
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.tile b { font-size: 14.5px; font-weight: 600; }
.meta { font-size: 12px; color: var(--gray); margin-top: 6px; line-height: 1.7; font-weight: 400; }
.last { font-size: 12.5px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; color: #4a4e54; }

/* Kanban board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { min-width: 235px; width: 235px; flex-shrink: 0; background: #e9ebee; border-radius: 16px; padding: 10px; }
.board-col-head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray); padding: 4px 6px 10px; }
.board-card {
  background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: grab;
  box-shadow: 0 1px 4px rgba(23,25,28,.08); transition: transform .1s, box-shadow .12s;
}
.board-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.board-card:active { cursor: grabbing; }

/* Tabulky */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-2); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 11px 10px; border-bottom: 1px solid #f2f3f4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafafa; }

.badge { background: #f1f2f3; border-radius: var(--r-pill); padding: 3px 10px; font-size: 10.5px; color: var(--gray); font-weight: 600; }
.tag { border-radius: var(--r-pill); padding: 3px 12px; font-size: 11px; color: #fff; display: inline-block; font-weight: 600; }
.status-pill { border-radius: var(--r-pill); padding: 4px 12px; font-size: 11px; font-weight: 600; }
.status-open { background: #edf0fe; color: #4655c4; }
.status-in-progress { background: #fff3d9; color: #9a6a08; }
.status-done { background: var(--green-soft); color: var(--green); }

/* Timeline zpráv */
.timeline { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 76%; padding: 11px 16px; border-radius: 20px; font-size: 13px; line-height: 1.5; }
.msg .who { font-size: 10.5px; font-weight: 600; color: var(--gray); margin-bottom: 3px; }
.msg.in { background: #f3f4f5; align-self: flex-start; border-bottom-left-radius: 8px; }
.msg.in.wa { box-shadow: inset 3px 0 0 #25d366; }
.msg.in.email { box-shadow: inset 3px 0 0 #2563eb; }
.msg.out { background: var(--orange-soft); align-self: flex-end; border-bottom-right-radius: 8px; }
.msg-img { max-width: 240px; max-height: 240px; border-radius: 12px; display: block; margin-top: 7px; }
.msg-file { display: inline-flex; gap: 6px; align-items: center; margin-top: 7px; color: var(--orange-dark); text-decoration: none; font-weight: 600; font-size: 12.5px; }

.list-item { font-size: 13px; border-top: 1px solid var(--line); padding: 13px 0; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.list-item:first-of-type { border-top: 0; }
.wa-list { max-height: 170px; overflow-y: auto; border-radius: 12px; padding: 12px; margin-top: 4px; background: #fff; border: 1px solid #d3d7dc; }
.wa-list label { font-weight: 400; margin: 3px 0; display: flex; gap: 8px; align-items: center; font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; width: fit-content; }
.tabs button { background: var(--card); color: var(--ink); box-shadow: var(--shadow); padding: 8px 18px; font-weight: 500; }
.tabs button.active { background: var(--ink); color: #fff; font-weight: 600; }

/* ===== Footer ===== */
footer { padding: 16px 22px 14px; font-size: 11.5px; color: var(--gray-2); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
footer a { color: var(--gray); text-decoration: none; }
footer a:hover { color: var(--orange-dark); }

/* ===== Login — tmavá centrovaná karta ===== */
body.auth-mode #sidebar, body.auth-mode #topbar, body.auth-mode #footer { display: none !important; }
body.auth-mode .layout { padding: 0; gap: 0; }
body.auth-mode main { max-width: none; padding: 0; }
#login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1100px 600px at 12% -10%, #6b430f 0%, #141517 55%),
              radial-gradient(700px 500px at 105% 110%, #3d2607 0%, transparent 60%), #141517;
  position: relative;
}
@keyframes authIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.auth-card {
  width: 100%; max-width: 460px; background: #212427; border-radius: 26px; padding: 44px 42px 38px;
  box-shadow: 0 30px 90px rgba(0,0,0,.55); animation: authIn .5s cubic-bezier(.2,.8,.25,1) both; text-align: center;
}
.auth-logo {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 22px;
  background: linear-gradient(135deg, #f7a03c 0%, var(--orange) 55%, #e14a12 100%);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(241,140,21,.35);
}
.auth-logo img { width: 42px; height: 42px; filter: brightness(0) invert(1); }
.auth-brand { margin-bottom: 4px; }
.auth-brand .wm { height: 30px; display: block; margin: 0 auto; filter: brightness(0) invert(1); }
.auth-brand span { display: block; font-size: 10px; font-weight: 500; letter-spacing: .3em; color: var(--orange); text-transform: uppercase; margin-top: 2px; margin-left: 3px; }
.auth-card h2 { color: #9aa0a6; font-size: 14.5px; font-weight: 400; margin: 18px 0 26px; letter-spacing: 0; }
.field { position: relative; margin-bottom: 20px; text-align: left; }
.field label { position: absolute; top: -8px; left: 14px; background: #212427; padding: 0 7px; font-size: 11px; color: #9aa0a6; margin: 0; font-weight: 400; z-index: 1; }
.field input {
  background: transparent; border: 1px solid #4a4f55; border-radius: 12px; color: #fff;
  padding: 14px 44px 14px 16px; font-size: 14px; width: 100%;
}
.field input:focus { background: transparent; border-color: var(--orange); box-shadow: none; }
.field input::placeholder { color: #5a6066; }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none !important; box-shadow: none !important; color: #9aa0a6; padding: 8px 10px; font-size: 15px;
}
.eye:hover { color: #fff; transform: translateY(-50%); }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: -6px 0 20px; font-size: 12.5px; }
.remember { display: flex; gap: 7px; align-items: center; font-weight: 400; color: #9aa0a6; margin: 0; }
.auth-row a { color: var(--orange); text-decoration: none; font-weight: 500; }
.auth-card button.w100 { width: 100%; padding: 15px; font-size: 15px; border-radius: 14px; margin-top: 2px; }
.auth-back { margin-top: 18px; font-size: 12.5px; }
.auth-back a { color: #9aa0a6; text-decoration: none; }
.auth-back a:hover { color: #fff; }
.auth-error { background: rgba(192,38,38,.18); color: #ff9b9b; border-radius: 12px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; display: none; text-align: left; }
.auth-sub { color: #9aa0a6; font-size: 12.5px; margin: -18px 0 22px; font-weight: 300; }
.auth-lang { position: absolute; top: 20px; right: 22px; }
.eye svg { display: block; }
.auth-foot { position: absolute; bottom: 18px; left: 0; right: 0; font-size: 11px; color: #6c7178; text-align: center; }
.auth-foot a { color: #9aa0a6; }

/* ===== Vyhledávání ===== */
#search-wrap { position: relative; }
#search-input { width: 190px; padding: 9px 14px; border-radius: 99px; font-size: 12.5px; background: var(--card); border: 0; box-shadow: var(--shadow); transition: width .15s; }
#search-input:focus { width: 260px; border: 0; box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--orange) 40%, transparent); }
#search-results {
  position: absolute; right: 0; top: 120%; width: 360px; background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-hover); display: none; z-index: 45; overflow: hidden; max-height: 55vh; overflow-y: auto; padding: 5px;
}
#search-results a { display: block; padding: 10px 12px; font-size: 12.5px; color: var(--ink); text-decoration: none; border-radius: 10px; }
#search-results a:hover { background: var(--bg); }

/* ===== Notifikace ===== */
#notif-wrap { position: relative; }
#notif-btn {
  background: var(--card); box-shadow: var(--shadow); border-radius: 50%; width: 38px; height: 38px;
  padding: 0; font-size: 15px; display: flex; align-items: center; justify-content: center; color: var(--ink);
}
#notif-btn:hover { background: #f6f6f7; transform: none; }
#notif-badge {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: none;
  align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--bg);
}
#notif-panel {
  position: absolute; right: 0; top: 120%; width: 330px; background: #fff; border-radius: 18px;
  box-shadow: var(--shadow-hover); display: none; z-index: 40; overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.notif-head { padding: 13px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--gray); border-bottom: 1px solid var(--line); }
.notif-item { display: block; padding: 12px 16px; font-size: 12.5px; color: var(--ink); text-decoration: none; border-bottom: 1px solid #f2f3f4; line-height: 1.5; }
.notif-item:hover { background: #fafafa; }
.notif-item.unread { background: var(--orange-soft); }
.notif-item small { color: var(--gray-2); font-size: 10.5px; }
.notif-empty { padding: 18px 16px; font-size: 12.5px; color: var(--gray); }

/* ===== AI asistent ===== */
#ai-fab {
  position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #f7a03c, var(--orange) 55%, var(--orange-dark));
  color: #fff; border: 0; cursor: pointer; z-index: 90; font-size: 22px;
  box-shadow: 0 10px 28px rgba(241,140,21,.45); display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
#ai-fab:hover { transform: translateY(-2px) scale(1.04); background: linear-gradient(135deg, #f7a03c, var(--orange) 55%, var(--orange-dark)); }
#ai-panel {
  position: fixed; right: 22px; bottom: 88px; width: 380px; max-width: calc(100vw - 44px);
  background: #fff; border-radius: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.28); z-index: 91;
  display: flex; flex-direction: column; overflow: hidden; animation: authIn .25s both;
}
/* integrovaný pravý sloupec */
#ai-side { display: none; }
#ai-side.open { display: block; width: 324px; flex-shrink: 0; }
#ai-panel-in {
  position: sticky; top: 12px; height: calc(100vh - 24px); background: #fff; border-radius: var(--r-xl);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
#ai-panel-in #ai-msgs { flex: 1; max-height: none; }
.ai-hist-item { display: flex; align-items: center; border-bottom: 1px solid #ececee; }
.ai-hist-item a { flex: 1; display: flex; align-items: center; gap: 8px; padding: 11px 12px; color: var(--ink); text-decoration: none; font-size: 12.5px; min-width: 0; }
.ai-hist-item a:hover { background: #fff; }
.ai-hist-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ai-hist-item small { color: var(--gray-2); font-size: 10.5px; flex-shrink: 0; }
.ai-hist-item .x { background: none; box-shadow: none; color: var(--gray-2); padding: 6px 10px; font-size: 12px; }
.ai-hist-item .x:hover { color: var(--red); background: none; transform: none; }
#ai-head { background: var(--ink); color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
#ai-head .dot { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #f7a03c, var(--orange-dark)); display: flex; align-items: center; justify-content: center; font-size: 15px; }
#ai-head b { font-size: 13.5px; }
#ai-head small { display: block; font-size: 10.5px; color: #9aa0a6; font-weight: 400; }
#ai-head .x { margin-left: auto; background: none; box-shadow: none; color: #9aa0a6; font-size: 17px; padding: 4px 8px; }
#ai-head .x:hover { color: #fff; background: none; transform: none; }
#ai-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; max-height: 46vh; min-height: 180px; background: #f7f7f8; }
.ai-m { max-width: 85%; padding: 9px 13px; border-radius: 15px; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; }
.ai-m.user { background: var(--orange); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.ai-m.bot { background: #fff; align-self: flex-start; border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.ai-m.bot.thinking { color: var(--gray); font-style: italic; }
#ai-inputrow { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid var(--line); }
#ai-input { flex: 1; background: #f3f4f5; border: 1px solid transparent; border-radius: 12px; padding: 10px 13px; font-size: 12.5px; }
#ai-send { border-radius: 12px; padding: 0 16px; }

/* ===== Toggle přepínač ===== */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 400; color: #4a4e54; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .tr { width: 38px; height: 22px; background: #d6d9dd; border-radius: 99px; transition: background .15s; position: relative; flex-shrink: 0; }
.switch .tr::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .tr { background: var(--orange); }
.switch input:checked + .tr::after { left: 19px; }
.switch.dark { color: #9aa0a6; }
.switch.dark .tr { background: #4a4f55; }
.switch.dark input:checked + .tr { background: var(--orange); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17,19,22,.5); display: flex; align-items: center; justify-content: center;
  z-index: 85; padding: 20px; animation: authIn .15s both;
}
.modal { background: #fff; border-radius: 22px; padding: 30px 34px 28px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.35); position: relative; }
.modal h3 { font-size: 16px; margin: 0 0 10px; text-align: center; width: 100%; }
.modal > .row:first-of-type { justify-content: center; }
.modal > .row:first-of-type .secondary.small { position: absolute; top: 16px; right: 16px; z-index: 3; }
.modal > .row:last-of-type { justify-content: center; margin-top: 20px; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
/* plovoucí popisky jako na loginu */
.modal label { display: inline-block; position: relative; z-index: 2; margin: 10px 0 0 12px; padding: 0 6px; background: #fff; font-size: 11px; color: var(--gray); font-weight: 500; }
.modal label + input, .modal label + select, .modal label + textarea,
.modal div > label + input, .modal div > label + select, .modal div > label + textarea { margin-top: -8px; }
.modal .wa-list label { position: static; margin: 3px 0; padding: 0; background: transparent; font-size: 13px; color: var(--ink); font-weight: 400; z-index: auto; display: flex; }
.modal .wa-list { background: #fff; border: 1px solid #d3d7dc; }
.modal .switch { position: static; }
.modal .hint { margin: 6px 0 4px 4px; }
@media (max-width: 560px) { .modal .grid2 { grid-template-columns: 1fr; } }

/* Toast */
#msg {
  position: fixed; bottom: 18px; right: 18px; background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 18px; display: none; max-width: 440px; z-index: 99; font-size: 13px;
  box-shadow: var(--shadow-hover); animation: authIn .25s both;
}
em.empty { color: var(--gray); font-size: 13px; }
.svgi { vertical-align: -3px; }
#page-title .wave .svgi { vertical-align: -2px; color: var(--orange); }
.kpi .ic .svgi { vertical-align: middle; }

/* Responsive — mobil: sidebar se změní na kompaktní horní lištu */
@media (max-width: 900px) {
  .layout { flex-direction: column; padding: 8px; gap: 10px; }
  #sidebar {
    width: 100%; height: auto; position: static; border-radius: 18px;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 10px; padding: 10px 12px;
  }
  .sb-brand { border: 0; margin: 0; padding: 0; }
  .sb-brand .t .wm { height: 18px; }
  #sb-space { margin: 0; grid-column: 2; grid-row: 1; }
  .space-btn { padding: 8px 10px; font-size: 12px; }
  #sb-user-slot { grid-column: 3; grid-row: 1; }
  .sb-user { margin: 0; padding: 4px; background: transparent; }
  .sb-user .u { display: none; }
  #nav { grid-column: 1 / -1; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  #nav a { flex-shrink: 0; padding: 8px 12px; margin: 0; font-size: 12.5px; }
  #nav .nav-sep { display: none; }
  #user-dropdown { left: auto; right: 0; bottom: auto; top: 110%; }

  #topbar { flex-wrap: wrap; padding: 4px 2px; position: static; margin-top: 0; }
  #page-title { font-size: 19px; }
  #hdr-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  #search-input { width: 130px; }
  #search-input:focus { width: 170px; }
  #search-results { width: calc(100vw - 32px); right: -8px; }
  main { padding: 4px 2px 0; }
  .card { padding: 16px; border-radius: 18px; overflow-x: auto; }
  .modal { padding: 22px 18px; border-radius: 18px; }
  .modal .grid2 { grid-template-columns: 1fr; }

  /* AI panel: na mobilu přes celou obrazovku, jinak jen jiskra */
  #ai-side.open { position: fixed; inset: 0; width: auto; z-index: 95; }
  #ai-panel-in { position: static; height: 100%; border-radius: 0; }
}
