:root {
  --green: #00B04F;
  --green-dark: #008A3E;
  --green-light: #E8F9EF;
  --green-muted: #B8E6CC;
  --bg: #F4F7F5;
  --card: #FFFFFF;
  --text: #1A2E22;
  --muted: #5C7366;
  --border: #D8E8DE;
  --sidebar-bg: #F3F4F6;
  --sidebar-border: #E5E7EB;
  --sidebar-active: #E8F5EE;
  --sidebar-text: #1F2937;
  --sidebar-label: #9CA3AF;
  --online: #00B04F;
  --stale: #F5A623;
  --offline: #C0392B;
  --unknown: #95A5A6;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 80, 40, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-width: 268px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: calc(1rem + var(--safe-bottom));
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.page-content {
  flex: 1;
}

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

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar {
  display: none;
}

/* --- Sidebar desktop --- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem 1rem;
  text-decoration: none;
  color: var(--sidebar-text);
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand img {
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.sidebar-brand strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.25;
}

.sidebar-brand span {
  display: block;
  font-size: 0.72rem;
  color: var(--sidebar-label);
  font-weight: 500;
  margin-top: 0.1rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.65rem;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 1.25rem;
}

.nav-section-label {
  margin: 0 0 0.4rem;
  padding: 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sidebar-label);
}

.sidebar-link,
.app-menu .nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.15rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

.sidebar-link:hover,
.app-menu .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.sidebar-link.is-active,
.app-menu .nav-item.is-active {
  background: var(--sidebar-active);
  color: var(--green-dark);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--green-muted);
}

.sidebar-link .nav-icon,
.app-menu .nav-item .nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  stroke: currentColor;
  color: #6B7280;
}

.sidebar-link.is-active .nav-icon,
.app-menu .nav-item.is-active .nav-icon {
  color: var(--green-dark);
}

.sidebar-foot {
  padding: 0.75rem 0.65rem 1rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  padding: 0.5rem 0.75rem 0.65rem;
}

.sidebar-user-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sidebar-text);
}

.sidebar-user-role {
  display: block;
  font-size: 0.75rem;
  color: var(--sidebar-label);
}

.sidebar-user-link {
  display: block;
  text-decoration: none;
  border-radius: 10px;
  transition: background 0.15s;
}

.sidebar-user-link:hover {
  background: var(--sidebar-active);
  text-decoration: none;
}

.sidebar-user-stats {
  display: block;
  font-size: 0.72rem;
  color: var(--green-dark);
  margin-top: 0.25rem;
}

.app-menu-user-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.app-menu-user-link:hover {
  text-decoration: none;
}

.app-menu-stats {
  display: block;
  font-size: 0.78rem;
  color: var(--green-dark);
  margin-top: 0.2rem;
}

.account-device-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-device-list li + li {
  margin-top: 0.35rem;
}

.account-device-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}

.account-device-link:hover {
  background: var(--green-light);
  text-decoration: none;
}

.sidebar-logout {
  color: #6B7280;
}

.sidebar-logout:hover {
  color: var(--offline);
  background: #FEF2F2;
}

/* --- Topbar mobile --- */
.topbar-mobile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  background: var(--green);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.brand-text {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Hamburger --- */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 20px;
}

.menu-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

/* --- Menu mobilne (drawer) --- */
.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.menu-backdrop.is-open {
  opacity: 1;
}

.app-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(300px, 88vw);
  z-index: 2010;
  background: var(--card);
  color: var(--text);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-menu.is-open {
  transform: translateX(0);
}

.app-menu-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1rem;
  background: var(--green);
  color: #fff;
}

.app-menu-head strong {
  display: block;
  font-size: 1rem;
}

.app-menu-role {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85) !important;
}

.app-menu-logo {
  border-radius: 50%;
  background: #fff;
}

.app-menu-links {
  flex: 1;
  padding: 0.5rem 0.65rem;
  overflow-y: auto;
}

.app-menu-links .nav-section-label {
  color: var(--sidebar-label);
}

.app-menu-foot {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  margin: 0;
}

.nav-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.nav-item-btn .nav-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

body.menu-open {
  overflow: hidden;
}

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }

  .app-layout {
    flex-direction: row;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
  }

  .topbar-mobile,
  .menu-toggle,
  .menu-backdrop,
  .app-menu {
    display: none !important;
  }

  .app-main {
    background: var(--bg);
  }

  .page-content {
    max-width: 960px;
    padding: 1.75rem 2rem 2.5rem;
    margin: 0;
    width: 100%;
  }
}

@media (max-width: 767px) {
  .sidebar {
    display: none !important;
  }
}

.subnav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.subnav-link {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.subnav-link.active {
  background: var(--green-light);
  color: var(--green-dark);
  border-color: var(--green-muted);
}

.bridge-hero .bridge-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.bridge-hero h1 { margin: 0; font-size: 1.15rem; }

.bridge-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.bridge-meta div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bridge-meta span { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; }
.bridge-meta strong { word-break: break-all; font-size: 0.88rem; }

.bridge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bridge-actions form { margin: 0; }

.status-running .status-dot { background: var(--online); }
.status-dry_run .status-dot { background: var(--stale); }
.status-stale .status-dot { background: var(--stale); }
.status-error .status-dot, .status-stopped .status-dot { background: var(--offline); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.log-dump {
  overflow-x: auto;
  font-size: 0.72rem;
  line-height: 1.35;
  background: #1A2E22;
  color: #B8E6CC;
  padding: 0.75rem;
  border-radius: 8px;
  max-height: 320px;
  white-space: pre-wrap;
  word-break: break-all;
}

.alert-error-block { border-color: #F5C6CB; }

.test-results { margin-top: 0.75rem; font-size: 0.9rem; }

.toast {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 20;
  max-width: 90%;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-icon.lg {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.75rem;
  display: block;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (min-width: 480px) {
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-card.online { border-color: var(--green-muted); background: var(--green-light); }
.stat-card.offline { border-color: #F5C6CB; background: #FDF2F2; }

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-dark);
}

.stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  min-width: 0;
}

.device-list { display: flex; flex-direction: column; gap: 0.75rem; }

.device-card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.device-card:active { transform: scale(0.99); }

.device-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sn { font-size: 1.05rem; word-break: break-all; }

.shop-badge {
  margin-left: auto;
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 600;
}

.shop-badge.missing {
  background: #FFF3CD;
  color: #856404;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--unknown);
}

.status-dot.lg { width: 14px; height: 14px; }

.status-online .status-dot { background: var(--online); box-shadow: 0 0 0 3px rgba(0,176,79,0.25); }
.status-stale .status-dot { background: var(--stale); }
.status-offline .status-dot { background: var(--offline); }

.measure-preview {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.88rem;
}

.measure-preview li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.measure-preview span { color: var(--muted); }

.device-card-foot { font-size: 0.78rem; margin-top: 0.6rem; }

.cert-ok { color: var(--green-dark); font-weight: 600; }
.cert-bad { color: var(--offline); font-weight: 600; }

.cert-status-block { margin-top: 1rem; }

.cert-overall {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.cert-valid, .cert-overall.cert-valid { background: var(--green-light); color: var(--green-dark); }
.cert-expiring, .cert-overall.cert-expiring { background: #FFF3CD; color: #856404; }
.cert-expired, .cert-overall.cert-expired { background: #FDECEA; color: #922B21; }
.cert-missing, .cert-overall.cert-missing { background: #F0F0F0; color: var(--muted); }

.chain-check { font-size: 0.88rem; margin: 0 0 0.75rem; }

.cert-table .small { font-size: 0.75rem; word-break: break-all; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-valid { background: var(--green-light); color: var(--green-dark); }
.badge-expiring { background: #FFF3CD; color: #856404; }
.badge-expired { background: #FDECEA; color: #922B21; }
.badge-online { background: var(--green-light); color: var(--green-dark); }
.badge-stale { background: #FFF3CD; color: #856404; }
.badge-offline { background: #FDECEA; color: #922B21; }
.badge-unknown { background: #ECEFF1; color: #546E7A; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }

.btn-secondary {
  background: #fff;
  color: var(--green-dark);
  border: 2px solid var(--green);
}

.btn-danger {
  background: var(--offline);
  color: #fff;
}

.btn-danger:hover {
  background: #A93226;
}

.danger-zone {
  border-color: #F5C6CB;
}

.danger-zone h2 {
  color: #922B21;
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
}

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

input, textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

input:focus, textarea:focus {
  outline: 2px solid var(--green-muted);
  border-color: var(--green);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form .btn { margin-top: 0.25rem; }

.muted { color: var(--muted); }
.empty-state { text-align: center; padding: 2rem 1rem; }

.login-card {
  max-width: 380px;
  margin: 3rem auto;
  text-align: center;
}

.login-header h1 { margin: 0 0 0.25rem; font-size: 1.35rem; }

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.alert-error { background: #FDECEA; color: #922B21; }
.user-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.user-card.user-inactive { opacity: 0.65; background: #FAFAFA; }

.user-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.badge-role { background: var(--green-light); color: var(--green-dark); }
.badge-admin { background: #E8F4FD; color: #1A5276; }

.user-edit-form { margin-top: 0.65rem; }

.user-edit-form input,
.user-edit-form select {
  margin-bottom: 0.65rem;
}

.user-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-sm { padding: 0.45rem 0.75rem; font-size: 0.85rem; }

.small { font-size: 0.82rem; }

.scan-hero h1 { margin: 0 0 0.5rem; font-size: 1.15rem; }

.scan-mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.scan-mode-toggle .btn { flex: 1; min-width: 140px; }

.scan-camera-card { padding: 0; overflow: hidden; }

.scan-viewport {
  position: relative;
  background: #111;
  aspect-ratio: 4 / 3;
  max-height: 52vh;
  overflow: hidden;
}

.scan-viewport video,
.scan-viewport img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  background: #1a1a1a;
}

.scan-overlay {
  position: absolute;
  inset: 12% 8%;
  border: 2px dashed rgba(0, 176, 79, 0.85);
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.scan-hint {
  padding: 0.65rem 1rem 0;
  font-size: 0.85rem;
  margin: 0;
}

.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
}

.btn-file { cursor: pointer; margin: 0; }

.scan-result { border-color: var(--green-muted); }

.quick-actions { margin: 0 0 1rem; }

.search-bar .scan-btn { white-space: nowrap; flex-shrink: 0; }

.scan-mode-btn.active { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); }

#scan-error[hidden] { display: none !important; }

.scan-loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

.scan-loading[hidden] { display: none !important; }

.scan-actions .btn-file {
  flex: 1;
  min-width: 140px;
  text-align: center;
}

.alert-success { background: var(--green-light); color: var(--green-dark); }
.alert-info { background: #E8F4FD; color: #1A5276; }

.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.device-header .device-title {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.device-header h1 {
  margin: 0;
  font-size: 1.15rem;
  word-break: break-all;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.section-head h2, .card > h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 0.45rem 0.35rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; }

.cert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.json-dump {
  overflow-x: auto;
  font-size: 0.78rem;
  background: #F8FAF9;
  padding: 0.75rem;
  border-radius: 8px;
  max-height: 280px;
}

.meta-grid {
  display: grid;
  gap: 0.65rem;
  font-size: 0.85rem;
}

.meta-grid div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.meta-grid strong { word-break: break-all; text-align: right; }

.foot-note { margin-top: 0.75rem; font-size: 0.82rem; }

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--green-dark);
}

.refresh-hint { font-size: 0.75rem; }

code {
  background: var(--green-light);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* --- Mapa i lokalizacja --- */
.page-content:has(.map-page) {
  max-width: none;
}

.map-page-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.map-summary {
  margin-bottom: 0.75rem;
}

.map-search {
  margin-bottom: 0.75rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.legend-dot.online { background: var(--online); }
.legend-dot.stale { background: var(--stale); }
.legend-dot.offline { background: var(--offline); }
.legend-dot.unknown { background: var(--unknown); }

.map-canvas {
  padding: 0;
  overflow: hidden;
  min-height: 420px;
  height: calc(100vh - 320px);
  position: relative;
  isolation: isolate;
  z-index: 0;
}

.map-canvas .leaflet-container {
  height: 100%;
  min-height: 420px;
  border-radius: var(--radius);
}

.map-foot {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.map-pin-wrap {
  background: transparent;
  border: none;
}

.map-pin {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.location-current {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.device-mini-map {
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.device-mini-map.is-hidden {
  display: none;
}

.device-mini-map .leaflet-container {
  height: 100%;
}

.location-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.gps-status {
  font-size: 0.85rem;
}

.gps-status.gps-error {
  color: var(--offline);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    height: calc(100vh - 280px);
    min-height: 360px;
  }
}

.location-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.small { font-size: 0.82rem; }

@media (min-width: 768px) {
  .page-content:has(.map-page) {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}
