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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
}

/* App layout with sidebar */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 20px;
    text-decoration: none;
    border-bottom: 1px solid #e5e5e5;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #2B59C3;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
}

.sidebar-section {
    padding: 16px 0 8px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 16px 8px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}

.sidebar-nav-link:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.sidebar-nav-link.active {
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 500;
}

.sidebar-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid #e5e5e5;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sidebar-user-actions {
    display: flex;
    gap: 4px;
}

.sidebar-signin {
    width: 100%;
    text-align: center;
}

/* Main area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Legacy top nav — hidden, replaced by sidebar */
.nav {
    display: none;
}

.nav-brand {
    font-weight: 600;
    font-size: 18px;
    color: #1a1a1a;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.nav-links a:hover {
    color: #1a1a1a;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
}

.footer {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 12px;
}

/* Coverage Matrix */
.coverage-grid {
    display: grid;
    grid-template-columns: 110px repeat(5, 1fr);
    gap: 6px;
    margin: 24px 0;
}

.coverage-header {
    font-size: 12px;
    font-weight: 600;
    padding: 8px 4px;
    text-align: center;
}

.coverage-header.row-label {
    text-align: right;
    padding-right: 12px;
}

.coverage-cell {
    height: 48px;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}

.coverage-cell:hover {
    transform: scale(1.05);
}

.coverage-cell.complete { background: #22c55e; }
.coverage-cell.partial { background: #eab308; }
.coverage-cell.missing { background: #ef4444; }
.coverage-cell.na { background: #52525b; }

.coverage-cell .tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 6px;
}

.coverage-cell:hover .tooltip {
    display: block;
}

.row-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.stat-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* Guideline View */
.guideline-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e5e5;
}

.guideline-meta {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

.guideline-content {
    line-height: 1.8;
}

.guideline-content h1 { font-size: 28px; margin: 24px 0 16px; }
.guideline-content h2 { font-size: 22px; margin: 32px 0 12px; }
.guideline-content h3 { font-size: 18px; margin: 24px 0 8px; }
.guideline-content p { margin: 12px 0; }
.guideline-content ul, .guideline-content ol { margin: 12px 0 12px 24px; }
.guideline-content code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; font-size: 14px; }
.guideline-content pre { background: #f5f5f5; padding: 16px; border-radius: 6px; overflow-x: auto; margin: 16px 0; }

.missing-items {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 16px;
    margin: 24px 0;
}

.missing-items h3 {
    color: #92400e;
    margin-bottom: 8px;
}

.missing-items ul {
    margin-left: 20px;
}

/* Guidelines List */
.guidelines-list {
    display: grid;
    gap: 24px;
}

.guidelines-group h2 {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}

.guidelines-group ul {
    list-style: none;
    display: grid;
    gap: 8px;
}

.guidelines-group a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    text-decoration: none;
    color: #1a1a1a;
}

.guidelines-group a:hover {
    border-color: #999;
}

.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.status-badge.complete { background: #dcfce7; color: #166534; }
.status-badge.partial { background: #fef3c7; color: #92400e; }
.status-badge.missing { background: #fee2e2; color: #991b1b; }
.status-badge.na { background: #f3f4f6; color: #6b7280; }

/* Config Page */
.config-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.config-section h2 {
    margin-bottom: 12px;
}

.config-section pre {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}

/* Gaps page */
.gaps-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gap-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
}

.gap-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.gap-type, .gap-category {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.gap-type {
    background: #e3f2fd;
    color: #1565c0;
}

.gap-category {
    background: #f3e5f5;
    color: #7b1fa2;
}

.gap-needs {
    color: #666;
    margin-bottom: 0.5rem;
}

.gap-sources {
    font-size: 0.875rem;
    color: #388e3c;
}

.gap-no-sources {
    color: #f57c00;
}

.gap-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #eeeeee;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 1rem;
}

.modal-body textarea {
    width: 100%;
    font-family: monospace;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.no-gaps {
    text-align: center;
    color: #388e3c;
    font-size: 1.25rem;
    padding: 2rem;
}

/* Contribute form */
.contribute-form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    font-family: monospace;
}

.form-group small {
    display: block;
    color: #666;
    margin-top: 0.25rem;
}

.preview-box {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    min-height: 200px;
    background: #fafafa;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.875rem;
}

.form-actions {
    margin-top: 1.5rem;
}

.result-box {
    margin-top: 1rem;
}

.result-box .success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 4px;
    padding: 1rem;
}

.result-box .error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 4px;
    padding: 1rem;
}

.auth-required {
    text-align: center;
    padding: 2rem;
    background: #fff3e0;
    border-radius: 8px;
}

/* Upload form specific */
.upload-form {
    max-width: 600px;
}

.file-drop-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: #1976d2;
    background: #e3f2fd;
}

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

.file-drop-zone p {
    margin: 0.5rem 0;
    color: #666;
}

.file-drop-zone small {
    display: block;
    color: #999;
    font-size: 0.75rem;
}

/* Sources list */
.sources-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.source-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
}

.source-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.source-type, .source-category {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.source-type {
    background: #e3f2fd;
    color: #1565c0;
}

.source-category {
    background: #f3e5f5;
    color: #7b1fa2;
}

.source-status {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.status-pending {
    background: #fff3e0;
    color: #e65100;
}

.status-approved {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-rejected {
    background: #ffebee;
    color: #c62828;
}

.source-info {
    font-size: 0.875rem;
    color: #666;
}

.source-info p {
    margin: 0.25rem 0;
}

.source-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-danger {
    background: #d32f2f;
    color: white;
}

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

.no-items {
    text-align: center;
    color: #666;
    padding: 2rem;
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.auth-note {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
}

.github-note {
    color: #666;
    font-size: 13px;
    margin-left: 12px;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Back link */
.back-link {
    margin-bottom: 24px;
}

.back-link a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.back-link a:hover {
    color: #1a1a1a;
}

/* Contribute flow */
.contribute-flow {
    max-width: 900px;
}

.step-description {
    color: #666;
    margin-bottom: 24px;
}

/* Source input tabs */
.source-input-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.source-input-section h2 {
    margin-bottom: 8px;
}

.source-input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 12px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.15s;
}

.tab-btn:hover {
    border-color: #1976d2;
    color: #1976d2;
}

.tab-btn.active {
    background: #1976d2;
    border-color: #1976d2;
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* File info display */
.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #e3f2fd;
    border-radius: 6px;
}

.file-info .file-name {
    flex: 1;
    font-weight: 500;
}

.file-info .btn-remove {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}

.file-info .btn-remove:hover {
    color: #d32f2f;
}

/* AI conversation tab */
.ai-instructions {
    color: #333;
}

.ai-instructions p {
    margin-bottom: 16px;
}

.ai-option {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.ai-option h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #1976d2;
}

.ai-option p {
    margin: 0 0 12px;
    font-size: 14px;
}

.command-box {
    position: relative;
    background: #1a1a1a;
    border-radius: 6px;
    padding: 16px;
    padding-right: 80px;
}

.command-box code {
    display: block;
    color: #4ade80;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.command-box .btn-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 12px;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
}

.command-box .btn-copy:hover {
    background: #444;
}

.ai-option textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 12px;
}

/* Content section */
.content-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 24px;
}

.content-section h2 {
    margin-bottom: 16px;
}

.suggestion-box {
    padding: 12px 16px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.suggestion-box strong {
    color: #2e7d32;
}

/* Form row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group .optional {
    font-weight: normal;
    color: #999;
    font-size: 12px;
}

/* Drop icon */
.drop-icon {
    color: #999;
    margin-bottom: 8px;
}

/* Connection status indicator */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.connection-status.connected {
    background: #e8f5e9;
    color: #2e7d32;
}

.connection-status.not-connected {
    background: #fff3e0;
    color: #e65100;
}

.connection-status a {
    color: #1976d2;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.connected .status-dot {
    background: #4caf50;
}

.not-connected .status-dot {
    background: #ff9800;
}

/* Figma auth prompt in preview */
.preview-box.figma-auth-prompt {
    background: #fff;
    text-align: center;
    padding: 32px;
}

.preview-box.figma-auth-prompt h3 {
    margin-bottom: 12px;
    color: #1a1a1a;
}

.preview-box.figma-auth-prompt p {
    color: #666;
    margin-bottom: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.preview-box.figma-auth-prompt .btn {
    margin-bottom: 16px;
}

.preview-box.figma-auth-prompt .auth-note {
    font-size: 13px;
}

/* MCP Config page */
.intro-section .feature-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.intro-section .feature-list li {
    padding: 8px 0 8px 28px;
    position: relative;
}

.intro-section .feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: bold;
}

.config-box {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
}

.config-box pre {
    color: #4ade80;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    margin: 0;
    white-space: pre-wrap;
    background: transparent;
    padding: 0;
}

.config-box .copy-btn {
    margin-top: 16px;
}

.terminal-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1a1a1a;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
}

.terminal-box code {
    flex: 1;
    color: #4ade80;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
    background: transparent;
    padding: 0;
}

.btn-copy-small {
    padding: 4px 12px;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.btn-copy-small:hover {
    background: #444;
}

.hint {
    color: #666;
    font-size: 13px;
    margin-top: 8px;
}

.example-prompts {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.example {
    background: #f8f9fa;
    border-left: 3px solid #1976d2;
    padding: 12px 16px;
    font-style: italic;
    color: #333;
    border-radius: 0 6px 6px 0;
}

.collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapsible:hover {
    color: #1976d2;
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.collapsible-content {
    margin-top: 16px;
}

.tool-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.tool-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tool-item h4 {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 14px;
    color: #1976d2;
    margin-bottom: 4px;
}

.tool-item p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Apple Reference — 7 column grid */
.coverage-grid-apple {
    grid-template-columns: 110px repeat(7, 1fr);
}

.section-subtitle {
    color: #666;
    margin-bottom: 24px;
}
