* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0a0c12; color: #e0e0e0; min-height: 100vh; overflow-x: hidden; }

/* Header */
.header { background: #12151e; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1e2235; z-index: 100; }
.header h1 { font-size: 16px; color: #fff; display: flex; align-items: center; gap: 8px; }
.header h1 .logo { color: #1976d2; }
.header-right { display: flex; align-items: center; gap: 16px; font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-dot.on { background: #4caf50; box-shadow: 0 0 6px #4caf50; }
.status-dot.off { background: #f44336; }

/* Layout: sidebar + main */
.layout { display: flex; height: calc(100vh - 42px); }

/* Sidebar */
.sidebar { width: 260px; min-width: 260px; background: #12151e; border-right: 1px solid #1e2235; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-section { border-bottom: 1px solid #1e2235; }
.sidebar-title { padding: 10px 14px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #555; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.sidebar-title .count { background: #1976d2; color: #fff; font-size: 9px; padding: 1px 6px; border-radius: 8px; }

/* Machine list */
.machine-list { overflow-y: auto; max-height: 180px; }
.machine-item { padding: 10px 14px; cursor: pointer; border-left: 3px solid transparent; transition: all 0.1s; }
.machine-item:hover { background: #1a1d27; }
.machine-item.selected { background: #141a2a; border-left-color: #1976d2; }
.machine-item .mi-name { font-size: 12px; font-weight: 600; color: #ccc; font-family: monospace; }
.machine-item .mi-meta { font-size: 10px; color: #555; margin-top: 3px; display: flex; gap: 8px; }
.machine-item .mi-meta .online { color: #4caf50; }
.no-machines { padding: 20px 14px; text-align: center; color: #444; font-size: 12px; }

/* Tab bar */
.tab-bar { overflow-y: auto; max-height: 240px; }
.tab-item { padding: 8px 14px; cursor: pointer; font-size: 11px; display: flex; align-items: center; gap: 8px; border-left: 3px solid transparent; }
.tab-item:hover { background: #1a1d27; }
.tab-item.active { background: #141a2a; border-left-color: #ff9800; }
.tab-item .tab-favicon { width: 14px; height: 14px; border-radius: 2px; background: #333; flex-shrink: 0; }
.tab-item .tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bbb; }
.tab-item .tab-close { margin-left: auto; color: #555; cursor: pointer; font-size: 14px; padding: 0 4px; flex-shrink: 0; }
.tab-item .tab-close:hover { color: #f44336; }
.no-tabs { padding: 16px 14px; color: #444; font-size: 11px; text-align: center; }

/* Quick actions in sidebar */
.quick-actions { padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qa-btn { padding: 7px 8px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #aaa; font-size: 10px; cursor: pointer; text-align: center; transition: all 0.1s; }
.qa-btn:hover { background: #1a1d27; color: #fff; border-color: #1976d2; }
.qa-btn.active { background: #1a2a3a; color: #42a5f5; border-color: #1976d2; }

/* Main area */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* URL bar */
.url-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #12151e; border-bottom: 1px solid #1e2235; }
.url-nav-btn { width: 28px; height: 28px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #888; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.url-nav-btn:hover { background: #1a1d27; color: #fff; }
.url-input { flex: 1; padding: 6px 12px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #e0e0e0; font-size: 13px; font-family: monospace; outline: none; }
.url-input:focus { border-color: #1976d2; }
.url-go { padding: 6px 14px; border: none; border-radius: 6px; background: #1976d2; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.url-go:hover { background: #1565c0; }

/* Browser view */
.browser-view { flex: 1; display: flex; overflow: hidden; }
.screenshot-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.screenshot-main { flex: 1; display: flex; align-items: center; justify-content: center; background: #000; overflow: auto; position: relative; }
.screenshot-main img { max-width: 100%; max-height: 100%; object-fit: contain; }
.screenshot-placeholder { color: #333; font-size: 14px; text-align: center; }
.screenshot-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #12151e; border-top: 1px solid #1e2235; font-size: 11px; color: #555; }
.screenshot-toolbar .st-label { color: #ff9800; }
.auto-refresh-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.auto-refresh-toggle input { accent-color: #1976d2; }

/* Screenshot history strip */
.screenshot-history { display: flex; gap: 4px; padding: 6px 12px; background: #0e1018; border-top: 1px solid #1e2235; overflow-x: auto; min-height: 64px; align-items: center; }
.history-thumb { width: 80px; height: 50px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; object-fit: cover; flex-shrink: 0; background: #1a1d27; }
.history-thumb:hover { border-color: #1976d2; }
.history-thumb.selected { border-color: #ff9800; }

/* Right panel (inspector/console) */
.right-panel { width: 340px; min-width: 340px; background: #12151e; border-left: 1px solid #1e2235; display: flex; flex-direction: column; overflow: hidden; }
.right-panel.collapsed { width: 0; min-width: 0; }
.rp-tabs { display: flex; border-bottom: 1px solid #1e2235; }
.rp-tab { padding: 8px 14px; font-size: 11px; cursor: pointer; color: #666; border-bottom: 2px solid transparent; text-transform: uppercase; letter-spacing: 0.5px; }
.rp-tab:hover { color: #aaa; }
.rp-tab.active { color: #42a5f5; border-bottom-color: #1976d2; }
.rp-content { flex: 1; overflow-y: auto; }

/* Command panel in right sidebar */
.cmd-panel { padding: 12px; }
.cmd-group { margin-bottom: 12px; }
.cmd-group-title { font-size: 10px; text-transform: uppercase; color: #555; letter-spacing: 0.5px; margin-bottom: 6px; font-weight: 700; }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.cmd-btn { padding: 6px 8px; border: 1px solid #1e2235; border-radius: 4px; background: #0f1117; color: #aaa; font-size: 10px; cursor: pointer; text-align: center; }
.cmd-btn:hover { background: #1a1d27; color: #fff; border-color: #1976d2; }

/* Inspector */
.inspector { padding: 12px; }
.insp-section { margin-bottom: 14px; }
.insp-title { font-size: 10px; text-transform: uppercase; color: #555; letter-spacing: 0.5px; margin-bottom: 6px; font-weight: 700; display: flex; justify-content: space-between; }
.insp-item { padding: 5px 8px; background: #0f1117; border-radius: 4px; margin-bottom: 3px; font-size: 11px; font-family: monospace; color: #aaa; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-item:hover { background: #1a1d27; color: #fff; }
.insp-item .tag { color: #c792ea; }
.insp-item .attr { color: #82aaff; }
.insp-item .val { color: #c3e88d; }

/* Console/Network log */
.console-log { padding: 8px; font-family: 'SF Mono', Consolas, monospace; font-size: 11px; line-height: 1.5; }
.console-entry { padding: 3px 6px; border-bottom: 1px solid #151822; }
.console-entry .ce-time { color: #444; }
.console-entry.ce-error { color: #ef5350; }
.console-entry.ce-warn { color: #ff9800; }
.console-entry.ce-info { color: #42a5f5; }
.console-entry.ce-log { color: #888; }
.console-entry.ce-net { color: #66bb6a; }

/* Custom command input */
.custom-cmd { padding: 12px; border-top: 1px solid #1e2235; }
.custom-cmd-row { display: flex; gap: 6px; }
.custom-cmd select { padding: 7px 8px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #e0e0e0; font-size: 12px; outline: none; width: 130px; }
.custom-cmd input { flex: 1; padding: 7px 10px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #e0e0e0; font-size: 12px; outline: none; }
.custom-cmd input:focus { border-color: #1976d2; }
.custom-cmd .send-btn { padding: 7px 14px; border: none; border-radius: 6px; background: #1976d2; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }

/* Pairing overlay */
.pair-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; }
.pair-overlay.show { display: flex; }
.pair-box { background: #1a1d27; border-radius: 12px; padding: 32px; text-align: center; border: 1px solid #2a2d3a; min-width: 320px; }
.pair-box h2 { color: #fff; margin-bottom: 16px; font-size: 18px; }
.pair-code { font-size: 32px; font-weight: 700; letter-spacing: 4px; color: #ff9800; font-family: monospace; padding: 16px; background: #0f1117; border-radius: 8px; margin-bottom: 16px; user-select: all; }
.pair-box .btn { margin: 4px; }
.btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-blue { background: #1976d2; color: white; }
.btn-green { background: #2e7d32; color: white; }
.btn-ghost { background: transparent; color: #888; border: 1px solid #2a2d3a; }
.btn:hover { opacity: 0.9; }

/* Bookmarks */
.bookmark-search { padding: 10px 14px 6px; }
.bookmark-search input { width: 100%; padding: 6px 10px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #e0e0e0; font-size: 11px; outline: none; }
.bookmark-search input:focus { border-color: #1976d2; }
.bookmark-list { overflow-y: auto; max-height: 200px; }
.bm-item { padding: 8px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; border-left: 3px solid transparent; }
.bm-item:hover { background: #1a1d27; }
.bm-item .bm-icon { width: 18px; height: 18px; border-radius: 3px; flex-shrink: 0; }
.bm-item .bm-info { flex: 1; min-width: 0; }
.bm-item .bm-name { font-size: 12px; color: #ccc; font-weight: 500; }
.bm-item .bm-domain { font-size: 10px; color: #555; }
.bm-item .bm-status { font-size: 9px; padding: 1px 6px; border-radius: 8px; flex-shrink: 0; }
.bm-item .bm-status.active { background: #1b3a1b; color: #4caf50; }
.bm-item .bm-status.inactive { background: #3a1b1b; color: #f44336; }

/* Bookmark detail panel */
.bm-detail { padding: 14px; }
.bm-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #1e2235; }
.bm-detail-header img { width: 28px; height: 28px; border-radius: 4px; }
.bm-detail-header .bm-dh-name { font-size: 16px; font-weight: 600; color: #fff; }
.bm-detail-header .bm-dh-domain { font-size: 11px; color: #555; }
.bm-detail-actions { display: flex; gap: 6px; margin-bottom: 14px; }
.bm-detail-actions .bm-act { padding: 6px 12px; border: 1px solid #1e2235; border-radius: 6px; background: #0f1117; color: #aaa; font-size: 11px; cursor: pointer; }
.bm-detail-actions .bm-act:hover { background: #1a1d27; color: #fff; border-color: #1976d2; }
.bm-detail-actions .bm-act.primary { background: #1976d2; color: #fff; border-color: #1976d2; }
.bm-field { margin-bottom: 10px; }
.bm-field-label { font-size: 10px; text-transform: uppercase; color: #555; letter-spacing: 0.5px; margin-bottom: 3px; }
.bm-field-value { font-size: 12px; color: #ccc; background: #0f1117; padding: 6px 10px; border-radius: 4px; font-family: monospace; display: flex; align-items: center; justify-content: space-between; }
.bm-field-value .bm-copy { color: #555; cursor: pointer; font-size: 10px; }
.bm-field-value .bm-copy:hover { color: #42a5f5; }
.bm-field-value.secret { color: #555; }
.bm-field-value.secret.revealed { color: #ff9800; }
.bm-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.bm-tag { font-size: 10px; padding: 2px 8px; border-radius: 8px; background: #1a1d27; color: #888; }
.bm-notes { font-size: 11px; color: #888; background: #0f1117; padding: 8px 10px; border-radius: 4px; line-height: 1.5; }

/* Add bookmark modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: #1a1d27; border-radius: 12px; padding: 24px; border: 1px solid #2a2d3a; width: 440px; max-height: 80vh; overflow-y: auto; }
.modal-box h2 { color: #fff; margin-bottom: 16px; font-size: 16px; }
.modal-field { margin-bottom: 12px; }
.modal-field label { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.modal-field input, .modal-field select, .modal-field textarea { width: 100%; padding: 8px 10px; border: 1px solid #2a2d3a; border-radius: 6px; background: #0f1117; color: #e0e0e0; font-size: 13px; outline: none; font-family: inherit; }
.modal-field textarea { min-height: 60px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Profile Manager */
.profile-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.85); z-index:300; overflow:auto; }
.profile-overlay.show { display:block; }
.profile-container { max-width:900px; margin:20px auto; padding:20px; }
.profile-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.profile-header h2 { color:#fff; font-size:20px; }
.profile-list-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:12px; margin-bottom:24px; }
.profile-card { background:#1a1d27; border:1px solid #2a2d3a; border-radius:10px; padding:16px; cursor:pointer; transition:all 0.15s; }
.profile-card:hover { border-color:#1976d2; transform:translateY(-1px); }
.profile-card .pc-type { font-size:9px; text-transform:uppercase; letter-spacing:1px; color:#888; margin-bottom:6px; }
.profile-card .pc-type.business { color:#ff9800; }
.profile-card .pc-type.personal { color:#42a5f5; }
.profile-card .pc-name { font-size:15px; font-weight:600; color:#fff; margin-bottom:4px; }
.profile-card .pc-meta { font-size:11px; color:#555; }
.profile-card .pc-stats { display:flex; gap:12px; margin-top:8px; font-size:10px; }
.profile-card .pc-stats .filled { color:#4caf50; }
.profile-card .pc-stats .missing { color:#f44336; }
.profile-card-add { border:2px dashed #2a2d3a; display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:120px; color:#444; }
.profile-card-add:hover { border-color:#1976d2; color:#888; }

.profile-detail { background:#12151e; border:1px solid #1e2235; border-radius:10px; padding:0; overflow:hidden; }
.pd-header { padding:16px 20px; background:#1a1d27; border-bottom:1px solid #1e2235; display:flex; justify-content:space-between; align-items:center; }
.pd-header h3 { color:#fff; font-size:16px; }
.pd-nav { display:flex; gap:4px; padding:8px 20px; background:#1a1d27; border-bottom:1px solid #1e2235; overflow-x:auto; }
.pd-nav-item { padding:6px 12px; font-size:11px; border-radius:6px; cursor:pointer; color:#666; white-space:nowrap; }
.pd-nav-item:hover { color:#aaa; background:#0f1117; }
.pd-nav-item.active { color:#42a5f5; background:#0f1117; }
.pd-section { padding:16px 20px; }
.pd-field { margin-bottom:10px; display:flex; gap:12px; align-items:flex-start; }
.pd-field-label { width:180px; min-width:180px; font-size:11px; color:#666; padding-top:8px; }
.pd-field-label .required { color:#f44336; }
.pd-field-input { flex:1; }
.pd-field-input input, .pd-field-input select, .pd-field-input textarea {
  width:100%; padding:7px 10px; border:1px solid #1e2235; border-radius:6px; background:#0f1117; color:#e0e0e0; font-size:12px; outline:none; font-family:inherit;
}
.pd-field-input textarea { min-height:60px; resize:vertical; }
.pd-field-input input:focus, .pd-field-input textarea:focus { border-color:#1976d2; }
.pd-field-status { width:20px; min-width:20px; padding-top:8px; font-size:12px; text-align:center; }
.pd-field-status.ok { color:#4caf50; }
.pd-field-status.missing { color:#f44336; }
.pd-field-status.verify { color:#ff9800; }
.pd-completion { padding:12px 20px; background:#1a1d27; border-top:1px solid #1e2235; display:flex; align-items:center; gap:12px; }
.pd-completion-bar { flex:1; height:6px; background:#0f1117; border-radius:3px; overflow:hidden; }
.pd-completion-fill { height:100%; background:#4caf50; border-radius:3px; transition:width 0.3s; }
.pd-completion-text { font-size:11px; color:#888; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2d3a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3d4a; }
