  :root {
  /* 기존 색/기본값 */
  --tv-blue:#2A3D8F; 
  --tv-blue-dark:#1C2E5C;
  --success:#0BAE8F; 
  --danger:#E03A3A; 
  --warning:#F59E0B;
  --bg:#f5f8fb; 
  --panel:#ffffff; 
  --text:#1f2937; 
  --muted:#6b7280; 
  --line:#e5e7eb;

  /* ===== 고급 토큰 ===== */
  /* 글자 컬러 스케일 */
  --ink-1: #0b1220;
  --ink-2: #1f2937;
  --ink-muted: #6b7280;

  /* 라운드 스케일 */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* 그림자 스케일 */
  --elev-1: 0 1px 2px rgba(16,24,40,.06), 0 1px 1px rgba(16,24,40,.04);
  --elev-2: 0 4px 12px rgba(16,24,40,.08), 0 2px 6px rgba(16,24,40,.06);
  --elev-3: 0 12px 28px rgba(16,24,40,.14), 0 8px 16px rgba(16,24,40,.08);

  /* 포커스 링 */
  --ring: 0 0 0 3px rgba(14,122,230,.12);

  /* ===== 기존 변수 자동 매핑 ===== */
  --radius: var(--radius-md);
  --shadow: var(--elev-2);
  }

  html, body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  }
  * { -webkit-tap-highlight-color: transparent; }

  *{box-sizing:border-box;margin:0;padding:0}
  body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,system-ui,sans-serif;background:var(--bg);color:var(--text)}

  #btnSyncRustDesk {
    display: none !important;
  }

  /* 상태 열 숨기기 */
  .hide-status-column th:nth-child(5),
  .hide-status-column td:nth-child(5) {
    display: none !important;
  }

  .filters {
    display: none !important;
  }

  @media (max-width: 768px) {
  .status-badge-mobile {
    display: none !important;
  }
  
  /* 모바일에서도 필터 버튼 숨기기 (이미 위에서 숨겨졌지만 명시) */
  .filters {
    display: none !important;
  }
}

  /* Login Screen */
  .login-container{
    position:fixed;
    inset:0;
    background:linear-gradient(135deg, var(--tv-blue) 0%, var(--tv-blue-dark) 100%);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:1000;
  }
  .login-box{
    background:#fff;
    padding:2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--elev-3);
    backdrop-filter: saturate(110%) blur(.5px);
    width:min(420px,90vw);
    text-align:center;
    border: 1px solid rgba(14,122,230,.08);
    max-height: 90vh;  /* ← 추가 */
    overflow-y: auto;  /* ← 추가 */
  }
  .login-logo{
    font-size:2rem;
    font-weight:800;
    color:var(--tv-blue);
    margin-bottom:1.5rem;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:.8rem;
  }
  .login-logo .dot{
    width:16px;
    height:16px;
    border-radius:50%;
    background:var(--tv-blue);
  }
  .login-form{
    display:flex;
    flex-direction:column;
    gap:1rem;
  }
  .login-input{
    height:48px;
    padding:0 1rem;
    border:2px solid var(--line);
    border-radius:12px;
    font-size:1rem;
    transition:border-color .2s;
  }
  .login-input:focus{
    outline:none;
    border-color:var(--tv-blue);
  }
  .login-btn{
    height:48px;
    background:var(--tv-blue);
    color:#fff;
    border:none;
    border-radius:12px;
    font-weight:700;
    font-size:1rem;
    cursor:pointer;
    transition:background .2s;
  }
  .login-btn:hover{
    background:var(--tv-blue-dark);
  }
  .login-btn:disabled{
    background:var(--muted);
    cursor:not-allowed;
  }
  .login-error{
    color:var(--danger);
    font-size:.9rem;
    margin-top:.5rem;
  }

  /* Main App */
  .main-app{
    display:none;
  }
  .main-app.logged-in{
    display:block;
  }

/* ========================================
   개선된 Topbar 스타일 (v4.2 - 브랜드 텍스트 수정)
   ======================================== */

/* 기본 Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, #394579, #2A3D8F);
  background-blend-mode: overlay;

  /* blur가 보이게: 투명도 + 블러 + 채도 */
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);

  backdrop-filter: blur(12px) saturate(150%);
  box-shadow: 0 2px 0 rgba(255,255,255,.08) inset, 
              0 4px 20px rgba(0,0,0,.15);
  color: #fff;
  padding: 0.65rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
}

/* 햄버거 메뉴 (기본 숨김) */
.menu-toggle {
  display: none;
}

/* 브랜드 */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.95;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

.brand-text {
  display: inline;
}

/* 오른쪽 액션 영역 */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* 서버 상태 */
.conn-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  cursor: help;
  flex-shrink: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.conn-status.conn-ok .status-dot {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16,185,129,0.7);
  animation: pulse-status 2s infinite;
}

.conn-status.conn-bad .status-dot {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239,68,68,0.7);
}

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

/* 새로고침 버튼 */
.topbar .btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;   /* ← 배경 제거 */
  border: none;              /* ← 테두리 제거 */
  border-radius: 8px;        /* 둥근 정도는 유지하거나 0으로 바꿔도 됨 */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.topbar .btn-icon-only:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

.topbar .btn-icon-only:active {
  transform: translateY(0);
}

.topbar .btn-icon-only svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

/* 사용자 드롭다운 */
.user-dropdown {
  position: relative;
  flex-shrink: 0;
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  background: transparent;   /* ← 배경 제거 */
  border: none;              /* ← 테두리 제거 */
  border-radius: 8px;        /* 둥근 정도는 유지하거나 0으로 바꿔도 됨 */
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff;
  font-size: 0.9rem;
}

.user-dropdown-toggle:hover {
  background: rgba(255,255,255,0.1);
}

/* 사용자 아바타 아이콘 */
.user-avatar {
  width: 24px;
  height: 24px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar svg {
  width: 14px;
  height: 14px;
  color: #fff;
}

/* 사용자 정보 텍스트 */
.user-info-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.user-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.user-role-text {
  font-size: 0.65rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* 쉐브론 아이콘 */
.chevron-icon {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.7);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.user-dropdown-toggle:hover .chevron-icon {
  transform: translateY(2px);
}

/* 드롭다운 메뉴 */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none;
  z-index: 100;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
}

.user-dropdown-menu.open {
  display: block;
  animation: dropdown-fade-in 0.2s ease;
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 드롭다운 헤더 */
.dropdown-header {
  padding: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.dropdown-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.dropdown-user-role {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* 구분선 */
.dropdown-divider {
  height: 1px;
  background: #e5e7eb;
}

/* 드롭다운 아이템 */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.9rem;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-weight: 500;
}

.dropdown-item:hover {
  background: #f9fafb;
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.dropdown-item:hover svg {
  color: var(--tv-blue);
}

/* 로그아웃 아이템 */
.dropdown-item-danger {
  color: #dc2626;
}

.dropdown-item-danger:hover {
  background: #fef2f2;
}

.dropdown-item-danger svg {
  color: #dc2626;
}

.dropdown-item-danger:hover svg {
  color: #b91c1c;
}

/* ========================================
   기존 버튼 스타일 보존
   ======================================== */
.btn {
  height: 34px;
  padding: 0 .9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
}

.btn-primary {
  background: #fff;
  color: var(--tv-blue);
}

.btn-primary:hover {
  filter: brightness(.96);
}

.btn-outline {
  background: transparent;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  background: #f3f4f6;
}

.btn-secondary {
  background: #f1f5f9;
  color: #111827;
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ========================================
   모바일 반응형 (768px 이하)
   ======================================== */
@media (max-width: 768px) {
  .topbar {
    padding: 0.5rem 0.7rem;
    gap: 0.5rem;
  }
  
  /* 햄버거 메뉴 - 맨 앞 */
  .menu-toggle {
    display: flex !important;
    flex-direction: column;
    gap: 3px;
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    cursor: pointer;
    padding: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    order: 1;
  }
  
  .menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
  }
  
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
  
  /* 브랜드 - 햄버거 다음 */
  .brand {
    font-size: 0.95rem;
    order: 2;
  }
  
  /* 브랜드 텍스트는 768px 이하에서는 계속 표시 */
  .brand-text {
    display: inline !important;
  }
  
  /* 오른쪽 액션 영역 - 맨 끝 */
  .topbar-actions {
    gap: 0.5rem;
    margin-left: auto;
    order: 3;
  }
  
  /* 서버 상태 */
  .conn-status {
    width: 12px;
    height: 12px;
  }
  
  .status-dot {
    width: 8px;
    height: 8px;
  }
  
  /* 새로고침 버튼 */
  .topbar .btn-icon-only {
    width: 32px;
    height: 32px;
  }
  
  .topbar .btn-icon-only svg {
    width: 16px;
    height: 16px;
  }
  
  /* 사용자 드롭다운 */
  .user-dropdown-toggle {
    padding: 0.35rem 0.6rem;
    gap: 0.4rem;
  }
  
  .user-avatar {
    width: 20px;
    height: 20px;
  }
  
  .user-avatar svg {
    width: 12px;
    height: 12px;
  }
  
  .user-name {
    font-size: 0.8rem;
  }
  
  .user-role-text {
    font-size: 0.6rem;
  }
  
  .chevron-icon {
    width: 14px;
    height: 14px;
  }
  
  /* 드롭다운 메뉴 */
  .user-dropdown-menu {
    min-width: 200px;
  }
}


  #menuToggle {
    display: none;
  }

  /* Layout */
  .shell{
    display:grid;
    grid-template-columns:280px 1fr;
    gap:1rem;
    margin:1rem auto;
    padding:0 1rem;
  }

  /* Left */
  .nav{
    background:var(--panel);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    overflow:hidden;
    position:sticky;
    top:72px;
    align-self:start;
  }
  .tabs{display:flex;border-bottom:1px solid var(--line)}
  .tab{
    flex:1;
    text-align:center;
    padding:.7rem 0;
    font-weight:700;
    color:var(--muted);
    cursor:pointer;
  }
  .tab.active{
    color:var(--tv-blue);
    border-bottom:2px solid var(--tv-blue);
    background:linear-gradient(180deg,#f8fbff,transparent);
  }
  .tab.disabled{color:#ccc;cursor:not-allowed;opacity:.5}
  .box{padding:1rem;display:flex;flex-direction:column;gap:.8rem}
  .search{height:36px;padding:.5rem .7rem;border:1px solid var(--line);border-radius:8px}
  .filters{display:flex;gap:.5rem;flex-wrap:wrap}
  .chip{
    padding:.3rem .6rem;
    border:1px solid var(--line);
    border-radius:999px;
    font-size:.85rem;
    color:var(--muted);
    cursor:pointer;
    background:#fff;
  }
  .chip.active{
    border-color:var(--tv-blue);
    color:var(--tv-blue);
    background:#f0f7ff;
  }
  .group-list{max-height:360px;overflow:auto;border:1px solid var(--line);border-radius:8px}
  .group-item{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:.5rem .7rem;
    border-bottom:1px dashed #eef2f7;
  }
  .group-item:last-child{border-bottom:none}
  .group-name{font-weight:700;cursor:pointer}
  .count{
    background:var(--tv-blue);
    color:#fff;
    border-radius:999px;
    font-size:.72rem;
    padding:.1rem .45rem;
  }
  .btn-mini{
    height:28px;
    font-size:.8rem;
    padding:0 .6rem;
    border-radius:6px;
    border:1px solid var(--line);
    background:#fff;
    color:var(--text);
    cursor:pointer;
    white-space:nowrap;
  }
  .btn-mini.danger{color:#fff;background:#ef4444;border-color:#ef4444}
  .btn-mini:disabled{opacity:.5;cursor:not-allowed}

  /* Right */
  .panel{
    background:var(--panel);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    overflow:hidden;
  }
  .panel-hd{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:.8rem 1rem;
    border-bottom:1px solid var(--line);
    background:#fbfdff;
  }
  .hd-left{display:flex;align-items:center;gap:.6rem;font-weight:800}
  .hd-right{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}
  .select{
    height:34px;
    border:1px solid var(--line);
    border-radius:8px;
    padding:.25rem .6rem;
    background:#fff;
  }
  
  /* Desktop Table */
  .table-wrap{overflow:auto}
  table{width:100%;border-collapse:separate;border-spacing:0}
  thead th{
    position:sticky;
    top:0;
    background:#f2f6fb;
    text-align:left;
    font-size:.78rem;
    color:#4b5563;
    text-transform:uppercase;
    letter-spacing:.4px;
    padding:.7rem .9rem;
    border-bottom:1px solid var(--line);
    white-space:nowrap;
  }
  tbody td{
    padding:.6rem .9rem;
    border-bottom:1px solid #f1f5f9;
    font-size:.92rem;
  }
  tr:hover td{background:#fbfdff}
  .mono{
    font-family:ui-monospace,SFMono-Regular,Consolas,Menlo,monospace;
    font-weight:700;
    color:var(--tv-blue);
  }
  .status{display:inline-flex;align-items:center;gap:.4rem;font-weight:700;font-size:.85rem}
  .dot{width:8px;height:8px;border-radius:50%}
  .online{color:var(--success)} .online .dot{background:var(--success);animation:pulse 2s infinite}
  .offline{color:var(--danger)} .offline .dot{background:var(--danger)}
  .checking{color:var(--warning)} .checking .dot{background:var(--warning);animation:spin 1s linear infinite}
  @keyframes pulse{0%,100%{opacity:1}50%{opacity:.5}}
  @keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
  .last-check{font-size:.75rem;color:var(--muted);margin-top:.2rem}
  .note{
    max-width:220px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    color:var(--muted);
  }
  .dense tbody td{padding:.35rem .6rem}

  /* Modals */
  .modal{
    position:fixed;
    inset:0;
    background:rgba(2,6,23,.55);
    display:none;
    align-items:center;
    justify-content:center;
    padding:1rem;
    z-index:30;
  }
  .modal.open{display:flex}
  .card{
    background:#fff;
    width:min(900px,96vw);
    border-radius:14px;
    box-shadow:var(--shadow);
    overflow:hidden;
  }
  .card-hd{
    padding:1rem 1.1rem;
    background:#f7fafc;
    border-bottom:1px solid var(--line);
    display:flex;
    justify-content:space-between;
    align-items:center;
    font-weight:800;
  }
  .card-bd{padding:1rem}
  .grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
  .fi{display:flex;flex-direction:column;gap:6px}
  .fi label{font-size:.8rem;color:#64748b;font-weight:800}
  .ipt2, select{height:38px;padding:.45rem .6rem;border:1.8px solid var(--line);border-radius:10px}
  .ipt2:focus, select:focus{outline:none;border-color:var(--tv-blue)}
  .card-ft{
    padding:1rem;
    border-top:1px solid var(--line);
    display:flex;
    justify-content:flex-end;
    gap:.5rem;
    background:#f7fafc;
  }

  /* Role badges */
  .role-badge{
    display:inline-block;
    padding:.2rem .5rem;
    border-radius:999px;
    font-size:.75rem;
    font-weight:600;
  }
  .role-admin{background:#ef4444;color:#fff}
  .role-manager{background:#f59e0b;color:#fff}
  .role-viewer{background:#6b7280;color:#fff}

  /* Role change controls */
  .user-role-select{
    height:28px;
    font-size:.8rem;
    padding:0 .4rem;
    border:1px solid var(--line);
    border-radius:6px;
    background:#fff;
  }
  .role-btn{
    height:28px;
    font-size:.8rem;
    padding:0 .6rem;
    border-radius:6px;
    border:1px solid var(--tv-blue);
    background:var(--tv-blue);
    color:white;
    cursor:pointer;
  }
  .role-btn:hover{
    background:var(--tv-blue-dark);
  }

  .hidden{display:none !important}
  .mobile-overlay{display:none}

  /* Floating Action Button */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--tv-blue) 0%, var(--tv-blue-dark) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(14, 122, 230, 0.4);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.fab:hover {
  background: linear-gradient(135deg, var(--tv-blue-dark) 0%, #0E7AE6 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(14, 122, 230, 0.5);
}

.fab:active {
  transform: scale(.95);
}

/* 모바일에서만 표시 */
@media (max-width: 768px) {
  .fab {
    display: flex;
  }
}

  /* User Dropdown */
  .user-dropdown {
    position: relative;
  }
  .user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    margin-top: .5rem;
    min-width: 160px;
    display: none;
    z-index: 100;
  }
  .user-dropdown-menu.open {
    display: block;
  }
  .user-dropdown-item {
    padding: .7rem 1rem;
    cursor: pointer;
    transition: background .2s;
    font-size: .85rem;
    border-bottom: 1px solid var(--line);
    color: #000;
  }
  .user-dropdown-item:last-child {
    border-bottom: none;
  }
  .user-dropdown-item:hover {
    background: var(--bg);
  }
  .user-dropdown-toggle {
    cursor: pointer;
    padding: .4rem .6rem;
    border-radius: 8px;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: .4rem;
  }

  /* 모바일 최적화 */
  @media (max-width: 768px) {
    input, select, textarea {
      font-size: 16px !important;
    }
    body {
      font-size: 14px;
    }

    /* Topbar - 2줄 구조 */
    .topbar {
      flex-wrap: wrap;
      padding: .6rem;
      gap: .3rem;
    }
    
    /* 데스크톱 요소 숨김 */
    .user-info,
    #btnUserManage,
    #btnLogout {
      display: none !important;
    }
    
    /* 모바일 전용 요소 표시 */
    .mobile-only {
      display: block !important;
    }
    
    /* 첫 번째 줄: 메뉴 + 브랜드 + 사용자 */
    #menuToggle {
      display: flex !important;
      flex-direction: column;
      gap: 3px;
      width: 26px;
      height: 26px;
      background: transparent;
      border: none;
      cursor: pointer;
      padding: 4px;
      order: 1;
    }
    
    #menuToggle span {
      display: block;
      width: 100%;
      height: 2.5px;
      background: white;
      border-radius: 2px;
      transition: all .3s;
    }
    
    #menuToggle.active span:nth-child(1) {
      transform: rotate(45deg) translate(4px, 4px);
    }
    
    #menuToggle.active span:nth-child(2) {
      opacity: 0;
    }
    
    #menuToggle.active span:nth-child(3) {
      transform: rotate(-45deg) translate(6px, -5px);
    }
    
    .brand {
      font-size: 1rem;
      flex: 1;
      order: 2;
    }
    
    .user-dropdown {
      order: 3;
    }
    
    .user-dropdown-toggle {
      font-size: .75rem;
      padding: .3rem .5rem;
    }
    
    /* 두 번째 줄: 상태 + 액션 버튼들 */
    .bar-right {
      width: 100%;
      order: 4;
      display: flex;
      gap: .4rem;
      align-items: center;
    }
    
    .conn-badge {
      font-size: .7rem;
      height: 24px;
      padding: 0 .4rem;
      flex-shrink: 0;
    }
    
    .btn {
      height: 32px;
      padding: 0 .6rem;
      font-size: .75rem;
    }
    
    /* 플로팅 액션 버튼 표시 */
    .fab {
      display: flex;
    }

    /* Layout */
    .shell {
      grid-template-columns: 1fr;
      gap: .75rem;
      padding: 0 .5rem;
      margin: .75rem auto;
    }

    /* 사이드바 슬라이드 메뉴 */
    .nav {
      position: fixed;
      left: -100%;
      top: 0;
      bottom: 0;
      width: 280px;
      z-index: 100;
      transition: left .3s ease;
      box-shadow: 2px 0 10px rgba(0,0,0,.3);
    }
    
    .nav.mobile-open {
      left: 0;
    }
    
    /* 오버레이 */
    .mobile-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.5);
      z-index: 99;
    }
    
    .mobile-overlay.active {
      display: block;
    }

    /* 패널 */
    .panel-hd {
      flex-direction: column;
      align-items: stretch;
      gap: .5rem;
      padding: .75rem;
    }
    
    .hd-left {
      width: 100%;
      font-size: .9rem;
    }
    
    .hd-right {
      width: 100%;
      flex-direction: row;
      gap: .4rem;
    }
    
    /* 데스크톱 요소 숨김 */
    #btnAdd,
    #btnExport,
    #density {
      display: none !important;
    }
    
    /* 스마트 입력창 */
    #quickId {
      flex: 1;
      height: 38px;
      font-size: .85rem;
      width: auto !important;
    }
    
    #btnQuickConn {
      width: auto;
      height: 38px;
      padding: 0 .8rem;
      flex-shrink: 0;
    }

    /* 통합 카드 디자인 - 메인 테이블만 */
    #posTable tbody tr.mobile-card {
      display: block;
      margin-bottom: 1rem;
      border: none;
    }

    #posTable tbody tr.mobile-card td.mobile-card-cell {
      display: block !important;
      padding: 0 !important;
      border: none !important;
      border-radius: 12px;
      background: white;
      box-shadow: 0 2px 12px rgba(0,0,0,.1);
      overflow: hidden;
      border-left: 4px solid var(--line);
    }

    #posTable tbody tr.mobile-card:hover td {
      background: white;
      box-shadow: 0 4px 16px rgba(0,0,0,.15);
    }

    /* 상태별 좌측 색상 바 */
    #posTable tbody tr.mobile-card.card-online td {
      border-left-color: #10b981;
    }

    #posTable tbody tr.mobile-card.card-offline td {
      border-left-color: #ef4444;
    }

     #posTable tbody tr.mobile-card.card-checking td {
      border-left-color: #f59e0b;
    }
    
    /* 상태별 좌측 색상 바 */
    #posTable tbody tr.card-online {
      border-left-color: #10b981;
    }
    
    #posTable tbody tr.card-offline {
      border-left-color: #ef4444;
    }
    
    #posTable tbody tr.card-checking {
      border-left-color: #f59e0b;
    }
    
    /* 카드 내부 컨테이너 */
    .pos-card-container {
      padding: 1rem;
    }
    
    /* 카드 헤더 영역 */
    .card-header-mobile {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: .75rem;
      gap: .5rem;
    }
    
    .card-title-mobile {
      flex: 1;
    }
    
    .card-title-main {
      font-weight: 700;
      font-size: 1rem;
      color: var(--text);
      margin-bottom: .25rem;
      display: flex;
      align-items: center;
      gap: .4rem;
    }
    
    .card-title-sub {
      font-size: .8rem;
      color: var(--muted);
      display: flex;
      align-items: center;
      gap: .3rem;
    }
    
    /* 상태 배지 */
    .status-badge-mobile {
      display: inline-flex;
      align-items: center;
      gap: .35rem;
      padding: .25rem .6rem;
      border-radius: 999px;
      font-size: .75rem;
      font-weight: 600;
      white-space: nowrap;
    }
    
    .status-badge-mobile.online {
      background: #dcfce7;
      color: #166534;
    }
    
    .status-badge-mobile.offline {
      background: #fee2e2;
      color: #991b1b;
    }
    
    .status-badge-mobile.checking {
      background: #fef3c7;
      color: #92400e;
    }
    
    .status-badge-mobile .dot {
      width: 6px;
      height: 6px;
    }
    
    /* 카드 정보 영역 */
    .card-info-mobile {
      background: #f9fafb;
      border-radius: 8px;
      padding: .75rem;
      margin-bottom: .75rem;
    }
    
    .info-row-mobile {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: .4rem 0;
      font-size: .85rem;
      border-bottom: 1px dashed #e5e7eb;
    }
    
    .info-row-mobile:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    
    .info-row-mobile:first-child {
      padding-top: 0;
    }
    
    .info-label {
      font-weight: 600;
      color: var(--muted);
      font-size: .75rem;
    }
    
    .info-value {
      font-weight: 500;
      color: var(--text);
      text-align: right;
      word-break: break-word;
      max-width: 60%;
    }
    
    .info-value.mono {
      font-family: ui-monospace, monospace;
      color: var(--tv-blue);
      font-weight: 600;
      cursor: pointer;
    }
    
    /* 카드 액션 버튼 */
    .card-actions-mobile {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: .5rem;
    }
    
    .card-actions-mobile.three-buttons {
      grid-template-columns: 1fr 1fr 1fr;
    }
    
    .card-actions-mobile .btn-mini {
      height: 40px;
      font-size: .8rem;
      padding: 0 1rem;
      font-weight: 600;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: .4rem;
      transition: all .2s;
    }
    
    .card-actions-mobile .btn-connect {
      background: linear-gradient(135deg, #394579 0%, #2A3D8F 100%);
      color: white;
      border: none;
      box-shadow: 0 2px 8px rgba(14,122,230,.3);
    }
    
    .card-actions-mobile .btn-connect:active {
      transform: scale(.95);
    }
    
    .card-actions-mobile .btn-edit {
      background: #f1f5f9;
      color: #475569;
      border: 1px solid #e2e8f0;
    }
    
    .card-actions-mobile .btn-mini.danger {
      background: #fef2f2;
      color: #dc2626;
      border: 1px solid #fecaca;
    }
    
    /* 기존 테이블 스타일 숨김 */
    #posTable tbody td:not(.mobile-card-cell) {
      display: none !important;
    }

    /* 빈 상태도 카드 스타일 */
    #posTable tbody tr:not(.mobile-card) {
      border-left: none;
      box-shadow: none;
    }

    #posTable tbody tr:not(.mobile-card) td[colspan] {
      display: table-cell !important;
      border-left: none !important;
    }
        
    #posTable .table-wrap {
      padding: .5rem;
    }
    
    #posTable {
      display: block;
    }
    
    #posTable thead {
      display: none;
    }
    
    #posTable tbody {
      display: flex;
      flex-direction: column;
      gap: 0;
    }
    
    /* 그룹/사용자 테이블은 모바일에서도 일반 테이블로 표시 */
    #groupPanel .table-wrap,
    #userPanel .table-wrap {
      overflow-x: auto;
    }
    
    #groupTable,
    #userTable {
      display: table;
      font-size: .85rem;
    }
    
    #groupTable thead,
    #userTable thead {
      display: table-header-group;
    }
    
    #groupTable tbody,
    #userTable tbody {
      display: table-row-group;
    }
    
    #groupTable tr,
    #userTable tr {
      display: table-row;
    }
    
    #groupTable td,
    #userTable td {
      display: table-cell;
      padding: .5rem;
    }
    
    #groupTable th,
    #userTable th {
      padding: .5rem;
      font-size: .75rem;
    }
    
    /* 그룹/사용자 테이블 버튼 모바일 최적화 */
    #groupTable .btn-mini,
    #userTable .btn-mini {
      height: 32px;
      font-size: .75rem;
      padding: 0 .5rem;
      white-space: nowrap;
    }
    
    #userTable .user-role-select {
      height: 32px;
      font-size: .75rem;
    }
    
    #userTable .role-btn {
      height: 32px;
      font-size: .75rem;
    }
    
    /* 패널 헤더 버튼들 */
    #groupPanel .hd-right,
    #userPanel .hd-right {
      width: 100%;
      flex-direction: row;
      gap: .4rem;
    }
    
    #gSearch,
    #uSearch {
      flex: 1;
      height: 36px;
      font-size: .85rem;
    }
    
    #btnGAdd {
      height: 36px;
      font-size: .75rem;
      padding: 0 .7rem;
      white-space: nowrap;
    }

    #btnAddUser {
      height: 36px;
      font-size: .75rem;
      padding: 0 .7rem;
      white-space: nowrap;
    }

    /* 모달 */
    .card {
      width: 95vw;
      max-height: 90vh;
      overflow-y: auto;
    }
    
    .grid {
      grid-template-columns: 1fr;
    }
    
    .ipt2 {
      height: 42px;
    }

    /* 로그인 */
    .login-box {
      width: 90vw;
      padding: 2rem 1.5rem;
    }
    
    .login-input, .login-btn {
      height: 46px;
    }
  }

/* 최근 접속 아이템 */
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .6rem;
  background: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
  font-size: .85rem;
  gap: .5rem;
}

.recent-item:hover {
  background: #e2e8f0;
  transform: translateX(2px);
}

.recent-item-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item-time {
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
  .recent-item {
    font-size: .8rem;
    padding: .45rem .5rem;
  }
}

/* 작업 버튼 컨테이너 오른쪽 정렬 */
#posTable tbody tr td[data-label="작업"] {
  text-align: right;
}

#posTable tbody tr td[data-label="작업"] > div {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  align-items: center;
}

/* 작업 열 오른쪽 정렬 */
@media (min-width: 769px) {
#posTable thead th:last-child {
  text-align: left;  /* ← 헤더도 오른쪽 정렬 */
  width: 1%;
  white-space: nowrap;
}

#posTable tbody td:last-child {
  text-align: left;
  width: 1%;  /* ← 이거 */
  white-space: nowrap;
}

#posTable tbody td:last-child > div {
  display: flex;
  justify-content: flex-start;  /* ← 버튼만 오른쪽 */
  gap: .35rem;
  align-items: center;
}
}
/* ================================================
   배치파일 다운로드 섹션 (로그인 화면)
   ================================================ */
.batch-download-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.batch-select {
  width: 100%;
  min-height: 50px;
  padding: 0.75rem 2.5rem 0.85rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 1rem;
  line-height: normal;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231f2937' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  vertical-align: middle;
  display: flex;
  align-items: center;
}

.batch-select:hover {
  border-color: var(--tv-blue);
  background-color: #f9fafb;
}

.batch-select:focus {
  outline: none;
  border-color: var(--tv-blue);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(14, 122, 230, 0.1);
}

.batch-select option {
  background: #fff;
  color: #1f2937;
  padding: 0.75rem;
  min-height: 40px;
  line-height: 1.6;
}

/* ================================================
   배치파일 관리 패널
   ================================================ */
#batchTable {
  width: 100%;
}

#batchTable th:nth-child(1) { width: 30%; }
#batchTable th:nth-child(2) { width: 25%; }
#batchTable th:nth-child(3) { width: 20%; }
#batchTable th:nth-child(4) { width: 25%; }

#batchContent,
#editBatchContent {
  resize: vertical;
  min-height: 200px;
  line-height: 1.5;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .batch-select {
    font-size: 1rem;
    min-height: 52px;
    padding: 1rem 2.5rem 1rem 1rem;
  }
  
  #batchTable {
    font-size: 0.85rem;
  }
  
  #batchContent,
  #editBatchContent {
    font-size: 0.85rem;
    min-height: 250px;
  }
}



