* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f5f6f8;
    color: #1a1a1a;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #1f2937;
    color: white;
}

.topbar a {
    color: white;
    margin-left: 1rem;
}

.user-info { display: flex; align-items: center; gap: 1rem; }

.content { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }

.login-box {
    max-width: 400px;
    margin: 4rem auto;
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

select {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    background: #2563eb;
    color: white;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:disabled { background: #9ca3af; cursor: not-allowed; }

.actions { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }

.results, .codes-panel { margin-top: 1rem; }

.message { padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 0.5rem; }
.message-user { background: #e0e7ff; }
.message-assistant { background: #dcfce7; }
.message .role { font-weight: bold; font-size: 0.8rem; text-transform: uppercase; }

.error { background: #fee2e2; color: #991b1b; padding: 0.75rem 1rem; border-radius: 6px; }

.summary { line-height: 1.5; }
.summary h1, .summary h2, .summary h3, .summary h4, .summary h5, .summary h6 {
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}
.summary h1:first-child, .summary h2:first-child, .summary h3:first-child,
.summary h4:first-child, .summary h5:first-child, .summary h6:first-child {
    margin-top: 0;
}
/* Cap heading sizes to the modal's scale — LLM summaries may use any level
   (including a top-level #), and a full-size <h1> is oversized here. */
.summary h1, .summary h2 { font-size: 1.15rem; }
.summary h3 { font-size: 1.05rem; }
.summary h4, .summary h5, .summary h6 { font-size: 1rem; }
.summary p { margin: 0 0 0.75rem; }
.summary ul, .summary ol { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.summary li { margin-bottom: 0.25rem; }
.summary code { background: #f3f4f6; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }
.summary pre { background: #f3f4f6; padding: 0.75rem; border-radius: 6px; overflow-x: auto; margin: 0 0 0.75rem; }
.summary pre code { background: none; padding: 0; }
.summary blockquote { border-left: 3px solid #d1d5db; margin: 0 0 0.75rem; padding-left: 0.75rem; color: #555; }
.summary a { color: #2563eb; }

.spinner { font-style: italic; color: #555; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 560px) {
    .project-grid { grid-template-columns: 1fr; }
}

.project-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    min-width: 0;
    overflow-wrap: break-word;
}

.project-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.project-name { margin: 0 0 0.5rem; overflow-wrap: break-word; }
.project-desc { color: #555; margin: 0 0 1rem; overflow-wrap: break-word; }

.project-stats {
    display: flex;
    list-style: none;
    padding: 0.75rem 0 0;
    margin: 0;
    border-top: 1px solid #e5e7eb;
}
.project-stats li {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    text-align: center;
}
.project-stats li + li { border-left: 1px solid #e5e7eb; }
.project-stats .stat-num { font-weight: bold; font-size: 1.25rem; color: #1f2937; }
.project-stats .stat-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.interviews-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.interviews-table th, .interviews-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.interviews-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #555;
}

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.85rem; margin-right: 0.4rem; }

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: bold;
    background: #e5e7eb;
    color: #374151;
}
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dcfce7; color: #166534; }

.back-link { color: #2563eb; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.muted { color: #9ca3af; }
.empty-state { color: #555; font-style: italic; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-title { margin: 0; font-size: 1.1rem; }

.modal-header-actions { display: flex; align-items: center; gap: 1rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #555;
}

.modal-body { padding: 1rem; overflow-y: auto; }
