:root {
  --bg: #0b0c10;
  --bg-elevated: #16171e;
  --bg-card: #1a1c25;
  --bg-glass: rgba(20, 21, 28, 0.72);
  --bg-hover: #21232e;
  --border: #2a2d3a;
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #edeef3;
  --text-dim: #9296a8;
  --accent: #a78bfa;
  --accent-dim: #6d28d9;
  --accent-2: #60a5fa;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #3b82f6);
  --gold: #f2b13c;
  --green: #3ecf8e;
  --red: #f2555a;
  --teal: #22c3a6;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 8px 24px -6px rgba(139, 92, 246, 0.45);
  --sidebar-w: 236px;
  --topbar-h: 56px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(1000px 520px at 10% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(700px 400px at 50% 110%, rgba(242, 177, 60, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.006em;
}

.hidden { display: none !important; }

a, button, input, select, textarea { font-family: inherit; }

button { -webkit-appearance: none; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* Custom scrollbars (WebKit + Firefox) */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }
*::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ---------------- ICONS (shared inline SVG set) ---------------- */

.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ---------------- LOGIN ---------------- */

#login-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  overflow: hidden;
}

#login-view::before,
#login-view::after {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

#login-view::before {
  background: #8b5cf6;
  top: -160px;
  left: -140px;
}

#login-view::after {
  background: #3b82f6;
  bottom: -180px;
  right: -140px;
}

/* Decorative chips / cards / dice in the corners */

.login-decor {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.login-decor-chips { left: -30px; bottom: -55px; width: 260px; height: 220px; }
.login-decor-cards { right: -20px; bottom: -45px; width: 300px; height: 260px; }

.login-chip {
  position: absolute;
  border-radius: 50%;
  background: repeating-conic-gradient(#3b2360 0deg 15deg, #241540 15deg 30deg);
  border: 6px solid #150d22;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(167, 139, 250, 0.25);
}

.login-chip::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6d28d9, #1a1024 75%);
  border: 2px solid rgba(167, 139, 250, 0.4);
}

.login-chip-1 { width: 130px; height: 130px; left: 10px; bottom: 55px; transform: rotate(-8deg); }
.login-chip-2 { width: 130px; height: 130px; left: 55px; bottom: 20px; transform: rotate(6deg); }
.login-chip-3 { width: 130px; height: 130px; left: 100px; bottom: -10px; transform: rotate(-4deg); }

.login-card-deco {
  position: absolute;
  width: 92px;
  height: 128px;
  border-radius: 12px;
  background: linear-gradient(160deg, #1c1330, #0d0812);
  border: 1px solid rgba(167, 139, 250, 0.3);
  box-shadow: 0 18px 34px -12px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #a78bfa;
  text-shadow: 0 0 14px rgba(167, 139, 250, 0.6);
}

.login-card-deco-1 { right: 120px; bottom: 25px; transform: rotate(-14deg); }
.login-card-deco-2 { right: 68px; bottom: 50px; transform: rotate(4deg); z-index: 1; }
.login-card-deco-3 { right: 16px; bottom: 20px; transform: rotate(18deg); }

.login-die {
  position: absolute;
  right: 6px;
  bottom: -14px;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(160deg, #241736, #120b1c);
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: 0 14px 28px -10px rgba(0, 0, 0, 0.6);
  transform: rotate(-10deg);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 10px;
  gap: 2px;
}

.login-die span { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c4b5fd, #a78bfa); box-shadow: 0 0 6px rgba(167, 139, 250, 0.7); }
.login-die span:nth-child(1) { grid-area: 1 / 1; }
.login-die span:nth-child(2) { grid-area: 1 / 3; }
.login-die span:nth-child(3) { grid-area: 2 / 2; }
.login-die span:nth-child(4) { grid-area: 3 / 1; }
.login-die span:nth-child(5) { grid-area: 3 / 3; }

/* Shell: topbar + 3-column grid (features / card / quote) */

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
}

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.login-brand { display: flex; align-items: center; gap: 12px; }

.login-brand-mark {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  border-radius: var(--radius);
  background: var(--bg-glass);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.login-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.login-brand-text strong { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.login-brand-text span { font-size: 12.5px; color: var(--text-dim); }

.login-secure-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--bg-glass);
  border: 1px solid var(--border-soft);
}

.login-secure-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.16);
}

.login-secure-text { display: flex; flex-direction: column; line-height: 1.3; text-align: left; }
.login-secure-text strong { font-size: 12.5px; font-weight: 700; }
.login-secure-text span { font-size: 11.5px; color: var(--text-dim); }

.login-grid {
  display: grid;
  grid-template-columns: 1fr minmax(340px, 428px) 1fr;
  gap: 24px;
  align-items: center;
}

.login-panel { display: flex; flex-direction: column; gap: 14px; }
.login-panel-right { align-items: flex-end; }

.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  max-width: 300px;
}

.login-feature-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.16);
}

.login-feature-text strong { display: block; font-size: 13.5px; font-weight: 700; }
.login-feature-text span { display: block; font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.login-quote {
  max-width: 280px;
  padding: 22px 22px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.login-quote-mark { font-size: 30px; color: var(--accent); line-height: 1; font-weight: 800; }
.login-quote p { font-size: 15px; line-height: 1.45; font-weight: 600; margin: 10px 0 14px; }
.login-quote-author { font-size: 12.5px; color: var(--text-dim); }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 428px;
  margin: 0 auto;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.login-card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  margin: 0 auto 14px;
  border-radius: var(--radius);
  background: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

.login-card h1 span {
  color: var(--accent);
}

.login-tagline {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 22px;
}

.subtitle {
  color: var(--text-dim);
  margin: 0 0 20px;
  font-size: 14px;
}

.login-card label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 14px 0 6px;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.login-card input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  outline: none;
}

.login-input-icon { position: relative; display: flex; align-items: center; }
.login-input-icon span {
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.7;
  pointer-events: none;
}
.login-input-icon input { padding-left: 36px; }

.login-card button {
  width: 100%;
  margin-top: 22px;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  min-height: 46px;
  box-shadow: var(--shadow-glow);
  transition: filter 0.15s var(--ease), transform 0.1s var(--ease), box-shadow 0.15s var(--ease);
}

.login-card button:hover { filter: brightness(1.08); box-shadow: 0 10px 28px -6px rgba(139, 92, 246, 0.6); }
.login-card button:active { transform: scale(0.98); }

.error-text {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin: 10px 0 0;
}

.login-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 20px 0 16px;
}

.login-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.hint {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
  margin-top: 18px;
}

.section-subtitle {
  margin: 28px 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-subtitle:first-of-type { margin-top: 0; }

.hint code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}

.login-advanced {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.login-advanced summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  user-select: none;
}

.login-advanced label { margin-top: 12px; }
.login-advanced .hint { margin-top: 10px; }

@media (max-width: 1100px) {
  .login-decor { display: none; }
  .login-grid { grid-template-columns: 1fr; justify-items: center; }
  .login-panel-left, .login-panel-right { display: none; }
  .login-topbar { max-width: 428px; margin: 0 auto 24px; }
}

@media (max-width: 480px) {
  .login-topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .login-secure-chip { justify-content: center; }
}

/* ---------------- APP LAYOUT ---------------- */

#app-view {
  display: flex;
  min-height: 100vh;
}

.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s var(--ease);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 22px;
  padding-left: 4px;
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border-radius: 9px;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-glow);
}

.sidebar-brand-text {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-text small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0;
}

.sidebar-collapse-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.sidebar-collapse-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.sidebar-collapse-btn .icon { width: 14px; height: 14px; transition: transform 0.2s var(--ease); }
.sidebar.collapsed .sidebar-collapse-btn .icon { transform: rotate(180deg); }

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding-left: 0; }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-header { display: none; }
.sidebar.collapsed .nav-group { margin-top: 10px; }
.sidebar.collapsed .nav-btn { justify-content: center; padding: 10px; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-btn:hover { background: var(--bg-hover); color: var(--text); }

.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-btn.active {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(59, 130, 246, 0.08));
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px -4px rgba(139, 92, 246, 0.5);
}

/* ---------------- NAV GROUPS (statické popisky sekcí, vždy rozbalené) ---------------- */

.nav-group {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}

.nav-group:first-child { margin-top: 0; }

.nav-group-header {
  padding: 0 12px 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-group-items-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-items-inner .nav-btn {
  font-size: 13.5px;
  padding: 9px 12px;
}

.nav-btn-danger {
  margin-top: 18px;
  padding: 11px 12px;
  border: 1px solid rgba(242, 85, 90, 0.35);
  border-radius: var(--radius);
  background: rgba(242, 85, 90, 0.1);
  color: var(--red);
}

.nav-btn-danger:hover {
  background: rgba(242, 85, 90, 0.18);
  border-color: rgba(242, 85, 90, 0.55);
  color: var(--red);
}

/* ---------------- TOPBAR ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 28px;
}

.topbar .sidebar-toggle { display: none; }

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 420px;
}

.topbar-search .icon {
  position: absolute;
  left: 13px;
  color: var(--text-dim);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.topbar-search input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  outline: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-bot-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.topbar-bot-status-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.topbar-bot-status-text strong { font-size: 12.5px; font-weight: 700; }
.topbar-bot-status-text span { font-size: 11px; color: var(--text-dim); }

.topbar-profile { position: relative; }

.topbar-profile-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.topbar-profile-btn:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.topbar-profile-btn .icon { width: 13px; height: 13px; color: var(--text-dim); }

.topbar-profile-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border-radius: 8px;
  background: var(--accent-gradient);
}

.topbar-profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}

.topbar-profile-info strong { font-size: 13px; font-weight: 700; }
.topbar-profile-info span { font-size: 11px; color: var(--text-dim); }

.topbar-profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.lang-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.lang-btn {
  flex: 1;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.lang-btn:hover { border-color: var(--accent-2); color: var(--text); }

.lang-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
}

.lang-switch-login {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}

.lang-switch-login .lang-btn { flex: 0 0 56px; }

.connection-info {
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
  margin-bottom: 10px;
  line-height: 1.4;
}

#change-password-btn,
#logout-btn {
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

#change-password-btn { margin-bottom: 8px; }

#change-password-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
#logout-btn:hover { border-color: var(--red); color: var(--red); }

main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
}

.page { display: none; }
.page.active { display: block; animation: fade-in 0.18s var(--ease); }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

main h2 {
  margin: 0 0 20px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.settings-section-title {
  margin: 28px 0 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.settings-section-title:first-of-type { margin-top: 0; }

/* ---------------- STAT GRID ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.stat-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  border-color: var(--accent-dim);
}

.stat-card:hover::before { opacity: 1; }

.stat-card .label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.stat-card .value {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-card .value.accent { color: var(--accent); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }

.stat-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.14);
  color: var(--accent);
}

.stat-card-icon .icon { width: 17px; height: 17px; }
.stat-card-top .label { margin-bottom: 0; }

.stat-card-delta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.stat-card-delta.up { color: var(--green); }
.stat-card-delta.down { color: var(--red); }

.stat-card-sparkline { display: block; margin-top: 10px; opacity: 0.9; }

/* ---------------- DASHBOARD WIDGETS ---------------- */

.dashboard-header { margin-bottom: 18px; }
.dashboard-header h2 { margin-bottom: 4px; }

.dashboard-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-flow: dense;
  gap: 16px;
  margin-top: 20px;
}

.dashboard-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.dashboard-panel-wide { grid-column: span 2; }

.panel-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 10px;
  margin-bottom: 16px;
}

.panel-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.panel-header h3 .icon { color: var(--accent); }

.panel-header-hint {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 0;
  flex-shrink: 1;
}

.panel-header-link {
  background: transparent;
  border: none;
  color: var(--accent-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.panel-header-link:hover { text-decoration: underline; }

/* Stejná pevná výška jako u donutu (140px kruh v Rozdělení měny) —
   oba panely tak mají stejnou přirozenou výšku obsahu a grid řádek
   je nemusí nijak dopočítávat/roztahovat, vždy vyjde stejně. */
/* Kompaktní pevná velikost (jako kruh u donutu), ne roztažená přes
   celou šířku panelu — souhrn (průměr za 14 dní) sedí vedle grafu,
   stejně jako legenda vedle donutu. */
.chart-area { width: 100%; display: flex; align-items: center; gap: 20px; }
.chart-area .chart-empty, .distribution-area .chart-empty { color: var(--text-dim); font-size: 13px; padding: 30px 0; text-align: center; }

.chart-svg-wrap { position: relative; flex-shrink: 0; }
.chart-svg-wrap svg { width: 320px; max-width: 100%; height: 140px; display: block; }
.chart-hit-area { cursor: crosshair; }

.chart-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -125%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s var(--ease);
  z-index: 5;
}

.chart-tooltip strong { font-size: 12.5px; font-weight: 800; }
.chart-tooltip span { color: var(--text-dim); font-size: 10.5px; }

.chart-tooltip.chart-tooltip-edge-start { transform: translate(0, -125%); }
.chart-tooltip.chart-tooltip-edge-end { transform: translate(-100%, -125%); }

.chart-summary {
  flex: 1;
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid var(--border-soft);
}

.chart-summary-label { font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.chart-summary-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.chart-summary-period { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.distribution-area {
  display: flex;
  align-items: center;
  gap: 20px;
}

.distribution-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.distribution-legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}

.distribution-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.distribution-legend-label { flex: 1; color: var(--text-dim); }
.distribution-legend-value { font-weight: 700; }

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
}

.quick-action-btn:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.quick-action-btn:active { transform: scale(0.98); }

.quick-action-btn .icon { color: var(--accent); flex-shrink: 0; }
.quick-action-btn .chevron-right { margin-left: auto; color: var(--text-dim); width: 15px; height: 15px; }

.quick-action-btn.primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
}

.quick-action-btn.primary .icon,
.quick-action-btn.primary .chevron-right { color: #ffffff; }

/* Bezpečnostní síť pro střední šířky (např. tablet ~768px), kde
   se panel ještě nezobrazuje jako plně široký ale zároveň ještě
   nespadl pod mobilní breakpoint níž — tabulka se místo přetečení
   mimo kartu/stránku jen vodorovně scrolluje uvnitř karty. Na
   telefonu (≤640px) se navíc mění na skládané karty (viz media
   query níže), takže se sem prakticky nikdy nedostane. */
#dashboard-recent-transfers { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.dashboard-mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dashboard-mini-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  padding: 0 8px 8px;
  font-weight: 600;
}
.dashboard-mini-table td { padding: 9px 8px; border-top: 1px solid var(--border-soft); }
.dashboard-mini-table .amount-pos { color: var(--green); font-weight: 700; }
.dashboard-mini-table .amount-neg { color: var(--red); font-weight: 700; }
.dashboard-mini-table .empty-row td { text-align: center; color: var(--text-dim); padding: 18px 8px; }

.system-status-list { display: flex; flex-direction: column; gap: 4px; }

.system-status-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 4px;
  border-top: 1px solid var(--border-soft);
}

.system-status-row:first-child { border-top: none; }

.system-status-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-dim);
}

.system-status-icon .icon { width: 15px; height: 15px; }

.system-status-text { flex: 1; min-width: 0; line-height: 1.3; }
.system-status-text strong { display: block; font-size: 13px; }
.system-status-text span { display: block; font-size: 11.5px; color: var(--text-dim); }

.system-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--text-dim);
}

.system-status-badge.up { color: var(--green); }
.system-status-badge.down { color: var(--red); }

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-panel-wide { grid-column: span 1; }
}

@media (max-width: 640px) {
  .distribution-area { flex-direction: column; align-items: stretch; }
  .chart-area { flex-direction: column; align-items: stretch; }
  .chart-svg-wrap svg { width: 100%; }
  .chart-summary { padding-left: 0; padding-top: 14px; border-left: none; border-top: 1px solid var(--border-soft); }

  /* Poslední transakce (dashboard) — 4-sloupcová tabulka se na
     úzkém telefonu (~390px) nevejde (viz white-space: nowrap
     u th/td výše) a přeteče mimo kartu i mimo stránku. Místo
     vodorovného scrollování se každý řádek "rozbalí" na malou
     kartu se štítky u každé hodnoty — čitelnější než scroll
     u krátkého souhrnu s jen 5 řádky. */
  .dashboard-mini-table thead { display: none; }

  .dashboard-mini-table,
  .dashboard-mini-table tbody,
  .dashboard-mini-table tr,
  .dashboard-mini-table td {
    display: block;
    width: 100%;
  }

  .dashboard-mini-table tr {
    padding: 10px 0;
    border-top: 1px solid var(--border-soft);
  }

  .dashboard-mini-table tr:first-child { border-top: none; }

  .dashboard-mini-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 2px 0;
    border-top: none;
    white-space: normal;
    text-align: right;
  }

  .dashboard-mini-table td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-dim);
    text-align: left;
  }

  .dashboard-mini-table .empty-row td {
    display: block;
    text-align: center;
  }

  .dashboard-mini-table .empty-row td::before { content: none; }
}

/* ---------------- TOOLBAR ---------------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.toolbar input, .toolbar select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.toolbar input:focus, .toolbar select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  outline: none;
}

.toolbar input[type="text"] { min-width: 240px; flex: 1; max-width: 360px; }

.toolbar button {
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
}

.toolbar button:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.toolbar button:active { transform: scale(0.97); }

.toolbar .danger-btn {
  border-color: var(--red);
  color: var(--red);
  margin-left: auto;
}

.toolbar .danger-btn:hover { background: rgba(242, 85, 90, 0.12); }

.tabs .tab-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------------- TABLE ---------------- */

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th, tbody td { white-space: nowrap; }

thead th {
  text-align: left;
  padding: 13px 14px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.12s var(--ease); }
tbody tr:hover { background: var(--bg-hover); }

tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: rgba(167, 139, 250, 0.08); }

.empty-row td {
  text-align: center;
  color: var(--text-dim);
  padding: 28px;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-cell img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-elevated);
}

.id {
  font-size: 11.5px;
  color: var(--text-dim);
}

.mono { font-variant-numeric: tabular-nums; }
.mono.positive { color: var(--green); }
.mono.negative { color: var(--red); }

/* ---------------- LEADERBOARD ---------------- */

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-dim);
}

.rank-badge.rank-1,
.rank-badge.rank-2,
.rank-badge.rank-3 {
  font-size: 17px;
  box-shadow: var(--shadow-sm);
}

.rank-badge.rank-1 { background: linear-gradient(135deg, #fde68a, var(--gold)); }
.rank-badge.rank-2 { background: linear-gradient(135deg, #f1f3f7, #b8bfcc); }
.rank-badge.rank-3 { background: linear-gradient(135deg, #f0b184, #b8693a); }

tbody tr.leaderboard-top { background: rgba(242, 177, 60, 0.035); }
tbody tr.leaderboard-top:hover { background: rgba(242, 177, 60, 0.07); }

.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
}

.pagination button {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.pagination button:not(:disabled):hover { border-color: var(--accent-dim); background: var(--bg-hover); }

.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ---------------- CARD LIST (suggestions) ---------------- */

.card-list { display: flex; flex-direction: column; gap: 10px; }

.suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease);
}

.suggestion-card:hover { border-color: var(--accent-dim); }

.suggestion-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.suggestion-card .author {
  font-size: 12.5px;
  color: var(--text-dim);
}

.suggestion-card .text { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.suggestion-card .reviewed-by { font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }
.suggestion-card .admin-response {
  font-size: 13px;
  color: var(--text);
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 4px;
}

.status-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.reviewing { background: rgba(167, 139, 250, 0.15); color: var(--accent); }
.status-badge.accepted { background: rgba(62, 207, 142, 0.15); color: var(--green); }
.status-badge.rejected { background: rgba(242, 85, 90, 0.15); color: var(--red); }
.status-badge.ticket-open { background: rgba(62, 207, 142, 0.15); color: var(--green); }
.status-badge.ticket-locked { background: rgba(242, 85, 90, 0.15); color: var(--red); }

.suggestion-actions { display: flex; gap: 8px; }

.suggestion-actions button {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.suggestion-actions button.accept:hover { border-color: var(--green); color: var(--green); background: rgba(62, 207, 142, 0.1); }
.suggestion-actions button.reject:hover { border-color: var(--red); color: var(--red); background: rgba(242, 85, 90, 0.1); }

.suggestion-actions .delete-suggestion { margin-left: auto; }
.suggestion-actions .delete-suggestion:hover { border-color: var(--red); color: var(--red); }

/* ---------------- MODAL ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  animation: fade-in 0.15s var(--ease);
}

.modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal.modal-wide { max-width: 680px; }

.ticket-transcript {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
}

.ticket-message {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.ticket-message-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.ticket-message-author { font-weight: 600; color: var(--text); }

.ticket-message-content {
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.modal-close:hover { color: var(--text); background: var(--bg-hover); }

.modal h3 { margin: 0 0 16px; }

.modal label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 14px 0 6px;
}

.modal label:first-of-type { margin-top: 0; }

.modal input[type="password"],
.modal input[type="text"],
.modal textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.modal input[type="password"]:focus,
.modal input[type="text"]:focus,
.modal textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  outline: none;
}

.modal textarea {
  font-family: inherit;
  resize: vertical;
}

.modal > button:not(.modal-close) {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  min-height: 46px;
  box-shadow: var(--shadow-glow);
  transition: filter 0.15s var(--ease), transform 0.1s var(--ease);
}

.modal > button:not(.modal-close):hover { filter: brightness(1.08); }
.modal > button:not(.modal-close):active { transform: scale(0.98); }

.modal .modal-id {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 18px;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.modal-stats div {
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 10px 12px;
}

.modal-stats .label { font-size: 11.5px; color: var(--text-dim); }
.modal-stats .value { font-size: 16px; font-weight: 700; margin-top: 2px; }

.balance-form {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 6px;
}

.balance-form h4 { margin: 0 0 12px; font-size: 13.5px; color: var(--text-dim); }

.balance-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.balance-form select, .balance-form input {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
}

.balance-form select { width: 110px; }
.balance-form input { flex: 1; }

.balance-form button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  box-shadow: var(--shadow-glow);
  transition: filter 0.15s var(--ease), transform 0.1s var(--ease);
}

.balance-form button:hover { filter: brightness(1.08); }
.balance-form button:active { transform: scale(0.98); }

.transfers-mini { margin-top: 18px; }
.transfers-mini h4 { font-size: 13.5px; color: var(--text-dim); margin-bottom: 10px; }

/* ---------------- USERS ---------------- */

.add-user-form {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.add-user-form h4 { margin: 0 0 12px; font-size: 13.5px; color: var(--text-dim); }

.add-user-form .balance-form-row { align-items: stretch; }

.add-user-form input {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
  flex: 1;
}

.add-user-form button {
  padding: 9px 16px;
  border-radius: 9px;
  border: none;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  box-shadow: var(--shadow-glow);
  transition: filter 0.15s var(--ease), transform 0.1s var(--ease);
}

.add-user-form button:hover { filter: brightness(1.08); }
.add-user-form button:active { transform: scale(0.98); }

.role-select {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.15s var(--ease);
}

.role-select:focus { border-color: var(--accent-2); outline: none; }

.add-user-form select {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
}

.delete-user-btn {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s var(--ease);
}

.delete-user-btn:hover { background: rgba(242, 85, 90, 0.12); }

.transfers-mini table { font-size: 12.5px; }
.transfers-mini th, .transfers-mini td { padding: 7px 8px; }

/* ---------------- TABLE ROW ACTIONS (tickety apod.) ---------------- */

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-transcript-btn {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.view-transcript-btn:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(96, 165, 250, 0.1);
}

.delete-ticket-btn {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
}

.delete-ticket-btn:hover { background: rgba(242, 85, 90, 0.12); }

/* ---------------- CHANGELOG ---------------- */

.changelog-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.changelog-form textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  outline: none;
}

.changelog-form > button {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-gradient);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  box-shadow: var(--shadow-glow);
  transition: filter 0.15s var(--ease), transform 0.1s var(--ease);
}

.changelog-form > button:hover { filter: brightness(1.08); }
.changelog-form > button:active { transform: scale(0.98); }

.changelog-type-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.changelog-type-badge.bugfix { background: rgba(242, 85, 90, 0.14); color: var(--red); }
.changelog-type-badge.new_game { background: rgba(62, 207, 142, 0.14); color: var(--green); }
.changelog-type-badge.update { background: rgba(96, 165, 250, 0.14); color: var(--accent-2); }
.changelog-type-badge.patch_update { background: rgba(34, 195, 166, 0.14); color: var(--teal); }
.changelog-type-badge.balance { background: rgba(242, 177, 60, 0.14); color: var(--gold); }
.changelog-type-badge.announcement { background: rgba(167, 139, 250, 0.14); color: var(--accent); }

.changelog-description {
  white-space: normal;
  min-width: 220px;
  color: var(--text-dim);
  font-size: 13px;
}

.changelog-everyone-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(242, 85, 90, 0.16);
  color: var(--red);
  white-space: nowrap;
  vertical-align: middle;
}

.changelog-ping-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  margin-bottom: 14px;
  user-select: none;
}

.changelog-ping-check input { cursor: pointer; }

/* ---------------- TOAST ---------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 100;
  box-shadow: var(--shadow-md);
  max-width: calc(100vw - 32px);
  text-align: center;
  animation: toast-in 0.2s var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast.error { border-color: rgba(242, 85, 90, 0.4); color: #ff8b8f; box-shadow: var(--shadow-md), 0 0 0 1px rgba(242, 85, 90, 0.15); }
.toast.success { border-color: rgba(62, 207, 142, 0.4); color: #6fe3af; box-shadow: var(--shadow-md), 0 0 0 1px rgba(62, 207, 142, 0.15); }

@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }

  #app-view { flex-direction: column; min-height: 100dvh; }

  /* Unified topbar becomes the sticky mobile header (hamburger + brand),
     replacing the inline sidebar on mobile */
  .topbar {
    gap: 10px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .topbar .sidebar-toggle {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
  }

  .sidebar-toggle span {
    width: 17px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
  }

  .sidebar-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .sidebar-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .sidebar-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .topbar-mobile-brand {
    display: block;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .topbar-search { display: none; }
  .topbar-bot-status-text { display: none; }
  .topbar-bot-status { padding: 7px; }
  .topbar-profile-info { display: none; }
  .topbar-profile-btn { padding: 4px; gap: 4px; }
  .topbar-profile-btn .icon { display: none; }
  .topbar-right { gap: 8px; }

  /* Off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 82%;
    max-width: 300px;
    height: 100dvh;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    z-index: 60;
    padding: calc(18px + env(safe-area-inset-top)) 14px 18px;
    padding-left: calc(14px + env(safe-area-inset-left));
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.45);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 82%; max-width: 300px; }
  .sidebar-collapse-btn { display: none; }

  .sidebar nav { flex-direction: column; flex-wrap: nowrap; gap: 3px; }
  .nav-btn { padding: 12px; font-size: 14.5px; min-height: 44px; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
  }

  .sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

  #change-password-btn, #logout-btn { min-height: 40px; }

  main { padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }

  main h2 { font-size: 18px; }
}

.topbar-mobile-brand { display: none; }

@media (max-width: 480px) {
  .login-card { padding: 22px 18px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input[type="text"] { min-width: 0; max-width: none; width: 100%; }
  .toolbar select, .toolbar button { width: 100%; }
  .toolbar .danger-btn { margin-left: 0; }
  .toolbar button, .toolbar input, .toolbar select { min-height: 40px; }

  .tabs { flex-direction: row; flex-wrap: wrap; }
  .tabs .tab-btn { flex: 1 1 auto; }

  .pagination { justify-content: center; flex-wrap: wrap; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 20px; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .modal.modal-wide { max-width: 100%; }

  .balance-form-row, .add-user-form .balance-form-row {
    flex-direction: column;
  }
  .balance-form select, .balance-form input,
  .add-user-form select, .add-user-form input, .add-user-form button {
    width: 100%;
  }

  .modal-stats { grid-template-columns: 1fr 1fr; gap: 8px; }

  .suggestion-card .top-row { flex-wrap: wrap; gap: 8px; }
  .suggestion-actions { flex-wrap: wrap; }
  .suggestion-actions .delete-suggestion { margin-left: 0; }
}

/* ---------------- DANGER ZONE ---------------- */

.danger-zone {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid rgba(242, 85, 90, 0.35);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(242, 85, 90, 0.05);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.danger-zone:hover {
  border-color: rgba(242, 85, 90, 0.55);
  box-shadow: 0 8px 24px -8px rgba(242, 85, 90, 0.25);
}

.danger-zone h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--red);
}

.danger-zone .hint { margin-top: 0; margin-bottom: 14px; }

.danger-zone label[for] {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 6px;
}

.danger-zone input[type="text"] {
  width: 100%;
  max-width: 320px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 14px;
}

.danger-zone .error-text { margin-top: 10px; margin-bottom: 0; }

.danger-zone-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.danger-zone-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}

.danger-zone .danger-btn {
  border: 1px solid var(--red);
  color: var(--red);
  background: transparent;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 40px;
  transition: background 0.15s var(--ease), transform 0.1s var(--ease);
}

.danger-zone .danger-btn:active { transform: scale(0.98); }

.danger-zone .danger-btn:hover { background: rgba(242, 85, 90, 0.12); }

/* ---------------- BOT CONTROL ---------------- */

.status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.status-row button {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
}

.status-row button:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.status-row button:active { transform: scale(0.97); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.running { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.stopped { background: var(--red); }
.status-dot.starting, .status-dot.stopping { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status-dot.unknown { background: var(--text-dim); }

.control-btn {
  font-weight: 600;
  transition: background 0.15s var(--ease), transform 0.1s var(--ease);
}

.control-btn:active { transform: scale(0.97); }

.control-btn.start { border-color: var(--green); color: var(--green); }
.control-btn.start:hover { background: rgba(62, 207, 142, 0.12); }

.control-btn.stop { border-color: var(--red); color: var(--red); }
.control-btn.stop:hover { background: rgba(242, 85, 90, 0.12); }

.control-btn.restart { border-color: var(--accent-2); color: var(--accent-2); }
.control-btn.restart:hover { background: rgba(96, 165, 250, 0.12); }

.log-panel {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.log-panel .toolbar { margin-bottom: 12px; }
.log-panel h4 { margin: 0; font-size: 14px; margin-right: auto; }

.log-output {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  max-height: 420px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-dim);
  margin: 0;
}

/* ---------------- COMMAND LIST ---------------- */

.command-tag {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(167, 139, 250, 0.12);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.command-desc {
  white-space: normal;
  min-width: 200px;
  color: var(--text);
}

.category-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.arg-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.arg-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
}

.arg-type {
  font-size: 11px;
  color: var(--text-dim);
}

.permission-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.permission-badge.everyone { background: rgba(62, 207, 142, 0.14); color: var(--green); }
.permission-badge.restricted { background: rgba(242, 177, 60, 0.14); color: var(--gold); }
