.create-project-page {
    padding: 2.5rem 3rem;
    background-color: #f7f7fb;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.create-project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.create-project-header h1 {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
}

.create-project-header p {
    margin: 0.35rem 0 0;
    color: #4b5563;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.ghost-icon-button {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ghost-icon-button:hover {
    background-color: #f3f4f6;
    border-color: #2563eb;
}

.icon-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.project-card {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.project-execution-card {
    padding: 1.25rem;
}

.execution-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.execution-profile-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.8rem;
    padding: 0.85rem 1rem;
    background-color: #fcfcff;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.execution-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.execution-value {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.execution-meta {
    font-size: 0.85rem;
    color: #6b7280;
}

.project-card label {
    display: block;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.4rem;
}

.project-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    border: 1px solid #d1d5db;
    font-size: 1rem;
    font-family: inherit;
}

.project-textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    background-color: #fff;
}

.project-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.project-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.section-heading h2,
.section-heading h3 {
    margin: 0;
}

.section-heading p {
    margin: 0.25rem 0 0;
    color: #4b5563;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.optional {
    background-color: #eef2ff;
    color: #4c1d95;
}

.badge.future {
    background-color: #fff7ed;
    color: #9a3412;
}

.constitution-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.constitution-field:last-child {
    margin-bottom: 0;
}

.category-chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.category-chip {
    display: flex;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.85rem;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.category-chip:hover {
    border-color: #2563eb;
}

.category-chip.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chip-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.75rem;
    background-color: #eef2ff;
    color: #1d4ed8;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.chip-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.chip-label {
    font-weight: 600;
    color: #111827;
}

.memory-options {
    display: grid;
    gap: 0.75rem;
}

.memory-option {
    border: 1px solid #d1d5db;
    border-radius: 0.85rem;
    padding: 0.9rem 1rem;
    display: flex;
    gap: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.memory-option input {
    margin-top: 0.35rem;
}

.memory-option.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.memory-copy .option-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.memory-copy p {
    margin: 0;
    color: #4b5563;
}

.memory-copy small {
    color: #6b7280;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.placeholder-card {
    background-color: #fbfbff;
    border-style: dashed;
}

.placeholder-copy {
    margin: 0 0 0.75rem 0;
    color: #4b5563;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.metadata-placeholder {
    border: 1px dashed #cbd5e1;
    border-radius: 0.65rem;
    padding: 0.6rem 0.75rem;
    color: #6b7280;
    background-color: #fff;
}

.metadata-list {
    margin: 0 0 0.75rem;
    padding-left: 1.2rem;
    color: #4b5563;
    line-height: 1.4;
}

.project-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    background-color: #fff;
    gap: 1rem;
}

.helper-copy {
    color: #4b5563;
}

.footer-actions {
    display: flex;
    gap: 0.75rem;
}

.primary-button,
.secondary-button,
.ghost-button {
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    background-color: transparent;
    font-size: 0.875rem;
    height: 38px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    transition: all 0.15s ease;
}

.primary-button {
    background-color: #111827;
    color: #fff;
    border-color: #111827;
}

.primary-button:hover:not(:disabled) {
    background-color: #1f2937;
}

.primary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-button {
    border-color: #d1d5db;
    color: #1f2937;
    background-color: #fff;
}

.secondary-button:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.secondary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ghost-button {
    border-color: #d1d5db;
    color: #1f2937;
    background-color: #fff;
}

.ghost-button:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.ghost-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.project-error-banner {
    border: 1px solid #fca5a5;
    background-color: #fef2f2;
    color: #b91c1c;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
}

.project-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    padding: 2rem 2.5rem;
    background-color: #f7f7fb;
}

.project-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.project-page-header > div:first-child {
    flex: 1;
    min-width: 280px;
}

.project-page-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.project-page-header p {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.4;
}

.project-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-thread-sections {
    display: grid;
    grid-template-columns: minmax(320px, 2fr) minmax(240px, 1fr);
    gap: 1rem;
}

.project-thread-list,
.project-thread-placeholder {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
}

.project-constitution-card {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
}

.project-constitution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.constitution-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    background-color: #fcfcff;
}

.project-execution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.execution-field-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Ensure execution dropdowns align with their trigger within project cards */
.execution-field-card .selector-control {
    position: relative;
    width: 100%;
}

.execution-field-card .selector-button {
    width: 100%;
    justify-content: space-between;
}

.execution-field-card .selector-dropdown {
    left: 0;
    right: auto;
    min-width: 100%;
}

.execution-helper-text {
    color: #6b7280;
    font-size: 0.85rem;
}

.execution-error-text {
    margin-top: 0.75rem;
    color: #b91c1c;
    font-size: 0.9rem;
}

.constitution-item h4 {
    margin: 0 0 0.35rem 0;
    font-size: 0.95rem;
    color: #111827;
}

.constitution-item p {
    margin: 0;
    font-size: 0.9rem;
    color: #4b5563;
    white-space: pre-wrap;
}

.project-thread-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.project-thread-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    padding: 0.65rem 0.75rem;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: left;
}

.project-thread-row:hover {
    background-color: #f9fafb;
}

.project-thread-row .thread-meta {
    font-size: 0.8rem;
    color: #6b7280;
}

.project-empty {
    color: #9ca3af;
    font-size: 0.9rem;
}

.project-input-panel {
    margin-top: auto;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.project-input-hint {
    font-size: 0.85rem;
    color: #6b7280;
}

.project-status {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #0f172a;
}

.project-page-loading {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
}

.project-page-error.subtle {
    border-color: #f87171;
    background-color: #fff1f2;
    color: #b91c1c;
}

.external-sources-card .secondary-button {
    margin-top: 1rem;
}

.external-source-empty {
    border: 1px dashed #d1d5db;
    border-radius: 0.85rem;
    padding: 1rem;
    color: #6b7280;
    text-align: center;
    background-color: #f9fafb;
}

.external-source-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.external-source-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.9rem;
    padding: 1rem;
    background-color: #fcfcff;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.external-source-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.external-source-card-actions {
    display: flex;
    gap: 0.35rem;
}

.external-source-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #4c1d95;
}

.external-source-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.external-source-meta {
    font-size: 0.85rem;
    color: #6b7280;
}

.github-repo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.github-repo-list li {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem;
    background-color: #fff;
}

.repo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.repo-branch {
    font-size: 0.8rem;
    color: #6b7280;
}

.artifact-roots-list {
    margin-top: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: #4b5563;
    font-size: 0.85rem;
}

.external-source-editor {
    margin-top: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
    background-color: #fdfdfd;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.editor-repos {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.github-repo-editor {
    border: 1px solid #e5e7eb;
    border-radius: 0.85rem;
    padding: 0.85rem;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.repo-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.artifact-root-editor {
    border-top: 1px solid #f3f4f6;
    padding-top: 0.65rem;
}

.editor-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.artifact-root-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.artifact-root-empty {
    color: #94a3b8;
    font-size: 0.85rem;
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.form-error {
    color: #b91c1c;
    font-size: 0.9rem;
}

.ghost-icon-button.danger {
    border-color: #fecaca;
    color: #b91c1c;
}

.ghost-icon-button.danger:hover {
    background-color: #fee2e2;
    border-color: #ef4444;
}

.editor-header h3 {
    margin: 0;
}

.drawer-danger-button {
    border: 1px solid #f87171;
    background-color: #dc2626;
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.drawer-danger-button:hover,
.drawer-danger-button:focus-visible {
    background-color: #b91c1c;
    border-color: #b91c1c;
}

.drawer-danger-button:focus-visible {
    outline: 2px solid #fecaca;
    outline-offset: 2px;
}

.drawer-danger-button:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.drawer-warning-button {
    border: 1px solid #fbbf24;
    background-color: #f59e0b;
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.drawer-warning-button:hover,
.drawer-warning-button:focus-visible {
    background-color: #d97706;
    border-color: #d97706;
}

.drawer-warning-button:focus-visible {
    outline: 2px solid #fef3c7;
    outline-offset: 2px;
}

.drawer-warning-button:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.button-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: buttonSpinnerRotate 0.8s linear infinite;
    display: inline-block;
}

@keyframes buttonSpinnerRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.drawer-secondary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.drawer-danger-actions {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 1024px) {
    .project-page {
        padding: 1.5rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .create-project-page {
        padding: 1.25rem;
    }

    .project-page {
        padding: 1.1rem 1rem;
    }

    .project-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .project-thread-sections {
        grid-template-columns: 1fr;
    }

    .project-thread-list,
    .project-constitution-card,
    .project-thread-placeholder {
        padding: 1rem;
    }

    .create-project-header {
        flex-direction: column;
    }

    .project-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Constitution modification styles */
.constitution-modification-card {
    background-color: #fef3c7;
    border-color: #fbbf24;
}

.constitution-modification-prompt {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modification-textarea {
    min-height: 80px;
}

.modification-preview-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background-color: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 0.75rem;
}

.banner-content {
    display: flex;
    gap: 0.75rem;
    flex: 1;
}

.banner-icon {
    font-size: 1.5rem;
}

.banner-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #1e3a8a;
}

.banner-content p {
    margin: 0;
    color: #1e40af;
    font-size: 0.9rem;
}

.banner-actions {
    display: flex;
    gap: 0.5rem;
}

/* Danger zone */
.project-danger-card {
    background-color: #fef2f2;
    border-color: #fecaca;
}

.danger-button {
    background-color: #dc2626;
    color: #fff;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
}

.danger-button:hover:not(:disabled) {
    background-color: #b91c1c;
}

.danger-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
