/* ============================================================
   PULSE – zbytek vlastního vzhledu (ustupuje Bootstrapu)
   ============================================================

   Barvy, poloměry, stíny, typografie a focus se řídí přepisem proměnných
   Bootstrapu v `static/scss/pulse.scss`, ne odsud. Tenhle soubor je jen
   dojezd: drží pravidla, která ještě nemají bootstrapový protějšek, a mizí.
   Nová pravidla sem nepatří — hlídá to rozpočet v `scripts/kontrola.py`.

   Tokeny níž jsou PŘEMOSTĚNÍ, ne paleta. Zbytek souboru je ještě psaný přes
   `var(--app-…)`; než se převede, ukazují jména na bootstrapové proměnné, aby
   existoval jediný zdroj pravdy. S posledním převedeným pravidlem zmizí i ony.
   ============================================================ */

:root {
  --app-bg: var(--bs-body-bg);
  --app-surface: var(--bs-secondary-bg);       /* plocha karet a panelů */
  --app-surface-2: var(--bs-tertiary-bg);      /* zapuštěná plocha polí */
  --app-search-bg: var(--bs-tertiary-bg);
  --app-border: var(--bs-border-color);
  --app-text: var(--bs-body-color);
  --app-muted: var(--bs-secondary-color);
  --app-shadow: var(--bs-box-shadow);

  --pulse-accent: var(--bs-primary);
  --pulse-accent-600: var(--bs-primary-text-emphasis);
  --pulse-accent-soft: var(--bs-primary-bg-subtle);
  --pulse-dark: var(--bs-dark);
  --pulse-danger: var(--bs-danger-text-emphasis);
  --pulse-danger-solid: var(--bs-danger);
}

/* `.text-secondary` se v Bootstrapu 5.3 řídí `--bs-secondary-rgb`, a tu téma
   nepřebarvuje — na tmavém pozadí zůstávala šedá #6c757d s poměrem 3,71 : 1.
   Nativní řešení je `.text-body-secondary` v šablonách; do jeho zavedení
   (193 výskytů ve 37 souborech) drží čitelnost tenhle jediný přepis. */
[data-bs-theme="dark"] {
  --bs-secondary-rgb: 166, 173, 180;
}

/* Záložky (Po kategoriích / Po strojích) – v tématu, aktivní viditelná v obou režimech */
.nav-tabs {
  --bs-nav-tabs-border-color: var(--app-border);
  --bs-nav-tabs-link-hover-border-color: var(--app-border);
  --bs-nav-tabs-link-active-color: var(--app-text);
  --bs-nav-tabs-link-active-bg: var(--app-surface);
  --bs-nav-tabs-link-active-border-color: var(--app-border);
}
.nav-tabs .nav-link { color: var(--app-muted); }
.nav-tabs .nav-link:hover { color: var(--app-text); }
.nav-tabs .nav-link.active {
  color: var(--app-text);
  background: var(--app-surface);
  box-shadow: inset 0 -2px 0 var(--pulse-accent);
}

/* Aktivní přepínač Celkem/Dle typu = značkově zelený (jako ostatní aktivní prvky) */
#machineMode .btn.active {
  --bs-btn-active-bg: var(--pulse-accent);
  --bs-btn-active-border-color: var(--pulse-accent);
  --bs-btn-active-color: #0a120c;
}


/* ============================================================
   Layout
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Full-width header ---- */
.app-header {
  display: flex; align-items: center; gap: 1rem;
  /* Skutečná výška je o dva pixely vyšší než min-height: nejvyšší dítě je
     ikonové tlačítko 42 px plus svislé odsazení. Sidebar i lepivé prvky
     počítají z proměnné, aby se rozešly. */
  min-height: var(--header-h);
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  padding: .5rem 1.25rem;
  position: sticky; top: 0; z-index: 1050;
}
.sidebar-toggle {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--app-text); font-size: 1.35rem; cursor: pointer;
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--app-surface-2); }

/* ---- Tělo: levý sidebar + obsah ---- */
.app-body { display: flex; flex: 1 0 auto; align-items: stretch; }

.app-sidebar {
  flex: 0 0 64px; width: 64px;
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  padding: .7rem .55rem;
  display: flex; flex-direction: column;
  position: sticky; top: var(--header-h); align-self: flex-start;
  height: calc(100vh - var(--header-h)); overflow: hidden;
  transition: flex-basis .18s ease, width .18s ease;
}
.side-scroll {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: .15rem;
  overflow-x: hidden; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--app-border) transparent;
}
.app-shell.sidebar-open .app-sidebar { flex-basis: 232px; width: 232px; }

/* Nadpis sekce. Ve sbaleném stavu (jen ikonky) není kam napsat text, tak se
   z nadpisu stane dělicí linka – rozdělení modulů zůstane vidět i tam. */
.side-group {
  padding: .6rem .7rem .2rem; white-space: nowrap;
  font-size: .68rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--app-muted); opacity: .8;
}
.app-shell:not(.sidebar-open) .side-group {
  flex: 0 0 1px; padding: 0; margin: .45rem .5rem .3rem;
  background: var(--app-border);
}
.side-role {
  flex: 0 0 auto; margin-top: .4rem; padding: .5rem .7rem 0;
  border-top: 1px solid var(--app-border);
  color: var(--app-muted); font-size: .76rem;
  display: flex; align-items: center; gap: .5rem; white-space: nowrap;
}
.side-role .bi { font-size: 1rem; flex: 0 0 26px; text-align: center; }
/* Sbalený sidebar (výchozí): jen ikonky */
.app-shell:not(.sidebar-open) .side-label { display: none; }
.app-shell:not(.sidebar-open) .side-role { justify-content: center; padding-left: 0; padding-right: 0; }

.app-main { flex: 1 1 auto; min-width: 0; padding: 1.25rem 1.4rem 1.6rem; }
.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }

.app-search { flex: 1 1 auto; max-width: 640px; margin: 0 auto; position: relative; }
.app-search .bi { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--app-muted); font-size: 1.05rem; }
.app-search input {
  width: 100%; border: none; outline: none;
  background: var(--app-search-bg);
  border-radius: 50rem; padding: .7rem 1.1rem .7rem 2.7rem;
  color: var(--app-text); font-size: .95rem;
}
.app-search input::placeholder { color: var(--app-muted); }

/* Našeptávač */
.search-suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--app-surface); border: 1px solid var(--app-border);
  border-radius: 14px; box-shadow: var(--app-shadow); padding: .35rem;
  max-height: 72vh; overflow-y: auto; z-index: 1200;
}
.ss-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); padding: .5rem .7rem .2rem; font-weight: 700; }
.ss-item { display: flex; align-items: center; gap: .55rem; padding: .5rem .7rem; border-radius: 9px; color: var(--app-text); text-decoration: none; }
.ss-item:hover { background: var(--app-surface-2); }
.ss-ico { color: var(--app-muted); font-size: 1rem; width: 16px; text-align: center; flex-shrink: 0; }
.ss-label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.ss-meta { color: var(--app-muted); font-size: .78rem; white-space: nowrap; flex-shrink: 0; }
.ss-empty { padding: .9rem .8rem; color: var(--app-muted); font-size: .9rem; text-align: center; }
.ss-all { display: flex; align-items: center; gap: .5rem; justify-content: center; padding: .6rem; margin-top: .25rem; border-top: 1px solid var(--app-border); color: var(--pulse-accent); text-decoration: none; font-size: .88rem; font-weight: 600; }
.ss-all:hover { background: var(--pulse-accent-soft); }

.app-actions { display: flex; align-items: center; gap: .65rem; flex-shrink: 0; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--app-text); font-size: 1.2rem;
  position: relative; cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: var(--app-surface-2); }
.icon-btn .notif-badge {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px;
  background: var(--pulse-danger-solid); color: #fff; border-radius: 50rem; font-size: .68rem;
  display: flex; align-items: center; justify-content: center; font-weight: 700; padding: 0 4px;
}
.avatar-btn { background: var(--pulse-dark); color: #fff; }
[data-bs-theme="dark"] .avatar-btn { background: #000; }

/* Theme switch (pill) */
.theme-switch {
  width: 58px; height: 30px; border-radius: 50rem; border: none;
  background: var(--pulse-dark); position: relative; cursor: pointer; padding: 0; flex-shrink: 0;
  transition: background .2s;
}
.theme-switch .knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: left .2s; display: flex; align-items: center; justify-content: center;
  color: var(--pulse-dark); font-size: .8rem;
}
[data-bs-theme="dark"] .theme-switch { background: var(--pulse-accent); }
[data-bs-theme="dark"] .theme-switch .knob { left: 31px; color: #0a120c; }

.page-title { font-weight: 700; font-size: 1.5rem; margin: .25rem 0 1rem; letter-spacing: -.01em; }
.page-title:empty { display: none; }




/* ============================================================
   Loga (PULSE / autoneum text approximace)
   ============================================================ */

/* Oficiální SVG loga */
.brand-img { height: 26px; width: auto; display: block; }
.footer-tep { width: clamp(190px, 22vw, 270px); height: auto; display: block; margin-bottom: 1.2rem; }
.footer-pulse { width: 210px; max-width: 100%; height: auto; display: block; }

/* ============================================================
   Patička (přesně dle zadání) – vždy tmavá
   ============================================================ */
.app-footer {
  margin-top: 1.5rem;
  background:
    radial-gradient(90% 130% at 0% 0%, rgba(0, 255, 145, .16) 0%, rgba(0, 255, 145, 0) 42%),
    linear-gradient(180deg, #0c150f 0%, #0a0f0c 100%);
  color: #c9cfcb;
  flex-shrink: 0;
}
.app-footer .footer-inner { max-width: 1480px; margin: 0 auto; padding: 3.2rem 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 0; }
.footer-col { padding: 0 2.2rem; position: relative; }
.footer-col:not(:first-child)::before {
  content: ""; position: absolute; left: 0; top: .2rem; bottom: .2rem; width: 1px;
  background: rgba(255, 255, 255, .12);
}
.footer-col:first-child { padding-left: 0; }
.footer-col:last-child { padding-right: 0; }

.footer-lede { color: #9aa39d; font-size: .95rem; max-width: 320px; line-height: 1.5; }

.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 1.05rem; }
.footer-links a { display: inline-flex; align-items: center; gap: .7rem; color: #e7eae8; text-decoration: none; font-size: 1.02rem; transition: color .15s; }
.footer-links a:hover { color: var(--pulse-accent); }
.footer-arrow { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.footer-links a:hover .footer-arrow { border-color: var(--pulse-accent); color: var(--pulse-accent); }

.footer-contact { margin-bottom: 1.6rem; }
.footer-contact .lbl { display: flex; align-items: center; gap: .55rem; color: #9aa39d; font-size: .9rem; margin-bottom: .15rem; }
.footer-contact .val { font-size: 1.18rem; font-weight: 700; color: #fff; }
.footer-contact a.val { text-decoration: none; }
.footer-guide { display: inline-flex; align-items: center; gap: .6rem; color: #fff; font-weight: 600; font-size: 1.05rem; text-decoration: none; }

.footer-legal { color: #7e867f; font-size: .82rem; line-height: 1.55; margin-top: 1.4rem; }
.footer-legal .strong { color: #9aa39d; }
.footer-legal a, .auth-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-legal a:hover, .auth-legal a:hover { color: var(--pulse-accent); }

/* ============================================================
   Login (split panel) + reset hesla
   ============================================================ */
.auth-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.2rem; padding: 2.5rem 1rem;
  background: radial-gradient(70% 80% at 12% 8%, rgba(0, 255, 145, .10) 0%, rgba(0, 255, 145, 0) 45%), #07100b;
}
.auth-legal { text-align: center; max-width: 780px; padding: 0 1rem; }
.auth-legal-lead { color: #cfd3d1; font-size: 1.02rem; margin: 0 0 .65rem; }
.auth-legal-fine { color: #7e867f; font-size: .8rem; line-height: 1.65; margin: 0; }
.auth-card {
  display: flex; width: 100%; max-width: 1000px; min-height: 600px;
  border-radius: 28px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .55);
}
.auth-brand {
  flex: 1 1 50%; display: flex; flex-direction: column; padding: 3.4rem 3rem;
  background:
    radial-gradient(95% 75% at 12% 8%, rgba(0, 255, 145, .22) 0%, rgba(0, 255, 145, 0) 50%),
    linear-gradient(155deg, #0f2718 0%, #0a140e 60%, #060d09 100%);
}
.auth-brand-headline { width: min(80%, 330px); height: auto; margin-bottom: 2.2rem; }
.auth-brand-lede { color: #aeb6b0; font-size: 1.05rem; line-height: 1.55; max-width: 340px; }
.auth-brand-logo { width: 150px; height: auto; margin-top: auto; }

.auth-form { flex: 1 1 50%; background: #fff; display: flex; align-items: center; justify-content: center; padding: 2.5rem; }
.auth-form-inner { width: 100%; max-width: 380px; }
.auth-title { color: #1a1a1a; text-align: center; font-weight: 600; margin-bottom: 2rem; }

.auth-field { position: relative; margin-bottom: 1.1rem; }
.auth-field i { position: absolute; left: 1.3rem; top: 50%; transform: translateY(-50%); color: #6b7280; font-size: 1.1rem; }
.auth-field input {
  width: 100%; height: 56px; border: none; border-radius: 50rem; background: #ececec;
  padding: 0 1.25rem 0 3.1rem; font-size: 1rem; color: #1a1a1a; outline: none;
}
.auth-field input::placeholder { color: #9aa0a6; }
.auth-field input:focus { background: #e6e7e9; box-shadow: 0 0 0 .2rem rgba(0, 255, 145, .25); }

/* Řádek pod hesly. Na úzké obrazovce se přepínač a odkaz nevejdou vedle sebe
   a překrývaly se – proto smí zalomit a mají mezi sebou mezeru. */
.auth-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem .9rem; margin: .3rem .25rem 0;
}
.auth-forgot { color: #6b7280; font-size: .9rem; text-decoration: none; }
.auth-forgot:hover { color: #1a1a1a; }
.auth-toggle { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: .9rem; color: #4b5563; user-select: none; }
.auth-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-toggle-track { width: 40px; height: 22px; border-radius: 50rem; background: #1a1a1a; position: relative; transition: background .2s; flex-shrink: 0; }
.auth-toggle-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
.auth-toggle input:checked + .auth-toggle-track { background: var(--pulse-accent); }
.auth-toggle input:checked + .auth-toggle-track .auth-toggle-knob { left: 21px; }

.auth-submit { min-width: 150px; padding: .7rem 2rem; font-size: 1rem; }

.auth-single { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem;
  background: radial-gradient(70% 80% at 12% 8%, rgba(0, 255, 145, .10) 0%, rgba(0, 255, 145, 0) 45%), #07100b; }
.auth-single-card { width: 100%; max-width: 440px; background: #fff; border-radius: 22px; padding: 2.5rem; }
.auth-single-card h2 { color: #1a1a1a; font-weight: 600; }
.auth-single-card .form-control { background: #ececec; border: none; border-radius: 50rem; height: 52px; padding: 0 1.3rem; color: #1a1a1a; }
.auth-single-card .form-label { color: #4b5563; }
/* Světlá karta na tmavé stránce: přebarvi Bootstrapu proměnnou, ať nemusíme
   přebíjet utility .text-muted / .text-secondary vlastním !important. */
.auth-single-card { --bs-secondary-color: #4b5563; }
.auth-single-card p { color: #4b5563; }

@media (max-width: 767.98px) {
  .auth-card { flex-direction: column; max-width: 440px; min-height: 0; }
  .auth-brand { padding: 2.4rem; }
  .auth-brand-logo { margin-top: 1.6rem; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem 0; }
  .footer-col { padding: 0 1.4rem; }
  .footer-col:nth-child(odd) { padding-left: 0; }
  .footer-col:nth-child(odd)::before { display: none; }
  .footer-headline { font-size: 2rem; }
}
@media (max-width: 767.98px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-col { padding: 0; }
  .footer-col::before { display: none; }
  /* Hlavička se na mobilu láme do dvou řad, takže je vyšší; sidebar z toho
     počítá přes proměnnou, aby mu první položky nezmizely pod ní. */
  .app-header { flex-wrap: wrap; }
  .app-search { order: 3; flex-basis: 100%; max-width: none; }

  /* Sidebar je na mobilu vysouvací panel, ne trvalý pruh ikon. Dřív tu zůstal
     64px široký sloupec bez popisků a burger byl skrytý – uživatel tak neměl
     jak zjistit, co která ikona znamená, a přišel o šířku obsahu. */
  .app-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    z-index: 1040;
    width: 264px;
    flex-basis: 264px;
    height: calc(100vh - var(--header-h));
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  }

  .app-shell.sidebar-open .app-sidebar {
    width: 264px;
    flex-basis: 264px;
    transform: translateX(0);
  }

  .app-shell.sidebar-open .side-label { display: inline; }

  /* Zákryt pod panelem: klik mimo nabídku ji zavře. */
  .app-shell.sidebar-open .app-body::before {
    content: "";
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 1039;
    background: rgba(0, 0, 0, .45);
  }

  .app-main { padding: 1rem .85rem 1.2rem; width: 100%; }
}

/* --- Rozcestník modulů (hub) -------------------------------------------------
   Karta = celý klikací blok. Barevný akcent odlišuje modul, ale zůstává jen
   v ikoně a levém proužku – karty samotné drží plochou paletu zbytku appky. */
.hub-card {
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}
.hub-card::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--hub-accent, var(--pulse-accent));
}
a.hub-card:hover { transform: translateY(-2px); box-shadow: var(--app-shadow); }
a.hub-card:hover .hub-cta { color: var(--hub-accent, var(--pulse-accent)); }
.hub-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: .8rem; font-size: 1.35rem;
  background: var(--hub-accent-soft, var(--pulse-accent-soft));
  color: var(--hub-accent, var(--pulse-accent));
}
.hub-cta { font-weight: 600; font-size: .92rem; color: var(--app-text); }
.hub-icon-sm { width: 30px; height: 30px; border-radius: .55rem; font-size: .95rem; }
/* Modul, který ještě neexistuje – čitelný, ale zjevně neaktivní */
.hub-card-soon { opacity: .62; }
.hub-card-soon::before { background: var(--app-border); }
.hub-card-soon .hub-icon { background: var(--app-surface-2); color: var(--app-muted); }

.hub-oee    { --hub-accent: #00ff91; --hub-accent-soft: rgba(0, 255, 145, .14); }
.hub-budget { --hub-accent: #2a78d6; --hub-accent-soft: rgba(42, 120, 214, .16); }
.hub-production-monitoring { --hub-accent: #ffb020; --hub-accent-soft: rgba(255, 176, 32, .16); }
.hub-doc    { --hub-accent: #e5484d; --hub-accent-soft: rgba(229, 72, 77, .16); }

/* --- Production monitoring ------------------------------------------------ */
.monitoring-card { border-left: 4px solid var(--app-border); }
.monitoring-card-online { border-left-color: #28a745; }
.monitoring-card-offline { border-left-color: #89919a; }
.monitoring-metric {
  min-height: 126px; padding: 1rem; border-radius: .8rem;
  background: var(--app-surface-2);
}
.monitoring-metric-good { background: rgba(0, 255, 145, .10); }
.monitoring-label {
  color: var(--app-muted); font-size: .75rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.monitoring-value {
  margin-top: .35rem; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.monitoring-unit { margin-top: .4rem; color: var(--app-muted); font-size: .85rem; }
.monitoring-empty {
  min-height: 126px; display: flex; align-items: center; justify-content: center;
  gap: .65rem; color: var(--app-muted); text-align: center; background: var(--app-surface-2);
  border-radius: .8rem; padding: 1rem;
}

/* Stav zařízení. Tři stavy, ne dva: „warning“ je mini PC, které žije a jen
   nemá co číst – bez něj vypadá stejně jako vypnuté. Barvy jsou zároveň
   doplněné ikonou a textem, aby stav nenesla jen barva. */
.monitoring-card-warning { border-left-color: #ffb020; }
.monitoring-card-unknown { border-left-color: var(--app-border); }
.monitoring-device {
  display: flex; align-items: center; gap: .85rem;
  padding: .75rem .9rem; border-radius: .7rem;
  background: var(--app-surface-2); border: 1px solid var(--app-border);
}
.monitoring-device-icon {
  flex: none; width: 40px; height: 40px; border-radius: .6rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; background: var(--app-surface); color: var(--app-muted);
}
.monitoring-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: #89919a; box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}
.monitoring-dot-ok { background: #28a745; animation: monitoring-pulse 2s ease-out infinite; }
.monitoring-dot-warning { background: #ffb020; }
.monitoring-dot-offline { background: #e5484d; }
.monitoring-device-ok .monitoring-device-icon { color: #28a745; }
.monitoring-device-warning .monitoring-device-icon { color: #ffb020; }
.monitoring-device-offline .monitoring-device-icon { color: #e5484d; }
.monitoring-device-meta {
  color: var(--app-muted); font-size: .78rem;
  font-variant-numeric: tabular-nums; word-break: break-word;
}
.monitoring-command-log {
  list-style: none; margin: 0; padding: 0;
  font-size: .78rem; color: var(--app-muted);
}
.monitoring-command-log li { display: flex; gap: .5rem; padding: .15rem 0; }

@keyframes monitoring-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(40, 167, 69, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(40, 167, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .monitoring-dot-ok { animation: none; }
}

/* Tisk: vlastní prvky schová obyčejné `display: none` (utility se přebíjet
   nemusí – prvky s Bootstrap třídou používají v šablonách .d-print-none). */
@media print {
  .app-header, .app-sidebar, .app-footer { display: none; }
  .app-main { padding: 0; }
  body { background: #fff; }
}

/* --- Budget dashboard --------------------------------------------------------
   Detail kola rozpočtu: hero pás (zbývá najít + meter plnění cíle + stat
   dlaždice), grafy a tabulka položek. Datové barvy řad žijí v budget_charts.js
   (ověřená paleta) – tady je jen UI. Barvy jedou přes proměnné aplikace. */

/* Hero pás */
.budget-hero { padding: 1.4rem 1.5rem 1.15rem; }
.bh-grid {
  display: grid; grid-template-columns: minmax(230px, 330px) 1fr;
  gap: 1.25rem 3rem; align-items: center;
}
.bh-num {
  font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 800;
  letter-spacing: -.02em; line-height: 1.05; margin-top: .35rem;
}
.bh-num.bh-met { font-size: clamp(1.7rem, 2.6vw, 2.3rem); display: flex; align-items: center; gap: .55rem; }
.bh-gap { color: var(--pulse-danger); }
.bh-met { color: #07b36a; }
[data-bs-theme="dark"] .bh-met { color: var(--pulse-accent-600); }
.bh-sub { color: var(--app-muted); font-size: .86rem; margin-top: .3rem; }

/* Meter plnění cíle (základ → cíl, výplň = kolik už je škrtnuto) */
.gm-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .5rem; }
.gm-label { font-size: .76rem; color: var(--app-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.gm-text { font-size: .82rem; color: var(--app-muted); font-variant-numeric: tabular-nums; }
.gm-track { position: relative; height: 12px; border-radius: 50rem; background: var(--app-surface-2); overflow: hidden; }
.gm-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  border-radius: 50rem; background: #2a78d6; transition: width .5s ease;
}
[data-bs-theme="dark"] .gm-fill { background: #3987e5; }
.gm-fill.gm-met { background: #00c281; }
[data-bs-theme="dark"] .gm-fill.gm-met { background: #1baf7a; }
.gm-scale { display: flex; justify-content: space-between; font-size: .76rem; color: var(--app-muted); margin-top: .4rem; font-variant-numeric: tabular-nums; }

/* Výzva, když cíl není zadán */
.gm-empty {
  display: flex; align-items: center; gap: .9rem;
  background: var(--app-surface-2); border-radius: .9rem; padding: .85rem 1.05rem;
}
.gm-empty > .bi { font-size: 1.45rem; color: var(--app-muted); }
.gm-empty a { color: var(--app-text); font-weight: 600; text-decoration-color: var(--pulse-accent); text-underline-offset: 2px; }

/* Kompaktní stat dlaždice v hero */
.bh-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-top: 1.05rem; }
.stat-tile { background: var(--app-surface-2); border-radius: .9rem; padding: .7rem .9rem; min-width: 0; }
.st-label { font-size: .67rem; color: var(--app-muted); text-transform: uppercase; letter-spacing: .045em; font-weight: 600; }
.st-value { font-size: 1.18rem; font-weight: 700; letter-spacing: -.01em; margin-top: .1rem; white-space: nowrap; }
.st-sub { font-size: .73rem; color: var(--app-muted); }

.budget-note {
  margin-top: 1.15rem; padding-top: .9rem;
  border-top: 1px solid var(--app-border);
  font-size: .82rem; color: var(--app-muted); line-height: 1.55;
}

/* Prázdný stav grafu (např. chybějící měsíční rozpad) */
.chart-empty {
  height: 100%; min-height: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; color: var(--app-muted); font-size: .9rem; text-align: center;
}
.chart-empty .bi { font-size: 1.6rem; opacity: .7; }
.budget-note strong { color: var(--app-text); font-weight: 600; }

@media (max-width: 991.98px) {
  .bh-grid { grid-template-columns: 1fr; gap: 1.25rem; }
}
@media (max-width: 575.98px) {
  .bh-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .budget-hero { padding: 1.15rem 1.1rem 1rem; }
}

/* Tabulka položek */
.budget-table-wrap { max-height: 72vh; overflow: auto; }
.budget-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--app-surface);
  box-shadow: inset 0 -1px 0 var(--app-border);
  border-bottom: 0;
  padding-top: .55rem; padding-bottom: .55rem;
}
.budget-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, .015); }
[data-bs-theme="dark"] .budget-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .02); }
.budget-table tbody tr:hover { background: rgba(0, 255, 145, .06); }
.budget-table td { border-color: var(--app-border); }
.budget-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.budget-table .form-control-sm {
  min-height: 34px; padding: 4px 10px; border-radius: .55rem;
  text-align: right; font-variant-numeric: tabular-nums;
}
/* Počítané položky (jehly): řádek ustoupí, škrty se dělají přes vstupy výpočtu */
.budget-table .row-calc td { color: var(--app-muted); }
.item-flag {
  display: inline-block; margin-left: .35rem; padding: .1rem .5rem;
  border-radius: 50rem; background: var(--app-surface-2); color: var(--app-muted);
  font-size: .68rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  vertical-align: middle;
}
.item-reason { color: var(--app-muted); font-size: .78rem; margin-top: .1rem; }

/* Přehled kol (index) – klikací karty s pruhem útraty */
.round-card { color: inherit; padding: 1.15rem 1.3rem; transition: transform .12s ease, box-shadow .12s ease; }
a.round-card:hover { transform: translateY(-2px); box-shadow: var(--app-shadow); }
.rc-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.spend-bar { position: relative; height: 9px; border-radius: 50rem; background: var(--app-surface-2); overflow: hidden; margin-top: .95rem; }
.sb-fill { position: absolute; inset: 0 auto 0 0; max-width: 100%; border-radius: 50rem; background: #2a78d6; }
[data-bs-theme="dark"] .sb-fill { background: #3987e5; }
.sb-target { position: absolute; top: -1px; bottom: -1px; width: 2px; background: var(--app-text); opacity: .55; }
.rc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-top: .85rem; }
.rc-num { font-weight: 600; font-variant-numeric: tabular-nums; font-size: .92rem; margin-top: .1rem; white-space: nowrap; }
.rc-cta { margin-top: .9rem; font-size: .85rem; font-weight: 600; color: var(--app-muted); transition: color .12s ease; }
a.round-card:hover .rc-cta { color: var(--app-text); }
@media (max-width: 575.98px) {
  .rc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Diagnostika řetězce (Production monitoring).
 *
 * Články jdou za sebou jako trasa signálu, ne jako mřížka karet – pořadí nese
 * význam a čte se to zleva doprava. Stav nese barva i text, nikdy jen barva.
 */
.pm-chain {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: pm-chain;
}

.pm-chain-step {
  position: relative;
  flex: 1 1 11rem;
  padding: .7rem .9rem;
  border: 1px solid var(--app-border);
  border-left: 4px solid var(--app-border);
  border-radius: .75rem;
  background: var(--app-surface-2);
}

.pm-chain-step[data-state="ok"] { border-left-color: #28a745; }
.pm-chain-step[data-state="warn"] { border-left-color: #ffb020; }
.pm-chain-step[data-state="bad"] { border-left-color: #e5484d; }

.pm-chain-name {
  display: block;
  font-size: .85rem;
  font-weight: 600;
}

.pm-chain-detail {
  display: block;
  margin-top: .15rem;
  color: var(--bs-secondary-color);
  font-size: .78rem;
}

/* Náhled loga v knihovně.
 *
 * Bílé pozadí schválně: hlavička tabule i heslová brána jsou světlé, takže
 * tady je logo vidět přesně tak jako na hale. Pevná výška drží dlaždice
 * v mřížce srovnané i u log s úplně jiným poměrem stran.
 */
.pm-logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 7.5rem;
  padding: 1rem;
  border-bottom: 1px solid var(--app-border);
  border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0;
  background: #ffffff;
}

.pm-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Krátká adresa zákaznického zobrazení – tuhle někdo ťuká ovladačem do
   televize, takže má být v seznamu vidět dřív než kanonická s UUID. */
.pm-url-short {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--pulse-accent-600);
}

/* Drobečková navigace.
 *
 * Oddělovač je v CSS, ne v šabloně: v HTML by ho čtečka obrazovky předčítala
 * jako obsah. Poslední článek je aktuální stránka, proto není odkaz.
 */
.pulse-breadcrumbs {
  margin-bottom: .35rem;
}

.pulse-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .85rem;
}

.pulse-breadcrumbs li + li::before {
  content: "/";
  margin-right: .35rem;
  color: var(--bs-secondary-color);
}

.pulse-breadcrumbs a {
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.pulse-breadcrumbs a:hover {
  color: var(--pulse-accent-600);
  text-decoration: underline;
}

.pulse-breadcrumbs [aria-current="page"] {
  color: var(--bs-body-color);
  font-weight: 600;
}

/* Dlouhé adresy v tabulkách. Sloupec dostane spodní šířku, aby se tabulka na
   mobilu radši posunula do strany (obal .table-responsive to umí) než aby
   adresu mačkala po písmenech – zlomená URL se špatně čte i opisuje. */
.pm-url-cell {
  min-width: 22rem;
}

.pm-url-short {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Tabulka překladů: šířky prvních dvou sloupců. Zbytek si mezi sebe rozdělí
   jazyky, kterých může být kolik chce — proto procenta, ne pevné pixely. */
.pm-label-key { width: 22%; }
.pm-label-default { width: 18%; }
