/* ==========================================================================
   SolidusTech UI — style.css (consolidated)
   Čisté proměnné, bez duplicit, jemná enterprise estetika
   ========================================================================== */

/* ---------- 0) Reset ---------- */
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
img,svg{display:block;max-width:100%}
:focus-visible{outline:2px solid #60a5fa;outline-offset:2px;border-radius:8px}

/* ---------- 1) Design tokens ---------- */
:root{
  /* Brand */
  --brand:#1f3b72;
  --accent:#2563eb;
  --accent-2:#4f8dfc;

  /* Surfaces & text */
  --bg:#ffffff;
  --ink:#0f172a;
  --muted:#667085;
  --line:#e7edf3;
  --card:#ffffff;

  /* States */
  --ok:#16a34a;
  --warn:#f59e0b;
  --danger:#ef4444;
  --info:#0ea5e9;

  /* Radii & Elevation */
  --radius-lg:18px;
  --radius-md:14px;
  --radius-sm:10px;
  --shadow-sm:0 2px 10px rgba(15,23,42,.06);
  --shadow:0 10px 30px rgba(15,23,42,.10);
  --shadow-lg:0 12px 32px rgba(15,23,42,.12);

  /* Motion */
  --ease:cubic-bezier(.2,.7,.2,1);
  --speed:.22s;
}

/* ---------- 2) Base ---------- */
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font: 500 16px/1.55 "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at -10% -10%, #f3f7ff, transparent 60%),
    radial-gradient(900px 500px at 110% -10%, #f7fbff, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Dashboard specific body styling */
.dashboard-body {
  overflow-x: hidden;
}

/* App Container - Full responsive layout */
.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  container-type: inline-size;
}

/* Universal responsive layout for all pages */
body:not(.dashboard-body) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1rem 2rem;
  max-width: 100%;
}

body:not(.dashboard-body) > * {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* Responsive padding for all pages */
@media (max-width: 1199px) {
  body:not(.dashboard-body) {
    padding: 1rem 1.5rem;
  }
}

@media (max-width: 767px) {
  body:not(.dashboard-body) {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 480px) {
  body:not(.dashboard-body) {
    padding: 0.5rem 0.75rem;
  }
}

/* ---------- 3) Top info bar (tvůj první <p>) ---------- */
body > p:first-of-type{
  position:sticky;top:0;z-index:10;
  backdrop-filter:saturate(1.2) blur(8px);
  background:rgba(255,255,255,.75);
  border:1px solid var(--line);
  border-radius:calc(var(--radius-md) + 2px);
  padding:12px 16px;
  box-shadow:var(--shadow-sm);
  display:flex;gap:12px;align-items:center;justify-content:space-between;
  margin-bottom:22px;
  animation:fadeIn .5s var(--ease) both;
}
body > p:first-of-type strong{
  background:linear-gradient(180deg,#eef4ff,#ffffff);
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 12px;
  font-weight:700;letter-spacing:.2px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.6);
}
body > p:first-of-type a{
  text-decoration:none;
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#fff;padding:8px 14px;border-radius:999px;font-weight:600;letter-spacing:.2px;
  box-shadow:0 6px 16px rgba(37,99,235,.18);border:0;
  transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;
}
body > p:first-of-type a:hover{transform:translateY(-1px);filter:saturate(1.05)}
body > p:first-of-type a:active{transform:none;filter:saturate(.95)}

/* ---------- 4) Nadpisy ---------- */
h2{
  font-size:clamp(22px,2.5vw,28px);
  line-height:1.2;margin:8px auto 18px;font-weight:800;letter-spacing:.2px;
  position:relative;padding-bottom:12px;animation:fadeIn .5s var(--ease) both;
}
h2::after{
  content:"";position:absolute;left:0;bottom:0;width:72px;height:4px;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  border-radius:999px;box-shadow:0 2px 10px rgba(37,99,235,.25);
  transform-origin:left;animation:underlineIn .6s var(--ease) .1s both;
}

/* ---------- 5) Grid karet (tvoje <ul><li>) ---------- */
ul{list-style:none;display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px;margin:8px 0 40px;animation:fadeIn .4s var(--ease) both}
li{
  border-radius:var(--radius-lg);border:1px solid var(--line);
  background:radial-gradient(200% 120% at 100% 0,#ffffff 0 20%,#fafdff 30%,#ffffff 60%),var(--card);
  box-shadow:var(--shadow-sm);
  transition:transform .2s var(--ease),box-shadow .2s ease,border-color .2s ease;
  overflow:hidden;
}
li:hover{transform:translateY(-4px);box-shadow:var(--shadow-lg);border-color:#dfe7ee}
li > a{
  display:block;padding:18px;color:var(--ink);font-weight:700;letter-spacing:.25px;text-decoration:none;position:relative;
}
li > a::after{
  content:"";position:absolute;left:18px;right:18px;bottom:12px;height:2px;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  border-radius:999px;transform:scaleX(0);transform-origin:left;transition:transform .22s var(--ease);opacity:.85;
}
li:hover > a::after{transform:scaleX(1)}
li > a::before{content:"↗";position:absolute;right:16px;top:14px;font-size:18px;opacity:.18;transition:transform .2s ease,opacity .2s ease}
li:hover > a::before{transform:translate(2px,-2px);opacity:.32}

/* ---------- 6) Karty / panely ---------- */
.card{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius-md);
  box-shadow:var(--shadow-sm);padding:clamp(16px,2vw,22px);
  transition:transform var(--speed) var(--ease),box-shadow var(--speed) var(--ease)
}
.card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.card h2,.card h3{margin:0 0 8px;color:var(--ink);letter-spacing:.2px}
.muted{color:var(--muted)}

/* ---------- 7) Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  height:42px;padding:0 16px;border-radius:12px;border:1px solid transparent;
  font-weight:700;letter-spacing:.2px;cursor:pointer;user-select:none;
  transition:transform var(--speed) var(--ease),box-shadow var(--speed) var(--ease),background var(--speed) var(--ease),border-color var(--speed) var(--ease),color var(--speed) var(--ease)
}
.btn:active{transform:translateY(1px)}
.btn-primary{background:linear-gradient(135deg,var(--brand) 0%,var(--accent) 100%);color:#fff;box-shadow:0 8px 24px rgba(37,99,235,.28)}
.btn-primary:hover{box-shadow:0 12px 32px rgba(37,99,235,.35)}
.btn-ghost{background:#fff;color:var(--accent);border-color:rgba(31,59,114,.25)}
.btn-ghost:hover{background:#f7f9ff;border-color:var(--accent-2);color:var(--accent-2)}
.btn-danger{background:linear-gradient(135deg,#ef4444,#f97316);color:#fff}
.btn-success{background:linear-gradient(135deg,#16a34a,#22c55e);color:#fff}

/* Speciál: Back button v hlavičce stránky */
.page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:8px 0 22px}
.btn-back{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 14px;border-radius:999px;border:1px solid var(--line);
  background:#fff;color:var(--accent);font-weight:700;text-decoration:none!important;
  box-shadow:var(--shadow-sm);transition:box-shadow .2s ease,transform .2s ease,border-color .2s ease
}
.btn-back svg{width:18px;height:18px}
.btn-back:hover{box-shadow:var(--shadow);border-color:var(--accent-2);transform:translateY(-1px)}

/* ---------- 8) Odkazy ---------- */
a{color:var(--accent);text-underline-offset:3px;transition:color .15s ease,opacity .15s ease}
a:hover{color:#1e4fdc}

/* ---------- 9) Formuláře ---------- */
.form{display:grid;gap:14px;background:var(--card);border:1px solid var(--line);border-radius:var(--radius-md);padding:clamp(16px,2.2vw,26px);box-shadow:var(--shadow-sm)}
.label{font-weight:700;font-size:.92rem;color:var(--ink)}
.input,.select{
  width:100%;height:44px;padding:10px 12px;border-radius:12px;background:#fff;border:1px solid #e3e8f2;color:var(--ink);
  transition:border-color var(--speed) var(--ease),box-shadow var(--speed) var(--ease)
}
.input::placeholder{color:#9aa4b2}
.input:focus,.select:focus{border-color:var(--accent-2);box-shadow:0 0 0 6px rgba(79,141,252,.18)}
.textarea{min-height:120px;resize:vertical}
.form-row{display:grid;gap:12px;grid-template-columns:1fr 1fr}
@media (max-width:820px){.form-row{grid-template-columns:1fr}}

/* ---------- 10) Tabulky ---------- */
.table{width:100%;border-collapse:separate;border-spacing:0;background:var(--card);border:1px solid var(--line);border-radius:var(--radius-md);overflow:hidden;box-shadow:var(--shadow-sm)}
.table th,.table td{text-align:left;padding:14px 16px;vertical-align:middle}
.table thead th{background:linear-gradient(180deg,#f9fbff,#f2f6ff);color:#334155;font-weight:800;letter-spacing:.2px;border-bottom:1px solid var(--line);position:sticky;top:0}
.table tbody tr + tr td{border-top:1px solid var(--line)}
.table tbody tr:hover{background:#f9fbff}
.badge{display:inline-block;padding:4px 10px;border-radius:999px;font-size:.78rem;font-weight:800;background:#eef2ff;color:var(--accent)}
.badge.ok{background:#eaf7ee;color:var(--ok)}
.badge.warn{background:#fff7e6;color:#b45309}
.badge.err{background:#ffecef;color:#b91c1c}
.badge.badge-low{background:#ecfdf5;color:#059669}
.badge.badge-medium{background:#fff7ed;color:#ea580c}
.badge.badge-high{background:#fef2f2;color:#dc2626}
.badge.badge-success{background:#ecfdf5;color:#059669}
.badge.badge-info{background:#eff6ff;color:#2563eb}
.badge.badge-danger{background:#fef2f2;color:#dc2626}
.badge.badge-outline{background:transparent;color:var(--muted);border:1px solid var(--line)}

/* ---------- 11) Toolbar / Search ---------- */
.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:space-between;margin-bottom:12px}
.search{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:6px 10px;height:40px}
.search input{border:none;outline:none;background:transparent;width:220px;max-width:50vw}

/* ---------- 12) KPI, utility ---------- */
.kpi{display:grid;gap:6px}
.kpi .value{font-weight:900;font-size:clamp(1.3rem,2.6vw,1.8rem)}
.kpi .label{color:var(--muted);font-weight:700}
.center{display:flex;align-items:center;justify-content:center}
.right{margin-left:auto}
.hide{display:none!important}
.m0{margin:0!important}.mt{margin-top:16px!important}.mb{margin-bottom:16px!important}

/* ---------- 13) Login (responzivní i „glass“) ---------- */
.solidus-bg,
.login-wrap{
  min-height:100vh;min-width:100vw;width:100%;height:100%;
  background:url('backround.jpg') center center/cover no-repeat, linear-gradient(120deg,#2563eb 0%,#4f8dfc 100%);
}
.login-wrap{position:fixed;top:0;left:0;z-index:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
.login-card{
  background:rgba(255,255,255,.92);
  border-radius:24px;box-shadow:0 12px 32px #2770B8;
  padding:38px 32px 32px;max-width:400px;width:100%;position:relative;z-index:2;display:flex;flex-direction:column;align-items:center
}
.login-title{font-size:2rem;font-weight:800;color:#2770B8;margin-bottom:18px;text-align:center}
.login-error{background:#ffecef;color:#b91c1c;border-radius:12px;padding:10px 18px;margin-bottom:16px;font-weight:700;box-shadow:0 2px 10px rgba(239,68,68,.08);text-align:center}
.login-form{width:100%;display:flex;flex-direction:column;gap:14px}
.login-input{height:44px;border-radius:12px;border:1px solid #e3e8f2;padding:10px 12px;font-size:1rem;background:#fff;color:var(--ink);transition:border-color .22s var(--ease),box-shadow .22s var(--ease)}
.login-input:focus{border-color:var(--accent-2);box-shadow:0 0 0 6px rgba(79,141,252,.18)}
.login-btn{background:linear-gradient(135deg,#2563eb 0%,#4f8dfc 100%);color:#fff;font-weight:700;border:none;border-radius:12px;height:44px;box-shadow:0 8px 24px rgba(37,99,235,.18);cursor:pointer;font-size:1.08rem;transition:box-shadow .18s ease,transform .18s ease}
.login-btn:hover{box-shadow:0 12px 32px rgba(37,99,235,.28);transform:translateY(-2px)}
.login-forgot{margin-top:1rem;text-align:center}
.login-forgot a{color:var(--accent);text-decoration:none;font-weight:600;transition:color .18s ease}
.login-forgot a:hover{color:var(--accent-2);text-decoration:underline}

/* „Perfektní responzivita“ přezdívané třídy – kompatibilita se stávajícím HTML */
.login-card-responsive{max-width:480px;width:100%;padding:56px 44px 44px;margin:0 auto}
.login-title-responsive{margin-bottom:36px;letter-spacing:.5px;font-size:2.3rem;text-align:center}
.login-form-responsive{gap:22px}
.login-label{font-weight:700;font-size:1.08rem;margin-bottom:2px}
.login-input-responsive{font-size:1.13rem;padding:12px 14px}
.login-btn-responsive{margin-top:10px;font-size:1.16rem;height:48px}
.login-error-responsive{font-size:1.08rem}
.login-forgot-responsive{margin-top:1.5rem;font-size:1.01rem}
@media (max-width:600px){
  .login-card-responsive{max-width:98vw;padding:24px 8vw}
  .login-title-responsive{font-size:1.5rem;margin-bottom:22px}
  .login-form-responsive{gap:14px}
  .login-btn-responsive{font-size:1.04rem;height:44px}
}

/* ---------- 14) Modern Sidebar Navigation ---------- */
.modern-sidebar {
  background: white;
  border-radius: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
  border-right: 1px solid var(--line);
  padding: 1.5rem;
  width: 280px;
  min-width: 280px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 100;
}

/* Main Content Area - full width layout */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: calc(100% - 280px);
  margin-left: 280px;
  margin-top: -10px;
  padding: 0;
  min-height: auto;
  order: 2;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Responsive layout for mobile */
@media (max-width: 900px) {
  .dashboard-layout {
    flex-direction: column;
    gap: 0;
    padding: 0;
  }
  
  .modern-sidebar {
    width: 100%;
    min-width: unset;
    position: static;
    height: auto;
    max-height: none;
    order: 2;
    border-radius: 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  
  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 1rem;
    order: 1;
  }
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: fixed;
  left: 280px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 80px;
  background: white;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 2px 0 12px rgba(39, 112, 184, 0.3);
  width: 45px;
}

.toggle-icon {
  font-size: 32px;
  font-weight: bold;
  line-height: 1;
  transition: transform 0.3s ease;
}

/* Sidebar collapsed state */
.dashboard-layout.sidebar-collapsed .modern-sidebar {
  transform: translateX(-280px);
}

.dashboard-layout.sidebar-collapsed .sidebar-toggle {
  left: 0;
}

.dashboard-layout.sidebar-collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

.dashboard-layout.sidebar-collapsed .main-content {
  margin-left: 0;
  width: 100%;
}

/* Sidebar Logo */
.sidebar-logo {
  padding: 2rem 1rem 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
  background: white;
}

.logo-image {
  width: 180px;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border: none;
  outline: none;
}

/* Sidebar Profile */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-profile:hover {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-color: #cbd5e1;
}

.sidebar-profile.active {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: var(--accent);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.profile-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none;
}

.profile-role {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: capitalize;
  cursor: pointer;
  user-select: none;
}

.profile-hint {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 0.25rem;
  opacity: 0.8;
  cursor: pointer;
  user-select: none;
}

.sidebar-profile:hover .profile-hint {
  opacity: 1;
}

.profile-dropdown-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.sidebar-profile.active .profile-dropdown-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Profile Dropdown Overlay (appears in main content) */
.profile-dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.profile-dropdown-overlay.show {
  opacity: 1;
  visibility: visible;
}

.profile-dropdown-panel {
  background: white;
  border-radius: 18px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.profile-dropdown-overlay.show .profile-dropdown-panel {
  transform: scale(1) translateY(0);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.profile-panel-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.profile-panel-close {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--muted);
}

.profile-panel-close:hover {
  background: #fee;
  border-color: #dc2626;
  color: #dc2626;
}

.profile-panel-content {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.profile-panel-user {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: 12px;
  margin-bottom: 2rem;
}

.profile-panel-avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.profile-panel-info {
  flex: 1;
}

.profile-panel-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.profile-panel-email {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.profile-panel-role {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: capitalize;
}

.profile-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-panel-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.profile-panel-btn:hover {
  background: #f8fafc;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(4px);
}

.profile-panel-btn svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.2s ease;
}

.profile-panel-btn:hover svg {
  color: var(--accent);
}

.profile-panel-btn-logout {
  border-color: #fee;
  color: #dc2626;
}

.profile-panel-btn-logout:hover {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626;
}

.profile-panel-btn-logout svg {
  color: #dc2626;
}

/* Old dropdown styles (kept for compatibility) */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  margin-top: 0.5rem;
}

.profile-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-dropdown-header {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.25rem;
}

.profile-dropdown-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.profile-dropdown-email {
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 0.25rem 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.profile-dropdown-item:hover {
  background: #f8fafc;
  color: var(--accent);
}

.profile-dropdown-item svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.2s ease;
}

.profile-dropdown-item:hover svg {
  color: var(--accent);
}

.profile-dropdown-logout {
  color: #dc2626;
}

.profile-dropdown-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

.profile-dropdown-logout svg {
  color: #dc2626;
}

/* Navigation Sections */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-list li {
  width: 100%;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  transition: all 0.2s var(--ease);
  position: relative;
  border: 1px solid transparent;
  width: 100%;
  box-sizing: border-box;
  min-height: 60px;
  cursor: pointer;
  user-select: none;
}

/* Skrýt URL při hover na odkazy */
a[href]:hover {
  pointer-events: auto;
}

.nav-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: var(--accent);
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: var(--accent);
  border-color: #c7d2fe;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 28px;
  height: 28px;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none;
}

/* Hover effects for icons */
.nav-item:hover .nav-icon svg,
.nav-item.active .nav-icon svg {
  stroke: var(--accent);
}

/* Special styling for logout */
.nav-item[href="logout.php"] {
  margin-top: 0.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.nav-item[href="logout.php"]:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.nav-item[href="logout.php"]:hover .nav-icon svg {
  stroke: #dc2626;
}

/* Legacy nav-menu support (for backward compatibility) */
.nav-menu {
  background: #f3f4f6;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.08);
  padding: 18px 16px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 320px;
}

.nav-menu-title {
  font-weight: 800;
  font-size: 1.15rem;
  color: #1f2937;
  margin-bottom: 12px;
}

.nav-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-menu-item {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06);
  padding: 16px 18px;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.08rem;
  text-decoration: none;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
  position: relative;
}

.nav-menu-item:hover {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- 15) Legacy Layout Support ---------- */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
aside.nav {
  background: #0f172a14;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 0.75rem;
}
.nav .nav-title {
  font-weight: 800;
  margin: 0.25rem 0.5rem 0.5rem;
}
.nav a {
  display: block;
  margin: 0.35rem 0.25rem;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  text-decoration: none;
}
.nav a:hover {
  background: #eef2ff;
  color: #1d4ed8;
  text-decoration: none;
}

/* ---------- 16) Malé komponenty / tabs ---------- */
.tabs{display:flex;gap:8px;margin:12px 0}
.tabs a{padding:8px 12px;border:1px solid #e5e7eb;border-radius:10px;text-decoration:none}
.tabs a.active{background:var(--accent);color:#fff;border-color:var(--accent)}

/* ---------- 17) Device meta badges (poslední hodnoty) ---------- */
.device-meta{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:8px 0}
.meta-badge{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:#eef2ff;box-shadow:0 2px 8px rgba(17,24,39,.06);font-weight:600;font-size:12px}
.meta-badge svg{width:16px;height:16px}
.meta-badge.ok{color:#0f766e;background:#ecfdf5}
.meta-badge.warn{color:#92400e;background:#fffbeb}
.meta-badge.err{color:#991b1b;background:#fef2f2}
.meta-badge .val{opacity:.9;font-weight:700}
.meta-badge .unit{opacity:.7;margin-left:2px}

/* ---------- 18) Footer ---------- */
.footer{margin:40px auto 20px;text-align:center;color:#93a0b3;font-weight:600}

/* Site Footer - Modern & Beautiful */
.site-footer {
  margin-top: auto;
  padding: 2rem 0;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-left {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-left strong {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 767px) {
  .site-footer {
    padding: 1.5rem 0;
  }
  
  .footer-inner {
    flex-direction: column;
    text-align: center;
    padding: 0 1rem;
  }
  
  .footer-left {
    font-size: 0.85rem;
  }
}

/* ---------- 19) Animace ---------- */
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@keyframes underlineIn{from{transform:scaleX(0);opacity:.2}to{transform:scaleX(1);opacity:1}}

/* ---------- 20) Print / reduced motion ---------- */
@media print{
  body{background:#fff;padding:0}
  body > p:first-of-type{position:static;box-shadow:none;border:0;background:#fff}
  a{color:#000;text-decoration:underline}
  li,h2{box-shadow:none}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none !important;transition:none !important}
}


/* === Formuláře === */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: .3rem;
  color: #1f2937; /* tmavě šedá */
}

.form-group input {
  padding: .6rem .8rem;
  border: 1px solid #d1d5db;
  border-radius: .5rem;
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus {
  outline: none;
  border-color: #2563eb; /* modrá */
  box-shadow: 0 0 0 3px rgba(37,99,235,0.3);
}

.form-actions {
  text-align: right;
}

.btn-primary {
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  border: none;
  padding: .7rem 1.2rem;
  border-radius: .6rem;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn-primary:hover {
  background: linear-gradient(135deg,#1d4ed8,#1e40af);
}

.btn-primary:active {
  transform: scale(.97);
}

/* === Karty pro formuláře === */
.card {
  padding: 1.5rem;
  background: #fff;
  border-radius: .8rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}


      .command-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 12px;
            margin: 20px 0;
        }
        .command-button {
            padding: 10px 16px;
            background: var(--primary-color, #1a56db);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            font-size: 14px;
            line-height: 1.4;
            text-align: center;
            transition: background-color 0.2s;
        }
        .command-button:hover {
            background: var(--primary-dark, #1e429f);
        }
        .result-area {
            margin-top: 20px;
            padding: 16px;
            background: var(--card-bg, #fff);
            border: 1px solid var(--border-color, #e5e7eb);
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .result-area pre {
            background: var(--pre-bg, #f3f4f6);
            padding: 12px;
            border-radius: 6px;
            border: 1px solid var(--border-color, #e5e7eb);
            overflow-x: auto;
            font-family: monospace;
            font-size: 13px;
            line-height: 1.5;
        }
        .result-area h3 {
            margin: 0 0 16px 0;
            font-size: 18px;
            font-weight: 600;
            color: var(--heading-color, #111827);
        }
        .result-area h4 {
            margin: 16px 0 8px 0;
            font-size: 16px;
            font-weight: 600;
            color: var(--heading-color, #111827);
        }
        .text-success {
            color: var(--success-color, #059669);
            font-weight: 600;
        }
        .text-danger {
            color: var(--danger-color, #dc2626);
            font-weight: 600;
        }
        .muted {
            color: var(--muted-color, #6b7280);
            font-size: 0.9em;
        }

/* ==========================================================================
   Downlink Commands - Moved from downlink.php
   ========================================================================== */
.command-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.btn-command {
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-restart { 
    background: #e74c3c; 
    color: white; 
}
.btn-restart:hover { 
    background: #c0392b; 
}

.btn-status { 
    background: #3498db; 
    color: white; 
}
.btn-status:hover { 
    background: #2980b9; 
}

.btn-config { 
    background: #f39c12; 
    color: white; 
}
.btn-config:hover { 
    background: #e67e22; 
}

.btn-reset { 
    background: #9b59b6; 
    color: white; 
}
.btn-reset:hover { 
    background: #8e44ad; 
}

.pending-command {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.command-status {
    font-weight: bold;
    color: #856404;
}

/* Historie příkazů */
.commands-history {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.commands-history h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.command-item {
    transition: transform 0.2s;
}

.command-item:hover {
    transform: translateX(5px);
}

.status-completed {
    background: #d4edda !important;
    border-color: #c3e6cb !important;
}

.status-pending {
    background: #fff3cd !important;
    border-color: #ffeaa7 !important;
}

/* ==========================================================================
   Utility Classes - Moved from inline styles
   ========================================================================== */

/* Page Headers */
.page-header {
    margin: 0;
}

/* Card Layout Utilities */
.card-main {
    margin-top: 32px;
    max-width: 520px;
}

.card-wide {
    margin-top: 32px;
    max-width: 600px;
}

.card-form {
    margin-top: 32px;
    max-width: 480px;
}

.card-narrow {
    margin-top: 24px;
    max-width: 680px;
}

/* Success/Info Messages */
.success-message {
    padding: 15px;
    margin: 15px 0;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
}

/* Section Spacing */
.section-top {
    margin-top: 20px;
}

.section-top-large {
    margin-top: 30px;
}

/* Table Reset */
.table-reset {
    margin: 0;
}

/* Form Spacing */
.form-top {
    margin-top: 10px;
}

/* Container Responsive */
.container-auth {
    max-width: 520px;
    margin-top: 40px;
}

/* Text Lists */
.password-requirements {
    margin: 0 0 0 18px;
}

/* Navigation Topbar */
.topbar-style {
    padding: 0.6rem 1rem;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

/* ==========================================================================
   Modern Page Layout System - Dashboard with Sidebar
   ========================================================================== */

/* Dashboard Layout Container */
.dashboard-layout {
  display: flex;
  flex-direction: row;
  gap: 0;
  max-width: 100%;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  align-items: flex-start;
}

/* Modern page body class */
.modern-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
  gap: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* Page Header Section */
.page-header-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding: 1.5rem 2rem 0;
  max-width: 100%;
  box-sizing: border-box;
}

.page-header-content h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0;
  font-weight: 500;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}

.btn-back:hover {
  background: #f8fafc;
  border-color: var(--accent-2);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Content Card */
.content-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  padding: 2rem;
  margin: 1rem 2rem 2rem;
}

/* UID Cell */
.uid-cell {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  color: var(--muted);
  background: #f8fafc;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

/* ==========================================================================
   Modern Dashboard Styling - Sensor Cards
   ========================================================================== */

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  padding: 0;
}

/* Better fullscreen utilization */
@media (min-height: 900px) {
  .dashboard-header {
    margin-bottom: 3rem;
  }
  
  .devices-grid {
    gap: 2.5rem;
  }
}

@media (min-height: 1200px) {
  .dashboard-layout {
    padding: 2rem;
  }
  
  .dashboard-header {
    margin-bottom: 3.5rem;
  }
  
  .devices-grid {
    gap: 3rem;
  }
}

.dashboard-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}

.dashboard-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0.5rem 0 0 0;
  font-weight: 500;
}

.dashboard-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-add-device, .btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.btn-add-device {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-add-device:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-filter {
  background: white;
  color: var(--ink);
  border: 2px solid #e2e8f0;
}

.btn-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f8fafc;
}

.btn-filter.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-refresh {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-refresh:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-refresh:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-refresh svg {
  transition: transform 0.3s ease;
}

.btn-refresh:hover svg {
  transform: rotate(180deg);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  background: white;
  color: var(--ink);
}

.btn-back:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f8fafc;
}

/* View Toggle Buttons */
.view-toggle {
  display: flex;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-view-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border-right: 1px solid var(--line);
  min-width: 44px;
  white-space: nowrap;
}

.btn-view-toggle:last-child {
  border-right: none;
}

.btn-view-toggle:hover {
  background: #f8fafc;
  color: var(--ink);
}

.btn-view-toggle.active {
  background: var(--accent);
  color: white;
}

.btn-view-toggle.active:hover {
  background: var(--accent-2);
}

/* Hide toggle text on mobile, keep icons */
@media (max-width: 767px) {
  .btn-view-toggle {
    padding: 0.75rem;
    min-width: 44px;
  }
}

/* Devices Grid - Fully responsive with better fullscreen utilization */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Dynamic grid based on available space - More columns for wider screens */
@media (min-width: 1800px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2.5rem;
  }
}

@media (max-width: 1799px) and (min-width: 1400px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
  }
}

@media (max-width: 1399px) and (min-width: 1200px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.75rem;
  }
}

@media (max-width: 1199px) and (min-width: 900px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 899px) and (min-width: 600px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
  }
}

@media (max-width: 599px) {
  .devices-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: white;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--line);
  min-height: 400px;
}

.empty-icon {
  margin-bottom: 1.5rem;
  color: var(--muted);
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* Sensor Cards */
.sensor-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: auto;
  display: flex;
  flex-direction: column;
}

/* Scale up cards on larger screens */
@media (min-width: 1600px) {
  .sensor-card {
    padding: 1.75rem;
    min-height: auto;
  }
  
  .sensor-name {
    font-size: 1.2rem;
  }
  
  .reading-value {
    font-size: 1.6rem;
  }
  
  .sensor-icon {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 2000px) {
  .sensor-card {
    padding: 2rem;
    min-height: auto;
  }
  
  .sensor-name {
    font-size: 1.3rem;
  }
  
  .reading-value {
    font-size: 1.8rem;
  }
  
  .sensor-icon {
    width: 52px;
    height: 52px;
  }
}

.sensor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--muted);
  transition: background 0.3s var(--ease);
}

.sensor-card.sensor-temperature::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.sensor-card.sensor-humidity::before {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}

.sensor-card.sensor-water::before {
  background: linear-gradient(90deg, #0ea5e9, #0284c7);
}

.sensor-card.sensor-multisensor::before {
  background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.sensor-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Sensor Header */
.sensor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.sensor-icon-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sensor-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.sensor-type-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.sensor-card.sensor-temperature .sensor-icon {
  background: linear-gradient(135deg, #fee2e2, #fef3f2);
  color: #dc2626;
  border-color: #fecaca;
}

.sensor-card.sensor-humidity .sensor-icon {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  color: #2563eb;
  border-color: #bfdbfe;
}

.sensor-card.sensor-water .sensor-icon {
  background: linear-gradient(135deg, #e0f2fe, #cffafe);
  color: #0284c7;
  border-color: #7dd3fc;
}

.sensor-card.sensor-multisensor .sensor-icon {
  background: linear-gradient(135deg, #ede9fe, #f3e8ff);
  color: #7c3aed;
  border-color: #c4b5fd;
}

/* Sensor Status */
.sensor-status {
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sensor-status.status-online {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.sensor-status.status-offline {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.sensor-status.status-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Sensor Info */
.sensor-info {
  margin-bottom: 1.5rem;
}

.sensor-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}

.sensor-id {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Sensor Readings */
.sensor-readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.reading-item {
  text-align: center;
}

.reading-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.reading-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

/* Sensor Meta */
.sensor-meta {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.meta-label {
  color: var(--muted);
  font-weight: 500;
}

.meta-value {
  color: var(--ink);
  font-weight: 600;
}

/* Sensor Actions */
.sensor-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto; /* Push actions to bottom of card */
}

.btn-action {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-action.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-action.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}

.btn-action.btn-secondary {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-action.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--accent-2);
}

.btn-action.btn-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-action.btn-icon:hover {
  background: #f8fafc;
  color: var(--accent);
  border-color: var(--accent-2);
}

.btn-action.btn-edit-todo {
  flex: 0 1 auto;
  background: #f8fafc;
  color: var(--ink);
  border: 1px solid #e2e8f0;
  gap: 0.4rem;
}

.btn-action.btn-edit-todo:hover {
  background: #eff6ff;
  color: var(--accent);
  border-color: var(--accent);
}

/* ==========================================================================
   Stats Overview - Beautiful KPI Cards
   ========================================================================== */

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-filter-card {
  cursor: pointer;
  user-select: none;
}

.stat-filter-card:active {
  transform: scale(0.98);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--muted);
}

.stat-card.stat-primary::before {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.stat-card.stat-success::before {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.stat-card.stat-warning::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.stat-card.stat-danger::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0, 0, 0, 0.1);
}

.stat-card.stat-active {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-width: 2px;
}

.stat-card.stat-active.stat-primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
}

.stat-card.stat-active.stat-success {
  border-color: #16a34a;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.stat-card.stat-active.stat-warning {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.stat-card.stat-active.stat-danger {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card.stat-primary .stat-icon {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  color: var(--accent);
}

.stat-card.stat-success .stat-icon {
  background: linear-gradient(135deg, #dcfce7, #d1fae5);
  color: #16a34a;
}

.stat-card.stat-warning .stat-icon {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
}

.stat-card.stat-danger .stat-icon {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Stats responsive */
@media (max-width: 1199px) {
  .stats-overview {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
  }
  
  .stat-card {
    padding: 1.5rem;
  }
  
  .stat-icon {
    width: 52px;
    height: 52px;
  }
  
  .stat-value {
    font-size: 2.25rem;
  }
}

@media (max-width: 767px) {
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1.25rem;
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .stat-icon {
    width: 48px;
    height: 48px;
  }
  
  .stat-value {
    font-size: 2rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .stats-overview {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    flex-direction: row;
    text-align: left;
    padding: 1rem;
  }
  
  .stat-icon {
    width: 44px;
    height: 44px;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }
}

/* ==========================================================================
   Search Box Component
   ========================================================================== */

.search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease);
  min-width: 220px;
}

.search-box:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box svg {
  color: var(--muted);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 500;
}

.search-box input::placeholder {
  color: var(--muted);
}

@media (max-width: 767px) {
  .search-box {
    width: 100%;
    order: 3;
  }
}

/* ==========================================================================
   Dashboard Header Improvements
   ========================================================================== */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.dashboard-header-left {
  flex: 1;
}

.dashboard-header-left h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--ink), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dashboard-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0.5rem 0 0 0;
  font-weight: 500;
}

.dashboard-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Filter Badge */
.filter-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 5px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.btn-filter {
  position: relative;
}

/* Enhanced button styles */
.btn-add-device, .btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}

.btn-add-device {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-add-device:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
  text-decoration: none;
}

.btn-filter {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-filter:hover {
  background: #f8fafc;
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

@media (max-width: 1199px) {
  .dashboard-header {
    gap: 1.5rem;
  }
  
  .dashboard-header-left h1 {
    font-size: 2.25rem;
  }
  
  .dashboard-subtitle {
    font-size: 1rem;
  }
}

@media (max-width: 767px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  
  .dashboard-header-left h1 {
    font-size: 2rem;
  }
  
  .dashboard-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Enhanced Filter Panel
   ========================================================================== */

.filter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: none;
}

.filter-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  animation: slideInRight 0.3s var(--ease);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.filter-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-close-filter {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.btn-close-filter:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

.filter-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.filter-section {
  margin-bottom: 2rem;
}

.filter-section h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 1rem 0;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}

.filter-checkbox:hover {
  background: #f8fafc;
  border-color: var(--line);
}

.filter-checkbox input[type="checkbox"] {
  display: none;
}

.filter-checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-radius: 6px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s var(--ease);
  background: white;
}

.filter-checkbox input:checked + .filter-checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}

.filter-checkbox input:checked + .filter-checkbox-custom::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
}

.filter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-dot.status-online {
  background: #16a34a;
}

.filter-dot.status-offline {
  background: #6b7280;
}

.filter-dot.status-warning {
  background: #f59e0b;
}

.filter-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  background: #f8fafc;
}

.btn-clear-filters {
  flex: 1;
  padding: 0.75rem;
  background: white;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-clear-filters:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-apply-filters {
  flex: 1;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-apply-filters:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Empty state for search */
.search-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.search-empty-state .empty-icon {
  margin-bottom: 1rem;
  color: var(--muted);
  opacity: 0.6;
}

.search-empty-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.search-empty-state p {
  color: var(--muted);
  font-size: 1rem;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .filter-panel {
    width: 100vw;
    max-width: 100vw;
  }
  
  .filter-header {
    padding: 1.25rem 1.5rem;
  }
  
  .filter-content {
    padding: 1.5rem;
  }
  
  .filter-footer {
    padding: 1rem 1.5rem;
    flex-direction: column;
  }
}

.filter-content {
  padding: 2rem;
  height: 100%;
  overflow-y: auto;
}

.filter-content h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.filter-content h4 {
  margin: 1.5rem 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.filter-options, .filter-types {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-options label, .filter-types label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.2s var(--ease);
}

.filter-options label:hover, .filter-types label:hover {
  background: #f8fafc;
}

.filter-options input, .filter-types input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.btn-clear-filters {
  margin-top: 2rem;
  width: 100%;
  padding: 0.75rem;
  background: #f3f4f6;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-clear-filters:hover {
  background: #e5e7eb;
  border-color: var(--accent-2);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ==========================================================================
   Table View Styling
   ========================================================================== */

.devices-table-container {
  width: 100%;
  margin-top: 1rem;
}

.table-wrapper {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.devices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.devices-table thead {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--line);
}

.devices-table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-right: 1px solid #e2e8f0;
  position: relative;
}

.devices-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.devices-table th.sortable:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
}

.devices-table th.sortable .sort-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  opacity: 0.3;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.devices-table th.sortable:hover .sort-icon {
  opacity: 0.6;
}

.devices-table th.sortable.sort-asc .sort-icon,
.devices-table th.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: var(--accent);
}

.devices-table th.sortable.sort-asc .sort-icon svg {
  transform: rotate(180deg);
}

.devices-table th.sortable.sort-desc .sort-icon svg {
  transform: rotate(0deg);
}

/* Sortable detail tables (graph-embedded tables) */
.sortable-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.sortable-table th.sortable:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
}

.sortable-table th.sortable .sort-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  opacity: 0.3;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.sortable-table th.sortable .sort-icon svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.sortable-table th.sortable:hover .sort-icon {
  opacity: 0.6;
}

.sortable-table th.sortable.sort-asc .sort-icon,
.sortable-table th.sortable.sort-desc .sort-icon {
  opacity: 1;
  color: var(--accent);
}

.sortable-table th.sortable.sort-asc .sort-icon svg {
  transform: rotate(180deg);
}

.sortable-table th.sortable.sort-desc .sort-icon svg {
  transform: rotate(0deg);
}

.devices-table th:last-child {
  border-right: none;
}

.devices-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.devices-table tbody tr:hover {
  background: #f8fafc;
}

.devices-table tbody tr.clickable-row:hover {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.devices-table tbody tr.clickable-row {
  transition: all 0.2s ease;
}

.devices-table tbody tr:last-child td {
  border-bottom: none;
}

/* Device Info Cell */
.device-info {
  min-width: 200px;
}

/* Fix: Name column misalignment
   The td.device-name-cell was set to display:flex, which made the cell height
   shrink to content and the row divider appeared higher than other cells.
   Revert the td back to table-cell behavior for consistent vertical alignment. */
table.devices-table td.device-name-cell {
  display: table-cell;
  vertical-align: middle;
}
table.devices-table td.device-name-cell > * {
  display: inline;
}

.device-name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.device-icon-small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.table-row.sensor-temperature .device-icon-small {
  background: linear-gradient(135deg, #fee2e2, #fef3f2);
  color: #dc2626;
  border-color: #fecaca;
}

.table-row.sensor-humidity .device-icon-small {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  color: #2563eb;
  border-color: #bfdbfe;
}

.table-row.sensor-water .device-icon-small {
  background: linear-gradient(135deg, #e0f2fe, #cffafe);
  color: #0284c7;
  border-color: #7dd3fc;
}

.table-row.sensor-multisensor .device-icon-small {
  background: linear-gradient(135deg, #ede9fe, #f3e8ff);
  color: #7c3aed;
  border-color: #c4b5fd;
}

.device-name {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.device-id {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.status-online {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-badge.status-offline {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.status-badge.status-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Type Badge */
.type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--ink);
  border: 1px solid #e2e8f0;
}

.type-badge.type-temperature {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.type-badge.type-humidity {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.type-badge.type-water {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #7dd3fc;
}

.type-badge.type-multisensor {
  background: #faf5ff;
  color: #7c3aed;
  border-color: #c4b5fd;
}

/* Role badges */
.type-badge.role-superadmin {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border-color: #fbbf24;
  font-weight: 700;
}

.type-badge.role-admin {
  background: #eff6ff;
  color: #1e40af;
  border-color: #93c5fd;
  font-weight: 600;
}

.type-badge.role-subadmin {
  background: #f0fdfa;
  color: #0f766e;
  border-color: #5eead4;
}

.type-badge.role-customer {
  background: #f5f5f5;
  color: #525252;
  border-color: #d4d4d4;
}

/* User avatar icon */
.user-avatar {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e40af;
}

/* Temperature Cell */
.temp-cell {
  font-weight: 600;
  color: var(--ink);
}

/* Battery Cell */
.battery-cell {
  min-width: 80px;
}

.battery-indicator {
  display: flex;
  align-items: center;
}

.battery-value {
  font-weight: 600;
  color: #16a34a;
}

.battery-value.low {
  color: #dc2626;
}

/* Signal Cell */
.signal-cell {
  font-weight: 500;
  color: var(--muted);
}

/* Actions Cell */
.actions-cell {
  min-width: 120px;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-table-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.btn-table-action:hover {
  background: #f8fafc;
  border-color: var(--accent-2);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-table-action.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-table-action.btn-primary:hover {
  background: var(--accent-2);
}

.btn-table-action.btn-secondary {
  background: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.btn-table-action.btn-secondary:hover {
  background: #d97706;
}

.btn-table-action.btn-edit {
  background: white;
  color: var(--muted);
  border-color: var(--line);
}

.btn-table-action.btn-edit:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #3b82f6;
}

.btn-table-action.btn-delete {
  background: white;
  color: var(--muted);
  border-color: var(--line);
}

.btn-table-action.btn-delete:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
}

.btn-table-action.btn-invite {
  background: white;
  color: var(--muted);
  border-color: var(--line);
}

.btn-table-action.btn-invite:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #3b82f6;
}

.btn-table-action.btn-todo {
  background: white;
  color: var(--muted);
  border-color: var(--line);
}

.btn-table-action.btn-todo:hover {
  background: #fef7ff;
  border-color: #9333ea;
  color: #9333ea;
}

/* Table Responsive Design */
@media (max-width: 1200px) {
  .devices-table {
    font-size: 0.85rem;
  }
  
  .devices-table th,
  .devices-table td {
    padding: 0.75rem 1rem;
  }
  
  .device-name-cell {
    gap: 0.5rem;
  }
  
  .device-icon-small {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 900px) {
  .table-wrapper {
    overflow-x: auto;
  }
  
  .devices-table {
    min-width: 800px;
  }
}

@media (max-width: 699px) {
  .view-toggle {
    order: -1;
    width: 100%;
  }
  
  .btn-view-toggle {
    flex: 1;
    justify-content: center;
  }
  
  .devices-table {
    min-width: 700px;
    font-size: 0.8rem;
  }
  
  .devices-table th,
  .devices-table td {
    padding: 0.5rem 0.75rem;
  }
  
  .device-name-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .device-icon-small {
    width: 24px;
    height: 24px;
  }
  
  .table-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .btn-table-action {
    width: 28px;
    height: 28px;
  }
}

/* Responsive Design - Improved breakpoints for better window resizing */

/* Smooth transitions for all responsive changes */
.dashboard-layout,
.devices-grid,
.modern-sidebar,
.dashboard-header {
  transition: all 0.3s ease;
}

/* Ultra Wide Desktop (2000px+) */
@media (min-width: 2000px) {
  .dashboard-layout {
    padding: 2rem 4rem;
    gap: 4rem;
  }
  
  .modern-sidebar {
    width: 320px;
    min-width: 320px;
    padding: 2.5rem;
  }
}

/* Extra Large Desktop (1600px - 1999px) */
@media (max-width: 1999px) and (min-width: 1600px) {
  .dashboard-layout {
    padding: 2rem 3rem;
    gap: 3.5rem;
  }
  
  .modern-sidebar {
    width: 300px;
    min-width: 300px;
    padding: 2rem;
  }
}

/* Large Desktop (1200px - 1599px) */
@media (max-width: 1599px) and (min-width: 1200px) {
  .dashboard-layout {
    padding: 1.75rem 2.5rem;
    gap: 2.5rem;
  }
  
  .modern-sidebar {
    width: 280px;
    min-width: 280px;
    padding: 1.75rem;
  }
}

/* Medium Desktop (900px - 1199px) */
@media (max-width: 1199px) and (min-width: 900px) {
  .dashboard-layout {
    padding: 1.5rem 1.5rem;
    gap: 2rem;
  }
  
  .modern-sidebar {
    width: 260px;
    min-width: 260px;
    padding: 1.25rem;
  }
}

/* Tablet and Small Desktop (700px - 899px) */
@media (max-width: 899px) and (min-width: 700px) {
  .dashboard-layout {
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }
  
  .modern-sidebar {
    width: 100%;
    min-width: unset;
    position: relative;
    top: 0;
    max-height: none;
    overflow-y: visible;
    order: 2;
  }
  
  .main-content {
    order: 1;
  }
  
  .dashboard-header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .dashboard-actions {
    flex: 1;
    justify-content: flex-end;
    min-width: fit-content;
  }
}

/* Mobile Landscape and Portrait (up to 699px) */
@media (max-width: 699px) {
  .dashboard-layout {
    flex-direction: column;
    padding: 1rem 0.75rem;
    gap: 1rem;
  }
  
  .modern-sidebar {
    width: 100%;
    min-width: unset;
    position: relative;
    top: 0;
    max-height: none;
    overflow-y: visible;
    order: 2;
    padding: 1rem;
    border-radius: 12px;
  }
  
  .main-content {
    order: 1;
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .dashboard-header h1 {
    font-size: 2rem;
  }
  
  .dashboard-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .btn-add-device,
  .btn-filter {
    flex: 1;
    min-width: 140px;
    justify-content: center;
  }
  
  .sensor-card {
    padding: 1.25rem;
  }
  
  .sensor-readings {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }
  
  .sensor-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn-action {
    width: 100%;
  }
  
  .filter-panel {
    width: 100%;
    right: 0;
  }
  
  /* Sidebar mobile adjustments */
  .sidebar-profile {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .profile-avatar {
    width: 40px;
    height: 40px;
  }
  
  .profile-name {
    font-size: 0.95rem;
  }
  
  .profile-role {
    font-size: 0.8rem;
  }
  
  .sidebar-nav {
    gap: 0.75rem;
  }
  
  .nav-section {
    gap: 0.25rem;
  }
  
  .nav-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .nav-section-title {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
  }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
  .dashboard-layout {
    padding: 0.75rem 0.5rem;
    gap: 0.75rem;
  }
  
  .dashboard-header h1 {
    font-size: 1.75rem;
  }
  
  .dashboard-subtitle {
    font-size: 1rem;
  }
  
  .btn-add-device, .btn-filter {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    min-width: 120px;
  }
  
  .sensor-card {
    padding: 1rem;
  }
  
  .sensor-name {
    font-size: 1.1rem;
  }
  
  .reading-value {
    font-size: 1.25rem;
  }
  
  .modern-sidebar {
    padding: 0.75rem;
  }
  
  .sidebar-profile {
    padding: 0.5rem;
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  
  .profile-avatar {
    width: 36px;
    height: 36px;
    align-self: center;
  }
}

/* Handle very narrow windows (common when resizing browser) */
@media (max-width: 350px) {
  .dashboard-layout {
    padding: 0.5rem 0.25rem;
  }
  
  .dashboard-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-add-device, .btn-filter {
    width: 100%;
    min-width: unset;
  }
  
  .sensor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .sensor-status {
    align-self: flex-end;
  }
}

/* Page Header Responsive Design */
@media (max-width: 1199px) {
  .page-header-section {
    padding: 1rem 1.5rem 0;
  }
}

@media (max-width: 767px) {
  .page-header-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1rem 0;
  }
  
  .page-header-content h1 {
    font-size: 1.8rem;
  }
  
  .page-subtitle {
    font-size: 1rem;
  }
  
  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  .btn-back,
  .btn-add-device {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .page-header-section {
    padding: 0.75rem 0.75rem 0;
  }
  
  .page-header-content h1 {
    font-size: 1.6rem;
  }
  
  .page-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn-back,
  .btn-add-device {
    width: 100%;
    flex: none;
  }
  
  .content-card {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .dashboard-header h1 {
    font-size: 2rem;
  }
  
  .sensor-card {
    padding: 1.25rem;
  }
  
  .sensor-name {
    font-size: 1.2rem;
  }
  
  .reading-value {
    font-size: 1.3rem;
  }
}

/* ==========================================================================
   Enhanced Downlink Commands Styling
   ========================================================================== */

/* Installation and Uninstall buttons */
.btn-install {
    background: #27ae60 !important;
    color: white !important;
    grid-column: 1 / -1; /* Full width */
}
.btn-install:hover {
    background: #2ecc71 !important;
}

.btn-uninstall {
    background: #e74c3c !important;
    color: white !important;
    grid-column: 1 / -1; /* Full width */
}
.btn-uninstall:hover {
    background: #c0392b !important;
}

.btn-monitor {
    background: #3498db !important;
    color: white !important;
}
.btn-monitor:hover {
    background: #2980b9 !important;
}

/* Monitoring commands layout */
.monitoring-commands {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.command-form-inline {
    margin: 0;
}

.command-with-input {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.command-with-input .btn-command {
    flex: 1;
    min-width: 200px;
}

.hex-input {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    text-align: center;
    background: white;
}

.hex-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.hex-input::placeholder {
    color: #95a5a6;
}

/* Styling pro number input */
.hex-input[type="number"] {
    appearance: textfield; /* Standard */
    -moz-appearance: textfield; /* Firefox */
}

.hex-input[type="number"]::-webkit-outer-spin-button,
.hex-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Success and warning messages */
.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .command-with-input {
        flex-direction: column;
        align-items: stretch;
    }
    
    .command-with-input .btn-command {
        min-width: unset;
    }
    
    .hex-input {
        width: 100%;
        max-width: 120px;
        align-self: center;
    }
    
    .monitoring-commands {
        gap: 20px;
    }
}

/* User role badges */
.role-superadmin {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: white;
  font-weight: 600;
}

.role-admin {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-weight: 600;
}

.role-subadmin {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: white;
  font-weight: 600;
}

.role-customer {
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  color: white;
  font-weight: 600;
}

/* User avatar */
.user-avatar {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

/* Email cell styling */
.email-cell {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Modern form styling */
.form-container {
  padding: 32px;
}

.modern-form {
  max-width: 800px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.required {
  color: #ef4444;
  font-weight: 700;
}

.form-input,
.form-select {
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.error-alert {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.success-alert {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

@container (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-container {
    padding: 20px;
  }
  
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Device info cards */
.device-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.info-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.info-card:hover {
  border-color: var(--line-hover);
  background: var(--surface-3);
}

.info-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.info-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.info-value.primary {
  color: var(--primary);
  font-size: 18px;
}

.info-value.monospace {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 14px;
}

@container (max-width: 700px) {
  .device-info-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }
  
  .info-card {
    padding: 16px;
  }
}

/* ==========================================================================
   Mobile Responsive Design for Users List and Dashboard
   ========================================================================== */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
  .dashboard-layout {
    padding: 1.5rem 1rem;
  }
  
  .search-section {
    flex-direction: column;
    gap: 1rem;
  }
  
  .search-box {
    width: 100%;
  }
  
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Landscape and Small Tablets (481px - 767px) */
@media (max-width: 767px) {
  .dashboard-layout {
    padding: 1rem 0.75rem;
  }
  
  .page-header h1 {
    font-size: 1.75rem;
  }
  
  .dashboard-subtitle {
    font-size: 0.95rem;
  }
  
  .search-section {
    margin-bottom: 1.25rem;
  }
  
  .search-box input {
    font-size: 0.95rem;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
  }
  
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
    margin-bottom: 1.25rem;
  }
  
  .stat-card {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .stat-icon {
    width: 42px;
    height: 42px;
  }
  
  .stat-value {
    font-size: 1.875rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
  
  /* Table responsive */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .devices-table {
    min-width: 700px;
    font-size: 0.85rem;
  }
  
  .devices-table th,
  .devices-table td {
    padding: 0.75rem 0.875rem;
  }
  
  .device-name-cell {
    gap: 0.625rem;
  }
  
  .device-icon-small {
    width: 32px;
    height: 32px;
  }
  
  .device-name {
    font-size: 0.95rem;
  }
  
  .device-id {
    font-size: 0.75rem;
  }
  
  .status-badge,
  .type-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
  }
  
  .action-buttons {
    gap: 0.375rem;
  }
  
  .btn-table-action {
    width: 30px;
    height: 30px;
  }
  
  .btn-table-action svg {
    width: 15px;
    height: 15px;
  }
}

/* Mobile Portrait (320px - 480px) */
@media (max-width: 480px) {
  .dashboard-layout {
    padding: 0.75rem 0.5rem;
    gap: 0.75rem;
  }
  
  .page-header {
    padding: 0.875rem;
    margin-bottom: 0.875rem;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
  }
  
  .dashboard-subtitle {
    font-size: 0.875rem;
  }
  
  .search-section {
    margin-bottom: 1rem;
  }
  
  .search-box {
    margin-bottom: 0.5rem;
  }
  
  .search-box input {
    font-size: 0.9rem;
    padding: 0.7rem 0.875rem 0.7rem 2.5rem;
  }
  
  .search-box svg {
    width: 16px;
    height: 16px;
    left: 0.875rem;
  }
  
  #searchCount {
    font-size: 0.8rem;
  }
  
  /* Stats - Single column on very small screens */
  .stats-overview {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .stat-card {
    padding: 0.875rem;
    flex-direction: row;
    text-align: left;
    gap: 0.875rem;
  }
  
  .stat-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  
  .stat-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .stat-content {
    flex: 1;
  }
  
  .stat-value {
    font-size: 1.75rem;
    margin-bottom: 0.125rem;
  }
  
  .stat-label {
    font-size: 0.75rem;
  }
  
  /* Table responsive for small screens */
  .devices-table-section {
    margin: 0 -0.5rem;
  }
  
  .table-wrapper {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .devices-table {
    min-width: 650px;
    font-size: 0.8rem;
  }
  
  .devices-table th,
  .devices-table td {
    padding: 0.625rem 0.75rem;
  }
  
  .devices-table th {
    font-size: 0.75rem;
    white-space: nowrap;
  }
  
  .device-name-cell {
    gap: 0.5rem;
  }
  
  .device-icon-small {
    width: 28px;
    height: 28px;
  }
  
  .device-icon-small svg {
    width: 14px;
    height: 14px;
  }
  
  .device-name {
    font-size: 0.875rem;
  }
  
  .device-id {
    font-size: 0.7rem;
  }
  
  .email-cell {
    font-size: 0.8rem;
  }
  
  .status-badge,
  .type-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }
  
  .role-badge {
    font-size: 0.7rem;
  }
  
  .action-buttons {
    gap: 0.25rem;
  }
  
  .btn-table-action {
    width: 28px;
    height: 28px;
  }
  
  .btn-table-action svg {
    width: 14px;
    height: 14px;
  }
  
  /* Sidebar toggle button */
  .sidebar-toggle {
    width: 36px;
    height: 36px;
  }
  
  .sidebar-toggle svg {
    width: 18px;
    height: 18px;
  }
}

/* Extra Small Screens (320px and below) */
@media (max-width: 360px) {
  .dashboard-layout {
    padding: 0.625rem 0.375rem;
  }
  
  .page-header h1 {
    font-size: 1.375rem;
  }
  
  .stats-overview {
    gap: 0.625rem;
  }
  
  .stat-card {
    padding: 0.75rem;
    gap: 0.75rem;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
  
  .devices-table {
    min-width: 600px;
  }
  
  .btn-table-action {
    width: 26px;
    height: 26px;
  }
  
  .btn-table-action svg {
    width: 13px;
    height: 13px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Increase tap targets for better touch interaction */
  .stat-filter-card {
    min-height: 48px;
  }
  
  .btn-table-action {
    min-width: 44px;
    min-height: 44px;
  }
  
  .devices-table th.sortable {
    min-height: 44px;
  }
  
  /* Better touch scrolling */
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Disable hover effects on touch devices */
  .stat-card:hover,
  .devices-table tr:hover {
    transform: none;
  }
}

/* Landscape orientation adjustments for phones */
@media (max-width: 767px) and (orientation: landscape) {
  .stats-overview {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
  }
  
  .stat-card {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem;
  }
  
  .stat-icon {
    width: 36px;
    height: 36px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
}

/* Custom scrollbar for table on mobile */
@media (max-width: 767px) {
  .table-wrapper::-webkit-scrollbar {
    height: 6px;
  }
  
  .table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }
  
  .table-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
  }
  
  .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
  
  /* Add scroll hint shadow */
  .table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(0,0,0,0.08), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .table-wrapper.has-scroll::after {
    opacity: 1;
  }
}

/* Print styles */
@media print {
  .sidebar-toggle,
  .modern-sidebar,
  .search-section,
  .action-buttons {
    display: none !important;
  }
  
  .dashboard-layout {
    display: block;
    padding: 0;
  }
  
  .main-content {
    max-width: 100%;
  }
  
  .table-wrapper {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .devices-table {
    font-size: 10pt;
  }
  
  .stat-card {
    break-inside: avoid;
  }
}

/* ==========================================================================
   Detail Zarizeni - Mobile Responsive
   ========================================================================== */

/* Device Info Grid - Default (Desktop) */
.device-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.info-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.info-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 16px;
  color: #0f172a;
  font-weight: 600;
  word-break: break-word;
}

.info-value.primary {
  color: #3b82f6;
  font-weight: 700;
}

.info-value.monospace {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 14px;
}

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
  .device-info-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

/* Mobile Landscape (481px - 767px) */
@media (max-width: 767px) {
  .device-info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }
  
  .info-card {
    padding: 10px;
  }
  
  .info-label {
    font-size: 10px;
    margin-bottom: 3px;
  }
  
  .info-value {
    font-size: 14px;
  }
  
  .info-value.primary {
    font-size: 15px;
  }
  
  .info-value.monospace {
    font-size: 12px;
  }
}

/* Mobile Portrait (320px - 480px) */
@media (max-width: 480px) {
  .device-info-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .info-card {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .info-label {
    font-size: 11px;
    margin-bottom: 0;
    flex: 1;
  }
  
  .info-value {
    font-size: 15px;
    text-align: right;
    flex: 1;
  }
  
  .info-value.primary {
    font-size: 16px;
  }
  
  .info-value.monospace {
    font-size: 13px;
  }
  
  /* Status badge on mobile */
  .info-value .status-badge {
    font-size: 11px;
    padding: 3px 10px;
  }
}

/* Extra Small (320px and below) */
@media (max-width: 360px) {
  .device-info-grid {
    gap: 6px;
  }
  
  .info-card {
    padding: 10px;
  }
  
  .info-label {
    font-size: 10px;
  }
  
  .info-value {
    font-size: 14px;
  }
  
  .info-value.primary {
    font-size: 15px;
  }
  
  .info-value.monospace {
    font-size: 12px;
  }
}

/* Tabs responsive for detail page */
@media (max-width: 767px) {
  .tabs {
    flex-direction: column;
    gap: 6px;
  }
  
  .tabs a {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .tabs a button {
    margin-left: 0 !important;
    margin-top: 6px;
    display: block;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .tabs {
    gap: 8px;
  }
  
  .tabs a {
    padding: 12px;
    font-size: 15px;
  }
}

/* Graph Filter Styles */
.graph-filter-card {
  padding: 20px;
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.graph-filter-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.period-buttons-group {
  display: flex;
  gap: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
}

.date-range-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.date-inputs-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.date-input-group {
  display: flex;
  flex-direction: column;
}

.date-label {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.date-input {
  padding: 8px 12px;
  background: #fff !important;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #000 !important;
  font-size: 14px;
  height: 38px;
}

.btn-submit-date {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  min-width: 80px;
}

.btn-submit-date:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-reset-date {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
  min-width: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-reset-date:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

/* Mobile Responsive for Graph Filters */
@media (max-width: 767px) {
  .graph-filter-card {
    padding: 16px;
  }
  
  .graph-filter-wrapper {
    flex-direction: column;
    gap: 16px;
  }
  
  .period-buttons-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: none;
    gap: 8px;
  }
  
  .period-buttons-group .btn-period-inline {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-align: center;
    padding: 10px;
  }
  
  .date-range-form {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }
  
  .date-inputs-wrapper {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }
  
  .date-input-group {
    width: 100%;
  }
  
  .date-input {
    width: 100%;
  }
  
  .btn-submit-date,
  .btn-reset-date {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .graph-filter-card {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .graph-filter-wrapper {
    gap: 12px;
  }
  
  .period-buttons-group {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  .period-buttons-group .btn-period-inline {
    padding: 12px 8px;
    font-size: 13px;
  }
  
  .date-label {
    font-size: 11px;
  }
  
  .date-input {
    padding: 10px;
    font-size: 13px;
    height: 42px;
  }
  
  .btn-submit-date,
  .btn-reset-date {
    padding: 12px;
    font-size: 15px;
    height: 44px;
  }
}

/* Chart Container Responsive */
.chart-container {
  width: 100%;
  height: 300px;
  position: relative;
}

@media (max-width: 1024px) {
  .chart-container {
    height: 280px;
  }
}

@media (max-width: 767px) {
  .chart-container {
    height: 260px;
  }
  
  .card {
    padding: 16px !important;
  }
  
  .card h3 {
    font-size: 16px;
  }
  
  .card .muted {
    font-size: 13px;
  }
  
  .card .muted strong {
    font-size: 15px !important;
  }
}

@media (max-width: 480px) {
  .chart-container {
    height: 240px;
  }
  
  .card {
    padding: 12px !important;
    margin-bottom: 12px !important;
  }
  
  .card h3 {
    font-size: 15px;
    margin-bottom: 8px;
  }
  
  .card .muted {
    font-size: 12px;
    line-height: 1.5;
  }
  
  .card .muted strong {
    font-size: 14px !important;
    display: inline-block;
  }
}

@media (max-width: 360px) {
  .chart-container {
    height: 220px;
  }
}

/* ==========================================================================
   UTILITY CLASSES - Extracted from inline styles
   ========================================================================== */

/* ---------- Layout Utilities ---------- */
.flex-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 16px;
  flex-wrap: wrap;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.flex-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.flex-between-20 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Info Cards ---------- */
.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}

.info-card-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 600;
}

.info-card-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.info-card-value.accent {
  color: var(--accent);
}

.info-card-value.monospace {
  font-family: monospace;
}

/* ---------- Buttons ---------- */
.btn-toggle-table {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-toggle-table:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-toggle-table:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-toggle-table::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-toggle-table:hover::before {
  left: 100%;
}

/* Period buttons styling - same size as toggle button */
.btn-period {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #374151;
  border: 1px solid #cbd5e1;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 80px;
  text-align: center;
}

.btn-period:hover {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: #1f2937;
}

.btn-period.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-period.active:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Submit and Reset buttons - same size as toggle button */
.btn-submit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  min-width: 80px;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-reset {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
  min-width: 80px;
}

.btn-reset:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
  text-decoration: none;
  color: white;
}

/* ---------- Table Utilities ---------- */
.table-scrollable {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
}

.table-inline {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-header {
  background: #f8fafc;
  position: sticky;
  top: 0;
}

.table-header th {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  color: #374151;
  font-weight: 600;
}

.table-header .th-center {
  text-align: center;
  width: 60px;
}

.table-header .th-left {
  text-align: left;
}

.table-header .th-right {
  text-align: right;
}

.table-header .th-cnt {
  text-align: center;
  width: 80px;
}

.table-row-data {
  border-bottom: 1px solid #f1f5f9;
}

.table-row-data td {
  padding: 12px 8px;
}

.td-center {
  text-align: center;
  color: #6b7280;
  font-weight: 500;
}

.td-left {
  color: #374151;
}

.td-right {
  text-align: right;
  color: #111827;
  font-weight: 600;
}

.td-mono {
  text-align: center;
  color: #111827;
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- Status Indicators ---------- */
.status-history {
  color: #10b981;
  font-size: 16px;
}

.status-original {
  color: #ef4444;
  font-size: 16px;
}

.status-history-small {
  color: #10b981;
  font-size: 12px;
  margin-left: 4px;
}

.status-original-small {
  color: #ef4444;
  font-size: 12px;
  margin-left: 4px;
}

/* ---------- Typography Utilities ---------- */
.page-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
}

.page-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.section-title {
  margin: 0 0 12px 0;
  color: #374151;
}

.section-subtitle {
  margin: 4px 0 0;
}

.debug-text {
  color: #666;
  font-size: 10px;
}

.debug-margin {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* ---------- Color Utilities ---------- */
.text-success {
  color: #10b981;
}

.text-primary {
  color: #3b82f6;
}

.text-warning {
  color: #f59e0b;
}

.text-large {
  font-size: 18px;
}

/* ---------- Spacing Utilities ---------- */
.mt-1 {
  margin-top: 1rem;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.p-24 {
  padding: 24px;
}

/* ---------- Display Utilities ---------- */
.d-none {
  display: none;
}

.fit-content {
  height: fit-content;
}

/* Debug information */
.debug-info {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* Status indicators - small variant */
.status-small {
  font-size: 12px;
}

.status-small.status-green {
  color: #10b981;
}

.status-small.status-red {
  color: #ef4444;
}

/* Margin utilities */
.ml-4 {
  margin-left: 4px;
}

.mb-16 {
  margin-bottom: 16px;
}

/* Text colors */
.text-success {
  color: #10b981;
}

.text-purple {
  color: #8b5cf6;
}

/* Text sizes */
.text-lg {
  font-size: 18px;
}

/* Text colors and weight combinations */
.td-medium {
  color: #374151;
  font-weight: 500;
}

.td-muted {
  color: #6b7280;
}

.td-weight-500 {
  font-weight: 500;
}

.td-text-small {
  color: #374151;
  font-size: 12px;
}

.status-column {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.idx-label {
  color: #a5b4fc;
  font-weight: 600;
}

.delta-value {
  font-weight: 600;
}

/* Status text indicators - subtle CALC/ORIG labels */
.status-calc {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: 2px 5px;
  border-radius: 3px;
  text-align: center;
  min-width: 35px;
}

.status-orig {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #d97706;
  background: #fef3c7;
  padding: 2px 5px;
  border-radius: 3px;
  text-align: center;
  min-width: 35px;
}

.status-calc-small {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: 1px 4px;
  border-radius: 2px;
  text-align: center;
  min-width: 30px;
}

.status-orig-small {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: #d97706;
  background: #fef3c7;
  padding: 1px 4px;
  border-radius: 2px;
  text-align: center;
  min-width: 30px;
}

.text-muted {
  color: #6b7280;
}

.text-danger {
  color: #ef4444;
}

/* Button groups */
.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-period-reset {
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  min-width: 80px;
}

.btn-period-reset:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Period inline buttons - same styling as period buttons */
.btn-period-inline {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #374151;
  border: 1px solid #cbd5e1;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 80px;
  text-align: center;
}

.btn-period-inline:hover {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: #1f2937;
}

.btn-period-inline.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-period-inline.active:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Info boxes */
.info-box {
  background: #0d1324;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 13px;
  color: #9ca3af;
}

.info-text {
  margin: 8px 0;
  font-size: 13px;
  color: #9ca3af;
}

/* Date form */
.date-form-container {
  margin-bottom: 20px;
  padding: 16px;
  background: #0d1324;
  border-radius: 8px;
}

.date-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.date-input-group {
  flex: 1;
  min-width: 150px;
}

.date-label {
  display: block;
  margin-bottom: 4px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

/* Removed duplicate .date-input - using the white version above */

/* Date form buttons - using shared btn-submit from above */

/* Date form reset button - using shared btn-reset from above */

/* Export table styles */
.btn-export {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  min-width: 80px;
}

.btn-export:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.export-table-container {
  overflow-x: auto;
  max-height: 70vh;
}

.export-table {
  width: 100%;
  border-collapse: collapse;
  background: #0d1324;
  font-size: 12px;
}

.export-table-header {
  background: #1e293b;
  position: sticky;
  top: 0;
}

/* Chart-table container layout */
.chart-table-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-table-container.side-by-side {
  flex-direction: row;
  gap: 0;
  align-items: flex-start;
}

.chart-table-container.side-by-side .chart-container {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  max-width: 50%;
}

.chart-table-container.side-by-side .table-container {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  max-width: 50%;
  display: block !important;
}

/* Table container default state */
.table-container {
  display: none;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
  margin-top: 16px;
}

.chart-table-container.side-by-side .table-container {
  border-top: none;
  border-left: 1px solid #e2e8f0;
  padding-top: 0;
  padding-left: 12px;
  margin-top: 0;
}

/* Table scroll container */
.table-scroll {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
}

/* Table width adjustments for side-by-side layout */
.chart-table-container.side-by-side .data-table {
  width: 100%;
  table-layout: fixed;
}

.chart-table-container.side-by-side .data-table th,
.chart-table-container.side-by-side .data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Specific column widths for better distribution */
.chart-table-container.side-by-side .th-number {
  width: 8%;
}

.chart-table-container.side-by-side .th-left {
  width: 35%;
}

.chart-table-container.side-by-side .th-center {
  width: 15%;
}

.chart-table-container.side-by-side .th-right {
  width: 21%;
}

.chart-table-container.side-by-side .th-cnt {
  width: 15%;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .chart-table-container.side-by-side {
    flex-direction: column;
  }
  
  .chart-table-container.side-by-side .chart-container {
    flex: none;
    width: 100%;
    max-width: none;
  }
}

/* ==========================================================================
   View Tabs Navigation (nová sekce pro export CSV)
   ========================================================================== */

.view-tabs-container {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.view-tab {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--muted);
  background: #f8fafc;
  border: 2px solid transparent;
  transition: all var(--speed) var(--ease);
  white-space: nowrap;
}

.view-tab:hover {
  color: var(--accent);
  background: #f1f5f9;
  border-color: #e2e8f0;
  transform: translateY(-1px);
}

.view-tab.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.view-tab.active:hover {
  color: #ffffff;
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

/* Export tlačítko v tabs */
.btn-export {
  margin-left: auto;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  background: #16a34a;
  border-color: #16a34a;
}

.btn-export:hover {
  background: #15803d;
  border-color: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Utility class for auto margin left */
.ml-auto {
  margin-left: auto !important;
}

/* Export Modal Styling (vylepšení existující) */
.export-table-container {
  max-height: 70vh;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid #374151;
}

.export-table {
  width: 100%;
  border-collapse: collapse;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.4;
}

.export-table th {
  position: sticky;
  top: 0;
  background: #111827;
  color: #9ca3af;
  font-weight: 600;
  z-index: 10;
}

.export-table th,
.export-table td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #374151;
  white-space: nowrap;
}

.export-table tr:nth-child(even) {
  background: #1f2937;
}

.export-table tr:nth-child(odd) {
  background: #111827;
}

.export-table tr:hover {
  background: #374151 !important;
}

/* Mobile responsiveness pro tabs */
@media (max-width: 768px) {
  .view-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  
  .view-tab {
    text-align: center;
    margin: 0;
  }
  
  .btn-export {
    margin-left: 0;
    margin-top: 0.5rem;
  }
}

/* ==========================================================================
   TODO Form Grid
   ========================================================================== */

.todo-form-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.todo-form-grid .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.todo-form-grid .form-row:first-child {
  grid-template-columns: 1fr;
}

.todo-form-grid .form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
}

@media (max-width: 768px) {
  .todo-form-grid .form-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Dashboard Price Highlight (nová sekce)
   ========================================================================== */

.price-highlight {
  color: #16a34a !important;
  font-weight: 600;
  font-size: 0.875rem;
}

/* ==========================================================================
   EXTRACTED STYLES - Centralizované styly z jednotlivých souborů
   ========================================================================== */

/* ---------- Devices List Page Styles ---------- */

/* Refresh button styles */
.btn-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-refresh:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-refresh:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Notes button styles */
.btn-notes {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  margin-right: 12px;
}

.btn-notes:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-notes svg {
  stroke-width: 2;
}

/* Enhanced Modal styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.display-none {
    display: none;
}

.modal-content {
  background-color: white;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #f1f5f9;
    color: #475569;
}

#editDeviceForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #334155;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control:disabled {
    background-color: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    margin-top: 24px;
}

.btn-cancel, .btn-save {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-cancel {
    background-color: #f1f5f9;
    color: #475569;
}

.btn-cancel:hover {
    background-color: #e2e8f0;
}

.btn-save {
    background-color: #3b82f6;
    color: white;
}

.btn-save:hover {
    background-color: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* TODO Modal Styles */
#todoModal .modal-content {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

#todoModal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 20px 24px;
    border-bottom: none;
}

#todoModal .modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

#todoModal .modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 24px;
    width: 36px;
    height: 36px;
}

#todoModal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
    transition: all 0.3s ease;
}

.todo-form-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.todo-form-section h4 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-form-section h4:before {
    content: "✏️";
    font-size: 1.2rem;
}

.todo-list-section {
    background: white;
    border-radius: 12px;
    margin: 0 24px 20px 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.todo-list-section h4 {
    margin: 0;
    color: #1f2937;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 20px 24px 0 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-list-section h4:before {
    content: "📋";
    font-size: 1.2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-row .form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #f3f4f6;
    margin-top: 20px;
}

.form-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.form-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.todo-items {
    max-height: 350px;
    overflow-y: auto;
    padding: 0 24px 24px 24px;
}

.todo-items::-webkit-scrollbar {
    width: 6px;
}

.todo-items::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.todo-items::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.todo-items::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.todo-item {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.todo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.todo-item:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #e5e7eb;
}

.todo-item.completed {
    opacity: 0.8;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.todo-item.completed:before {
    background: #22c55e;
}

.todo-item.overdue {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
}

.todo-item.overdue:before {
    background: #ef4444;
}

.todo-item.priority-high:before {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.todo-item.priority-medium:before {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.todo-item.priority-low:before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.todo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.todo-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.todo-badges .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.todo-description {
    font-weight: 600;
    margin-bottom: 12px;
    color: #111827;
    font-size: 1rem;
    line-height: 1.5;
}

.todo-meta {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.todo-meta div {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.todo-meta div:last-child {
    margin-bottom: 0;
}

.todo-meta div:before {
    font-size: 14px;
}

.todo-meta div:nth-child(1):before { content: "📅"; }
.todo-meta div:nth-child(2):before { content: "👤"; }
.todo-meta div:nth-child(3):before { content: "🔔"; }
.todo-meta div:nth-child(4):before { content: "✅"; }

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-sm.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-sm.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.empty-message {
    text-align: center;
    color: #9ca3af;
    padding: 60px 30px;
    font-style: italic;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    margin: 20px;
    font-size: 1.1rem;
}

.empty-message:before {
    content: "📝";
    display: block;
    font-size: 3rem;
    margin-bottom: 16px;
}

#todoModal .modal-actions {
    padding: 20px 24px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.completion-badge {
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TODO Actions Buttons */
.todo-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.btn-todo-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #374151;
}

.btn-todo-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-todo-action.btn-complete {
    border-color: #22c55e;
    color: #22c55e;
}

.btn-todo-action.btn-complete:hover {
    background: #22c55e;
    color: white;
}

.btn-todo-action.btn-edit {
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-todo-action.btn-edit:hover {
    background: #3b82f6;
    color: white;
}

.btn-todo-action.btn-delete {
    border-color: #ef4444;
    color: #ef4444;
}

.btn-todo-action.btn-delete:hover {
    background: #ef4444;
    color: white;
}

.btn-todo-action svg {
    width: 16px;
    height: 16px;
}

.completion-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #15803d;
}

/* Custom Select Styling pro TODO formulář */
.todo-form-section select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 45px 14px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 15px center;
    background-repeat: no-repeat;
    background-size: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.todo-form-section select:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.todo-form-section select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23667eea' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.todo-form-section select:hover:not(:focus) {
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: #fafafa;
}

.todo-form-section select option {
    background: white;
    color: #374151;
    padding: 14px 18px;
    font-weight: 500;
    border-bottom: 1px solid #f3f4f6;
}

.todo-form-section select option:last-child {
    border-bottom: none;
}

/* Priority Select - Červené téma */
#todoPriority {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23dc2626' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    border-left: 4px solid #dc2626;
}

#todoPriority:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12), 0 4px 12px rgba(220, 38, 38, 0.15);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23dc2626' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

#todoPriority option[value="high"] {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    font-weight: 700;
}

#todoPriority option[value="medium"] {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #d97706;
    font-weight: 600;
}

#todoPriority option[value="low"] {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #16a34a;
    font-weight: 600;
}

/* Category Select - Fialové téma */
#todoCategory {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%238b5cf6' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    border-left: 4px solid #8b5cf6;
}

#todoCategory:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12), 0 4px 12px rgba(139, 92, 246, 0.15);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%238b5cf6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

#todoCategory option[value="general"] {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
}

#todoCategory option[value="maintenance"] {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #2563eb;
}

#todoCategory option[value="repair"] {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
}

#todoCategory option[value="calibration"] {
    background: linear-gradient(135deg, #fefbeb 0%, #fef3c7 100%);
    color: #d97706;
}

#todoCategory option[value="inspection"] {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0284c7;
}

/* Notification Select - Modré téma */
#todoNotification {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2306b6d4' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    border-left: 4px solid #06b6d4;
}

#todoNotification:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12), 0 4px 12px rgba(6, 182, 212, 0.15);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2306b6d4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Animace pro loading state při změně selectu */
.todo-form-section select.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.todo-form-section select.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Hover efekt pro options */
.todo-form-section select option:hover,
.todo-form-section select option:focus {
    background-color: #f3f4f6 !important;
    transform: scale(1.02);
}

/* Active state */
.todo-form-section select:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Textarea styling pro TODO formulář */
.todo-form-section textarea {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 400;
    color: #374151;
    width: 100%;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    font-family: inherit;
    line-height: 1.5;
    border-left: 4px solid #667eea;
}

.todo-form-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.12), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.todo-form-section textarea:hover:not(:focus) {
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: #fafafa;
}

.todo-form-section textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

/* Input styling pro datetime-local */
.todo-form-section input[type="datetime-local"] {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border-left: 4px solid #10b981;
    cursor: pointer;
}

.todo-form-section input[type="datetime-local"]:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12), 0 4px 12px rgba(16, 185, 129, 0.15);
    transform: translateY(-2px);
}

.todo-form-section input[type="datetime-local"]:hover:not(:focus) {
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: #fafafa;
}

/* Label styling */
.todo-form-section .form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
    font-size: 14px;
    letter-spacing: 0.025em;
}

/* Notes Modal Styling */
.notes-modal-content {
    max-width: 900px;
    max-height: 85vh;
    width: 95%;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.notes-modal-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 24px;
    border-bottom: none;
}

.notes-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notes-search-section {
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.notes-search {
    max-width: 400px;
    margin: 0 auto;
}

.notes-list-container {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0;
}

.notes-list {
    padding: 24px;
}

.note-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.note-item:hover {
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.15);
}

.note-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.note-device-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.device-name {
    font-weight: 700;
    font-size: 16px;
    color: #111827;
}

.device-uid {
    background: #e5e7eb;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.device-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.device-status.status-online {
    background: #dcfce7;
    color: #166534;
}

.device-status.status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-date {
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

.note-content {
    padding: 20px;
}

.note-text {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
    padding: 16px;
    margin: 0;
    border-radius: 8px;
    color: #92400e;
    font-weight: 500;
    line-height: 1.5;
}

.no-note {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 12px;
    margin: 0;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

.empty-notes {
    text-align: center;
    color: #9ca3af;
    padding: 60px 30px;
    font-size: 18px;
    font-weight: 500;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.loading-notes {
    text-align: center;
    color: #6b7280;
    padding: 40px;
    font-size: 16px;
    font-weight: 500;
    animation: pulse 2s infinite;
}

.error-message {
    text-align: center;
    color: #dc2626;
    padding: 40px;
    font-size: 16px;
    font-weight: 500;
    background: #fef2f2;
    border: 2px solid #fee2e2;
    border-radius: 12px;
}

/* TODO Priority Styling */
.todo-priority {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.todo-priority.priority-high {
    background: #fee2e2;
    color: #dc2626;
}

.todo-priority.priority-medium {
    background: #fef3c7;
    color: #d97706;
}

.todo-priority.priority-low {
    background: #dcfce7;
    color: #16a34a;
}

/* TODO Status Styling */
.todo-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.todo-status.status-completed {
    background: #dcfce7;
    color: #16a34a;
}

.todo-status.status-pending {
    background: #e0f2fe;
    color: #0284c7;
}

.todo-status.status-overdue {
    background: #fee2e2;
    color: #dc2626;
    animation: pulse 2s infinite;
}

/* TODO Description Styling */
.todo-description {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0284c7;
    padding: 16px;
    margin: 0 0 12px 0;
    border-radius: 8px;
    color: #0c4a6e;
    font-weight: 500;
    line-height: 1.5;
}

.completion-info {
    background: #f0fdf4;
    border-left: 4px solid #16a34a;
    padding: 12px;
    border-radius: 6px;
    color: #15803d;
    font-size: 14px;
    font-weight: 500;
}

.todo-category {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
}

/* ---------- Admin Voda Preview Styles - Dark Theme ---------- */
.admin-voda-body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #0b1020;
    color: #e5e9f0;
    margin: 0;
}

.admin-voda-wrap {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 16px;
}

.admin-voda-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 0 #000 inset;
}

.admin-voda-body h1 {
    font-size: 22px;
    margin: 0 0 12px;
}

.admin-voda-body h2 {
    font-size: 18px;
    margin: 0 0 8px;
    color: #a5b4fc;
}

.admin-voda-body label {
    display: block;
    margin-bottom: 6px;
    color: #9ca3af;
}

.admin-voda-body input[type=text] {
    width: 240px;
    background: #0d1324;
    border: 1px solid #27324a;
    color: #e5e9f0;
    border-radius: 10px;
    padding: 8px 10px;
}

.admin-voda-body button, .admin-voda-body .btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.admin-voda-body .btn.secondary {
    background: #374151;
}

.admin-voda-body button:hover, .admin-voda-body .btn:hover {
    opacity: 0.9;
}

.admin-voda-body table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.admin-voda-body th, .admin-voda-body td {
    padding: 8px 10px;
    border-bottom: 1px solid #1f2937;
}

.admin-voda-body th {
    background: #0d1324;
    color: #9ca3af;
    text-align: left;
    position: sticky;
    top: 0;
}

.admin-voda-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media(max-width:768px) {
    .admin-voda-grid {
        grid-template-columns: 1fr;
    }
}

.admin-voda-kv {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 6px 12px;
}

.admin-voda-kv div.key {
    color: #9ca3af;
}

.admin-voda-body .badge {
    display: inline-block;
    background: #1f2937;
    color: #93c5fd;
    border: 1px solid #293548;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.admin-voda-body .note {
    color: #fca5a5;
}

.admin-voda-body .small {
    font-size: 12px;
    color: #9ca3af;
}

.admin-voda-body pre {
    background: #0d1324;
    padding: 8px;
    border-radius: 8px;
    overflow: auto;
}

.admin-voda-body details summary {
    cursor: pointer;
    user-select: none;
}

/* ---------- Auto Refresh Monitor Styles - Terminal Theme ---------- */
.auto-refresh-body {
    font-family: monospace;
    padding: 20px;
    background: #1a1a1a;
    color: #00ff00;
}

.auto-refresh-container {
    max-width: 800px;
}

.auto-refresh-status {
    margin: 5px 0;
}

.auto-refresh-error {
    color: #ff4444;
}

.auto-refresh-success {
    color: #44ff44;
}

.auto-refresh-info {
    color: #4444ff;
}

.auto-refresh-controls {
    margin: 20px 0;
}

.auto-refresh-controls button {
    padding: 10px 20px;
    margin: 5px;
}

.auto-refresh-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
    padding: 10px;
    background: #2a2a2a;
    border-radius: 5px;
}

.auto-refresh-stat {
    text-align: center;
}

.auto-refresh-stat-value {
    font-size: 1.5em;
    font-weight: bold;
}

.auto-refresh-stat-label {
    font-size: 0.8em;
    color: #aaa;
}

/* ---------- User Create Simple Form Styles ---------- */
.user-create-simple-body {
    font-family: Arial, sans-serif;
    margin: 20px;
}

.user-create-form-container {
    max-width: 600px;
    margin: 0 auto;
}

.user-create-form-group {
    margin-bottom: 15px;
}

.user-create-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.user-create-form-input, .user-create-form-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.user-create-btn-primary {
    background: #007cba;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.user-create-btn-primary:hover {
    background: #005a86;
}

.user-create-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.user-create-success {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.user-create-required {
    color: red;
}

/* ---------- Utility Inline Styles ---------- */

/* Margin and spacing utilities */
.margin-top-8px { margin-top: 8px; }
.margin-top-10px { margin-top: 10px; }
.margin-top-12px { margin-top: 12px; }
.margin-top-14px { margin-top: 14px; }
.margin-top-15px { margin-top: 15px; }
.margin-top-16px { margin-top: 16px; }
.margin-top-18px { margin-top: 18px; }
.margin-top-20px { margin-top: 20px; }
.margin-top-32px { margin-top: 32px; }

.margin-bottom-12px { margin-bottom: 12px; }

.margin-left-8px { margin-left: 8px; }
.margin-left-10px { margin-left: 10px; }

.margin-20px { margin: 20px; }
.padding-15px { padding: 15px; }

/* Display utilities */
.display-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-space-between { justify-content: space-between; }
.gap-8px { gap: 8px; }

/* Background and color utilities */
.bg-success { background: #10b981; }
.color-white { color: white; }
.border-radius-8px { border-radius: 8px; }
.white-space-pre-line { white-space: pre-line; }

/* Text colors for status spans */
.color-slate-600 { color: #64748b; }
.color-slate-400 { color: #cbd5e1; }
.color-red-500 { color: #ef4444; }

/* Font sizes */
.font-size-13px { font-size: 13px; }
.font-size-1rem { font-size: 1rem; }

/* Max width utilities */
.max-width-520px { max-width: 520px; }

/* Container utilities */
.padding-0-margin-0 { padding: 0; margin: 0; }

/* Debug styles */
.debug-pre {
    background: #f0f0f0;
    padding: 10px;
    max-height: 200px;
    overflow: auto;
}

/* Test form styles */
.test-form-success { 
    background: lightgreen; 
    padding: 10px; 
    margin: 10px 0; 
}

.test-form-border { 
    border: 1px solid #ccc; 
    padding: 20px; 
}

.test-form-button { 
    padding: 10px 20px; 
    font-size: 16px; 
}

/* Success/Error message styles */
.color-green { color: green; }
.color-red { color: red; }

/* Cursor utilities */
.cursor-pointer { cursor: pointer; }

/* Display utilities */
.display-none { display: none !important; }
.hidden { 
  display: none !important;
}

/* Grid utilities */
.grid-column-full { grid-column: 1 / -1; }

/* Modal utilities */
.modal-content-large { max-width: 800px; max-height: 90vh; overflow-y: auto; }

/* Animation for loading spinners */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin-animation {
    animation: spin 1s linear infinite;
}

/* Link styles in error messages */
.error-link {
    color: #dc2626;
    text-decoration: underline;
    font-weight: bold;
}

/* Responsivní úpravy pro všechny extrahované styly */
@media (max-width: 768px) {
    #todoModal .modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .todo-form-section, .todo-list-section {
        margin: 15px;
    }
    
    .todo-form-section select,
    .todo-form-section textarea,
    .todo-form-section input[type="datetime-local"] {
        padding: 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .notes-modal-content {
        width: 98%;
        margin: 1%;
        max-height: 95vh;
    }
    
    .note-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .note-device-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .notes-list {
        padding: 16px;
    }
    
    .note-item {
        margin-bottom: 12px;
    }
    
    .todo-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .todo-badges {
        justify-content: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================ */
/* VÝCHOZÍ SKRYTÍ MOBILNÍCH PRVKŮ */
.mobile-top-nav {
  display: none;
}

.mobile-dashboard-content {
  display: none;
}

/* DESKTOP - SKRYTÍ MOBILNÍCH PRVKŮ */
/* ============================================ */
@media only screen and (min-width: 481px) {
  /* Skrytí mobilní navigace na desktopu */
  .mobile-top-nav {
    display: none !important;
  }
  
  /* Skrytí mobilního dashboard obsahu na desktopu */
  .mobile-dashboard-content {
    display: none !important;
  }
  
  /* Reset mobilních stavů na desktopu */
  body.mobile-dashboard-active .main-content {
    padding-top: 0 !important; /* Reset mobile padding */
  }
  
  body.mobile-dashboard-active .main-content > *:not(.mobile-dashboard-content) {
    display: block !important; /* Zobraz vše na desktopu */
  }
}

/* ============================================ */
/* MOBILNÍ DESIGN - POUZE PRO MOBILY MAX 480px */
/* ============================================ */
@media only screen and (max-width: 480px) {
  
  /* Skrytí desktopového sidebaru na mobilech */
  body .modern-sidebar {
    display: none !important;
  }
  
  /* Skrytí toggle buttonu na mobilech */
  body .sidebar-toggle {
    display: none !important;
  }
  
  /* Přizpůsobení main-content pro mobily */
  body .main-content {
    width: 100% !important;
    margin-left: 0 !important;
    padding-top: 70px !important; /* Místo pro top nav */
  }
  
  /* Mobilní top navigace */
  body .mobile-top-nav {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    border-bottom: 2px solid #e5e7eb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    align-items: center;
    padding: 0 1rem;
    overflow-x: auto;
  }
  
  /* Logo v mobilní navigaci */
  body .mobile-nav-logo {
    height: 35px;
    margin-right: 1rem;
    flex-shrink: 0;
  }
  
  /* Menu kontejner */
  body .mobile-nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  body .mobile-nav-menu::-webkit-scrollbar {
    display: none;
  }
  
  /* Mobilní navigační položky */
  body .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.8rem;
    text-decoration: none;
    color: #64748b;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: fit-content;
    flex-shrink: 0;
  }
  
  body .mobile-nav-item:hover {
    background: #f1f5f9;
    color: #2770b8;
    transform: translateY(-1px);
  }
  
  body .mobile-nav-item.active {
    background: #2770b8;
    color: white;
    box-shadow: 0 2px 8px rgba(39, 112, 184, 0.3);
  }
  
  /* Ikony v mobilní navigaci */
  body .mobile-nav-icon {
    margin-bottom: 0.25rem;
  }
  
  body .mobile-nav-icon svg {
    width: 18px;
    height: 18px;
  }
  
  /* Text v mobilní navigaci */
  body .mobile-nav-text {
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1;
  }
  
  /* Mobilní dashboard obsah - skrytý ve výchozím stavu */
  body .mobile-dashboard-content {
    display: none;
    padding: 1rem;
    background: #f8fafc;
    min-height: calc(100vh - 70px);
  }
  
  /* Aktivní stav mobilního dashboardu */
  body.mobile-dashboard-active .mobile-dashboard-content {
    display: block !important;
  }
  
  /* Skrytí main obsahu když je aktivní mobilní dashboard */
  body.mobile-dashboard-active .main-content > *:not(.mobile-dashboard-content) {
    display: none !important;
  }
  
  /* Rychlé akce karty pro mobilní dashboard */
  body .quick-action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.8rem;
  }
  
  body .quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  }
  
  body .quick-action-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2770b8 0%, #1e40af 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
  }
  
  body .quick-action-card h4 {
    margin: 0 0 0.2rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
  }
  
  body .quick-action-card p {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
  }
  
  /* MOBILNÍ ÚPRAVY PRO DEVICE LIST - ikony akcí vedle sebe */
  body .table-actions {
    display: flex !important;
    flex-direction: row !important; /* Vedle sebe, ne pod sebou */
    gap: 0.3rem !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important; /* Nepovolí zalamování */
  }
  
  body .action-buttons {
    display: flex !important;
    flex-direction: row !important; /* Vedle sebe, ne pod sebou */
    gap: 0.3rem !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important; /* Nepovolí zalamování */
  }
  
  body .btn-table-action {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important; /* Nepovolí zmenšení */
    margin: 0 !important;
  }
  
  body .btn-table-action svg {
    width: 16px !important;
    height: 16px !important;
  }
  
  /* Pro případ že by byl container akcí moc úzký */
  body .actions-cell {
    min-width: 120px !important;
    white-space: nowrap !important;
  }
  
}

/* Statistiky badge pro refresh navigace */
.stats-badge {
  background: linear-gradient(135deg, #2770b8 0%, #1e40af 100%);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  margin-left: 0.5rem;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(39, 112, 184, 0.3);
}

/* ==========================================================================
   DEVICES LIST - VIEW TOGGLE & ACTIONS
   ========================================================================== */

/* View Toggle Buttons */
.btn-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #dee2e6;
  color: #6c757d;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-view-toggle:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #495057;
}

.btn-view-toggle.active {
  background: #007cba;
  border-color: #007cba;
  color: white;
}

.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle .btn-view-toggle {
  border: none;
  border-radius: 0;
  border-right: 1px solid #dee2e6;
}

.view-toggle .btn-view-toggle:last-child {
  border-right: none;
}

.btn-view-toggle svg {
  width: 16px;
  height: 16px;
}

/* Card Actions Row - ikony vedle sebe */
.sensor-actions-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  color: #495057;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-action-icon:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-action-icon.btn-view {
  background: #e3f2fd;
  border-color: #90caf9;
  color: #1565c0;
}

.btn-action-icon.btn-view:hover {
  background: #bbdefb;
  border-color: #64b5f6;
}

.btn-action-icon.btn-todo {
  background: #fff3e0;
  border-color: #ffcc80;
  color: #e65100;
}

.btn-action-icon.btn-todo:hover {
  background: #ffe0b2;
  border-color: #ffb74d;
}

.btn-action-icon.btn-config {
  background: #f3e5f5;
  border-color: #ce93d8;
  color: #4a148c;
}

.btn-action-icon.btn-config:hover {
  background: #e1bee7;
  border-color: #ba68c8;
}

.btn-action-icon.btn-edit {
  background: #e8f5e8;
  border-color: #a5d6a7;
  color: #2e7d32;
}

.btn-action-icon.btn-edit:hover {
  background: #c8e6c9;
  border-color: #81c784;
}

.btn-action-icon.btn-delete {
  background: #ffebee;
  border-color: #ef9a9a;
  color: #c62828;
}

.btn-action-icon.btn-delete:hover {
  background: #ffcdd2;
  border-color: #e57373;
}

.btn-action-icon.btn-assign {
  background: #e1f5fe;
  border-color: #81d4fa;
  color: #0277bd;
}

.btn-action-icon.btn-assign:hover {
  background: #b3e5fc;
  border-color: #4fc3f7;
}

/* Table Actions - tlačítka v tabulce (stejné barvy jako v kartách) */
.btn-table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 2px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-table-action:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-table-action.btn-assign {
  background: #e1f5fe !important;
  border-color: #81d4fa !important;
  color: #0277bd !important;
}

.btn-table-action.btn-assign:hover {
  background: #b3e5fc !important;
  border-color: #4fc3f7 !important;
}

.btn-table-action.btn-view {
  background: #e3f2fd !important;
  border-color: #90caf9 !important;
  color: #1565c0 !important;
}

.btn-table-action.btn-view:hover {
  background: #bbdefb !important;
  border-color: #64b5f6 !important;
}

.btn-table-action.btn-todo {
  background: #fff3e0 !important;
  border-color: #ffcc80 !important;
  color: #e65100 !important;
}

.btn-table-action.btn-todo:hover {
  background: #ffe0b2 !important;
  border-color: #ffb74d !important;
}

.btn-table-action.btn-config {
  background: #f3e5f5 !important;
  border-color: #ce93d8 !important;
  color: #4a148c !important;
}

.btn-table-action.btn-config:hover {
  background: #e1bee7 !important;
  border-color: #ba68c8 !important;
}

.btn-table-action.btn-edit {
  background: #e8f5e8 !important;
  border-color: #a5d6a7 !important;
  color: #2e7d32 !important;
}

.btn-table-action.btn-edit:hover {
  background: #c8e6c9 !important;
  border-color: #81c784 !important;
}

.btn-table-action.btn-delete {
  background: #ffebee !important;
  border-color: #ef9a9a !important;
  color: #c62828 !important;
}

.btn-table-action.btn-delete:hover {
  background: #ffcdd2 !important;
  border-color: #e57373 !important;
}

/* User badges pro Admin a Customer sloupce */
.user-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
}

.admin-badge {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.customer-badge {
  background: #f3e5f5;
  color: #6a1b9a;
  border: 1px solid #ce93d8;
}

/* Batch refresh tlačítko */
.btn-batch-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  user-select: none;
}

.btn-batch-refresh:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-batch-refresh:active {
  transform: translateY(0);
}

.btn-batch-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   MAPA (MAP) STYLES
   ========================================================================== */

#map {
  width: 100%;
  height: calc(100vh - 120px);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-container {
  padding: 1.5rem;
  background: #fff;
  border-radius: 12px;
  margin: 1.5rem;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.map-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.map-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.device-count {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.leaflet-popup-content {
  text-align: center;
  min-width: 150px;
}

.popup-device-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.popup-device-type {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.popup-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.popup-status.online {
  background: #d1fae5;
  color: #065f46;
}

.popup-status.offline {
  background: #fee2e2;
  color: #991b1b;
}

.popup-btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.popup-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.no-devices {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.no-devices svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.device-label {
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.875rem;
  color: #1f2937;
  white-space: nowrap;
}

.device-label::before {
  border-top-color: #3b82f6 !important;
}

.leaflet-tooltip-top:before {
  border-top-color: #3b82f6;
}

/* ===========================================================================
   DEVICE ASSIGN STYLES
   ========================================================================== */

.device-checkbox-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  background: #f8f9fa;
}

.device-checkbox-item {
  display: flex;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.device-checkbox-item:hover {
  background: #e3f2fd;
  border-color: #90caf9;
}

.device-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  cursor: pointer;
}

.device-checkbox-item label {
  cursor: pointer;
  flex: 1;
  margin: 0;
  font-size: 14px;
  user-select: none;
}

.device-info-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #e0e0e0;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 8px;
  user-select: none;
}

.select-all-wrapper {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.select-all-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.select-all-wrapper label {
  cursor: pointer;
  font-weight: 600;
  margin: 0;
  user-select: none;
}

/* ===========================================================================
   MOBILNÍ DESIGN (pouze pro mobily, desktop beze změny)
   =========================================================================== */
@media (max-width: 767px) {
  /* Hamburger menu */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 8px;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10001;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  }
  .hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    margin: 4px 0;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
  }
  /* Mobilní navigace jako overlay */
  .mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 80vw;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 24px rgba(0,0,0,0.18);
    z-index: 10000;
    flex-direction: column;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    gap: 1.5rem;
    overflow-y: auto;
    transition: left 0.3s;
  }
  .mobile-nav.open {
    display: flex;
    left: 0;
  }
  .mobile-nav .nav-item {
    font-size: 1.1rem;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    user-select: none;
  }
  .mobile-nav .nav-item.active {
    color: var(--accent);
    font-weight: 700;
    background: #f0f6ff;
  }
  .mobile-nav .nav-item:last-child {
    border-bottom: none;
  }
  .mobile-nav-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
    z-index: 10001;
  }
  /* Overlay pro zavření menu */
  .mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.25);
    z-index: 9999;
  }
  .mobile-nav.open ~ .mobile-nav-overlay {
    display: block;
  }
  /* Hamburger je vždy viditelný na mobilu */
  .hamburger {
    display: flex !important;
  }
  /* Skrytí sidebaru na mobilu */
  .modern-sidebar {
    display: none !important;
  }
  /* Hlavní obsah přes celou šířku */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 1rem 0.5rem 1.5rem 0.5rem !important;
  }
  /* Karty a grafy v detailu zařízení */
  .sensor-card, .content-card, .card {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    padding: 1rem 0.5rem !important;
    margin: 0.5rem 0 !important;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  }
  /* Grafy roztáhnout na šířku */
  .chart-container, .graph-wrapper, .device-graph {
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    margin-left: -2vw !important;
    margin-right: -2vw !important;
    overflow-x: auto;
    background: #fff;
    border-radius: 12px;
    padding: 0.5rem 0.25rem 1rem 0.25rem;
  }
  .chart-container canvas, .graph-wrapper canvas {
    width: 100vw !important;
    min-width: 320px !important;
    max-width: 100vw !important;
    height: auto !important;
  }
  /* Touch-friendly prvky */
  button, .btn, .nav-item, .sensor-card {
    min-height: 44px;
    font-size: 1rem;
  }
  /* Tabulky horizontální scroll */
  .table-container, .data-table, .table-inline {
    overflow-x: auto !important;
    min-width: 600px;
    font-size: 0.95rem;
  }
  /* Formuláře na šířku */
  .form-row, .form-group, .form-input, .form-select, .form-textarea {
    width: 100% !important;
    font-size: 16px !important;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 0.5rem 0.25rem 1rem 0.25rem !important;
  }
  .sensor-card, .content-card, .card {
    padding: 0.75rem 0.25rem !important;
    border-radius: 10px;
  }
  .chart-container, .graph-wrapper, .device-graph {
    margin-left: -4vw !important;
    margin-right: -4vw !important;
    padding: 0.25rem 0.1rem 0.75rem 0.1rem;
  }
  .chart-container canvas, .graph-wrapper canvas {
    min-width: 220px !important;
  }
}