/* CARL Control Panel - Nostalgic Warmth Meets Terminal Efficiency */
/* Flask static version - unified design system */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* Core palette - warm charcoal foundation */
    --bg-deep: #0d0d0f;
    --bg-primary: #141416;
    --bg-secondary: #1a1a1e;
    --bg-card: #1e1e24;
    --bg-elevated: #26262e;
    --bg-hover: #2a2a34;

    /* Amber/gold accent spectrum - CARL's identity */
    --accent: #d4a373;
    --accent-bright: #e9c088;
    --accent-dim: #b8956a;
    --accent-hover: #e9c088;
    --accent-glow: rgba(212, 163, 115, 0.15);
    --accent-glow-strong: rgba(212, 163, 115, 0.25);

    /* Text hierarchy - improved contrast */
    --text-primary: #ebe8e3;
    --text-secondary: #b5b0a8;
    --text-muted: #8a857c;
    --text-code: #d4d0c9;

    /* Semantic colors */
    --success: #7d9f6a;
    --success-dim: rgba(125, 159, 106, 0.15);
    --warning: #d4a373;
    --warning-dim: rgba(212, 163, 115, 0.15);
    --error: #c47a6a;
    --error-dim: rgba(196, 122, 106, 0.15);

    /* Borders */
    --border: #2a2a32;
    --border-subtle: #222228;
    --border-accent: #3d3830;
    --border-ornate: linear-gradient(90deg, transparent 0%, #3d3830 15%, #4a4438 50%, #3d3830 85%, transparent 100%);

    /* Toggle & interactive */
    --toggle-bg: #32302a;
    --toggle-active: var(--accent);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Typography */
    --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;
}

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

body {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E"),
        linear-gradient(180deg, var(--bg-deep) 0%, #0a0a0c 100%);
    background-attachment: fixed;
}

::selection { background: var(--accent-glow-strong); color: var(--text-primary); }

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-ornate);
}

header h1 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

header h1::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--accent-glow-strong);
}

.header-left { display: flex; flex-direction: column; gap: 4px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.workspace-info { display: flex; align-items: center; gap: 8px; }
.workspace-path { font-size: 0.7rem; color: var(--text-secondary); font-family: var(--font-mono); }
.btn-icon { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-muted); padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 0.75rem; transition: all 0.15s ease; }
.btn-icon:hover { background: var(--bg-card); border-color: var(--accent-dim); color: var(--accent); }

.btn-refresh { font-size: 1rem; padding: 4px 8px; font-weight: 600; }
.btn-refresh.spinning { animation: spin 0.8s linear infinite; pointer-events: none; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.save-status-inline { font-size: 0.7rem; color: var(--success); opacity: 0; transition: opacity 0.3s ease; }
.save-status-inline:not(:empty) { opacity: 1; }
.save-status-inline.error { color: var(--error); }

/* Status */
.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    transition: all 0.25s ease;
}

.status.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px rgba(125, 159, 106, 0.5);
    animation: connectedPulse 2s ease-in-out infinite;
}

@keyframes connectedPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(125, 159, 106, 0.5); }
    50% { box-shadow: 0 0 12px rgba(125, 159, 106, 0.8), 0 0 4px rgba(125, 159, 106, 1); }
}

.status.connected .status-text { color: var(--success); }
.status.disconnected .status-text { color: var(--error); }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-accent);
    position: relative;
    transition: all 0.25s ease;
}

.card:hover {
    border-color: var(--accent-dim);
    box-shadow: 0 0 0 1px rgba(212, 163, 115, 0.08);
}

.card::before, .card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid var(--border-accent);
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.25s ease;
}

.card::before { top: 6px; left: 6px; border-right: none; border-bottom: none; border-radius: 2px 0 0 0; }
.card::after { bottom: 6px; right: 6px; border-left: none; border-top: none; border-radius: 0 0 2px 0; }
.card:hover::before, .card:hover::after { opacity: 1; border-color: var(--accent-dim); }

.card h2 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--accent-bright);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.card-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.card-header-actions { display: flex; gap: 8px; }

/* Section Divider */
.section-divider {
    margin: 24px 0 16px 0;
    padding: 0 4px;
}

.section-divider h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-bright);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-accent);
    display: inline-block;
}

.section-divider p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Toggle Group */
.toggle-group { display: flex; flex-direction: column; gap: 8px; }

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 5px;
    border: 1px solid var(--border-subtle);
    transition: all 0.15s ease;
}

.toggle-item:hover { border-color: var(--border-accent); background: var(--bg-elevated); }

.toggle-info { display: flex; flex-direction: column; gap: 2px; }
.toggle-info label { font-size: 0.8rem; font-weight: 500; cursor: pointer; color: var(--text-primary); }
.toggle-description { font-size: 0.7rem; color: var(--text-secondary); }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--toggle-bg);
    transition: all 0.25s ease;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    transition: all 0.25s ease;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider { background: var(--accent); border-color: var(--accent-dim); box-shadow: 0 0 12px var(--accent-glow); }
input:checked + .slider::before { transform: translateX(20px); background: var(--bg-deep); }
input:disabled + .slider { opacity: 0.4; cursor: not-allowed; }

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

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--bg-deep); border-color: var(--accent-dim); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-bright); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-secondary { background: var(--toggle-bg); color: var(--text-primary); border-color: var(--border-accent); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-dim); background: var(--bg-hover); box-shadow: 0 0 6px var(--accent-glow); }
.btn-small { padding: 4px 8px; font-size: 0.7rem; }
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--error); }
.btn-danger:hover:not(:disabled) { background: var(--error); color: white; }
.btn-text { background: transparent; color: var(--text-muted); border: none; }
.btn-text:hover:not(:disabled) { color: var(--text-secondary); text-decoration: underline; }

/* Forms */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.8rem; color: var(--text-secondary); }

.form-group input[type="text"], .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.form-group input[type="text"]:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.form-hint { display: block; margin-top: 4px; font-size: 0.7rem; color: var(--text-secondary); }

/* Code */
code {
    font-family: var(--font-mono);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--accent);
    border: 1px solid var(--border-subtle);
}

.code-block {
    position: relative;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 12px;
}

.code-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-ornate);
}

.code-block pre {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-code);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 180px;
    overflow-y: auto;
    margin: 0;
    line-height: 1.6;
}

.code-block .btn-small { position: absolute; top: 8px; right: 8px; }

/* Loading */
.loading { opacity: 0.6; pointer-events: none; }

/* View Toggle */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Setup */
.setup-card { text-align: center; position: relative; }
.setup-card h2 { margin-bottom: 8px; text-transform: none; }
.setup-header { position: relative; margin-bottom: 8px; }
.setup-titles { text-align: center; }
.btn-back { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; font-size: 1.2rem; font-weight: 600; color: var(--accent); border-color: var(--accent-dim); background: var(--bg-secondary); }
.setup-form { margin: 24px 0; text-align: left; }
.setup-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.error-message { margin-top: 12px; padding: 8px 12px; background: var(--error-dim); border: 1px solid var(--error); border-radius: 5px; color: var(--error); font-size: 0.8rem; display: none; }
.error-message.visible { display: block; animation: slideIn 0.25s ease; }
.error-message.warning { background: var(--warning-dim); border-color: var(--warning); color: var(--warning); }
.setup-info { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-subtle); text-align: left; }
.setup-info h3 { font-size: 0.8rem; margin-bottom: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.setup-info ul { list-style: none; padding: 0; }
.setup-info li { padding: 8px 0; font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.setup-info li::before { content: ''; width: 4px; height: 4px; background: var(--accent); border-radius: 1px; }

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    padding: 2px;
    border-radius: 5px;
    border: 1px solid var(--border-subtle);
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { background: var(--accent); color: var(--bg-deep); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.25s ease; }
.tab-content p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; }

/* Navigation */
.main-nav {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    padding: 3px;
    border-radius: 5px;
    border: 1px solid var(--border);
}

.nav-tab, .nav-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-tab:hover, .nav-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.nav-tab.active, .nav-btn.active { background: var(--accent); color: var(--bg-deep); font-weight: 600; box-shadow: 0 2px 0 var(--accent-dim) inset, 0 0 8px var(--accent-glow); }

/* Hooks */
.hooks-card { border-color: var(--accent-dim); }
.hooks-card::before, .hooks-card::after { border-color: var(--accent-dim); opacity: 0.8; }

.hooks-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 5px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    border: 1px solid var(--border-subtle);
}

.hooks-status .status-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
.hooks-status.installed .status-indicator { background: var(--success); box-shadow: 0 0 6px rgba(125, 159, 106, 0.5); }

.hooks-step { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.hooks-step:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.hooks-step h3 { font-size: 0.8rem; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.hooks-step p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; }

.hooks-complete {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--success-dim);
    border: 1px solid var(--success);
    border-radius: 5px;
    color: var(--success);
    font-size: 0.8rem;
}

.hooks-complete .success-icon { font-size: 1rem; }

/* Hooks Location Options */
.hooks-location-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.hooks-location-options .radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}
.hooks-location-options .radio-option:hover { border-color: var(--accent-dim); }
.hooks-location-options .radio-option.selected { border-color: var(--accent); background: var(--accent-glow); }
.hooks-location-options .radio-option input[type="radio"] { display: none; }
.hooks-location-options .option-content { display: flex; flex-direction: column; gap: 4px; }
.hooks-location-options .option-content strong { font-size: 0.85rem; color: var(--text-primary); }
.hooks-location-options .radio-option.selected .option-content strong { color: var(--accent); }
.hooks-location-options .option-path { font-size: 0.75rem; color: var(--accent); font-family: var(--font-mono); }
.hooks-location-options .option-desc { font-size: 0.7rem; color: var(--text-muted); }

/* Result Messages */
.result-message { margin-top: 12px; padding: 8px 12px; border-radius: 5px; font-size: 0.8rem; display: none; animation: slideIn 0.25s ease; }
.result-message:not(:empty) { display: block; }
.result-message.success { background: var(--success-dim); border: 1px solid var(--success); color: var(--success); }
.result-message.error { background: var(--error-dim); border: 1px solid var(--error); color: var(--error); }

/* Sessions */
.sessions-card .card-header { display: flex; justify-content: space-between; align-items: center; }
.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.sessions-list .loading, .sessions-list .error { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 0.8rem; }
.sessions-list .error { color: var(--error); }
.no-sessions { padding: 16px; text-align: center; color: var(--text-muted); font-style: italic; font-size: 0.8rem; }

.session-item { background: var(--bg-secondary); border: 1px solid var(--border-accent); border-radius: 5px; overflow: hidden; transition: all 0.2s ease; }
.session-item:hover { border-color: var(--accent-dim); box-shadow: 0 0 8px var(--accent-glow); }
.session-item.expanded { border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow-strong); }
.session-header { display: flex; justify-content: space-between; align-items: center; padding: 12px; cursor: pointer; transition: background 0.2s ease; }
.session-header:hover { background: rgba(212, 163, 115, 0.05); }
.session-info { display: flex; flex-direction: column; gap: 2px; }
.session-label { font-weight: 600; color: var(--text-primary); font-size: 0.8rem; }
.session-time { font-size: 0.7rem; color: var(--text-secondary); }
.session-uuid { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); margin-right: 8px; }
.expand-icon { color: var(--text-secondary); font-size: 0.7rem; transition: transform 0.15s ease; }
.session-item.expanded .expand-icon { color: var(--accent); }
.session-overrides { padding: 12px; background: var(--bg-card); border-top: 1px solid var(--border-subtle); }
.override-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.override-row:last-child { border-bottom: none; }
.override-label { font-size: 0.8rem; color: var(--text-primary); }
.override-options { display: flex; gap: 2px; }

.radio-option {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-secondary);
}

.radio-option input { display: none; }
.radio-option:hover { border-color: var(--accent-dim); color: var(--text-primary); }
.radio-option.selected { background: var(--accent); border-color: var(--accent); color: var(--bg-deep); font-weight: 600; }

/* Optional Hooks */
.optional-hooks-card .card-header { display: flex; justify-content: space-between; align-items: center; }
.optional-hooks-list { display: flex; flex-direction: column; gap: 12px; }
.optional-hooks-list .loading, .optional-hooks-list .error { padding: 16px; text-align: center; color: var(--text-secondary); font-size: 0.8rem; }
.optional-hooks-list .no-hooks { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.8rem; }

/* Optional Hook Card - Three-State Layout */
.optional-hook-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    transition: all 0.15s ease;
}
.optional-hook-item:hover { border-color: var(--border-accent); }
.optional-hook-item.active { border-color: var(--success); background: var(--success-dim); }

/* Header row: name + status badge inline */
.optional-hook-info {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.optional-hook-name { font-weight: 600; color: var(--text-primary); font-size: 0.85rem; }
.optional-hook-badges { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.optional-hook-description { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }
.optional-hook-meta { font-size: 0.7rem; color: var(--text-muted); }
.optional-hook-meta code { background: var(--bg-deep); padding: 2px 6px; border-radius: 3px; font-size: 0.65rem; }

/* Status badges */
.optional-hook-status {
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}
.optional-hook-status.active { background: var(--success); color: var(--bg-deep); }
.optional-hook-status.partial { background: var(--accent); color: var(--bg-deep); }
.optional-hook-status.inactive { background: var(--toggle-bg); color: var(--text-muted); }

/* Resource type badges (HOOK, SKILL, COMMAND) */
.resource-type-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.resource-type-hook { background: var(--text-muted); color: var(--bg-deep); }
.resource-type-skill { background: #8b5cf6; color: white; }
.resource-type-command { background: #0ea5e9; color: white; }

/* Wiring section (inside installed hook card) */
.optional-hook-item .hooks-step {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}
.optional-hook-item .hooks-step h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.optional-hook-item .hooks-step p {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}
.optional-hook-item .code-block {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px;
}
.optional-hook-item .code-block pre {
    margin: 0;
    font-size: 0.65rem;
    color: var(--text-code);
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

/* Wired state - toggle and uninstall */
.optional-hook-item .override-row {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

/* Installations */
.existing-installations { margin: 12px 0; }
.installation-list { display: flex; flex-direction: column; gap: 8px; }

.installation-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
    font-family: var(--font-mono);
}

.installation-btn:hover { border-color: var(--accent-dim); background: var(--bg-elevated); }
.installation-btn.current { border-color: var(--success); background: var(--success-dim); }
.installation-btn.invalid { border-color: var(--warning); opacity: 0.7; }
.installation-name { font-weight: 600; color: var(--text-primary); font-size: 0.8rem; }
.installation-path { font-size: 0.7rem; color: var(--text-secondary); }

.current-badge, .error-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.03em; }
.current-badge { background: var(--success); color: var(--bg-deep); }
.error-badge { background: var(--warning); color: var(--bg-deep); }

.installation-item { display: flex; align-items: stretch; gap: 0; }
.installation-item .installation-btn { flex: 1; border-radius: 5px 0 0 5px; }
.installation-item .btn-remove-workspace { padding: 0 12px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-left: none; border-radius: 0 5px 5px 0; color: var(--text-muted); cursor: pointer; transition: all 0.15s ease; font-size: 1.2rem; font-weight: 300; }
.installation-item .btn-remove-workspace:hover { background: var(--error-dim); color: var(--error); border: 1px solid var(--error); }
.installation-item.current .installation-btn { border-radius: 5px; }
.installation-item.current .btn-remove-workspace { display: none; }
.installation-item.invalid .installation-btn { border-radius: 5px 0 0 5px; }

/* Domains */
.domain-search { margin-bottom: 16px; }
.domain-search input { width: 100%; padding: 10px 14px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; color: var(--text-primary); font-size: 0.8rem; font-family: var(--font-mono); }
.domain-search input:focus { outline: none; border-color: var(--accent); }
.domain-search input::placeholder { color: var(--text-muted); }

.domains-list { display: flex; flex-direction: column; gap: 12px; }
.domains-list .loading, .domains-list .error, .domains-list .no-domains { padding: 20px; text-align: center; color: var(--text-secondary); }
.domains-list .error { color: var(--error); }

.domain-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 12px; transition: all 0.15s ease; }
.domain-card.active { border-left: 3px solid var(--success); }
.domain-card.inactive { border-left: 3px solid var(--text-muted); opacity: 0.8; }

.domain-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.domain-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.domain-name { font-size: 1rem; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }

.domain-badge { font-size: 0.65rem; padding: 3px 10px; border-radius: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.domain-badge.always-on { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%); color: var(--bg-deep); }
.domain-badge.protected { background: linear-gradient(135deg, var(--warning) 0%, #c49463 100%); color: var(--bg-deep); }
.domain-badge.special { background: linear-gradient(135deg, #a88ba8 0%, #8a6b8a 100%); color: var(--bg-deep); }
.domain-badge.carl { background: linear-gradient(135deg, #7c5c7c 0%, #5a3d5a 100%); color: #f0e6f0; border: 1px solid #8a6b8a; }

/* Domains Sections */
.domains-section { margin-bottom: 20px; }
.domains-section:last-child { margin-bottom: 0; }
.section-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; padding-left: 4px; }
.core-domains-section { padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.domain-trigger { display: flex; align-items: center; gap: 4px; }
.core-trigger { font-style: italic; color: var(--text-secondary); }

.state-toggle { min-width: 80px; }
.state-toggle.state-active { background: var(--success); color: white; border: none; }
.state-toggle.state-active:hover:not(:disabled) { background: #6b8f5a; }
.state-toggle.state-inactive { background: var(--toggle-bg); color: var(--text-secondary); border: none; }
.state-toggle.state-inactive:hover:not(:disabled) { background: var(--bg-hover); }

.domain-info { display: flex; gap: 24px; margin-bottom: 12px; flex-wrap: wrap; }
.domain-stat { display: flex; gap: 6px; align-items: center; }
.domain-keywords { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 0; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); }
.stat-value { font-size: 0.8rem; color: var(--text-primary); }
.domain-keywords .stat-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.domain-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); }

/* Modals */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.modal-confirm { z-index: 2000; } /* Confirmation modals appear above other modals */
.modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px); }

.modal-content {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.3);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn { from { opacity: 0; transform: translateY(-20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-content::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--border-ornate); border-radius: 8px 8px 0 0; }
.modal-content.modal-small { max-width: 400px; }
.modal-content.modal-large { max-width: 600px; }
.modal-content.modal-medium { max-width: 500px; }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.modal-header h2, .modal-header h3 { font-size: 0.875rem; font-weight: 600; margin: 0; color: var(--accent-bright); }
.modal-close { background: none; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; transition: color 0.15s ease; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 16px; }
.modal-body .bootstrap-list { margin: 12px 0; padding-left: 20px; font-size: 0.8rem; }
.modal-body .bootstrap-list li { margin-bottom: 6px; color: var(--text-secondary); }
.modal-body .bootstrap-list code { background: var(--bg-deep); padding: 2px 6px; border-radius: 3px; font-size: 0.75rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-subtle); }

/* Import Domains Modal */
.import-source-row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; margin: 12px 0; }
.import-source-row .path-value { flex: 1; font-size: 0.8rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-warning { padding: 10px 12px; background: var(--warning-dim); border: 1px solid var(--warning); border-radius: 5px; margin-top: 12px; }
.import-warning p { margin: 0; font-size: 0.8rem; color: var(--warning); }
#import-domains-section h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }

/* Addons */
.addons-section { margin-bottom: 24px; }
.addons-section h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 12px; color: var(--accent-bright); text-transform: uppercase; }
.addons-list { display: flex; flex-direction: column; gap: 12px; }
.addons-list .loading, .addons-list .error, .addons-list .no-addons { padding: 20px; text-align: center; color: var(--text-secondary); }
.addons-list .error { color: var(--error); }

.addon-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 16px; transition: all 0.15s ease; }
.addon-card:hover { border-color: var(--accent-dim); }
.addon-card.installed { border-left: 3px solid var(--success); }
.addon-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.addon-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.addon-version { font-size: 0.7rem; color: var(--text-secondary); background: var(--bg-card); padding: 2px 8px; border-radius: 10px; }
.addon-description { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
.addon-meta { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.addon-stat { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-secondary); }
.addon-stat .count { font-weight: 600; color: var(--text-primary); }
.addon-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.addon-tag { font-size: 0.65rem; padding: 3px 8px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 10px; color: var(--text-secondary); }
.addon-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); }

/* Checkboxes */
.checkbox-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.checkbox-item { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 5px; cursor: pointer; transition: all 0.15s ease; }
.checkbox-item:hover { border-color: var(--accent-dim); }
.checkbox-item input[type="checkbox"] { margin-top: 2px; accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-item-info { flex: 1; min-width: 0; }
.checkbox-item-name { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.checkbox-item-detail { font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px; }
.checkbox-item .item-name { font-family: var(--font-mono); font-weight: 500; flex: 1; }
.checkbox-item .item-meta { font-size: 0.7rem; color: var(--text-secondary); }

/* Badges */
.conflict-badge, .special-badge, .state-badge { font-size: 0.65rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.conflict-badge { background: var(--warning); color: var(--bg-deep); }
.special-badge { background: #9c7b9c; color: var(--bg-deep); }
.state-badge { background: var(--toggle-bg); color: var(--text-muted); }
.state-badge.active { background: var(--success); color: var(--bg-deep); }
.state-badge.inactive { background: var(--toggle-bg); color: var(--text-muted); }

/* Rules */
.rules-list { display: flex; flex-direction: column; gap: 8px; }
.rules-list .loading, .rules-list .no-rules { padding: 20px; text-align: center; color: var(--text-muted); }
.rule-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 5px; transition: all 0.15s ease; }
.rule-item:hover { border-color: var(--accent-dim); }
.rule-item.editing { border-color: var(--accent-dim); background: var(--bg-card); box-shadow: inset 0 0 0 1px var(--accent-glow); }
.rule-index { flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); border: 1px solid var(--border-accent); border-radius: 5px; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.rule-content { flex: 1; min-width: 0; }
.rule-text { font-size: 0.8rem; color: var(--text-primary); line-height: 1.5; word-break: break-word; }
.rule-text.placeholder { color: var(--text-muted); font-style: italic; }
.rule-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rule-action-btn { padding: 6px 8px; background: transparent; border: 1px solid var(--border-subtle); border-radius: 3px; color: var(--text-muted); font-size: 0.7rem; cursor: pointer; transition: all 0.15s ease; }
.rule-action-btn:hover { border-color: var(--accent-dim); color: var(--text-primary); }
.rule-action-btn.delete:hover { border-color: var(--error); color: var(--error); background: var(--error-dim); }
.rule-action-btn.save { background: var(--accent); border-color: var(--accent-dim); color: var(--bg-deep); font-weight: 600; padding: 6px 12px; }
.rule-action-btn.save:hover { background: var(--accent-bright); box-shadow: 0 0 8px var(--accent-glow); }
.rule-action-btn.cancel { background: var(--bg-elevated); border-color: var(--border-accent); color: var(--text-secondary); }
.rule-action-btn.cancel:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Toast Notifications */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; max-width: 400px; }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); animation: toast-slide-in 0.3s ease; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--accent); }
.toast-message { flex: 1; font-size: 0.85rem; color: var(--text-primary); line-height: 1.4; }
.toast-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 0; line-height: 1; }
.toast-close:hover { color: var(--text-primary); }
.toast-fade-out { animation: toast-fade-out 0.3s ease forwards; }

@keyframes toast-slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-fade-out { to { transform: translateX(100%); opacity: 0; } }

/* Session Details Expanded */
.session-details { padding: 16px; background: var(--bg-card); border-top: 1px solid var(--border-subtle); }
.session-meta { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.meta-row { display: flex; align-items: center; padding: 6px 0; gap: 12px; }
.meta-label { font-size: 0.75rem; color: var(--text-secondary); min-width: 100px; flex-shrink: 0; }
.meta-value { font-size: 0.8rem; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.meta-value code { font-family: var(--font-mono); font-size: 0.75rem; background: var(--bg-card); padding: 2px 6px; border-radius: 3px; word-break: break-all; color: var(--text-code); }
.meta-value.truncated { cursor: help; }
.meta-value.domains-list { color: var(--accent); font-weight: 500; }
.meta-value.filepath code { font-size: 0.7rem; color: var(--text-muted); }
.copy-btn { background: transparent; border: none; cursor: pointer; padding: 2px 4px; font-size: 0.75rem; opacity: 0.6; transition: opacity 0.15s; color: var(--text-muted); }
.copy-btn:hover { opacity: 1; color: var(--accent); }
.copy-btn.resume-btn { color: #4ade80; }
.copy-btn.resume-btn:hover { opacity: 1; color: #22c55e; }
.copy-btn.resume-btn.danger { color: #facc15; }
.copy-btn.resume-btn.danger:hover { opacity: 1; color: #eab308; }

.session-domains-preview { font-size: 0.7rem; color: var(--accent); background: var(--accent-glow); padding: 2px 8px; border-radius: 10px; margin-top: 4px; cursor: help; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-title-edit { flex: 1; }
.session-title-input { width: 100%; padding: 6px 10px; font-size: 0.8rem; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-family: var(--font-mono); outline: none; transition: border-color 0.15s; }
.session-title-input:focus { border-color: var(--accent); }
.session-title-input::placeholder { color: var(--text-muted); opacity: 0.6; }

.session-overrides-section { margin-top: 8px; }
.overrides-header { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.override-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.override-meta { font-size: 0.65rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; cursor: help; }
.override-meta .meta-prefix { color: var(--text-secondary); font-weight: 500; }
.override-meta.exclude { opacity: 0.6; font-style: italic; }
.override-toggle { display: flex; align-items: center; }

/* Domain Card Wrapper & Reorder */
.domain-card-wrapper { display: flex; gap: 12px; }
.domain-reorder { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.domain-content { flex: 1; min-width: 0; }
.reorder-btn { padding: 4px 6px; background: transparent; border: 1px solid var(--border-subtle); border-radius: 3px; color: var(--text-muted); font-size: 0.65rem; cursor: pointer; transition: all 0.15s; line-height: 1; }
.reorder-btn:hover:not(:disabled) { border-color: var(--accent-dim); color: var(--accent); background: var(--accent-glow); }
.reorder-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Rule Reorder */
.rule-reorder { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.rule-edit-input { width: 100%; padding: 10px 12px; background: var(--bg-deep); border: 1px solid var(--border-accent); border-radius: 5px; color: var(--text-primary); font-size: 0.8rem; font-family: var(--font-mono); resize: vertical; min-height: 70px; line-height: 1.5; }
.rule-edit-input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 2px var(--accent-glow); }
.rule-edit-actions { display: flex; gap: 8px; margin-top: 10px; }

/* CLAUDEMD Integration Card */
.claudemd-card { border-color: var(--warning); background: linear-gradient(135deg, var(--bg-card) 0%, rgba(212, 163, 115, 0.05) 100%); }
.claudemd-card h2 { color: var(--warning); }
.claudemd-card .warning-text { color: var(--warning); font-weight: 500; }
.claudemd-status { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--warning-dim); border: 1px solid var(--warning); border-radius: 5px; margin-bottom: 16px; font-size: 0.8rem; }
.claudemd-status .status-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); animation: statusPulse 2s infinite; }
.claudemd-status .status-indicator.warning { background: var(--warning); }
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.claudemd-step { margin-bottom: 16px; }
.claudemd-step p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 12px; }
.claudemd-complete { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--success-dim); border: 1px solid var(--success); border-radius: 5px; color: var(--success); font-size: 0.8rem; }
.claudemd-complete .success-icon { font-size: 1rem; }
.claudemd-path-section { margin-bottom: 16px; }
.claudemd-path-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: 5px; font-size: 0.75rem; }
.claudemd-path-row .path-label { color: var(--text-muted); white-space: nowrap; }
.claudemd-path-row .path-value { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); background: transparent; padding: 2px 6px; border-radius: 3px; }
.claudemd-path-row .btn-small { padding: 4px 10px; font-size: 0.7rem; }
.claudemd-dismiss-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-subtle); text-align: center; }
.claudemd-dismiss-section .btn-text { font-size: 0.75rem; }

/* Context Brackets */
.bracket-section { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.bracket-section.enabled { border-left: 3px solid var(--success); }
.bracket-section.disabled { border-left: 3px solid var(--text-muted); opacity: 0.7; }
.bracket-header { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--bg-card); }
.bracket-info { display: flex; flex-direction: column; gap: 2px; }
.bracket-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.bracket-desc { font-size: 0.7rem; color: var(--text-secondary); }
.bracket-rules { padding: 12px; }
.bracket-rule, .command-rule { display: flex; gap: 10px; padding: 8px; background: var(--bg-card); border-radius: 4px; margin-bottom: 6px; font-size: 0.8rem; align-items: flex-start; }
.bracket-rule:last-child { margin-bottom: 0; }
.command-rule:last-child { margin-bottom: 0; }
.rule-num { flex-shrink: 0; width: 20px; color: var(--text-secondary); font-weight: 500; }
.rule-text { flex: 1; word-break: break-word; }
.bracket-rule-actions { display: flex; gap: 4px; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.bracket-rule:hover .bracket-rule-actions { opacity: 1; }
.bracket-rule-actions .btn-icon { padding: 2px 6px; font-size: 0.75rem; background: transparent; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.bracket-rule-actions .btn-icon:hover { background: var(--bg-elevated); color: var(--text); border-color: var(--accent-dim); }
.bracket-rule-actions .btn-icon.btn-danger:hover { background: rgba(239, 68, 68, 0.15); color: #ef4444; border-color: #ef4444; }
.bracket-rule-reorder { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.add-bracket-rule-btn { margin-top: 8px; }

/* Commands Sections */
.command-section { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; transition: border-color 0.15s; }
.command-section:hover { border-color: var(--accent-dim); }
.command-section:focus-within { border-color: var(--accent-dim); outline: none; }
.command-header { display: flex; justify-content: space-between; align-items: center; padding: 12px; cursor: pointer; }
.command-reorder { display: flex; flex-direction: column; gap: 2px; margin-right: 8px; }
.command-reorder .reorder-btn { padding: 2px 6px; font-size: 0.6rem; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 3px; cursor: pointer; color: var(--text-muted); line-height: 1; outline: none; }
.command-reorder .reorder-btn:hover:not(:disabled) { background: var(--accent); color: var(--bg-deep); border-color: var(--accent); }
.command-reorder .reorder-btn:focus { outline: none; border-color: var(--accent-dim); }
.command-info { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; }
.command-name { font-weight: 600; font-family: var(--font-mono); color: #9c7b9c; }
.command-count { font-size: 0.75rem; color: var(--text-secondary); }
.command-rules { padding: 12px; background: var(--bg-card); border-top: 1px solid var(--border-subtle); }
.command-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; }

/* Modal Detail Section */
.detail-section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border-subtle); }
.detail-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.detail-section h4 { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.section-header h4 { margin-bottom: 0; }
.section-header .btn { flex-shrink: 0; }
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.config-item label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.config-item input { width: 100%; padding: 8px 10px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; color: var(--text-primary); font-size: 0.8rem; font-family: var(--font-mono); }
.config-item input:focus { outline: none; border-color: var(--accent); }
.save-status-inline { margin-left: 12px; font-size: 0.75rem; }
.save-status-inline.success { color: var(--success); }
.save-status-inline.error { color: var(--error); }
.text-warning { color: var(--warning); font-size: 0.8rem; margin-top: 8px; }

/* Preview Modal */
.preview-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.preview-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.preview-section h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.preview-meta { display: flex; flex-direction: column; gap: 8px; }
.preview-meta p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.preview-meta strong { color: var(--text-primary); }

/* Accordion Checkbox Items */
.checkbox-item-accordion { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: all 0.15s; margin-bottom: 8px; }
.checkbox-item-accordion:last-child { margin-bottom: 0; }
.checkbox-item-accordion:hover { border-color: var(--accent-dim); }
.checkbox-item-accordion.expanded { border-color: var(--accent); }
.checkbox-item-accordion.has-conflict { border-left: 3px solid var(--warning); }
.accordion-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; cursor: pointer; }
.checkbox-label-wrap { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.checkbox-label-wrap input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }

/* Rules Tooltip */
.rules-tooltip-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.rules-tooltip-trigger .info-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.rules-tooltip-trigger:hover .info-icon {
    color: var(--accent);
}

.rules-tooltip {
    display: none;
    position: fixed;
    min-width: 300px;
    max-width: 420px;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    box-shadow: var(--shadow-lg), 0 0 12px var(--accent-glow);
    z-index: 10000;
    font-size: 0.75rem;
    line-height: 1.4;
    pointer-events: none;
}

.rules-tooltip-trigger:hover .rules-tooltip {
    display: block;
    animation: tooltipFadeIn 0.15s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

.tooltip-rule {
    display: flex;
    gap: 8px;
    padding: 4px 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.tooltip-rule:last-child {
    margin-bottom: 0;
}

.tooltip-rule-num {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 16px;
    flex-shrink: 0;
}

.tooltip-more {
    padding: 6px 0 0;
    color: var(--accent);
    font-size: 0.7rem;
    font-style: italic;
    text-align: center;
}

/* Recall keyword tooltip */
.recall-tooltip-trigger {
    position: relative;
    cursor: help;
    display: inline-flex;
    align-items: center;
}
.recall-tooltip-trigger .recall-icon {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.recall-tooltip-trigger:hover .recall-icon {
    opacity: 1;
}
.recall-tooltip-trigger:hover .rules-tooltip {
    opacity: 1;
    visibility: visible;
    animation: tooltipFadeIn 0.15s ease;
}
.recall-tooltip .tooltip-keyword {
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-family: var(--font-mono);
}
.recall-tooltip .tooltip-keyword:last-child {
    margin-bottom: 0;
}
.checkbox-label .domain-name { font-weight: 600; font-family: var(--font-mono); color: var(--text-primary); font-size: 0.85rem; }
.checkbox-meta { font-size: 0.7rem; color: var(--text-secondary); background: var(--bg-card); padding: 2px 6px; border-radius: 10px; }
.checkbox-meta.secondary { background: transparent; color: var(--text-muted); }
.checkbox-meta.bracket-pill { font-size: 0.6rem; font-family: var(--font-mono); }
.checkbox-meta.bracket-pill.empty { opacity: 0.5; }
.checkbox-meta.cmd-pill { font-size: 0.6rem; font-family: var(--font-mono); color: var(--accent); }
.checkbox-meta.recall-pill { }
.bracket-badge { font-size: 0.6rem; font-family: var(--font-mono); padding: 2px 6px; border-radius: 10px; }
.bracket-badge.fresh { color: #4ade80; background: rgba(74, 222, 128, 0.15); }
.bracket-badge.moderate { color: #facc15; background: rgba(250, 204, 21, 0.15); }
.bracket-badge.depleted { color: #f87171; background: rgba(248, 113, 113, 0.15); }
.special-badge { font-size: 0.65rem; color: var(--accent); background: var(--accent-glow); padding: 2px 6px; border-radius: 10px; font-style: italic; }
.checkbox-item.is-core { border-color: var(--accent-dim); }
.checkbox-item.is-core strong { color: var(--accent); }
.checkbox-item input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; }
.checkbox-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
.accordion-toggle { background: transparent; border: 1px solid var(--border-subtle); border-radius: 4px; color: var(--text-muted); padding: 4px 8px; font-size: 0.65rem; cursor: pointer; transition: all 0.15s; font-family: var(--font-mono); }
.accordion-toggle:hover { background: var(--bg-card); border-color: var(--accent-dim); color: var(--text-primary); }
.accordion-content { display: none; padding: 0 12px 12px; border-top: 1px solid var(--border-subtle); margin-top: 0; padding-top: 10px; background: var(--bg-card); }
.preview-rules-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.preview-rule { font-size: 0.75rem; color: var(--text-primary); line-height: 1.4; padding: 6px 8px; background: var(--bg-secondary); border-radius: 4px; display: flex; gap: 8px; }
.preview-rule .rule-num { color: var(--text-muted); font-weight: 600; flex-shrink: 0; min-width: 20px; }
.preview-rule.no-rules { color: var(--text-muted); font-style: italic; }

/* Rule-level Selection */
.preview-rule-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 5px; cursor: pointer; transition: all 0.15s; margin-bottom: 6px; }
.preview-rule-item:last-child { margin-bottom: 0; }
.preview-rule-item:hover { border-color: var(--accent-dim); background: var(--accent-glow); }
.preview-rule-item input[type="checkbox"] { margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.preview-rule-item .rule-num { color: var(--text-muted); font-weight: 600; flex-shrink: 0; min-width: 24px; }
.preview-rule-item .rule-text { font-size: 0.75rem; color: var(--text-primary); line-height: 1.4; }

/* Select All/None Controls */
.rule-select-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle); }
.btn-link { background: none; border: none; color: var(--accent); font-size: 0.7rem; cursor: pointer; padding: 0; text-decoration: underline; font-family: var(--font-mono); }
.btn-link:hover { color: var(--accent-bright); }
.rule-select-controls .separator { color: var(--text-muted); font-size: 0.7rem; }

/* Conflict Options */
.conflict-options { display: flex; flex-direction: column; gap: 8px; }
.conflict-options .radio-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; cursor: pointer; transition: all 0.15s; }
.conflict-options .radio-option:hover { border-color: var(--accent-dim); }
.conflict-options .radio-option:has(input:checked) { border-color: var(--accent); background: var(--accent-glow); }
.conflict-options .radio-option:has(input:checked) strong { color: var(--accent); }
.conflict-options .radio-option input[type="radio"] { margin-top: 3px; accent-color: var(--accent); }
.conflict-options .radio-option span { display: flex; flex-direction: column; gap: 2px; }
.conflict-options .radio-option strong { font-size: 0.85rem; color: var(--text-primary); }
.conflict-options .radio-option small { font-size: 0.7rem; color: var(--text-muted); }

/* Commands Addon Preview */
.commands-addon-preview { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.commands-addon-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.commands-select-controls { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.commands-count { font-size: 0.75rem; color: var(--text-secondary); }
.command-item-accordion { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 5px; margin-bottom: 8px; overflow: hidden; }
.command-item-accordion:last-child { margin-bottom: 0; }
.command-item-accordion:hover { border-color: var(--accent-dim); }
.command-item-accordion .accordion-header { padding: 8px 10px; }
.command-item-accordion .accordion-content { padding: 8px 10px 10px; background: var(--bg-secondary); }
.command-item-accordion.has-conflict { border-left: 3px solid var(--warning); }
.command-item-accordion.is-installed { border-left: 3px solid var(--success); }

/* Addon State Badges */
.cmd-state-badge { font-size: 0.6rem; padding: 2px 6px; border-radius: 3px; margin-left: 8px; font-weight: 500; }
.cmd-state-badge.installed { background: var(--success-dim); color: var(--success); }
.cmd-state-badge.conflict { background: var(--warning-dim); color: var(--warning); }
.installed-badge { font-size: 0.65rem; padding: 2px 8px; border-radius: 4px; background: var(--success-dim); color: var(--success); margin-left: 8px; }
.addon-type-badge { font-size: 0.6rem; padding: 2px 6px; border-radius: 3px; background: var(--accent-glow); color: var(--accent); margin-left: 8px; text-transform: uppercase; }
.addon-date { font-size: 0.65rem; color: var(--text-secondary); display: block; margin-top: 4px; }

/* Conflict Handling */
.conflict-handling { margin-top: 12px; padding: 12px; background: var(--bg-card); border-radius: 5px; }
.conflict-handling label { display: block; margin-bottom: 8px; font-size: 0.8rem; color: var(--text-primary); }
.conflict-handling select { width: 100%; padding: 8px 10px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; color: var(--text-primary); font-size: 0.8rem; font-family: var(--font-mono); }
.conflict-handling select:focus { outline: none; border-color: var(--accent); }
.install-note { margin-top: 12px; padding: 10px 12px; background: var(--accent-glow); border: 1px solid var(--accent-dim); border-radius: 5px; font-size: 0.75rem; color: var(--text-secondary); }

/* Export Modal */
.export-section { margin-bottom: 20px; }
.export-section h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.export-section .form-group { margin-bottom: 12px; }
.export-section .form-group label { display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 500; }
.export-section input[type="text"], .export-section textarea { width: 100%; padding: 10px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; color: var(--text-primary); font-size: 0.8rem; font-family: var(--font-mono); }
.export-section input[type="text"]:focus, .export-section textarea:focus { outline: none; border-color: var(--accent); }
.export-section textarea { resize: vertical; min-height: 60px; }
.export-result { margin-top: 12px; }
.export-result .code-block { max-height: 300px; overflow-y: auto; }
.export-result .code-block pre { font-size: 0.65rem; }
.domains-preview { display: flex; flex-direction: column; gap: 6px; }
.domain-preview-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--bg-secondary); border-radius: 5px; }
.domain-preview-name { font-weight: 500; font-family: var(--font-mono); font-size: 0.8rem; }
.domain-preview-rules { font-size: 0.7rem; color: var(--text-secondary); }
.export-select-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.export-select-controls .separator { color: var(--text-muted); }

/* Edit Command/Rules Modal */
.edit-rules-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 400px; overflow-y: auto; }
.edit-rule-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px; background: var(--bg-deep); border: 1px solid var(--border); border-radius: 4px; }
.edit-rule-row .rule-num { min-width: 24px; padding-top: 8px; color: var(--text-muted); font-size: 0.75rem; font-weight: 600; }
.edit-rule-row textarea { flex: 1; resize: vertical; min-height: 48px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); font-size: 0.8rem; font-family: var(--font-mono); padding: 8px; }
.edit-rule-row textarea:focus { outline: none; border-color: var(--accent); }
.btn-icon { background: none; border: none; cursor: pointer; padding: 4px 8px; font-size: 1rem; color: var(--text-muted); border-radius: 4px; }
.btn-icon:hover { background: var(--bg-hover); color: var(--error); }
.btn-remove-rule { margin-top: 4px; }

/* Uninstall Modal */
.addon-name-display { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; padding: 12px; background: var(--bg-deep); border-radius: 5px; font-family: var(--font-mono); }
.uninstall-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.uninstall-options .radio-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 5px; cursor: pointer; transition: all 0.15s; }
.uninstall-options .radio-option:hover { border-color: var(--accent-dim); }
.uninstall-options .radio-option:has(input:checked) { border-color: var(--accent); background: var(--accent-glow); }
.uninstall-options .radio-option input[type="radio"] { display: block; width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.uninstall-options .radio-text { display: flex; flex-direction: column; gap: 2px; }
.uninstall-options .radio-label { font-weight: 500; color: var(--text-primary); font-size: 0.85rem; }
.uninstall-options .radio-desc { font-size: 0.75rem; color: var(--text-muted); }
.uninstall-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; padding: 12px; background: var(--bg-deep); border-radius: 5px; margin-top: 8px; }
.uninstall-item { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg-secondary); border-radius: 4px; }
.uninstall-item .item-name { font-family: var(--font-mono); font-weight: 500; font-size: 0.8rem; }
#uninstall-commands-section h4, #uninstall-domains-section h4 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }

/* Empty State */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 2rem; margin-bottom: 12px; opacity: 0.6; }
.empty-state-text { font-size: 0.85rem; margin-bottom: 16px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-accent); }

/* Danger Zone */
.danger-zone-card {
    border-color: var(--danger-dim);
    margin-top: 24px;
}
.danger-title {
    color: var(--danger);
}
.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.danger-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
}
.danger-action:hover {
    border-color: var(--danger-dim);
}
.danger-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.danger-info strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}
.danger-info span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.btn-warning {
    background: var(--warning);
    color: var(--bg-deep);
    border: none;
}
.btn-warning:hover {
    background: #e6a800;
}
.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}
.btn-danger:hover {
    background: #c0392b;
}
.cleanup-preview {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 5px;
}
.cleanup-preview h4 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: var(--danger);
}
.cleanup-preview ul {
    margin: 0;
    padding: 0 0 0 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.cleanup-preview li {
    margin-bottom: 4px;
}
.cleanup-preview code {
    background: var(--bg-secondary);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7rem;
}
.cleanup-confirm-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

/* Settings Accordions */
.card.accordion {
    overflow: hidden;
}

.card.accordion .card-header.accordion-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0;
    transition: padding-bottom 0.2s ease;
}

.card.accordion.open .card-header.accordion-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.card.accordion .card-title {
    flex: 1;
}

.card.accordion .card-title h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card.accordion .accordion-toggle {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.card.accordion .accordion-toggle:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    background: var(--accent-glow);
}

.card.accordion .accordion-icon {
    font-size: 0.65rem;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.accordion.open .accordion-icon {
    transform: rotate(90deg);
}

.card.accordion .accordion-content {
    display: none;
    opacity: 0;
}

.card.accordion.open .accordion-content {
    display: block;
    animation: accordionReveal 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes accordionReveal {
    0% {
        opacity: 0;
        transform: translateY(-12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered reveal for toggle items inside accordions */
.card.accordion.open .toggle-item {
    opacity: 0;
    animation: toggleItemReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.accordion.open .toggle-item:nth-child(1) { animation-delay: 0.1s; }
.card.accordion.open .toggle-item:nth-child(2) { animation-delay: 0.18s; }
.card.accordion.open .toggle-item:nth-child(3) { animation-delay: 0.26s; }
.card.accordion.open .toggle-item:nth-child(4) { animation-delay: 0.34s; }
.card.accordion.open .toggle-item:nth-child(5) { animation-delay: 0.42s; }

@keyframes toggleItemReveal {
    0% {
        opacity: 0;
        transform: translateX(-8px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Staggered reveal for session items */
.card.accordion.open .session-item {
    opacity: 0;
    animation: toggleItemReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.accordion.open .session-item:nth-child(1) { animation-delay: 0.1s; }
.card.accordion.open .session-item:nth-child(2) { animation-delay: 0.15s; }
.card.accordion.open .session-item:nth-child(3) { animation-delay: 0.2s; }
.card.accordion.open .session-item:nth-child(4) { animation-delay: 0.25s; }
.card.accordion.open .session-item:nth-child(5) { animation-delay: 0.3s; }

/* Staggered reveal for optional hook items */
.card.accordion.open .optional-hook-item {
    opacity: 0;
    animation: toggleItemReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.accordion.open .optional-hook-item:nth-child(1) { animation-delay: 0.1s; }
.card.accordion.open .optional-hook-item:nth-child(2) { animation-delay: 0.18s; }
.card.accordion.open .optional-hook-item:nth-child(3) { animation-delay: 0.26s; }
.card.accordion.open .optional-hook-item:nth-child(4) { animation-delay: 0.34s; }
.card.accordion.open .optional-hook-item:nth-child(5) { animation-delay: 0.42s; }

/* Staggered reveal for addon cards */
.card.accordion.open .addon-card {
    opacity: 0;
    animation: toggleItemReveal 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.accordion.open .addon-card:nth-child(1) { animation-delay: 0.1s; }
.card.accordion.open .addon-card:nth-child(2) { animation-delay: 0.16s; }
.card.accordion.open .addon-card:nth-child(3) { animation-delay: 0.22s; }
.card.accordion.open .addon-card:nth-child(4) { animation-delay: 0.28s; }
.card.accordion.open .addon-card:nth-child(5) { animation-delay: 0.34s; }
.card.accordion.open .addon-card:nth-child(6) { animation-delay: 0.4s; }

/* Inline icon button (used for refresh in accordion header) */
.btn-icon-inline {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
    vertical-align: middle;
}

.btn-icon-inline:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

.btn-icon-inline.btn-icon-accent {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-icon-inline.btn-icon-accent:hover {
    color: var(--accent-bright);
    background: var(--accent-glow-strong);
    transform: scale(1.1);
}

/* Command Accordion Items (for Export/Uninstall modals) */
.command-accordion-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.command-accordion-item:last-child {
    margin-bottom: 0;
}

.command-accordion-item:hover {
    border-color: var(--accent-dim);
}

.command-accordion-item.open {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.command-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.command-accordion-header:hover {
    background: var(--bg-elevated);
}

.command-accordion-header .checkbox-label-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
}

.command-accordion-header .checkbox-label-wrap input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.command-accordion-header .command-name {
    font-weight: 600;
    font-family: var(--font-mono);
    color: #9c7b9c;
    font-size: 0.85rem;
}

.command-accordion-header .checkbox-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 10px;
}

.command-accordion-header .accordion-toggle {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.command-accordion-header .accordion-toggle:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    background: var(--accent-glow);
}

.command-accordion-header .accordion-icon {
    font-size: 0.65rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.command-accordion-item.open .accordion-icon {
    transform: rotate(90deg);
}

.command-accordion-content {
    display: none;
    padding: 0 12px 12px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
    animation: accordionReveal 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.command-accordion-item.open .command-accordion-content {
    display: block;
}

.command-accordion-content .preview-rules-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding-top: 10px;
}

.command-accordion-content .preview-rule {
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: 4px;
    display: flex;
    gap: 10px;
    word-break: break-word;
}

.command-accordion-content .preview-rule span:last-child {
    flex: 1;
    min-width: 0;
}

.command-accordion-content .preview-rule .rule-num {
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 20px;
}

.command-accordion-content .no-rules {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Staggered reveal for rules inside command accordion */
.command-accordion-item.open .preview-rule {
    opacity: 0;
    animation: toggleItemReveal 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.command-accordion-item.open .preview-rule:nth-child(1) { animation-delay: 0.05s; }
.command-accordion-item.open .preview-rule:nth-child(2) { animation-delay: 0.1s; }
.command-accordion-item.open .preview-rule:nth-child(3) { animation-delay: 0.15s; }
.command-accordion-item.open .preview-rule:nth-child(4) { animation-delay: 0.2s; }
.command-accordion-item.open .preview-rule:nth-child(5) { animation-delay: 0.25s; }
.command-accordion-item.open .preview-rule:nth-child(6) { animation-delay: 0.3s; }
.command-accordion-item.open .preview-rule:nth-child(7) { animation-delay: 0.35s; }
.command-accordion-item.open .preview-rule:nth-child(8) { animation-delay: 0.4s; }

/* Update Banner */
.update-banner {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    margin: 16px 0;
    padding: 12px 16px;
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.update-banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.update-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.update-icon {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

.update-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.update-text strong {
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
}

#update-version {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.update-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.update-pip-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.pip-command {
    background: var(--bg-darker);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    user-select: all;
}

.update-progress {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-darker);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 100px;
    text-align: right;
}

.update-ready {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.update-ready span {
    color: var(--accent);
    font-weight: 500;
}

/* Hook Update Notification */
.hook-update-card {
    background: linear-gradient(135deg, #3a2a1a 0%, #281808 100%);
    border: 1px solid #f59e0b;
}

.hook-update-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

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

.hook-update-text h3 {
    margin: 0 0 4px 0;
    color: #f59e0b;
    font-size: 1rem;
}

.hook-update-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hook-update-list {
    margin: 12px 0;
    padding-left: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.hook-update-list li {
    margin: 4px 0;
}

.hook-update-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Responsive */
@media (max-width: 500px) {
    .container { padding: 12px; }
    header h1 { font-size: 0.875rem; }
    .toggle-item { flex-direction: column; align-items: flex-start; gap: 12px; }
    .switch { align-self: flex-end; }
    .tabs { flex-direction: column; }
    .modal-content { width: 95%; max-height: 90vh; }
    .domain-header { flex-direction: column; gap: 12px; }
    .state-toggle { align-self: flex-end; }
    .domain-info { flex-direction: column; gap: 8px; }
    .domain-actions, .addon-actions { flex-direction: column; }
    .domain-actions .btn, .addon-actions .btn { width: 100%; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }
    .setup-actions { flex-direction: column; }
    .override-options { flex-wrap: wrap; }
    .config-grid { grid-template-columns: 1fr; }
    .rule-item { flex-direction: column; }
    .rule-actions { align-self: flex-end; }
    .domain-card-wrapper { flex-direction: column; }
    .domain-reorder { flex-direction: row; align-self: flex-end; order: -1; }
    .addon-header { flex-direction: column; gap: 8px; }
    .addon-meta { flex-direction: column; gap: 6px; }
    .checkbox-list { max-height: 200px; }
    .commands-addon-header { flex-direction: column; align-items: flex-start; }
    .commands-select-controls { margin-left: 0; margin-top: 8px; }
}
