* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Roboto, 'Microsoft YaHei', sans-serif; background: #f4f7fc; color: #1e293b; }
::-webkit-scrollbar { width: 6px; height: 6px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }
* { scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0.15) transparent; }
button, .btn, a, .cart-btn, .send-btn, .edit-btn, .delete-btn, .logout-btn, .pwd-btn, .link-btn, .save-btn, .cancel-btn, .danger-btn, .order-btn, .comm-btn, .qty-btn, .qty-confirm-btn, .manage-link { text-decoration: none !important; }
.user-dropdown { position: relative; display: inline-block; }
.user-dropdown-btn { background: #eef2f6; padding: 6px 14px; border-radius: 40px; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; border: none; font-weight: 500; color: #1e293b; }
.user-dropdown-btn:hover { background: #e2e8f0; }
.user-dropdown-menu { position: absolute; top: 100%; right: 0; background: white; border-radius: 16px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1); min-width: 150px; z-index: 100; margin-top: 8px; border: 1px solid #e2edf2; overflow: hidden; display: none; }
.user-dropdown-menu.show { display: block; }
.user-dropdown-menu a { display: block; padding: 10px 16px; color: #1e293b; font-size: 14px; transition: background 0.2s; }
.user-dropdown-menu a:hover { background: #f1f5f9; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 1200px; }
th { text-align: left; padding: 14px 12px; background: #f9fbfd; color: #2c5a74; border-bottom: 1px solid #e2edf2; white-space: nowrap; }
th a { color: #2c5a74; text-decoration: none; display: flex; align-items: center; gap: 5px; }
th a:hover { color: #1e6f9f; }
td { padding: 12px; border-bottom: 1px solid #eff3f8; vertical-align: middle; }
.action-buttons { display: flex; flex-wrap: nowrap; gap: 6px; white-space: nowrap; }
.edit-btn, .delete-btn, .cart-add-btn, .send-btn { padding: 5px 10px; border-radius: 20px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; transition: all 0.2s; cursor: pointer; border: none; }
.edit-btn { background: #ef0585; color: #ffffff; }
.edit-btn:hover { background: #e0e7ff; transform: translateY(-1px); }
.delete-btn { background: #756969; color: #ffffff; }
.delete-btn:hover { background: #fecaca; transform: translateY(-1px); }
.cart-add-btn { background: #f59e0b; color: white; }
.cart-add-btn:hover { background: #d97706; transform: translateY(-1px); }
.send-btn { background: #10b981; color: white; }
.send-btn:hover { background: #059669; transform: translateY(-1px); }
.link-btn { background: #e6f7e6; color: #2c7a4d; padding: 5px 10px; border-radius: 20px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; transition: all 0.2s; }
.link-btn:hover { background: #d1fae5; transform: translateY(-1px); }
.price { color: #eab308; font-weight: bold; white-space: nowrap; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 8px; font-size: 12px; }
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0b2b3b 0%, #1a4a6e 100%); }
.login-card { background: rgba(255,255,255,0.96); border-radius: 32px; padding: 40px 36px; width: 420px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3); }
.login-logo { font-size: 36px; font-weight: 800; text-align: center; background: linear-gradient(135deg, #0f2b3d, #1e5a7a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { text-align: center; color: #5a6e7c; margin-bottom: 32px; font-size: 14px; }
.input-group { margin-bottom: 22px; }
.input-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: #2c3e50; }
.input-group input { width: 100%; padding: 12px 16px; border: 1px solid #cbd5e1; border-radius: 20px; font-size: 15px; }
.input-group input:focus { outline: none; border-color: #1e6f9f; box-shadow: 0 0 0 3px rgba(30,111,159,0.1); }
.login-btn { width: 100%; padding: 12px; background: #1e6f9f; border: none; border-radius: 28px; color: white; font-size: 16px; font-weight: bold; cursor: pointer; }
.login-btn:hover { background: #155a82; transform: translateY(-1px); }
.error-msg { background: #fee2e2; color: #c62828; padding: 10px; border-radius: 14px; font-size: 13px; text-align: center; margin-bottom: 20px; }
.main-container { display: flex; flex-direction: column; min-height: 100vh; }
.top-nav { background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.05); padding: 0 28px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid #e2edf2; }
.logo-area { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; color: #155a82; padding: 12px 0; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { text-decoration: none; color: #2c3e50; font-weight: 500; cursor: pointer; }
.nav-links a:hover { color: #1e6f9f; }
.user-info { display: flex; align-items: center; gap: 18px; }
.nav-action-btn { background: #1e6f9f; color: white; border: none; padding: 6px 20px; border-radius: 30px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s; text-decoration: none; }
.nav-action-btn:hover { background: #155a82; transform: translateY(-1px); color: white; }
.cart-badge { background: #ef4444; color: white; border-radius: 50%; padding: 2px 8px; font-size: 12px; margin-left: 4px; }
.layout { display: flex; flex: 1; }
.sidebar { width: 320px; background: white; margin: 20px 0 20px 24px; border-radius: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); padding: 16px 0; height: fit-content; }
.sidebar-block { margin-bottom: 8px; border-bottom: 1px solid #f0f2f5; }
.sidebar-block:last-child { border-bottom: none; }
.block-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; cursor: pointer; user-select: none; }
.block-header:hover { background: #f8fafc; }
.block-title { font-size: 15px; font-weight: 600; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.block-title-icon { font-size: 18px; }
.block-toggle { font-size: 12px; color: #94a3b8; transition: transform 0.3s ease; }
.block-toggle.open { transform: rotate(90deg); }
.block-content { padding: 0 16px 16px 20px; display: none; }
.block-content.open { display: block; }
.status-row { display: flex; align-items: center; gap: 12px; background: #f8fafc; padding: 8px 12px; border-radius: 20px; margin-bottom: 15px; font-size: 13px; }
.status-led { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: 0 0 2px currentColor; }
.status-led.green { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.status-led.red { background: #ef4444; box-shadow: 0 0 4px #ef4444; }
.status-led.orange { background: #f59e0b; box-shadow: 0 0 4px #f59e0b; }
.status-led.gray { background: #94a3b8; box-shadow: 0 0 2px #94a3b8; }
.status-text { font-weight: 500; color: #1e293b; }
.status-detail { color: #64748b; font-size: 12px; margin-left: 4px; }
.serial-sidebar-select, .serial-sidebar-baud, .tcp-sidebar-input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #e2e8f0; background: white; font-size: 13px; margin-bottom: 10px; }
.serial-sidebar-btn, .tcp-sidebar-btn { width: 100%; padding: 8px 12px; border-radius: 12px; border: none; font-size: 13px; cursor: pointer; margin-bottom: 8px; font-weight: 500; }
.serial-sidebar-connect { background: #1e6f9f; color: white; }
.serial-sidebar-disconnect { background: #64748b; color: white; }
.serial-sidebar-refresh { background: #e2e8f0; color: #475569; }
.tcp-sidebar-start { background: #10b981; color: white; }
.tcp-sidebar-stop { background: #dc2626; color: white; }
.serial-sidebar-log, .tcp-sidebar-log { font-size: 11px; color: #64748b; background: #f8fafc; padding: 10px; border-radius: 12px; max-height: 120px; overflow-y: auto; margin-top: 10px; }
.category-list, .package-list { list-style: none; margin-top: 4px; max-height: 280px; overflow-y: auto; }
.category-list li, .package-list li { padding: 8px 12px; margin: 2px 0; font-size: 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-radius: 10px; }
.category-list li:hover, .package-list li:hover { background: #eef4ff; }
.category-list li.active, .package-list li.active { background: #e0f2fe; color: #0369a1; font-weight: 500; }
.badge { background: #e2e8f0; border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 500; }
.manage-link { font-size: 11px; background: #f1f5f9; padding: 4px 8px; border-radius: 20px; cursor: pointer; color: #475569; }
.manage-link:hover { background: #e2e8f0; color: #1e6f9f; }
.main-content { flex: 1; padding: 20px 28px 28px 20px; }
.search-section { background: white; border-radius: 28px; padding: 20px 24px; margin-bottom: 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.search-box { flex: 2; display: flex; gap: 12px; align-items: center; background: #f8fafc; padding: 4px 16px; border-radius: 60px; border: 1px solid #dee4e9; }
.search-box:focus-within { border-color: #1e6f9f; box-shadow: 0 0 0 2px rgba(30,111,159,0.1); }
.search-box input { flex: 1; border: none; background: transparent; padding: 12px 0; font-size: 15px; outline: none; }
.search-box button { background: #1e6f9f; border: none; padding: 8px 24px; border-radius: 40px; color: white; cursor: pointer; font-weight: 500; }
.add-btn { background: #2c7a4d; color: white; border: none; padding: 10px 28px; border-radius: 40px; font-weight: bold; cursor: pointer; }
.add-btn:hover { background: #21623e; transform: translateY(-1px); }
.clear-filter-btn { background: #e2e8f0; border: none; padding: 10px 20px; border-radius: 40px; font-size: 13px; cursor: pointer; color: #475569; transition: all 0.2s; }
.clear-filter-btn:hover { background: #cbd5e1; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: white; border-radius: 28px; width: 680px; max-width: 90%; padding: 28px 32px; position: relative; animation: modalFadeIn 0.25s ease; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); max-height: 85vh; overflow-y: auto; }
@keyframes modalFadeIn { from { opacity: 0; transform: scale(0.96) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-content h3 { margin-bottom: 24px; font-size: 22px; font-weight: 600; color: #1e293b; display: flex; align-items: center; gap: 10px; }
.modal-content h3::before { content: "✨"; font-size: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 24px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 500; color: #475569; }
.form-field input, .form-field select { padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 16px; font-size: 14px; width: 100%; }
.form-field input:focus, .form-field select:focus { outline: none; border-color: #1e6f9f; box-shadow: 0 0 0 3px rgba(30,111,159,0.1); }
.form-field .hint { font-size: 11px; color: #64748b; margin-top: 4px; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; padding-top: 16px; border-top: 1px solid #eef2f6; }
.save-btn { background: #1e6f9f; color: white; border: none; padding: 10px 24px; border-radius: 40px; cursor: pointer; font-weight: 500; }
.save-btn:hover { background: #155a82; transform: translateY(-1px); }
.cancel-btn { background: #f1f5f9; color: #475569; border: none; padding: 10px 24px; border-radius: 40px; cursor: pointer; font-weight: 500; }
.cancel-btn:hover { background: #e2e8f0; transform: translateY(-1px); }
.danger-btn { background: #dc2626; color: white; border: none; padding: 8px 20px; border-radius: 28px; cursor: pointer; display: inline-block; }
.danger-btn:hover { background: #b91c1c; transform: translateY(-1px); }
.order-btn { background: #10b981; color: white; padding: 10px 28px; border-radius: 40px; font-size: 14px; font-weight: bold; cursor: pointer; border: none; }
.order-btn:hover { background: #059669; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.success-msg { background: #dcfce7; color: #166534; padding: 10px 18px; border-radius: 30px; margin-bottom: 20px; }
.error-msg-small { background: #fee2e2; color: #dc2626; padding: 10px 18px; border-radius: 30px; margin-bottom: 20px; }
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.cart-footer { display: flex; justify-content: flex-end; margin-top: 20px; gap: 12px; }
.quantity-input { width: 80px; padding: 6px 8px; text-align: center; border: 1.5px solid #e2e8f0; border-radius: 12px; }
.empty-cart { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 60px 20px; text-align: center; }
.empty-cart p { font-size: 18px; color: #666; margin: 0; }
.cards-row { display: flex; gap: 24px; margin-bottom: 25px; flex-wrap: wrap; }
.comm-card { flex: 1; min-width: 280px; background: #f8fafc; border-radius: 20px; border: 1px solid #e2edf2; overflow: hidden; transition: box-shadow 0.2s; }
.comm-card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; cursor: pointer; background: #f8fafc; transition: background 0.2s; }
.comm-card-header:hover { background: #f1f5f9; }
.comm-card-title { font-size: 15px; font-weight: 600; color: #1e293b; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comm-card-toggle { font-size: 12px; color: #94a3b8; transition: transform 0.3s ease; }
.comm-card-toggle.open { transform: rotate(90deg); }
.comm-card-content { padding: 0 20px 20px 20px; display: none; }
.comm-card-content.open { display: block; }
.comm-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
.comm-status .status-indicator { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.comm-select, .comm-input { padding: 8px 14px; border-radius: 40px; border: 1px solid #cbd5e1; background: white; font-size: 13px; }
.comm-btn { border: none; padding: 8px 18px; border-radius: 40px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s; }
.comm-btn-primary { background: #1e6f9f; color: white; }
.comm-btn-primary:hover { background: #155a82; transform: translateY(-1px); }
.comm-btn-success { background: #10b981; color: white; }
.comm-btn-success:hover { background: #059669; transform: translateY(-1px); }
.comm-btn-danger { background: #dc2626; color: white; }
.comm-btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }
.comm-btn-secondary { background: #e2e8f0; color: #475569; }
.comm-btn-secondary:hover { background: #cbd5e1; transform: translateY(-1px); }
.comm-log { margin-top: 15px; font-size: 12px; color: #64748b; max-height: 80px; overflow-y: auto; background: #f1f5f9; padding: 10px; border-radius: 12px; scrollbar-width: thin; }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span { padding: 8px 14px; background: white; border-radius: 20px; text-decoration: none; color: #1e6f9f; border: 1px solid #e2edf2; }
.pagination a:hover { background: #eef2ff; transform: translateY(-1px); }
.pagination .active { background: #1e6f9f; color: white; border-color: #1e6f9f; }
.per-page-select { padding: 6px 12px; border-radius: 20px; border: 1px solid #cbd5e1; background: white; margin-left: 10px; }
.qty-modal .modal-content { width: 380px; text-align: center; }
.qty-modal .modal-content h3::before { content: "🛒"; }
.qty-input-large { font-size: 32px; padding: 16px; text-align: center; width: 100%; border: 2px solid #e2e8f0; border-radius: 20px; margin: 16px 0; font-weight: 600; }
.qty-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.qty-btn { background: #f1f5f9; border: none; padding: 8px 20px; border-radius: 40px; cursor: pointer; font-size: 14px; }
.qty-confirm-btn { background: #f59e0b; color: white; border: none; padding: 12px 28px; border-radius: 40px; cursor: pointer; font-size: 16px; font-weight: 600; margin-top: 8px; }
#pwdModal .modal-content { max-width: 460px; width: 90%; text-align: center; }
#pwdModal h3 { justify-content: center; }
#pwdModal h3::before { content: "🔐"; }
.pwd-form { display: flex; flex-direction: column; gap: 20px; margin: 28px 0 10px; }
.pwd-input-group { text-align: left; }
.pwd-input-group label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 6px; }
.pwd-input-group input { width: 100%; padding: 12px 16px; border: 1.5px solid #e2e8f0; border-radius: 20px; font-size: 14px; transition: all 0.2s; background: #fff; }
.pwd-input-group input:focus { outline: none; border-color: #1e6f9f; box-shadow: 0 0 0 3px rgba(30,111,159,0.1); }
.pwd-msg { font-size: 13px; padding: 8px 12px; border-radius: 30px; margin: 10px 0; }
.pwd-msg.error { background: #fee2e2; color: #dc2626; }
.pwd-msg.success { background: #dcfce7; color: #166534; }
#pwdModal .modal-buttons { justify-content: center; border-top: none; padding-top: 10px; gap: 16px; }
.truncate-text { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-card { background: #f8fafc; border-radius: 24px; padding: 20px; margin-bottom: 20px; border: 1px solid #e2e8f0; }
.device-card h4 { font-size: 16px; margin-bottom: 16px; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.device-input { width: 100%; padding: 12px 16px; border: 1.5px solid #e2e8f0; border-radius: 20px; font-family: monospace; font-size: 13px; margin-bottom: 16px; }
.device-input:focus { outline: none; border-color: #1e6f9f; }
.device-help { font-size: 12px; color: #64748b; margin-bottom: 16px; }
@media (max-width: 780px) { .sidebar { display: none; } .form-grid { grid-template-columns: 1fr; } .cards-row { flex-direction: column; } }