/* Select */
select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: inherit;
    cursor: pointer;
}


/* Status lamp */
.status-lamp {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    transition: background 0.3s;
}
.status-lamp.connected  { background: var(--success-dim); box-shadow: 0 0 8px var(--success-dim); }
.status-lamp.connecting { background: var(--warn); animation: pulse 1s infinite; }
.status-lamp.error      { background: var(--error); box-shadow: 0 0 8px var(--error); }

/* Nav controls */
.nav-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
}

.nav-status-text { color: var(--text-dim); }

.nav-user {
    color: var(--text-dim);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 10px;
    margin-right: 6px;
}

.nav-logout-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0;
    padding-right: 0;
    transition: color 0.15s;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: transparent;
}
.nav-logout-btn:hover { color: var(--error); text-decoration-color: var(--error); }

.nav-login-btn {
    color: white !important;
    text-decoration: none !important;
    padding: 3px 12px !important;
    border: none !important;
    background: var(--secondary);
    border-radius: 12px;
    margin-right: 12px;
    transition: opacity 0.15s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.nav-login-btn:hover { opacity: 0.85; }
.nav-login-btn.active, .nav-login-btn.router-link-active {
    position: relative;
}
.nav-login-btn.active::after, .nav-login-btn.router-link-active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

/* Badges */
.usage-badge {
    color: var(--text-dim);
    opacity: 0.7;
    white-space: nowrap;
}

.user-badge {
    padding: 4px 8px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
}

.session-badge {
    padding: 4px 8px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
}

/* Nav SM state pill */
.nav-sm-state {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--muted);
    color: var(--muted-text);
    white-space: nowrap;
    font-weight: 500;
    transition: background 0.3s, color 0.3s;
    pointer-events: none;
}
.nav-sm-state.IDLE             { background: var(--muted); color: var(--muted-text); }
.nav-sm-state.AGENT_RUNNING    { background: #1a3a5c; color: var(--warn); animation: pulse 1.5s infinite; }
.nav-sm-state.HANDOVER_PENDING { background: #2a2a1a; color: var(--warn); }
.nav-sm-state.HANDOVER_DONE    { background: #1a3a1a; color: var(--success); }
.nav-sm-state.SWITCHING        { background: #1e3a5f; color: #60a5fa; }
.nav-sm-state.CONNECTING       { background: var(--muted); color: var(--warn); animation: pulse 1.5s infinite; }

.toolbar-sm-state {
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--muted);
    color: var(--muted-text);
    white-space: nowrap;
    font-weight: 500;
    transition: background 0.3s, color 0.3s;
    pointer-events: none;
}
.toolbar-sm-state.IDLE             { background: var(--muted); color: var(--muted-text); }
.toolbar-sm-state.AGENT_RUNNING    { background: #1a3a5c; color: var(--warn); animation: pulse 1.5s infinite; }
.toolbar-sm-state.HANDOVER_PENDING { background: #2a2a1a; color: var(--warn); }
.toolbar-sm-state.HANDOVER_DONE    { background: #1a3a1a; color: var(--success); }
.toolbar-sm-state.SWITCHING        { background: #1e3a5f; color: #60a5fa; }
.toolbar-sm-state.CONNECTING       { background: var(--muted); color: var(--warn); animation: pulse 1.5s infinite; }
.toolbar-sm-state.STOP_PENDING     { background: #3a1a1a; color: var(--error); }

.version-badge {
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    background: var(--muted);
    border-radius: var(--radius-sm);
    color: var(--muted-text);
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.15s;
}
.version-badge:hover { color: var(--text); }
.version-copy-icon { opacity: 0.6; }
.version-badge:hover .version-copy-icon { opacity: 1; }

.ws-status {
    color: var(--text-dim);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    min-width: 0;
    text-align: center;
}

/* Agent selector */
.agents-header {
    display: flex;
    align-items: center;
    gap: var(--space-gap);
    padding: 0;
    flex-shrink: 0;
}

.agent-selection-group {
    display: flex;
    align-items: center;
    gap: var(--space-gap);
}

.or-separator { color: var(--text-dim); }

.default-agent-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.default-agent-btn:hover { background: var(--accent); border-color: var(--accent); }
.default-agent-btn:disabled {
    opacity: var(--disabled-opacity);
    cursor: default;
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-dim);
}


.footer-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.handover-btn {
    background: var(--user-bubble);
    color: #a8d5b5;
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.handover-btn:hover    { opacity: 0.85; }
.handover-btn:disabled { opacity: var(--disabled-opacity); cursor: default; }

/* HUD confirm buttons — enabled only when handover is pending */
.confirm-new-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.confirm-new-btn:hover:not(:disabled) { opacity: 0.85; }
.confirm-new-btn:disabled { opacity: var(--disabled-opacity); cursor: default; }

.stay-btn {
    background: var(--bg-dim);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.stay-btn:hover:not(:disabled) { opacity: 0.85; }
.stay-btn:disabled { opacity: var(--disabled-opacity); cursor: default; }

.handover-preview {
    margin: 8px 0;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    color: var(--text);
    white-space: pre-wrap;
    max-height: 320px;
    overflow-y: auto;
    text-align: left;
}

.handover-context-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.handover-context-header:hover { opacity: 0.8; }
.handover-toggle {
    opacity: 0.6;
    font-weight: normal;
}

.confirm-new-btn {
    display: inline-block;
    margin-top: 6px;
    background: var(--user-bubble);
    color: #a8d5b5;
    border: none;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.15s;
}
.confirm-new-btn:hover { opacity: 0.85; }

/* Logout / misc */
.logout-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 4px;
    cursor: pointer;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Not logged in */
.not-logged-in {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    gap: var(--space-page);
    color: var(--text-dim);
}
.not-logged-in a { color: var(--accent); text-decoration: none; font-weight: 600; }
.not-logged-in a:hover { text-decoration: underline; }

/* ── Mobile — visibility + touch targets only, no spacing changes ── */
@media (max-width: 639px) {
    .nav-user { display: none; }
}
