@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:   #060d1a;
  --bg-card:   #0d1f38;
  --bg-input:  #0a1628;
  --bg-hover:  #112440;
  --cyan:      #00d4ff;
  --cyan-dim:  rgba(0,212,255,0.12);
  --cyan-glow: rgba(0,212,255,0.08);
  --text:      #e8f4ff;
  --text-muted:#5a7fa0;
  --border:    rgba(0,212,255,0.15);
  --border-md: rgba(0,212,255,0.28);
  --success:   #00e5a0;
  --error:     #ff4d6d;
  --warning:   #ffaa00;
  --radius:    12px;
  --radius-sm: 8px;
  --topbar-h:  60px;
}

html, body {
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none; z-index: 0;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.4;
}
.card-pad { padding: 1.5rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.6rem 1.2rem;
  background: var(--cyan); color: var(--bg-deep);
  border: none; border-radius: var(--radius-sm);
  font-family: 'Exo 2', sans-serif; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.04em;
  text-decoration: none;
}
.btn:hover { background: #33ddff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: none; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); background: none; transform: none; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #ff6b85; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-icon.danger:hover { border-color: var(--error); color: var(--error); }

/* ── FORM ELEMENTS ── */
.input {
  width: 100%;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 1rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.9rem;
  color: var(--text); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--text-muted); opacity: 0.6; }
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-glow); }

.select {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 1rem;
  font-family: 'Exo 2', sans-serif; font-size: 0.9rem;
  color: var(--text); outline: none; cursor: pointer;
}
.select:focus { border-color: var(--cyan); }

/* ── SECTION HEADER ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: 1rem; font-weight: 700; letter-spacing: 0.03em; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card { padding: 1.25rem 1.5rem; }
.stat-label {
  font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px;
}
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-value.cyan { color: var(--cyan); }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px;
  padding: 3rem; color: var(--text-muted); text-align: center;
}
.empty-icon { font-size: 2rem; opacity: 0.4; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 2rem; right: 2rem;
  padding: 0.8rem 1.2rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; z-index: 9999;
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: rgba(0,229,160,0.15); border: 1px solid rgba(0,229,160,0.4); color: var(--success); }
.toast.error   { background: rgba(255,77,109,0.15); border: 1px solid rgba(255,77,109,0.4); color: #ff8fa3; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 500; display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 440px;
  position: relative;
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer; line-height: 1; z-index: 2;
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.5rem; }
.modal-field { margin-bottom: 0.85rem; }
.modal-label {
  display: block; font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 6px;
}
.modal-creds {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1rem;
}
.cred-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 0.8rem; }
.cred-key { color: var(--text-muted); }
.cred-val { font-family: 'JetBrains Mono', monospace; color: var(--cyan); font-size: 0.78rem; }
.modal-note { font-size: 0.78rem; color: var(--warning); margin-bottom: 1rem; }

/* ── LIVE BADGE ── */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.4rem 0.8rem; border-radius: var(--radius-sm);
  background: rgba(0,229,160,0.1); border: 1px solid rgba(0,229,160,0.3);
  font-size: 0.72rem; font-weight: 700; color: var(--success);
  letter-spacing: 0.05em; white-space: nowrap;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Flash při příchozí hodnotě — zelené bliknutí na čteném widgetu */
@keyframes widgetFlash {
  0%   { box-shadow: 0 0 0 0 rgba(46,213,115,0.0); }
  20%  { box-shadow: 0 0 0 2px rgba(46,213,115,0.7), 0 0 14px 2px rgba(46,213,115,0.35); }
  100% { box-shadow: 0 0 0 0 rgba(46,213,115,0.0); }
}
.widget-flash { animation: widgetFlash 0.6s ease-out; }

/* Puls tečky živého stavu při každém pollu s daty */
@keyframes dotPulse {
  0%   { transform: scale(1);   box-shadow: 0 0 0 0 rgba(46,213,115,0.7); opacity: 1; }
  50%  { transform: scale(1.8); box-shadow: 0 0 6px 2px rgba(46,213,115,0.6); opacity: 1; }
  100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(46,213,115,0.0); opacity: 0.6; }
}
.dot-pulse { animation: dotPulse 0.5s ease-out; }

/* ── MAIN CONTENT ── */
.main {
  margin-top: var(--topbar-h);
  padding: 2rem 1.5rem;
  position: relative; z-index: 1;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── PLAN BUTTONS ── */
.btn-plan {
  width: 100%; padding: 0.8rem;
  border-radius: var(--radius-sm); border: none;
  font-family: 'Exo 2', sans-serif; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.04em;
  text-decoration: none; text-align: center; display: block;
}
.btn-plan:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-plan.free { background: none; border: 1px solid var(--border-md); color: var(--text); }
.btn-plan.free:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-plan.basic { background: var(--cyan); color: var(--bg-deep); }
.btn-plan.basic:hover { background: #33ddff; }
.btn-plan.pro { background: var(--warning); color: var(--bg-deep); }
.btn-plan.pro:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .main { padding: 1.2rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════
   KOMPONENTY — extrahováno z HTML stránek
   ════════════════════════════════════════ */

/* ── CENTERED PAGE (login, accept-share) ── */
body.page-centered::after {
  content: '';
  position: fixed; top: -40%; left: -20%; width: 70%; height: 80%;
  background: radial-gradient(ellipse, rgba(0,212,255,0.06) 0%, transparent 65%);
  pointer-events: none; z-index: 0;
}
.page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.logo { display: block; text-align: center; margin-bottom: 2rem; text-decoration: none; }
.logo img { width: 180px; height: auto; }

/* ── AUTH CARD ── */
.auth-card, .accept-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem;
  position: relative; overflow: hidden;
}
.accept-card { text-align: center; }
.auth-card::before, .accept-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0.6;
}
.accept-icon  { font-size: 2.5rem; margin-bottom: 1rem; }
.accept-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.accept-sub   { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── TABS ── */
.tabs { display: flex; background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 2rem; }
.tab {
  flex: 1; padding: 0.6rem;
  font-family: 'Exo 2', sans-serif; font-size: 0.9rem; font-weight: 600;
  color: var(--text-muted); background: none; border: none; border-radius: 6px;
  cursor: pointer; transition: all 0.2s;
}
.tab.active { background: var(--cyan); color: var(--bg-deep); }
.tab:not(.active):hover { color: var(--text); }

/* view-tabs */
.view-tabs {
  display: flex; gap: 4px; margin-bottom: 1.25rem;
  background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px; width: fit-content;
}
.view-tab {
  padding: 0.5rem 1.5rem; border-radius: 6px;
  font-family: 'Exo 2', sans-serif; font-size: 0.88rem; font-weight: 600;
  color: var(--text-muted); background: none; border: none; cursor: pointer; transition: all 0.2s;
}
.view-tab.active { background: var(--cyan); color: var(--bg-deep); }
.view-tab:not(.active):hover { color: var(--text); }

/* ── FORM ── */
.form { display: none; flex-direction: column; gap: 1.2rem; }
.form.active { display: flex; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label, .filter-label, .modal-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 3px;
}
.field .field-error { font-size: 0.75rem; color: var(--error); display: none; }
.field .field-error.show { display: block; }
.btn-full { width: 100%; padding: 0.85rem; margin-top: 0.3rem; font-size: 1rem; }
.btn-full:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; display: none; margin-bottom: 1rem; }
.alert.show { display: block; }
.alert.error   { background: rgba(255,77,109,0.12); border: 1px solid rgba(255,77,109,0.3); color: #ff8fa3; }
.alert.success { background: rgba(0,229,160,0.1);  border: 1px solid rgba(0,229,160,0.3);  color: var(--success); }
.footer { margin-top: 2rem; text-align: center; font-size: 0.78rem; color: var(--text-muted); }
.footer a { color: var(--cyan); text-decoration: none; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ares-row { display: flex; gap: 8px; }
.ares-row .input { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--cyan); cursor: pointer; }
.billing-form { display: flex; flex-direction: column; gap: 0.75rem; }
.share-form   { display: flex; flex-direction: column; gap: 1rem; }

/* ── BADGE ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; }
.badge.yes     { background: rgba(0,229,160,0.12);  color: var(--success); border: 1px solid rgba(0,229,160,0.3); }
.badge.no      { background: rgba(90,127,160,0.12); color: var(--text-muted); border: 1px solid rgba(90,127,160,0.2); }
.badge-active  { padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; }
.badge-active.yes { background: rgba(0,229,160,0.12);  color: var(--success); border: 1px solid rgba(0,229,160,0.3); }
.badge-active.no  { background: rgba(255,77,109,0.12); color: var(--error);   border: 1px solid rgba(255,77,109,0.3); }
.badge-admin   { background: rgba(255,170,0,0.15); color: var(--warning); border: 1px solid rgba(255,170,0,0.3); padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; }
.badge-plan    { background: var(--cyan-dim); color: var(--cyan); border: 1px solid var(--border-md); padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; }

/* ── SHARE INFO BOX ── */
.share-info { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: 1.5rem; text-align: left; }
.share-info-row { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 3px 0; }
.share-info-key { color: var(--text-muted); }
.share-info-val { font-family: 'JetBrains Mono', monospace; color: var(--text); }

/* ── TABLE (sdílení, admin) ── */
.share-table, .admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.share-table th, .admin-table th { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.share-table td, .admin-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid rgba(0,212,255,0.06); vertical-align: middle; }
.share-table tr:last-child td, .admin-table tr:last-child td { border-bottom: none; }
.share-table tr:hover td, .admin-table tr:hover td { background: var(--bg-hover); }

/* ── TOKEN BOX ── */
.token-box { display: flex; align-items: center; gap: 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-top: 1rem; }
.token-url { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--cyan); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── CREDITS ── */
.credits-header { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.credit-stat { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.25rem 1.5rem; }
.credit-stat-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.credit-stat-val   { font-size: 1.8rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--cyan); }
.credit-stat-sub   { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tx-table th { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.tx-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid rgba(0,212,255,0.06); vertical-align: middle; }
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: var(--bg-hover); }
.tx-amount { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.tx-amount.plus  { color: var(--success); }
.tx-amount.minus { color: var(--error); }
.tx-type { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; }
.tx-type.billing  { background: rgba(255,170,0,0.12); color: var(--warning); border: 1px solid rgba(255,170,0,0.3); }
.tx-type.purchase { background: rgba(0,229,160,0.12); color: var(--success); border: 1px solid rgba(0,229,160,0.3); }
.tx-type.admin    { background: rgba(0,212,255,0.12); color: var(--cyan);    border: 1px solid rgba(0,212,255,0.3); }
.tx-time { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-muted); }

/* ── PROFILE ── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.profile-row:last-child { border-bottom: none; }
.profile-key { color: var(--text-muted); flex-shrink: 0; }
.profile-val { font-family: 'JetBrains Mono', monospace; color: var(--text); text-align: right; }

/* ── SHARING ── */
.sharing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .sharing-grid { grid-template-columns: 1fr; } }

/* ── HISTORY ── */
.hist-filters { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 1.25rem; align-items: end; }
@media (max-width: 900px) { .hist-filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .hist-filters { grid-template-columns: 1fr; } }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
input[type="datetime-local"] {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 1rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.85rem;
  color: var(--text); outline: none; width: 100%; color-scheme: dark;
}
input[type="datetime-local"]:focus { border-color: var(--cyan); }
.topic-group  { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 6px; }
.topic-header { display: flex; align-items: center; gap: 10px; padding: 0.75rem 1rem; background: var(--bg-input); cursor: pointer; transition: background 0.15s; user-select: none; }
.topic-header:hover { background: var(--bg-hover); }
.topic-arrow  { font-size: 0.7rem; color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.topic-group.open .topic-arrow { transform: rotate(90deg); }
.topic-name   { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: var(--cyan); flex: 1; }
.topic-count  { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--cyan-dim); color: var(--cyan); }
.topic-latest { font-size: 0.72rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.topic-body   { display: none; }
.topic-group.open .topic-body { display: block; }
.topic-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.2); flex-wrap: wrap; gap: 6px; }
.export-btns { display: flex; gap: 6px; }
.export-btn { padding: 3px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; cursor: pointer; transition: all 0.2s; border: 1px solid var(--border); background: none; color: var(--text-muted); font-family: 'Exo 2', sans-serif; }
.export-btn:hover     { border-color: var(--cyan);    color: var(--cyan); }
.export-btn.csv:hover { border-color: var(--success); color: var(--success); }
.export-btn.json:hover{ border-color: var(--warning); color: var(--warning); }
.hist-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.hist-table td { padding: 0.5rem 1rem; border-bottom: 1px solid rgba(0,212,255,0.05); }
.hist-table tr:last-child td { border-bottom: none; }
.hist-table tr:hover td { background: rgba(0,212,255,0.03); }
.hist-payload { font-family: 'JetBrains Mono', monospace; color: var(--text); }
.hist-time    { font-family: 'JetBrains Mono', monospace; color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; text-align: right; }
.pagination   { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0.6rem 1rem; border-top: 1px solid var(--border); background: rgba(0,0,0,0.1); }

/* ── CODEGEN ── */
.cg-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }
.code-tabs { display: flex; gap: 4px; }
.code-tab { padding: 0.5rem 1.2rem; border-radius: 8px 8px 0 0; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); background: var(--bg-input); border: 1px solid var(--border); border-bottom: none; cursor: pointer; transition: all 0.15s; }
.code-tab.active { background: var(--bg-card); color: var(--cyan); border-color: var(--border-md); }
.code-tab:not(.active):hover { color: var(--text); }
.code-wrap { background: var(--bg-card); border: 1px solid var(--border-md); border-radius: 0 8px 8px 8px; overflow: hidden; }
.code-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.72rem; color: var(--text-muted); }
.code-lang { font-family: 'JetBrains Mono', monospace; color: var(--cyan); }
.copy-btn { padding: 4px 12px; background: var(--cyan-dim); border: 1px solid var(--border-md); color: var(--cyan); border-radius: 4px; font-size: 0.72rem; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.copy-btn:hover { background: var(--cyan); color: var(--bg-deep); }
.code-body { padding: 1.25rem; overflow-x: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.76rem; line-height: 1.7; white-space: pre; max-height: 65vh; overflow-y: auto; }
.ph-change  { color: #ffaa00; }
.ph-auto    { color: #00e5a0; }
.ph-action  { color: var(--cyan); }
.ph-comment { color: #3d6080; }
.ph-todo    { color: #ff4d6d; }
.legend { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: 0.78rem; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot  { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.gitignore-note { margin-top: 1rem; padding: 0.75rem 1rem; background: rgba(255,77,109,0.08); border: 1px solid rgba(255,77,109,0.25); border-radius: var(--radius-sm); font-size: 0.8rem; color: #ff8fa3; }
.skeleton { background: var(--bg-hover); border-radius: 6px; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ── DEVICES ── */
.devices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.device-card { padding: 1.25rem; }
.device-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.device-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.device-status.online  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.device-status.offline { background: var(--text-muted); }
.device-name { font-size: 1rem; font-weight: 700; flex: 1; }
.device-actions { display: flex; gap: 6px; }
.device-meta { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0.75rem; }
.device-meta-row { display: flex; justify-content: space-between; font-size: 0.78rem; }
.device-meta-row span:first-child { color: var(--text-muted); }
.device-meta-row span:last-child  { font-family: 'JetBrains Mono', monospace; }
.device-messages { display: none; border-top: 1px solid var(--border); padding-top: 0.75rem; margin-bottom: 0.5rem; }
.device-messages.open { display: block; }
.msgs-title   { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.msgs-empty   { font-size: 0.78rem; color: var(--text-muted); }
.msg-item     { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid rgba(0,212,255,0.06); font-size: 0.78rem; }
.msg-item:last-child { border-bottom: none; }
.msg-topic   { color: var(--cyan); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.msg-payload { color: var(--text); font-family: 'JetBrains Mono', monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time    { color: var(--text-muted); font-size: 0.7rem; white-space: nowrap; }
.btn-toggle  { background: none; border: none; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; width: 100%; text-align: center; padding: 4px; transition: color 0.15s; }
.btn-toggle:hover { color: var(--cyan); }

/* ── PLAN CARDS ── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; align-items: stretch; }
.plan-card { padding: 1.75rem; display: flex; flex-direction: column; transition: border-color 0.2s; }
.plan-card.featured::after { content: 'POPULÁRNÍ'; position: absolute; top: 16px; right: 16px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; color: var(--bg-deep); background: var(--cyan); padding: 3px 8px; border-radius: 4px; }
.plan-badge    { display: inline-block; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; background: rgba(0,229,160,0.15); color: var(--success); border: 1px solid rgba(0,229,160,0.3); }
.plan-name     { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.plan-price    { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.plan-period   { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 8px; flex: 1; margin-bottom: 1.5rem; }
.plan-features li { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.plan-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

/* ── ADMIN ── */
.search-bar { margin-bottom: 1rem; }

/* ── DASHBOARD WIDGETY ── */
.dash-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 10px; flex-wrap: wrap; }
.dash-toolbar-left  { display: flex; align-items: center; gap: 10px; }
.dash-toolbar-right { display: flex; align-items: center; gap: 8px; }
.edit-badge { display: none; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; background: rgba(255,170,0,0.12); border: 1px solid rgba(255,170,0,0.3); font-size: 0.72rem; font-weight: 700; color: var(--warning); letter-spacing: 0.06em; }
.edit-badge.visible { display: flex; }
.btn-edit-active { background: rgba(255,170,0,0.12) !important; border-color: rgba(255,170,0,0.4) !important; color: var(--warning) !important; }
.widget-grid { display: grid; grid-template-columns: repeat(24, 1fr); gap: 14px; min-height: 200px; }
.group-header { grid-column: 1 / -1; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); padding: 12px 2px 2px; border-bottom: 1px solid var(--border); margin-top: 6px; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-6  { grid-column: span 6; }
.col-12 { grid-column: span 12; }
.widget { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color 0.2s; position: relative; min-height: 140px; display: flex; flex-direction: column; }
.widget::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); opacity: 0.3; }
.widget.edit-active { border-color: rgba(255,170,0,0.5); cursor: move; }
.widget.edit-active:hover { border-color: var(--warning); }
.widget.drag-over { border-color: var(--cyan); border-style: dashed; }
.widget-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; }
.widget-label  { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.widget-edit-btns { display: none; gap: 4px; }
.edit-active .widget-edit-btns { display: flex; }
.wedit-btn { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: none; color: var(--text-muted); cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.wedit-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.wedit-btn.del:hover { border-color: var(--error); color: var(--error); }
.widget-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 14px 16px; }
.lbl-value { font-size: 2.4rem; font-weight: 700; line-height: 1; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.lbl-unit  { font-size: 0.9rem; color: var(--text-muted); margin-left: 4px; }
.lbl-sub   { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.live-dot-sm { width: 5px; height: 5px; border-radius: 50%; background: var(--success); opacity: 0.6; display: inline-block; }
.live-dot-sm.dot-offline { background: var(--text-muted); opacity: 0.4; }
.pub-btn { width: 72px; height: 72px; border-radius: 50%; border: 2px solid rgba(0,212,255,0.35); background: rgba(0,212,255,0.08); color: var(--cyan); font-size: 1.6rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.pub-btn-rect { min-width: 70%; padding: 12px 24px; border-radius: var(--radius-sm); border: 1px solid rgba(0,212,255,0.4); background: rgba(0,212,255,0.1); color: var(--cyan); font-family: 'Exo 2', sans-serif; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.03em; cursor: pointer; transition: all 0.15s; }
.pub-btn-rect:hover { background: rgba(0,212,255,0.2); border-color: var(--cyan); }
.pub-btn-rect:active { transform: scale(0.96); }
.pub-btn:hover { background: rgba(0,212,255,0.18); border-color: var(--cyan); transform: scale(1.05); }
.pub-btn:active { transform: scale(0.93); }

/* ── SLIDER ── */
.slider-input { -webkit-appearance: none; appearance: none; width: 90%; height: 6px; border-radius: 3px; background: rgba(0,212,255,0.15); outline: none; cursor: pointer; }
.slider-input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); cursor: pointer; box-shadow: 0 0 6px rgba(0,212,255,0.6); }
.slider-input::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--cyan); cursor: pointer; box-shadow: 0 0 6px rgba(0,212,255,0.6); }

/* ── REŽIMY (dropdown) ── */
.mode-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mode-btn { padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none; color: var(--text-muted); font-family: 'Exo 2', sans-serif; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.mode-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.mode-btn.active { background: rgba(0,212,255,0.15); border-color: var(--cyan); color: var(--cyan); }

/* ── MULTI-LABEL ── */
.multi-wrap { display: flex; flex-direction: column; gap: 7px; width: 100%; }
.multi-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.multi-lbl { font-size: 0.82rem; color: var(--text-muted); }
.multi-val { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--text); font-size: 1rem; }
.multi-unit { font-size: 0.7rem; color: var(--text-muted); margin-left: 2px; }
.pub-btn-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 8px; font-family: 'JetBrains Mono', monospace; }
.toggle-status { font-size: 0.85rem; font-weight: 700; margin-bottom: 10px; }
.toggle-status.on  { color: var(--success); }
.toggle-status.off { color: var(--text-muted); }
.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--text-muted); }
.sw { position: relative; width: 52px; height: 28px; cursor: pointer; flex-shrink: 0; }
.sw input { display: none; }
.sw-track { position: absolute; inset: 0; border-radius: 28px; background: var(--text-muted); transition: background 0.2s; }
.sw-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.sw input:checked ~ .sw-track { background: var(--success); }
.sw input:checked ~ .sw-thumb { transform: translateX(24px); }
.sp-current { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 4px; font-family: 'JetBrains Mono', monospace; }
.sp-display { font-size: 2rem; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; display: flex; align-items: baseline; gap: 4px; margin-bottom: 10px; }
.sp-unit { font-size: 0.85rem; color: var(--text-muted); }
.sp-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sp-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none; color: var(--text); font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.12s; }
.sp-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.sp-btn:active { transform: scale(0.88); }
.sp-val-input { width: 70px; text-align: center; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 1rem; padding: 5px; }
.sp-send { display: flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid rgba(0,212,255,0.3); background: rgba(0,212,255,0.08); color: var(--cyan); font-family: 'Exo 2', sans-serif; font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.sp-send:hover { background: rgba(0,212,255,0.18); }
.icon-display { font-size: 2.8rem; margin-bottom: 8px; transition: all 0.3s; line-height: 1; }
.icon-value   { font-size: 0.7rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.grid-empty      { grid-column: span 12; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 4rem; color: var(--text-muted); text-align: center; }
.grid-empty-icon { font-size: 2.5rem; opacity: 0.25; }
.side-panel { position: fixed; top: var(--topbar-h); right: -380px; bottom: 0; width: 360px; background: var(--bg-card); border-left: 1px solid var(--border); z-index: 200; transition: right 0.3s ease; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.side-panel.open { right: 0; }
.panel-head  { display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: 0.95rem; font-weight: 700; }
.panel-close { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: var(--radius-sm); width: 28px; height: 28px; cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; }
.panel-close:hover { border-color: var(--error); color: var(--error); }
.panel-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0.85rem; }
.type-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.type-opt { padding: 10px 6px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none; cursor: pointer; text-align: center; transition: all 0.15s; }
.type-opt:hover { border-color: rgba(0,212,255,0.4); }
.type-opt.sel { border-color: var(--cyan); background: var(--cyan-dim); }
.type-opt-ico { font-size: 1.3rem; margin-bottom: 3px; }
.type-opt-lbl { font-size: 0.65rem; color: var(--text-muted); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.type-opt.sel .type-opt-lbl { color: var(--cyan); }
.size-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.size-opt { padding: 7px 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none; cursor: pointer; text-align: center; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; transition: all 0.15s; }
.size-opt:hover { border-color: rgba(0,212,255,0.4); }
.size-opt.sel { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.cfg-fields { display: flex; flex-direction: column; gap: 10px; }
.cfg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 0.85rem; }
.cfg-row .panel-field { margin-bottom: 0; }
.gauge-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.gauge-svg  { overflow: visible; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .widget-grid { grid-template-columns: repeat(12,1fr); }
  .col-6, .col-12 { grid-column: span 12; }
}
@media (max-width: 600px) {
  .widget-grid { grid-template-columns: repeat(4,1fr); gap: 10px; }
  .col-2, .col-3, .col-4, .col-6, .col-12 { grid-column: span 4; }
  .side-panel { width: 100%; right: -100%; }
  .dash-toolbar { gap: 6px; }
}