/**
 * Project edit / list UI (themeable; dark overrides in fcms-theme.css)
 */

.project-page-head {
    margin: 0 0 14px;
}
.project-page-head h2 {
    margin-bottom: 6px;
}
.project-page-nav {
    margin: 0 0 8px;
}
.project-list-block {
    max-width: min(1600px, 100%);
    margin: 0 0 20px;
}
.project-list-heading {
    margin: 0 0 6px;
    border: none;
}
.project-list-block table.data {
    width: 100%;
}
.project-form-block {
    max-width: min(720px, 100%);
    margin: 20px 0 8px;
    padding: 14px 16px;
    border: 1px solid var(--fc-border);
    border-radius: 8px;
    background: var(--fc-panel-2);
    box-sizing: border-box;
    color: var(--fc-body);
}
.project-form-block h3 {
    margin-top: 0;
    border: none;
}
.project-edit-form {
    max-width: none;
}
.project-panel-title {
    display: block;
    margin-bottom: 2px;
}

/* ---------- Project hub (edit mode — less scrolling) ---------- */
.project-hub {
    max-width: min(960px, 100%);
    margin: 0 0 20px;
    padding: 14px 16px 16px;
    border: 1px solid var(--fc-border);
    border-radius: 10px;
    background: var(--fc-panel-2);
    box-sizing: border-box;
    color: var(--fc-body);
}
.project-hub-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 4px;
}
.project-hub-title h3 {
    margin: 0 0 4px;
    border: none;
    font-size: 1.2rem;
}
.project-hub-name {
    font-weight: 500;
    color: var(--fc-muted);
}
.project-hub-meta {
    margin: 0;
    font-size: 14px;
    color: var(--fc-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}
.project-hub-meta-dot { color: var(--fc-muted); }
.project-hub-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.project-hub-status-form {
    display: inline;
    margin: 0;
}
.project-hub-status-form .btn {
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    vertical-align: middle;
}
.project-hub-on { color: #1a6b2e; font-weight: 600; }
.project-hub-off { color: #a60; font-weight: 600; }
.project-hub-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.project-hub-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    padding: 12px 12px 10px;
    min-height: 72px;
    border: 1px solid var(--fc-border-strong);
    border-radius: 8px;
    background: var(--fc-white);
    color: var(--fc-ink);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.project-hub-tile:hover,
.project-hub-tile:focus-visible {
    border-color: var(--fc-primary);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--fc-primary) 20%, transparent);
    outline: none;
}
a.project-hub-tile-link:hover {
    text-decoration: none;
}
.project-hub-tile-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--fc-link);
}
.project-hub-tile-stat {
    font-size: 12px;
    line-height: 1.35;
    color: var(--fc-muted);
}

/* ---------- Section modals ---------- */
body.project-modal-open {
    overflow: hidden;
}
.project-modal[hidden] {
    display: none !important;
}
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.project-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 30, 45, 0.5);
}
.project-modal-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: min(90vh, 900px);
    background: var(--fc-white);
    border: 1px solid var(--fc-border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    color: var(--fc-body);
}
.project-modal-panel-wide {
    width: min(960px, 100%);
}
.project-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--fc-border);
    background: var(--fc-panel-2);
    flex-shrink: 0;
}
.project-modal-header h3 {
    margin: 0;
    border: none;
    font-size: 1.1rem;
    color: var(--fc-ink);
}
.project-modal-close {
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--fc-muted);
    padding: 0 4px;
}
.project-modal-close:hover {
    color: var(--fc-ink);
}
.project-modal-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 14px 16px 20px;
    -webkit-overflow-scrolling: touch;
}
.project-modal-body .project-section,
.project-modal-body.project-section-tasks,
.project-modal-body.project-section-pos {
    max-width: none;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.project-panel {
    max-width: min(1600px, 100%);
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--fc-border-strong);
    border-radius: 8px;
    background: var(--fc-panel-2);
    color: inherit;
    box-sizing: border-box;
}

.project-panel.project-panel-info {
    border-color: var(--fc-border-strong);
    background: var(--fc-panel-2);
}

.project-panel ul {
    margin: 6px 0 0;
    padding-left: 1.2em;
}

/* Section blocks under project edit form */
.project-section {
    max-width: min(1600px, 100%);
    border-top: 2px solid var(--fc-border);
    margin-top: 28px;
    padding-top: 16px;
}

.project-section.project-section-sm {
    max-width: min(960px, 100%);
}

.project-section.project-section-tasks {
    max-width: min(1600px, 100%);
}

.project-section.project-section-pos {
    max-width: min(1600px, 100%);
}

@media (min-width: 1600px) {
    .project-panel,
    .project-section,
    .project-section.project-section-tasks,
    .project-section.project-section-pos {
        max-width: min(1800px, 100%);
    }
}

/* Machine multi-select list */
.machine-checkboxes {
    max-width: 480px;
    border: 1px solid var(--fc-border);
    padding: 10px;
    border-radius: 6px;
    max-height: 200px;
    overflow: auto;
    background: var(--fc-panel);
    box-sizing: border-box;
}

.machine-checkboxes label {
    display: block;
    font-weight: 500;
    margin: 4px 0;
    color: inherit;
}

.project-active-warn {
    color: #a60;
    max-width: 520px;
}

.task-completion-result {
    display: inline-block;
    margin-top: 4px;
    padding: 6px 8px;
    background: var(--fc-panel-2);
    border: 1px solid var(--fc-border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #1a3a1a;
    max-width: 100%;
    word-break: break-word;
}

.task-prompt-hint em {
    color: var(--fc-muted);
}

/* Task complete modal (shared with week.php patterns).
 * Must stack above .project-modal (10030) when Complete is clicked from the Tasks hub. */
.fcms-task-complete-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcms-task-complete-modal[hidden] {
    display: none !important;
}

.fcms-task-complete-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 30, 45, 0.45);
}

.fcms-task-complete-card {
    position: relative;
    z-index: 1;
    width: min(440px, 94vw);
    background: var(--fc-white);
    border-radius: 10px;
    padding: 18px 18px 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--fc-border);
    color: inherit;
}

.fcms-task-complete-card h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    border: none;
}

.fcms-task-complete-desc {
    margin: 0 0 12px;
    color: var(--fc-muted);
    font-size: 0.95rem;
}

.fcms-task-complete-label {
    display: block;
    font-weight: 600;
    margin: 0 0 6px;
    font-size: 0.92rem;
}

.fcms-task-complete-notes {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 16px;
    padding: 8px 10px;
    border: 1px solid var(--fc-border-strong);
    border-radius: 6px;
    min-height: 88px;
    resize: vertical;
}

.fcms-task-complete-hint {
    margin: 6px 0 12px;
    font-size: 0.85rem;
}

.fcms-task-complete-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

body.fcms-task-complete-open {
    overflow: hidden;
}

.project-section-heading {
    margin: 14px 0 6px;
    font-size: 1rem;
    border: none;
}

@media (max-width: 640px) {
    .machine-checkboxes {
        max-width: 100%;
    }
    .project-section,
    .project-section.project-section-sm,
    .project-section.project-section-tasks,
    .project-section.project-section-pos {
        max-width: 100%;
    }
}

/* Week / job-workspace task detail modal */
.week-task-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 240;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.week-task-detail-modal[hidden] {
    display: none !important;
}
.week-task-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 22, 28, 0.45);
}
.week-task-detail-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: min(90vh, 720px);
    overflow: auto;
    background: var(--fc-white);
    border: 1px solid var(--fc-border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    padding: 18px 18px 16px;
}
.week-task-detail-card h3 {
    margin: 0 28px 6px 0;
    font-size: 1.2rem;
    border: none;
    padding: 0;
}
.week-task-detail-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--fc-muted);
    padding: 0 4px;
}
.week-task-detail-status {
    margin: 0 0 12px;
}
.week-task-detail-meta {
    margin: 0 0 14px;
    font-size: 0.92rem;
    color: var(--fc-muted);
    line-height: 1.45;
}
.week-task-detail-meta strong {
    color: var(--fc-ink);
}
.week-task-detail-result {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--fc-panel-2);
    border: 1px solid var(--fc-border);
    border-radius: 8px;
    font-size: 0.92rem;
}
.week-task-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--fc-border);
}
.week-task-detail-actions form {
    display: inline;
    margin: 0;
}
.week-task-detail-edit label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin: 8px 0 3px;
}
.week-task-detail-edit input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    padding: 7px 9px;
    border: 1px solid var(--fc-border-strong);
    border-radius: 6px;
}
.week-task-detail-edit .edit-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
body.week-task-detail-open {
    overflow: hidden;
}
tr.task-row-clickable {
    cursor: pointer;
}
tr.task-row-clickable:hover td {
    background: rgba(26, 90, 154, 0.06);
}
