:root {
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --brand: #0d6efd;
    --brand-soft: #e7f1ff;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
}

body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(13, 110, 253, 0.12), transparent 32%),
                linear-gradient(180deg, #f8fbff 0%, #eef2f8 100%);
    color: var(--text);
}

.custom-navbar {
    /* lighter gray header for improved contrast with logo */
    background: linear-gradient(0deg, #f3f4f6 0%, #f3f4f6 100%);
    border-bottom: 1px solid #e5e7eb;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Ensure the brand does not grow so large that it overlaps nav links. */
.custom-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-right: 1rem;
}

/* Allow the brand text to show fully on larger screens, but truncate on small screens */
.custom-navbar .navbar-brand span {
    display: inline-block;
    max-width: none;
    /* allow the full site name to display; avoid truncation */
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

/* Make header text and nav links black for better contrast */
.custom-navbar .navbar-brand,
.custom-navbar .navbar-brand span,
.custom-navbar .nav-link,
.custom-navbar .navbar-text {
    color: #000 !important;
}

.custom-navbar .nav-link:hover,
.custom-navbar .nav-link:focus {
    color: #111 !important;
}

.brand-logo {
    max-height: 40px;
    width: auto;
}

/* Slightly reduce logo on smaller screens so the label and tabs don't overlap */
@media (min-width: 992px) {
    .brand-logo { max-height: 36px; }
}

/* Make sure the collapse area grows to take remaining space and prevent overlap */
.custom-navbar .container-fluid {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Center the main nav (the left-middle list) so tabs sit between brand and auth links. */
.custom-navbar .navbar-nav.me-auto {
    margin-left: auto;
    margin-right: auto;
}

.custom-navbar .collapse.navbar-collapse {
    flex-grow: 1;
}

.main-content {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.card,
.card .card-body,
.card .card-footer,
.card .card-header {
    border-radius: 1.25rem;
}

.card {
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 1.25rem 2rem rgba(15, 23, 42, 0.12);
}

.card-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: var(--surface-soft);
    font-weight: 700;
}

.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-outline-primary {
    border-radius: 999px;
}

.table {
    background: var(--surface);
    border-radius: 1rem;
}

.table thead {
    background: rgba(13, 110, 253, 0.07);
}

.table th,
.table td {
    vertical-align: middle;
}

.table-responsive {
    overflow: hidden;
    border-radius: 1rem;
}

.form-label {
    font-weight: 600;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: 0.85rem;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(13, 110, 253, 0.5);
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.12);
}

.badge {
    border-radius: 1rem;
    padding: 0.5rem 0.9rem;
    font-weight: 600;
}

.status-select {
    min-width: 160px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    font-weight: 600;
    padding-right: 2.25rem;
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    color: #111827;
}

.status-select option {
    background-color: #f8fafc;
    color: #111827;
}

.status-select option:checked,
.status-select option:hover {
    background: linear-gradient(0deg, #e2e8f0 0%, #e2e8f0 100%);
    color: #111827;
}

.status-select.status-lead {
    background-color: #f9d5e5;
    color: #5d103d;
    border-color: #eea4c8;
}

.status-select.status-upcoming {
    background-color: #f9e79f;
    color: #5b4c00;
    border-color: #e7cf58;
}

.status-select.status-planning {
    background-color: #f7f1d0;
    color: #4d3d0a;
    border-color: #ebdc9d;
}

.status-select.status-inprogress {
    background-color: #cfeecf;
    color: #14532d;
    border-color: #8cc896;
}

.status-select.status-behind-schedule {
    background-color: #f8c7c7;
    color: #6b1d1d;
    border-color: #e06a6a;
}

.status-select.status-complete {
    background-color: #142c5d;
    color: #f8fafc;
    border-color: #0f1d3d;
}

.status-select.status-archived {
    background-color: #d1d5db;
    color: #1f2937;
    border-color: #9ca3af;
}

.status-form {
    min-width: 180px;
}

.visibility-select {
    min-width: 190px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.82rem;
}

.visibility-select.visibility-public {
    background-color: #e6f6ea;
    color: #14532d;
    border-color: #a7d9b5;
}

.visibility-select.visibility-private {
    background-color: #f1f2f4;
    color: #374151;
    border-color: #cbd2d9;
}

.project-grid {
    margin-top: 0.5rem;
}

.project-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.5rem;
    padding: 1.2rem;
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.project-card__eyebrow {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.project-card__title-block h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.project-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.25rem;
    font-size: 0.84rem;
    color: var(--muted);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.project-card__scope {
    background: linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1.1rem;
    padding: 0.9rem;
}

.project-card__scope-header,
.project-card__media-header,
.project-card__logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.project-card__scope-label,
.project-card__media-header span,
.project-card__logs-header span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
}

.project-card__scope-header strong {
    display: block;
    font-size: 0.96rem;
    margin-top: 0.15rem;
}

.project-card__scope-preview {
    width: 100%;
    height: 180px;
    border: 1px solid #dfe7f2;
    border-radius: 0.9rem;
    background: white;
    overflow: hidden;
}

.pdf-preview {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.pdf-preview__canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.project-card__scope-preview-text {
    max-height: 180px;
    overflow: hidden;
    background: white;
    border: 1px solid #dfe7f2;
    border-radius: 0.9rem;
    padding: 0.8rem;
    color: #334155;
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.project-card__scope-empty,
.project-card__empty-media {
    padding: 0.9rem;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.6);
    color: var(--muted);
    font-size: 0.9rem;
}

.project-card__media {
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1rem;
    padding: 0.9rem;
}

.project-card__photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.project-card__photo-grid img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.project-card__logs {
    background: rgba(248, 250, 252, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1rem;
    padding: 0.9rem;
}

.project-card__logs ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.7rem;
}

.project-card__logs li {
    background: white;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0.8rem;
    padding: 0.7rem 0.8rem;
    display: grid;
    gap: 0.25rem;
}

.log-date {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--muted);
}

.log-copy {
    color: #334155;
    font-size: 0.82rem;
    line-height: 1.5;
}

.project-card__actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.35rem;
}

.project-card__media-header a,
.project-card__logs-header a,
.project-card__scope-header a {
    font-size: 0.8rem;
    color: var(--brand);
    text-decoration: none;
}

.list-group-item {
    border: none;
    border-radius: 1rem;
    background: var(--surface);
}

.alert {
    border-radius: 1rem;
}

.comment-bubble {
    background: var(--surface-soft);
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
}

.comment-bubble strong {
    color: var(--text);
}

.comment-bubble small {
    color: var(--muted);
}

.spinner-overlay {
    background-color: rgba(15, 23, 42, 0.55);
}

.gantt-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gantt-row-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gantt-row-title {
    font-weight: 700;
}

.gantt-bar-wrapper {
    position: relative;
    background: #eef2f8;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    min-height: 56px;
    overflow: hidden;
}

.gantt-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 1rem;
    color: #fff;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    font-weight: 700;
}

.gantt-link-handle {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #0f172a;
    transform: translateY(-50%);
    z-index: 4;
    cursor: crosshair;
}

.gantt-link-handle-start { left: -6px; }
.gantt-link-handle-end { right: -6px; }
.gantt-link-handle.dragging { background: #0d6efd; box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2); }

.gantt-color-choice {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.modal-content {
    border-radius: 1.25rem;
}

.footer {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

@media (max-width: 768px) {
    .navbar-brand span {
        display: none;
    }
}

/* On medium and larger screens reduce logo slightly so long site names fit */
@media (min-width: 768px) {
    .brand-logo { max-height: 34px; }
}
