#root .ant-layout-sider {
  transition: width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease, flex-basis 0.3s ease;
}

#root .ant-layout-sider.yk-sidebar-collapsed {
  flex: 0 0 68px !important;
  width: 68px !important;
  min-width: 68px !important;
  max-width: 68px !important;
  overflow: hidden;
}

#root .brand-lockup {
  position: relative;
}

#root .yk-sidebar-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(77, 145, 255, 0.3);
  border-radius: 8px;
  background: rgba(57, 123, 230, 0.08);
  color: #a9b5c9;
  font: 22px/1 sans-serif;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

#root .yk-sidebar-toggle:hover {
  border-color: rgba(77, 145, 255, 0.7);
  background: rgba(57, 123, 230, 0.2);
  color: #fff;
}

#root .ant-layout-sider.yk-sidebar-collapsed .brand-lockup {
  gap: 0;
  padding: 12px 6px 42px;
}

#root .ant-layout-sider.yk-sidebar-collapsed .brand-lockup-logo {
  width: 36px;
  height: 36px;
}

#root .ant-layout-sider.yk-sidebar-collapsed .brand-lockup-name,
#root .ant-layout-sider.yk-sidebar-collapsed .brand-lockup-sub,
#root .ant-layout-sider.yk-sidebar-collapsed .ant-menu-title-content,
#root .ant-layout-sider.yk-sidebar-collapsed .ant-menu-item-group-title,
#root .ant-layout-sider.yk-sidebar-collapsed .ant-menu-submenu-arrow {
  display: none !important;
}

#root .ant-layout-sider.yk-sidebar-collapsed .ant-menu {
  width: 68px !important;
}

#root .ant-layout-sider.yk-sidebar-collapsed .ant-menu-inline .ant-menu-item,
#root .ant-layout-sider.yk-sidebar-collapsed .ant-menu-inline .ant-menu-submenu-title {
  padding-inline: 22px !important;
}

#root .yk-device-list-wrap {
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
}

#root .yk-device-grid-thumbnail {
  width: 64px !important;
  height: 64px !important;
  flex: 0 0 64px !important;
  overflow: hidden;
  border: 1px solid rgba(164, 184, 219, 0.24) !important;
  border-radius: 12px !important;
  background: #080a0f !important;
  box-shadow: inset 0 0 0 3px rgba(3, 6, 12, 0.65), 0 5px 16px rgba(0, 0, 0, 0.35) !important;
  position: relative;
  cursor: zoom-in;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#root .yk-device-grid-thumbnail > svg:first-child {
  opacity: 1;
}

#root .yk-device-grid-thumbnail:hover {
  border-color: rgba(90, 156, 255, 0.8) !important;
  box-shadow: inset 0 0 0 3px rgba(3, 6, 12, 0.65), inset 0 0 18px rgba(80, 126, 201, 0.2), 0 0 18px rgba(57, 123, 230, 0.24) !important;
}

.yk-live-device-frame {
  display: block;
  position: absolute;
  z-index: 2;
  border-radius: inherit;
  object-fit: cover;
  pointer-events: none;
}

#root .yk-device-grid-thumbnail .yk-live-device-frame {
  inset: 0;
  width: 100%;
  height: 100%;
}

#root .yk-device-table tbody .yk-column-device .yk-live-device-frame {
  top: 50%;
  left: 8px;
  width: 54px;
  height: 64px;
  transform: translateY(-50%);
  border: 1px solid rgba(164, 184, 219, 0.24);
  border-radius: 9px;
}

.yk-live-device-frame[hidden] {
  display: none;
}

#root .yk-device-table {
  display: block;
  min-width: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 8px !important;
}

#root .yk-device-table thead {
  display: none;
}

#root .yk-device-table tbody {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#root .yk-device-table tbody tr {
  display: flex;
  align-items: center;
  min-height: 88px;
  overflow: hidden;
  border: 1px solid #222633;
  border-left: 4px solid transparent;
  border-radius: 9px;
  background: #13161f;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

#root .yk-device-table tbody tr:hover {
  border-left-color: #397be6;
  background: #181d29;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

#root .yk-device-table tbody tr.yk-device-online .yk-column-status {
  color: #4ade80;
}

#root .yk-device-table tbody tr.yk-device-offline .yk-column-status {
  color: #8b93a3;
}

#root .yk-device-table tbody tr.yk-device-sleeping .yk-column-status {
  color: #fbbf24;
}

#root .yk-device-table tbody td {
  display: block;
  min-width: 0;
  padding: 10px 8px !important;
  border: 0 !important;
  color: #9ca3af;
  white-space: normal;
}

#root .yk-device-table tbody .yk-column-select {
  flex: 0 0 42px;
  padding: 10px 6px 10px 12px !important;
  text-align: center;
}

#root .yk-device-table tbody .yk-column-device {
  position: relative;
  flex: 1 1 250px;
  min-width: 200px;
  min-height: 64px;
  padding: 10px 64px 10px 76px !important;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 700;
  white-space: normal;
  overflow: hidden;
}

.yk-device-expand-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 5px 7px;
  border: 1px solid rgba(112, 149, 207, 0.2);
  border-radius: 6px;
  background: rgba(15, 20, 30, 0.88);
  color: #8797af;
  font: 11px/1.2 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.yk-device-expand-toggle:hover,
.yk-device-expand-toggle[aria-expanded="true"] {
  border-color: rgba(77, 145, 255, 0.55);
  background: rgba(57, 123, 230, 0.14);
  color: #c4d9fa;
}

#root .yk-device-table tbody .yk-column-device::before {
  position: absolute;
  top: 50%;
  left: 8px;
  width: 54px;
  height: 64px;
  transform: translateY(-50%);
  border: 1px solid rgba(164, 184, 219, 0.24);
  border-radius: 9px;
  background: #080a0f;
  box-shadow: inset 0 0 0 3px rgba(3, 6, 12, 0.65), 0 5px 16px rgba(0, 0, 0, 0.35);
  content: "";
}

#root .yk-device-table tbody .yk-column-device::after {
  content: none;
}

#root .yk-device-table tbody .yk-column-device:hover::before {
  border-color: rgba(90, 156, 255, 0.8);
  box-shadow: inset 0 0 0 3px rgba(3, 6, 12, 0.65), inset 0 0 18px rgba(80, 126, 201, 0.2), 0 0 18px rgba(57, 123, 230, 0.24);
}

#root .yk-device-table tbody tr.yk-device-expanded-row {
  display: block;
  min-height: 0;
  overflow: visible;
  border: 1px solid #222b3b;
  border-left: 4px solid #397be6;
  border-radius: 8px;
  background: #10141d;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.02);
}

#root .yk-device-table tbody tr.yk-device-expanded-row[hidden] {
  display: none !important;
}

#root .yk-device-table tbody tr.yk-device-expanded-row > td {
  width: 100%;
  padding: 12px 16px !important;
}

.yk-device-expanded-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 16px;
}

.yk-device-expanded-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.yk-device-expanded-label {
  color: #6f7d92;
  font: 10px/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.04em;
}

.yk-device-expanded-value {
  overflow: hidden;
  color: #c5cedb;
  font: 12px/1.4 ui-monospace, SFMono-Regular, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yk-live-preview {
  position: fixed;
  z-index: 2147483000;
  display: none;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(112, 149, 207, 0.32);
  border-radius: 14px;
  background: #0b0e14;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(255, 255, 255, 0.035);
  color: #e6edf8;
  pointer-events: none;
  backdrop-filter: blur(18px);
}

.yk-live-preview.is-visible {
  display: block;
  animation: yk-preview-enter 160ms ease-out;
}

.yk-live-preview-header {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border-bottom: 1px solid rgba(142, 164, 199, 0.12);
  font: 12px/1.2 ui-sans-serif, system-ui, sans-serif;
}

.yk-live-preview-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #45d49a;
  box-shadow: 0 0 10px rgba(69, 212, 154, 0.72);
}

.yk-live-preview-title {
  overflow: hidden;
  color: #d7e1f1;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yk-live-preview-live {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid rgba(69, 212, 154, 0.24);
  border-radius: 4px;
  background: rgba(69, 212, 154, 0.08);
  color: #6de0ad;
  font: 9px/1 ui-monospace, monospace;
  letter-spacing: 0.1em;
}

.yk-live-preview-screen {
  position: relative;
  display: grid;
  min-height: 180px;
  max-height: min(58vh, 410px);
  place-items: center;
  overflow: hidden;
  background: #07090d;
}

.yk-live-preview-screen img {
  display: block;
  width: 100%;
  max-height: min(58vh, 410px);
  object-fit: contain;
}

.yk-live-preview-screen img[hidden],
.yk-live-preview-message[hidden] {
  display: none;
}

.yk-live-preview-message {
  padding: 32px 18px;
  color: #8d9ab0;
  font: 12px/1.6 ui-sans-serif, system-ui, sans-serif;
  text-align: center;
}

.yk-live-preview-footer {
  padding: 9px 13px 10px;
  border-top: 1px solid rgba(142, 164, 199, 0.1);
  color: #66748b;
  font: 10px/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.02em;
}

@keyframes yk-preview-enter {
  from {
    transform: translateY(4px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

#root .yk-device-table tbody .yk-column-status {
  flex: 0 0 68px;
  color: #8b93a3;
  font-size: 12px;
  white-space: nowrap;
}

#root .yk-device-table tbody .yk-column-status span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: rgba(107, 114, 128, 0.1);
}

#root .yk-device-table tbody .yk-column-status span::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

#root .yk-device-table tbody .yk-device-online .yk-column-status span {
  background: rgba(34, 197, 94, 0.1);
}

#root .yk-device-table tbody .yk-device-online .yk-column-status span::before {
  box-shadow: 0 0 5px #22c55e;
}

#root .yk-device-table tbody .yk-device-offline .yk-column-status span {
  background: rgba(107, 114, 128, 0.12);
}

#root .yk-device-table tbody .yk-device-sleeping .yk-column-status span {
  background: rgba(245, 158, 11, 0.1);
}

#root .yk-device-table tbody .yk-column-model,
#root .yk-device-table tbody .yk-column-ip,
#root .yk-device-table tbody .yk-column-system,
#root .yk-device-table tbody .yk-column-owner,
#root .yk-device-table tbody .yk-column-group,
#root .yk-device-table tbody .yk-column-last-seen {
  flex: 0 1 110px;
  overflow: hidden;
  color: #8b93a3;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

#root .yk-device-table tbody .yk-column-model {
  flex-basis: 130px;
  color: #c4c9d4;
}

#root .yk-device-table tbody .yk-column-device > div {
  margin-top: 3px;
  color: #858e9f;
  font-size: 11px;
  font-weight: 400;
}

#root .yk-device-table tbody .yk-column-ip {
  flex-basis: 130px;
}

#root .yk-device-table tbody .yk-column-actions {
  flex: 0 0 auto;
  padding-right: 12px !important;
  border-left: 1px solid #222633 !important;
}

#root .yk-device-table tbody .yk-column-actions > div {
  gap: 8px !important;
}

#root .yk-device-table tbody input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #397be6;
}

@media (max-width: 720px) {
  #root .ant-layout-sider.yk-sidebar-collapsed {
    flex-basis: 60px !important;
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
  }

  #root .yk-device-table tbody tr {
    flex-wrap: wrap;
    padding: 6px 4px;
  }

  #root .yk-device-table tbody .yk-column-device {
    flex-basis: calc(100% - 60px);
  }

  #root .yk-device-table tbody .yk-column-actions {
    margin-left: auto;
  }

  #root .yk-device-table tbody .yk-column-model,
  #root .yk-device-table tbody .yk-column-ip,
  #root .yk-device-table tbody .yk-column-system,
  #root .yk-device-table tbody .yk-column-owner,
  #root .yk-device-table tbody .yk-column-group,
  #root .yk-device-table tbody .yk-column-last-seen {
    flex: 1 1 95px;
    padding: 4px 8px !important;
  }

  #root .yk-device-table tbody .yk-column-actions {
    flex-basis: auto;
  }
}

body #aiBox {
  box-sizing: border-box;
  width: min(1180px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(88vh, calc(100vh - 100px));
  max-height: calc(100vh - 100px);
}

@supports (height: 100dvh) {
  body #aiBox {
    height: min(88dvh, calc(100dvh - 100px));
    max-height: calc(100dvh - 100px);
  }
}

@media (max-width: 720px) {
  body #aiBox {
    inset: max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
  }
}

@media (max-width: 1400px) {
  #root .control-page .home-tab-split {
    grid-template-columns: minmax(0, 0.55fr) minmax(480px, 1.45fr) !important;
  }

  #root .control-page .home-tab-right {
    min-width: 480px !important;
  }
}

@media (max-width: 1100px) {
  #root .control-page .home-tab-split {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(160px, 0.7fr) minmax(240px, 1.3fr) !important;
    gap: 12px !important;
    overflow-y: auto !important;
  }

  #root .control-page .home-tab-right {
    min-width: 0 !important;
    margin-top: 0 !important;
    padding-left: 0 !important;
    border-left: 0 !important;
    border-top: 1px solid var(--fc-border) !important;
  }
}

#root .ctrl-screen-area .ctrl-phone-frame:has(.ctrl-phone-screen div[style*="touch-action: none"]) {
  flex: 0 0 auto !important;
  width: min(320px, calc(100vw - 40px)) !important;
  min-width: 0 !important;
  height: min(78vh, 760px) !important;
  max-height: 760px !important;
  aspect-ratio: auto !important;
}

#root .ctrl-screen-area .ctrl-phone-screen div[style*="touch-action: none"] {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #111827 !important;
}

#root .ctrl-screen-area .ctrl-phone-screen div[style*="touch-action: none"] > div[style*="pointer-events: none"] {
  color: #111827 !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  border-color: #64748b !important;
  background-color: rgba(37, 99, 235, 0.08) !important;
}
