:root {
    --bg: #0f0f12;
    --bg-card: #1a1a22;
    --bg-input: #2a2a32;
    --bg-sidebar: #14141a;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #00ff9d;
    --accent-hover: #00cc7a;
    --accent-gradient: linear-gradient(90deg, #00ff9d, #00cc7a);
    --accent-glow: 0 10px 25px rgba(0, 255, 157, 0.3);
    --border: #333;
    --border-hover: #00ff9d;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.4);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    --sidebar-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    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-sidebar);
    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: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #000;
    font-weight: 800;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.sidebar-nav {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav .nav-link {
    display: block;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: all 0.15s;
}

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

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sidebar-footer .nav-link {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sidebar-footer .nav-link:hover {
    color: var(--accent);
}

/* Main Content */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 30px;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    margin-left: 0;
}

.main:has(.login-page) {
    margin-left: 0;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 420px;
}

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

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: #000;
    font-weight: 800;
    font-size: 1.6rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    -webkit-text-fill-color: var(--text-muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.label {
    color: var(--accent);
    font-size: 0.95rem;
    display: block;
}

/* Filter bar grid — matches card width */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 16px;
    align-items: end;
}

.filter-grid .form-group {
    min-width: 0;
}

.filter-grid .filter-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding-top: 24px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    .filter-grid .filter-actions {
        grid-column: span 2;
    }
}

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

.input:focus,
.select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.25);
}

.input::placeholder {
    color: #555;
}

/* Custom Select — replaces native <select> with fully themeable dropdown */
.cs-wrap {
    position: relative;
    width: 100%;
}

.cs-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.cs-trigger:hover,
.cs-open .cs-trigger {
    border-color: var(--accent);
}

.cs-open .cs-trigger {
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.25);
}

.cs-arrow {
    margin-left: 8px;
    color: var(--text-muted);
    transition: transform 0.15s;
    font-size: 0.8rem;
}

.cs-open .cs-arrow {
    transform: rotate(180deg);
}

.cs-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 2000;
    margin-top: 4px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.cs-menu.cs-visible {
    display: block;
}

.cs-item {
    padding: 10px 14px;
    cursor: pointer;
    color: #ccc !important;
    font-size: 1rem;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.cs-item:hover,
.cs-item:focus,
.cs-item:active {
    background: #1a3a2a !important;
    color: #fff !important;
}

.cs-item.cs-selected {
    background: rgba(0, 255, 157, 0.2) !important;
    color: #00ff9d !important;
    font-weight: 600;
}

.cs-item.cs-selected:hover {
    background: rgba(0, 255, 157, 0.3) !important;
    color: #00ff9d !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #333;
    color: var(--text);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    box-shadow: var(--accent-glow);
}

.btn-secondary {
    background: #333;
    color: var(--text);
}

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

.btn-block {
    width: 100%;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-card);
    margin-bottom: 25px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.3);
    color: var(--accent);
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.85rem;
    text-align: center;
    min-width: 80px;
}

.badge-success {
    background: rgba(0, 255, 157, 0.15);
    color: var(--accent);
}

.badge-error {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.badge-info {
    background: rgba(255, 183, 77, 0.15);
    color: #ffb74d;
}

.badge-warning {
    background: rgba(255, 213, 0, 0.15);
    color: #ffd500;
}

/* Progress */
.progress-container {
    height: 8px;
    background: #333;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.4s ease;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 600; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

/* Upload Zone */
.upload-zone {
    border: 2px dashed #444;
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.drag-active {
    border-color: var(--accent);
    background: rgba(0, 255, 157, 0.05);
}

.upload-zone input[type="file"] { display: none; }

/* 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;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Stat Number */
.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* Tabs */
.tabs {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab-link {
    display: inline-block;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
    text-decoration: none;
}

.tab-link:hover {
    color: var(--text);
}

.tab-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    padding-top: 20px;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.autocomplete-dropdown:empty {
    display: none;
}

.autocomplete-dropdown:not(:empty) {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.1s;
}

.autocomplete-item:hover {
    background: var(--bg-input);
    color: var(--accent);
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-entry {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}

.activity-entry:last-child {
    border-bottom: none;
}

.activity-user {
    font-weight: 600;
    color: var(--accent);
}

.activity-action {
    color: var(--text);
}

.activity-time {
    font-size: 0.8rem;
    margin-left: auto;
}

.activity-ticket {
    font-size: 0.8rem;
}

/* Note Item */
.note-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.note-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

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

.note-user {
    font-weight: 600;
    font-size: 0.9rem;
}

.note-time {
    font-size: 0.8rem;
}

.note-body {
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.5;
}

.note-actions {
    margin-top: 12px;
}

/* Button Danger */
.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-danger:hover {
    background: #e74c3c;
}

/* Role Badges */
.badge-admin {
    background: rgba(0, 255, 157, 0.2);
    color: var(--accent);
}

.badge-staff {
    background: rgba(255, 183, 77, 0.2);
    color: #ffb74d;
}

.badge-customer {
    background: rgba(100, 181, 246, 0.2);
    color: #64b5f6;
}

/* Button Small */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-ghost:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* File item */
.file-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.file-thumb-link {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    display: block;
}

.file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 0.8rem;
}

#files-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.file-grid-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    gap: 12px;
    padding: 12px;
}

.file-grid-item.no-thumb .file-grid-thumb {
    display: none;
}

.file-grid-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-grid-thumb img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.file-grid-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-grid-name {
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-grid-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 0.75rem;
    flex: 1;
}

.file-grid-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

@media (max-width: 800px) {
    #files-list {
        grid-template-columns: 1fr;
    }
}
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

/* Text Muted */
.text-muted { color: var(--text-muted); }

/* Remove native blue outline on focus in WebKit/Chromium */
.input:focus-visible,
.select:focus-visible {
    outline: none;
}

/* Native Date/Time Picker — dark theme fix */
.dt-native-wrap {
    display: flex;
    gap: 8px;
}

input.dt-native {
    color-scheme: dark;
    flex: 1;
    min-width: 0;
}

input.dt-native[type="time"] {
    flex: 0 0 140px;
}

/* Theme the picker icon green to match accent (#00ff9d) */
input.dt-native::-webkit-calendar-picker-indicator {
    filter: brightness(0) saturate(100%) invert(76%) sepia(51%) saturate(3528%) hue-rotate(105deg) brightness(105%) contrast(101%);
    cursor: pointer;
}

/* ─── Pipeline UI ──────────────────────────────────────────────────────────── */

.pipeline-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.steps-container {
    margin-top: 8px;
}

.step-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
}

.step-row:hover {
    background: rgba(255,255,255,0.03);
}

.step-order {
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 24px;
}

.step-tool {
    flex: 1;
}

.step-status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
}

.step-status-badge.pending   { color: var(--text-muted); border-color: #555; }
.step-status-badge.running   { color: #00bfff; border-color: #00bfff; }
.step-status-badge.completed { color: var(--accent); border-color: var(--accent); }
.step-status-badge.failed    { color: #ff4444; border-color: #ff4444; }

.step-files {
    font-size: 0.85rem;
    white-space: nowrap;
}

.step-error {
    color: #ff4444;
    font-size: 0.85rem;
    cursor: help;
}

.step-duration {
    font-size: 0.8rem;
    white-space: nowrap;
}

.step-detail {
    background: rgba(0,0,0,0.2);
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.step-error-detail {
    color: #ff4444;
    background: rgba(255,68,68,0.1);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-top: 4px;
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.btn-retry-step {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-color: #ff4444;
    color: #ff4444;
}

.btn-retry-step:hover {
    background: rgba(255,68,68,0.15);
}

.step-editor-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.step-params-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.step-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
    flex: 1 0 auto;
}

.step-field .label-sm {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.step-field .input,
.step-field .select {
    font-size: 0.8rem;
    padding: 4px 8px;
    height: auto;
    min-height: 28px;
}

.step-field input[type="checkbox"] {
    margin-top: 4px;
}

.step-presets {
    width: 100%;
    margin-bottom: 6px;
}

.step-presets .step-preset-select {
    font-size: 0.8rem;
    width: 100%;
}

#pipeline-file-picker {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

#pipeline-file-picker label {
    width: calc(50% - 8px);
    min-width: 180px;
}

/* Tool Registry */
#tool-registry-container .table {
    margin-top: 0;
}

.tool-toggle {
    cursor: pointer;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 560px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    margin: 0;
    font-size: 1.2rem;
}

.btn-danger {
    border-color: #ff4444;
    color: #ff4444;
}

.btn-danger:hover {
    background: rgba(255,68,68,0.15);
}

/* ─── Review Modal (Processing Pipeline) ─────────────────────────────────── */
.review-modal {
    width: 720px;
    max-width: 95vw;
}

.review-image-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.review-image-card + .review-image-card {
    margin-top: 12px;
}

.review-preview img {
    object-fit: contain;
    background: #222;
}

.review-control-group {
    margin-top: 8px;
}

.review-fill-color,
.review-fill-color-text {
    vertical-align: middle;
}

.review-container .hidden {
    display: none !important;
}

.review-summary {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.review-summary strong {
    color: var(--text);
}

/* Step status badge colors */
.step-status-badge.review_needed {
    background: #f59e0b20;
    color: #f59e0b;
    border-color: #f59e0b;
}

/* Tool table */
.tool-table {
    width: 100%;
}

.tool-table th,
.tool-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

/* ─── Badge variants for Tools & Plugins table ──────────────────────────── */
.badge-plugin,
.badge-tool {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-plugin {
    background: #00ff9d20;
    color: #00ff9d;
    border: 1px solid #00ff9d44;
}
.badge-tool {
    background: #88888820;
    color: #aaa;
    border: 1px solid #88888844;
}

/* ─── Email Threaded View ─────────────────────────────────────────────── */
.email-thread {
    position: relative;
    margin-bottom: 12px;
}
.email-thread::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.email-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    position: relative;
    z-index: 1;
}
.email-reply {
    margin-left: 32px;
    margin-top: 8px;
    position: relative;
}
.email-reply::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    width: 20px;
    height: 2px;
    background: var(--border);
}
.email-reply .email-item {
    border-left: 2px solid var(--accent);
}
.email-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
