.content {
    padding: clamp(22px, 3vw, 40px);
}

.projects-page {
    width: min(100%, 1380px);
    margin: 0 auto;
}

.projects-heading,
.project-detail-heading,
.task-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.projects-heading {
    margin-bottom: 28px;
}

.projects-heading h1,
.form-heading h1,
.project-detail-heading h1 {
    font-size: clamp(30px, 4vw, 44px);
}

.projects-heading p,
.form-heading p,
.project-detail-heading p,
.task-section-heading p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.projects-eyebrow {
    margin: 0 0 8px !important;
    color: var(--sidebar-active) !important;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.projects-actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.projects-actions form {
    margin: 0;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button-primary { background: #6d28d9; color: #fff; }
.button-primary:hover { background: #5b21b6; }
.button-secondary { border-color: var(--border); background: #fff; color: var(--ink); }
.button-secondary:hover { background: #f8fafc; }
.button-danger { border-color: #fecaca; background: #fff; color: #b42318; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: 20px;
}

.project-card,
.projects-empty,
.entity-form,
.task-list {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 36px rgb(16 24 40 / 5%);
}

.project-card {
    display: flex;
    min-height: 310px;
    flex-direction: column;
    overflow: hidden;
}

.project-card-main {
    display: grid;
    grid-template-columns: 6px 1fr;
    gap: 16px;
    padding: 22px 22px 16px;
}

.project-color {
    display: inline-block;
    width: 6px;
    min-height: 42px;
    border-radius: 99px;
    background: var(--project-color);
}

.project-card h2 {
    margin: 10px 0 6px;
    font-size: 21px;
}

.project-card h2 a { color: var(--ink); text-decoration: none; }
.project-card h2 a:hover { color: #6d28d9; }
.project-card-main p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

.status-badge,
.priority {
    display: inline-flex;
    width: fit-content;
    border-radius: 99px;
    padding: 4px 9px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 750;
}

.status-completed { background: #ecfdf3; color: #027a48; }
.status-on_hold { background: #fff7ed; color: #b54708; }
.status-archived { background: #f2f4f7; color: #475467; }
.status-in_progress { background: #eff8ff; color: #175cd3; }
.priority-low { background: #f2f4f7; color: #475467; }
.priority-normal { background: #eef2ff; color: #4338ca; }
.priority-high { background: #fff7ed; color: #b54708; }
.priority-critical { background: #fef3f2; color: #b42318; }

.project-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: auto 0 0;
    padding: 0 22px 18px;
}

.project-metrics div { min-width: 0; border-left: 1px solid var(--border); padding: 0 10px; }
.project-metrics div:first-child { border-left: 0; padding-left: 0; }
.project-metrics dt { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.project-metrics dd { margin: 5px 0 0; font-size: 18px; font-weight: 750; }

.project-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    border-top: 1px solid var(--border);
    padding: 14px 22px;
    color: var(--muted);
    font-size: 12px;
}

.project-card-footer a { margin-left: auto; color: #6d28d9; font-weight: 750; text-decoration: none; }
.projects-empty { padding: clamp(36px, 7vw, 72px); text-align: center; }
.projects-empty h2, .projects-empty h3 { margin: 0; }
.projects-empty p { margin: 8px 0 0; color: var(--muted); }
.projects-empty.compact { padding: 42px; }

.back-link { display: inline-block; margin-bottom: 18px; color: #6d28d9; font-weight: 700; text-decoration: none; }
.form-page { max-width: 880px; }
.form-heading { margin-bottom: 24px; }
.entity-form { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: clamp(22px, 4vw, 36px); }
.form-field { min-width: 0; }
.form-span, .entity-form > .palette-field { grid-column: 1 / -1; }
.form-field label, .form-field legend { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.form-field input:not([type="radio"]), .form-field textarea, .form-field select {
    width: 100%; min-height: 44px; border: 1px solid #cbd5e1; border-radius: 9px; padding: 10px 12px; background: #fff; color: var(--ink); font: inherit;
}
.form-field textarea { resize: vertical; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: #7c3aed; outline: 3px solid rgb(124 58 237 / 15%); }
.field-error { margin: 6px 0 0; color: #b42318; font-size: 13px; }
.palette-field, .duration-field { margin: 0; border: 0; padding: 0; }
.color-palette { display: flex; flex-wrap: wrap; gap: 12px; }
.color-choice { margin: 0 !important; cursor: pointer; }
.color-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.color-choice span:not(.visually-hidden) { display: block; width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50%; background: var(--choice-color); box-shadow: 0 0 0 1px #cbd5e1; }
.color-choice input:checked + span { box-shadow: 0 0 0 3px #111827; }
.color-choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.duration-field > div { display: grid; grid-template-columns: auto minmax(80px, 140px) auto minmax(80px, 140px); align-items: center; gap: 10px; }
.duration-field label { margin: 0; }
.form-actions { justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 20px; }

.notice { margin-bottom: 20px; border: 1px solid #abefc6; border-radius: 10px; padding: 12px 15px; background: #ecfdf3; color: #067647; }
.project-detail-heading { border: 1px solid var(--border); border-radius: 16px; padding: clamp(22px, 4vw, 36px); background: #fff; }
.project-detail-heading > div:first-child { position: relative; padding-left: 22px; }
.project-detail-heading .project-color { position: absolute; inset: 0 auto 0 0; }
.project-detail-heading p:last-child { max-width: 760px; }
.task-section-heading { align-items: center; margin: 34px 0 14px; }
.task-section-heading h2 { margin: 0; font-size: 24px; }
.task-filters {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) repeat(4, minmax(130px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}
.filter-field { min-width: 0; }
.filter-field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-field input, .filter-field select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
.filter-field input:focus, .filter-field select:focus {
    border-color: #7c3aed;
    outline: 3px solid rgb(124 58 237 / 15%);
}
.hide-completed {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    align-self: center;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}
.hide-completed input { width: 18px; height: 18px; accent-color: #6d28d9; }
.filter-actions { display: flex; grid-column: 2 / -1; align-items: center; justify-content: flex-end; gap: 16px; }
.filter-actions a { color: #6d28d9; font-size: 14px; font-weight: 700; }
.task-sort-table { margin-bottom: 10px; overflow-x: auto; }
.task-sort-row { display: flex; width: max-content; min-width: 100%; align-items: center; gap: 7px; }
.task-sort-label { margin-right: 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.task-sort-column a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 6px 10px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.task-sort-column a:hover { border-color: #c4b5fd; color: #5b21b6; }
.task-sort-column.is-active a { border-color: #c4b5fd; background: #f5f3ff; color: #5b21b6; }
.task-list { overflow: hidden; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 24px; border-top: 1px solid var(--border); padding: 18px 22px; }
.task-row:first-child { border-top: 0; }
.task-labels { display: flex; flex-wrap: wrap; gap: 7px; }
.task-row h3 { margin: 9px 0 0; font-size: 17px; }
.task-row-main p { overflow: hidden; margin: 5px 0 0; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; gap: 22px; margin: 0; }
.task-meta dt { color: var(--muted); font-size: 11px; }
.task-meta dd { margin: 4px 0 0; font-size: 13px; font-weight: 650; }
.task-edit { color: #6d28d9; font-weight: 700; text-decoration: none; }

@media (max-width: 900px) {
    .project-metrics { grid-template-columns: repeat(2, 1fr); gap: 14px 0; }
    .project-metrics div:nth-child(3) { border-left: 0; padding-left: 0; }
    .task-row { grid-template-columns: 1fr auto; }
    .task-meta { grid-column: 1 / -1; }
    .task-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-actions { grid-column: auto; }
}

@media (max-width: 640px) {
    .projects-heading, .project-detail-heading, .task-section-heading { flex-direction: column; }
    .projects-actions { width: 100%; flex-wrap: wrap; }
    .projects-actions .button, .projects-actions form, .projects-actions form .button { flex: 1; }
    .entity-form { grid-template-columns: 1fr; }
    .form-field, .form-span { grid-column: 1; }
    .task-row { grid-template-columns: 1fr; }
    .task-meta { grid-column: auto; flex-wrap: wrap; gap: 14px 22px; }
    .task-edit { justify-self: start; }
    .duration-field > div { grid-template-columns: auto 1fr; }
    .task-filters { grid-template-columns: 1fr; }
    .filter-actions { grid-column: 1; justify-content: space-between; }
}
