/* ── LanTech Orchestration — Frontend Dashboard (.pmf-app) ────── */

/* ── Canonical CSS variables (DO NOT OVERRIDE --primary) ──────── */

.pmf-app {
    --sidebar-w: 260px;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Layout ────────────────────────────────────────────────────── */

.pmf-app {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}
.pmf-app button {
    color: inherit !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    text-transform: none !important;
    text-decoration: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
}

/* ── Sidebar ───────────────────────────────────────────────────── */

.pmf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #1e293b;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.pmf-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.pmf-app .pmf-logo { font-size: 17px; font-weight: 700; color: #fff; }
.pmf-sidebar-header .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.pmf-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.pmf-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.pmf-user-name { font-weight: 600; font-size: 13px; color: #fff; }
.pmf-user-role { font-size: 11px; color: #94a3b8; }

/* ── Nav ───────────────────────────────────────────────────────── */

.pmf-nav {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    flex: 1;
}

.pmf-nav-item a,
.pmf-nav-subitem a {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 20px !important;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px !important;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.pmf-nav-item a:hover,
.pmf-nav-subitem a:hover {
    background: rgba(255,255,255,.06);
    color: #e2e8f0;
}

.pmf-nav-item.active > a,
.pmf-nav-subitem.active > a {
    background: rgba(59,130,246,.2);
    color: #60a5fa;
    font-weight: 600;
}

.pmf-nav-icon { display: flex; align-items: center; justify-content: center; width: 20px; flex-shrink: 0; font-size: 16px; }
.pmf-nav-icon.dashicons,
.pmf-nav-item .dashicons,
.pmf-nav-subitem .dashicons {
    font-size: 16px !important;
    width: 18px !important;
    height: 18px !important;
    opacity: .9;
}

.pmf-nav-item.active .dashicons,
.pmf-nav-subitem.active .dashicons {
    opacity: 1;
}

/* ── Nav groups (unified mode) ─────────────────────────────────── */

.pmf-app nav.pmf-sidebar .pmf-nav-group-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-height: 40px !important;
    padding: 12px 20px !important;
    border: none !important;
    background: none !important;
    border-left: 3px solid transparent !important;
    color: #e2e8f0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    font-style: normal !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    cursor: pointer;
    transition: background .15s;
}

.pmf-app nav.pmf-sidebar .pmf-nav-group-toggle:hover {
    background: rgba(255,255,255,.05) !important;
}

.pmf-nav-chevron { font-size: 11px; transition: transform .2s; }
.pmf-nav-group.expanded .pmf-nav-chevron { transform: rotate(90deg); }

.pmf-nav-subitems {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
}

.pmf-nav-group.expanded .pmf-nav-subitems {
    max-height: 600px;
}

.pmf-nav-subitem a {
    padding-left: 36px !important;
    font-size: 12.5px !important;
}

/* ── Sidebar footer ────────────────────────────────────────────── */

.pmf-sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pmf-sidebar-footer a {
    display: block !important;
    color: #94a3b8;
    text-decoration: none;
    font-size: 12px !important;
    padding: 6px 0 !important;
    transition: color .15s;
}

.pmf-sidebar-footer a:hover {
    color: #fff;
}

.pmf-sidebar-footer .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ── Main area ─────────────────────────────────────────────────── */

.pmf-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 24px 32px;
    min-width: 0;
}

.pmf-page-header {
    margin-bottom: 24px;
}

.pmf-page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text);
}

.pmf-page-header p {
    color: var(--text-muted);
    margin: 0;
}

/* ── Stats row ─────────────────────────────────────────────────── */

.pmf-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.pmf-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent, var(--primary));
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.pmf-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 4px;
}

.pmf-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

/* ── Cards ─────────────────────────────────────────────────────── */

.pmf-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.pmf-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.pmf-card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

/* ── Tables ────────────────────────────────────────────────────── */

.pmf-table-wrap {
    overflow-x: auto;
}

.pmf-table {
    width: 100%;
    border-collapse: collapse;
}

.pmf-table th,
.pmf-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.pmf-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .3px;
}

.pmf-table tbody tr:hover {
    background: #f8fafc;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.pmf-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    line-height: 1.4;
}

.pmf-action-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.pmf-action-btn.pmf-action-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pmf-action-btn.pmf-action-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.pmf-action-btn.pmf-action-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.pmf-action-btn.pmf-action-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.pmf-action-btn.pmf-action-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.pmf-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.pmf-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Badges ────────────────────────────────────────────────────── */

.lorch-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
}

.lorch-badge-ok,
.lorch-badge-online,
.lorch-badge-running,
.lorch-badge-healthy,
.lorch-badge-active,
.lorch-badge-complete {
    background: #d1fae5;
    color: #065f46;
}

.lorch-badge-warn,
.lorch-badge-degraded {
    background: #fef3c7;
    color: #92400e;
}

.lorch-badge-error,
.lorch-badge-offline,
.lorch-badge-stopped,
.lorch-badge-failed {
    background: #fee2e2;
    color: #991b1b;
}

.lorch-badge-muted,
.lorch-badge-provisioning,
.lorch-badge-pending {
    background: #e2e8f0;
    color: #475569;
}

.lorch-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ── Health grid ───────────────────────────────────────────────── */

.lorch-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    padding: 16px 20px;
}

.lorch-health-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.lorch-health-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}

.lorch-health-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.lorch-health-indicator.healthy  { background: var(--success); }
.lorch-health-indicator.degraded { background: var(--warning); }
.lorch-health-indicator.error    { background: var(--danger); }
.lorch-health-indicator.offline  { background: #94a3b8; }

.lorch-health-info {
    flex: 1;
    min-width: 0;
}

.lorch-health-name {
    font-weight: 600;
    font-size: 14px;
}

.lorch-health-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Hosts grid ────────────────────────────────────────────────── */

.lorch-hosts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.lorch-host-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.lorch-host-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.lorch-host-card-top h3 {
    margin: 0;
    font-size: 16px;
}

.lorch-host-card-body {
    padding: 16px 20px;
}

.lorch-host-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.lorch-host-row .label {
    color: var(--text-muted);
}

.lorch-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0;
}

.lorch-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width .3s ease;
}

.lorch-progress-bar.warn  { background: var(--warning); }
.lorch-progress-bar.danger { background: var(--danger); }

/* ── Charts area ───────────────────────────────────────────────── */

.lorch-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}

.lorch-chart-area {
    padding: 20px;
    min-height: 200px;
    position: relative;
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Modals ────────────────────────────────────────────────────── */

.lorch-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lorch-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
}

.lorch-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.lorch-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.lorch-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.lorch-modal-close {
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    line-height: 1;
}

.lorch-modal-close:hover {
    color: var(--text);
}

.lorch-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ── Form grid ─────────────────────────────────────────────────── */

.lorch-form {
    padding: 20px 24px;
}

.lorch-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.lorch-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lorch-field-full {
    grid-column: 1 / -1;
}

.lorch-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.lorch-field input,
.lorch-field select,
.lorch-field textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color .15s;
}

.lorch-field input:focus,
.lorch-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.lorch-field small {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Detail tabs ───────────────────────────────────────────────── */

.lorch-detail-tabs {
    display: flex;
    gap: 4px;
}

.lorch-tab {
    padding: 6px 14px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
}

.lorch-tab:hover {
    color: var(--text);
}

.lorch-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.lorch-tab-content {
    padding: 20px;
}

/* ── Security tabs ─────────────────────────────────────────────── */

.lorch-sec-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Provision steps ───────────────────────────────────────────── */

.lorch-provision-steps {
    padding: 20px 24px;
}

.lorch-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
}

.lorch-step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

.lorch-step-icon.complete { background: #d1fae5; color: #065f46; }
.lorch-step-icon.in_progress { background: #dbeafe; color: #1d4ed8; }
.lorch-step-icon.pending { background: #e2e8f0; color: #64748b; }
.lorch-step-icon.failed { background: #fee2e2; color: #991b1b; }

.lorch-step-name {
    flex: 1;
    font-weight: 500;
}

.lorch-step-dur {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Settings rows ─────────────────────────────────────────────── */

.lorch-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.lorch-setting-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Chart.js canvas sizing ────────────────────────────────────── */

.lorch-chart-area canvas {
    width: 100% !important;
    max-height: 280px;
}

/* ── Toast notifications ──────────────────────────────────────── */

#lorch-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.lorch-toast {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    animation: lorch-toast-in .25s ease;
    word-break: break-word;
}

.lorch-toast-info  { background: #1e40af; }
.lorch-toast-error { background: #991b1b; }
.lorch-toast-ok    { background: #065f46; }

.lorch-toast-out {
    opacity: 0;
    transform: translateX(30px);
    transition: all .3s ease;
}

@keyframes lorch-toast-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Caddy route card styles ──────────────────────────────────── */

#lorch-caddy-table .lorch-badge {
    font-size: 11px;
    padding: 1px 8px;
}

/* ── Loading ───────────────────────────────────────────────────── */

.pmf-loading {
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    font-size: 14px;
}

/* ── Mobile sidebar toggle ─────────────────────────────────────── */

.pmf-sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 101;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #1e293b;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ── Agent actions ─────────────────────────────────────────────── */

.lorch-agent-actions {
    white-space: nowrap;
}

.lorch-agent-actions .pmf-action-btn {
    padding: 4px 6px;
    min-width: unset;
    line-height: 1;
}

.lorch-agent-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

/* ── Agent detail panel ───────────────────────────────────────── */

.lorch-agent-detail-panel {
    margin-top: 16px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--bg-soft, #f8fafc);
    overflow: hidden;
}

.lorch-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg, #fff);
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.lorch-detail-header strong {
    font-size: 14px;
    color: var(--text, #1e293b);
}

.lorch-file-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--bg, #fff);
    padding: 0 12px;
}

.lorch-file-tab {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}

.lorch-file-tab:hover {
    color: var(--primary, #3b82f6);
}

.lorch-file-tab.active {
    color: var(--primary, #3b82f6);
    border-bottom-color: var(--primary, #3b82f6);
}

.lorch-file-editor-wrap {
    padding: 12px 16px;
}

.lorch-file-editor {
    width: 100%;
    min-height: 300px;
    max-height: 500px;
    resize: vertical;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 12px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background: var(--bg, #fff);
    color: var(--text, #1e293b);
    tab-size: 4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.lorch-file-editor:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.lorch-file-editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

/* ── Reset modal radio labels ─────────────────────────────────── */

#lorch-reset-agent-form .lorch-field label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background .15s;
}

#lorch-reset-agent-form .lorch-field label:hover {
    background: var(--bg-soft, #f1f5f9);
}

#lorch-reset-agent-form input[type="radio"] {
    margin-top: 3px;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 782px) {
    .pmf-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .pmf-sidebar.open {
        transform: translateX(0);
    }

    .pmf-sidebar-toggle {
        display: flex;
    }

    .pmf-main {
        margin-left: 0;
        padding: 60px 16px 24px;
    }

    .pmf-stats-row {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .lorch-form-grid {
        grid-template-columns: 1fr;
    }

    .lorch-charts-grid {
        grid-template-columns: 1fr;
    }

    .pmf-stat-value {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .pmf-stats-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Panel tabs (Files / Skills / Tools) ─────────────────────── */

.lorch-panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border, #e2e8f0);
    margin-bottom: 16px;
}

.lorch-panel-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--text-muted, #64748b);
    transition: color 0.15s, border-color 0.15s;
}

.lorch-panel-tab:hover {
    color: var(--text, #1e293b);
}

.lorch-panel-tab.active {
    color: var(--primary, #3b82f6);
    border-bottom-color: var(--primary, #3b82f6);
}

/* ── Capability list ─────────────────────────────────────────── */

.lorch-cap-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.lorch-cap-card {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 14px;
    background: var(--bg-soft, #f8fafc);
    transition: box-shadow 0.15s;
}

.lorch-cap-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lorch-cap-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.lorch-cap-card-header strong {
    flex: 1;
    font-size: 14px;
}

.lorch-cap-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.lorch-cap-badge-ok {
    background: #ecfdf5;
    color: #065f46;
}

.lorch-cap-desc {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    margin: 0 0 6px;
    line-height: 1.4;
}

.lorch-cap-files {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

.lorch-cap-details {
    list-style: disc;
    padding-left: 18px;
    margin: 0;
    font-size: 13px;
    color: var(--text-muted, #64748b);
}

.lorch-cap-details li {
    margin-bottom: 3px;
    line-height: 1.4;
}

/* ── Panel actions & empty states ────────────────────────────── */

.lorch-panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.lorch-panel-count {
    font-size: 13px;
    color: #94a3b8;
}

.lorch-empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted, #64748b);
}

.lorch-empty-state p {
    margin: 8px 0 0;
    font-size: 14px;
    font-weight: 600;
}

.lorch-empty-sub {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #94a3b8 !important;
    max-width: 380px;
    margin-left: auto !important;
    margin-right: auto !important;
    line-height: 1.5;
}

.lorch-cap-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Wide modal variant ─────────────────────────────────────── */

.lorch-modal-wide {
    max-width: 680px;
    width: 90vw;
}

/* ── Skill modal tabs ───────────────────────────────────────── */

.lorch-skill-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border, #e2e8f0);
    padding: 0 20px;
}

.lorch-skill-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.lorch-skill-tab:hover {
    color: var(--primary, #3b82f6);
}

.lorch-skill-tab.active {
    color: var(--primary, #3b82f6);
    border-bottom-color: var(--primary, #3b82f6);
}

.lorch-skill-pane {
    padding: 16px 20px 20px;
}

.lorch-skill-pane-hint {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    margin: 0 0 14px;
    line-height: 1.5;
}

/* ── Template grid ──────────────────────────────────────────── */

.lorch-template-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.lorch-template-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.lorch-template-card:hover {
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}

.lorch-template-card-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.lorch-template-card-body {
    flex: 1;
    min-width: 0;
}

.lorch-template-card-body strong {
    display: inline;
    font-size: 14px;
    margin-right: 6px;
}

.lorch-template-card-body p {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    margin: 4px 0 2px;
    line-height: 1.4;
}

.lorch-template-meta {
    font-size: 11px;
    color: #94a3b8;
}

.lorch-cap-badge-type {
    background: #eff6ff;
    color: #2563eb;
}

.lorch-template-card .pmf-action-btn {
    flex-shrink: 0;
    align-self: center;
}

/* ── Zip dropzone ───────────────────────────────────────────── */

.lorch-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 36px 20px;
    border: 2px dashed var(--border, #cbd5e1);
    border-radius: 10px;
    background: var(--bg-soft, #f8fafc);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.lorch-dropzone:hover,
.lorch-dropzone-active {
    border-color: var(--primary, #3b82f6);
    background: #eff6ff;
}

.lorch-dropzone-icon .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: var(--primary, #3b82f6);
}

.lorch-dropzone-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1e293b);
    margin: 0;
}

.lorch-dropzone-sub {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

/* ── Zip preview ────────────────────────────────────────────── */

.lorch-zip-preview {
    padding: 14px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    margin-bottom: 14px;
}

.lorch-zip-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.lorch-zip-preview-header .dashicons {
    color: var(--primary, #3b82f6);
}

.lorch-zip-preview-header strong {
    flex: 1;
}

.lorch-zip-manifest {
    margin-bottom: 12px;
}

.lorch-zip-manifest pre {
    background: var(--bg-soft, #f1f5f9);
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    overflow-x: auto;
    margin: 0;
}

/* ── Skill help box ─────────────────────────────────────────── */

.lorch-skill-help-box {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-soft, #f8fafc);
    border-radius: 8px;
    border: 1px solid var(--border, #e2e8f0);
    font-size: 13px;
}

.lorch-skill-help-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text, #1e293b);
}

.lorch-skill-help-box pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    overflow-x: auto;
    margin: 4px 0 12px;
    line-height: 1.5;
}

.lorch-skill-help-box pre:last-child {
    margin-bottom: 0;
}

/* ── Tool detail rows ───────────────────────────────────────── */

.lorch-tool-detail-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lorch-detail-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.lorch-detail-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card, #fff);
    color: var(--text, #1e293b);
}

.lorch-detail-row input:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.lorch-remove-detail-row {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background: var(--bg-soft, #f8fafc);
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.lorch-remove-detail-row:hover {
    color: var(--danger, #ef4444);
    border-color: var(--danger, #ef4444);
}

/* ── Tool preview ───────────────────────────────────────────── */

.lorch-tool-preview {
    padding: 0 20px 12px;
}

.lorch-tool-preview label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.lorch-tool-preview pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    min-height: 40px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════
 *  Phase 2 — New Dashboard View Styles
 * ══════════════════════════════════════════════════════════════ */

/* ── Activity Feed ─────────────────────────────────────────── */

.lorch-activity-list {
    max-height: 360px;
    overflow-y: auto;
}

.lorch-activity-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    font-size: 13px;
}

.lorch-activity-item:last-child {
    border-bottom: none;
}

.lorch-activity-time {
    flex-shrink: 0;
    width: 140px;
    color: var(--text-muted, #64748b);
    font-size: 12px;
}

.lorch-activity-action {
    flex-shrink: 0;
    width: 160px;
    font-weight: 600;
}

.lorch-activity-detail {
    flex: 1;
    color: var(--text-muted, #64748b);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lorch-activity-info    { border-left: 3px solid var(--primary, #3b82f6); }
.lorch-activity-warning { border-left: 3px solid var(--warning, #f59e0b); }
.lorch-activity-error   { border-left: 3px solid var(--danger, #ef4444); }
.lorch-activity-critical { border-left: 3px solid var(--danger, #ef4444); background: #fef2f2; }

/* ── Alert Row ─────────────────────────────────────────────── */

.lorch-alert-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.lorch-alert-row:last-child {
    border-bottom: none;
}

.lorch-alert-row > span:nth-child(2) {
    flex: 1;
    font-size: 13px;
}

/* ── Tabbed pane buttons (safety, monitoring, model-policies) ─ */

.lorch-safety-tabs,
.lorch-monitoring-tabs,
.lorch-modpol-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lorch-safety-tab.active,
.lorch-mon-tab.active,
.lorch-modpol-tab.active {
    background: var(--primary, #3b82f6) !important;
    color: #fff !important;
    border-color: var(--primary, #3b82f6) !important;
}
