
:root {
  /* Palette - Zinc/Slate Dark Mode Theme */
  --bg-body: #09090b;
  --bg-sidebar: #0c0c0e;
  --bg-panel: #121214;
  --bg-surface: #18181b;
  --bg-hover: #27272a;
  
  --border-subtle: #27272a;
  --border-strong: #3f3f46;
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #52525b;
  
  --accent-primary: #3b82f6; /* Blue 500 */
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.2);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --header-height: 64px;
  --sidebar-width: 260px;
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 20;
    flex-shrink: 0;
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}
.brand-icon { font-size: 1.25rem; margin-right: 0.75rem; }
.brand-text { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }

.nav-menu { padding: 1.5rem 1rem; flex: 1; }
.nav-label { 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    color: var(--text-tertiary); 
    margin-bottom: 0.75rem; 
    padding-left: 0.75rem; 
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    transition: all 0.2s ease;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-surface); color: var(--text-primary); font-weight: 500; border: 1px solid var(--border-subtle); }
.nav-item svg { opacity: 0.7; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-subtle);
}
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.status-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }

/* Main Stage */
.main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

/* Toolbar */
.toolbar {
    height: var(--header-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10;
    flex-shrink: 0;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 1rem; }
.page-title { font-size: 1.1rem; font-weight: 600; }
.file-count-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}
.btn-primary { 
    background: var(--accent-primary); 
    color: white; 
    box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--text-primary); color: var(--bg-body); }
.btn-secondary:hover { opacity: 0.9; }
.btn-outline { border-color: var(--border-strong); background: transparent; color: var(--text-primary); }
.btn-outline:hover { border-color: var(--text-secondary); background: var(--bg-surface); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-block { width: 100%; justify-content: center; }

.icon-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.active { background: var(--bg-surface); border-color: var(--border-subtle); color: var(--text-primary); }

/* Workspace Grid */
.workspace-grid {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Config Panel */
.config-panel {
    width: 300px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-shrink: 0;
}

.panel-section { display: flex; flex-direction: column; gap: 0.75rem; }
.section-title { font-size: 0.75rem; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }

.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.input-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.25rem; display: block; }
.input-dark, .select-dark {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-mono);
}
.input-dark:focus, .select-dark:focus { border-color: var(--accent-primary); }
.input-dark::placeholder { color: var(--text-tertiary); }

.tokens-container { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.token {
    font-size: 0.75rem;
    background: var(--bg-hover);
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: var(--font-mono);
}
.token:hover { border-color: var(--accent-primary); }

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-size: 0.9rem; }

/* Stage & Dropzone */
.stage-container {
    flex: 1;
    background: var(--bg-body);
    position: relative;
    display: flex;
    flex-direction: column;
}

.dropzone-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-tertiary);
}
.empty-icon { margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.25rem; color: var(--text-primary); margin-bottom: 0.5rem; }

/* File List (Table Layout) */
.file-list-header {
    display: grid;
    grid-template-columns: 48px 2fr 32px 2fr 80px 48px;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-panel);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    position: sticky;
    top: 0;
    z-index: 5;
}

.file-row {
    display: grid;
    grid-template-columns: 48px 2fr 32px 2fr 80px 48px;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
    transition: background 0.1s;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.file-row:hover { background: var(--bg-surface); }
.file-row.updated .col-new { color: var(--success); }

.col-icon { display: flex; justify-content: center; color: var(--text-tertiary); }
.col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.col-arrow { text-align: center; color: var(--text-tertiary); }
.col-new { color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-meta { text-align: right; font-size: 0.75rem; color: var(--text-tertiary); }
.col-action { display: flex; justify-content: center; }

.remove-btn {
    background: none; border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
}
.remove-btn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

/* Highlight Diff */
.diff-added { color: var(--success); }
.diff-removed { text-decoration: line-through; color: var(--danger); opacity: 0.5; }

/* Grid View Modifiers */
.file-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}
.file-list.grid-view .file-row {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    padding: 1rem;
    height: 140px;
    text-align: center;
    position: relative;
}
.file-list.grid-view .col-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.file-list.grid-view .col-arrow { transform: rotate(90deg); margin: 0.25rem 0; font-size: 0.7rem; }
.file-list.grid-view .col-name, .file-list.grid-view .col-new { width: 100%; text-align: center; font-size: 0.8rem; }
.file-list.grid-view .col-meta { display: none; }
.file-list.grid-view .col-action { position: absolute; top: 4px; right: 4px; }

/* Documentation Layout */
.doc-wrapper {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-body);
}
.doc-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}
.doc-content h1 { font-size: 2.25rem; font-weight: 700; margin-bottom: 2rem; color: var(--text-primary); letter-spacing: -0.02em; }
.doc-content h2 { font-size: 1.5rem; font-weight: 600; margin: 2.5rem 0 1rem; color: var(--text-primary); letter-spacing: -0.01em; }
.doc-content p { color: var(--text-secondary); line-height: 1.7; margin-bottom: 1.25rem; font-size: 1.05rem; }
.doc-content ul, .doc-content ol { color: var(--text-secondary); margin-bottom: 1.5rem; padding-left: 1.5rem; line-height: 1.6; }
.doc-content li { margin-bottom: 0.5rem; }
.doc-content a { color: var(--accent-primary); text-decoration: none; }
.doc-content a:hover { text-decoration: underline; }
.doc-content code { background: var(--bg-surface); padding: 0.2em 0.4em; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; color: var(--text-primary); border: 1px solid var(--border-subtle); }

/* Mobile */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; overflow-y: auto; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-subtle); display: none; }
    .workspace-grid { flex-direction: column; overflow: visible; }
    .config-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: none; }
    .file-list-header { display: none; }
    .file-row { grid-template-columns: 1fr 20px 1fr 30px; gap: 10px; padding: 1rem; }
    .col-icon, .col-meta { display: none; }
}
.hidden { display: none !important; }
