/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --bg: #eef2f7;
  --bg-soft: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #fbfdff;
  --text: #111827;
  --muted: #64748b;
  --line: #d8e0ea;
  --line-strong: #c3cedd;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e6f4f1;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #a15c07;
  --warn-soft: #fffbeb;
  --ok: #167647;
  --ok-soft: #ecfdf3;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.05);
  --shadow-md: 0 12px 30px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 24px 70px rgb(15 23 42 / 0.20);
  --phone-ratio: 9 / 19.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

.topbar {
  align-items: center;
  background: rgb(255 255 255 / 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 10px;
  font-weight: 800;
  margin-right: 10px;
}

.brand::before {
  background: linear-gradient(135deg, #0f766e, #2563eb);
  border-radius: 8px;
  content: "";
  display: inline-block;
  height: 28px;
  width: 28px;
}

.brand-with-logo::before {
  display: none;
}

.brand-logo {
  border-radius: 8px;
  display: inline-block;
  height: 28px;
  object-fit: contain;
  width: 28px;
}

.topnav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.topnav a,
.topnav .link-button {
  border-radius: 7px;
  color: #475569;
  font-size: 0.95rem;
  font-weight: 750;
  padding: 8px 10px;
}

.topnav a:hover,
.topnav a.active,
.topnav .link-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  text-decoration: none;
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.stat-card strong {
  font-size: 1.5rem;
}

.stat-card span {
  color: var(--muted);
  font-weight: 750;
}

.page {
  margin: 0 auto;
  max-width: none;
  padding: 22px;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 116px);
  place-items: center;
}

.auth-card {
  display: grid;
  gap: 18px;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

.auth-card h1 {
  margin: 0;
}

.activity-shell {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-height: calc(100vh - 108px);
  position: relative;
  overflow: hidden;
}

.activity-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 0;
  padding: 18px 22px 0;
}

.activity-tab {
  background: #eef2f7;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #475569;
  font-weight: 800;
  min-width: 108px;
  padding: 9px 18px;
  text-align: center;
}

.activity-tab.active {
  background: var(--accent);
  box-shadow: 0 8px 20px rgb(15 118 110 / 0.22);
  color: #fff;
  text-decoration: none;
}

.activity-tab:hover {
  text-decoration: none;
}

.activity-summary {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 26px 34px 0;
}

.activity-title {
  display: grid;
  gap: 4px;
}

.activity-title h1 {
  font-size: 1.65rem;
  margin: 0;
}

.activity-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  min-width: min(560px, 52vw);
}

.activity-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 2px;
  padding: 10px 12px;
}

.activity-kpi strong {
  font-size: 1.2rem;
}

.activity-kpi span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.activity-frame {
  padding: 28px 34px 34px;
}

.activity-device-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 190px));
}

.activity-device-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: grid;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.activity-device-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}

.activity-device-thumb {
  align-items: center;
  aspect-ratio: var(--phone-ratio);
  background:
    linear-gradient(#111827, #111827) top 12px center / 36px 4px no-repeat,
    radial-gradient(circle at top, #334155, #020617 68%);
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 3px #0f172a, inset 0 0 0 4px rgb(255 255 255 / 0.12);
  color: #cbd5e1;
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 22px 8px 14px;
}

.activity-device-thumb img {
  border-radius: 12px;
  height: calc(100% - 10px);
  object-fit: contain;
  width: calc(100% - 2px);
}

.activity-card-body {
  display: grid;
  gap: 6px;
  padding: 13px;
}

.activity-card-meta {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.activity-card-meta .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.activity-group-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 122px;
  overflow: hidden;
}

.activity-group-name {
  align-items: center;
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
  color: var(--text);
  display: grid;
  justify-content: center;
  padding: 16px;
  text-align: center;
  align-content: center;
  gap: 6px;
}

.activity-group-name:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.activity-group-devices {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 14px;
}

.activity-group-device {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 8px;
  min-width: 112px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.activity-group-device:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
  text-decoration: none;
}

.activity-group-device-thumb {
  align-items: center;
  aspect-ratio: var(--phone-ratio);
  background:
    linear-gradient(#111827, #111827) top 8px center / 26px 3px no-repeat,
    radial-gradient(circle at top, #334155, #020617 68%);
  border-radius: 13px;
  box-shadow: inset 0 0 0 2px #0f172a, inset 0 0 0 3px rgb(255 255 255 / 0.12);
  color: #cbd5e1;
  display: flex;
  font-size: 0.78rem;
  justify-content: center;
  overflow: hidden;
  padding: 16px 5px 9px;
  width: 96px;
}

.activity-group-device-thumb img {
  border-radius: 8px;
  height: calc(100% - 7px);
  object-fit: contain;
  width: calc(100% - 1px);
}

.activity-group-device-body {
  display: grid;
  gap: 4px;
  width: 96px;
}

.activity-group-device-body strong,
.activity-group-device-body .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-group-empty {
  align-self: center;
  padding: 0 8px;
}

.activity-new-group {
  justify-self: start;
  min-width: 160px;
  text-align: center;
}

.activity-overlay {
  background: rgb(15 23 42 / 0.46);
  backdrop-filter: blur(2px);
  inset: 0;
  padding: 28px;
  position: absolute;
  z-index: 5;
}

.activity-overlay-close {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow-md);
  color: var(--text);
  display: flex;
  font-size: 1rem;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  position: fixed;
  right: 42px;
  top: 102px;
  width: 34px;
  z-index: 6;
}

.activity-overlay-close:hover {
  text-decoration: none;
}

.activity-overlay-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  height: calc(100vh - 150px);
  min-height: 420px;
  overflow-y: auto;
  padding: 20px;
}

.detail-page {
  display: grid;
  gap: 16px;
}

.detail-page-nav {
  display: flex;
  justify-content: flex-start;
}

.detail-page-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-height: calc(100vh - 150px);
  overflow: visible;
  padding: 20px;
  position: relative;
}

.activity-device-overlay {
  position: relative;
}

.activity-device-overlay .operation-content {
  grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr);
}

.group-overlay-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.group-detail-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr);
}

.group-device-overview {
  align-content: start;
  display: grid;
  gap: 16px;
}

.group-operation-column {
  align-content: start;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.group-overview-devices {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}

.group-overview-device {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 8px;
}

.group-overview-device:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
  text-decoration: none;
}

.group-overlay-devices {
  display: grid;
  gap: 10px;
}

.group-overlay-device {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.group-overlay-device:hover {
  background: #f8fafc;
  text-decoration: none;
}

.group-task-create {
  display: grid;
  gap: 12px;
}

.group-task-create summary {
  cursor: pointer;
  display: inline-flex;
  list-style: none;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.flash {
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}

.notice {
  background: var(--ok-soft);
  color: var(--ok);
}

.alert {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.section-header h1 {
  font-size: 1.55rem;
  margin: 0;
}

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

.button,
button,
input[type="submit"] {
  appearance: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  text-decoration: none;
}

.button.secondary,
button.secondary,
input.secondary {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}

.button.secondary:hover,
button.secondary:hover,
input.secondary:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
  color: var(--text);
}

.button.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button.danger:hover,
button.danger:hover {
  background: #912018;
  border-color: #912018;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-weight: 600;
  padding: 0;
}

.device-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.thumb {
  align-items: center;
  aspect-ratio: 16 / 10;
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.thumb img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.card-body,
.panel {
  padding: 16px;
}

.device-title {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 6px;
}

.device-title h2 {
  font-size: 1.08rem;
  margin: 0;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 8px;
  text-transform: uppercase;
}

.status-online {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-offline,
.status-unknown {
  background: #f1f5f9;
  color: #475569;
}

.status-pending {
  background: var(--info-soft);
  color: var(--info);
}

.status-running {
  background: #fef3c7;
  color: #92400e;
}

.status-completed {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-canceled {
  background: #f1f5f9;
  color: #475569;
}

.warning {
  background: var(--warn-soft);
  border: 1px solid #fde68a;
  border-radius: 7px;
  color: var(--warn);
  margin-top: 10px;
  padding: 8px 10px;
}

.device-detail {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.device-workbench {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - 108px);
  min-height: 720px;
  overflow: hidden;
}

.group-workbench {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 108px);
  min-height: 640px;
  overflow: hidden;
}

.device-sidebar {
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.group-sidebar {
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.sidebar-header h1,
.operation-header h1,
.empty-state h1 {
  font-size: 1.35rem;
  margin: 0;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.compact {
  font-size: 0.9rem;
  padding: 6px 10px;
}

.device-list {
  display: grid;
  min-height: 0;
  overflow-y: auto;
}

.group-list {
  display: grid;
  min-height: 0;
  overflow-y: auto;
}

.device-row {
  border-bottom: 1px solid var(--line);
  color: var(--text);
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.group-row {
  border-bottom: 1px solid var(--line);
  color: var(--text);
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.device-row:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.group-row:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.device-row.active {
  background: #e6f4f1;
  box-shadow: inset 4px 0 0 var(--accent);
}

.group-row.active {
  background: #e6f4f1;
  box-shadow: inset 4px 0 0 var(--accent);
}

.device-row-main,
.device-row-meta {
  display: grid;
  gap: 4px;
}

.group-row-main,
.group-row-meta {
  display: grid;
  gap: 4px;
}

.device-row-title {
  font-weight: 800;
}

.group-row-title {
  font-weight: 800;
}

.device-row-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.group-row-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.sidebar-empty {
  padding: 18px;
}

.operation-pane {
  background: var(--bg);
  min-width: 0;
  overflow-y: auto;
  padding: 20px;
}

.group-pane {
  background: var(--bg);
  min-width: 0;
  overflow-y: auto;
  padding: 20px;
}

.group-detail {
  display: grid;
  gap: 16px;
}

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

.group-device-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.group-device-row:hover {
  background: #f8fafc;
  text-decoration: none;
}

.operation-header {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 16px;
}

.operation-content {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr);
}

.stream-column {
  align-content: start;
  display: grid;
  gap: 12px;
  justify-items: center;
  min-width: 0;
}

.device-operation-column {
  align-content: start;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.device-operation-header {
  margin-bottom: 0;
}

.device-account-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.device-account-overview span {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 5px 8px;
}

.device-account-overview strong {
  color: var(--text);
  margin-right: 4px;
}

.device-position-details {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.device-position-details h2 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.device-position-details ul {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.device-position-details li {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 7px 9px;
}

.device-position-details strong {
  color: var(--text);
  white-space: nowrap;
}

.stream-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.icon-button {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 1.1rem;
  height: 42px;
  justify-content: center;
  padding: 0;
  width: 42px;
}

.icon-button.secondary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.icon-button.secondary:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
  color: var(--text);
}

.device-inspector {
  align-content: start;
  display: grid;
  gap: 14px;
}

.panel-backdrop {
  background: rgb(0 0 0 / 0.45);
  inset: 0;
  position: fixed;
  z-index: 80;
}

.panel-backdrop.hidden {
  display: none;
}

.device-settings-panel {
  background: var(--bg);
  border: 0;
  display: grid;
  gap: 14px;
  inset: 0;
  max-height: none;
  overflow-y: auto;
  padding: 28px max(28px, calc((100vw - 1100px) / 2));
  position: fixed;
  width: 100vw;
  z-index: 81;
}

.device-settings-panel .panel {
  box-shadow: var(--shadow-lg);
}

.device-settings-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.device-settings-header h2 {
  margin: 0;
}

.device-settings-close {
  align-items: center;
  background: #0f172a;
  border: 1px solid #0f172a;
  border-radius: 7px;
  box-shadow: var(--shadow-md);
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.device-settings-close:hover {
  background: #1e293b;
  border-color: #1e293b;
  color: #fff;
}

.device-settings-panel.hidden {
  display: none;
}

.device-data-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.device-data-fields legend {
  font-weight: 600;
  padding-inline: 4px;
}

.device-data-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr auto 1fr auto;
}

.device-data-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.device-data-value {
  font-size: 0.85rem;
}


.empty-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  text-align: center;
}

.stream-shell {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: center;
  aspect-ratio: var(--phone-ratio);
  height: min(760px, calc(100vh - 255px));
  margin: 0 auto;
  min-height: 520px;
  overflow: hidden;
  position: relative;
  width: min(100%, 430px);
}

.stream-shell iframe {
  border: 0;
  display: block;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  width: 100%;
}

.stream-shell-offline {
  align-items: center;
  color: #cbd5e1;
  justify-content: center;
}

.stream-offline-state {
  align-items: center;
  display: grid;
  min-height: 100%;
  text-align: center;
}

.stream-offline-state h2 {
  font-size: 1.5rem;
  margin: 0;
}

.control-overlay {
  align-items: center;
  background: rgb(2 6 23 / 0.62);
  backdrop-filter: blur(1px);
  color: #fff;
  display: flex;
  inset: 0;
  justify-content: flex-start;
  padding: 28px;
  position: absolute;
  text-align: left;
  z-index: 2;
}

.control-overlay > div {
  align-items: flex-start;
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 260px;
}

.control-overlay h2,
.control-overlay p {
  margin: 0;
}

.control-overlay-action {
  box-shadow: 0 10px 24px rgb(15 118 110 / 0.28);
  margin-top: 4px;
  min-width: 150px;
}

.fields {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 5px;
  font-weight: 700;
  color: #334155;
}

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

.checkbox-field {
  align-items: center;
  display: flex;
  flex-direction: row;
  font-weight: 700;
  gap: 8px;
}

.checkbox-field input {
  width: auto;
}

.check-row {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.checkbox-list {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
}

.checkbox-list legend {
  color: var(--muted);
  font-weight: 800;
  padding: 0 4px;
}

.compact-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  padding: 8px 10px;
  width: 100%;
  background: #fff;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.14);
  outline: 0;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.meta-list {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.event-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
}

.event-list li {
  border-top: 1px solid var(--line);
  display: block;
  padding-top: 9px;
}

.panel-header {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin: -16px -16px 16px;
  padding: 14px 16px;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: var(--bg-soft);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.danger-link {
  color: var(--danger);
}

.task-queue {
  display: grid;
  gap: 14px;
}

.task-queue-disabled {
  opacity: 0.72;
}

.task-queue h2,
.task-queue h3 {
  margin: 0;
}

.task-queue h3 {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.task-group {
  display: grid;
  gap: 8px;
}

.task-disabled-state {
  display: grid;
  gap: 8px;
  min-height: 140px;
  place-content: center;
  text-align: center;
}

.task-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-item {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  grid-template-columns: min-content minmax(0, 1fr) auto;
  min-height: 54px;
  padding: 9px;
}

.task-item-running {
  grid-template-columns: minmax(0, 1fr) auto;
}

.task-item-history {
  grid-template-columns: minmax(0, 1fr) auto;
}

.task-item-pending {
  cursor: grab;
}

.task-item-pending.dragging {
  opacity: 0.55;
}

.task-drag-handle {
  color: var(--muted);
  cursor: grab;
  font-weight: 800;
  user-select: none;
}

.task-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-main strong,
.task-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-empty {
  margin: 0;
}

.task-actions {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
}

.hidden {
  display: none !important;
}

.task-modal-backdrop {
  align-items: center;
  background: rgb(15 23 42 / 0.48);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 22px;
  position: fixed;
  z-index: 90;
}

.task-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgb(15 23 42 / 0.25);
  display: grid;
  max-height: min(760px, calc(100vh - 44px));
  max-width: min(920px, calc(100vw - 44px));
  overflow: hidden;
  width: 100%;
}

.task-modal-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px;
}

.task-modal-header h2,
.task-create-form h3 {
  margin: 0;
}

.task-modal-header p {
  margin: 4px 0 0;
}

.task-create-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 0;
}

.task-create-layout-single {
  grid-template-columns: minmax(0, 1fr);
}

.task-type-list {
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow-y: auto;
  padding: 12px;
}

.task-type-group {
  display: grid;
  gap: 4px;
}

.task-type-group .task-type-app {
  padding: 4px 6px 2px;
}

.task-type-row {
  align-items: flex-start;
  background: #fff;
  border-color: var(--line);
  color: var(--text);
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
}

.task-type-row.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.task-type-app {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.task-create-form {
  max-height: 620px;
  overflow-y: auto;
  padding: 16px;
}

.task-create-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-height: 130px;
}

.task-create-error {
  background: #fef2f2;
  border-radius: 7px;
  color: var(--danger);
  margin: 0;
  padding: 8px 10px;
}

.health-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 880px) {
  .topbar,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    padding: 14px;
  }

  .activity-summary {
    align-items: stretch;
    flex-direction: column;
    padding: 20px 18px 0;
  }

  .activity-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .activity-frame {
    padding: 20px 18px 24px;
  }

  .activity-group-row {
    grid-template-columns: 1fr;
  }

  .activity-group-name {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  .activity-overlay {
    padding: 14px;
  }

  .activity-overlay-close {
    right: 22px;
    top: 88px;
  }

  .activity-overlay-panel {
    height: calc(100vh - 118px);
    padding: 14px;
  }

  .group-overlay-grid,
  .group-detail-layout {
    grid-template-columns: 1fr;
  }

  .device-detail {
    grid-template-columns: 1fr;
  }

  .device-workbench {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .device-sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    max-height: 360px;
  }

  .operation-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .operation-content {
    grid-template-columns: 1fr;
  }

  .task-create-layout {
    grid-template-columns: 1fr;
  }

  .task-type-list {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    max-height: 220px;
  }

  .stream-shell iframe {
    width: 100%;
  }

  .stream-shell {
    height: min(720px, 68vh);
    min-height: 420px;
    width: min(100%, 405px);
  }
}
