/* Praxis Admin Portal — Dark theme */

:root {
    --bg-primary: #0e1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-card-hover: #242a33;
    --bg-input: #0d1117;
    --border: #30363d;
    --border-focus: #58a6ff;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #00d4aa;
    --accent-hover: #00e6bb;
    --accent-gradient: linear-gradient(135deg, #00b4d8, #00d4aa);
    --status-up: #3fb950;
    --status-down: #f85149;
    --status-degraded: #d29922;
    --status-unknown: #6e7681;
    --sidebar-width: 240px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-card);
    color: var(--accent);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
}

.user-info {
    padding: 8px 12px;
    margin-bottom: 4px;
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout { color: var(--text-muted); }
.logout:hover { color: var(--status-down); }

/* Content */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.content-body {
    padding: 24px 32px;
}

/* Status grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.15s ease;
}

.status-card:hover { background: var(--bg-card-hover); }

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.status-up .status-indicator { background: var(--status-up); box-shadow: 0 0 8px var(--status-up); }
.status-down .status-indicator { background: var(--status-down); box-shadow: 0 0 8px var(--status-down); }
.status-degraded .status-indicator { background: var(--status-degraded); box-shadow: 0 0 8px var(--status-degraded); }
.status-unknown .status-indicator { background: var(--status-unknown); }

.status-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.status-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
}

.status-up .status-badge { color: var(--status-up); }
.status-down .status-badge { color: var(--status-down); }
.status-degraded .status-badge { color: var(--status-degraded); }

/* Sections */
.section {
    margin-bottom: 32px;
}

.section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.link-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.15s ease;
    color: var(--text-primary);
}

.link-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

.link-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.link-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Info table */
.info-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.info-table table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.info-table tr:last-child td { border-bottom: none; }

.info-table .label {
    color: var(--text-muted);
    font-weight: 500;
    width: 160px;
}

/* Grafana embed */
.embed-container {
    width: 100%;
    height: calc(100vh - 140px);
}

/* Login page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 180, 216, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(0, 212, 170, 0.06) 0%, transparent 50%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* Alert */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #f85149;
}

/* Forms */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.btn-block { width: 100%; }

.btn-primary {
    background: var(--accent-gradient);
    color: #0e1117;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(0, 212, 170, 0.3);
    color: #0e1117;
}

.btn-entra {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-entra:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-icon {
    width: 18px;
    height: 18px;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    font-size: 12px;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; }
    .content-body { padding: 16px; }
    .status-grid { grid-template-columns: 1fr; }
}
/* ===== Node Management Page ===== */

.node-overview-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.overview-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    text-align: center;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-online .stat-value { color: var(--status-up); }
.stat-offline .stat-value { color: var(--text-muted); }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Node cards */
.nodes-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.node-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.node-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.node-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.node-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.node-dot-online { background: var(--status-up); box-shadow: 0 0 8px var(--status-up); }
.node-dot-unreachable { background: var(--status-down); box-shadow: 0 0 8px var(--status-down); }
.node-dot-not_deployed { background: var(--text-muted); }

.node-hostname {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

.node-role-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.node-status-pill {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
}

.pill-online { background: rgba(63, 185, 80, 0.15); color: var(--status-up); }
.pill-unreachable { background: rgba(248, 81, 73, 0.15); color: var(--status-down); }
.pill-not_deployed { background: rgba(110, 118, 129, 0.15); color: var(--text-muted); }

.node-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Metric bars */
.node-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-bar-container {
    /* Phase 4.2 (G001): ticks need to show just outside the bar edge, so the
       container now positions children but does NOT clip overflow. */
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
}

.metric-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.6s ease, background-color 0.2s ease;
}

/* Phase 4.2 (G001): canonical 3-state thresholds. Previously an attribute
   substring selector ("width: 8"/"width: 9") flipped the color at any value
   starting with those digits — including 8.5% — which was the root of the
   inverted color bug. Colors are now driven from JS (barColorClass()). */
.metric-bar-fill-ok   { background: var(--status-up); }
.metric-bar-fill-warn { background: var(--status-degraded); }
.metric-bar-fill-high { background: var(--status-down); }

/* Tick marks at 75% and 90% (G001). */
.metric-bar-ticks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.metric-tick {
    position: absolute;
    top: -2px;
    width: 1px;
    height: 10px;
    background: rgba(255, 255, 255, 0.22);
    transform: translateX(-0.5px);
}

/* Same threshold classes for the sortable-table bar cells. */
.table-bar-fill.metric-bar-fill-ok   { background: var(--status-up); }
.table-bar-fill.metric-bar-fill-warn { background: var(--status-degraded); }
.table-bar-fill.metric-bar-fill-high { background: var(--status-down); }

.metric-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.metric-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.node-uptime {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 16px;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

.uptime-label { color: var(--text-muted); }
.uptime-value { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.uptime-divider { color: var(--border); }

/* Specs sections */
.node-specs {
    margin-bottom: 16px;
}

.node-specs h4,
.node-services-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.spec-key { color: var(--text-muted); }
.spec-val { color: var(--text-secondary); text-align: right; }

/* Service list */
.node-services-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.service-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.service-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.svc-up { background: var(--status-up); }
.svc-down { background: var(--status-down); }
.svc-degraded { background: var(--status-degraded); }

.service-name {
    color: var(--text-primary);
    flex: 1;
}

.service-status-text {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Not deployed placeholder */
.node-not-deployed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    color: var(--text-muted);
    text-align: center;
}

.node-not-deployed svg { opacity: 0.4; }
.node-not-deployed p { font-size: 13px; }

@media (max-width: 768px) {
    .node-overview-stats { flex-direction: column; }
    .node-metrics-grid { grid-template-columns: 1fr; }
    .specs-grid { grid-template-columns: 1fr; }
}

/* ===== SOP Management Page ===== */

.sop-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sop-filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sop-filter-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sop-filter-btn.active {
    background: rgba(0, 212, 170, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}

/* SOP cards */
.sop-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sop-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s ease;
}

.sop-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.sop-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 8px;
}

.sop-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.sop-category-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: rgba(0, 180, 216, 0.12);
    color: #00b4d8;
    white-space: nowrap;
}

.sop-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
}

.sop-meta-pills {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sop-version-pill,
.sop-steps-pill {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.sop-card-body {
    padding: 0 20px 12px;
}

.sop-applies-to {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.sop-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sop-prereqs {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    align-items: center;
}

.sop-prereqs-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.sop-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
}

.sop-verified {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-sop-expand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sop-expand:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.expand-icon {
    transition: transform 0.2s ease;
}

/* Expanded detail section */
.sop-detail {
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.sop-detail-content {
    padding: 20px;
}

.sop-detail-section {
    margin-bottom: 20px;
}

.sop-detail-section:last-child {
    margin-bottom: 0;
}

.sop-detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.sop-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sop-checklist li {
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: 20px;
    position: relative;
}

.sop-checklist li::before {
    content: '\2610';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* SOP steps */
.sop-step {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
}

.sop-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.sop-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.sop-step-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.sop-step-field {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0 4px 32px;
    line-height: 1.4;
}

.sop-field-label {
    font-weight: 600;
    color: var(--text-muted);
}

.sop-field-pass .sop-field-label {
    color: var(--status-up);
}

.sop-field-fail .sop-field-label {
    color: var(--status-degraded);
}

@media (max-width: 768px) {
    .sop-card-header {
        flex-direction: column;
        gap: 8px;
    }
    .sop-identity {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .sop-meta-pills {
        align-self: flex-start;
    }
}

/* ===== User Management Page ===== */

.user-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.user-add-form .form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.user-add-form .form-group {
    flex: 1;
    min-width: 140px;
}

.user-add-form .form-group-btn {
    flex: 0 0 auto;
    min-width: auto;
}

.user-add-form select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

.user-add-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
}

.btn-add-user {
    white-space: nowrap;
    padding: 10px 20px;
}

.alert-success {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: var(--status-up);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Users table */
.users-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.users-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.users-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.users-table tr:last-child td {
    border-bottom: none;
}

.users-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.user-cell-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #0e1117;
    flex-shrink: 0;
}

.role-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
}

.role-admin {
    background: rgba(0, 212, 170, 0.12);
    color: var(--accent);
}

.role-viewer {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.user-cell-date {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.user-cell-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-action:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-delete:hover {
    border-color: var(--status-down);
    color: var(--status-down);
    background: rgba(248, 81, 73, 0.1);
}

.btn-reset-pw:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.inline-form {
    display: inline;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.modal-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .user-add-form .form-row {
        flex-direction: column;
    }
    .user-add-form .form-group {
        min-width: 100%;
    }
}

/* ===== Audit Log Page ===== */

.audit-filters {
    margin-bottom: 20px;
}

.audit-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.audit-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.audit-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.audit-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.audit-table tr:last-child td {
    border-bottom: none;
}

.audit-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.audit-row-fail {
    background: rgba(248, 81, 73, 0.04);
}

.audit-row-fail:hover {
    background: rgba(248, 81, 73, 0.08);
}

.audit-cell-time {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.audit-cell-user {
    font-weight: 500;
    color: var(--text-primary);
}

.audit-cell-detail {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-cell-ip {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-family: monospace;
}

.audit-event-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    text-transform: capitalize;
}

.audit-evt-login {
    background: rgba(0, 180, 216, 0.12);
    color: #00b4d8;
}

.audit-evt-logout {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.audit-evt-user_create {
    background: rgba(63, 185, 80, 0.12);
    color: var(--status-up);
}

.audit-evt-user_delete {
    background: rgba(248, 81, 73, 0.12);
    color: var(--status-down);
}

.audit-evt-password_change {
    background: rgba(210, 153, 34, 0.12);
    color: var(--status-degraded);
}

.audit-evt-role_change {
    background: rgba(88, 166, 255, 0.12);
    color: #58a6ff;
}

.audit-evt-admin_api {
    background: rgba(0, 212, 170, 0.12);
    color: var(--accent);
}

.audit-evt-page_access {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.audit-status-ok {
    font-size: 11px;
    font-weight: 600;
    color: var(--status-up);
}

.audit-status-fail {
    font-size: 11px;
    font-weight: 600;
    color: var(--status-down);
}

/* Audit empty state */
.audit-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px;
    color: var(--text-muted);
    text-align: center;
}

.audit-empty svg {
    opacity: 0.3;
}

.audit-empty p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.audit-empty-sub {
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .audit-table-wrapper {
        overflow-x: auto;
    }
}


/* ===== Admin Chat Page (IMPL-016A) ===== */

.chat-layout {
    display: flex;
    height: calc(100vh - 73px);
    margin: -24px -32px;
}

.chat-sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 12px;
    flex-shrink: 0;
}

.btn-new-chat {
    margin-bottom: 12px;
    font-size: 13px;
    padding: 8px 14px;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-history-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-history-item:hover {
    background: var(--bg-card);
}

.chat-history-item.active {
    background: var(--bg-card);
    border-left: 2px solid var(--accent);
}

.history-preview {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.history-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Chat main area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome screen */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    flex: 1;
}

.welcome-icon {
    margin-bottom: 16px;
    color: var(--accent);
}

.chat-welcome h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
}

.suggestion-chip {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.suggestion-chip:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* Messages */
.chat-message {
    display: flex;
    gap: 12px;
    max-width: 820px;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.msg-avatar-user {
    background: var(--accent-gradient);
    color: #0e1117;
}

.msg-avatar-assistant {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-role {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px;
}

.message-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 10px 0 4px;
}

.message-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.message-content code.inline-code {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--accent);
}

.message-content pre {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 10px 0;
    overflow-x: auto;
}

.message-content pre code {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary);
}

.message-content ul, .message-content ol {
    padding-left: 20px;
    margin: 6px 0;
}

.message-content li {
    margin-bottom: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* Input area */
.chat-input-area {
    border-top: 1px solid var(--border);
    padding: 16px 32px;
    background: var(--bg-secondary);
}

.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: border-color 0.15s;
}

.chat-input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 200px;
    font-family: inherit;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent-gradient);
    color: #0e1117;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-send:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 212, 170, 0.3);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chat-input-footer {
    margin-top: 6px;
    text-align: center;
}

.chat-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-model-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: rgba(88, 166, 255, 0.12);
    color: #58a6ff;
}

@media (max-width: 768px) {
    .chat-sidebar { display: none; }
    .chat-messages { padding: 16px; }
    .chat-input-area { padding: 12px 16px; }
}

/* ===== Chat tool-call expanders + sources row (Phase 5 chunk 5.6b) ===== */

.chat-tool-events {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0 10px;
}

.chat-tool-event {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(88, 166, 255, 0.04);
    font-size: 12.5px;
    color: var(--text-secondary);
    overflow: hidden;
}

.chat-tool-event[open] {
    background: rgba(88, 166, 255, 0.07);
}

.chat-tool-event[data-status="denied"],
.chat-tool-event[data-status="error"] {
    border-color: rgba(248, 81, 73, 0.5);
    background: rgba(248, 81, 73, 0.05);
}

.chat-tool-event-header {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    user-select: none;
}

.chat-tool-event-header::-webkit-details-marker { display: none; }

.chat-tool-event-caret {
    display: inline-block;
    transition: transform 120ms ease;
    color: var(--text-muted);
    font-size: 10px;
}

.chat-tool-event[open] .chat-tool-event-caret {
    transform: rotate(90deg);
}

.chat-tool-event-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-tool-event-name code {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 12px;
    color: var(--text-primary);
    background: transparent;
}

.chat-tool-event-status {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    text-transform: lowercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.chat-tool-event-status-ok {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
}

.chat-tool-event-status-denied,
.chat-tool-event-status-error {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
}

.chat-tool-event-status-pending {
    background: rgba(245, 194, 66, 0.15);
    color: #f5c242;
}

.chat-tool-event-elapsed {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.chat-tool-event-body {
    padding: 8px 10px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-tool-event-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-tool-event-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.chat-tool-event-args {
    margin: 0;
    padding: 6px 8px;
    background: rgba(13, 17, 23, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 11.5px;
    color: var(--text-secondary);
    overflow-x: auto;
    max-height: 180px;
}

.chat-tool-event-summary,
.chat-tool-event-error {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-tool-event-error {
    color: #f85149;
}

.chat-sources-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.chat-sources-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-right: 2px;
}

.chat-source-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(88, 166, 255, 0.08);
    color: #58a6ff;
    font-size: 11.5px;
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease;
}

.chat-source-pill:hover {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.5);
}

.chat-source-pill[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ===== Client Nodes Page (Phase 1) ===== */

.clients-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 64px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    gap: 12px;
}
.clients-empty-state h3 {
    color: var(--text-primary);
    margin: 8px 0 0;
}
.clients-empty-state p { margin: 0 0 12px; }
.clients-empty-state svg { color: var(--text-muted); opacity: 0.6; }

.clients-error-banner {
    background: rgba(220, 70, 70, 0.12);
    border: 1px solid rgba(220, 70, 70, 0.45);
    color: #ffb4b4;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.clients-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

.client-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s ease;
}
.client-card:hover { border-color: var(--accent, #3b82f6); }

.client-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.client-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.client-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}
.client-id-badge {
    display: inline-block;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    word-break: break-all;
}

.client-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}
.client-dot-running { background: var(--status-up, #3fb950); }
.client-dot-stopped { background: #d0861a; }
.client-dot-undeployed { background: var(--text-muted, #8b949e); }

.client-status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.client-status-pill.pill-running {
    background: rgba(63, 185, 80, 0.12);
    color: var(--status-up, #3fb950);
    border: 1px solid rgba(63, 185, 80, 0.3);
}
.client-status-pill.pill-stopped {
    background: rgba(208, 134, 26, 0.12);
    color: #e3a957;
    border: 1px solid rgba(208, 134, 26, 0.3);
}
.client-status-pill.pill-undeployed {
    background: rgba(139, 148, 158, 0.12);
    color: var(--text-muted, #8b949e);
    border: 1px solid rgba(139, 148, 158, 0.25);
}

.client-meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.client-meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.meta-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.client-skills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 22px;
}
.skill-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #9fc5ff;
    font-size: 11px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.skill-chip-more { background: var(--bg, #111); color: var(--text-muted); border-color: var(--border); }
.skill-chip-empty { background: transparent; border: 1px dashed var(--border); color: var(--text-muted); font-style: italic; font-family: inherit; }

.client-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg, #161b22);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.btn-action:hover { background: rgba(255,255,255,0.04); }
.btn-detail { border-color: rgba(59, 130, 246, 0.5); color: #9fc5ff; }
.btn-detail:hover { background: rgba(59, 130, 246, 0.15); }
.btn-deploy { border-color: rgba(63, 185, 80, 0.45); color: #86d97a; }
.btn-deploy:hover { background: rgba(63, 185, 80, 0.15); }
.btn-restart { border-color: rgba(208, 134, 26, 0.45); color: #e3a957; }
.btn-restart:hover { background: rgba(208, 134, 26, 0.15); }
.btn-logs {}
.btn-delete { border-color: rgba(220, 70, 70, 0.45); color: #ff8080; margin-left: auto; }
.btn-delete:hover { background: rgba(220, 70, 70, 0.15); }

/* Shared primary button (also used by New Client link) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #2563eb;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.04); }
.btn-danger {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: #b33030;
    color: #ffffff;
    border: 1px solid #b33030;
    cursor: pointer;
}
.btn-danger:hover { background: #922424; }

/* Modals (confirmation + log viewer) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    min-width: 360px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.modal-box.modal-wide {
    max-width: 960px;
    width: 95%;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.modal-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-body {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 14px;
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 6px;
}
.modal-close:hover { color: var(--text-primary); }

.log-viewer {
    background: #0b0f14;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 12px;
    color: #c9d1d9;
    white-space: pre;
    overflow: auto;
    max-height: 60vh;
    min-height: 240px;
}

@media (max-width: 640px) {
    .clients-list { grid-template-columns: 1fr; }
    .client-card-actions .btn-delete { margin-left: 0; }
}

/* ============================================================
 * Client Detail Page (Portal UI Phase 2)
 * ============================================================ */

.detail-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    padding: 24px;
    font-size: 14px;
}
.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent, #4a9eff);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.detail-breadcrumb {
    margin-bottom: 14px;
}
.detail-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
}
.detail-back-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated, rgba(255,255,255,0.04));
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.detail-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.detail-name {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}
.detail-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.detail-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 14px;
}
.detail-section-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.detail-section-header .detail-section-title {
    margin: 0;
}
.detail-refresh-note {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 18px;
}
.info-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
}
.info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.info-value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

/* Skills table */
.skill-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.skill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.skill-table thead th {
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    text-align: left;
    font-weight: 500;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
.skill-table tbody tr {
    border-bottom: 1px solid var(--border);
}
.skill-table tbody tr:last-child {
    border-bottom: none;
}
.skill-table td {
    padding: 10px 12px;
    color: var(--text-primary);
    vertical-align: top;
}
.skill-table td .skill-row-desc {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
}
.skill-type-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(80, 150, 230, 0.15);
    color: #7fb9ef;
    font-size: 11px;
    font-weight: 500;
    text-transform: lowercase;
}
.skill-base-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(180, 120, 250, 0.15);
    color: #c09af3;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.skill-status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    text-transform: lowercase;
}
.skill-status-healthy {
    background: rgba(52, 199, 89, 0.15);
    color: #5bd27a;
}
.skill-status-nocreds {
    background: rgba(245, 166, 35, 0.15);
    color: #f5a623;
}
.cred-ok   { color: #5bd27a; font-size: 12px; }
.cred-missing { color: #f5a623; font-size: 12px; }
.cred-none { color: var(--text-muted); font-size: 12px; font-style: italic; }
.skill-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-style: italic;
}
.skill-actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}
.skill-action-locked {
    color: var(--text-muted);
    font-size: 12px;
}

/* Add skill panel */
.add-skill-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,0.015);
}
.add-skill-title {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.add-skill-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.skill-picker-select {
    flex: 1;
    min-width: 240px;
    padding: 8px 10px;
    background: var(--bg-body, #12151a);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
}
.add-skill-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    min-height: 16px;
}
.add-skill-cred-form {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
}
.cred-form-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}
.cred-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
}
.cred-field-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
}
.cred-field input {
    padding: 8px 10px;
    background: var(--bg-body, #12151a);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
}
.cred-field input:focus {
    outline: none;
    border-color: var(--accent, #4a9eff);
}
.cred-form-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* Logs controls */
.logs-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.logs-control-label {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.logs-control-label select,
#detail-logs-lines {
    padding: 4px 6px;
    background: var(--bg-body, #12151a);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
}

/* Config viewer */
.config-viewer {
    background: #0b0f14;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 12px;
    color: #c9d1d9;
    white-space: pre;
    overflow: auto;
    max-height: 40vh;
    min-height: 120px;
    margin: 0;
}

@media (max-width: 640px) {
    .detail-header { flex-direction: column; align-items: flex-start; }
    .detail-header-actions { width: 100%; }
    .detail-info-grid { grid-template-columns: 1fr 1fr; }
    .skill-table td, .skill-table th { padding: 8px; }
    .skill-actions-cell { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* =======================================================================
 * Portal UI Phase 3 — Client Creation Wizard
 * Appended to portal.css; follows the dark-theme conventions established in
 * Phase 1 (clients list) and Phase 2 (client detail).
 * ======================================================================= */

.wizard-success-banner {
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.45);
    color: #7be89f;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 13px;
}

.wizard-header {
    padding: 18px 0 4px 0;
}
.wizard-title {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 600;
    color: #e8e8e8;
}
.wizard-subtitle {
    margin: 0;
    color: #8a8a8a;
    font-size: 13px;
    max-width: 720px;
    line-height: 1.5;
}

/* -----------------------------------------------------------------------
 * Stepper
 * ----------------------------------------------------------------------- */
.wizard-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 0 16px 0;
    margin-bottom: 8px;
}
.step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #8a8a8a;
    cursor: default;
    user-select: none;
    transition: all 0.15s ease;
}
.step-item.active {
    background: rgba(94, 169, 255, 0.14);
    border-color: rgba(94, 169, 255, 0.45);
    color: #cfe3ff;
}
.step-item.completed {
    color: #7be89f;
    border-color: rgba(46, 204, 113, 0.35);
    background: rgba(46, 204, 113, 0.08);
    cursor: pointer;
}
.step-item.completed:hover {
    background: rgba(46, 204, 113, 0.14);
}
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    font-weight: 600;
    color: inherit;
}
.step-item.active .step-number {
    background: rgba(94, 169, 255, 0.28);
    color: #e8f2ff;
}
.step-item.completed .step-number {
    background: rgba(46, 204, 113, 0.25);
    color: #e6faee;
}
.step-label {
    font-size: 13px;
    font-weight: 500;
}
.step-connector {
    flex: 0 0 28px;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}

/* -----------------------------------------------------------------------
 * Cards
 * ----------------------------------------------------------------------- */
.wizard-body {
    display: block;
}
.wizard-step { display: none; }
.wizard-step.active { display: block; }

.wizard-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 20px 22px;
    margin-bottom: 16px;
}
.wizard-card-subtle {
    background: rgba(255, 255, 255, 0.015);
    border-style: dashed;
}
.wizard-section-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #d8d8d8;
}
.wizard-section-help {
    margin: 0 0 16px 0;
    color: #8a8a8a;
    font-size: 12.5px;
    line-height: 1.55;
    max-width: 720px;
}

/* -----------------------------------------------------------------------
 * Form fields
 * ----------------------------------------------------------------------- */
.wizard-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.wizard-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.wizard-row .wizard-field { flex: 1 1 220px; min-width: 0; }

.wizard-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wizard-label {
    font-size: 12.5px;
    font-weight: 500;
    color: #c8c8c8;
}
.wizard-label .required {
    color: #ff7979;
    margin-left: 2px;
}
.wizard-input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
    padding: 9px 11px;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.wizard-input:focus {
    outline: none;
    border-color: rgba(94, 169, 255, 0.55);
    background: rgba(0, 0, 0, 0.35);
}
.wizard-textarea {
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
}
.wizard-select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.field-help {
    color: #6f6f6f;
    font-size: 11.5px;
    line-height: 1.45;
}

/* -----------------------------------------------------------------------
 * Discovery section
 * ----------------------------------------------------------------------- */
.wizard-discovery-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.discover-status {
    font-size: 12px;
    color: #8a8a8a;
}
.discover-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12.5px;
    line-height: 1.6;
}
.discover-result > div { margin: 2px 0; }
.discover-ok { color: #7be89f; }
.discover-fail { color: #ff7979; }
.discover-neutral { color: #c6c6c6; }
.btn-link {
    background: transparent;
    border: none;
    color: #5ea9ff;
    cursor: pointer;
    padding: 0 4px;
    font-size: inherit;
    text-decoration: underline;
}
.btn-link:hover { color: #8dc2ff; }

/* -----------------------------------------------------------------------
 * Skill selection cards
 * ----------------------------------------------------------------------- */
.wizard-inline-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8a8a8a;
    padding: 14px 4px;
    font-size: 13px;
}
.skill-picker-group { margin-top: 8px; }
.skill-picker-group-title {
    margin: 12px 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #c8c8c8;
    display: flex;
    align-items: center;
    gap: 8px;
}
.skill-group-badge {
    font-size: 10.5px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    color: #b0b0b0;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.skill-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.skill-select-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.skill-select-card:hover {
    border-color: rgba(94, 169, 255, 0.35);
    background: rgba(94, 169, 255, 0.04);
}
.skill-select-card.selected {
    border-color: rgba(94, 169, 255, 0.65);
    background: rgba(94, 169, 255, 0.08);
}
.skill-select-card.locked {
    cursor: not-allowed;
    opacity: 0.92;
}
.skill-select-card.locked.selected {
    border-color: rgba(46, 204, 113, 0.55);
    background: rgba(46, 204, 113, 0.08);
}
.skill-select-card input[type="checkbox"] {
    margin-top: 2px;
    accent-color: #5ea9ff;
}
/* Phase 4.5 G043: visible "locked-checked" indicator for required base-skill cards.
   Replaces the native disabled checkbox, which browsers render so greyed-out that
   operators misread it as unchecked. */
.skill-check-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 4px;
    flex-shrink: 0;
}
.skill-check-indicator.skill-check-locked {
    background: rgba(46, 204, 113, 0.22);
    border: 1px solid rgba(46, 204, 113, 0.6);
    color: #2ecc71;
}
.skill-select-body { flex: 1; min-width: 0; }
.skill-select-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.skill-select-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #e8e8e8;
}
.skill-select-version {
    font-size: 11px;
    color: #7a7a7a;
}
.skill-select-desc {
    font-size: 12px;
    color: #a8a8a8;
    line-height: 1.5;
    margin-bottom: 8px;
    /* Clamp to 2 lines to keep cards balanced */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}
.skill-select-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.skill-badge {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #b0b0b0;
    font-weight: 500;
    text-transform: lowercase;
}
.skill-badge-base {
    background: rgba(46, 204, 113, 0.18);
    color: #8ee8b1;
}
.skill-badge-type.skill-badge-direct { background: rgba(94, 169, 255, 0.18); color: #a9cfff; }
.skill-badge-type.skill-badge-gateway { background: rgba(205, 133, 63, 0.18); color: #e8b87b; }
.skill-badge-type.skill-badge-base { background: rgba(46, 204, 113, 0.18); color: #8ee8b1; }
.skill-badge-creds { background: rgba(255, 193, 7, 0.15); color: #ffd866; }
.skill-badge-nocreds { background: rgba(255, 255, 255, 0.06); color: #a0a0a0; }

/* -----------------------------------------------------------------------
 * Credential forms (Step 3)
 * ----------------------------------------------------------------------- */
.credential-forms {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.credential-none {
    padding: 14px 16px;
    background: rgba(46, 204, 113, 0.06);
    border: 1px dashed rgba(46, 204, 113, 0.35);
    border-radius: 6px;
    color: #8ee8b1;
    font-size: 13px;
}
.credential-form {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    padding: 14px 16px;
}
.credential-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.credential-form-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #e8e8e8;
}
.credential-form-type {
    font-size: 11px;
    color: #7a7a7a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 999px;
}
.credential-form-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}
.cred-field-label {
    font-size: 12px;
    font-weight: 500;
    color: #c8c8c8;
    display: block;
    margin-bottom: 5px;
}
.cred-field-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 12.5px;
    font-family: inherit;
}
.cred-field-input:focus {
    outline: none;
    border-color: rgba(94, 169, 255, 0.55);
    background: rgba(0, 0, 0, 0.4);
}

/* -----------------------------------------------------------------------
 * Review (Step 4)
 * ----------------------------------------------------------------------- */
.review-section { margin-bottom: 18px; }
.review-section:last-child { margin-bottom: 0; }
.review-section-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #c8c8c8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
    background: rgba(0, 0, 0, 0.15);
    padding: 12px 14px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.review-cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
}
.review-cell-wide { grid-column: 1 / -1; }
.review-label {
    font-size: 11.5px;
    color: #8a8a8a;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.review-value {
    font-size: 13px;
    color: #e8e8e8;
    text-align: right;
    overflow-wrap: anywhere;
}
.review-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.review-skill-chip {
    background: rgba(94, 169, 255, 0.14);
    color: #b7d6ff;
    border: 1px solid rgba(94, 169, 255, 0.3);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
}
.review-skill-chip.chip-base {
    background: rgba(46, 204, 113, 0.14);
    color: #9fecbd;
    border-color: rgba(46, 204, 113, 0.35);
}
.review-empty {
    color: #7a7a7a;
    font-size: 12.5px;
    font-style: italic;
}
.review-credentials {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.review-cred-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12.5px;
}
.review-cred-skill {
    color: #e8e8e8;
    font-weight: 500;
}

/* -----------------------------------------------------------------------
 * Footer (nav buttons)
 * ----------------------------------------------------------------------- */
.wizard-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    margin-top: 6px;
    background: linear-gradient(to top, rgba(18, 18, 20, 0.95) 75%, rgba(18, 18, 20, 0));
    z-index: 2;
}
.wizard-footer-right {
    display: flex;
    gap: 10px;
}
.wizard-footer button[disabled] { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 640px) {
    .wizard-stepper { flex-wrap: wrap; row-gap: 10px; }
    .step-connector { display: none; }
    .wizard-row { flex-direction: column; gap: 12px; }
    .review-grid { grid-template-columns: 1fr; }
    .wizard-footer { flex-direction: column; gap: 10px; align-items: stretch; }
    .wizard-footer-right { flex-wrap: wrap; }
    .wizard-footer-right button { flex: 1; }
}

/* ===========================================================================
   Portal UI Phase 4 — Fleet Overview Dashboard
   Append-only additions. Uses the same dark-theme variables as prior phases.
   =========================================================================== */

/* View toggle (grid / table) */
.fleet-view-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}
.fleet-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.fleet-toggle-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.fleet-toggle-btn.active {
    background: var(--accent);
    color: #0a0f14;
}
.fleet-toggle-btn.active:hover { background: var(--accent-hover); }
.fleet-toggle-btn svg { opacity: 0.85; }

.fleet-last-refreshed {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Shared status pill — also used by fleet table rows */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}
.status-pill .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-running {
    background: rgba(63, 185, 80, 0.12);
    color: var(--status-up);
    border-color: rgba(63, 185, 80, 0.3);
}
.status-running .status-dot { background: var(--status-up); box-shadow: 0 0 6px var(--status-up); }
.status-stopped {
    background: rgba(248, 81, 73, 0.12);
    color: var(--status-down);
    border-color: rgba(248, 81, 73, 0.3);
}
.status-stopped .status-dot { background: var(--status-down); }
.status-undeployed {
    background: rgba(110, 118, 129, 0.18);
    color: var(--text-muted);
    border-color: rgba(110, 118, 129, 0.3);
}
.status-undeployed .status-dot { background: var(--text-muted); }

/* Grid view */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 8px;
}
.fleet-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.fleet-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.fleet-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.fleet-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fleet-card-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fleet-card-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
}
.fleet-skills-count { font-weight: 600; color: var(--text-primary); }
.fleet-skills-sep { color: var(--text-muted); padding: 0 2px; }
.skill-chip {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 212, 170, 0.08);
    border: 1px solid rgba(0, 212, 170, 0.2);
    border-radius: 999px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 500;
}
.skill-chip-more {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
    color: var(--text-muted);
}
.fleet-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
}
.fleet-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fleet-metric .metric-value {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.fleet-metrics-inactive {
    padding: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}
.fleet-card-undeployed { opacity: 0.75; }
.fleet-card-undeployed:hover { opacity: 1; }

/* Table view */
.fleet-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}
.fleet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.fleet-table thead th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.fleet-table thead th.sortable { cursor: pointer; user-select: none; }
.fleet-table thead th.sortable:hover { color: var(--text-primary); }
.fleet-table thead th.sorted { color: var(--accent); }
.fleet-table thead th .sort-arrow {
    margin-left: 4px;
    font-size: 9px;
    opacity: 0.8;
}
.fleet-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}
.fleet-table tbody tr:last-child td { border-bottom: none; }
.fleet-table tbody tr.fleet-row:hover { background: rgba(255,255,255,0.02); }
.fleet-row-link {
    display: block;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
}
.fleet-row-link:hover { color: var(--accent); }
.fleet-row-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.table-bar-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}
.table-bar-cell > span {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.table-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.table-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.6s ease;
}
.table-bar-fill[style*="width: 8"],
.table-bar-fill[style*="width: 9"] {
    background: var(--status-down);
}
.table-na { color: var(--text-muted); font-size: 12px; }
.btn-sm {
    padding: 5px 10px !important;
    font-size: 12px !important;
}

/* Responsive */
@media (max-width: 640px) {
    .fleet-grid { grid-template-columns: 1fr; }
    .fleet-view-toggle .fleet-toggle-btn { padding: 6px 8px; }
    .fleet-table { font-size: 12px; }
    .fleet-table thead th, .fleet-table tbody td { padding: 10px 8px; }
    .fleet-last-refreshed { display: none; }
}

/* ============================================================================
 * Praxis Portal — Phase 4.1 shared primitives
 * Gaps: G002, G021, G024, G025, G027, G038
 * Append-only; existing per-page classes remain for backwards compat until the
 * downstream phases refactor their templates.
 * ==========================================================================*/

/* New status tokens introduced in Phase 4.1 */
:root {
    --status-idle: #6e7681;       /* stopped / paused — same gray family as unknown */
    --status-pill-bg: rgba(255, 255, 255, 0.04);
}

/* -------- Global :focus-visible (G025) ------------------------------------ */
:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}
/* Neutralize the browser default for already-styled form controls so the rule
   above is the single source of truth. Form inputs keep their box focus styles
   via existing .input:focus rules if they exist. */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

/* -------- Button primitive (G002, G024) ----------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius, 8px);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    padding: 0 14px;
    min-height: 44px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn.btn-sm { min-height: 40px; font-size: 12px; padding: 0 12px; }
.btn.btn-md { min-height: 44px; }

.btn.btn-icon-only { padding: 0; width: 44px; }
.btn.btn-icon-only.btn-sm { width: 40px; }
.btn.btn-block { width: 100%; }

.btn .btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.btn .btn-icon svg { width: 16px; height: 16px; }

/* Variants */
.btn.btn-primary {
    background: var(--accent);
    color: #0e1117;
    border-color: var(--accent);
}
.btn.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn.btn-danger {
    background: transparent;
    color: var(--status-down);
    border-color: var(--status-down);
}
.btn.btn-danger:hover:not(:disabled) {
    background: rgba(248, 81, 73, 0.12);
}

.btn.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn.btn-ghost:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* -------- StatusPill primitive (G021, G038) ------------------------------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--status-pill-bg);
    border: 1px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
}
.status-pill .status-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.status-pill .status-pill-label { font-variant: small-caps; letter-spacing: 0.04em; }

.status-pill.status-pill-healthy { color: var(--status-up); border-color: rgba(63, 185, 80, 0.25); }
.status-pill.status-pill-healthy .status-pill-dot { background: var(--status-up); }

.status-pill.status-pill-degraded { color: var(--status-degraded); border-color: rgba(210, 153, 34, 0.3); }
.status-pill.status-pill-degraded .status-pill-dot { background: var(--status-degraded); }

.status-pill.status-pill-down { color: var(--status-down); border-color: rgba(248, 81, 73, 0.3); }
.status-pill.status-pill-down .status-pill-dot { background: var(--status-down); }

.status-pill.status-pill-stopped { color: var(--status-idle); border-color: rgba(110, 118, 129, 0.35); }
.status-pill.status-pill-stopped .status-pill-dot { background: var(--status-idle); }

.status-pill.status-pill-unknown { color: var(--text-muted); border-color: rgba(110, 118, 129, 0.25); }
.status-pill.status-pill-unknown .status-pill-dot { background: var(--text-muted); }

/* -------- Confirm dialog button overrides --------------------------------- */
.confirm-dialog-box { max-width: 520px; }
.confirm-dialog-overlay .modal-actions { gap: 8px; }

/* -------- Backward-compat: widen legacy icon-only buttons (G002, G024) ---- */
/* The old .btn-action pattern was 32x32 — bump it to 40x40 in place so existing
   users.html markup gets a compliant touch target until its Phase 4.x rewrite. */
.btn-action {
    min-width: 40px !important;
    min-height: 40px !important;
    width: 40px !important;
    height: 40px !important;
}

/* -------- Phase 4.3 (M2): clickable card styling ------------------------- */
/* Applied to .client-card and .node-card when they drill into a detail
   page on card-level click (buttons inside stop propagation). */
.client-card-clickable,
.node-card-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.client-card-clickable:hover,
.node-card-clickable:hover {
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}
.client-card-clickable:focus-visible,
.node-card-clickable:focus-visible {
    outline: 2px solid var(--border-focus, var(--accent, #3b82f6));
    outline-offset: 2px;
}
/* Nodes anchor needs the inner color reset so the whole card doesn't adopt
   link styling. */
a.node-card-clickable { text-decoration: none; color: inherit; }

/* =========================================================================
 * Phase 4.4: Platform Trust row + /isolation /backups /gateway pages
 * ========================================================================= */

.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.trust-card {
    display: block;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.trust-card:hover {
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}
.trust-card:focus-visible {
    outline: 2px solid var(--border-focus, var(--accent, #3b82f6));
    outline-offset: 2px;
}
.trust-card-wide {
    grid-column: 1 / -1;
}

.trust-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.trust-card-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.trust-card-desc {
    margin: 0 0 12px 0;
    color: var(--muted, #6b7280);
    font-size: 13px;
}
.trust-card-meta {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}
.trust-meta-label {
    color: var(--muted, #6b7280);
}
.trust-meta-value {
    font-variant-numeric: tabular-nums;
    color: var(--text, #111827);
}
.trust-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.trust-open-hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted, #6b7280);
}

/* Helpers used by the three new pages */
.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.muted {
    color: var(--muted, #6b7280);
}
.doc-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.6;
}
.doc-list li {
    margin-bottom: 4px;
}

/* Simple data table used by isolation/backups/gateway pages.
   Matches the visual language of existing tables elsewhere without
   pulling in their column-specific rules. */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    color: var(--muted, #6b7280);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
}
.data-table tbody td {
    padding: 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    vertical-align: middle;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table .cell-detail {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, monospace);
    font-size: 12px;
    color: var(--muted, #6b7280);
    word-break: break-all;
}

/* =========================================================================
 * Phase 4.5: Control Agent composite card (G023)
 * The Control Agent is structurally different from peer service cards —
 * it carries two independent sub-states (service + LLM inference). Style
 * it to visually signal the composite nature so operators don't read the
 * second pill as an anomaly.
 * ========================================================================= */
.status-card.status-card-composite {
    position: relative;
    outline: 1px dashed rgba(148, 163, 184, 0.35);
    outline-offset: -4px;
}
.status-card.status-card-composite .composite-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted, #6b7280);
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}
.composite-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.composite-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.composite-label {
    font-size: 11.5px;
    color: var(--muted, #6b7280);
    letter-spacing: 0.2px;
}

/* ==========================================================================
 * Phase 4.5 Fire 2 (G019) — Multi-select mode + bulk action bar
 * ========================================================================= */

#multi-select-toggle.active {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: var(--accent, #2563eb);
}

.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    margin: 12px 0 16px;
    background: var(--panel-2, #eef2ff);
    border: 1px solid var(--border, #c7d2fe);
    border-left: 4px solid var(--accent, #2563eb);
    border-radius: 8px;
    flex-wrap: wrap;
}
.bulk-action-label {
    font-size: 14px;
    color: var(--text, #111827);
}
.bulk-action-label strong {
    font-weight: 700;
    color: var(--accent, #2563eb);
    margin-right: 4px;
}
.bulk-link {
    background: none;
    border: none;
    color: var(--accent, #2563eb);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    margin-left: 8px;
    text-decoration: underline;
}
.bulk-link:hover { opacity: 0.8; }
.bulk-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.grid-multi-select .client-card-clickable { cursor: pointer; }
.grid-multi-select .client-card-actions { display: none; }
.client-card.client-card-multi-select { position: relative; }
.client-card.client-card-selected {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: -2px;
    background: var(--panel-2, #eef2ff);
}
.client-ms-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 4px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    cursor: pointer;
}
.client-ms-checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent, #2563eb);
    cursor: pointer;
}

/* Bulk setup modal */
.bulk-targets {
    padding: 8px 10px;
    background: var(--panel-2, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
}
.bulk-targets-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    margin-bottom: 6px;
}
.bulk-targets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bulk-target-chip {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-bg, #dbeafe);
    color: var(--accent, #2563eb);
    border-radius: 12px;
    font-size: 12px;
    font-family: var(--font-mono, monospace);
}

/* Bulk progress modal */
.bulk-progress-summary {
    padding: 8px 10px;
    background: var(--panel-2, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
}
.bulk-progress-running {
    color: var(--accent, #2563eb);
}
.bulk-progress-list {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
}
.bulk-progress-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.bulk-progress-table th,
.bulk-progress-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.bulk-progress-table th {
    background: var(--panel-2, #f9fafb);
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}
.bulk-progress-detail {
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}

/* ===========================================================================
   Phase 4.6 G028 — Chat model picker
   Drop-down that lives in the page title on /chat, grouped by provider.
   =========================================================================== */
.chat-model-picker {
    position: relative;
    display: inline-block;
}
.chat-model-picker-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, #e5e7eb);
    background: var(--panel-2, #f9fafb);
    color: var(--text, #111827);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}
.chat-model-picker-button:hover {
    border-color: var(--accent, #0f766e);
    background: var(--panel, #ffffff);
}
.chat-model-picker-button:focus-visible {
    outline: 2px solid var(--accent, #0f766e);
    outline-offset: 2px;
}
.chat-model-picker-label {
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-model-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 280px;
    max-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--panel, #ffffff);
    border: 1px solid var(--border, #d1d5db);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 300;
    padding: 6px 0;
}
.chat-model-group-header {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: var(--panel-2, #f9fafb);
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.chat-model-group-error,
.chat-model-group-empty {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    font-style: italic;
}
.chat-model-group-error {
    color: var(--status-down, #b91c1c);
}
.chat-model-row {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 13px;
    border: 0;
    background: transparent;
    color: var(--text, #111827);
    cursor: pointer;
    font-family: inherit;
    border-bottom: 1px solid var(--border-subtle, #f3f4f6);
}
.chat-model-row:last-child { border-bottom: 0; }
.chat-model-row:hover {
    background: var(--panel-2, #f9fafb);
}
.chat-model-row:focus-visible {
    outline: 2px solid var(--accent, #0f766e);
    outline-offset: -2px;
}
.chat-model-row-selected {
    background: rgba(15, 118, 110, 0.08);
}
.chat-model-row-selected::before {
    content: "✓ ";
    color: var(--accent, #0f766e);
    font-weight: 700;
}
.chat-model-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.chat-model-row-name { font-weight: 500; }
.chat-model-row-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--panel-2, #f3f4f6);
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.chat-model-row-desc {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    margin-top: 2px;
}

