@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap');

:root {
    /* Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-secondary: #161616; /* Sidebar */
    --bg-tertiary: #1e1e1e;  /* Items/Cards */
    --bg-hover: #2a2a2a;

    /* Text */
    --text-primary: #e3e3e3;
    --text-secondary: #a8a8a8;
    --text-dim: #666666;

    /* Accents */
    --accent: #00ff41;       /* Keeping the hacker green accent */
    --accent-dim: rgba(0, 255, 65, 0.1);
    --danger: #ff4444;
    --warning: #ffcc00;
    --info: #ff79c6;
    --success: #00ff41;

    /* Borders */
    --border: #333333;
    --glow: 0 0 10px #00ff4155;
    
    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 68px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =========================================
   APP LAYOUT (Chat Interface)
   ========================================= */

/* Layout Container */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    transition: width 0.3s ease, margin-left 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    margin-left: 0;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 16px 0;
}

.sidebar-header .icon-btn {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.new-chat-wrapper {
    padding: 0 16px 8px;
    transition: padding 0.3s ease;
}

.sidebar.collapsed .new-chat-wrapper {
    padding: 0 10px 8px;
    display: flex;
    justify-content: center;
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar.collapsed .new-chat-btn {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
    gap: 0;
}

.new-chat-btn .btn-text {
    opacity: 1;
    transition: opacity 0.2s;
}

.sidebar.collapsed .new-chat-btn .btn-text {
    display: none;
    opacity: 0;
}

.new-chat-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-dim);
}

.history-label {
    padding: 16px 16px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sidebar.collapsed .history-label {
    opacity: 0;
    visibility: hidden;
    height: 0;
    padding: 0;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    opacity: 1;
    transition: opacity 0.2s;
}

.sidebar.collapsed .history-list {
    opacity: 0;
    visibility: hidden;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    visibility: hidden;
}

.btn-link-danger {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    width: 100%;
    border-radius: 4px;
}

.btn-link-danger:hover {
    background: rgba(255, 68, 68, 0.1);
    color: var(--danger);
}

/* History Items */
.history-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.1s;
    position: relative;
    padding-right: 32px;
}

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

.history-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 500;
}

/* Context Menu Button - hidden by default, show on hover */
.history-item .context-btn {
    display: none;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.history-item:hover .context-btn,
.history-item.menu-open .context-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-item .context-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.1);
}

/* Context Menu Dropdown */
.context-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    z-index: 1000;
    min-width: 150px;
    padding: 6px;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

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

.context-menu-item .material-icons {
    font-size: 18px;
}

.context-menu-item.delete:hover {
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent flex overflow */
    min-height: 0; /* Important: allow container to shrink below content size */
    position: relative;
    overflow: hidden; /* Force children to scroll */
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary); /* Ensure header has background */
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

header h1 {
    font-family: 'Silkscreen', cursive;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    letter-spacing: 0.5px;
}

header h1 .title-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

header h1 .title-link:hover {
    color: inherit;
    text-decoration: none;
}

.subtitle {
    font-size: 12px;
    font-weight: 400;
    margin-left: 12px;
    color: var(--accent);
    opacity: 0.8;
}

nav {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 6px;
}

nav a {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    padding: 6px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

nav a:hover {
    color: var(--text-primary);
}

nav a.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 500;
}

.nav-help-btn {
    background: linear-gradient(135deg, rgba(74, 21, 75, 0.3), rgba(0, 255, 65, 0.2));
    border: 1px solid transparent;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    position: relative;
    animation: slackGlow 3s ease-in-out infinite;
}

@keyframes slackGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(74, 21, 75, 0.4), 0 0 10px rgba(0, 255, 65, 0.2);
        border-color: rgba(74, 21, 75, 0.5);
    }
    50% {
        box-shadow: 0 0 10px rgba(0, 255, 65, 0.4), 0 0 20px rgba(74, 21, 75, 0.3);
        border-color: rgba(0, 255, 65, 0.5);
    }
}

.nav-help-btn:hover {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(74, 21, 75, 0.5), rgba(0, 255, 65, 0.3));
    border-color: var(--accent);
    animation: none;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
}

/* Chat Workspace */
.chat-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 20px;
    min-height: 0; /* Fix scrolling issue: allows flex child to scroll */
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 24px 48px;
    width: 100%;
}

/* Welcome / Empty State */
.empty-state-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state-logo {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--accent);
    display: flex;
    justify-content: center;
}

.logo-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
}

.empty-state-text {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state-sub {
    font-size: 14px;
    max-width: 500px;
}

/* Messages */
.message {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.message.assistant.flowing .message-content {
    position: relative;
    overflow: hidden;
}

.message.assistant.flowing .message-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
    transform: translateY(-100%);
    animation: flowingWash 0.5s ease-out forwards;
    pointer-events: none;
}

@keyframes flowingWash {
    0% { transform: translateY(-100%); opacity: 0.8; }
    100% { transform: translateY(0); opacity: 0; }
}

.message-header {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    font-family: 'Fira Code', monospace;
    letter-spacing: 0.5px;
}

.message-content {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-primary);
    overflow-wrap: break-word;
    letter-spacing: 0.01em;
}

.message.user .message-content {
    background: var(--bg-tertiary);
    padding: 14px 18px;
    border-radius: 12px;
    display: inline-block;
    max-width: 85%;
    align-self: flex-end;
    line-height: 1.6;
}

.message.user {
    align-items: flex-end;
}

.message.assistant .message-content {
    background: transparent;
    padding: 4px 0;
    max-width: 100%;
}

.message.assistant {
    align-items: flex-start;
}

/* Input Area */
.chat-input-area {
    width: 100%;
    padding: 0 20px;
}

.chat-input-wrapper {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 8px 12px 8px 20px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--text-dim);
    background: var(--bg-tertiary);
}

/* Response glow animation for title */
.title-link.response-glow {
    animation: titleResponseGlow 0.5s ease-in-out 4;
}

@keyframes titleResponseGlow {
    0%, 100% {
        text-shadow: 0 0 8px rgba(0, 255, 65, 0.6), 0 0 16px rgba(74, 21, 75, 0.5);
        color: rgba(0, 255, 65, 0.9);
    }
    50% {
        text-shadow: 0 0 12px rgba(74, 21, 75, 0.6), 0 0 24px rgba(0, 255, 65, 0.4);
        color: rgba(200, 150, 255, 0.9);
    }
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    outline: none;
    max-height: 200px;
    overflow-y: auto;
}

#message-input::placeholder {
    color: var(--text-dim);
}

.icon-btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.icon-btn-primary:hover {
    transform: scale(1.05);
}
.icon-btn-primary:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.input-footer {
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 10px;
}

/* Markdown Styles override for cleaner look and better readability */

/* Paragraphs - generous spacing for easier reading */
.message-content p {
    margin-bottom: 1.25em;
    line-height: 1.75;
}
.message-content p:last-child {
    margin-bottom: 0;
}

/* Headings - clear visual hierarchy like the reference */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
    margin-top: 1.75em;
    margin-bottom: 0.75em;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child,
.message-content h4:first-child {
    margin-top: 0;
}

.message-content h1 {
    font-size: 1.5em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--border);
}

.message-content h2 {
    font-size: 1.35em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
}

.message-content h3 {
    font-size: 1.2em;
}

.message-content h4 {
    font-size: 1.1em;
}

.message-content h5,
.message-content h6 {
    font-size: 1em;
    color: var(--text-secondary);
}

/* Inline code */
.message-content code {
    font-family: 'Fira Code', monospace;
    background: rgba(0,0,0,0.3);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.875em;
    color: #ff79c6;
}

/* Code blocks */
.message-content pre {
    background: #000;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
    border: 1px solid var(--border);
}
.message-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Lists - better spacing for readability */
.message-content ul,
.message-content ol {
    margin-left: 1.5em;
    margin-bottom: 1.25em;
    padding-left: 0.5em;
}

.message-content li {
    margin-bottom: 0.6em;
    line-height: 1.7;
}

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

/* Nested lists */
.message-content li ul,
.message-content li ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Bold text - slightly heavier for emphasis */
.message-content strong,
.message-content b {
    font-weight: 600;
    color: var(--text-primary);
}

/* Blockquotes */
.message-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.5em 0;
    padding: 0.75em 1.25em;
    background: rgba(0, 255, 65, 0.05);
    color: var(--text-secondary);
}

.message-content blockquote p {
    margin-bottom: 0.75em;
}

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

/* Horizontal rules - visual separation like reference image */
.message-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

/* Tables */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.9em;
}

.message-content th,
.message-content td {
    padding: 0.75em 1em;
    border: 1px solid var(--border);
    text-align: left;
}

.message-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.message-content td {
    color: var(--text-secondary);
}

/* Links */
.message-content a {
    color: var(--accent);
    text-decoration: none;
}
.message-content a:hover {
    text-decoration: underline;
}


/* =========================================
   LEGACY / OTHER PAGES STYLES
   ========================================= */

.channels-page, .storage-page, .container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
}

.section, .import-form, .stat-card, .document-card, .modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 15px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.section h2 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 15px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.description {
    color: var(--text-dim);
    margin-bottom: 20px;
    font-size: 11px;
}

/* Forms */
input, select, textarea {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 3px;
    outline: none;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--text-primary);
    box-shadow: var(--glow);
}

label {
    display: block;
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
}

button, .btn, .btn-view, .refresh-btn {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

button:hover:not(:disabled), .btn:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    box-shadow: var(--glow);
}

.btn-delete, .btn-stop {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-delete:hover, .btn-stop:hover {
    background: var(--danger);
    color: var(--bg-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

th {
    background: var(--bg-tertiary);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

tr:hover td {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Channels List */
.channels-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.channel-item:hover {
    border-color: var(--text-primary);
    box-shadow: var(--glow);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-badge.completed {
    color: var(--success);
    border-color: var(--success);
    background: rgba(0, 255, 65, 0.1);
}

.status-badge.running {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 102, 0, 0.1);
    animation: pulse 2s infinite;
}

.status-badge.failed {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(255, 51, 51, 0.1);
}

.status-badge.pending {
    color: var(--warning);
    border-color: var(--warning);
    background: rgba(255, 204, 0, 0.1);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--text-primary);
    box-shadow: var(--glow);
    transition: width 0.3s;
}

/* Storage Page Stats */
.store-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    text-align: center;
}

.stat-card .value {
    font-size: 24px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.stat-card .label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Storage Documents */
.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.documents-grid {
    display: grid;
    gap: 15px;
}

.document-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    transition: all 0.2s;
    align-items: start;
}

.document-card:hover {
    border-color: var(--text-primary);
    box-shadow: var(--glow);
    background: var(--bg-tertiary);
}

.doc-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-word;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.doc-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Helpers */
.text-error { color: var(--danger) !important; }
.text-muted { color: var(--text-dim) !important; }
.loading { text-align: center; color: var(--text-dim); padding: 20px; font-style: italic; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Mobile & Responsive */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        margin-left: -280px; /* Hidden by default on mobile */
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    }
    
    .sidebar.mobile-open {
        margin-left: 0;
    }

    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }

    #toggle-sidebar-btn {
        display: none; /* Hide internal sidebar toggle on mobile, use header one */
    }
    
    header h1 span.subtitle {
        display: none;
    }
}

/* Typing Indicator Animation */
.status-text {
    transition: opacity 0.3s ease;
}

.status-text.pulse {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    font-style: italic;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Suggested Questions */
.suggested-questions-container {
    margin-top: 32px;
    max-width: 600px;
    width: 100%;
}

.suggested-questions-loading {
    color: var(--text-dim);
    font-style: italic;
    font-size: 14px;
    text-align: center;
}

.suggested-questions-label {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}

.suggested-questions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggested-question-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1.4;
}

.suggested-question-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.suggested-question-btn:active {
    transform: translateY(0);
}

.suggested-question-btn .material-icons {
    color: var(--primary);
    font-size: 20px;
    flex-shrink: 0;
}

.suggested-question-btn .question-text {
    flex: 1;
}

@media (max-width: 768px) {
    .suggested-questions-container {
        margin-top: 24px;
        padding: 0 16px;
    }

    .suggested-question-btn {
        padding: 12px 14px;
        font-size: 13px;
    }
}

/* Follow-up Questions */
.follow-up-questions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Message Action Buttons */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions,
.message-actions:focus-within {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn .material-icons {
    font-size: 18px;
}

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

.action-btn.active {
    color: var(--accent);
}

.action-btn.thumbs-up:hover,
.action-btn.thumbs-up.active {
    color: var(--success);
}

.action-btn.thumbs-down:hover,
.action-btn.thumbs-down.active {
    color: var(--danger);
}

.action-btn.copied {
    color: var(--success);
}

.action-btn.flash {
    animation: flashFeedback 0.3s ease;
}

@keyframes flashFeedback {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.follow-up-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.follow-up-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.follow-up-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    line-height: 1.3;
    transition: all 0.2s ease;
    max-width: 100%;
    text-align: left;
}

.follow-up-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.follow-up-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .follow-up-list {
        flex-direction: column;
    }

    .follow-up-btn {
        width: 100%;
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* =========================================
   ADMIN PAGE STYLES
   ========================================= */

.admin-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group input,
.filter-group select {
    width: 100%;
}

.filter-bar .refresh-btn {
    flex-shrink: 0;
}

/* Usage List */
.usage-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.usage-card:hover {
    border-color: var(--text-dim);
    background: var(--bg-hover);
}

.usage-card.type-slack {
    border-left: 3px solid #4A154B;
}

.usage-card.type-web {
    border-left: 3px solid var(--accent);
}

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

.type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.type-slack {
    background: rgba(74, 21, 75, 0.3);
    color: #E01E5A;
}

.type-badge.type-web {
    background: rgba(0, 255, 65, 0.1);
    color: var(--accent);
}

.timestamp {
    font-size: 11px;
    color: var(--text-dim);
}

.usage-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.usage-question,
.usage-response {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.usage-question {
    color: var(--text-primary);
}

.usage-question strong,
.usage-response strong {
    color: var(--text-dim);
    margin-right: 6px;
}

/* Usage Modal */
.usage-modal {
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
}

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

.modal-header h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.usage-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    gap: 12px;
    align-items: baseline;
}

.detail-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    min-width: 80px;
    flex-shrink: 0;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
}

.detail-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.detail-section h4 {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.detail-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.detail-text.response-text {
    max-height: 400px;
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding: 16px 0;
}

.page-info {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
}

/* Search Filter Layout */
.search-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-filter input {
    flex: 1;
    min-width: 200px;
}

/* Warning button style */
.btn-warning {
    color: var(--warning);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    color: var(--bg-primary);
}

/* Metadata tags */
.doc-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.metadata-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 10px;
    color: var(--text-secondary);
}

.metadata-tag.channel {
    color: var(--accent);
    border-color: var(--accent);
}

.metadata-tag.date {
    color: var(--info);
    border-color: var(--info);
}

/* State badges for documents */
.state-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 600;
}

.state-badge.ACTIVE {
    background: rgba(0, 255, 65, 0.1);
    color: var(--success);
}

.state-badge.PENDING {
    background: rgba(255, 204, 0, 0.1);
    color: var(--warning);
}

.state-badge.FAILED {
    background: rgba(255, 68, 68, 0.1);
    color: var(--danger);
}

/* Metadata section in modal */
.metadata-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.metadata-section h4 {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 12px;
}

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

.metadata-item {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 4px;
}

.metadata-item .key {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.metadata-item .value {
    font-size: 12px;
    color: var(--text-primary);
    word-break: break-word;
}

/* Detail grid for modal */
.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    align-items: baseline;
}

.detail-grid .detail-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.detail-grid .detail-value {
    font-size: 12px;
    color: var(--text-primary);
    word-break: break-word;
}

/* Admin page responsive */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .usage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .usage-meta {
        flex-direction: column;
        gap: 4px;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   SLACK GUIDE MODAL
   ========================================= */

.guide-modal {
    max-width: 500px;
}

.guide-intro {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.guide-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.guide-command {
    background: var(--bg-tertiary);
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.guide-command code {
    display: inline-block;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 6px;
}

.guide-command p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.guide-command p code {
    font-size: 12px;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--info);
}

.guide-tips {
    background: var(--bg-primary);
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.guide-tips h4 {
    font-size: 12px;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.guide-tips ul {
    margin: 0;
    padding-left: 18px;
}

.guide-tips li {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.guide-tips li:last-child {
    margin-bottom: 0;
}

.guide-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.filter-item code {
    font-family: 'Fira Code', monospace;
    color: var(--accent);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 140px;
}

.filter-item span {
    color: var(--text-secondary);
}

.guide-example {
    background: var(--bg-tertiary);
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.guide-example h4 {
    font-size: 12px;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.guide-example code {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--info);
    background: rgba(0,0,0,0.3);
    padding: 10px 12px;
    border-radius: 4px;
    word-break: break-word;
}

.guide-section h4 {
    margin-top: 0;
}

/* =========================================
   PERSONALIZATION STYLES
   ========================================= */

.nav-personalize-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-personalize-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-personalize-btn.connected {
    border-color: var(--success);
    color: var(--success);
    background: rgba(0, 255, 65, 0.08);
}

.nav-personalize-btn.connected .material-icons {
    color: var(--success);
}

/* Personalize Modal */
.personalize-modal {
    max-width: 440px;
}

.personalize-intro {
    margin-bottom: 24px;
}

.personalize-intro p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.personalize-benefits {
    list-style: none;
    padding: 0;
    margin: 0;
}

.personalize-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.personalize-benefits li .material-icons {
    font-size: 18px;
    color: var(--accent);
}

.connect-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #00dd38;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.personalize-note {
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    margin: 0;
}

/* Connected State */
.connected-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 10px;
    margin-bottom: 16px;
}

.connected-icon {
    font-size: 32px;
    color: var(--success);
}

.connected-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.connected-info strong {
    color: var(--text-primary);
    font-size: 14px;
}

.site-name {
    color: var(--text-secondary);
    font-size: 12px;
}

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

.disconnect-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 13px;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Mobile adjustments for personalize button */
@media (max-width: 768px) {
    .nav-personalize-btn .personalize-text {
        display: none;
    }
    
    .nav-personalize-btn {
        padding: 6px 8px;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast .material-icons {
    font-size: 20px;
}

.toast-success {
    border-color: var(--success);
}

.toast-success .material-icons {
    color: var(--success);
}

.toast-info .material-icons {
    color: var(--info);
}

.toast-error {
    border-color: var(--danger);
}

.toast-error .material-icons {
    color: var(--danger);
}

/* =========================================
   CONSTITUTION MODAL
   ========================================= */

.constitution-modal {
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.constitution-intro {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Tabs */
.constitution-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.constitution-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.constitution-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.constitution-tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.constitution-tab .material-icons {
    font-size: 16px;
}

/* Add Form */
.constitution-add-form {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.constitution-add-form .form-row {
    margin-bottom: 10px;
}

.constitution-add-form .form-row:last-child {
    margin-bottom: 0;
}

.constitution-add-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
}

.constitution-add-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.constitution-add-form textarea::placeholder {
    color: var(--text-dim);
}

.form-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.char-counter {
    font-size: 11px;
    color: var(--text-dim);
    font-family: 'Fira Code', monospace;
}

.char-counter.limit-warning {
    color: var(--warning);
}

.char-counter.limit-reached {
    color: var(--danger);
}

.constitution-add-form .btn-primary {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 12px;
}

.constitution-add-form .btn-primary .material-icons {
    font-size: 16px;
}

/* Rules Container */
.constitution-rules-container {
    flex: 1;
    overflow: hidden;
    min-height: 200px;
}

.constitution-rules-panel {
    display: none;
    height: 100%;
}

.constitution-rules-panel.active {
    display: block;
}

.rules-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.empty-rules {
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    padding: 40px 20px;
}

.empty-rules.error {
    color: var(--danger);
}

/* Rule Item */
.rule-item {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.rule-item:hover {
    border-color: var(--border);
}

.rule-item.own-rule {
    border-left: 2px solid var(--accent);
}

.rule-text {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-word;
}

.rule-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rule-date {
    font-size: 11px;
    color: var(--text-dim);
}

.rule-owner {
    font-size: 11px;
    color: var(--text-dim);
    font-style: italic;
}

.rule-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.rule-item:hover .rule-actions {
    opacity: 1;
}

.rule-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.rule-action-btn.delete:hover {
    background: rgba(255, 68, 68, 0.2);
    color: var(--danger);
}

.rule-action-btn .material-icons {
    font-size: 16px;
}

/* Scrollbar for rules list */
.rules-list::-webkit-scrollbar {
    width: 6px;
}

.rules-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.rules-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.rules-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .constitution-modal {
        max-height: 90vh;
        margin: 16px;
    }
    
    .form-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .constitution-add-form .btn-primary {
        margin-left: 0;
        justify-content: center;
    }
    
    .rule-actions {
        opacity: 1;
    }
}
