:root {
  color-scheme: light;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --text: #182033;
  --muted: #667085;
  --line: #dbe3ef;
  --brand: #0f6b78;
  --brand-strong: #0a4c55;
  --brand-soft: #e5f3f4;
  --accent: #7357d5;
  --ok: #16845b;
  --warn: #a95d12;
  --danger: #b93434;
  --shadow: 0 18px 48px rgba(24, 32, 51, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
.primary { background: var(--brand); color: white; }
.primary:hover { background: var(--brand-strong); }
.secondary { background: #edf2f7; color: var(--text); }
.danger { background: #ffe7e7; color: var(--danger); }
.danger:hover { background: #ffd8d8; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.wide { width: 100%; }
.small { padding: 7px 10px; font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: white;
  color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 460px);
  background: radial-gradient(circle at 18% 18%, #e7f4f5, transparent 34%), var(--bg);
}
.login-aside {
  padding: 56px;
  display: grid;
  align-content: center;
  gap: 16px;
  max-width: 760px;
}
.login-aside h2 { font-size: clamp(32px, 5vw, 58px); line-height: 1.02; max-width: 680px; }
.login-aside p { color: var(--muted); font-size: 18px; max-width: 560px; line-height: 1.6; }
.login form {
  margin: auto 42px auto 0;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 16px;
}
.logo-lockup { display: flex; align-items: center; gap: 12px; }
.logo-lockup h1 { font-size: 24px; }
.logo-lockup.compact { padding: 18px 16px; }
.logo-lockup.compact div:last-child { display: grid; gap: 2px; }
.logo-lockup.compact span { color: var(--muted); font-size: 13px; }
.logo-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 900;
}
.field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; text-align: center; }
.error { color: var(--danger); font-size: 14px; }
.muted { color: var(--muted); }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}
nav { padding: 8px; display: grid; align-content: start; gap: 6px; }
nav button {
  background: transparent;
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 12px;
}
nav button span { color: var(--muted); font-size: 12px; font-weight: 500; }
nav button.active { background: var(--brand-soft); color: var(--brand-strong); }
nav button.active span { color: var(--brand-strong); }
.user-card {
  margin: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
}
.user-card div:last-child { display: grid; gap: 2px; min-width: 0; }
.user-card span { color: var(--muted); font-size: 12px; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f1ecff;
  color: var(--accent);
  font-weight: 900;
}
.main { min-width: 0; }
header {
  min-height: 86px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 18px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 3;
}
.content { padding: 24px; display: grid; gap: 18px; align-content: start; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card, .org-card, .table-wrap, .ticket-row, .empty, dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.stat-card { padding: 16px; display: grid; gap: 6px; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-size: 30px; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.toolbar > div { display: grid; gap: 4px; }
.toolbar-actions { display: flex !important; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ticket-list { display: grid; gap: 10px; }
.ticket-row {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}
.ticket-main { display: grid; gap: 8px; min-width: 0; }
.ticket-main p {
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ticket-topline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.unread-badge {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #e02424;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 6px 14px rgba(224, 36, 36, .2);
}
.chat-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.button-unread-badge {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  color: #e02424;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 950;
}
.meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta span:not(:last-child)::after { content: ""; }
.status, .priority {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: #edf1f7;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}
.status.new { background: #fff1da; color: var(--warn); }
.status.in_progress { background: #e5f2ff; color: #1264a3; }
.status.connecting { background: #dff8fb; color: #0d7480; }
.status.waiting_client { background: #f1ecff; color: var(--accent); }
.status.resolved, .status.closed { background: #e3f5ec; color: var(--ok); }
.status.not_ours { background: #f1f5f9; color: #526070; }
.priority.high, .priority.urgent { background: #ffe7e7; color: var(--danger); }
.org-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.org-card { padding: 16px; display: grid; gap: 14px; align-content: start; }
.org-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 900;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-size: 12px; font-weight: 900; background: var(--panel-soft); text-transform: uppercase; }
.devices-table td { white-space: nowrap; }
.devices-table td:nth-child(2) { font-weight: 900; color: var(--text); }
.devices-table td:nth-child(6) { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.devices-table td:last-child { text-align: right; }
.device-actions { display: flex; justify-content: flex-end; gap: 8px; }
.org-device-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.org-device-item {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 13px;
  display: grid;
  gap: 5px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.org-device-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.org-device-item.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}
.org-device-item.active span { color: var(--brand-strong); }
.org-workspace .toolbar .ghost { width: max-content; }
.org-tabs {
  display: inline-flex;
  width: max-content;
  background: #edf2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}
.org-tabs button {
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 9px 14px;
}
.org-tabs button.active {
  background: white;
  color: var(--brand-strong);
  box-shadow: 0 4px 14px rgba(24, 32, 51, .08);
}
.org-tab-panel {
  display: grid;
  gap: 14px;
}
.monitoring-grid {
  grid-template-columns: 1fr;
}
.monitor-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.monitor-log-list {
  display: grid;
  gap: 8px;
}
.monitor-log {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 11px 12px;
  display: grid;
  gap: 3px;
  background: white;
}
.monitor-log.warning { border-left-color: var(--warn); background: #fffaf0; }
.monitor-log.critical { border-left-color: var(--danger); background: #fffafa; }
.monitor-log span, .monitor-log small { color: var(--muted); font-size: 12px; }
.portal-links-editor {
  display: grid;
  gap: 10px;
}
.portal-link-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(260px, 1.5fr) 140px auto;
  gap: 10px;
  align-items: end;
}
.topology-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.topology-input { min-height: 54px; }
.topology-chain {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 2px 4px;
}
.topology-node {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 4px;
  background: white;
  position: relative;
}
.topology-node::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  position: absolute;
  top: 10px;
  right: 10px;
}
.topology-node.online { border-color: rgba(22, 132, 91, .35); }
.topology-node.online::before { background: var(--ok); box-shadow: 0 0 0 6px rgba(22, 132, 91, .12); }
.topology-node.offline { border-color: rgba(185, 52, 52, .35); background: #fffafa; }
.topology-node.offline::before { background: var(--danger); box-shadow: 0 0 0 6px rgba(185, 52, 52, .10); }
.topology-node span, .topology-node small { color: var(--muted); font-size: 12px; font-weight: 800; }
.topology-link {
  min-width: 76px;
  height: 22px;
  position: relative;
  flex: 0 0 76px;
}
.topology-link::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 3px;
  border-radius: 999px;
  background: #c7d3e2;
}
.topology-link.active::before {
  background: linear-gradient(90deg, var(--ok), #8ee0bd, var(--ok));
  background-size: 200% 100%;
  animation: topology-flow 1.3s linear infinite;
}
.topology-link.broken::before {
  background: repeating-linear-gradient(90deg, var(--danger) 0 10px, transparent 10px 18px);
  height: 4px;
  animation: topology-alert .8s ease-in-out infinite alternate;
}
.topology-link.downstream::before { background: #e5e9f0; }
.topology-link span {
  position: absolute;
  inset: 0;
}
.topology-link.broken span::before,
.topology-link.broken span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 3px;
  background: var(--danger);
  top: 10px;
  left: calc(50% - 9px);
}
.topology-link.broken span::before { transform: rotate(45deg); }
.topology-link.broken span::after { transform: rotate(-45deg); }
@keyframes topology-flow {
  from { background-position: 0 0; }
  to { background-position: 200% 0; }
}
@keyframes topology-alert {
  from { opacity: .55; }
  to { opacity: 1; }
}
.network-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.network-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  flex-wrap: wrap;
}
.network-now { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.network-now span {
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
}
.network-chart { width: 100%; height: 190px; display: block; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 8px; }
.chart-axis { stroke: #c7d3e2; stroke-width: 1; }
.chart-line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.rx { stroke: var(--brand); }
.chart-line.tx { stroke: var(--accent); }
.chart-empty { fill: var(--muted); font-size: 15px; font-weight: 800; }
.speedtest-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  background: white;
}
.speedtest-panel > div:first-child { display: grid; gap: 3px; }
.speedtest-values { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.speedtest-values span {
  border-radius: 999px;
  background: #edf2f7;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
}
.device-filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(160px, .7fr) minmax(180px, .9fr) auto;
  gap: 10px;
  align-items: end;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.empty { padding: 36px; display: grid; gap: 8px; text-align: center; }
.modal-body { display: grid; gap: 14px; width: min(780px, calc(100vw - 32px)); }
dialog { border: 0; padding: 20px; }
dialog::backdrop { background: rgba(24, 32, 51, .42); }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.description-box { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 8px; padding: 14px; line-height: 1.5; white-space: pre-wrap; }
.form-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.align-end { align-self: end; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 4px; background: #fff; }
.comment span { color: var(--muted); font-size: 12px; }
.comment p { color: var(--text); }
.ticket-page .toolbar > div:first-child { gap: 10px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.ticket-device-status { display: flex; justify-content: flex-start; }
.main-detail { min-width: 0; }
.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.info-item {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.info-item span { color: var(--muted); font-size: 12px; font-weight: 800; }
.info-item strong { overflow-wrap: anywhere; }
.form-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.webhook-box {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 11px;
}
.webhook-box code {
  font-family: Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  color: var(--brand-strong);
}
.stack { display: grid; gap: 10px; }
.timeline { display: grid; gap: 10px; }
.timeline-item {
  position: relative;
  border-left: 3px solid var(--brand);
  padding: 8px 0 8px 12px;
  display: grid;
  gap: 4px;
}
.timeline-item span { color: var(--muted); font-size: 12px; }
.timeline-item p { color: var(--muted); }
.attachment {
  color: var(--brand-strong);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
  font-weight: 800;
}
.attachment:hover { border-color: var(--brand); }
.web-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(24, 32, 51, .46);
  display: grid;
  place-items: center;
  padding: 20px;
}
.web-chat-modal {
  width: min(760px, 100%);
  height: min(760px, calc(100vh - 40px));
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(24, 32, 51, .24);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
}
.web-chat-head {
  padding: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}
.web-chat-messages {
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.web-chat-empty {
  margin: auto;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 20px;
}
.web-chat-message {
  max-width: 78%;
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  box-shadow: 0 8px 18px rgba(24, 32, 51, .05);
}
.web-chat-message.client {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
}
.web-chat-message.mine {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
}
.web-chat-message span { font-size: 12px; font-weight: 900; opacity: .82; }
.web-chat-message p { white-space: pre-wrap; line-height: 1.45; }
.web-chat-message small { font-size: 11px; opacity: .72; }
.web-chat-compose {
  padding: 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.web-chat-input {
  min-height: 46px;
  max-height: 130px;
}
.web-chat-modal > .error {
  background: var(--panel);
  padding: 0 12px 12px;
}
.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.device-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
}
.device-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.device-head > div { display: grid; gap: 4px; min-width: 0; }
.agent-status {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}
.agent-status.online { background: #e3f5ec; color: var(--ok); }
.agent-status.offline { background: #ffe7e7; color: var(--danger); }
.device-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.dashboard-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(24, 32, 51, .04);
  min-height: 240px;
}
.donut-chart { width: 100%; height: 190px; }
.donut-bg {
  fill: none;
  stroke: #edf2f7;
  stroke-width: 18;
}
.donut-segment {
  fill: none;
  stroke-width: 18;
  transform: rotate(-90deg);
  transform-origin: 70px 70px;
  transition: stroke-dasharray .3s ease;
}
.donut-total {
  fill: var(--text);
  font-size: 24px;
  font-weight: 900;
}
.chart-legend {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.bar-chart {
  display: grid;
  gap: 14px;
  align-content: center;
}
.bar-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
}
.bar-row span { color: var(--muted); font-weight: 800; }
.bar-track {
  height: 14px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
}
.compact-timeline .timeline-item { padding-top: 4px; padding-bottom: 4px; }
.helpdesk-grid {
  grid-template-columns: 1fr;
}
.server-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.log-rules-editor {
  display: grid;
  gap: 10px;
}
.log-rule-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 160px minmax(180px, 1fr) 140px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

@media (max-width: 1020px) {
  .stats, .org-grid, .device-grid, .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .speedtest-panel { grid-template-columns: 1fr; }
  .portal-link-row, .log-rule-row, .server-settings-grid, .settings-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 780px) {
  .login { grid-template-columns: 1fr; }
  .login-aside { padding: 28px; }
  .login form { margin: 0 20px 28px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; grid-template-rows: auto auto; }
  .sidebar .user-card { display: none; }
  nav { grid-auto-flow: column; overflow-x: auto; }
  nav button { min-width: 160px; }
  header { position: static; }
  .stats, .org-grid { grid-template-columns: 1fr; }
  .device-grid, .device-info { grid-template-columns: 1fr; }
  .device-filters, .org-device-list { grid-template-columns: 1fr; }
  .portal-link-row, .log-rule-row, .server-settings-grid, .settings-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .ticket-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.two, .info-grid { grid-template-columns: 1fr; }
}
