/* My Reports page. Scoped under .fr-page - see FieldDashboard.css /
   TasksAllocation.css for why every selector here is prefixed (this
   stylesheet loads globally alongside every other page's). */

.fr-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

.fr-title {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.fr-subtitle {
    margin: 0 0 20px;
    font-size: 0.92rem;
    color: #6b7280;
}

/* ---------- Stat cards ---------- */
.fr-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.fr-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #cbd5e1;
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
}

.fr-stat-completed {
    border-left-color: #16a34a;
    background: linear-gradient(135deg, #ecfdf5, #ffffff);
}

.fr-stat-closetime {
    border-left-color: #d97706;
    background: linear-gradient(135deg, #fef3e2, #ffffff);
}

.fr-stat-soil {
    border-left-color: #0f766e;
    background: linear-gradient(135deg, #f0fdfa, #ffffff);
}

.fr-stat-farmers {
    border-left-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.fr-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.fr-stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.fr-stat-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.fr-stat-completed .fr-stat-icon { color: #16a34a; }
.fr-stat-closetime .fr-stat-icon { color: #d97706; }
.fr-stat-soil .fr-stat-icon { color: #0f766e; }
.fr-stat-farmers .fr-stat-icon { color: #2563eb; }

.fr-stat-number {
    font-size: 1.9rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.fr-stat-desc {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

/* ---------- Activity table ---------- */
.fr-table-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.5rem 1.5rem;
}

.fr-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.fr-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

    .fr-table th {
        text-align: left;
        font-size: 0.9rem;
        font-weight: 700;
        color: #111827;
        padding: 1rem 0.75rem;
        border-bottom: 1px solid #e5e7eb;
        white-space: nowrap;
    }

    .fr-table th:first-child,
    .fr-table td:first-child {
        padding-left: 0;
    }

    .fr-table td {
        padding: 1rem 0.75rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.9rem;
        color: #111827;
        vertical-align: top;
    }

    .fr-table tr:last-child td {
        border-bottom: none;
    }

.fr-cell-date {
    white-space: nowrap;
    color: #374151;
}

.fr-cell-task {
    min-width: 220px;
}

.fr-type-pill {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 14px;
    padding: 4px 12px;
    white-space: nowrap;
}

.fr-type-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.fr-type-teal {
    background: #ccfbf1;
    color: #0f766e;
}

.fr-type-orange {
    background: #ffedd5;
    color: #c2410c;
}

.fr-type-green {
    background: #dcfce7;
    color: #15803d;
}

.fr-outcome {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.fr-outcome-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fr-outcome-completed {
    color: #15803d;
}

    .fr-outcome-completed .fr-outcome-dot {
        background: #15803d;
    }

.fr-outcome-partial {
    color: #c2662a;
}

    .fr-outcome-partial .fr-outcome-dot {
        background: #c2662a;
    }

/* ---------- Tablet (768px - 1199.98px) ---------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .fr-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ---------- Phone (<= 767.98px) ---------- */
@media (max-width: 767.98px) {
    .fr-page {
        padding-top: 12px !important;
        padding-bottom: calc(16px + var(--safe-bottom, 0px)) !important;
    }

    .fr-title {
        font-size: 1.25rem;
    }

    .fr-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .fr-stat-card {
        padding: 0.85rem 0.9rem;
    }

    .fr-stat-number {
        font-size: 1.5rem;
    }

    .fr-stat-label {
        font-size: 0.78rem;
    }

    .fr-stat-icon {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .fr-table-card {
        padding: 0.5rem 1rem;
    }

    /* Table becomes a stack of cards, one per task, instead of a
       horizontally-scrolling grid. The row uses flex (not plain block) so
       the Task cell - 2nd in the DOM/desktop column order - can be moved
       to the top of the card via "order" without touching desktop layout. */
    .fr-table-scroll {
        overflow-x: visible;
    }

    .fr-table {
        min-width: 0;
    }

    .fr-table thead {
        display: none;
    }

    .fr-table,
    .fr-table tbody {
        display: block;
        width: 100%;
    }

    .fr-table tr {
        display: flex;
        flex-direction: column;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 0.9rem 1rem;
        margin-bottom: 12px;
    }

    .fr-table tr:last-child {
        margin-bottom: 0;
    }

    .fr-table td {
        border-bottom: none !important;
        padding: 6px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

    .fr-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        text-align: left;
        flex-shrink: 0;
    }

    .fr-table td.fr-cell-header {
        order: -1;
        display: block;
        text-align: left;
        padding-bottom: 10px;
        margin-bottom: 4px;
        border-bottom: 1px solid #f1f5f9 !important;
    }
}

@media (max-width: 420px) {
    .fr-stats-grid {
        grid-template-columns: 1fr;
    }
}
