:root {
  color-scheme: light;
  --brand: #3F6F63;
  --brand-dark: #2F5B51;
  --action: #2F7D32;
  --ink: #1D2D2A;
  --muted: #61736E;
  --line: #D8E5DE;
  --background: #F7FAF8;
  --soft: #F7FAF8;
  --panel: #FFFFFF;
  --soft-accent: #E8F5E9;
  --nav: #1D2D2A;
  --nav-active: #2F5B51;
  --blue: #2F7D32;
  --green: #2F7D32;
  --yellow: #d99a00;
  --red: #ca3b35;
  --danger-soft: #ffecea;
  --danger-text: #a5322d;
  --table-row-alt: #F2F7F4;
  --table-selected: #E8F5E9;
  --focus-line: #9FD5A2;
  --shadow: rgba(29, 45, 42, 0.14);
  --shadow-soft: rgba(63, 111, 99, 0.14);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --brand: #7BC67F;
    --brand-dark: #9FD5A2;
    --action: #7BC67F;
    --ink: #E5E7EB;
    --muted: #9CA3AF;
    --line: #374151;
    --background: #0B1220;
    --soft: #0B1220;
    --panel: #111827;
    --soft-accent: #24452A;
    --nav: #0B1220;
    --nav-active: #24452A;
    --blue: #9FD5A2;
    --green: #7BC67F;
    --danger-soft: #452727;
    --danger-text: #fca5a5;
    --table-row-alt: #162132;
    --table-selected: #24452A;
    --focus-line: #9FD5A2;
    --shadow: rgba(0, 0, 0, 0.32);
    --shadow-soft: rgba(123, 198, 127, 0.16);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.nav-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #fff;
  padding: 16px 12px;
}

@media (min-width: 820px) {
  .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100dvh;
  }
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-collapsed .brand {
  justify-content: center;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
  flex: 0 0 auto;
}

.panel-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
}

.nav-toggle {
  margin-left: auto;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-collapsed .brand-copy,
.nav-collapsed .sidebar-foot span {
  display: none;
}

.nav-collapsed .nav-toggle {
  margin-left: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 20px;
  letter-spacing: 0;
}

.brand span {
  color: #c7cfdd;
  font-size: 12px;
}

.main-nav {
  display: grid;
  gap: 6px;
  margin-top: 26px;
}

.nav-item {
  position: relative;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #d9e2f2;
  padding: 12px 14px;
  text-align: left;
}

.nav-icon {
  display: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-collapsed .nav-item {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0;
  font-size: 0;
}

.nav-collapsed .nav-icon {
  display: block;
}

.nav-collapsed .nav-label {
  display: none;
}

.nav-collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 20;
  min-width: max-content;
  max-width: 220px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 6px;
  padding: 8px 10px;
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(4px, -50%);
  transition: opacity 120ms ease, transform 120ms ease;
}

.nav-collapsed .nav-item:hover::after,
.nav-collapsed .nav-item:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.nav-item.active,
.nav-item:hover {
  background: var(--nav-active);
  color: #fff;
}

.sidebar-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  color: #c7cfdd;
  font-size: 13px;
}

.sidebar-foot a {
  color: #fff;
}

.logout-link {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.logout-link:hover,
.logout-link:focus-visible {
  background: var(--nav-active);
}

.logout-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-collapsed .sidebar-foot {
  justify-content: center;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 520px) auto;
  align-items: center;
  gap: 18px;
  min-height: 65px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.top-title strong,
.top-title span {
  display: block;
}

.top-title span {
  color: var(--muted);
  font-size: 12px;
}

.global-search {
  position: relative;
}

.global-search span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
}

.global-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px 0 66px;
}

.top-actions,
.toolbar,
.drawer-actions,
.modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 8px 14px;
  text-decoration: none;
}

.primary-button {
  border-color: var(--action);
  background: var(--action);
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  background: var(--panel);
  color: var(--ink);
}

.danger-button {
  background: var(--panel);
  border-color: var(--red);
  color: var(--red);
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 360px;
  min-height: 0;
}

.detail-collapsed .content-grid {
  grid-template-columns: 220px minmax(0, 1fr);
}

.group-panel,
.main-panel,
.detail-panel {
  min-width: 0;
  overflow: auto;
}

.group-panel {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 12px;
}

.group-search {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

.group-list {
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

.group-item {
  display: flex;
  justify-content: space-between;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
}

.group-item.active,
.group-item:hover {
  background: var(--soft-accent);
  color: var(--action);
}

.main-panel {
  background: var(--soft);
  padding: 26px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.view-heading h2,
.view-heading p {
  margin: 0;
}

.device-list-heading {
  display: grid;
  justify-content: stretch;
  align-items: start;
  gap: 10px;
}

.view-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.device-list-heading .toolbar {
  justify-content: flex-start;
}

.view-heading p,
.connect-card p,
.download-card p {
  color: var(--muted);
}

.support-layout {
  display: grid;
  gap: 18px;
}

.connect-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px;
}

.connect-card > * {
  min-width: 0;
}

.eyebrow {
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 13px;
}

.connect-card h1 {
  margin: 0;
  font-size: 32px;
}

.connect-form,
.device-modal {
  display: grid;
  gap: 12px;
}

.quick-connect-fields,
.quick-connect-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

label input,
label select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--ink);
  background: var(--panel);
}

textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 12px;
}

.metric,
.download-card,
.settings-panel,
.customer-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric {
  padding: 16px;
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  margin-top: 8px;
  font-size: 28px;
}

.device-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: auto;
}

.device-table {
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

.device-table th,
.device-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
  vertical-align: middle;
}

.device-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.device-table.measure-columns {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  table-layout: auto;
  width: max-content;
  max-width: none;
}

.device-table.measure-columns .th-resize-wrap {
  width: max-content;
}

.device-table .col-group,
.device-table td:nth-child(5) {
  text-align: left;
}

.th-resize-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 18px;
  padding-right: 10px;
}

.column-resizer {
  position: absolute;
  top: -9px;
  right: -10px;
  bottom: -9px;
  z-index: 2;
  width: 12px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 5px;
  bottom: 8px;
  width: 1px;
  background: transparent;
}

.column-resizer:hover::after,
.resizing-columns .column-resizer::after {
  background: var(--brand);
}

.resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.device-table td:nth-child(3),
.device-table td:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sort-header {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  text-transform: uppercase;
  font-size: inherit;
  font-weight: 800;
}

.sort-header:hover,
.sort-header:focus-visible {
  color: var(--brand);
}

.device-table tbody tr {
  background: var(--panel);
}

.device-table tbody tr:nth-child(2n) {
  background: var(--table-row-alt);
}

.device-table tbody tr.selected {
  background: var(--table-selected);
}

.device-table td strong {
  display: inline;
}

.ready-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--soft-accent);
  color: var(--action);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.status {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0;
  border-radius: 99px;
  background: var(--muted);
}

.status.online {
  background: var(--green);
}

.status.idle {
  background: var(--yellow);
}

.status.offline {
  background: var(--red);
}

.status.unknown {
  background: var(--muted);
}

.health-list-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--muted);
}

.health-list-dot.green {
  background: var(--green);
}

.health-list-dot.yellow {
  background: var(--yellow);
}

.health-list-dot.red {
  background: var(--red);
}

.copy-link,
.connect-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
}

.copy-link {
  white-space: nowrap;
}

.platform-pill {
  display: inline-grid;
  place-items: center;
  min-width: 70px;
  height: 24px;
  border-radius: 99px;
  background: var(--soft-accent);
  color: var(--brand-dark);
  font-weight: 700;
}

.detail-panel {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
}

@media (min-width: 820px) {
  .detail-panel {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    max-height: 100dvh;
  }
}

.detail-collapsed .detail-panel {
  display: none;
}

.drawer-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.detail-close {
  margin-left: auto;
  flex: 0 0 auto;
}

.drawer-head h2,
.drawer-head p {
  margin: 0;
}

.drawer-head p {
  color: var(--muted);
}

.icon-device {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand);
  font-weight: 900;
}

.drawer-actions {
  margin: 20px 0;
}

.drawer-section {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.drawer-section.warning {
  border: 0;
  border-radius: var(--radius);
  background: var(--soft-accent);
  padding: 14px;
}

.note-panel {
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--soft-accent);
  margin: 18px 0;
  padding: 14px;
}

.drawer-section h3 {
  margin: 0 0 12px;
}

.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.note-head h3 {
  margin: 0;
}

.text-action {
  border: 0;
  background: transparent;
  color: var(--action);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 0;
}

.text-action:hover,
.text-action:focus-visible {
  color: var(--brand-dark);
  text-decoration: underline;
}

.device-note {
  margin: 10px 0 0;
  line-height: 1.4;
  white-space: pre-wrap;
}

.note-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.edit-device-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 12px;
  margin-bottom: 14px;
}

.device-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.edit-device-form label {
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.edit-device-form label input,
.edit-device-form label select {
  min-height: 36px;
}

.detail-row,
.settings-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
}

.detail-row span,
.settings-list span {
  color: var(--muted);
}

.health-details {
  display: grid;
  gap: 12px;
}

.health-details summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  list-style: none;
}

.health-details summary::-webkit-details-marker {
  display: none;
}

.health-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.health-state .health-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--muted);
}

.health-state.green {
  color: var(--green);
}

.health-state.green .health-dot {
  background: var(--green);
}

.health-state.yellow {
  color: var(--yellow);
}

.health-state.yellow .health-dot {
  background: var(--yellow);
}

.health-state.red {
  color: var(--red);
}

.health-state.red .health-dot {
  background: var(--red);
}

.health-grid {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.health-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  font-size: 14px;
}

.health-row span {
  color: var(--muted);
}

.health-warnings {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.health-warnings p {
  border-left: 3px solid var(--yellow);
  background: var(--soft);
  margin: 0;
  padding: 8px 10px;
}

.mini-notes p {
  border-radius: var(--radius);
  background: var(--soft);
  padding: 10px;
}

.full {
  width: 100%;
  justify-content: center;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.download-card,
.customer-card,
.settings-panel {
  padding: 16px;
}

.download-card span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.download-card strong,
.download-card code,
.customer-card strong,
.customer-card span {
  display: block;
  margin-top: 8px;
}

.customer-card {
  text-align: left;
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
  text-align: left;
}

.activity-item strong,
.activity-item span {
  display: block;
}

.activity-item span {
  margin-top: 4px;
  color: var(--muted);
}

.settings-stack {
  display: grid;
  gap: 14px;
  max-width: 920px;
}

.settings-panel {
  max-width: 920px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.settings-form-head h2,
.settings-form-head p {
  margin: 0;
}

.settings-form-head p {
  margin-top: 4px;
  color: var(--muted);
}

.settings-status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.settings-status.enabled {
  background: var(--soft-accent);
  color: var(--action);
}

.settings-status.pending {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top left, var(--soft-accent), transparent 36%), var(--soft);
}

.login-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 18px 50px var(--shadow);
}

.login-brand {
  margin-bottom: 22px;
}

.login-error {
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger-text);
  padding: 10px 12px;
  margin: 12px 0;
}

.login-message {
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 12px 0;
}

.login-message.error {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.login-message.success {
  background: var(--soft-accent);
  color: var(--action);
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card .secondary-form {
  margin-top: 10px;
}

.login-link {
  margin: 14px 0 0;
  font-size: 13px;
}

.login-link a {
  color: var(--brand);
  font-weight: 800;
}

.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  line-height: 1.25;
}

.inline-check input {
  width: auto;
  min-width: auto;
  min-height: auto;
  margin: 0;
  flex: 0 0 auto;
}

.client-download-page {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--panel) 0, var(--soft) 100%);
  padding: 34px 18px;
}

.client-download-shell {
  width: min(840px, 100%);
  margin: 0 auto;
}

.client-download-brand {
  margin-bottom: 34px;
}

.client-download-brand span {
  color: var(--muted);
}

.client-download-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.client-download-heading h1,
.client-download-heading p {
  margin: 0;
}

.client-download-heading h1 {
  font-size: 20px;
  line-height: 1.1;
}

.detected-label {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft-accent);
  color: var(--action);
  padding: 8px 10px;
  font-size: 13px;
}

.download-code-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  margin: 18px 0;
}

.client-download-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.client-download-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 0;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 28px var(--shadow-soft);
  overflow: hidden;
}

.client-download-card > div:first-child {
  min-width: 0;
  padding: 18px;
}

.client-download-card:hover,
.client-download-card:focus-within {
  border-color: var(--brand);
}

.client-download-card[data-card-download] {
  cursor: pointer;
}

.client-download-card[data-card-download]:focus-visible {
  border-color: var(--brand);
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.client-download-card > div:first-child > span {
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.client-download-card h2,
.client-download-card p {
  margin: 6px 0 0;
}

.client-download-card h2 {
  font-size: 18px;
  line-height: 1.15;
}

.client-download-card p,
.client-download-note {
  color: var(--muted);
}

.client-download-actions {
  display: grid;
  align-content: center;
  align-self: stretch;
  border-left: 1px solid var(--line);
  gap: 10px;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  padding: 18px 12px;
}

.client-download-action {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.client-download-action.primary {
  grid-row: 2;
}

.client-download-action.secondary {
  align-self: end;
  grid-row: 3;
}

.client-download-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.client-download-link {
  color: var(--brand);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.client-download-link:hover,
.client-download-link:focus-visible {
  color: var(--brand-dark);
  text-decoration: underline;
}

.client-download-link.disabled {
  cursor: default;
  opacity: 0.55;
  pointer-events: none;
}

.client-download-note {
  margin: 16px 0 0;
  font-size: 14px;
}

.mobile-console {
  min-height: 100vh;
  background: var(--soft);
  padding: 14px;
}

.mobile-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--soft) 96%, transparent);
  padding: 4px 0 12px;
}

.mobile-top .brand strong {
  font-size: 18px;
}

.mobile-mini-button {
  min-width: 62px;
  text-align: center;
}

.mobile-search-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.mobile-search-panel input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 0 13px;
}

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.mobile-tabs button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-height: 38px;
  color: var(--ink);
  font-weight: 700;
}

.mobile-tabs button.active {
  border-color: var(--action);
  background: var(--action);
  color: #fff;
}

.mobile-status {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.mobile-device-list {
  display: grid;
  gap: 10px;
  padding-bottom: 32px;
}

.mobile-device-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px;
}

.mobile-device-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.mobile-device-head h2,
.mobile-device-head p {
  margin: 0;
}

.mobile-device-head h2 {
  font-size: 17px;
  line-height: 1.2;
}

.mobile-device-head p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.mobile-id {
  margin-top: 11px;
  border-radius: var(--radius);
  background: var(--soft-accent);
  color: var(--blue);
  padding: 10px;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.mobile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mobile-meta span {
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--muted);
  padding: 5px 7px;
  font-size: 12px;
}

.mobile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.mobile-actions button {
  min-height: 44px;
}

.mobile-actions .open-rustdesk {
  grid-column: 1 / -1;
}

.mobile-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

.mobile-toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  transform: translateY(80px);
  opacity: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 12px;
  text-align: center;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.mobile-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(23, 32, 42, 0.36);
  padding: 18px;
}

.device-modal {
  width: min(520px, 100%);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
}

.modal-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.device-modal textarea {
  min-height: 150px;
}

.modal-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  box-shadow: 0 12px 32px var(--shadow);
}

.empty-state,
.empty-detail {
  color: var(--muted);
  padding: 20px;
}

@media (max-width: 819px) {
  .app-shell,
  .content-grid,
  .topbar,
  .connect-card,
  .metric-row,
  .settings-grid,
  .settings-grid.compact {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .client-download-list {
    grid-template-columns: 1fr;
  }

  .client-download-card,
  .download-code-form {
    grid-template-columns: 1fr;
  }

  .client-download-actions {
    border-left: 0;
    border-top: 1px solid var(--line);
    grid-template-rows: none;
    justify-items: start;
  }

  .client-download-action {
    grid-row: auto;
    justify-items: start;
  }

  .client-download-link {
    text-align: left;
    white-space: normal;
  }
}
