:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --green: #3fb950;
    --green-bg: #0d2818;
    --yellow: #d29922;
    --yellow-bg: #2d1f00;
    --red: #f85149;
    --red-bg: #2d0f0f;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand a {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}
.nav-user {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-sans);
}
.btn:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-primary {
    background: #238636;
    border-color: #2ea043;
    color: #fff;
}
.btn-primary:hover { background: #2ea043; }
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-danger {
    background: transparent;
    border-color: var(--red);
    color: var(--red);
}
.btn-danger:hover { background: var(--red-bg); }
.btn-yellow {
    background: transparent;
    border-color: var(--yellow);
    color: var(--yellow);
}
.btn-yellow:hover { background: var(--yellow-bg); }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon-danger:hover { background: var(--red-bg); color: var(--red); }

/* Flash messages */
.flash-messages { margin-bottom: 24px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}
.flash-success { background: var(--green-bg); border: 1px solid #238636; color: var(--green); }
.flash-error { background: var(--red-bg); border: 1px solid #da3633; color: var(--red); }
.flash-warning { background: var(--yellow-bg); border: 1px solid #9e6a03; color: var(--yellow); }
.flash-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
    opacity: 0.7;
}
.flash-close:hover { opacity: 1; }

/* Auth */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
}
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-header h1 { font-size: 2.5rem; margin-bottom: 8px; }
.auth-header h2 { font-size: 1.25rem; margin-bottom: 4px; }
.auth-header p { color: var(--text-secondary); font-size: 0.875rem; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.875rem; font-weight: 500; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: border-color 0.15s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.form-hint { font-size: 0.75rem; color: var(--text-muted); }
.form-check { flex-direction: row; align-items: center; gap: 8px; }
.form-check label { font-weight: 400; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.dashboard-header h1 { font-size: 1.5rem; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.15s;
}
.project-card:hover { border-color: var(--bg-hover); }
.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.project-card-header h3 { font-size: 1.1rem; }
.project-card-body { margin-bottom: 16px; }
.project-url {
    display: block;
    font-size: 0.875rem;
    font-family: var(--font-mono);
    color: var(--accent);
    margin-bottom: 4px;
}
.project-date { font-size: 0.75rem; color: var(--text-muted); }
.project-card-footer { display: flex; gap: 8px; }

.badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-green { background: var(--green-bg); color: var(--green); border: 1px solid #238636; }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid #9e6a03; }

.empty-state {
    text-align: center;
    padding: 64px 0;
    color: var(--text-secondary);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text-primary); }

/* Project Manager */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.project-header-left { display: flex; flex-direction: column; gap: 4px; }
.project-header-left h1 { font-size: 1.5rem; }
.project-header-right { display: flex; gap: 8px; align-items: center; }
.back-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.back-link:hover { color: var(--accent); }
.project-url-small {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.875rem;
    font-family: var(--font-mono);
    overflow-x: auto;
}
.breadcrumb a { color: var(--accent); white-space: nowrap; }
.breadcrumb .sep { color: var(--text-muted); }

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

.upload-zone {
    flex: 1;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
    cursor: pointer;
}
.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(88,166,255,0.05);
}
.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.upload-icon { font-size: 1.5rem; }
.upload-hint { font-size: 0.75rem; color: var(--text-muted); }
.file-input { display: none; }

/* File list */
.file-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.file-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg-tertiary); }
.file-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    min-width: 0;
}
.file-name:hover { color: var(--accent); }
.file-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-right: 12px;
    flex-shrink: 0;
}
.file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.file-parent { color: var(--text-secondary); }
.empty-files {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Editor */
.editor-page { margin: -32px -24px; }
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.editor-header-left { display: flex; align-items: center; gap: 12px; }
.editor-header-right { display: flex; gap: 8px; }
.editor-filename {
    font-size: 0.875rem;
    font-family: var(--font-mono);
    font-weight: 500;
}

#editor {
    width: 100%;
    min-height: calc(100vh - 100px);
    padding: 16px 24px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    tab-size: 4;
}
#editor:focus { box-shadow: none; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}
.modal-content h2 { margin-bottom: 16px; font-size: 1.1rem; }

/* Responsive */
@media (max-width: 640px) {
    .container { padding: 16px; }
    .project-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; }
    .project-header { flex-direction: column; }
    .editor-header { flex-direction: column; gap: 8px; }
}
