/* Pingasaurus Self Hosted - app.css */

:root {
  --background: 0 0% 100%;
  --foreground: 222 47% 11%;
  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;
  --primary: 199 89% 48%;
  --primary-foreground: 0 0% 100%;
  --secondary: 210 40% 96%;
  --muted: 210 40% 96%;
  --muted-foreground: 215 20% 40%;
  --destructive: 0 72% 51%;
  --border: 214 32% 91%;
  --input: 214 32% 91%;
  --ring: 199 89% 48%;
  --radius: 0.5rem;

  --status-online: 142 76% 36%;
  --status-offline: 0 72% 51%;
  --status-warning: 38 92% 50%;
  --status-unknown: 215 20% 50%;

  --sidebar-bg: 210 40% 98%;
  --sidebar-border: 214 32% 91%;
  --sidebar-accent: 210 40% 93%;

  --shadow-card: 0 4px 24px hsl(0 0% 0% / 0.08);
  --shadow-pop: 0 10px 30px hsl(0 0% 0% / 0.14);
}

html.dark {
  --background: 222 47% 6%;
  --foreground: 210 40% 96%;
  --card: 222 47% 9%;
  --card-foreground: 210 40% 96%;
  --primary: 199 89% 48%;
  --primary-foreground: 222 47% 6%;
  --secondary: 222 47% 14%;
  --muted: 222 47% 14%;
  --muted-foreground: 215 20% 62%;
  --destructive: 0 72% 51%;
  --border: 222 47% 16%;
  --input: 222 47% 16%;

  --status-online: 142 76% 45%;
  --status-offline: 0 72% 55%;
  --status-warning: 38 92% 50%;
  --status-unknown: 222 20% 55%;

  --sidebar-bg: 222 47% 8%;
  --sidebar-border: 222 47% 16%;
  --sidebar-accent: 222 47% 15%;

  --shadow-card: 0 4px 24px hsl(0 0% 0% / 0.4);
  --shadow-pop: 0 10px 30px hsl(0 0% 0% / 0.55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: hsl(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }

.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 0.8125rem; }
.tiny { font-size: 0.75rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }

.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.ico-sm { width: 14px; height: 14px; flex: 0 0 auto; }
.ico-lg { width: 28px; height: 28px; flex: 0 0 auto; }

/* ---------------------------------------------------------------- */
/* Layout                                                            */
/* ---------------------------------------------------------------- */

.shell { min-height: 100%; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  background: hsl(var(--sidebar-bg));
  border-right: 1px solid hsl(var(--sidebar-border));
  display: flex;
  flex-direction: column;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-logo {
  height: 80px;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid hsl(var(--sidebar-border));
  padding: 0 16px;
}
.sidebar-logo img { max-height: 56px; max-width: 100%; object-fit: contain; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-heading {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 8px;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.nav-heading.admin { margin-top: 22px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius);
  color: hsl(var(--foreground));
  font-size: 0.875rem; font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: hsl(var(--sidebar-accent) / .6); text-decoration: none; }
.nav-link.active { background: hsl(var(--sidebar-accent)); color: hsl(var(--foreground)); }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; border-top: 1px solid hsl(var(--sidebar-border));
}
.avatar {
  width: 36px; height: 36px; border-radius: 999px; flex: 0 0 auto;
  background: hsl(var(--sidebar-accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.875rem;
}
.who { flex: 1; min-width: 0; }
.who-email { font-size: 0.8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

.main { display: flex; flex-direction: column; min-height: 100vh; }
.content { padding: 20px; flex: 1; }
.foot {
  padding: 16px 20px; font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 14px;
  background: hsl(var(--background) / .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(var(--border));
}
.topbar-logo { height: 36px; width: auto; object-fit: contain; }
.spacer { flex: 1; }

.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: hsl(0 0% 0% / .55);
  display: none;
}
.backdrop.show { display: block; }

@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); }
  .main { margin-left: 256px; }
  .topbar { display: none; }
  .content { padding: 28px 32px; }
  .backdrop { display: none !important; }
}

/* ---------------------------------------------------------------- */
/* Components                                                        */
/* ---------------------------------------------------------------- */

.page-head {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px;
}
.page-head .sub { color: hsl(var(--muted-foreground)); font-size: 0.9375rem; margin-top: 2px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
}
.card + .card { margin-top: 20px; }
.card-head {
  padding: 16px 18px; border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .desc { color: hsl(var(--muted-foreground)); font-size: 0.8125rem; margin-top: 2px; font-weight: 400; }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid transparent;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 0.875rem; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: filter .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.btn-outline { background: transparent; color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--muted)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--muted)); }
.btn-danger { background: hsl(var(--destructive)); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  background: transparent; border: none; cursor: pointer;
  color: hsl(var(--foreground)); text-decoration: none; flex: 0 0 auto;
}
.icon-btn:hover { background: hsl(var(--muted)); }

/* Forms */
label { display: block; font-size: 0.8125rem; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: 0.75rem; color: hsl(var(--muted-foreground)); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid hsl(var(--input)); border-radius: var(--radius);
  background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: 0.875rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid hsl(var(--ring) / .35); outline-offset: 1px;
  border-color: hsl(var(--ring));
}
textarea { resize: vertical; min-height: 80px; }
.inline-form { display: inline; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px;
}
.switch-row label { margin: 0; }
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: hsl(var(--muted-foreground) / .35); transition: background .15s ease;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 999px; background: #fff;
  transition: transform .15s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: hsl(var(--primary)); }
.switch input:checked + .track::after { transform: translateX(20px); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters .search { position: relative; flex: 1 1 240px; }
.filters .search .ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: hsl(var(--muted-foreground));
}
.filters .search input { padding-left: 34px; }
.filters select { width: auto; min-width: 150px; }

/* Flash messages */
.flash {
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid hsl(var(--border)); margin-bottom: 16px;
  font-size: 0.875rem;
}
.flash-success { background: hsl(var(--status-online) / .12); border-color: hsl(var(--status-online) / .5); color: hsl(var(--status-online)); }
.flash-error   { background: hsl(var(--destructive) / .12); border-color: hsl(var(--destructive) / .5); color: hsl(var(--destructive)); }
.flash-warning { background: hsl(var(--status-warning) / .12); border-color: hsl(var(--status-warning) / .5); color: hsl(var(--status-warning)); }
.flash-info    { background: hsl(var(--primary) / .12); border-color: hsl(var(--primary) / .5); color: hsl(var(--primary)); }

/* Badges and status */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.4;
  border: 1px solid hsl(var(--border)); background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}
.badge .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.badge.status-online  { background: hsl(var(--status-online) / .12);  color: hsl(var(--status-online));  border-color: hsl(var(--status-online) / .4); }
.badge.status-offline { background: hsl(var(--status-offline) / .12); color: hsl(var(--status-offline)); border-color: hsl(var(--status-offline) / .4); }
.badge.status-unknown { background: hsl(var(--status-unknown) / .12); color: hsl(var(--status-unknown)); border-color: hsl(var(--status-unknown) / .4); }
.badge.pulse .dot { animation: pulse-status 1.6s ease-in-out infinite; }
.badge-primary { background: hsl(var(--primary) / .15); color: hsl(var(--primary)); border-color: hsl(var(--primary) / .4); }
.badge-danger  { background: hsl(var(--destructive) / .15); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / .4); }
.badge-warning { background: hsl(var(--status-warning) / .15); color: hsl(var(--status-warning)); border-color: hsl(var(--status-warning) / .4); }
.badge-ok      { background: hsl(var(--status-online) / .15); color: hsl(var(--status-online)); border-color: hsl(var(--status-online) / .4); }

@keyframes pulse-status { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.dot-lg { width: 12px; height: 12px; border-radius: 999px; display: inline-block; flex: 0 0 auto; }
.bg-online  { background: hsl(var(--status-online)); }
.bg-offline { background: hsl(var(--status-offline)); }
.bg-unknown { background: hsl(var(--status-unknown)); }
.t-online   { color: hsl(var(--status-online)); }
.t-offline  { color: hsl(var(--status-offline)); }
.t-unknown  { color: hsl(var(--status-unknown)); }

/* Stat cards */
.stat {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px); padding: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.stat .label { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); font-weight: 500; }
.stat .value { font-size: 1.875rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .sub { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.stat .badge-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: hsl(var(--primary) / .12); color: hsl(var(--primary));
}
.stat.online  .badge-icon { background: hsl(var(--status-online) / .14);  color: hsl(var(--status-online)); }
.stat.offline .badge-icon { background: hsl(var(--status-offline) / .14); color: hsl(var(--status-offline)); }
.stat.warning .badge-icon { background: hsl(var(--status-warning) / .14); color: hsl(var(--status-warning)); }

/* Device cards */
.device-card {
  position: relative; display: block;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px); padding: 16px 16px 14px;
  color: inherit; text-decoration: none; overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.device-card:hover { border-color: hsl(var(--primary) / .55); box-shadow: var(--shadow-card); text-decoration: none; }
.device-card.paused { opacity: .6; }
.device-card .strip { position: absolute; inset: 0 0 auto 0; height: 3px; }
.device-card .strip.online  { background: hsl(var(--status-online)); }
.device-card .strip.offline { background: hsl(var(--status-offline)); }
.device-card .strip.unknown { background: hsl(var(--status-unknown)); }
.device-card .dc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.device-card .dc-id { display: flex; gap: 12px; min-width: 0; flex: 1 1 auto; align-items: center; }
/* The name column must be allowed to shrink so its text truncates instead of
   pushing into the status badge. The wrapping span holds the name and IP. */
.device-card .dc-id > span:last-child { display: block; min-width: 0; flex: 1 1 auto; }
/* The badge group keeps its natural width and never shrinks. */
.device-card .dc-top > .row { flex: 0 0 auto; }
.device-card .dc-icon {
  width: 40px; height: 40px; border-radius: var(--radius); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.device-card .dc-icon.online  { background: hsl(var(--status-online) / .14);  color: hsl(var(--status-online)); }
.device-card .dc-icon.offline { background: hsl(var(--status-offline) / .14); color: hsl(var(--status-offline)); }
.device-card .dc-icon.unknown { background: hsl(var(--status-unknown) / .14); color: hsl(var(--status-unknown)); }
.device-card .dc-name { display: block; font-weight: 600; }
.device-card .dc-ip { display: block; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.device-card .dc-meta {
  margin-top: 14px; padding-top: 11px; border-top: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.75rem; color: hsl(var(--muted-foreground));
}
.device-card .dc-meta .row { gap: 5px; }
.spark { display: block; width: 100%; height: 30px; margin-top: 10px; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data th {
  text-align: left; font-weight: 600; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: .04em;
  color: hsl(var(--muted-foreground));
  padding: 10px 12px; border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap; background: hsl(var(--muted) / .5);
}
table.data td { padding: 11px 12px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: hsl(var(--muted) / .45); }
table.data .actions { display: flex; gap: 4px; justify-content: flex-end; }

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 54px 20px; text-align: center;
  border: 1px dashed hsl(var(--border)); border-radius: calc(var(--radius) + 2px);
  color: hsl(var(--muted-foreground));
}
.empty .ico { width: 40px; height: 40px; opacity: .45; margin-bottom: 12px; }
.empty h3 { color: hsl(var(--foreground)); margin-bottom: 5px; }

/* Alert banner */
.alert-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; margin-bottom: 20px;
  border: 1px solid hsl(var(--status-offline) / .55);
  background: hsl(var(--status-offline) / .1);
  color: hsl(var(--status-offline));
  border-radius: calc(var(--radius) + 2px);
  font-weight: 600;
}
.alert-banner .ico { width: 24px; height: 24px; animation: pulse-status 1.8s ease-in-out infinite; }

/* Progress bar */
.progress { height: 8px; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; margin-top: 7px; }
.progress > span { display: block; height: 100%; background: hsl(var(--primary)); border-radius: 999px; }
.progress.good > span { background: hsl(var(--status-online)); }
.progress.bad  > span { background: hsl(var(--status-offline)); }

/* Check strip */
.check-strip { display: flex; gap: 2px; height: 34px; }
.check-strip i { flex: 1 1 0; border-radius: 2px; min-width: 2px; }
.check-strip i.online  { background: hsl(var(--status-online)); }
.check-strip i.offline { background: hsl(var(--status-offline)); }

/* Chart */
.chart-wrap { width: 100%; overflow: hidden; }
.chart { width: 100%; height: 220px; display: block; }

/* Timeline list rows */
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border: 1px solid hsl(var(--border));
  border-radius: var(--radius); margin-bottom: 8px;
}
.list-row:last-child { margin-bottom: 0; }
.list-row.ongoing { border-color: hsl(var(--status-offline) / .5); background: hsl(var(--status-offline) / .06); }
.scroll-box { max-height: 420px; overflow-y: auto; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  padding: 20px; background: hsl(0 0% 0% / .6);
}
.modal.open { display: flex; }
.modal-panel {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-pop);
}
.modal-panel.wide { max-width: 760px; }
.modal-head { padding: 18px 20px 6px; }
.modal-head h2 { margin-bottom: 4px; }
.modal-body { padding: 14px 20px; }
.modal-foot {
  padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end;
  flex-wrap: wrap;
}

/* Code blocks */
pre.code {
  background: hsl(var(--muted)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 12px;
  font-size: 0.75rem; overflow: auto; max-height: 340px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; margin: 0;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 0.875rem; }
.kv dt { color: hsl(var(--muted-foreground)); }
.kv dd { margin: 0; }

details.log-row summary { cursor: pointer; list-style: none; }
details.log-row summary::-webkit-details-marker { display: none; }

/* Auth pages */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px); padding: 28px;
  box-shadow: var(--shadow-card);
}
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo img { max-height: 76px; max-width: 100%; object-fit: contain; }

/* ---------------------------------------------------------------- */
/* Screen view (wallboard)                                           */
/* ---------------------------------------------------------------- */

body.bare { background: hsl(var(--background)); }

.screen { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.screen-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; border-bottom: 1px solid hsl(var(--border)); flex: 0 0 auto;
}
.screen-head .brand { display: flex; align-items: center; gap: 16px; }
.screen-head img { height: 48px; width: auto; object-fit: contain; }
.screen-head h1 { font-size: 1.75rem; }
.screen-head .meta { color: hsl(var(--muted-foreground)); font-size: 0.9375rem; }
.screen-controls { display: flex; gap: 6px; opacity: .35; transition: opacity .2s ease; }
.screen-controls:hover { opacity: 1; }

.screen-tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  padding: 18px 28px; flex: 0 0 auto;
}
.tile {
  border: 2px solid hsl(var(--border)); border-radius: 16px; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: hsl(var(--card));
}
.tile .label { font-size: 0.875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.tile .value { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.tile.online  { background: hsl(var(--status-online) / .1);  border-color: hsl(var(--status-online));  color: hsl(var(--status-online)); }
.tile.offline { background: hsl(var(--status-offline) / .1); border-color: hsl(var(--status-offline)); color: hsl(var(--status-offline)); }
.tile.warning { background: hsl(var(--status-warning) / .1); border-color: hsl(var(--status-warning)); color: hsl(var(--status-warning)); }

.screen-banner {
  margin: 0 28px 14px; padding: 16px 22px; border-radius: 14px;
  border: 2px solid hsl(var(--status-offline)); background: hsl(var(--status-offline) / .1);
  color: hsl(var(--status-offline)); font-size: 1.25rem; font-weight: 700;
  display: flex; align-items: center; gap: 14px; flex: 0 0 auto;
}
.screen-banner .ico { width: 32px; height: 32px; animation: pulse-status 1.6s ease-in-out infinite; }

.screen-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.screen-scroll::-webkit-scrollbar { display: none; }
.screen-grid {
  display: grid; gap: 14px; padding: 0 28px 28px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.screen-device {
  border: 2px solid hsl(var(--border)); border-radius: 16px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px; min-height: 148px;
  background: hsl(var(--card));
}
.screen-device.online  { background: hsl(var(--status-online) / .08);  border-color: hsl(var(--status-online)); }
.screen-device.offline { background: hsl(var(--status-offline) / .08); border-color: hsl(var(--status-offline)); animation: pulse-status 2.4s ease-in-out infinite; }
.screen-device.unknown { background: hsl(var(--status-unknown) / .08); border-color: hsl(var(--status-unknown)); }
.screen-device .sd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.screen-device .sd-status { font-size: 0.6875rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.screen-device .sd-name { font-size: 1.0625rem; font-weight: 700; line-height: 1.25; word-break: break-word; }
.screen-device .sd-ip { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.screen-device .sd-foot { margin-top: auto; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.screen-device .sd-down { font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .screen-tiles { grid-template-columns: repeat(2, 1fr); padding: 14px 16px; }
  .screen-head { padding: 12px 16px; }
  .screen-head h1 { font-size: 1.25rem; }
  .screen-grid { padding: 0 16px 16px; }
  .screen-banner { margin: 0 16px 12px; font-size: 1rem; }
}

/* Print */
@media print {
  .sidebar, .topbar, .foot, .head-actions, .backdrop { display: none !important; }
  .main { margin-left: 0; }
}
