/* MDO Target / Achievement (Yearly Target Allocation) page. Scoped under
   .tga-page - see FieldDashboard.css / TasksAllocation.css for why every
   selector here is prefixed (this stylesheet loads globally alongside
   every other page's). */

.tga-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

.tga-title {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.tga-subtitle {
    margin: 0 0 20px;
    font-size: 0.92rem;
    color: #6b7280;
}

.tga-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 20px;
    max-width: 640px;
}

.tga-card:not(.tga-form-card) {
    max-width: none;
}

.tga-card-title {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.tga-card-subtitle {
    margin: 0 0 1.25rem;
    font-size: 0.88rem;
    color: #6b7280;
}

.tga-field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.tga-required {
    color: #dc2626;
    margin-left: 2px;
}

.tga-select,
.tga-input {
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    color: #111827;
    outline: none;
}

    .tga-select:focus,
    .tga-input:focus {
        border-color: #15803d;
    }

.tga-target-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 1.1rem 0 1.5rem;
}

.tga-btn-save {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #15803d;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.85rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

    .tga-btn-save:hover:not(:disabled) {
        background: #166534;
    }

    .tga-btn-save:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* ---------- Current yearly targets table ---------- */
.tga-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tga-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

    .tga-table th {
        text-align: left;
        font-size: 0.88rem;
        font-weight: 700;
        color: #111827;
        padding: 0.9rem 0.75rem;
        border-bottom: 1px solid #e5e7eb;
        white-space: nowrap;
    }

    .tga-table th:first-child,
    .tga-table td:first-child {
        padding-left: 0;
    }

    .tga-table td {
        padding: 1rem 0.75rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.92rem;
        color: #111827;
        vertical-align: middle;
    }

    .tga-table tr:last-child td {
        border-bottom: none;
    }

.tga-jmdo-name {
    font-weight: 700;
    color: #111827;
}

.tga-jmdo-sub {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.tga-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .tga-icon-btn:hover {
        background: #f9fafb;
    }

/* ---------- Phone (<= 767.98px) ---------- */
@media (max-width: 767.98px) {
    .tga-page {
        padding-top: 12px !important;
        padding-bottom: calc(16px + var(--safe-bottom, 0px)) !important;
    }

    .tga-title {
        font-size: 1.25rem;
    }

    .tga-card {
        padding: 1.1rem 1.1rem;
    }

    .tga-target-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tga-select,
    .tga-input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .tga-btn-save {
        min-height: 44px;
    }

    /* Table becomes a stack of cards, one per JMDO, instead of a
       horizontally-scrolling grid. */
    .tga-table-scroll {
        overflow-x: visible;
    }

    .tga-table {
        min-width: 0;
    }

    .tga-table thead {
        display: none;
    }

    .tga-table,
    .tga-table tbody,
    .tga-table tr,
    .tga-table td {
        display: block;
        width: 100%;
    }

    .tga-table tr {
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 0.9rem 1rem;
        margin-bottom: 12px;
    }

    .tga-table tr:last-child {
        margin-bottom: 0;
    }

    .tga-table td {
        border-bottom: none !important;
        padding: 6px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

    .tga-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        text-align: left;
        flex-shrink: 0;
    }

    .tga-table td.tga-cell-header {
        display: block;
        text-align: left;
        padding-bottom: 10px;
        margin-bottom: 4px;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    .tga-table td.tga-cell-actions {
        display: flex;
        justify-content: flex-end;
        margin-top: 4px;
    }
}
